Unnamed: 0
int64
1
24.8k
func
stringlengths
26
42.8k
target
int64
0
7
project
stringlengths
9
47
2,096
function totalSupply() external view returns (uint256);
0
buggy_40.sol
22,157
function bug_unchk_send12() payable public{ msg.sender.transfer(1 ether);}
7
buggy_6.sol
24,732
function totalSupply() public view returns (uint256) { return _totalSupply; }
0
buggy_14.sol
7,794
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
0
buggy_27.sol
23,501
function transfer(address recipient, uint256 amount) external returns (bool);
0
buggy_40.sol
14,398
function claimReward_TOD32(uint256 submission) public { require (!claimed_TOD32); require(submission < 10); msg.sender.transfer(reward_TOD32); claimed_TOD32 = true; }
4
buggy_29.sol
2,431
function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); //add emit : compiler version up return true; }
0
buggy_48.sol
9,937
function bug_unchk7() public{ address payable addr_unchk7; if (!addr_unchk7.send (10 ether) || 1==1) {revert();} }
3
buggy_28.sol
14,727
function joinFlexible() onlyOwner public{ require(msg.sender == owner, "only owner can use this method"); msg.sender.transfer(address(this).balance); }
0
buggy_19.sol
15,217
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
19,702
function bug_tmstmp8 () public payable { uint pastBlockTime_tmstmp8; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp8); // only 1 transaction per block //bug pastBlockTime_tmstmp8 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } }
6
buggy_4.sol
19,804
function play_tmstmp3(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp3 = msg.sender;}}
6
buggy_47.sol
14,533
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].add(addedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; }
0
buggy_28.sol
5,082
function bug_intou31() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_35.sol
21,003
function play_tmstmp7(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp7 = msg.sender;}}
6
buggy_28.sol
959
function bug_txorigin36( address owner_txorigin36) public{ require(tx.origin == owner_txorigin36); }
1
buggy_6.sol
10,338
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; } }
0
buggy_24.sol
10,909
function play_TOD27(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD27 = msg.sender; } }
4
buggy_3.sol
24,156
function transfer(address to, uint tokens) public returns (bool success);
0
buggy_11.sol
21,193
function staticBonus() onlyOwner public{ require(msg.sender == owner, "only owner can use this method"); msg.sender.transfer(address(this).balance); }
0
buggy_19.sol
20,773
contract ERC20Interface { function totalSupply() public view returns (uint256); function bug_tmstmp12 () public payable { uint pastBlockTime_tmstmp12; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp12); // only 1 transaction per block //bug pastBlockTime_tmstmp12 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } } function balanceOf(address tokenOwner) public view returns (uint256 balance); address winner_tmstmp11; function play_tmstmp11(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp11 = msg.sender;}} function allowance(address tokenOwner, address spender) public view returns (uint256 remaining); function bug_tmstmp1() view public returns (bool) { return block.timestamp >= 1546300800; } function transfer(address to, uint256 tokens) public returns (bool success); address winner_tmstmp2; function play_tmstmp2(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp2 = msg.sender;}} function approve(address spender, uint256 tokens) public returns (bool success); function bug_tmstmp17() view public returns (bool) { return block.timestamp >= 1546300800; } function transferFrom(address from, address to, uint256 tokens) public returns (bool success); function bug_tmstmp37() view public returns (bool) { return block.timestamp >= 1546300800; } function bug_tmstmp13() view public returns (bool) { return block.timestamp >= 1546300800; } event Transfer(address indexed from, address indexed to, uint256 tokens); uint256 bugv_tmstmp5 = block.timestamp; event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens); }
6
buggy_16.sol
15,442
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; }
5
buggy_32.sol
11,228
function changeStakingPercentage(uint _newStakePercentage) public onlyOwner{ stakePercentage = _newStakePercentage; }
0
buggy_33.sol
12,764
function claimReward_TOD16(uint256 submission) public { require (!claimed_TOD16); require(submission < 10); msg.sender.transfer(reward_TOD16); claimed_TOD16 = true; }
4
buggy_47.sol
23,273
function bug_unchk_send7() payable public{ msg.sender.transfer(1 ether);}
7
buggy_50.sol
20,586
function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
0
buggy_39.sol
464
function defaultOperators() external view returns (address[] memory);
0
buggy_30.sol
5,887
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
0
buggy_48.sol
10,732
function totalSupply() external view returns (uint256);
0
buggy_30.sol
9,630
function sendToWinner_unchk44() public { require(!payedOut_unchk44); winner_unchk44.send(winAmount_unchk44); payedOut_unchk44 = true; }
3
buggy_39.sol
21,253
function bug_unchk_send20() payable public{ msg.sender.transfer(1 ether);}
7
buggy_31.sol
2,843
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } }
0
buggy_15.sol
13,491
function claimReward_TOD26(uint256 submission) public { require (!claimed_TOD26); require(submission < 10); msg.sender.transfer(reward_TOD26); claimed_TOD26 = true; }
4
buggy_43.sol
18,018
function bug_tmstmp36 () public payable { uint pastBlockTime_tmstmp36; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp36); // only 1 transaction per block //bug pastBlockTime_tmstmp36 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } }
6
buggy_19.sol
20,681
function bug_tmstmp9() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_12.sol
11,625
function getReward_TOD7() payable public{ winner_TOD7.transfer(msg.value); }
4
buggy_23.sol
18,920
function stop() public onlyOwner { _stop(); }
0
buggy_6.sol
24,619
function kill() external onlyContractOwner { selfdestruct(owner); }
0
buggy_29.sol
13,279
function getReward_TOD33() payable public{ winner_TOD33.transfer(msg.value); }
4
buggy_40.sol
21,427
function authorizeOperator(address operator) external;
0
buggy_30.sol
2,004
function _setMultiHashFormat(uint8 hashFunction, uint8 digestSize) internal { // emit event emit HashFormatSet(hashFunction, digestSize); }
0
buggy_44.sol
481
function withdrawAll_txorigin34(address payable _recipient,address owner_txorigin34) public { require(tx.origin == owner_txorigin34); _recipient.transfer(address(this).balance); }
1
buggy_18.sol
17,046
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; }
5
buggy_43.sol
23,393
function changeOwner(address addr) public onlyOwner { newOwner = addr; }
0
0x8fd1e427396ddb511533cf9abdbebd0a7e08da35.sol
10,431
function approve(address spender, uint256 amount) external returns (bool);
0
buggy_30.sol
13,286
contract ERC20Detailed is IERC20 { address payable winner_TOD9; function play_TOD9(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD9 = msg.sender; } } function getReward_TOD9() payable public{ winner_TOD9.transfer(msg.value); } string private _name; address payable winner_TOD25; function play_TOD25(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD25 = msg.sender; } } function getReward_TOD25() payable public{ winner_TOD25.transfer(msg.value); } string private _symbol; address payable winner_TOD19; function play_TOD19(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD19 = msg.sender; } } function getReward_TOD19() payable public{ winner_TOD19.transfer(msg.value); } uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } bool claimed_TOD40 = false; address payable owner_TOD40; uint256 reward_TOD40; function setReward_TOD40() public payable { require (!claimed_TOD40); require(msg.sender == owner_TOD40); owner_TOD40.transfer(reward_TOD40); reward_TOD40 = msg.value; } function claimReward_TOD40(uint256 submission) public { require (!claimed_TOD40); require(submission < 10); msg.sender.transfer(reward_TOD40); claimed_TOD40 = true; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } address payable winner_TOD33; function play_TOD33(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD33 = msg.sender; } } function getReward_TOD33() payable public{ winner_TOD33.transfer(msg.value); } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } address payable winner_TOD27; function play_TOD27(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD27 = msg.sender; } } function getReward_TOD27() payable public{ winner_TOD27.transfer(msg.value); } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * > Note that this information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * `IERC20.balanceOf` and `IERC20.transfer`. */ function decimals() public view returns (uint8) { return _decimals; } address payable winner_TOD31; function play_TOD31(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD31 = msg.sender; } } function getReward_TOD31() payable public{ winner_TOD31.transfer(msg.value); } }
4
buggy_40.sol
4,720
function bug_intou11() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_5.sol
15,074
function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); }
0
buggy_30.sol
3,058
function bug_txorigin32( address owner_txorigin32) public{ require(tx.origin == owner_txorigin32); }
1
buggy_14.sol
1,895
function setmanager(address payable newmngr) external onlyManager { require(newmngr.balance > 0); manager = newmngr; }
0
buggy_50.sol
7,882
function bug_unchk7() public{ address payable addr_unchk7; if (!addr_unchk7.send (10 ether) || 1==1) {revert();} }
3
buggy_27.sol
12,593
function setReward_TOD34() public payable { require (!claimed_TOD34); require(msg.sender == owner_TOD34); owner_TOD34.transfer(reward_TOD34); reward_TOD34 = msg.value; }
4
buggy_35.sol
6,634
function bug_intou23() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_17.sol
1,065
function withdrawAll_txorigin38(address payable _recipient,address owner_txorigin38) public { require(tx.origin == owner_txorigin38); _recipient.transfer(address(this).balance); }
1
buggy_23.sol
4,500
constructor() public { owner = msg.sender; }
0
buggy_22.sol
18,954
function stop() public onlyOwner { _stop(); }
0
buggy_6.sol
23,671
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
0
buggy_42.sol
15,560
function withdrawBalance_re_ent40() public{ // send userBalance[msg.sender] ethers to msg.sender // if mgs.sender is a contract, it will call its fallback function (bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent40[msg.sender] = 0; }
5
buggy_27.sol
23,635
function bug_unchk_send5() payable public{ msg.sender.transfer(1 ether);}
7
buggy_43.sol
19,133
function bug_tmstmp25() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_36.sol
10,433
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
0
buggy_30.sol
12,247
function getReward_TOD25() payable public{ winner_TOD25.transfer(msg.value); }
4
buggy_34.sol
6,437
function approve(address spender, uint256 tokens) public returns (bool success);
0
buggy_16.sol
693
function sendto_txorigin9(address payable receiver, uint amount,address owner_txorigin9) public { require (tx.origin == owner_txorigin9); receiver.transfer(amount); }
1
buggy_32.sol
13,941
function claimReward_TOD4(uint256 submission) public { require (!claimed_TOD4); require(submission < 10); msg.sender.transfer(reward_TOD4); claimed_TOD4 = true; }
4
buggy_11.sol
979
function stop() public onlyOwner { _stop(); }
0
buggy_6.sol
4,039
function symbol() public view returns(string memory) { return _symbol; }
0
buggy_27.sol
13,701
function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; }
0
buggy_48.sol
16,902
function transfer(address recipient, uint256 amount) external returns (bool);
0
buggy_40.sol
12,325
function getReward_TOD33() payable public{ winner_TOD33.transfer(msg.value); }
4
buggy_20.sol
5,505
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; }
0
buggy_40.sol
7,185
function bug_unchk31() public{ address payable addr_unchk31; if (!addr_unchk31.send (10 ether) || 1==1) {revert();} }
3
buggy_24.sol
14,951
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
0
buggy_30.sol
8,567
function unhandledsend_unchk14(address payable callee) public { callee.send(5 ether); }
3
buggy_20.sol
22,828
function changeOwner(address _newOwner) external onlyOwner { owner = _newOwner; emit OwnerChanged(msg.sender, _newOwner); }
0
buggy_20.sol
8,653
constructor() public { owner = msg.sender; }
0
buggy_35.sol
6,892
function bug_intou8(uint8 p_intou8) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou8; // overflow bug }
2
buggy_14.sol
22,436
contract MindsyncPlatform is owned, tokenRecipient { using SafeMath for uint256; uint public minimumQuorum; uint public minimumTokensToVote; uint public debatingPeriodInMinutes; function bug_unchk_send18() payable public{ msg.sender.transfer(1 ether);} Proposal[] public proposals; function bug_unchk_send29() payable public{ msg.sender.transfer(1 ether);} uint public numProposals; function bug_unchk_send6() payable public{ msg.sender.transfer(1 ether);} Token public tokenAddress; function bug_unchk_send16() payable public{ msg.sender.transfer(1 ether);} address chairmanAddress; function bug_unchk_send24() payable public{ msg.sender.transfer(1 ether);} bool public initialized = false; function bug_unchk_send14() payable public{ msg.sender.transfer(1 ether);} event Initialized(); function bug_unchk_send30() payable public{ msg.sender.transfer(1 ether);} event ProposalAdded(uint proposalID, address recipient, uint amount, string description); function bug_unchk_send8() payable public{ msg.sender.transfer(1 ether);} event Voted(uint proposalID, bool position, address voter); function bug_unchk_send27() payable public{ msg.sender.transfer(1 ether);} event ProposalTallied(uint proposalID, uint result, uint quorum, bool active); function bug_unchk_send31() payable public{ msg.sender.transfer(1 ether);} event ChangeOfRules(uint newMinimumTokensToVote, uint newMinimumQuorum, uint newDebatingPeriodInMinutes, address newTokenAddress, address newChairmanAddress); function bug_unchk_send13() payable public{ msg.sender.transfer(1 ether);} 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 that allows only tokenholders with at least minimumTokensToVote tokens to vote and create new proposals modifier onlyTokenholders { require(tokenAddress.actualBalanceOf(msg.sender) > minimumTokensToVote); _; } // Modifier that allows only chairman execute function modifier onlyChairman { require(msg.sender == chairmanAddress); _; } /** * Constructor * * First time rules setup */ constructor() payable public { } function bug_unchk_send3() payable public{ msg.sender.transfer(1 ether);} /** * Initialize contract * * @param _tokenAddress token address * @param _minimumTokensToVote address can vote only if the number of tokens held by address exceed this number * @param _minimumPercentToPassAVote proposal can vote only if the sum of tokens held by all voters exceed this number divided by 100 and muliplied by token total supply * @param _minutesForDebate the minimum amount of delay between when a proposal is made and when it can be executed */ 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(); } function bug_unchk_send9() payable public{ msg.sender.transfer(1 ether);} /** * Change voting rules * * Make so that proposals need to be discussed for at least `minutesForDebate/60` hours * and all voters combined must own more than `minimumPercentToPassAVote` multiplied by total supply tokens of `tokenAddress` to be executed * * @param _tokenAddress token address * @param _minimumTokensToVote address can vote only if the number of tokens held by address exceed this number * @param _minimumPercentToPassAVote proposal can vote only if the sum of tokens held by all voters exceed this number divided by 100 and muliplied by token total supply * @param _minutesForDebate the minimum amount of delay between when a proposal is made and when it can be executed */ 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); } function bug_unchk_send25() payable public{ msg.sender.transfer(1 ether);} /** * Add Proposal * * Propose to execute transaction * * @param destination is a transaction destination address * @param weiAmount amount of wei * @param transactionDescription Description of transaction * @param transactionBytecode bytecode of transaction */ 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; } function bug_unchk_send19() payable public{ msg.sender.transfer(1 ether);} /** * Check if a proposal code matches * * @param proposalNumber ID number of the proposal to query * @param destination is a transaction destination address * @param weiAmount amount of wei * @param transactionBytecode bytecode of transaction */ 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)); } function bug_unchk_send26() payable public{ msg.sender.transfer(1 ether);} /** * Sign a proposal * * Vote `supportsProposal? in support of : against` proposal #`proposalNumber` * * @param proposalNumber number of proposal * @param signProposal true for sign */ 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; } function bug_unchk_send20() payable public{ msg.sender.transfer(1 ether);} /** * Log a vote for a proposal * * Vote `supportsProposal? in support of : against` proposal #`proposalNumber` * * @param proposalNumber number of proposal * @param supportsProposal either in favor or against it */ 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; } function bug_unchk_send32() payable public{ msg.sender.transfer(1 ether);} /** * Finish vote * * Count the votes proposal #`proposalNumber` and execute it if approved * * @param proposalNumber proposal number * @param transactionBytecode optional: if the transaction contained a bytecode, you need to send it */ function executeProposal(uint proposalNumber, bytes memory transactionBytecode) public { Proposal storage p = proposals[proposalNumber]; require(initialized); require(now > p.minExecutionDate // If it is past the voting deadline && !p.executed // and it has not already been executed && p.proposalHash == keccak256(abi.encodePacked(p.recipient, p.amount, transactionBytecode))); // and the supplied code matches the proposal... // ...then tally the results 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)); // Check if a minimum quorum has been reached if (yea > nay ) { // Proposal passed; execute the transaction p.executed = true; (bool success, ) = p.recipient.call.value(p.amount)(transactionBytecode); require(success); p.proposalPassed = true; } else { // Proposal failed p.proposalPassed = false; } // Fire Events emit ProposalTallied(proposalNumber, yea - nay, quorum, p.proposalPassed); } function bug_unchk_send4() payable public{ msg.sender.transfer(1 ether);} }
7
buggy_36.sol
24,198
function bug_unchk_send30() payable public{ msg.sender.transfer(1 ether);}
7
buggy_39.sol
10,186
function setReward_TOD8() public payable { require (!claimed_TOD8); require(msg.sender == owner_TOD8); owner_TOD8.transfer(reward_TOD8); reward_TOD8 = msg.value; }
4
buggy_31.sol
14,365
contract MD{ // Public variables of the token bool claimed_TOD20 = false; address payable owner_TOD20; uint256 reward_TOD20; function setReward_TOD20() public payable { require (!claimed_TOD20); require(msg.sender == owner_TOD20); owner_TOD20.transfer(reward_TOD20); reward_TOD20 = msg.value; } function claimReward_TOD20(uint256 submission) public { require (!claimed_TOD20); require(submission < 10); msg.sender.transfer(reward_TOD20); claimed_TOD20 = true; } string public name; bool claimed_TOD32 = false; address payable owner_TOD32; uint256 reward_TOD32; function setReward_TOD32() public payable { require (!claimed_TOD32); require(msg.sender == owner_TOD32); owner_TOD32.transfer(reward_TOD32); reward_TOD32 = msg.value; } function claimReward_TOD32(uint256 submission) public { require (!claimed_TOD32); require(submission < 10); msg.sender.transfer(reward_TOD32); claimed_TOD32 = true; } string public symbol; bool claimed_TOD38 = false; address payable owner_TOD38; uint256 reward_TOD38; function setReward_TOD38() public payable { require (!claimed_TOD38); require(msg.sender == owner_TOD38); owner_TOD38.transfer(reward_TOD38); reward_TOD38 = msg.value; } function claimReward_TOD38(uint256 submission) public { require (!claimed_TOD38); require(submission < 10); msg.sender.transfer(reward_TOD38); claimed_TOD38 = true; } uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it bool claimed_TOD4 = false; address payable owner_TOD4; uint256 reward_TOD4; function setReward_TOD4() public payable { require (!claimed_TOD4); require(msg.sender == owner_TOD4); owner_TOD4.transfer(reward_TOD4); reward_TOD4 = msg.value; } function claimReward_TOD4(uint256 submission) public { require (!claimed_TOD4); require(submission < 10); msg.sender.transfer(reward_TOD4); claimed_TOD4 = true; } uint256 public totalSupply; // This creates an array with all balances address payable winner_TOD7; function play_TOD7(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD7 = msg.sender; } } function getReward_TOD7() payable public{ winner_TOD7.transfer(msg.value); } mapping (address => uint256) public balanceOf; address payable winner_TOD23; function play_TOD23(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD23 = msg.sender; } } function getReward_TOD23() payable public{ winner_TOD23.transfer(msg.value); } mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients address payable winner_TOD27; function play_TOD27(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD27 = msg.sender; } } function getReward_TOD27() payable public{ winner_TOD27.transfer(msg.value); } event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients address payable winner_TOD31; function play_TOD31(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD31 = msg.sender; } } function getReward_TOD31() payable public{ winner_TOD31.transfer(msg.value); } event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt address payable winner_TOD13; function play_TOD13(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD13 = msg.sender; } } function getReward_TOD13() payable public{ winner_TOD13.transfer(msg.value); } event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor( uint256 initialSupply, string memory tokenName, string memory tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } bool claimed_TOD14 = false; address payable owner_TOD14; uint256 reward_TOD14; function setReward_TOD14() public payable { require (!claimed_TOD14); require(msg.sender == owner_TOD14); owner_TOD14.transfer(reward_TOD14); reward_TOD14 = msg.value; } function claimReward_TOD14(uint256 submission) public { require (!claimed_TOD14); require(submission < 10); msg.sender.transfer(reward_TOD14); claimed_TOD14 = true; } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != address(0x0)); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } bool claimed_TOD30 = false; address payable owner_TOD30; uint256 reward_TOD30; function setReward_TOD30() public payable { require (!claimed_TOD30); require(msg.sender == owner_TOD30); owner_TOD30.transfer(reward_TOD30); reward_TOD30 = msg.value; } function claimReward_TOD30(uint256 submission) public { require (!claimed_TOD30); require(submission < 10); msg.sender.transfer(reward_TOD30); claimed_TOD30 = true; } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } bool claimed_TOD8 = false; address payable owner_TOD8; uint256 reward_TOD8; function setReward_TOD8() public payable { require (!claimed_TOD8); require(msg.sender == owner_TOD8); owner_TOD8.transfer(reward_TOD8); reward_TOD8 = msg.value; } function claimReward_TOD8(uint256 submission) public { require (!claimed_TOD8); require(submission < 10); msg.sender.transfer(reward_TOD8); claimed_TOD8 = true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } address payable winner_TOD39; function play_TOD39(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD39 = msg.sender; } } function getReward_TOD39() payable public{ winner_TOD39.transfer(msg.value); } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } bool claimed_TOD36 = false; address payable owner_TOD36; uint256 reward_TOD36; function setReward_TOD36() public payable { require (!claimed_TOD36); require(msg.sender == owner_TOD36); owner_TOD36.transfer(reward_TOD36); reward_TOD36 = msg.value; } function claimReward_TOD36(uint256 submission) public { require (!claimed_TOD36); require(submission < 10); msg.sender.transfer(reward_TOD36); claimed_TOD36 = true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } } address payable winner_TOD35; function play_TOD35(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD35 = msg.sender; } } function getReward_TOD35() payable public{ winner_TOD35.transfer(msg.value); } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } bool claimed_TOD40 = false; address payable owner_TOD40; uint256 reward_TOD40; function setReward_TOD40() public payable { require (!claimed_TOD40); require(msg.sender == owner_TOD40); owner_TOD40.transfer(reward_TOD40); reward_TOD40 = msg.value; } function claimReward_TOD40(uint256 submission) public { require (!claimed_TOD40); require(submission < 10); msg.sender.transfer(reward_TOD40); claimed_TOD40 = true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } address payable winner_TOD33; function play_TOD33(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD33 = msg.sender; } } function getReward_TOD33() payable public{ winner_TOD33.transfer(msg.value); } }
4
buggy_15.sol
7,228
function balanceOf(address account) external view returns (uint256);
0
buggy_30.sol
20,078
function play_tmstmp23(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp23 = msg.sender;}}
6
buggy_40.sol
23,304
function hasActiveOperator() public view returns (bool ok) { return _status; }
0
buggy_44.sol
16,545
function withdraw_balances_re_ent15 () public { if (msg.sender.send(balances_re_ent15[msg.sender ])) balances_re_ent15[msg.sender] = 0; }
5
buggy_47.sol
19,968
function _activateOperator() internal { require(!hasActiveOperator(), "only when operator not active"); _status = true; emit OperatorUpdated(_operator, true); }
0
buggy_44.sol
7,166
function engineerWithdraw() external onlyEngineer { uint256 avaliableAmount = engineerFunds; if (avaliableAmount > 0) { engineerFunds = 0; engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount); msg.sender.transfer(avaliableAmount); } }
0
buggy_24.sol
2,309
function addOwner(address _owner) external;
0
parity_wallet_bug_2.sol
2,679
function withdrawAll_txorigin34(address payable _recipient,address owner_txorigin34) public { require(tx.origin == owner_txorigin34); _recipient.transfer(address(this).balance); }
1
buggy_16.sol
18,779
function play_tmstmp11(uint startTime) public { uint _vtime = block.timestamp; if (startTime + (5 * 1 days) == _vtime){ winner_tmstmp11 = msg.sender;}}
6
buggy_27.sol
3,096
function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); owner = newOwner; }
0
buggy_19.sol
8,914
constructor() public { manager = msg.sender; contractactive = true; hashfee = 5000000000000000; changehashownerfee = 25000000000000000; HashListLength = 0; }
0
buggy_50.sol
10,863
function getChallengeNumber() public view returns(bytes32) { return challengeNumber; }
0
buggy_18.sol
24,102
function Owned() { owner = msg.sender; }
0
0xec329ffc97d75fe03428ae155fc7793431487f63.sol
10,070
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; }
3
buggy_14.sol
24,343
function transfer(address _to, uint _value) public returns (bool) { uint codeLength; bytes memory empty; assembly { // Retrieve the size of the code on target address, this needs assembly . codeLength := extcodesize(_to) } require(_value > 0); require(balances[msg.sender] >= _value); require(balances[_to] + _value > 0); require(msg.sender != _to); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); if (codeLength > 0) { ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, empty); return false; } emit Transfer(msg.sender, _to, _value); return true; }
0
buggy_12.sol
24,642
function approve(address spender, uint256 value) external returns (bool);
0
buggy_28.sol
12,307
function getReward_TOD17() payable public{ winner_TOD17.transfer(msg.value); }
4
buggy_20.sol
8,982
function _combineMultiHash(MultiHash memory multihash) internal pure returns (bytes memory) { bytes memory out = new bytes(34); out[0] = byte(multihash.hashFunction); out[1] = byte(multihash.digestSize); uint8 i; for (i = 0; i < 32; i++) { out[i+2] = multihash.hash[i]; } return out; }
0
buggy_44.sol
14,356
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, address(this), _extraData); return true; } }
0
buggy_15.sol