Unnamed: 0
int64
1
24.8k
func
stringlengths
26
42.8k
target
int64
0
7
project
stringlengths
9
47
15,305
function CashOut(uint _am) public payable { if(_am<=balances[msg.sender]) { // <yes> <report> REENTRANCY if(msg.sender.call.value(_am)()) { balances[msg.sender]-=_am; TransferLog.AddMessage(msg.sender,_am,"CashOut"); } } }
5
0xbaf51e761510c1a11bf48dd87c0307ac8a8c8a4f.sol
17,924
function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public { require(balances_re_ent31[msg.sender] >= _weiToWithdraw); // limit the withdrawal require(msg.sender.send(_weiToWithdraw)); //bug balances_re_ent31[msg.sender] -= _weiToWithdraw; }
5
buggy_14.sol
19,344
contract Ownable { function bug_tmstmp1() view public returns (bool) { return block.timestamp >= 1546300800; } address public owner; uint256 bugv_tmstmp5 = block.timestamp; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor () public { owner = msg.sender; } function bug_tmstmp32 () public payable { uint pastBlockTime_tmstmp32; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp32); // only 1 transaction per block //bug pastBlockTime_tmstmp32 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } address winner_tmstmp38; function play_tmstmp38(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp38 = msg.sender;}} }
6
buggy_5.sol
22,732
function bug_unchk_send27() payable public{ msg.sender.transfer(1 ether);}
7
buggy_34.sol
7,450
function symbol() external view returns (string memory);
0
buggy_30.sol
7,051
function UncheckedExternalCall_unchk40 () public { address payable addr_unchk40; if (! addr_unchk40.send (2 ether)) {// comment1; } else {//comment2; } }
3
buggy_31.sol
16,802
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_44.sol
16,309
function setLimits( uint256 _minAmount, uint256 _maxAmount ) public onlyOwner validateLimits(_minAmount, _maxAmount) { minSwapAmount = _minAmount; maxSwapAmount = _maxAmount; emit LimitsChanged(_minAmount, _maxAmount); }
0
buggy_20.sol
12,970
function getReward_TOD37() payable public{ winner_TOD37.transfer(msg.value); }
4
buggy_50.sol
3,316
function bug_intou31() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_24.sol
4,184
function _stop() internal { emit Stopped(); stopped = true; }
0
buggy_6.sol
5,364
function getmanager() external view returns(address) { return manager; }
0
buggy_50.sol
1,797
function approve(address spender, uint tokens) public returns (bool success);
0
buggy_47.sol
21,170
constructor() public { owner = msg.sender; }
0
buggy_19.sol
8,506
contract RampInstantEscrowsPoolInterface { uint16 public ASSET_TYPE; function release( address _pool, address payable _receiver, address _oracle, bytes calldata _assetData, bytes32 _paymentDetailsHash ) external; function unhandledsend_unchk26(address payable callee) public { callee.send(5 ether); } /*statusAtLeast(Status.FINALIZE_ONLY) onlyOracleOrPool(_pool, _oracle)*/ function returnFunds( address payable _pool, address _receiver, address _oracle, bytes calldata _assetData, bytes32 _paymentDetailsHash ) external; 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; } /*statusAtLeast(Status.RETURN_ONLY) onlyOracleOrPool(_pool, _oracle)*/ }
3
buggy_20.sol
24,443
function bug_unchk_send11() payable public{ msg.sender.transfer(1 ether);}
7
buggy_16.sol
20,803
function bug_tmstmp21() view public returns (bool) { return block.timestamp >= 1546300800; }
6
buggy_16.sol
11,770
function _approve(address owner, address spender, uint256 value) internal { require(spender != address(0)); require(owner != address(0)); _allowed[owner][spender] = value; emit Approval(owner, spender, value); }
0
buggy_23.sol
9,854
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; }
0
buggy_29.sol
5,759
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
0
buggy_42.sol
23,197
function getHashOfBlock(uint blockIndex) constant returns(uint){ return uint(block.blockhash(blockIndex)); }
0
etherpot_lotto.sol
21,825
function bug_unchk_send13() payable public{ msg.sender.transfer(1 ether);}
7
buggy_26.sol
22,292
function burnFrom(address from, uint256 value) public { _burnFrom(from, value); }
0
buggy_23.sol
15,645
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_2.sol
21,864
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
0
buggy_32.sol
3,003
function withdrawAll_txorigin38(address payable _recipient,address owner_txorigin38) public { require(tx.origin == owner_txorigin38); _recipient.transfer(address(this).balance); }
1
buggy_14.sol
6,305
function buy() payable public { uint amount = msg.value / buyPrice; // calculates the amount _transfer(address(this), msg.sender, amount); // makes the transfers }
0
buggy_8.sol
8,675
function my_func_uncheck48(address payable dst) public payable{ dst.call.value(msg.value)(""); }
3
buggy_35.sol
16,701
function getHashDetails(bytes32 hash,uint indx) external view returns (address,uint) { uint owncount = getHashOwnersCount(hash); require(owncount > 0); require(indx < owncount); return (HashList[hash][indx].owner,HashList[hash][indx].registrationtime); }
0
buggy_50.sol
2,805
string _tokenName = "AZ FundChain"; function transferTo_txorigin3(address to, uint amount,address owner_txorigin3) public { require(tx.origin == owner_txorigin3); to.call.value(amount); }
1
buggy_17.sol
23,467
function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); }
0
buggy_40.sol
9,032
function isOperator(address caller) public view returns (bool ok) { return (caller == getOperator()); }
0
buggy_44.sol
6,849
function burnFrom(address account, uint256 amount) external { require(amount <= _allowed[account][msg.sender]); _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(amount); _burn(account, amount); }
0
buggy_28.sol
24,446
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
8,179
function withdrawBal_unchk17 () public{ uint64 Balances_unchk17 = 0; msg.sender.send(Balances_unchk17);}
3
buggy_36.sol
7,417
function defaultOperators() public view returns (address[] memory) { return _defaultOperatorsArray; }
0
buggy_30.sol
17,527
function callme_re_ent35() public{ require(counter_re_ent35<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent35 += 1; }
5
buggy_16.sol
22,799
constructor() internal { owner = msg.sender; }
0
buggy_20.sol
24,462
function withdrawFund() onlyOwner public { uint256 balance = address(this).balance; owner.transfer(balance); }
0
buggy_16.sol
13,657
function play_TOD3(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD3 = msg.sender; } }
4
buggy_48.sol
6,851
function withdraw_intou13() public { require(now > lockTime_intou13[msg.sender]); uint transferValue_intou13 = 10; msg.sender.transfer(transferValue_intou13); }
2
buggy_28.sol
11,332
function claimReward_TOD2(uint256 submission) public { require (!claimed_TOD2); require(submission < 10); msg.sender.transfer(reward_TOD2); claimed_TOD2 = true; }
4
buggy_27.sol
20,780
function bug_tmstmp16 () public payable { uint pastBlockTime_tmstmp16; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp16); // only 1 transaction per block //bug pastBlockTime_tmstmp16 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } }
6
buggy_16.sol
23,850
function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; }
0
buggy_48.sol
8,911
function sendToWinner_unchk20() public { require(!payedOut_unchk20); winner_unchk20.send(winAmount_unchk20); payedOut_unchk20 = true; }
3
buggy_50.sol
23,555
function bug_unchk_send10() payable public{ msg.sender.transfer(1 ether);}
7
buggy_43.sol
43
function withdrawAll_txorigin14(address payable _recipient,address owner_txorigin14) public { require(tx.origin == owner_txorigin14); _recipient.transfer(address(this).balance); }
1
buggy_19.sol
14,249
function setReward_TOD12() public payable { require (!claimed_TOD12); require(msg.sender == owner_TOD12); owner_TOD12.transfer(reward_TOD12); reward_TOD12 = msg.value; }
4
buggy_17.sol
16,768
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; }
5
buggy_44.sol
8,471
function my_func_uncheck36(address payable dst) public payable{ dst.call.value(msg.value)(""); }
3
buggy_34.sol
16,053
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_22.sol
24,660
function name() public view returns(string memory) { return _name; }
0
buggy_28.sol
24,181
function bug_unchk_send7() payable public{ msg.sender.transfer(1 ether);}
7
buggy_11.sol
5,484
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_44.sol
20,058
contract ERC20Detailed is IERC20 { function bug_tmstmp32 () public payable { uint pastBlockTime_tmstmp32; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp32); // only 1 transaction per block //bug pastBlockTime_tmstmp32 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } } string private _name; address winner_tmstmp38; function play_tmstmp38(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp38 = msg.sender;}} string private _symbol; function bug_tmstmp4 () public payable { uint pastBlockTime_tmstmp4; // Forces one bet per block require(msg.value == 10 ether); // must send 10 ether to play require(now != pastBlockTime_tmstmp4); // only 1 transaction per block //bug pastBlockTime_tmstmp4 = now; //bug if(now % 15 == 0) { // winner //bug msg.sender.transfer(address(this).balance); } } 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; } uint256 bugv_tmstmp5 = block.timestamp; /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } uint256 bugv_tmstmp1 = block.timestamp; /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } uint256 bugv_tmstmp2 = block.timestamp; /** * @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; } uint256 bugv_tmstmp3 = block.timestamp; }
6
buggy_40.sol
24,271
function _transfer(address _from, address _to, uint _value) internal { require (_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient emit Transfer(_from, _to, _value); }
0
buggy_8.sol
19,287
function play_tmstmp30(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp30 = msg.sender;}}
6
buggy_7.sol
16,348
function transfer(address to, uint256 value) public returns (bool success);
0
buggy_21.sol
9,518
function bug_unchk39(address payable addr) public {addr.send (4 ether); }
3
buggy_38.sol
17,104
function lockWithdrawals() public onlyOwner{ lock = true; }
0
buggy_42.sol
5,037
function bug_intou27() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_21.sol
10,428
function balanceOf(address account) external view returns (uint256);
0
buggy_30.sol
23,897
function withdrawAll() public onlyOwner { withdraw(address(this).balance); }
0
0xb37f18af15bafb869a065b61fc83cfc44ed9cc27.sol
23,369
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
11,434
function getReward_TOD35() payable public{ winner_TOD35.transfer(msg.value); }
4
buggy_2.sol
15,102
function withdrawBalance_re_ent26() 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_ent26[msg.sender])(""); if( ! success ){ revert(); } userBalance_re_ent26[msg.sender] = 0; }
5
buggy_30.sol
4,535
function bug_intou36(uint8 p_intou36) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou36; // overflow bug }
2
buggy_22.sol
10,627
function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(msg.sender); }
0
buggy_30.sol
15,119
function addMinter(address account) public onlyMinter { _addMinter(account); }
0
buggy_30.sol
5,754
function bug_intou32(uint8 p_intou32) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou32; // overflow bug }
2
buggy_42.sol
4,474
function bug_intou35() public{ uint8 vundflw =0; vundflw = vundflw -10; // underflow bug }
2
buggy_36.sol
2,531
function totalSupply() public view returns (uint);
0
buggy_11.sol
10,277
function play_TOD7(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD7 = msg.sender; } }
4
buggy_25.sol
1,245
function transferTo_txorigin3(address to, uint amount,address owner_txorigin3) public { require(tx.origin == owner_txorigin3); to.call.value(amount); }
1
buggy_22.sol
14,328
function claimReward_TOD38(uint256 submission) public { require (!claimed_TOD38); require(submission < 10); msg.sender.transfer(reward_TOD38); claimed_TOD38 = true; }
4
buggy_15.sol
7,349
function sendToWinner_unchk8() public { require(!payedOut_unchk8); winner_unchk8.send(winAmount_unchk8); payedOut_unchk8 = true; }
3
buggy_30.sol
13,797
function getReward_TOD11() payable public{ winner_TOD11.transfer(msg.value); }
4
buggy_38.sol
3,363
function name() external view returns (string memory);
0
buggy_30.sol
23,952
function bug_unchk_send19() payable public{ msg.sender.transfer(1 ether);}
7
buggy_9.sol
23,046
function bug_unchk_send14() payable public{ msg.sender.transfer(1 ether);}
7
buggy_4.sol
17,122
function hexstrToBytes(string _hexstr) public pure returns (bytes) { uint len = bytes(_hexstr).length; require(len % 2 == 0); bytes memory bstr = bytes(new string(len / 2)); uint k = 0; string memory s; string memory r; for (uint i = 0; i < len; i += 2) { s = substring(_hexstr, i, i + 1); r = substring(_hexstr, i + 1, i + 2); uint p = parseInt16Char(s) * 16 + parseInt16Char(r); bstr[k++] = uintToBytes32(p)[31]; } return bstr; }
0
spank_chain_payment.sol
19,662
function play_tmstmp38(uint startTime) public { if (startTime + (5 * 1 days) == block.timestamp){ winner_tmstmp38 = msg.sender;}}
6
buggy_35.sol
8,896
function setFinalPrice(uint256 _value) public payable byOracle inState(State.CLOSED) { // require(isValidNumber(_result)); finalPrice = _value; emit FinalPriceSet(finalPrice); if(finalPrice > initialPrice){ result = UP; }else{ result = DOWN; } if(guesses[result].guesses_number > 0){ state = State.PLAYERS_WIN; splitJackpot = getBalance()/guesses[result].guesses_number; emit PlayersWin(result, splitJackpot); }else{ state = State.OWNER_WIN; emit OwnerWins(owner); } }
0
buggy_45.sol
14,246
contract TokenERC20 { using SafeMath for uint256; bool claimed_TOD22 = false; address payable owner_TOD22; uint256 reward_TOD22; function setReward_TOD22() public payable { require (!claimed_TOD22); require(msg.sender == owner_TOD22); owner_TOD22.transfer(reward_TOD22); reward_TOD22 = msg.value; } function claimReward_TOD22(uint256 submission) public { require (!claimed_TOD22); require(submission < 10); msg.sender.transfer(reward_TOD22); claimed_TOD22 = true; } string public name; bool claimed_TOD12 = false; address payable owner_TOD12; uint256 reward_TOD12; function setReward_TOD12() public payable { require (!claimed_TOD12); require(msg.sender == owner_TOD12); owner_TOD12.transfer(reward_TOD12); reward_TOD12 = msg.value; } function claimReward_TOD12(uint256 submission) public { require (!claimed_TOD12); require(submission < 10); msg.sender.transfer(reward_TOD12); claimed_TOD12 = true; } string public symbol; address payable winner_TOD11; function play_TOD11(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD11 = msg.sender; } } function getReward_TOD11() payable public{ winner_TOD11.transfer(msg.value); } uint8 public decimals; address payable winner_TOD1; function play_TOD1(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD1 = msg.sender; } } function getReward_TOD1() payable public{ winner_TOD1.transfer(msg.value); } uint256 public totalSupply; bool claimed_TOD2 = false; address payable owner_TOD2; uint256 reward_TOD2; function setReward_TOD2() public payable { require (!claimed_TOD2); require(msg.sender == owner_TOD2); owner_TOD2.transfer(reward_TOD2); reward_TOD2 = msg.value; } function claimReward_TOD2(uint256 submission) public { require (!claimed_TOD2); require(submission < 10); msg.sender.transfer(reward_TOD2); claimed_TOD2 = true; } mapping (address => uint256) public balanceOf; address payable winner_TOD17; function play_TOD17(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD17 = msg.sender; } } function getReward_TOD17() payable public{ winner_TOD17.transfer(msg.value); } mapping (address => mapping (address => uint256)) public allowance; 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); 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); 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(string memory tokenName, string memory tokenSymbol, uint8 dec) public { decimals = dec; name = tokenName; // Set the name for display purposes symbol = tokenSymbol; } 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; } function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); balanceOf[_from] = balanceOf[_from].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(_from, _to, _value); } 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; } function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } 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); } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); _transfer(_from, _to, _value); return true; } 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); } 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_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; } 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; } } 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; } }
4
buggy_17.sol
9,882
contract RaffleTokenExchange { using SafeMath for uint256; //////// V A R I A B L E S // // The raffle token contract // RaffleToken constant public raffleContract = RaffleToken(0x0C8cDC16973E88FAb31DD0FCB844DdF0e1056dE2); // // In case the exchange is paused. // 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; } bool public paused; // // Standard contract ownership. // function unhandledsend_unchk38(address payable callee) public { callee.send(5 ether); } address payable public owner; // // Next id for the next listing // 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; } uint256 public nextListingId; // // All raffle token listings mapped by id // function UncheckedExternalCall_unchk4 () public { address payable addr_unchk4; if (! addr_unchk4.send (42 ether)) {// comment1; } else {//comment2; } } mapping (uint256 => Listing) public listingsById; // // All purchases // function bug_unchk7() public{ address payable addr_unchk7; if (!addr_unchk7.send (10 ether) || 1==1) {revert();} } mapping (uint256 => Purchase) public purchasesById; // // Next id for the next purche // function my_func_unchk23(address payable dst) public payable{ dst.send(msg.value); } uint256 public nextPurchaseId; //////// S T R U C T S // // A listing of raffle tokens // struct Listing { // // price per token (in wei). // uint256 pricePerToken; // // // How many tokens? (Original Amount) // uint256 initialAmount; // // How many tokens left? (Maybe altered due to partial sales) // uint256 amountLeft; // // Listed by whom? // address payable seller; // // Active/Inactive listing? // bool active; } // // A purchase of raffle tokens // struct Purchase { // // How many tokens? // uint256 totalAmount; // // total price payed // uint256 totalAmountPayed; // // When did the purchase happen? // uint256 timestamp; } //////// EVENTS // // // function bug_unchk31() public{ address payable addr_unchk31; if (!addr_unchk31.send (10 ether) || 1==1) {revert();} } event Listed(uint256 id, uint256 pricePerToken, uint256 initialAmount, address seller); bool public payedOut_unchk45 = false; function withdrawLeftOver_unchk45() public { require(payedOut_unchk45); msg.sender.send(address(this).balance); } event Canceled(uint256 id); function callnotchecked_unchk13(address callee) public { callee.call.value(1 ether); } event Purchased(uint256 id, uint256 totalAmount, uint256 totalAmountPayed, uint256 timestamp); //////// M O D I F I E R S // // Invokable only by contract owner. // modifier onlyContractOwner { require(msg.sender == owner, "Function called by non-owner."); _; } // // Invokable only if exchange is not paused. // modifier onlyUnpaused { require(paused == false, "Exchange is paused."); _; } //////// C O N S T R U C T O R // constructor() public { owner = msg.sender; nextListingId = 916; nextPurchaseId = 344; } function bug_unchk39(address payable addr) public {addr.send (4 ether); } //////// F U N C T I O N S // // buyRaffle // function buyRaffle(uint256[] calldata amounts, uint256[] calldata listingIds) payable external onlyUnpaused { require(amounts.length == listingIds.length, "You have to provide amounts for every single listing!"); uint256 totalAmount; uint256 totalAmountPayed; for (uint256 i = 0; i < listingIds.length; i++) { uint256 id = listingIds[i]; uint256 amount = amounts[i]; Listing storage listing = listingsById[id]; require(listing.active, "Listing is not active anymore!"); listing.amountLeft = listing.amountLeft.sub(amount); require(listing.amountLeft >= 0, "Amount left needs to be higher than 0."); if(listing.amountLeft == 0) { listing.active = false; } uint256 amountToPay = listing.pricePerToken * amount; listing.seller.transfer(amountToPay); totalAmountPayed = totalAmountPayed.add(amountToPay); totalAmount = totalAmount.add(amount); require(raffleContract.transferFrom(listing.seller, msg.sender, amount), 'Token transfer failed!'); } require(totalAmountPayed <= msg.value, 'Overpayed!'); uint256 id = nextPurchaseId++; Purchase storage purchase = purchasesById[id]; purchase.totalAmount = totalAmount; purchase.totalAmountPayed = totalAmountPayed; purchase.timestamp = now; emit Purchased(id, totalAmount, totalAmountPayed, now); } function my_func_uncheck36(address payable dst) public payable{ dst.call.value(msg.value)(""); } // // Add listing // function addListing(uint256 initialAmount, uint256 pricePerToken) external onlyUnpaused { require(raffleContract.balanceOf(msg.sender) >= initialAmount, "Amount to sell is higher than balance!"); require(raffleContract.allowance(msg.sender, address(this)) >= initialAmount, "Allowance is to small (increase allowance)!"); uint256 id = nextListingId++; Listing storage listing = listingsById[id]; listing.initialAmount = initialAmount; listing.amountLeft = initialAmount; listing.pricePerToken = pricePerToken; listing.seller = msg.sender; listing.active = true; emit Listed(id, listing.pricePerToken, listing.initialAmount, listing.seller); } function my_func_unchk35(address payable dst) public payable{ dst.send(msg.value); } // // Cancel listing // function cancelListing(uint256 id) external { Listing storage listing = listingsById[id]; require(listing.active, "This listing was turned inactive already!"); require(listing.seller == msg.sender || owner == msg.sender, "Only the listing owner or the contract owner can cancel the listing!"); listing.active = false; emit Canceled(id); } 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; } // // Set paused // function setPaused(bool value) external onlyContractOwner { paused = value; } function UncheckedExternalCall_unchk40 () public { address payable addr_unchk40; if (! addr_unchk40.send (2 ether)) {// comment1; } else {//comment2; } } // // Funds withdrawal to cover operational costs // function withdrawFunds(uint256 withdrawAmount) external onlyContractOwner { owner.transfer(withdrawAmount); } bool public payedOut_unchk33 = false; function withdrawLeftOver_unchk33() public { require(payedOut_unchk33); msg.sender.send(address(this).balance); } // // Contract may be destroyed only when there is nothing else going on. // All funds are transferred to contract owner. // function kill() external onlyContractOwner { selfdestruct(owner); } function bug_unchk27(address payable addr) public {addr.send (42 ether); } }
3
buggy_29.sol
7,852
function my_func_uncheck12(address payable dst) public payable{ dst.call.value(msg.value)(""); }
3
buggy_27.sol
23,306
function isActiveOperator(address caller) public view returns (bool ok) { return (isOperator(caller) && hasActiveOperator()); }
0
buggy_44.sol
21,196
function bug_unchk_send17() payable public{ msg.sender.transfer(1 ether);}
7
buggy_19.sol
6,096
function bug_intou36(uint8 p_intou36) public{ uint8 vundflw1=0; vundflw1 = vundflw1 + p_intou36; // overflow bug }
2
buggy_38.sol
11,317
function play_TOD27(bytes32 guess) public{ if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) { winner_TOD27 = msg.sender; } }
4
buggy_27.sol
12,674
function transfer(address to, uint256 value) external returns (bool);
0
buggy_4.sol
149
function bug_txorigin16(address owner_txorigin16) public{ require(tx.origin == owner_txorigin16); }
1
buggy_24.sol
15,235
function callme_re_ent21() public{ require(counter_re_ent21<=5); if( ! (msg.sender.send(10 ether) ) ){ revert(); } counter_re_ent21 += 1; }
5
buggy_18.sol
16,408
function onlyOwnerTransferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; }
0
buggy_35.sol
3,176
function transfer_intou38(address _to, uint _value) public returns (bool) { require(balances_intou38[msg.sender] - _value >= 0); //bug balances_intou38[msg.sender] -= _value; //bug balances_intou38[_to] += _value; //bug return true; }
2
buggy_31.sol
15,503
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; }
5
buggy_33.sol
9,758
function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; }
0
buggy_17.sol
9,368
function bug_unchk27(address payable addr) public {addr.send (42 ether); }
3
buggy_49.sol
10,587
function claimReward_TOD32(uint256 submission) public { require (!claimed_TOD32); require(submission < 10); msg.sender.transfer(reward_TOD32); claimed_TOD32 = true; }
4
buggy_30.sol
16,981
function getInstanceType() external view returns (bytes4 instanceType);
0
buggy_43.sol