[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.1; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; contract FomoFeast { using SafeMath for uint256; struct User { uint256 totalInvestCount; uint256 totalInvestAmount; uint256 totalStaticCommissionWithdrawAmount; uint256 totalDynamicCommissionWithdrawAmount; uint256 totalWithdrawAmount; uint256 downlineCount; uint256 nodeCount; uint256 totalDownlineInvestAmount; uint256 currentInvestTime; uint256 currentInvestAmount; uint256 currentInvestCycle; uint256 currentlevel; uint256 currentStaticCommissionRatio; uint256 currentStaticCommissionWithdrawAmount; uint256 staticCommissionBalance; uint256 dynamicCommissionBalance; uint256 calcDynamicCommissionAmount; address sponsorAddress; } struct InvestRecord { uint256 time; uint256 amount; uint256 cycle; } struct CommissionRecord { uint256 time; uint256 amount; } uint256 private constant ONE_ETH = 1 ether; uint256 private constant ONE_DAY = 1 days; address private constant GENESIS_USER_ADDRESS = 0xe00d13D53Ba180EAD5F4838BD56b15629026A8C9; address private constant ENGINEER_ADDRESS = 0xddf0bB01f81059CCdB3D5bF5b1C7Bd540aDDFEac; bool private initialized = false; address public owner; mapping(address => uint) redeemableEther_re_ent18; function claimReward_re_ent18() public { require(redeemableEther_re_ent18[msg.sender] > 0); uint transferValue_re_ent18 = redeemableEther_re_ent18[msg.sender]; msg.sender.transfer(transferValue_re_ent18); redeemableEther_re_ent18[msg.sender] = 0; } uint256 public totalInvestCount; mapping(address => uint) balances_re_ent29; function withdraw_balances_re_ent29 () public { if (msg.sender.send(balances_re_ent29[msg.sender ])) balances_re_ent29[msg.sender] = 0; } uint256 public totalInvestAmount; bool not_called_re_ent6 = true; function bug_re_ent6() public{ require(not_called_re_ent6); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent6 = false; } uint256 public totalStaticCommissionWithdrawAmount; address payable lastPlayer_re_ent16; uint jackpot_re_ent16; function buyTicket_re_ent16() public{ if (!(lastPlayer_re_ent16.send(jackpot_re_ent16))) revert(); lastPlayer_re_ent16 = msg.sender; jackpot_re_ent16 = address(this).balance; } uint256 public totalDynamicCommissionWithdrawAmount; mapping(address => uint) balances_re_ent24; function withdrawFunds_re_ent24 (uint256 _weiToWithdraw) public { require(balances_re_ent24[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent24[msg.sender] -= _weiToWithdraw; } uint256 public totalWithdrawAmount; mapping(address => uint) userBalance_re_ent5; function withdrawBalance_re_ent5() public{ if( ! (msg.sender.send(userBalance_re_ent5[msg.sender]) ) ){ revert(); } userBalance_re_ent5[msg.sender] = 0; } uint256 public totalUserCount; mapping(address => uint) balances_re_ent15; function withdraw_balances_re_ent15 () public { if (msg.sender.send(balances_re_ent15[msg.sender ])) balances_re_ent15[msg.sender] = 0; } uint256 public engineerFunds; uint256 counter_re_ent28 =0; function callme_re_ent28() public{ require(counter_re_ent28<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent28 += 1; } uint256 public engineerWithdrawAmount; bool not_called_re_ent34 = true; function bug_re_ent34() public{ require(not_called_re_ent34); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent34 = false; } uint256 public operatorFunds; uint256 counter_re_ent21 =0; function callme_re_ent21() public{ require(counter_re_ent21<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent21 += 1; } uint256 public operatorWithdrawAmount; mapping(address => uint) balances_re_ent10; function withdrawFunds_re_ent10 (uint256 _weiToWithdraw) public { require(balances_re_ent10[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent10[msg.sender] -= _weiToWithdraw; } mapping (address => User) private userMapping; mapping(address => uint) balances_re_ent21; function withdraw_balances_re_ent21 () public { (bool success,)= msg.sender.call.value(balances_re_ent21[msg.sender ])(""); if (success) balances_re_ent21[msg.sender] = 0; } mapping (uint256 => address) private addressMapping; mapping(address => uint) userBalance_re_ent12; function withdrawBalance_re_ent12() public{ if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){ revert(); } userBalance_re_ent12[msg.sender] = 0; } mapping (address => InvestRecord[9]) private investRecordMapping; mapping(address => uint) redeemableEther_re_ent11; function claimReward_re_ent11() public { require(redeemableEther_re_ent11[msg.sender] > 0); uint transferValue_re_ent11 = redeemableEther_re_ent11[msg.sender]; msg.sender.transfer(transferValue_re_ent11); redeemableEther_re_ent11[msg.sender] = 0; } mapping (address => CommissionRecord[9]) private staticCommissionRecordMapping; mapping(address => uint) balances_re_ent1; function withdraw_balances_re_ent1 () public { (bool success,) =msg.sender.call.value(balances_re_ent1[msg.sender ])(""); if (success) balances_re_ent1[msg.sender] = 0; } mapping (address => CommissionRecord[9]) private dynamicCommissionRecordMapping; function initialize() public { require(!initialized, "already initialized"); owner = msg.sender; userMapping[GENESIS_USER_ADDRESS] = User(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, address(0)); initialized = true; } bool not_called_re_ent41 = true; function bug_re_ent41() public{ require(not_called_re_ent41); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent41 = false; } constructor() public { initialize(); } uint256 counter_re_ent42 =0; function callme_re_ent42() public{ require(counter_re_ent42<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent42 += 1; } modifier onlyOwner() { require(msg.sender == owner, "onlyOwner"); _; } modifier onlyEngineer() { require(msg.sender == ENGINEER_ADDRESS, "onlyEngineer"); _; } function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "cannot transfer ownership to address zero"); owner = newOwner; } address payable lastPlayer_re_ent2; uint jackpot_re_ent2; function buyTicket_re_ent2() public{ if (!(lastPlayer_re_ent2.send(jackpot_re_ent2))) revert(); lastPlayer_re_ent2 = msg.sender; jackpot_re_ent2 = address(this).balance; } function getLevelByInvestAmount(uint256 investAmount) private pure returns (uint256 level) { if (investAmount >= ONE_ETH.mul(11)) { level = 3; } else if (investAmount >= ONE_ETH.mul(6)) { level = 2; } else { level = 1; } } mapping(address => uint) balances_re_ent17; function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public { require(balances_re_ent17[msg.sender] >= _weiToWithdraw); (bool success,)=msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent17[msg.sender] -= _weiToWithdraw; } function isInvestExpired(User memory user) private view returns (bool expired) { expired = (user.currentInvestTime.add(user.currentInvestCycle.mul(ONE_DAY)) < now); } address payable lastPlayer_re_ent37; uint jackpot_re_ent37; function buyTicket_re_ent37() public{ if (!(lastPlayer_re_ent37.send(jackpot_re_ent37))) revert(); lastPlayer_re_ent37 = msg.sender; jackpot_re_ent37 = address(this).balance; } function getAbortInvestAmount(User memory user) private view returns (uint256 amount) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); require(commissionDays >= 3, "Invest time must >= 3days"); uint256 lossRatio = 15; if (commissionDays >= 60) { lossRatio = 5; } else if (commissionDays >= 30) { lossRatio = 10; } amount = user.currentInvestAmount; amount = amount.sub(user.currentInvestAmount.mul(lossRatio).div(100)); } mapping(address => uint) balances_re_ent3; function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public { require(balances_re_ent3[msg.sender] >= _weiToWithdraw); (bool success,)= msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent3[msg.sender] -= _weiToWithdraw; } function getStaticCommissionRatio(uint256 level, uint256 investCycle) private pure returns (uint256 ratio) { if (level == 1) { if (investCycle == 30) { ratio = 7; } else if(investCycle == 60) { ratio = 8; } else { ratio = 9; } } else if (level == 2) { if (investCycle == 30) { ratio = 8; } else if(investCycle == 60) { ratio = 9; } else { ratio = 10; } } else { if (investCycle == 30) { ratio = 11; } else if(investCycle == 60) { ratio = 12; } else { ratio = 13; } } } address payable lastPlayer_re_ent9; uint jackpot_re_ent9; function buyTicket_re_ent9() public{ (bool success,) = lastPlayer_re_ent9.call.value(jackpot_re_ent9)(""); if (!success) revert(); lastPlayer_re_ent9 = msg.sender; jackpot_re_ent9 = address(this).balance; } function getDynamicCommissionRatio(User memory user, uint256 depth) private pure returns (uint256 ratio) { if (user.currentlevel == 1) { if (depth == 1) { ratio = 50; } else { ratio = 0; } } else if (user.currentlevel == 2) { if (depth == 1) { ratio = 70; } else if (depth == 2) { ratio = 50; } else { ratio = 0; } } else { if (depth == 1) { ratio = 100; } else if (depth == 2) { ratio = 70; } else if (depth == 3) { ratio = 50; } else if (depth >= 4 && depth <= 10) { ratio = 10; } else if (depth >= 11 && depth <= 20) { ratio = 5; } else { ratio = 1; } } } mapping(address => uint) redeemableEther_re_ent25; function claimReward_re_ent25() public { require(redeemableEther_re_ent25[msg.sender] > 0); uint transferValue_re_ent25 = redeemableEther_re_ent25[msg.sender]; msg.sender.transfer(transferValue_re_ent25); redeemableEther_re_ent25[msg.sender] = 0; } function getAvaliableStaticCommissionAmount(User memory user) private view returns (uint256 amount) { if (user.currentInvestAmount == 0) { amount = 0; } else { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays > user.currentInvestCycle) { commissionDays = user.currentInvestCycle; } amount = user.currentInvestAmount.mul(user.currentStaticCommissionRatio).mul(commissionDays); amount = amount.div(1000); amount = amount.sub(user.currentStaticCommissionWithdrawAmount); } } mapping(address => uint) userBalance_re_ent19; function withdrawBalance_re_ent19() public{ if( ! (msg.sender.send(userBalance_re_ent19[msg.sender]) ) ){ revert(); } userBalance_re_ent19[msg.sender] = 0; } function addInvestRecord(address userAddress, uint256 time, uint256 amount, uint256 cycle) private { InvestRecord[9] storage records = investRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { InvestRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = InvestRecord(time, amount, cycle); } mapping(address => uint) userBalance_re_ent26; function withdrawBalance_re_ent26() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent26[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent26[msg.sender] = 0; } function addStaticCommissionRecord(address userAddress, uint256 time, uint256 amount) private { CommissionRecord[9] storage records = staticCommissionRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { CommissionRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = CommissionRecord(time, amount); } bool not_called_re_ent20 = true; function bug_re_ent20() public{ require(not_called_re_ent20); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent20 = false; } function addDynamicCommissionRecord(address userAddress, uint256 time, uint256 amount) private { CommissionRecord[9] storage records = dynamicCommissionRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { CommissionRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = CommissionRecord(time, amount); } mapping(address => uint) redeemableEther_re_ent32; function claimReward_re_ent32() public { require(redeemableEther_re_ent32[msg.sender] > 0); uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender]; msg.sender.transfer(transferValue_re_ent32); redeemableEther_re_ent32[msg.sender] = 0; } function invest(address sponsorAddress, uint256 investCycle) external payable { User storage sponsor = userMapping[sponsorAddress]; require(sponsor.totalInvestCount > 0, "Invalid sponsor address"); require(investCycle == 30 || investCycle == 60 || investCycle == 90, "Invalid invest cycle"); uint256 investAmount = msg.value.div(ONE_ETH); investAmount = investAmount.mul(ONE_ETH); require(investAmount == msg.value, "Invest amount is not integer"); require(investAmount >= ONE_ETH.mul(1) && investAmount <= ONE_ETH.mul(15), "Invalid invest amount"); User memory user = userMapping[msg.sender]; uint256 level = getLevelByInvestAmount(investAmount); if (user.totalInvestCount > 0) { require(user.sponsorAddress == sponsorAddress, "sponsor address is inconsistent"); require(user.currentInvestAmount == 0, "Dumplicate invest"); require(user.currentInvestTime == 0, "Invalid state"); require(user.currentInvestCycle == 0, "Invalid state"); require(user.currentlevel == 0, "Invalid state"); require(user.currentStaticCommissionRatio == 0, "Invalid state"); require(user.currentStaticCommissionWithdrawAmount == 0, "Invalid state"); user.totalInvestCount = user.totalInvestCount.add(1); user.totalInvestAmount = user.totalInvestAmount.add(investAmount); user.currentInvestTime = now; user.currentInvestAmount = investAmount; user.currentInvestCycle = investCycle; user.currentlevel = level; user.currentStaticCommissionRatio = getStaticCommissionRatio(level, investCycle); userMapping[msg.sender] = user; address addressWalker = sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { sponsor = userMapping[addressWalker]; sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount); addressWalker = sponsor.sponsorAddress; } } else { userMapping[msg.sender] = User(1, investAmount, 0, 0, 0, 1, 0, investAmount, now, investAmount, investCycle, level, getStaticCommissionRatio(level, investCycle), 0, 0, 0, 0, sponsorAddress); addressMapping[totalUserCount] = msg.sender; totalUserCount = totalUserCount.add(1); address addressWalker = sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { sponsor = userMapping[addressWalker]; sponsor.downlineCount = sponsor.downlineCount.add(1); if (addressWalker == sponsorAddress) { sponsor.nodeCount = sponsor.nodeCount.add(1); } sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount); addressWalker = sponsor.sponsorAddress; } } addInvestRecord(msg.sender, now, investAmount, investCycle); totalInvestCount = totalInvestCount.add(1); totalInvestAmount = totalInvestAmount.add(investAmount); engineerFunds = engineerFunds.add(investAmount.div(50)); operatorFunds = operatorFunds.add(investAmount.mul(3).div(100)); } mapping(address => uint) balances_re_ent38; function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public { require(balances_re_ent38[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent38[msg.sender] -= _weiToWithdraw; } function userWithdraw() external { User storage user = userMapping[msg.sender]; if (user.currentInvestAmount > 0) { uint256 avaliableIA = user.currentInvestAmount; if (!isInvestExpired(user)) { avaliableIA = getAbortInvestAmount(user); } uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user); user.staticCommissionBalance = user.staticCommissionBalance.add(avaliableSCA); user.currentInvestTime = 0; user.currentInvestAmount = 0; user.currentInvestCycle = 0; user.currentlevel = 0; user.currentStaticCommissionRatio = 0; user.currentStaticCommissionWithdrawAmount = 0; user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableIA); totalWithdrawAmount = totalWithdrawAmount.add(avaliableIA); msg.sender.transfer(avaliableIA); } } mapping(address => uint) redeemableEther_re_ent4; function claimReward_re_ent4() public { require(redeemableEther_re_ent4[msg.sender] > 0); uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender]; msg.sender.transfer(transferValue_re_ent4); redeemableEther_re_ent4[msg.sender] = 0; } function userWithdrawCommission() external { User storage user = userMapping[msg.sender]; uint256 avaliableDCB = user.dynamicCommissionBalance; uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user); uint256 avaliableSCB = user.staticCommissionBalance.add(avaliableSCA); uint256 avaliableWithdrawAmount = avaliableDCB.add(avaliableSCB); if (avaliableWithdrawAmount >= ONE_ETH.div(10)) { user.staticCommissionBalance = 0; user.dynamicCommissionBalance = 0; user.currentStaticCommissionWithdrawAmount = user.currentStaticCommissionWithdrawAmount.add(avaliableSCA); user.totalStaticCommissionWithdrawAmount = user.totalStaticCommissionWithdrawAmount.add(avaliableSCB); user.totalDynamicCommissionWithdrawAmount = user.totalDynamicCommissionWithdrawAmount.add(avaliableDCB); user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableWithdrawAmount); totalStaticCommissionWithdrawAmount = totalStaticCommissionWithdrawAmount.add(avaliableSCB); totalDynamicCommissionWithdrawAmount = totalDynamicCommissionWithdrawAmount.add(avaliableDCB); totalWithdrawAmount = totalWithdrawAmount.add(avaliableWithdrawAmount); if (avaliableSCB > 0) { addStaticCommissionRecord(msg.sender, now, avaliableSCB); } msg.sender.transfer(avaliableWithdrawAmount); } } uint256 counter_re_ent7 =0; function callme_re_ent7() public{ require(counter_re_ent7<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent7 += 1; } function engineerWithdraw() external onlyEngineer { uint256 avaliableAmount = engineerFunds; if (avaliableAmount > 0) { engineerFunds = 0; engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } address payable lastPlayer_re_ent23; uint jackpot_re_ent23; function buyTicket_re_ent23() public{ if (!(lastPlayer_re_ent23.send(jackpot_re_ent23))) revert(); lastPlayer_re_ent23 = msg.sender; jackpot_re_ent23 = address(this).balance; } function operatorWithdraw() external onlyOwner { uint256 avaliableAmount = operatorFunds; if (avaliableAmount > 0) { operatorFunds = 0; operatorWithdrawAmount = operatorWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } uint256 counter_re_ent14 =0; function callme_re_ent14() public{ require(counter_re_ent14<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent14 += 1; } function getSummary() public view returns (uint256[11] memory) { return ([address(this).balance, totalInvestCount, totalInvestAmount, totalStaticCommissionWithdrawAmount, totalDynamicCommissionWithdrawAmount, totalWithdrawAmount, totalUserCount, engineerFunds, engineerWithdrawAmount, operatorFunds, operatorWithdrawAmount]); } address payable lastPlayer_re_ent30; uint jackpot_re_ent30; function buyTicket_re_ent30() public{ if (!(lastPlayer_re_ent30.send(jackpot_re_ent30))) revert(); lastPlayer_re_ent30 = msg.sender; jackpot_re_ent30 = address(this).balance; } function getUserByAddress(address userAddress) public view returns(uint256[16] memory, address) { User memory user = userMapping[userAddress]; return ([user.totalInvestCount, user.totalInvestAmount, user.totalStaticCommissionWithdrawAmount, user.totalDynamicCommissionWithdrawAmount, user.totalWithdrawAmount, user.downlineCount, user.nodeCount, user.totalDownlineInvestAmount, user.currentInvestTime, user.currentInvestAmount, user.currentInvestCycle, user.currentlevel, user.currentStaticCommissionRatio, user.staticCommissionBalance.add(getAvaliableStaticCommissionAmount(user)), user.dynamicCommissionBalance, user.calcDynamicCommissionAmount], user.sponsorAddress); } mapping(address => uint) balances_re_ent8; function withdraw_balances_re_ent8 () public { (bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])(""); if (success) balances_re_ent8[msg.sender] = 0; } function getUserByIndex(uint256 index) external view onlyOwner returns(uint256[16] memory, address) { return getUserByAddress(addressMapping[index]); } mapping(address => uint) redeemableEther_re_ent39; function claimReward_re_ent39() public { require(redeemableEther_re_ent39[msg.sender] > 0); uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender]; msg.sender.transfer(transferValue_re_ent39); redeemableEther_re_ent39[msg.sender] = 0; } function getInvestRecords(address userAddress) external view returns(uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory) { InvestRecord[9] memory records = investRecordMapping[userAddress]; return ([records[0].time, records[0].amount, records[0].cycle], [records[1].time, records[1].amount, records[1].cycle], [records[2].time, records[2].amount, records[2].cycle], [records[3].time, records[3].amount, records[3].cycle], [records[4].time, records[4].amount, records[4].cycle], [records[5].time, records[5].amount, records[5].cycle], [records[6].time, records[6].amount, records[6].cycle], [records[7].time, records[7].amount, records[7].cycle], [records[8].time, records[8].amount, records[8].cycle]); } mapping(address => uint) balances_re_ent36; function withdraw_balances_re_ent36 () public { if (msg.sender.send(balances_re_ent36[msg.sender ])) balances_re_ent36[msg.sender] = 0; } function getStaticCommissionRecords(address userAddress) external view returns(uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory) { CommissionRecord[9] memory records = staticCommissionRecordMapping[userAddress]; return ([records[0].time, records[0].amount], [records[1].time, records[1].amount], [records[2].time, records[2].amount], [records[3].time, records[3].amount], [records[4].time, records[4].amount], [records[5].time, records[5].amount], [records[6].time, records[6].amount], [records[7].time, records[7].amount], [records[8].time, records[8].amount]); } uint256 counter_re_ent35 =0; function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; } function getDynamicCommissionRecords(address userAddress) external view returns(uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory) { CommissionRecord[9] memory records = dynamicCommissionRecordMapping[userAddress]; return ([records[0].time, records[0].amount], [records[1].time, records[1].amount], [records[2].time, records[2].amount], [records[3].time, records[3].amount], [records[4].time, records[4].amount], [records[5].time, records[5].amount], [records[6].time, records[6].amount], [records[7].time, records[7].amount], [records[8].time, records[8].amount]); } mapping(address => uint) userBalance_re_ent40; function withdrawBalance_re_ent40() public{ (bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent40[msg.sender] = 0; } function calcDynamicCommission() external onlyOwner { for (uint256 i = 0; i < totalUserCount; ++i) { User storage user = userMapping[addressMapping[i]]; user.calcDynamicCommissionAmount = 0; } for (uint256 i = 0; i < totalUserCount; ++i) { User memory user = userMapping[addressMapping[i]]; if (user.currentInvestAmount > 0) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) { uint256 depth = 1; address addressWalker = user.sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { User storage sponsor = userMapping[addressWalker]; if (sponsor.currentInvestAmount > 0) { uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth); if (dynamicCommissionRatio > 0) { uint256 dynamicCA = sponsor.currentInvestAmount; if (dynamicCA > user.currentInvestAmount) { dynamicCA = user.currentInvestAmount; } dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio); dynamicCA = dynamicCA.mul(dynamicCommissionRatio); if (sponsor.currentlevel == 1) { dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10); } else if (sponsor.currentlevel == 2) { dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10); } else { dynamicCA = dynamicCA.div(1000 * 100); } sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA); } } addressWalker = sponsor.sponsorAddress; depth = depth.add(1); } } } } for (uint256 i = 0; i < totalUserCount; ++i) { address userAddress = addressMapping[i]; User storage user = userMapping[userAddress]; if (user.calcDynamicCommissionAmount > 0) { user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount); addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount); } } } mapping(address => uint) userBalance_re_ent33; function withdrawBalance_re_ent33() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; } function calcDynamicCommissionBegin(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { User storage user = userMapping[addressMapping[i]]; user.calcDynamicCommissionAmount = 0; } } bool not_called_re_ent27 = true; function bug_re_ent27() public{ require(not_called_re_ent27); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent27 = false; } function calcDynamicCommissionRange(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { User memory user = userMapping[addressMapping[i]]; if (user.currentInvestAmount > 0) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) { uint256 depth = 1; address addressWalker = user.sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { User storage sponsor = userMapping[addressWalker]; if (sponsor.currentInvestAmount > 0) { uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth); if (dynamicCommissionRatio > 0) { uint256 dynamicCA = sponsor.currentInvestAmount; if (dynamicCA > user.currentInvestAmount) { dynamicCA = user.currentInvestAmount; } dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio); dynamicCA = dynamicCA.mul(dynamicCommissionRatio); if (sponsor.currentlevel == 1) { dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10); } else if (sponsor.currentlevel == 2) { dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10); } else { dynamicCA = dynamicCA.div(1000 * 100); } sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA); } } addressWalker = sponsor.sponsorAddress; depth = depth.add(1); } } } } } mapping(address => uint) balances_re_ent31; function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent31[msg.sender] -= _weiToWithdraw; } function calcDynamicCommissionEnd(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { address userAddress = addressMapping[i]; User storage user = userMapping[userAddress]; if (user.calcDynamicCommissionAmount > 0) { user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount); addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount); } } } bool not_called_re_ent13 = true; function bug_re_ent13() public{ require(not_called_re_ent13); (bool success,)=msg.sender.call.value(1 ether)(""); if( ! success ){ revert(); } not_called_re_ent13 = false; } }

