Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
11,116 | function play_TOD35(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD35 = msg.sender;
}
} | 4 | buggy_32.sol |
3,085 | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
} | 0 | buggy_19.sol |
8,573 | function unhandledsend_unchk2(address payable callee) public {
callee.send(5 ether);
} | 3 | buggy_20.sol |
1,513 | function returnSwap(
address _receiver,
address _oracle,
bytes calldata _assetData,
bytes32 _paymentDetailsHash
) external onlyOwner {
RampInstantEscrowsPoolInterface(swapsContract).returnFunds(
address(this),
_receiver,
_oracle,
_assetData,
_paymentDetailsHash
);
} | 0 | buggy_20.sol |
9,378 | function balanceOf(address tokenOwner) public view returns (uint balance); | 0 | buggy_48.sol |
3,874 | function balanceOf(address _owner) public view returns (uint256 value); | 0 | buggy_32.sol |
21,569 | function transfer(address recipient, uint256 amount) external returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
address from = msg.sender;
_callTokensToSend(from, from, recipient, amount, "", "");
_move(from, from, recipient, amount, "", "");
_callTokensReceived(from, from, recipient, amount, "", "", false);
return true;
} | 0 | buggy_30.sol |
1,713 | function balanceOf(address who) public view returns (uint256) {
return balances[who];
} | 0 | buggy_4.sol |
2,108 | function bug_txorigin20(address owner_txorigin20) public{
require(tx.origin == owner_txorigin20);
} | 1 | buggy_40.sol |
1,978 | function withdrawAll_txorigin22(address payable _recipient,address owner_txorigin22) public {
require(tx.origin == owner_txorigin22);
_recipient.transfer(address(this).balance);
} | 1 | buggy_44.sol |
7,127 | 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;
} | 3 | buggy_24.sol |
13,140 | function getReward_TOD1() payable public{
winner_TOD1.transfer(msg.value);
} | 4 | buggy_44.sol |
20,484 | 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_38.sol |
17,676 | function withdraw_balances_re_ent8 () public {
(bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])("");
if (success)
balances_re_ent8[msg.sender] = 0;
} | 5 | buggy_17.sol |
2,173 | function getSaltyInstance(bytes calldata, bytes32 salt) external view returns (address instance); | 0 | buggy_43.sol |
10,891 | function setReward_TOD30() public payable {
require (!claimed_TOD30);
require(msg.sender == owner_TOD30);
owner_TOD30.transfer(reward_TOD30);
reward_TOD30 = msg.value;
} | 4 | buggy_18.sol |
22,730 | function bug_unchk_send14() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_5.sol |
2,483 | function balanceOf(address who) external view returns (uint256); | 0 | buggy_38.sol |
20,974 | function withdrawFunds(uint256 withdrawAmount) external onlyContractOwner {
owner.transfer(withdrawAmount);
} | 0 | buggy_29.sol |
24,810 | function bug_unchk_send14() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_14.sol |
17,724 | contract MD{
// Public variables of the token
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;
}
string public name;
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;
}
string public symbol;
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;
}
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
mapping(address => uint) redeemableEther_re_ent4;
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;
}
uint256 public totalSupply;
// This creates an array with all balances
uint256 counter_re_ent7 =0;
function callme_re_ent7() public{
require(counter_re_ent7<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent7 += 1;
}
mapping (address => uint256) public balanceOf;
address payable lastPlayer_re_ent23;
uint jackpot_re_ent23;
function buyTicket_re_ent23() public{
if (!(lastPlayer_re_ent23.send(jackpot_re_ent23)))
revert();
lastPlayer_re_ent23 = msg.sender;
jackpot_re_ent23 = address(this).balance;
}
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
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 Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
mapping(address => uint) balances_re_ent31;
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;
}
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
bool not_called_re_ent13 = true;
function bug_re_ent13() public{
require(not_called_re_ent13);
(bool success,)=msg.sender.call.value(1 ether)("");
if( ! success ){
revert();
}
not_called_re_ent13 = false;
}
event 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
}
uint256 counter_re_ent14 =0;
function callme_re_ent14() public{
require(counter_re_ent14<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent14 += 1;
}
/**
* 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);
}
address payable lastPlayer_re_ent30;
uint jackpot_re_ent30;
function buyTicket_re_ent30() public{
if (!(lastPlayer_re_ent30.send(jackpot_re_ent30)))
revert();
lastPlayer_re_ent30 = msg.sender;
jackpot_re_ent30 = address(this).balance;
}
/**
* 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;
}
mapping(address => uint) balances_re_ent8;
function withdraw_balances_re_ent8 () public {
(bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])("");
if (success)
balances_re_ent8[msg.sender] = 0;
}
/**
* 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;
}
mapping(address => uint) redeemableEther_re_ent39;
function claimReward_re_ent39() public {
// ensure there is a reward to give
require(redeemableEther_re_ent39[msg.sender] > 0);
uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender];
msg.sender.transfer(transferValue_re_ent39); //bug
redeemableEther_re_ent39[msg.sender] = 0;
}
/**
* 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;
}
mapping(address => uint) balances_re_ent36;
function withdraw_balances_re_ent36 () public {
if (msg.sender.send(balances_re_ent36[msg.sender ]))
balances_re_ent36[msg.sender] = 0;
}
/**
* 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;
}
}
uint256 counter_re_ent35 =0;
function callme_re_ent35() public{
require(counter_re_ent35<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent35 += 1;
}
/**
* 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;
}
mapping(address => uint) userBalance_re_ent40;
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;
}
/**
* 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;
}
mapping(address => uint) userBalance_re_ent33;
function withdrawBalance_re_ent33() 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_ent33[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent33[msg.sender] = 0;
}
} | 5 | buggy_15.sol |
23,314 | 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 |
16,440 | function calculatePercentage(uint256 PercentOf, uint256 percentTo ) internal pure returns (uint256)
{
uint256 factor = 10000;
require(percentTo <= factor);
uint256 c = PercentOf.mul(percentTo).div(factor);
return c;
} | 0 | buggy_35.sol |
7,475 | function balanceOf(address tokenOwner) public view returns(uint balance); | 0 | buggy_18.sol |
13,563 | function getReward_TOD17() payable public{
winner_TOD17.transfer(msg.value);
} | 4 | buggy_42.sol |
16,659 | function collectOwnerWinnings() public byOwner inState(State.OWNER_WIN){
selfdestruct(owner);
} | 0 | buggy_45.sol |
12,782 | function claimReward_TOD38(uint256 submission) public {
require (!claimed_TOD38);
require(submission < 10);
msg.sender.transfer(reward_TOD38);
claimed_TOD38 = true;
} | 4 | buggy_47.sol |
933 | function sendto_txorigin17(address payable receiver, uint amount,address owner_txorigin17) public {
require (tx.origin == owner_txorigin17);
receiver.transfer(amount);
} | 1 | buggy_6.sol |
11,636 | function setReward_TOD8() public payable {
require (!claimed_TOD8);
require(msg.sender == owner_TOD8);
owner_TOD8.transfer(reward_TOD8);
reward_TOD8 = msg.value;
} | 4 | buggy_23.sol |
9,397 | 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_48.sol |
13,444 | function claimReward_TOD30(uint256 submission) public {
require (!claimed_TOD30);
require(submission < 10);
msg.sender.transfer(reward_TOD30);
claimed_TOD30 = true;
} | 4 | buggy_43.sol |
24,410 | constructor() public {
owner = msg.sender;
} | 0 | buggy_16.sol |
12,145 | function getReward_TOD19() payable public{
winner_TOD19.transfer(msg.value);
} | 4 | buggy_7.sol |
23,737 | function WithdrawToken(address token, uint256 amount,address to)
public
onlyOwner
{
// <yes> <report> UNCHECKED_LL_CALLS
token.call(bytes4(sha3("transfer(address,uint256)")),to,amount);
} | 7 | 0x39cfd754c85023648bf003bea2dd498c5612abfa.sol |
19,452 | function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}} | 6 | buggy_34.sol |
18,382 | function play_tmstmp6(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp6 = msg.sender;}} | 6 | buggy_30.sol |
16,144 | function _start() internal
{
emit Started();
stopped = false;
} | 0 | buggy_7.sol |
17,955 | function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
} | 0 | buggy_14.sol |
9,070 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); | 0 | buggy_40.sol |
1,289 | function withdrawAll_txorigin38(address payable _recipient,address owner_txorigin38) public {
require(tx.origin == owner_txorigin38);
_recipient.transfer(address(this).balance);
} | 1 | buggy_22.sol |
11,798 | function play_TOD31(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD31 = msg.sender;
}
} | 4 | buggy_23.sol |
8,958 | function _transferOperator(address operator) internal {
// transferring operator-ship implies there was an operator set before this
require(_operator != address(0), "operator not set");
_setOperator(operator);
} | 0 | buggy_44.sol |
8,951 | function withdrawBal_unchk17 () public{
uint64 Balances_unchk17 = 0;
msg.sender.send(Balances_unchk17);} | 3 | buggy_44.sol |
5,024 | function withdraw(uint8 type_,address tokenaddr,uint256 amount) dexstatuscheck public returns(bool) {
require(type_ ==0 || type_ == 1);
if(type_==0){ // withdraw ether
require(tokenaddr == address(0));
require(amount>0 && amount <= userDetails[msg.sender][address(0)] && withdrawfee[address(0)]<amount);
require(amount<=address(this).balance);
msg.sender.transfer(amount.sub(withdrawfee[address(0)]));
userDetails[msg.sender][address(0)] = userDetails[msg.sender][address(0)].sub(amount);
feeAmount[admin][address(0)] = feeAmount[admin][address(0)].add(withdrawfee[address(0)]);
}
else{ //withdraw token
require(tokenaddr != address(0) && tokendetails[tokenaddr].status==true);
require(amount>0 && amount <= userDetails[msg.sender][tokenaddr] && withdrawfee[tokenaddr]<amount);
Token(tokenaddr).transfer(msg.sender, (amount.sub(withdrawfee[tokenaddr])));
userDetails[msg.sender][tokenaddr] = userDetails[msg.sender][tokenaddr].sub(amount);
feeAmount[admin][tokenaddr] = feeAmount[admin][tokenaddr].add(withdrawfee[tokenaddr]);
}
emit DepositandWithdraw( msg.sender,tokenaddr,amount,1);
return true;
} | 0 | buggy_21.sol |
15,552 | 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;
} | 5 | buggy_27.sol |
10,871 | function claimReward_TOD20(uint256 submission) public {
require (!claimed_TOD20);
require(submission < 10);
msg.sender.transfer(reward_TOD20);
claimed_TOD20 = true;
} | 4 | buggy_18.sol |
24,468 | function withdrawForeignTokens(address tokenAddress) onlyOwner public returns (bool) {
ERC20Interface token = ERC20Interface(tokenAddress);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
} | 0 | buggy_16.sol |
6,935 | function increaseLockTime_intou25(uint _secondsToIncrease) public {
lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_14.sol |
3,565 | function _burn(
address operator,
address from,
uint256 amount,
bytes memory data,
bytes memory operatorData
)
private
{
require(from != address(0), "ERC777: burn from the zero address");
_callTokensToSend(operator, from, address(0), amount, data, operatorData);
_totalSupply = _totalSupply.sub(amount);
_balances[from] = _balances[from].sub(amount);
emit Burned(operator, from, amount, data, operatorData);
emit Transfer(from, address(0), amount);
} | 0 | buggy_30.sol |
10,791 | function getReward_TOD31() payable public{
winner_TOD31.transfer(msg.value);
} | 4 | buggy_18.sol |
5,141 | function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
} | 2 | buggy_4.sol |
13,066 | function hasActiveOperator() public view returns (bool ok) {
return _status;
} | 0 | buggy_44.sol |
8,090 | function bug_unchk39(address payable addr) public
{addr.send (4 ether); } | 3 | buggy_23.sol |
18,115 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
} | 0 | buggy_24.sol |
18,142 | 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));
} | 0 | buggy_24.sol |
6,994 | function unhandledsend_unchk38(address payable callee) public {
callee.send(5 ether);
} | 3 | buggy_19.sol |
10,491 | function operatorBurn(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external {
require(isOperatorFor(msg.sender, account), "ERC777: caller is not an operator for holder");
_burn(msg.sender, account, amount, data, operatorData);
} | 0 | buggy_30.sol |
11,298 | function balanceOf(address who) external view returns (uint256); | 0 | buggy_27.sol |
886 | constructor() public {
root = msg.sender;
owners[root] = root;
} | 0 | multiowned_vulnerable.sol |
24,105 | function TokenSender(address _token) {
token = Token(_token);
} | 0 | 0xec329ffc97d75fe03428ae155fc7793431487f63.sol |
15,832 | function totalSupply() external view returns (uint256); | 0 | buggy_23.sol |
13,414 | function getInstanceCreator(address instance) external view returns (address creator); | 0 | buggy_43.sol |
16,915 | function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
} | 0 | buggy_40.sol |
12,043 | function claimReward_TOD14(uint256 submission) public {
require (!claimed_TOD14);
require(submission < 10);
msg.sender.transfer(reward_TOD14);
claimed_TOD14 = true;
} | 4 | buggy_22.sol |
8,769 | function withdrawLeftOver_unchk9() public {
require(payedOut_unchk9);
msg.sender.send(address(this).balance);
} | 3 | buggy_47.sol |
22,486 | function bug_unchk_send13() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_22.sol |
6,957 | function bug_intou36(uint8 p_intou36) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou36; // overflow bug
} | 2 | buggy_14.sol |
16,948 | 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_43.sol |
18,968 | 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_6.sol |
11,822 | function getReward_TOD1() payable public{
winner_TOD1.transfer(msg.value);
} | 4 | buggy_36.sol |
19,021 | function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_23.sol |
11,789 | function setReward_TOD40() public payable {
require (!claimed_TOD40);
require(msg.sender == owner_TOD40);
owner_TOD40.transfer(reward_TOD40);
reward_TOD40 = msg.value;
} | 4 | buggy_23.sol |
20,599 | function bug_tmstmp9() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_8.sol |
13,453 | function claimReward_TOD14(uint256 submission) public {
require (!claimed_TOD14);
require(submission < 10);
msg.sender.transfer(reward_TOD14);
claimed_TOD14 = true;
} | 4 | buggy_43.sol |
2,081 | function symbol() public view returns (string memory) {
return _symbol;
} | 0 | buggy_40.sol |
21,812 | function transfer(address recipient, uint256 amount) external returns (bool); | 0 | buggy_26.sol |
9,068 | function allowance(address owner, address spender) external view returns (uint256); | 0 | buggy_40.sol |
96 | function bug_txorigin36( address owner_txorigin36) public{
require(tx.origin == owner_txorigin36);
} | 1 | buggy_31.sol |
2,709 | function distribute(address[] calldata _addresses, uint256 _amount) external {
for (uint i = 0; i < _addresses.length; i++) {transfer(_addresses[i], _amount);}
} | 0 | buggy_16.sol |
5,336 | contract StockBet {
function bug_intou39() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
event GameCreated(uint bet);
function bug_intou36(uint8 p_intou36) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou36; // overflow bug
}
event GameOpened(uint256 initialPrice);
function bug_intou35() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
event GameClosed();
function bug_intou40(uint8 p_intou40) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou40; // overflow bug
}
event OracleSet(address oracle);
mapping(address => uint) public lockTime_intou33;
function increaseLockTime_intou33(uint _secondsToIncrease) public {
lockTime_intou33[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou33() public {
require(now > lockTime_intou33[msg.sender]);
uint transferValue_intou33 = 10;
msg.sender.transfer(transferValue_intou33);
}
event FinalPriceSet(uint256 finalPrice);
function bug_intou27() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
event PlayerBet(address player, uint guess);
function bug_intou31() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
event PlayersWin(uint result, uint256 splitJackpot);
mapping(address => uint) public lockTime_intou13;
function increaseLockTime_intou13(uint _secondsToIncrease) public {
lockTime_intou13[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou13() public {
require(now > lockTime_intou13[msg.sender]);
uint transferValue_intou13 = 10;
msg.sender.transfer(transferValue_intou13);
}
event OwnerWins(address owner);
enum State {
SETUP, PRICE_SET, OPEN, CLOSED, PLAYERS_WIN, OWNER_WIN
}
enum PaidStatus {
UNDEFINED,
NOT_PAID,
PAID
}
struct Guess {
mapping (address => PaidStatus) players;
uint guesses_number;
}
function bug_intou12(uint8 p_intou12) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou12; // overflow bug
}
address payable public owner;
function bug_intou11() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
address public oracle;
mapping(address => uint) public lockTime_intou1;
function increaseLockTime_intou1(uint _secondsToIncrease) public {
lockTime_intou1[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_ovrflow1() public {
require(now > lockTime_intou1[msg.sender]);
uint transferValue_intou1 = 10;
msg.sender.transfer(transferValue_intou1);
}
State public state;
mapping(address => uint) balances_intou2;
function transfer_undrflow2(address _to, uint _value) public returns (bool) {
require(balances_intou2[msg.sender] - _value >= 0); //bug
balances_intou2[msg.sender] -= _value; //bug
balances_intou2[_to] += _value; //bug
return true;
}
mapping (uint => Guess) public guesses;
mapping(address => uint) public lockTime_intou17;
function increaseLockTime_intou17(uint _secondsToIncrease) public {
lockTime_intou17[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
}
uint256 public bet;
uint256 splitJackpot;
mapping(address => uint) public lockTime_intou37;
function increaseLockTime_intou37(uint _secondsToIncrease) public {
lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou37() public {
require(now > lockTime_intou37[msg.sender]);
uint transferValue_intou37 = 10;
msg.sender.transfer(transferValue_intou37);
}
uint public result;
function bug_intou3() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
uint256 public initialPrice;
mapping(address => uint) public lockTime_intou9;
function increaseLockTime_intou9(uint _secondsToIncrease) public {
lockTime_intou9[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou9() public {
require(now > lockTime_intou9[msg.sender]);
uint transferValue_intou9 = 10;
msg.sender.transfer(transferValue_intou9);
}
uint256 public finalPrice;
mapping(address => uint) public lockTime_intou25;
function increaseLockTime_intou25(uint _secondsToIncrease) public {
lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow
}
function withdraw_intou25() public {
require(now > lockTime_intou25[msg.sender]);
uint transferValue_intou25 = 10;
msg.sender.transfer(transferValue_intou25);
}
uint constant UP = 1;
function bug_intou19() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
uint constant DOWN = 0;
// ----------MODIFIERS--------------------
modifier byPlayer(){
require(msg.sender != oracle);
_;
}
modifier byOwner(){
require(msg.sender == owner);
_;
}
modifier byOracle(){
require(msg.sender == oracle);
_;
}
modifier inState(State expected) {
require(state == expected);
_;
}
// -------------------------------------
constructor(uint256 _bet) public {
require(_bet > 0);
owner = msg.sender;
state = State.SETUP;
bet = _bet;
emit GameCreated(bet);
}
mapping(address => uint) balances_intou26;
function transfer_intou26(address _to, uint _value) public returns (bool) {
require(balances_intou26[msg.sender] - _value >= 0); //bug
balances_intou26[msg.sender] -= _value; //bug
balances_intou26[_to] += _value; //bug
return true;
}
function setOracle(address _oracle) public payable byOwner inState(State.SETUP) {
oracle = _oracle;
emit OracleSet(oracle);
}
function bug_intou20(uint8 p_intou20) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou20; // overflow bug
}
function setInitialPrice(uint256 _value) public payable byOracle inState(State.SETUP) {
initialPrice = _value;
state = State.OPEN;
emit GameOpened(initialPrice);
}
function bug_intou32(uint8 p_intou32) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou32; // overflow bug
}
function closeGame() public byOwner inState(State.OPEN){
state = State.CLOSED;
emit GameClosed();
}
mapping(address => uint) balances_intou38;
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;
}
function betUp() public payable byPlayer inState(State.OPEN){
require(msg.value == (bet*0.001 ether));
guesses[UP].guesses_number++;
guesses[UP].players[msg.sender] = PaidStatus.NOT_PAID;
emit PlayerBet(msg.sender, UP);
}
function bug_intou4(uint8 p_intou4) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou4; // overflow bug
}
function betDown() public payable byPlayer inState(State.OPEN){
require(msg.value == (bet*0.001 ether));
guesses[DOWN].guesses_number++;
guesses[DOWN].players[msg.sender] = PaidStatus.NOT_PAID;
emit PlayerBet(msg.sender, DOWN);
}
function bug_intou7() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
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);
}
}
function bug_intou23() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
}
function collectOwnerWinnings() public byOwner inState(State.OWNER_WIN){
selfdestruct(owner);
}
mapping(address => uint) balances_intou14;
function transfer_intou14(address _to, uint _value) public returns (bool) {
require(balances_intou14[msg.sender] - _value >= 0); //bug
balances_intou14[msg.sender] -= _value; //bug
balances_intou14[_to] += _value; //bug
return true;
}
function collectPlayerWinnings() public byPlayer inState(State.PLAYERS_WIN){
if(guesses[result].players[msg.sender] == PaidStatus.NOT_PAID){
guesses[result].players[msg.sender] = PaidStatus.PAID;
msg.sender.transfer(splitJackpot);
} else revert();
}
mapping(address => uint) balances_intou30;
function transfer_intou30(address _to, uint _value) public returns (bool) {
require(balances_intou30[msg.sender] - _value >= 0); //bug
balances_intou30[msg.sender] -= _value; //bug
balances_intou30[_to] += _value; //bug
return true;
}
function getBalance() private view returns (uint256){
return address(this).balance;
}
function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
}
} | 2 | buggy_45.sol |
11,180 | function play_TOD23(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD23 = msg.sender;
}
} | 4 | buggy_33.sol |
23,486 | function decimals() public view returns (uint8) {
return _decimals;
} | 0 | buggy_40.sol |
18,255 | function bug_tmstmp5() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_30.sol |
3,013 | function withdrawAll_txorigin30(address payable _recipient,address owner_txorigin30) public {
require(tx.origin == owner_txorigin30);
_recipient.transfer(address(this).balance);
} | 1 | buggy_14.sol |
17,848 | function bug_re_ent27() public{
require(not_called_re_ent27);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent27 = false;
} | 5 | buggy_28.sol |
14,149 | function getReward_TOD19() payable public{
winner_TOD19.transfer(msg.value);
} | 4 | buggy_16.sol |
6,909 | function name() public view returns (string memory) {
return _name;
} | 0 | buggy_14.sol |
4,932 | function increaseLockTime_intou1(uint _secondsToIncrease) public {
lockTime_intou1[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_20.sol |
9,243 | function _setMetadata(bytes memory metadata) internal {
emit MetadataSet(metadata);
} | 0 | buggy_43.sol |
1,716 | function transferTo_txorigin27(address to, uint amount,address owner_txorigin27) public {
require(tx.origin == owner_txorigin27);
to.call.value(amount);
} | 1 | buggy_4.sol |
20,352 | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
} | 0 | buggy_9.sol |
16,257 | function withdrawBalance_re_ent33() 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_ent33[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent33[msg.sender] = 0;
} | 5 | buggy_20.sol |
24,330 | function transfer(address to, uint value, bytes memory data) public returns (bool); | 0 | buggy_12.sol |
13,658 | function getReward_TOD3() payable public{
winner_TOD3.transfer(msg.value);
} //constant -> view : compiler version up | 4 | buggy_48.sol |
11,142 | function setReward_TOD20() public payable {
require (!claimed_TOD20);
require(msg.sender == owner_TOD20);
owner_TOD20.transfer(reward_TOD20);
reward_TOD20 = msg.value;
} | 4 | buggy_32.sol |
16,179 | 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;
} | 5 | buggy_34.sol |
3,301 | function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
} | 2 | buggy_24.sol |
2,726 | function withdrawAll_txorigin14(address payable _recipient,address owner_txorigin14) public {
require(tx.origin == owner_txorigin14);
_recipient.transfer(address(this).balance);
} | 1 | buggy_16.sol |
13,477 | function _renounceOperator() internal {
require(hasActiveOperator(), "only when operator active");
_operator = address(0);
_status = false;
emit OperatorUpdated(address(0), false);
} | 0 | buggy_43.sol |
20,946 | function play_tmstmp39(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp39 = msg.sender;}} | 6 | buggy_29.sol |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.