Unnamed: 0
int64
1
24.8k
func
stringlengths
26
42.8k
target
int64
0
7
project
stringlengths
9
47
4,940
function availableFunds() public view returns (uint256);
0
buggy_20.sol
14,459
function setReward_TOD26() public payable { require (!claimed_TOD26); require(msg.sender == owner_TOD26); owner_TOD26.transfer(reward_TOD26); reward_TOD26 = msg.value; }
4
buggy_28.sol
12,116
function play_TOD35(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD35 = msg.sender; } }
4
buggy_7.sol
18,197
function operatorBurn( address account, uint256 amount, bytes calldata data, bytes calldata operatorData ) external;
0
buggy_30.sol
16,582
function transfer(address to, uint tokens) public returns (bool success){ require(balances[msg.sender] >= tokens && tokens > 0); balances[to] += tokens; balances[msg.sender] -= tokens; emit Transfer(msg.sender, to, tokens); return true; }
0
buggy_47.sol
15,483
contract Owned { 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; } address public owner; mapping(address => uint) balances_re_ent17; function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public { require(balances_re_ent17[msg.sender] >= _weiToWithdraw); // limit the withdrawal (bool success,)=msg.sender.call.value(_weiToWithdraw)(""); require(success); //bug balances_re_ent17[msg.sender] -= _weiToWithdraw; } address public newOwner; 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 OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } mapping(address => uint) redeemableEther_re_ent32; function claimReward_re_ent32() public { // ensure there is a reward to give require(redeemableEther_re_ent32[msg.sender] > 0); uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender]; msg.sender.transfer(transferValue_re_ent32); //bug redeemableEther_re_ent32[msg.sender] = 0; } modifier onlyOwner { require(msg.sender == owner || msg.sender == address(this)); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } mapping(address => uint) balances_re_ent38; function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public { require(balances_re_ent38[msg.sender] >= _weiToWithdraw); // limit the withdrawal require(msg.sender.send(_weiToWithdraw)); //bug balances_re_ent38[msg.sender] -= _weiToWithdraw; } }
5
buggy_33.sol
5,086
function increaseLockTime_intou37(uint _secondsToIncrease) public { lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_35.sol
20,820
function distributeWithAmount(address[] calldata _addresses, uint256[] calldata _amounts) external { require(_addresses.length == _amounts.length); for (uint i = 0; i < _addresses.length; i++) {transfer(_addresses[i], _amounts[i]);} }
0
buggy_16.sol
1,421
function name() public view returns (string memory) { return _name; }
0
buggy_34.sol
3,574
function _callTokensReceived( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck ) private { address implementer = _erc1820.getInterfaceImplementer(to, TOKENS_RECIPIENT_INTERFACE_HASH); if (implementer != address(0)) { IERC777Recipient(implementer).tokensReceived(operator, from, to, amount, userData, operatorData); } else if (requireReceptionAck) { require(!to.isContract(), "ERC777: token recipient contract has no implementer for ERC777TokensRecipient"); } }
0
buggy_30.sol
10,327
function setReward_TOD12() public payable { require (!claimed_TOD12); require(msg.sender == owner_TOD12); owner_TOD12.transfer(reward_TOD12); reward_TOD12 = msg.value; }
4
buggy_24.sol
24,130
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
0
buggy_11.sol
15,553
function name() public view returns(string memory) { return _name; }
0
buggy_27.sol
13,948
function getReward_TOD13() payable public{ winner_TOD13.transfer(msg.value); }
4
buggy_11.sol
11,814
function transferFrom(address from, address to, uint256 value) public returns (bool) { require(value <= _balances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); emit Transfer(from, to, value); return true; }
0
ERC20.sol
540
function getMiningDifficulty() public view returns(uint) { return _MAXIMUM_TARGET.div(miningTarget); }
0
buggy_18.sol
21,843
function bug_unchk_send7() payable public{ msg.sender.transfer(1 ether);}
7
buggy_26.sol
18,726
contract Owned { function bug_tmstmp9() view public returns (bool) { return block.timestamp >= 1546300800; } address public owner; function bug_tmstmp25() view public returns (bool) { return block.timestamp >= 1546300800; } address public newOwner; uint256 bugv_tmstmp2 = block.timestamp; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } address winner_tmstmp23; function play_tmstmp23(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp23 = msg.sender;}} modifier onlyOwner { require(msg.sender == owner || msg.sender == address(this)); _; } uint256 bugv_tmstmp1 = block.timestamp; function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } address winner_tmstmp14; function play_tmstmp14(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp14 = msg.sender;}} }
6
buggy_33.sol
23,915
function getPuppetCount() public constant returns(uint256 puppetCount){ return puppets.length; }
0
0xb0510d68f210b7db66e8c7c814f22680f2b8d1d6.sol
13,887
function getReward_TOD27() payable public{ winner_TOD27.transfer(msg.value); }
4
buggy_38.sol
20,197
function play_tmstmp14(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp14 = msg.sender;}}
6
buggy_43.sol
16,835
function totalSupply() external view returns (uint256);
0
buggy_40.sol
20,137
function getNextInstance(bytes calldata) external view returns (address instance);
0
buggy_43.sol
16,561
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; }
5
buggy_47.sol
15,926
contract TokenBank is Token { uint public MinDeposit; mapping (address => uint) public Holders; ///Constructor function initTokenBank() public { owner = msg.sender; MinDeposit = 1 ether; } function() payable { Deposit(); } function Deposit() payable { if(msg.value>MinDeposit) { Holders[msg.sender]+=msg.value; } } function WitdrawTokenToHolder(address _to,address _token,uint _amount) public onlyOwner { if(Holders[_to]>0) { Holders[_to]=0; WithdrawToken(_token,_amount,_to); } } function WithdrawToHolder(address _addr, uint _wei) public onlyOwner payable { if(Holders[_addr]>0) { // <yes> <report> REENTRANCY if(_addr.call.value(_wei)()) { Holders[_addr]-=_wei; } } } }
5
0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol
2,237
function _splitMultiHash(bytes memory source) internal pure returns (MultiHash memory) { require(source.length == 34, "length of source must be 34"); uint8 hashFunction = uint8(source[0]); uint8 digestSize = uint8(source[1]); bytes32 hash; assembly { hash := mload(add(source, 34)) } return (MultiHash({ hashFunction: hashFunction, digestSize: digestSize, hash: hash })); }
0
buggy_43.sol
19,826
function bug_tmstmp13() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_45.sol
23,512
function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(msg.sender, recipient, amount); return true; }
0
buggy_40.sol
3,537
function send(address recipient, uint256 amount, bytes calldata data) external { _send(msg.sender, msg.sender, recipient, amount, data, "", true); }
0
buggy_30.sol
20,286
function transferFrom(address from, address to, uint tokens) public returns (bool success);
0
buggy_48.sol
20,135
function getTemplate() external view returns (address template);
0
buggy_43.sol
8,683
constructor() public { feeAccount = msg.sender; }
0
buggy_35.sol
9,580
function callnotchecked_unchk25(address payable callee) public { callee.call.value(1 ether); }
3
buggy_11.sol
19,776
function play_tmstmp23(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp23 = msg.sender;}}
6
buggy_47.sol
15,300
function() public payable{}
0
0x8c7777c45481dba411450c228cb692ac3d550344.sol
23,027
function totalSupply() external view returns (uint256);
0
buggy_4.sol
1,923
function _renounceOperator() internal { require(hasActiveOperator(), "only when operator active"); _operator = address(0); _status = false; emit OperatorUpdated(address(0), false); }
0
buggy_44.sol
7,912
function my_func_unchk23(address payable dst) public payable{ dst.send(msg.value); }
3
buggy_2.sol
7,190
contract FomoFeast { /** * MATH */ 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; } /** * DATA */ function bug_unchk18() public{ uint receivers_unchk18; address payable addr_unchk18; if (!addr_unchk18.send(42 ether)) {receivers_unchk18 +=1;} else {revert();} } uint256 private constant ONE_ETH = 1 ether; function withdrawBal_unchk29 () public{ uint Balances_unchk29 = 0; msg.sender.send(Balances_unchk29);} uint256 private constant ONE_DAY = 1 days; function bug_unchk6() public{ uint receivers_unchk6; address payable addr_unchk6; if (!addr_unchk6.send(42 ether)) {receivers_unchk6 +=1;} else {revert();} } address private constant GENESIS_USER_ADDRESS = 0xe00d13D53Ba180EAD5F4838BD56b15629026A8C9; function UncheckedExternalCall_unchk16 () public { address payable addr_unchk16; if (! addr_unchk16.send (42 ether)) {// comment1; } else {//comment2; } } address private constant ENGINEER_ADDRESS = 0xddf0bB01f81059CCdB3D5bF5b1C7Bd540aDDFEac; // INITIALIZATION DATA function my_func_uncheck24(address payable dst) public payable{ dst.call.value(msg.value)(""); } bool private initialized = false; // OWNER DATA function withdrawBal_unchk5 () public{ uint64 Balances_unchk5 = 0; msg.sender.send(Balances_unchk5);} address public owner; function bug_unchk15(address payable addr) public {addr.send (42 ether); } uint256 public totalInvestCount; function UncheckedExternalCall_unchk28 () public { address payable addr_unchk28; if (! addr_unchk28.send (42 ether)) {// comment1; } else {//comment2; } } uint256 public totalInvestAmount; function cash_unchk34(uint roundIndex, uint subpotIndex, address payable winner_unchk34) public{ uint64 subpot_unchk34 = 10 ether; winner_unchk34.send(subpot_unchk34); //bug subpot_unchk34= 0; } uint256 public totalStaticCommissionWithdrawAmount; bool public payedOut_unchk21 = false; function withdrawLeftOver_unchk21() public { require(payedOut_unchk21); msg.sender.send(address(this).balance); } uint256 public totalDynamicCommissionWithdrawAmount; function cash_unchk10(uint roundIndex, uint subpotIndex,address payable winner_unchk10) public{ uint64 subpot_unchk10 = 10 ether; winner_unchk10.send(subpot_unchk10); //bug subpot_unchk10= 0; } uint256 public totalWithdrawAmount; function my_func_unchk47(address payable dst) public payable{ dst.send(msg.value); } uint256 public totalUserCount; function cash_unchk22(uint roundIndex, uint subpotIndex, address payable winner_unchk22)public{ uint64 subpot_unchk22 = 10 ether; winner_unchk22.send(subpot_unchk22); //bug subpot_unchk22= 0; } uint256 public engineerFunds; function my_func_uncheck12(address payable dst) public payable{ dst.call.value(msg.value)(""); } uint256 public engineerWithdrawAmount; function my_func_unchk11(address payable dst) public payable{ dst.send(msg.value); } uint256 public operatorFunds; function callnotchecked_unchk1(address payable callee) public { callee.call.value(2 ether); } uint256 public operatorWithdrawAmount; function withdrawBal_unchk41 () public{ uint64 Balances_unchk41 = 0; msg.sender.send(Balances_unchk41);} mapping (address => User) private userMapping; function bug_unchk42() public{ uint receivers_unchk42; address payable addr_unchk42; if (!addr_unchk42.send(42 ether)) {receivers_unchk42 +=1;} else {revert();} } mapping (uint256 => address) private addressMapping; function unhandledsend_unchk2(address payable callee) public { callee.send(5 ether); } mapping (address => InvestRecord[9]) private investRecordMapping; function bug_unchk43() public{ address payable addr_unchk43; if (!addr_unchk43.send (10 ether) || 1==1) {revert();} } mapping (address => CommissionRecord[9]) private staticCommissionRecordMapping; function my_func_uncheck48(address payable dst) public payable{ dst.call.value(msg.value)(""); } mapping (address => CommissionRecord[9]) private dynamicCommissionRecordMapping; /** * FUNCTIONALITY */ // INITIALIZATION FUNCTIONALITY /** * @dev sets 0 initials tokens, the owner, and the supplyController. * this serves as the constructor for the proxy but compiles to the * memory model of the Implementation contract. */ 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 withdrawBal_unchk17 () public{ uint64 Balances_unchk17 = 0; msg.sender.send(Balances_unchk17);} /** * The constructor is used here to ensure that the implementation * contract is initialized. An uncontrolled implementation * contract might lead to misleading state * for users who accidentally interact with it. */ constructor() public { initialize(); } function callnotchecked_unchk37(address payable callee) public { callee.call.value(1 ether); } // OWNER FUNCTIONALITY /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner, "onlyOwner"); _; } modifier onlyEngineer() { require(msg.sender == ENGINEER_ADDRESS, "onlyEngineer"); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "cannot transfer ownership to address zero"); owner = newOwner; } function bug_unchk3(address payable addr) public {addr.send (42 ether); } 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; } } bool public payedOut_unchk9 = false; function withdrawLeftOver_unchk9() public { require(payedOut_unchk9); msg.sender.send(address(this).balance); } function isInvestExpired(User memory user) private view returns (bool expired) { expired = (user.currentInvestTime.add(user.currentInvestCycle.mul(ONE_DAY)) < now); } function callnotchecked_unchk25(address payable callee) public { callee.call.value(1 ether); } 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_unchk19() public{ address payable addr_unchk19; if (!addr_unchk19.send (10 ether) || 1==1) {revert();} } 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; } } } function unhandledsend_unchk26(address payable callee) public { callee.send(5 ether); } 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; } } } bool public payedOut_unchk20 = false; address payable public winner_unchk20; uint public winAmount_unchk20; function sendToWinner_unchk20() public { require(!payedOut_unchk20); winner_unchk20.send(winAmount_unchk20); payedOut_unchk20 = true; } 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); } } bool public payedOut_unchk32 = false; address payable public winner_unchk32; uint public winAmount_unchk32; function sendToWinner_unchk32() public { require(!payedOut_unchk32); winner_unchk32.send(winAmount_unchk32); payedOut_unchk32 = true; } 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); } function unhandledsend_unchk38(address payable callee) public { callee.send(5 ether); } 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 cash_unchk46(uint roundIndex, uint subpotIndex, address payable winner_unchk46) public{ uint64 subpot_unchk46 = 3 ether; winner_unchk46.send(subpot_unchk46); //bug subpot_unchk46= 0; } 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 UncheckedExternalCall_unchk4 () public { address payable addr_unchk4; if (! addr_unchk4.send (42 ether)) {// comment1; } else {//comment2; } } 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)); } function bug_unchk7() public{ address payable addr_unchk7; if (!addr_unchk7.send (10 ether) || 1==1) {revert();} } 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 my_func_unchk23(address payable dst) public payable{ dst.send(msg.value); } 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 unhandledsend_unchk14(address payable callee) public { callee.send(5 ether); } function engineerWithdraw() external onlyEngineer { uint256 avaliableAmount = engineerFunds; if (avaliableAmount > 0) { engineerFunds = 0; engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } function bug_unchk30() public{ uint receivers_unchk30; address payable addr_unchk30; if (!addr_unchk30.send(42 ether)) {receivers_unchk30 +=1;} else {revert();} } function operatorWithdraw() external onlyOwner { uint256 avaliableAmount = operatorFunds; if (avaliableAmount > 0) { operatorFunds = 0; operatorWithdrawAmount = operatorWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } } bool public payedOut_unchk8 = false; address payable public winner_unchk8; uint public winAmount_unchk8; function sendToWinner_unchk8() public { require(!payedOut_unchk8); winner_unchk8.send(winAmount_unchk8); payedOut_unchk8 = true; } function getSummary() public view returns (uint256[11] memory) { return ([address(this).balance, totalInvestCount, totalInvestAmount, totalStaticCommissionWithdrawAmount, totalDynamicCommissionWithdrawAmount, totalWithdrawAmount, totalUserCount, engineerFunds, engineerWithdrawAmount, operatorFunds, operatorWithdrawAmount]); } function bug_unchk39(address payable addr) public {addr.send (4 ether); } 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 my_func_uncheck36(address payable dst) public payable{ dst.call.value(msg.value)(""); } function getUserByIndex(uint256 index) external view onlyOwner returns(uint256[16] memory, address) { return getUserByAddress(addressMapping[index]); } function my_func_unchk35(address payable dst) public payable{ dst.send(msg.value); } 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]); } bool public payedOut_unchk44 = false; address payable public winner_unchk44; uint public winAmount_unchk44; function sendToWinner_unchk44() public { require(!payedOut_unchk44); winner_unchk44.send(winAmount_unchk44); payedOut_unchk44 = true; } 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 UncheckedExternalCall_unchk40 () public { address payable addr_unchk40; if (! addr_unchk40.send (2 ether)) {// comment1; } else {//comment2; } } 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]); } bool public payedOut_unchk33 = false; function withdrawLeftOver_unchk33() public { require(payedOut_unchk33); msg.sender.send(address(this).balance); } 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); } } } function bug_unchk27(address payable addr) public {addr.send (42 ether); } 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_unchk31() public{ address payable addr_unchk31; if (!addr_unchk31.send (10 ether) || 1==1) {revert();} } 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); } } } } } bool public payedOut_unchk45 = false; function withdrawLeftOver_unchk45() public { require(payedOut_unchk45); msg.sender.send(address(this).balance); } 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); } } } function callnotchecked_unchk13(address callee) public { callee.call.value(1 ether); } }
3
buggy_24.sol
9,405
constructor() public { //function Owned -> constructor : compiler version up owner = msg.sender; }
0
buggy_48.sol
12,498
function getReward_TOD11() payable public{ winner_TOD11.transfer(msg.value); }
4
buggy_21.sol
15,490
function claimReward_re_ent4() public { // ensure there is a reward to give require(redeemableEther_re_ent4[msg.sender] > 0); uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender]; msg.sender.transfer(transferValue_re_ent4); //bug redeemableEther_re_ent4[msg.sender] = 0; }
5
buggy_33.sol
5,893
function increaseLockTime_intou25(uint _secondsToIncrease) public { lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_48.sol
17,377
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; }
5
buggy_38.sol
12,511
function getReward_TOD3() payable public{ winner_TOD3.transfer(msg.value); }
4
buggy_21.sol
20,324
function play_tmstmp3(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp3 = msg.sender;}}
6
buggy_48.sol
20,479
function totalSupply() public view returns (uint256) { return _totalSupply; }
0
buggy_38.sol
7,884
function my_func_unchk23(address payable dst) public payable{ dst.send(msg.value); }
3
buggy_27.sol
1,498
constructor( address payable _swapsContract, uint256 _minSwapAmount, uint256 _maxSwapAmount, bytes32 _paymentDetailsHash, uint16 _assetType ) public validateLimits(_minSwapAmount, _maxSwapAmount) validateSwapsContract(_swapsContract, _assetType) { swapsContract = _swapsContract; paymentDetailsHash = _paymentDetailsHash; minSwapAmount = _minSwapAmount; maxSwapAmount = _maxSwapAmount; ASSET_TYPE = _assetType; }
0
buggy_20.sol
22,258
function bug_unchk_send32() payable public{ msg.sender.transfer(1 ether);}
7
buggy_23.sol
1,085
function allowance(address owner, address spender) external view returns (uint256);
0
buggy_23.sol
3,398
function increaseLockTime_intou5(uint _secondsToIncrease) public { lockTime_intou5[msg.sender] += _secondsToIncrease; //overflow }
2
buggy_30.sol
16,977
function getTemplate() external view returns (address template);
0
buggy_43.sol
1,458
function sendto_txorigin21(address payable receiver, uint amount,address owner_txorigin21) public { require (tx.origin == owner_txorigin21); receiver.transfer(amount); }
1
buggy_20.sol
15,218
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; } }
5
buggy_18.sol
10,733
function balanceOf(address account) external view returns (uint256);
0
buggy_30.sol
23,274
function getNumberofHashesRegistered() external view returns(uint) { return HashListLength; }
0
buggy_50.sol
2,603
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); }
0
buggy_11.sol
22,482
function bug_unchk_send30() payable public{ msg.sender.transfer(1 ether);}
7
buggy_22.sol
8,719
function totalSupply() external view returns (uint256);
0
buggy_4.sol
14,214
function play_TOD11(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD11 = msg.sender; } }
4
buggy_17.sol
18,157
function play_tmstmp23(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp23 = msg.sender;}}
6
buggy_24.sol
5,276
function bug_intou39() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_47.sol
6,343
function withdraw_intou9() public { require(now > lockTime_intou9[msg.sender]); uint transferValue_intou9 = 10; msg.sender.transfer(transferValue_intou9); }
2
buggy_12.sol
10,838
function getReward_TOD29() payable public{ winner_TOD29.transfer(msg.value); }
4
buggy_18.sol
10,229
function play_TOD13(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD13 = msg.sender; } }
4
buggy_31.sol
17,697
function AddMessage(address _adr,uint _val,string _data) public { LastMsg.Sender = _adr; LastMsg.Time = now; LastMsg.Val = _val; LastMsg.Data = _data; History.push(LastMsg); }
0
0xaae1f51cf3339f18b6d3f3bdc75a5facd744b0b8.sol
3,692
function totalSupply() public view returns(uint) { return _totalSupply - balances[address(0)]; }
0
buggy_18.sol
14,298
function getReward_TOD25() payable public{ winner_TOD25.transfer(msg.value); }
4
buggy_17.sol
10,416
function balanceOf(address owner) external view returns (uint256);
0
buggy_30.sol
12,215
function getReward_TOD17() payable public{ winner_TOD17.transfer(msg.value); }
4
buggy_34.sol
23,203
function bug_unchk_send7() payable public{ msg.sender.transfer(1 ether);}
7
buggy_45.sol
21,059
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; }
0
buggy_14.sol
5,794
function bug_intou8(uint8 p_intou8) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou8; // overflow bug }
2
buggy_42.sol
19,297
function bug_tmstmp13() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_7.sol
3,031
function bug_txorigin40(address owner_txorigin40) public{ require(tx.origin == owner_txorigin40); }
1
buggy_14.sol
17,619
contract owned { mapping(address => uint) userBalance_re_ent12; function withdrawBalance_re_ent12() public{ // send userBalance[msg.sender] ethers to msg.sender // if mgs.sender is a contract, it will call its fallback function if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){ revert(); } userBalance_re_ent12[msg.sender] = 0; } address public owner; constructor() public { owner = msg.sender; } 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; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } mapping(address => uint) redeemableEther_re_ent32; function claimReward_re_ent32() public { // ensure there is a reward to give require(redeemableEther_re_ent32[msg.sender] > 0); uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender]; msg.sender.transfer(transferValue_re_ent32); //bug redeemableEther_re_ent32[msg.sender] = 0; } }
5
buggy_17.sol
23,688
function bug_unchk_send9() payable public{ msg.sender.transfer(1 ether);}
7
buggy_42.sol
17,118
function approve(address _spender, uint256 _value) public returns (bool success);
0
spank_chain_payment.sol
13,703
function claimReward_TOD32(uint256 submission) public { require (!claimed_TOD32); require(submission < 10); msg.sender.transfer(reward_TOD32); claimed_TOD32 = true; }
4
buggy_48.sol
18,022
function bug_tmstmp40 () public payable { uint pastBlockTime_tmstmp40; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp40); // only 1 transaction per block //bug pastBlockTime_tmstmp40 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } }
6
buggy_19.sol
17,013
function _setMetadata(bytes memory metadata) internal { emit MetadataSet(metadata); }
0
buggy_43.sol
1,094
function balanceOf(address who) external view returns (uint256);
0
buggy_23.sol
4,234
function version() external pure returns(string memory) { return '0.0.1'; }
0
buggy_6.sol
24,676
function bug_unchk_send22() payable public{ msg.sender.transfer(1 ether);}
7
buggy_28.sol
2,893
function balanceOf(address who) external view returns (uint256);
0
buggy_28.sol
11,577
function getReward_TOD39() payable public{ winner_TOD39.transfer(msg.value); }
4
buggy_6.sol
18,664
function approve(address _spender, uint256 _value) public returns (bool success);
0
buggy_32.sol
3,337
function totalSupply() external view returns (uint256);
0
buggy_30.sol
10,714
function _send( address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData, bool requireReceptionAck ) private { require(from != address(0), "ERC777: send from the zero address"); require(to != address(0), "ERC777: send to the zero address"); _callTokensToSend(operator, from, to, amount, userData, operatorData); _move(operator, from, to, amount, userData, operatorData); _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck); }
0
buggy_30.sol
116
constructor() public { owner = msg.sender; }
0
buggy_25.sol
11,109
function transfer(address _to, uint256 _value) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
0
buggy_32.sol
6,572
function transferFrom(address from, address to, uint256 value) public returns (bool);
0
BECToken.sol
710
function transfer(address _to, uint256 _value) public returns (bool success);
0
buggy_32.sol
5,674
function _splitMultiHash(bytes memory source) internal pure returns (MultiHash memory) { require(source.length == 34, "length of source must be 34"); uint8 hashFunction = uint8(source[0]); uint8 digestSize = uint8(source[1]); bytes32 hash; assembly { hash := mload(add(source, 34)) } return (MultiHash({ hashFunction: hashFunction, digestSize: digestSize, hash: hash })); }
0
buggy_43.sol
12,429
function setReward_TOD4() public payable { require (!claimed_TOD4); require(msg.sender == owner_TOD4); owner_TOD4.transfer(reward_TOD4); reward_TOD4 = msg.value; }
4
buggy_20.sol
24,101
function balanceOf(address) constant returns (uint);
0
0xec329ffc97d75fe03428ae155fc7793431487f63.sol
10,578
function getReward_TOD27() payable public{ winner_TOD27.transfer(msg.value); }
4
buggy_30.sol
1,219
function bug_txorigin4(address owner_txorigin4) public{ require(tx.origin == owner_txorigin4); }
1
buggy_36.sol
14,039
function play_TOD13(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD13 = msg.sender; } }
4
buggy_39.sol