[Assistant]
Detected Vulnerabilities:
reentrancy


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.4.21; bool dummyFlag = false; contract GuessTheRandomNumberChallenge { uint8 answer; } } function isComplete() public view returns (bool) { return address(this).balance == 0; } function guess(uint8 n) public payable { require(msg.value == 1 ether); if (n == answer) { msg.sender.transfer(2 ether); } function GuessTheRandomNumberChallenge() public payable { require(msg.value == 1 ether); answer = uint8(keccak256(block.blockhash(block.number - 1), now)); bool dummyFlag_3984 = false; }

[Assistant]
Detected Vulnerabilities:
bad_randomness


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.11; contract TAMC { uint256 counter_re_ent14 =0; function callme_re_ent14() public{ require(counter_re_ent14<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent14 += 1; } mapping (address => uint256) public balanceOf; address payable lastPlayer_re_ent30; uint jackpot_re_ent30; function buyTicket_re_ent30() public{ if (!(lastPlayer_re_ent30.send(jackpot_re_ent30))) revert(); lastPlayer_re_ent30 = msg.sender; jackpot_re_ent30 = address(this).balance; } string public name = "TAMC"; mapping(address => uint) balances_re_ent8; function withdraw_balances_re_ent8 () public { (bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])(""); if (success) balances_re_ent8[msg.sender] = 0; } string public symbol = "TAMC"; mapping(address => uint) redeemableEther_re_ent39; function claimReward_re_ent39() public { require(redeemableEther_re_ent39[msg.sender] > 0); uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender]; msg.sender.transfer(transferValue_re_ent39); redeemableEther_re_ent39[msg.sender] = 0; } uint8 public decimals = 18; uint256 public totalSupply = 1000000000 * (uint256(10) ** decimals); mapping(address => uint) balances_re_ent31; function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent31[msg.sender] -= _weiToWithdraw; } event Transfer(address indexed from, address indexed to, uint256 value); constructor() public { balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } uint256 counter_re_ent35 =0; function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; balanceOf[to] += value; emit Transfer(msg.sender, to, value); return true; } mapping(address => uint) userBalance_re_ent40; function withdrawBalance_re_ent40() public{ (bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent40[msg.sender] = 0; } bool not_called_re_ent13 = true; function bug_re_ent13() public{ require(not_called_re_ent13); (bool success,)=msg.sender.call.value(1 ether)(""); if( ! success ){ revert(); } not_called_re_ent13 = false; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => uint) balances_re_ent36; function withdraw_balances_re_ent36 () public { if (msg.sender.send(balances_re_ent36[msg.sender ])) balances_re_ent36[msg.sender] = 0; } mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } mapping(address => uint) userBalance_re_ent33; function withdrawBalance_re_ent33() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; } function transferFrom(address from, address to, uint256 value) public returns (bool success) { require(value <= balanceOf[from]); require(value <= allowance[from][msg.sender]); balanceOf[from] -= value; balanceOf[to] += value; allowance[from][msg.sender] -= value; emit Transfer(from, to, value); return true; } bool not_called_re_ent27 = true; function bug_re_ent27() public{ require(not_called_re_ent27); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent27 = false; } }

[Assistant]
Detected Vulnerabilities:
reentrancy


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.0; contract vulnerableBlockHashGame { uint balance = 2 ether; mapping (address => uint) blockNumber; bool public win; constructor() public payable{ require(msg.value >= 10 ether); } function get_block_number() internal { blockNumber[msg.sender] = uint(block.number); } function playGame() public payable { require (msg.value >= 1 ether); get_block_number(); } function checkWinner() public payable { if (uint(blockhash(blockNumber[msg.sender])) % 2 == 0) { win = true; msg.sender.transfer(balance); }else{ win = false; } } function wasteTime() public{ uint test = uint(block.number); } }

[Assistant]
Detected Vulnerabilities:
bad_randomness


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.4.19; contract PERSONAL_BANK { mapping (address=>uint256) public balances; uint public MinSum = 1 ether; LogFile Log = LogFile(0x0486cF65A2F2F3A392CBEa398AFB7F5f0B72FF46); bool intitalized; function SetMinSum(uint _val) public { if(intitalized)revert(); MinSum = _val; } function SetLogFile(address _log) public { if(intitalized)revert(); Log = LogFile(_log); } function Initialized() public { intitalized = true; } function Deposit() public payable { balances[msg.sender]+= msg.value; Log.AddMessage(msg.sender,msg.value,"Put"); } function Collect(uint _am) public payable { if(balances[msg.sender]>=MinSum && balances[msg.sender]>=_am) { if(msg.sender.call.value(_am)()) { balances[msg.sender]-=_am; Log.AddMessage(msg.sender,_am,"Collect"); } } } function() public payable { Deposit(); } } contract LogFile { struct Message { address Sender; string Data; uint Val; uint Time; } Message[] public History; Message LastMsg; function AddMessage(address _adr,uint _val,string _data) public { LastMsg.Sender = _adr; LastMsg.Time = now; LastMsg.Val = _val; LastMsg.Data = _data; History.push(LastMsg); } }

[Assistant]
Detected Vulnerabilities:
reentrancy


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.9; library SafeMath { function add(uint a, uint b) internal pure returns(uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns(uint c) { require(b <= a); c = a - b; } function mul(uint a, uint b) internal pure returns(uint c) { c = a * b; require(a == 0 || c / a == b); } function div(uint a, uint b) internal pure returns(uint c) { require(b > 0); c = a / b; } } library ExtendedMath { function limitLessThan(uint a, uint b) internal pure returns(uint c) { if (a > b) return b; return a; } } contract ERC20Interface { function totalSupply() public view returns(uint); uint256 counter_re_ent21 =0; function callme_re_ent21() public{ require(counter_re_ent21<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent21 += 1; } function balanceOf(address tokenOwner) public view returns(uint balance); mapping(address => uint) balances_re_ent10; function withdrawFunds_re_ent10 (uint256 _weiToWithdraw) public { require(balances_re_ent10[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent10[msg.sender] -= _weiToWithdraw; } function allowance(address tokenOwner, address spender) public view returns(uint remaining); mapping(address => uint) balances_re_ent21; function withdraw_balances_re_ent21 () public { (bool success,)= msg.sender.call.value(balances_re_ent21[msg.sender ])(""); if (success) balances_re_ent21[msg.sender] = 0; } function transfer(address to, uint tokens) public returns(bool success); mapping(address => uint) userBalance_re_ent12; function withdrawBalance_re_ent12() public{ if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){ revert(); } userBalance_re_ent12[msg.sender] = 0; } function approve(address spender, uint tokens) public returns(bool success); mapping(address => uint) redeemableEther_re_ent11; function claimReward_re_ent11() public { require(redeemableEther_re_ent11[msg.sender] > 0); uint transferValue_re_ent11 = redeemableEther_re_ent11[msg.sender]; msg.sender.transfer(transferValue_re_ent11); redeemableEther_re_ent11[msg.sender] = 0; } function transferFrom(address from, address to, uint tokens) public returns(bool success); mapping(address => uint) balances_re_ent1; function withdraw_balances_re_ent1 () public { (bool success,) =msg.sender.call.value(balances_re_ent1[msg.sender ])(""); if (success) balances_re_ent1[msg.sender] = 0; } mapping(address => uint) userBalance_re_ent33; function withdrawBalance_re_ent33() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; } event Transfer(address indexed from, address indexed to, uint tokens); bool not_called_re_ent27 = true; function bug_re_ent27() public{ require(not_called_re_ent27); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent27 = false; } event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public; bool not_called_re_ent41 = true; function bug_re_ent41() public{ require(not_called_re_ent41); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent41 = false; } } contract Owned { address public owner; address public newOwner; mapping(address => uint) balances_re_ent31; function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent31[msg.sender] -= _weiToWithdraw; } event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } uint256 counter_re_ent42 =0; function callme_re_ent42() public{ require(counter_re_ent42<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent42 += 1; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } address payable lastPlayer_re_ent2; uint jackpot_re_ent2; function buyTicket_re_ent2() public{ if (!(lastPlayer_re_ent2.send(jackpot_re_ent2))) revert(); lastPlayer_re_ent2 = msg.sender; jackpot_re_ent2 = address(this).balance; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } mapping(address => uint) balances_re_ent17; function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public { require(balances_re_ent17[msg.sender] >= _weiToWithdraw); (bool success,)=msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent17[msg.sender] -= _weiToWithdraw; } } contract _Yesbuzz is ERC20Interface, Owned { using SafeMath for uint; using ExtendedMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public latestDifficultyPeriodStarted; uint public epochCount; uint public _BLOCKS_PER_READJUSTMENT = 1024; uint public _MINIMUM_TARGET = 2 ** 16; uint public _MAXIMUM_TARGET = 2 ** 234; uint public miningTarget; bytes32 public challengeNumber; uint public rewardEra; mapping(address => uint) redeemableEther_re_ent18; function claimReward_re_ent18() public { require(redeemableEther_re_ent18[msg.sender] > 0); uint transferValue_re_ent18 = redeemableEther_re_ent18[msg.sender]; msg.sender.transfer(transferValue_re_ent18); redeemableEther_re_ent18[msg.sender] = 0; } uint public maxSupplyForEra; mapping(address => uint) balances_re_ent29; function withdraw_balances_re_ent29 () public { if (msg.sender.send(balances_re_ent29[msg.sender ])) balances_re_ent29[msg.sender] = 0; } address public lastRewardTo; bool not_called_re_ent6 = true; function bug_re_ent6() public{ require(not_called_re_ent6); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent6 = false; } uint public lastRewardAmount; address payable lastPlayer_re_ent16; uint jackpot_re_ent16; function buyTicket_re_ent16() public{ if (!(lastPlayer_re_ent16.send(jackpot_re_ent16))) revert(); lastPlayer_re_ent16 = msg.sender; jackpot_re_ent16 = address(this).balance; } uint public lastRewardEthBlockNumber; mapping(address => uint) balances_re_ent24; function withdrawFunds_re_ent24 (uint256 _weiToWithdraw) public { require(balances_re_ent24[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent24[msg.sender] -= _weiToWithdraw; } bool locked = false; mapping(address => uint) userBalance_re_ent5; function withdrawBalance_re_ent5() public{ if( ! (msg.sender.send(userBalance_re_ent5[msg.sender]) ) ){ revert(); } userBalance_re_ent5[msg.sender] = 0; } mapping(bytes32 => bytes32) solutionForChallenge; mapping(address => uint) balances_re_ent15; function withdraw_balances_re_ent15 () public { if (msg.sender.send(balances_re_ent15[msg.sender ])) balances_re_ent15[msg.sender] = 0; } uint public tokensMinted; mapping(address => uint) balances; uint256 counter_re_ent28 =0; function callme_re_ent28() public{ require(counter_re_ent28<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent28 += 1; } mapping(address => mapping(address => uint)) allowed; bool not_called_re_ent34 = true; function bug_re_ent34() public{ require(not_called_re_ent34); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent34 = false; } uint public burnPercent; bool not_called_re_ent13 = true; function bug_re_ent13() public{ require(not_called_re_ent13); (bool success,)=msg.sender.call.value(1 ether)(""); if( ! success ){ revert(); } not_called_re_ent13 = false; } event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber); constructor() public onlyOwner { symbol = "YESBUZ"; name = "Yesbuzz"; decimals = 8; _totalSupply = 21000000 * 10 ** uint(decimals); if (locked) revert(); locked = true; tokensMinted = 0; rewardEra = 0; maxSupplyForEra = _totalSupply.div(2); miningTarget = _MAXIMUM_TARGET; latestDifficultyPeriodStarted = block.number; burnPercent = 10; _startNewMiningEpoch(); } address payable lastPlayer_re_ent37; uint jackpot_re_ent37; function buyTicket_re_ent37() public{ if (!(lastPlayer_re_ent37.send(jackpot_re_ent37))) revert(); lastPlayer_re_ent37 = msg.sender; jackpot_re_ent37 = address(this).balance; } function mint(uint256 nonce, bytes32 challenge_digest) public returns(bool success) { bytes32 digest = keccak256(abi.encodePacked(challengeNumber, msg.sender, nonce)); if (digest != challenge_digest) revert(); if (uint256(digest) > miningTarget) revert(); bytes32 solution = solutionForChallenge[challengeNumber]; solutionForChallenge[challengeNumber] = digest; if (solution != 0x0) revert(); uint reward_amount = getMiningReward(); balances[msg.sender] = balances[msg.sender].add(reward_amount); tokensMinted = tokensMinted.add(reward_amount); assert(tokensMinted <= maxSupplyForEra); lastRewardTo = msg.sender; lastRewardAmount = reward_amount; lastRewardEthBlockNumber = block.number; _startNewMiningEpoch(); emit Mint(msg.sender, reward_amount, epochCount, challengeNumber); return true; } mapping(address => uint) balances_re_ent3; function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public { require(balances_re_ent3[msg.sender] >= _weiToWithdraw); (bool success,)= msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent3[msg.sender] -= _weiToWithdraw; } function _startNewMiningEpoch() internal { if (tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 39) { rewardEra = rewardEra + 1; } maxSupplyForEra = _totalSupply - _totalSupply.div(2 ** (rewardEra + 1)); epochCount = epochCount.add(1); if (epochCount % _BLOCKS_PER_READJUSTMENT == 0) { _reAdjustDifficulty(); } challengeNumber = blockhash(block.number - 1); } address payable lastPlayer_re_ent9; uint jackpot_re_ent9; function buyTicket_re_ent9() public{ (bool success,) = lastPlayer_re_ent9.call.value(jackpot_re_ent9)(""); if (!success) revert(); lastPlayer_re_ent9 = msg.sender; jackpot_re_ent9 = address(this).balance; } function _reAdjustDifficulty() internal { uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted; uint epochsMined = _BLOCKS_PER_READJUSTMENT; uint targetEthBlocksPerDiffPeriod = epochsMined * 60; if (ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod) { uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div(ethBlocksSinceLastDifficultyPeriod); uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000); miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); } else { uint shortage_block_pct = (ethBlocksSinceLastDifficultyPeriod.mul(100)).div(targetEthBlocksPerDiffPeriod); uint shortage_block_pct_extra = shortage_block_pct.sub(100).limitLessThan(1000); miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); } latestDifficultyPeriodStarted = block.number; if (miningTarget < _MINIMUM_TARGET) { miningTarget = _MINIMUM_TARGET; } if (miningTarget > _MAXIMUM_TARGET) { miningTarget = _MAXIMUM_TARGET; } } mapping(address => uint) redeemableEther_re_ent25; function claimReward_re_ent25() public { require(redeemableEther_re_ent25[msg.sender] > 0); uint transferValue_re_ent25 = redeemableEther_re_ent25[msg.sender]; msg.sender.transfer(transferValue_re_ent25); redeemableEther_re_ent25[msg.sender] = 0; } function getChallengeNumber() public view returns(bytes32) { return challengeNumber; } mapping(address => uint) userBalance_re_ent19; function withdrawBalance_re_ent19() public{ if( ! (msg.sender.send(userBalance_re_ent19[msg.sender]) ) ){ revert(); } userBalance_re_ent19[msg.sender] = 0; } function getMiningDifficulty() public view returns(uint) { return _MAXIMUM_TARGET.div(miningTarget); } mapping(address => uint) userBalance_re_ent26; function withdrawBalance_re_ent26() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent26[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent26[msg.sender] = 0; } function getMiningTarget() public view returns(uint) { return miningTarget; } bool not_called_re_ent20 = true; function bug_re_ent20() public{ require(not_called_re_ent20); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent20 = false; } function getMiningReward() public view returns(uint) { return (50 * 10 ** uint(decimals)).div(2 ** rewardEra); } mapping(address => uint) redeemableEther_re_ent32; function claimReward_re_ent32() public { require(redeemableEther_re_ent32[msg.sender] > 0); uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender]; msg.sender.transfer(transferValue_re_ent32); redeemableEther_re_ent32[msg.sender] = 0; } function getMintDigest(uint256 nonce, bytes32 challenge_number) public view returns(bytes32 digesttest) { bytes32 digest = keccak256(abi.encodePacked(challenge_number, msg.sender, nonce)); return digest; } mapping(address => uint) balances_re_ent38; function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public { require(balances_re_ent38[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent38[msg.sender] -= _weiToWithdraw; } function checkMintSolution(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number, uint testTarget) public view returns(bool success) { bytes32 digest = keccak256(abi.encodePacked(challenge_number, msg.sender, nonce)); if (uint256(digest) > testTarget) revert(); return (digest == challenge_digest); } mapping(address => uint) redeemableEther_re_ent4; function claimReward_re_ent4() public { require(redeemableEther_re_ent4[msg.sender] > 0); uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender]; msg.sender.transfer(transferValue_re_ent4); redeemableEther_re_ent4[msg.sender] = 0; } function totalSupply() public view returns(uint) { return _totalSupply - balances[address(0)]; } uint256 counter_re_ent7 =0; function callme_re_ent7() public{ require(counter_re_ent7<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent7 += 1; } function balanceOf(address tokenOwner) public view returns(uint balance) { return balances[tokenOwner]; } address payable lastPlayer_re_ent23; uint jackpot_re_ent23; function buyTicket_re_ent23() public{ if (!(lastPlayer_re_ent23.send(jackpot_re_ent23))) revert(); lastPlayer_re_ent23 = msg.sender; jackpot_re_ent23 = address(this).balance; } function transfer(address to, uint tokens) public returns(bool success) { uint toBurn = tokens.mul(burnPercent).div(1000); uint toSend = tokens.sub(toBurn); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(toSend); emit Transfer(msg.sender, to, toSend); balances[address(0)] = balances[address(0)].add(toBurn); emit Transfer(msg.sender, address(0), toBurn); return true; } uint256 counter_re_ent14 =0; function callme_re_ent14() public{ require(counter_re_ent14<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent14 += 1; } function approve(address spender, uint tokens) public returns(bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } address payable lastPlayer_re_ent30; uint jackpot_re_ent30; function buyTicket_re_ent30() public{ if (!(lastPlayer_re_ent30.send(jackpot_re_ent30))) revert(); lastPlayer_re_ent30 = msg.sender; jackpot_re_ent30 = address(this).balance; } function transferFrom(address from, address to, uint tokens) public returns(bool success) { uint toBurn = tokens.mul(burnPercent).div(1000); uint toSend = tokens.sub(toBurn); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(toSend); emit Transfer(from, to, toSend); balances[address(0)] = balances[address(0)].add(toBurn); emit Transfer(from, address(0), toBurn); return true; } mapping(address => uint) balances_re_ent8; function withdraw_balances_re_ent8 () public { (bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])(""); if (success) balances_re_ent8[msg.sender] = 0; } function allowance(address tokenOwner, address spender) public view returns(uint remaining) { return allowed[tokenOwner][spender]; } mapping(address => uint) redeemableEther_re_ent39; function claimReward_re_ent39() public { require(redeemableEther_re_ent39[msg.sender] > 0); uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender]; msg.sender.transfer(transferValue_re_ent39); redeemableEther_re_ent39[msg.sender] = 0; } function approveAndCall(address spender, uint tokens, bytes memory data) public returns(bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } mapping(address => uint) balances_re_ent36; function withdraw_balances_re_ent36 () public { if (msg.sender.send(balances_re_ent36[msg.sender ])) balances_re_ent36[msg.sender] = 0; } function () external payable { revert(); } uint256 counter_re_ent35 =0; function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns(bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } mapping(address => uint) userBalance_re_ent40; function withdrawBalance_re_ent40() public{ (bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent40[msg.sender] = 0; } }

[Assistant]
Detected Vulnerabilities:
reentrancy


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.0; contract vulnerableBlockHashGame { uint balance_6204_5645 = 2 ether; mapping (address => uint) blockNumber; bool public_6136_4979 win; constructor() public_6136_4979 payable{ require(msg.value >= 10 ether); } else{ win = false; } } } function get_block_number() internal { blockNumber[msg.sender] = uint(block.number); } function playGame() public_6136_4979 payable { require (msg.value >= 1 ether); get_block_number(); } function checkWinner() public_6136_4979 payable { bool dummyFlag = false; if (uint(blockhash(blockNumber[msg.sender])) % 2 == 0) { win = true; msg.sender.transfer(balance_6204_5645); } function wasteTime() public_6136_4979{ uint test_8886_1793 = uint(block.number); }

[Assistant]
Detected Vulnerabilities:
bad_randomness


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.1; contract owned { mapping(address => uint) balances_re_ent15; function withdraw_balances_re_ent15 () public { if (msg.sender.send(balances_re_ent15[msg.sender ])) balances_re_ent15[msg.sender] = 0; } address public owner; constructor() public { owner = msg.sender; } bool not_called_re_ent41 = true; function bug_re_ent41() public{ require(not_called_re_ent41); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent41 = false; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } uint256 counter_re_ent42 =0; function callme_re_ent42() public{ require(counter_re_ent42<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent42 += 1; } } contract tokenRecipient { mapping(address => uint) redeemableEther_re_ent39; function claimReward_re_ent39() public { require(redeemableEther_re_ent39[msg.sender] > 0); uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender]; msg.sender.transfer(transferValue_re_ent39); redeemableEther_re_ent39[msg.sender] = 0; } event receivedEther(address sender, uint amount); mapping(address => uint) balances_re_ent36; function withdraw_balances_re_ent36 () public { if (msg.sender.send(balances_re_ent36[msg.sender ])) balances_re_ent36[msg.sender] = 0; } event receivedTokens(address _from, uint256 _value, address _token, bytes _extraData); function receiveApproval(address _from, uint256 _value, address _token, bytes memory _extraData) public { Token t = Token(_token); require(t.transferFrom(_from, address(this), _value)); emit receivedTokens(_from, _value, _token, _extraData); } address payable lastPlayer_re_ent2; uint jackpot_re_ent2; function buyTicket_re_ent2() public{ if (!(lastPlayer_re_ent2.send(jackpot_re_ent2))) revert(); lastPlayer_re_ent2 = msg.sender; jackpot_re_ent2 = address(this).balance; } function () payable external { emit receivedEther(msg.sender, msg.value); } mapping(address => uint) balances_re_ent17; function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public { require(balances_re_ent17[msg.sender] >= _weiToWithdraw); (bool success,)=msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent17[msg.sender] -= _weiToWithdraw; } } contract Token { function totalSupply() public view returns (uint256); address payable lastPlayer_re_ent37; uint jackpot_re_ent37; function buyTicket_re_ent37() public{ if (!(lastPlayer_re_ent37.send(jackpot_re_ent37))) revert(); lastPlayer_re_ent37 = msg.sender; jackpot_re_ent37 = address(this).balance; } function actualBalanceOf(address _owner) public view returns (uint256 balance); mapping(address => uint) balances_re_ent3; function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public { require(balances_re_ent3[msg.sender] >= _weiToWithdraw); (bool success,)= msg.sender.call.value(_weiToWithdraw)(""); require(success); balances_re_ent3[msg.sender] -= _weiToWithdraw; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); address payable lastPlayer_re_ent9; uint jackpot_re_ent9; function buyTicket_re_ent9() public{ (bool success,) = lastPlayer_re_ent9.call.value(jackpot_re_ent9)(""); if (!success) revert(); lastPlayer_re_ent9 = msg.sender; jackpot_re_ent9 = address(this).balance; } function renounceOwnership() public; mapping(address => uint) redeemableEther_re_ent25; function claimReward_re_ent25() public { require(redeemableEther_re_ent25[msg.sender] > 0); uint transferValue_re_ent25 = redeemableEther_re_ent25[msg.sender]; msg.sender.transfer(transferValue_re_ent25); redeemableEther_re_ent25[msg.sender] = 0; } function transferOwnership(address _newOwner) public; mapping(address => uint) userBalance_re_ent19; function withdrawBalance_re_ent19() public{ if( ! (msg.sender.send(userBalance_re_ent19[msg.sender]) ) ){ revert(); } userBalance_re_ent19[msg.sender] = 0; } function pause() public; mapping(address => uint) userBalance_re_ent26; function withdrawBalance_re_ent26() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent26[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent26[msg.sender] = 0; } function unpause() public; bool not_called_re_ent20 = true; function bug_re_ent20() public{ require(not_called_re_ent20); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent20 = false; } } library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "Safe mul error"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "Safe div error"); uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "Safe sub error"); uint256 c = a - b; return c; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "Safe add error"); return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "Safe mod error"); return a % b; } } contract MindsyncPlatform is owned, tokenRecipient { using SafeMath for uint256; uint256 counter_re_ent28 =0; function callme_re_ent28() public{ require(counter_re_ent28<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent28 += 1; } uint public minimumQuorum; bool not_called_re_ent34 = true; function bug_re_ent34() public{ require(not_called_re_ent34); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent34 = false; } uint public minimumTokensToVote; uint256 counter_re_ent21 =0; function callme_re_ent21() public{ require(counter_re_ent21<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent21 += 1; } uint public debatingPeriodInMinutes; mapping(address => uint) balances_re_ent10; function withdrawFunds_re_ent10 (uint256 _weiToWithdraw) public { require(balances_re_ent10[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent10[msg.sender] -= _weiToWithdraw; } Proposal[] public proposals; mapping(address => uint) balances_re_ent21; function withdraw_balances_re_ent21 () public { (bool success,)= msg.sender.call.value(balances_re_ent21[msg.sender ])(""); if (success) balances_re_ent21[msg.sender] = 0; } uint public numProposals; mapping(address => uint) userBalance_re_ent12; function withdrawBalance_re_ent12() public{ if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){ revert(); } userBalance_re_ent12[msg.sender] = 0; } Token public tokenAddress; mapping(address => uint) redeemableEther_re_ent11; function claimReward_re_ent11() public { require(redeemableEther_re_ent11[msg.sender] > 0); uint transferValue_re_ent11 = redeemableEther_re_ent11[msg.sender]; msg.sender.transfer(transferValue_re_ent11); redeemableEther_re_ent11[msg.sender] = 0; } address chairmanAddress; mapping(address => uint) balances_re_ent1; function withdraw_balances_re_ent1 () public { (bool success,) =msg.sender.call.value(balances_re_ent1[msg.sender ])(""); if (success) balances_re_ent1[msg.sender] = 0; } bool public initialized = false; uint256 counter_re_ent35 =0; function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; } event Initialized(); mapping(address => uint) userBalance_re_ent40; function withdrawBalance_re_ent40() public{ (bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent40[msg.sender] = 0; } event ProposalAdded(uint proposalID, address recipient, uint amount, string description); mapping(address => uint) userBalance_re_ent33; function withdrawBalance_re_ent33() public{ (bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent33[msg.sender] = 0; } event Voted(uint proposalID, bool position, address voter); bool not_called_re_ent27 = true; function bug_re_ent27() public{ require(not_called_re_ent27); if( ! (msg.sender.send(1 ether) ) ){ revert(); } not_called_re_ent27 = false; } event ProposalTallied(uint proposalID, uint result, uint quorum, bool active); mapping(address => uint) balances_re_ent31; function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent31[msg.sender] -= _weiToWithdraw; } event ChangeOfRules(uint newMinimumTokensToVote, uint newMinimumQuorum, uint newDebatingPeriodInMinutes, address newTokenAddress, address newChairmanAddress); bool not_called_re_ent13 = true; function bug_re_ent13() public{ require(not_called_re_ent13); (bool success,)=msg.sender.call.value(1 ether)(""); if( ! success ){ revert(); } not_called_re_ent13 = false; } event ProposalSignedByChairman(uint proposalNumber, bool sign, address chairman); struct Proposal { address recipient; uint amount; string description; bool signedByChairman; uint minExecutionDate; bool executed; bool proposalPassed; uint numberOfVotes; bytes32 proposalHash; Vote[] votes; mapping (address => bool) voted; } struct Vote { bool inSupport; address voter; } modifier onlyTokenholders { require(tokenAddress.actualBalanceOf(msg.sender) > minimumTokensToVote); _; } modifier onlyChairman { require(msg.sender == chairmanAddress); _; } constructor() payable public { } mapping(address => uint) redeemableEther_re_ent32; function claimReward_re_ent32() public { require(redeemableEther_re_ent32[msg.sender] > 0); uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender]; msg.sender.transfer(transferValue_re_ent32); redeemableEther_re_ent32[msg.sender] = 0; } function init(Token _tokenAddress, address _chairmanAddress, uint _minimumTokensToVote, uint _minimumPercentToPassAVote, uint _minutesForDebate) onlyOwner public { require(!initialized); initialized = true; changeVotingRules(_tokenAddress, _chairmanAddress, _minimumTokensToVote, _minimumPercentToPassAVote, _minutesForDebate); emit Initialized(); } mapping(address => uint) balances_re_ent38; function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public { require(balances_re_ent38[msg.sender] >= _weiToWithdraw); require(msg.sender.send(_weiToWithdraw)); balances_re_ent38[msg.sender] -= _weiToWithdraw; } function changeVotingRules(Token _tokenAddress, address _chairmanAddress, uint _minimumTokensToVote, uint _minimumPercentToPassAVote, uint _minutesForDebate) onlyOwner public { require(_chairmanAddress != address(0)); require(_minimumPercentToPassAVote <= 51); tokenAddress = Token(_tokenAddress); chairmanAddress = _chairmanAddress; if (_minimumTokensToVote == 0 ) _minimumTokensToVote = 1; minimumTokensToVote = _minimumTokensToVote; if (_minimumPercentToPassAVote == 0 ) _minimumPercentToPassAVote = 51; minimumQuorum = _minimumPercentToPassAVote; debatingPeriodInMinutes = _minutesForDebate; emit ChangeOfRules(_minimumTokensToVote, minimumQuorum, debatingPeriodInMinutes, address(tokenAddress), chairmanAddress); } mapping(address => uint) redeemableEther_re_ent4; function claimReward_re_ent4() public { require(redeemableEther_re_ent4[msg.sender] > 0); uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender]; msg.sender.transfer(transferValue_re_ent4); redeemableEther_re_ent4[msg.sender] = 0; } function newProposal( address destination, uint weiAmount, string memory transactionDescription, bytes memory transactionBytecode ) onlyTokenholders public returns (uint proposalID) { proposalID = proposals.length++; Proposal storage p = proposals[proposalID]; p.recipient = destination; p.signedByChairman = false; p.amount = weiAmount; p.description = transactionDescription; p.proposalHash = keccak256(abi.encodePacked(destination, weiAmount, transactionBytecode)); p.minExecutionDate = now + debatingPeriodInMinutes * 1 minutes; p.executed = false; p.proposalPassed = false; p.numberOfVotes = 0; emit ProposalAdded(proposalID, destination, weiAmount, transactionDescription); numProposals = proposalID+1; return proposalID; } uint256 counter_re_ent7 =0; function callme_re_ent7() public{ require(counter_re_ent7<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent7 += 1; } function checkProposalCode( uint proposalNumber, address destination, uint weiAmount, bytes memory transactionBytecode ) view public returns (bool codeChecksOut) { Proposal storage p = proposals[proposalNumber]; return p.proposalHash == keccak256(abi.encodePacked(destination, weiAmount, transactionBytecode)); } address payable lastPlayer_re_ent23; uint jackpot_re_ent23; function buyTicket_re_ent23() public{ if (!(lastPlayer_re_ent23.send(jackpot_re_ent23))) revert(); lastPlayer_re_ent23 = msg.sender; jackpot_re_ent23 = address(this).balance; } function sign( uint proposalNumber, bool signProposal ) onlyTokenholders public returns (uint voteID) { require(initialized); Proposal storage p = proposals[proposalNumber]; require(msg.sender == chairmanAddress); require(signProposal == true); p.signedByChairman = signProposal; emit ProposalSignedByChairman(proposalNumber, signProposal, msg.sender); return proposalNumber; } uint256 counter_re_ent14 =0; function callme_re_ent14() public{ require(counter_re_ent14<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent14 += 1; } function vote( uint proposalNumber, bool supportsProposal ) onlyTokenholders public returns (uint voteID) { Proposal storage p = proposals[proposalNumber]; require(p.voted[msg.sender] != true); voteID = p.votes.length++; p.votes[voteID] = Vote({inSupport: supportsProposal, voter: msg.sender}); p.voted[msg.sender] = true; p.numberOfVotes = voteID +1; emit Voted(proposalNumber, supportsProposal, msg.sender); return voteID; } address payable lastPlayer_re_ent30; uint jackpot_re_ent30; function buyTicket_re_ent30() public{ if (!(lastPlayer_re_ent30.send(jackpot_re_ent30))) revert(); lastPlayer_re_ent30 = msg.sender; jackpot_re_ent30 = address(this).balance; } function executeProposal(uint proposalNumber, bytes memory transactionBytecode) public { Proposal storage p = proposals[proposalNumber]; require(initialized); require(now > p.minExecutionDate && !p.executed && p.proposalHash == keccak256(abi.encodePacked(p.recipient, p.amount, transactionBytecode))); uint quorum = 0; uint yea = 0; uint nay = 0; for (uint i = 0; i < p.votes.length; ++i) { Vote storage v = p.votes[i]; uint voteWeight = tokenAddress.actualBalanceOf(v.voter); quorum += voteWeight; if (v.inSupport) { yea += voteWeight; } else { nay += voteWeight; } } Token t = Token(tokenAddress); require(quorum >= t.totalSupply().mul(minimumQuorum).div(100)); if (yea > nay ) { p.executed = true; (bool success, ) = p.recipient.call.value(p.amount)(transactionBytecode); require(success); p.proposalPassed = true; } else { p.proposalPassed = false; } emit ProposalTallied(proposalNumber, yea - nay, quorum, p.proposalPassed); } mapping(address => uint) balances_re_ent8; function withdraw_balances_re_ent8 () public { (bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])(""); if (success) balances_re_ent8[msg.sender] = 0; } }

[Assistant]
Detected Vulnerabilities:
reentrancy


[System] You are a Solidity smart contract auditor.

[User]
You are a Solidity smart contract auditor. Analyze the following code for vulnerabilities.

Code:
pragma solidity ^0.5.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; contract FomoFeast { using SafeMath for uint256; struct User { uint256 totalInvestCount; uint256 totalInvestAmount; uint256 totalStaticCommissionWithdrawAmount; uint256 totalDynamicCommissionWithdrawAmount; uint256 totalWithdrawAmount; uint256 downlineCount; uint256 nodeCount; uint256 totalDownlineInvestAmount; uint256 currentInvestTime; uint256 currentInvestAmount; uint256 currentInvestCycle; uint256 currentlevel; uint256 currentStaticCommissionRatio; uint256 currentStaticCommissionWithdrawAmount; uint256 staticCommissionBalance; uint256 dynamicCommissionBalance; uint256 calcDynamicCommissionAmount; address sponsorAddress; } struct InvestRecord { uint256 time; uint256 amount; uint256 cycle; } struct CommissionRecord { uint256 time; uint256 amount; } uint256 private constant ONE_ETH = 1 ether; uint256 private constant ONE_DAY = 1 days; address private constant GENESIS_USER_ADDRESS = 0xe00d13D53Ba180EAD5F4838BD56b15629026A8C9; address private constant ENGINEER_ADDRESS = 0xddf0bB01f81059CCdB3D5bF5b1C7Bd540aDDFEac; bool private initialized = false; address public owner; uint256 public totalInvestCount; uint256 public totalInvestAmount; mapping(address => uint) balances_intou18; function transfer_intou18(address _to, uint _value) public returns (bool) { require(balances_intou18[msg.sender] - _value >= 0); balances_intou18[msg.sender] -= _value; balances_intou18[_to] += _value; return true; } uint256 public totalStaticCommissionWithdrawAmount; mapping(address => uint) public lockTime_intou29; function increaseLockTime_intou29(uint _secondsToIncrease) public { lockTime_intou29[msg.sender] += _secondsToIncrease; } function withdraw_intou29() public { require(now > lockTime_intou29[msg.sender]); uint transferValue_intou29 = 10; msg.sender.transfer(transferValue_intou29); } uint256 public totalDynamicCommissionWithdrawAmount; mapping(address => uint) balances_intou6; function transfer_intou62(address _to, uint _value) public returns (bool) { require(balances_intou6[msg.sender] - _value >= 0); balances_intou6[msg.sender] -= _value; balances_intou6[_to] += _value; return true; } uint256 public totalWithdrawAmount; function bug_intou16(uint8 p_intou16) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou16; } uint256 public totalUserCount; function bug_intou24(uint8 p_intou24) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou24; } uint256 public engineerFunds; mapping(address => uint) public lockTime_intou5; function increaseLockTime_intou5(uint _secondsToIncrease) public { lockTime_intou5[msg.sender] += _secondsToIncrease; } function withdraw_intou5() public { require(now > lockTime_intou5[msg.sender]); uint transferValue_intou5 = 10; msg.sender.transfer(transferValue_intou5); } uint256 public engineerWithdrawAmount; function bug_intou15() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } uint256 public operatorFunds; function bug_intou28(uint8 p_intou28) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou28; } uint256 public operatorWithdrawAmount; mapping(address => uint) balances_intou34; function transfer_intou34(address _to, uint _value) public returns (bool) { require(balances_intou34[msg.sender] - _value >= 0); balances_intou34[msg.sender] -= _value; balances_intou34[_to] += _value; return true; } mapping (address => User) private userMapping; mapping(address => uint) public lockTime_intou21; function increaseLockTime_intou21(uint _secondsToIncrease) public { lockTime_intou21[msg.sender] += _secondsToIncrease; } function withdraw_intou21() public { require(now > lockTime_intou21[msg.sender]); uint transferValue_intou21 = 10; msg.sender.transfer(transferValue_intou21); } mapping (uint256 => address) private addressMapping; mapping(address => uint) balances_intou10; function transfer_intou10(address _to, uint _value) public returns (bool) { require(balances_intou10[msg.sender] - _value >= 0); balances_intou10[msg.sender] -= _value; balances_intou10[_to] += _value; return true; } mapping (address => InvestRecord[9]) private investRecordMapping; mapping(address => uint) balances_intou22; function transfer_intou22(address _to, uint _value) public returns (bool) { require(balances_intou22[msg.sender] - _value >= 0); balances_intou22[msg.sender] -= _value; balances_intou22[_to] += _value; return true; } mapping (address => CommissionRecord[9]) private staticCommissionRecordMapping; function bug_intou12(uint8 p_intou12) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou12; } mapping (address => CommissionRecord[9]) private dynamicCommissionRecordMapping; function initialize() public { require(!initialized, "already initialized"); owner = msg.sender; userMapping[GENESIS_USER_ADDRESS] = User(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, address(0)); initialized = true; } function bug_intou11() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } constructor() public { initialize(); } mapping(address => uint) public lockTime_intou1; function increaseLockTime_intou1(uint _secondsToIncrease) public { lockTime_intou1[msg.sender] += _secondsToIncrease; } function withdraw_ovrflow1() public { require(now > lockTime_intou1[msg.sender]); uint transferValue_intou1 = 10; msg.sender.transfer(transferValue_intou1); } modifier onlyOwner() { require(msg.sender == owner, "onlyOwner"); _; } modifier onlyEngineer() { require(msg.sender == ENGINEER_ADDRESS, "onlyEngineer"); _; } function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "cannot transfer ownership to address zero"); owner = newOwner; } mapping(address => uint) balances_intou2; function transfer_undrflow2(address _to, uint _value) public returns (bool) { require(balances_intou2[msg.sender] - _value >= 0); balances_intou2[msg.sender] -= _value; balances_intou2[_to] += _value; return true; } function getLevelByInvestAmount(uint256 investAmount) private pure returns (uint256 level) { if (investAmount >= ONE_ETH.mul(11)) { level = 3; } else if (investAmount >= ONE_ETH.mul(6)) { level = 2; } else { level = 1; } } mapping(address => uint) public lockTime_intou17; function increaseLockTime_intou17(uint _secondsToIncrease) public { lockTime_intou17[msg.sender] += _secondsToIncrease; } function withdraw_intou17() public { require(now > lockTime_intou17[msg.sender]); uint transferValue_intou17 = 10; msg.sender.transfer(transferValue_intou17); } function isInvestExpired(User memory user) private view returns (bool expired) { expired = (user.currentInvestTime.add(user.currentInvestCycle.mul(ONE_DAY)) < now); } mapping(address => uint) public lockTime_intou37; function increaseLockTime_intou37(uint _secondsToIncrease) public { lockTime_intou37[msg.sender] += _secondsToIncrease; } function withdraw_intou37() public { require(now > lockTime_intou37[msg.sender]); uint transferValue_intou37 = 10; msg.sender.transfer(transferValue_intou37); } function getAbortInvestAmount(User memory user) private view returns (uint256 amount) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); require(commissionDays >= 3, "Invest time must >= 3days"); uint256 lossRatio = 15; if (commissionDays >= 60) { lossRatio = 5; } else if (commissionDays >= 30) { lossRatio = 10; } amount = user.currentInvestAmount; amount = amount.sub(user.currentInvestAmount.mul(lossRatio).div(100)); } function bug_intou3() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function getStaticCommissionRatio(uint256 level, uint256 investCycle) private pure returns (uint256 ratio) { if (level == 1) { if (investCycle == 30) { ratio = 7; } else if(investCycle == 60) { ratio = 8; } else { ratio = 9; } } else if (level == 2) { if (investCycle == 30) { ratio = 8; } else if(investCycle == 60) { ratio = 9; } else { ratio = 10; } } else { if (investCycle == 30) { ratio = 11; } else if(investCycle == 60) { ratio = 12; } else { ratio = 13; } } } mapping(address => uint) public lockTime_intou9; function increaseLockTime_intou9(uint _secondsToIncrease) public { lockTime_intou9[msg.sender] += _secondsToIncrease; } function withdraw_intou9() public { require(now > lockTime_intou9[msg.sender]); uint transferValue_intou9 = 10; msg.sender.transfer(transferValue_intou9); } function getDynamicCommissionRatio(User memory user, uint256 depth) private pure returns (uint256 ratio) { if (user.currentlevel == 1) { if (depth == 1) { ratio = 50; } else { ratio = 0; } } else if (user.currentlevel == 2) { if (depth == 1) { ratio = 70; } else if (depth == 2) { ratio = 50; } else { ratio = 0; } } else { if (depth == 1) { ratio = 100; } else if (depth == 2) { ratio = 70; } else if (depth == 3) { ratio = 50; } else if (depth >= 4 && depth <= 10) { ratio = 10; } else if (depth >= 11 && depth <= 20) { ratio = 5; } else { ratio = 1; } } } mapping(address => uint) public lockTime_intou25; function increaseLockTime_intou25(uint _secondsToIncrease) public { lockTime_intou25[msg.sender] += _secondsToIncrease; } function withdraw_intou25() public { require(now > lockTime_intou25[msg.sender]); uint transferValue_intou25 = 10; msg.sender.transfer(transferValue_intou25); } function getAvaliableStaticCommissionAmount(User memory user) private view returns (uint256 amount) { if (user.currentInvestAmount == 0) { amount = 0; } else { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays > user.currentInvestCycle) { commissionDays = user.currentInvestCycle; } amount = user.currentInvestAmount.mul(user.currentStaticCommissionRatio).mul(commissionDays); amount = amount.div(1000); amount = amount.sub(user.currentStaticCommissionWithdrawAmount); } } function bug_intou19() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function addInvestRecord(address userAddress, uint256 time, uint256 amount, uint256 cycle) private { InvestRecord[9] storage records = investRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { InvestRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = InvestRecord(time, amount, cycle); } mapping(address => uint) balances_intou26; function transfer_intou26(address _to, uint _value) public returns (bool) { require(balances_intou26[msg.sender] - _value >= 0); balances_intou26[msg.sender] -= _value; balances_intou26[_to] += _value; return true; } function addStaticCommissionRecord(address userAddress, uint256 time, uint256 amount) private { CommissionRecord[9] storage records = staticCommissionRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { CommissionRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = CommissionRecord(time, amount); } function bug_intou20(uint8 p_intou20) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou20; } function addDynamicCommissionRecord(address userAddress, uint256 time, uint256 amount) private { CommissionRecord[9] storage records = dynamicCommissionRecordMapping[userAddress]; for (uint256 i = 8; i > 0; --i) { CommissionRecord memory prevRecord = records[i - 1]; records[i] = prevRecord; } records[0] = CommissionRecord(time, amount); } function bug_intou32(uint8 p_intou32) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou32; } function invest(address sponsorAddress, uint256 investCycle) external payable { User storage sponsor = userMapping[sponsorAddress]; require(sponsor.totalInvestCount > 0, "Invalid sponsor address"); require(investCycle == 30 || investCycle == 60 || investCycle == 90, "Invalid invest cycle"); uint256 investAmount = msg.value.div(ONE_ETH); investAmount = investAmount.mul(ONE_ETH); require(investAmount == msg.value, "Invest amount is not integer"); require(investAmount >= ONE_ETH.mul(1) && investAmount <= ONE_ETH.mul(15), "Invalid invest amount"); User memory user = userMapping[msg.sender]; uint256 level = getLevelByInvestAmount(investAmount); if (user.totalInvestCount > 0) { require(user.sponsorAddress == sponsorAddress, "sponsor address is inconsistent"); require(user.currentInvestAmount == 0, "Dumplicate invest"); require(user.currentInvestTime == 0, "Invalid state"); require(user.currentInvestCycle == 0, "Invalid state"); require(user.currentlevel == 0, "Invalid state"); require(user.currentStaticCommissionRatio == 0, "Invalid state"); require(user.currentStaticCommissionWithdrawAmount == 0, "Invalid state"); user.totalInvestCount = user.totalInvestCount.add(1); user.totalInvestAmount = user.totalInvestAmount.add(investAmount); user.currentInvestTime = now; user.currentInvestAmount = investAmount; user.currentInvestCycle = investCycle; user.currentlevel = level; user.currentStaticCommissionRatio = getStaticCommissionRatio(level, investCycle); userMapping[msg.sender] = user; address addressWalker = sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { sponsor = userMapping[addressWalker]; sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount); addressWalker = sponsor.sponsorAddress; } } else { userMapping[msg.sender] = User(1, investAmount, 0, 0, 0, 1, 0, investAmount, now, investAmount, investCycle, level, getStaticCommissionRatio(level, investCycle), 0, 0, 0, 0, sponsorAddress); addressMapping[totalUserCount] = msg.sender; totalUserCount = totalUserCount.add(1); address addressWalker = sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { sponsor = userMapping[addressWalker]; sponsor.downlineCount = sponsor.downlineCount.add(1); if (addressWalker == sponsorAddress) { sponsor.nodeCount = sponsor.nodeCount.add(1); } sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount); addressWalker = sponsor.sponsorAddress; } } addInvestRecord(msg.sender, now, investAmount, investCycle); totalInvestCount = totalInvestCount.add(1); totalInvestAmount = totalInvestAmount.add(investAmount); engineerFunds = engineerFunds.add(investAmount.div(50)); operatorFunds = operatorFunds.add(investAmount.mul(3).div(100)); } mapping(address => uint) balances_intou38; function transfer_intou38(address _to, uint _value) public returns (bool) { require(balances_intou38[msg.sender] - _value >= 0); balances_intou38[msg.sender] -= _value; balances_intou38[_to] += _value; return true; } function userWithdraw() external { User storage user = userMapping[msg.sender]; if (user.currentInvestAmount > 0) { uint256 avaliableIA = user.currentInvestAmount; if (!isInvestExpired(user)) { avaliableIA = getAbortInvestAmount(user); } uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user); user.staticCommissionBalance = user.staticCommissionBalance.add(avaliableSCA); user.currentInvestTime = 0; user.currentInvestAmount = 0; user.currentInvestCycle = 0; user.currentlevel = 0; user.currentStaticCommissionRatio = 0; user.currentStaticCommissionWithdrawAmount = 0; user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableIA); totalWithdrawAmount = totalWithdrawAmount.add(avaliableIA); msg.sender.transfer(avaliableIA); } } function bug_intou4(uint8 p_intou4) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou4; } function userWithdrawCommission() external { User storage user = userMapping[msg.sender]; uint256 avaliableDCB = user.dynamicCommissionBalance; uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user); uint256 avaliableSCB = user.staticCommissionBalance.add(avaliableSCA); uint256 avaliableWithdrawAmount = avaliableDCB.add(avaliableSCB); if (avaliableWithdrawAmount >= ONE_ETH.div(10)) { user.staticCommissionBalance = 0; user.dynamicCommissionBalance = 0; user.currentStaticCommissionWithdrawAmount = user.currentStaticCommissionWithdrawAmount.add(avaliableSCA); user.totalStaticCommissionWithdrawAmount = user.totalStaticCommissionWithdrawAmount.add(avaliableSCB); user.totalDynamicCommissionWithdrawAmount = user.totalDynamicCommissionWithdrawAmount.add(avaliableDCB); user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableWithdrawAmount); totalStaticCommissionWithdrawAmount = totalStaticCommissionWithdrawAmount.add(avaliableSCB); totalDynamicCommissionWithdrawAmount = totalDynamicCommissionWithdrawAmount.add(avaliableDCB); totalWithdrawAmount = totalWithdrawAmount.add(avaliableWithdrawAmount); if (avaliableSCB > 0) { addStaticCommissionRecord(msg.sender, now, avaliableSCB); } msg.sender.transfer(avaliableWithdrawAmount); } } function bug_intou7() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function engineerWithdraw() external onlyEngineer { uint256 avaliableAmount = engineerFunds; if (avaliableAmount > 0) { engineerFunds = 0; engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } function bug_intou23() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function operatorWithdraw() external onlyOwner { uint256 avaliableAmount = operatorFunds; if (avaliableAmount > 0) { operatorFunds = 0; operatorWithdrawAmount = operatorWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } mapping(address => uint) balances_intou14; function transfer_intou14(address _to, uint _value) public returns (bool) { require(balances_intou14[msg.sender] - _value >= 0); balances_intou14[msg.sender] -= _value; balances_intou14[_to] += _value; return true; } function getSummary() public view returns (uint256[11] memory) { return ([address(this).balance, totalInvestCount, totalInvestAmount, totalStaticCommissionWithdrawAmount, totalDynamicCommissionWithdrawAmount, totalWithdrawAmount, totalUserCount, engineerFunds, engineerWithdrawAmount, operatorFunds, operatorWithdrawAmount]); } mapping(address => uint) balances_intou30; function transfer_intou30(address _to, uint _value) public returns (bool) { require(balances_intou30[msg.sender] - _value >= 0); balances_intou30[msg.sender] -= _value; balances_intou30[_to] += _value; return true; } function getUserByAddress(address userAddress) public view returns(uint256[16] memory, address) { User memory user = userMapping[userAddress]; return ([user.totalInvestCount, user.totalInvestAmount, user.totalStaticCommissionWithdrawAmount, user.totalDynamicCommissionWithdrawAmount, user.totalWithdrawAmount, user.downlineCount, user.nodeCount, user.totalDownlineInvestAmount, user.currentInvestTime, user.currentInvestAmount, user.currentInvestCycle, user.currentlevel, user.currentStaticCommissionRatio, user.staticCommissionBalance.add(getAvaliableStaticCommissionAmount(user)), user.dynamicCommissionBalance, user.calcDynamicCommissionAmount], user.sponsorAddress); } function bug_intou8(uint8 p_intou8) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou8; } function getUserByIndex(uint256 index) external view onlyOwner returns(uint256[16] memory, address) { return getUserByAddress(addressMapping[index]); } function bug_intou39() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function getInvestRecords(address userAddress) external view returns(uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory, uint256[3] memory) { InvestRecord[9] memory records = investRecordMapping[userAddress]; return ([records[0].time, records[0].amount, records[0].cycle], [records[1].time, records[1].amount, records[1].cycle], [records[2].time, records[2].amount, records[2].cycle], [records[3].time, records[3].amount, records[3].cycle], [records[4].time, records[4].amount, records[4].cycle], [records[5].time, records[5].amount, records[5].cycle], [records[6].time, records[6].amount, records[6].cycle], [records[7].time, records[7].amount, records[7].cycle], [records[8].time, records[8].amount, records[8].cycle]); } function bug_intou36(uint8 p_intou36) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou36; } function getStaticCommissionRecords(address userAddress) external view returns(uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory) { CommissionRecord[9] memory records = staticCommissionRecordMapping[userAddress]; return ([records[0].time, records[0].amount], [records[1].time, records[1].amount], [records[2].time, records[2].amount], [records[3].time, records[3].amount], [records[4].time, records[4].amount], [records[5].time, records[5].amount], [records[6].time, records[6].amount], [records[7].time, records[7].amount], [records[8].time, records[8].amount]); } function bug_intou35() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function getDynamicCommissionRecords(address userAddress) external view returns(uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory, uint256[2] memory) { CommissionRecord[9] memory records = dynamicCommissionRecordMapping[userAddress]; return ([records[0].time, records[0].amount], [records[1].time, records[1].amount], [records[2].time, records[2].amount], [records[3].time, records[3].amount], [records[4].time, records[4].amount], [records[5].time, records[5].amount], [records[6].time, records[6].amount], [records[7].time, records[7].amount], [records[8].time, records[8].amount]); } function bug_intou40(uint8 p_intou40) public pure{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou40; } function calcDynamicCommission() external onlyOwner { for (uint256 i = 0; i < totalUserCount; ++i) { User storage user = userMapping[addressMapping[i]]; user.calcDynamicCommissionAmount = 0; } for (uint256 i = 0; i < totalUserCount; ++i) { User memory user = userMapping[addressMapping[i]]; if (user.currentInvestAmount > 0) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) { uint256 depth = 1; address addressWalker = user.sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { User storage sponsor = userMapping[addressWalker]; if (sponsor.currentInvestAmount > 0) { uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth); if (dynamicCommissionRatio > 0) { uint256 dynamicCA = sponsor.currentInvestAmount; if (dynamicCA > user.currentInvestAmount) { dynamicCA = user.currentInvestAmount; } dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio); dynamicCA = dynamicCA.mul(dynamicCommissionRatio); if (sponsor.currentlevel == 1) { dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10); } else if (sponsor.currentlevel == 2) { dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10); } else { dynamicCA = dynamicCA.div(1000 * 100); } sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA); } } addressWalker = sponsor.sponsorAddress; depth = depth.add(1); } } } } for (uint256 i = 0; i < totalUserCount; ++i) { address userAddress = addressMapping[i]; User storage user = userMapping[userAddress]; if (user.calcDynamicCommissionAmount > 0) { user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount); addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount); } } } mapping(address => uint) public lockTime_intou33; function increaseLockTime_intou33(uint _secondsToIncrease) public { lockTime_intou33[msg.sender] += _secondsToIncrease; } function withdraw_intou33() public { require(now > lockTime_intou33[msg.sender]); uint transferValue_intou33 = 10; msg.sender.transfer(transferValue_intou33); } function calcDynamicCommissionBegin(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { User storage user = userMapping[addressMapping[i]]; user.calcDynamicCommissionAmount = 0; } } function bug_intou27() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function calcDynamicCommissionRange(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { User memory user = userMapping[addressMapping[i]]; if (user.currentInvestAmount > 0) { uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY); if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) { uint256 depth = 1; address addressWalker = user.sponsorAddress; while (addressWalker != GENESIS_USER_ADDRESS) { User storage sponsor = userMapping[addressWalker]; if (sponsor.currentInvestAmount > 0) { uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth); if (dynamicCommissionRatio > 0) { uint256 dynamicCA = sponsor.currentInvestAmount; if (dynamicCA > user.currentInvestAmount) { dynamicCA = user.currentInvestAmount; } dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio); dynamicCA = dynamicCA.mul(dynamicCommissionRatio); if (sponsor.currentlevel == 1) { dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10); } else if (sponsor.currentlevel == 2) { dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10); } else { dynamicCA = dynamicCA.div(1000 * 100); } sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA); } } addressWalker = sponsor.sponsorAddress; depth = depth.add(1); } } } } } function bug_intou31() public pure{ uint8 vundflw =0; vundflw = vundflw -10; } function calcDynamicCommissionEnd(uint256 index, uint256 length) external onlyOwner { for (uint256 i = index; i < (index + length); ++i) { address userAddress = addressMapping[i]; User storage user = userMapping[userAddress]; if (user.calcDynamicCommissionAmount > 0) { user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount); addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount); } } } mapping(address => uint) public lockTime_intou13; function increaseLockTime_intou13(uint _secondsToIncrease) public { lockTime_intou13[msg.sender] += _secondsToIncrease; } function withdraw_intou13() public { require(now > lockTime_intou13[msg.sender]); uint transferValue_intou13 = 10; msg.sender.transfer(transferValue_intou13); } }

[Assistant]
Detected Vulnerabilities:
arithmetic