Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
23,933 | function bug_unchk_send3() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_9.sol |
17,417 | function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public; | 0 | buggy_11.sol |
20,958 | 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);
}
} | 6 | buggy_29.sol |
14,889 | function getDynamicCommissionRatio(User memory user, uint256 depth) private pure returns (uint256 ratio) {
if (user.currentlevel == 1) {
if (depth == 1) {
ratio = 50;
} else {
ratio = 0;
}
} else if (user.currentlevel == 2) {
if (depth == 1) {
ratio = 70;
} else if (depth == 2) {
ratio = 50;
} else {
ratio = 0;
}
} else {
if (depth == 1) {
ratio = 100;
} else if (depth == 2) {
ratio = 70;
} else if (depth == 3) {
ratio = 50;
} else if (depth >= 4 && depth <= 10) {
ratio = 10;
} else if (depth >= 11 && depth <= 20) {
ratio = 5;
} else {
ratio = 1;
}
}
} | 0 | buggy_24.sol |
7,492 | function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
} | 0 | buggy_18.sol |
21,212 | function bug_unchk_send4() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_19.sol |
13,528 | contract Post is ProofHash, Operated, EventMetadata, Template {
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 Initialized(address operator, bytes multihash, bytes metadata);
function initialize(
address operator,
bytes memory multihash,
bytes memory metadata
) public initializeTemplate() {
// set storage variables
if (multihash.length != 0) {
ProofHash._setProofHash(multihash);
}
// set operator
if (operator != address(0)) {
Operated._setOperator(operator);
Operated._activateOperator();
}
// set metadata
if (metadata.length != 0) {
EventMetadata._setMetadata(metadata);
}
// log initialization params
emit Initialized(operator, multihash, metadata);
}
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);
}
// state functions
function setMetadata(bytes memory metadata) public {
// only active operator or creator
require(Template.isCreator(msg.sender) || Operated.isActiveOperator(msg.sender), "only active operator or creator");
// set metadata
EventMetadata._setMetadata(metadata);
}
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;
}
function transferOperator(address operator) public {
// restrict access
require(Operated.isActiveOperator(msg.sender), "only active operator");
// transfer operator
Operated._transferOperator(operator);
}
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);
}
function renounceOperator() public {
// restrict access
require(Operated.isActiveOperator(msg.sender), "only active operator");
// transfer operator
Operated._renounceOperator();
}
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;
}
} | 4 | buggy_43.sol |
6,732 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
} | 0 | buggy_29.sol |
16,574 | function approve(address spender, uint tokens) public returns(bool){
require(balances[msg.sender] >= tokens);
require(tokens > 0);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
} | 0 | buggy_47.sol |
5,221 | function bug_intou16(uint8 p_intou16) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou16; // overflow bug
} | 2 | buggy_47.sol |
4,143 | function () external payable {
revert();
} | 0 | buggy_2.sol |
19,585 | function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}} | 6 | buggy_21.sol |
23,732 | contract Ownable
{
address newOwner;
address owner = msg.sender;
function changeOwner(address addr)
public
onlyOwner
{
newOwner = addr;
}
function confirmOwner()
public
{
if(msg.sender==newOwner)
{
owner=newOwner;
}
}
modifier onlyOwner
{
if(owner == msg.sender)_;
}
} | 0 | 0x39cfd754c85023648bf003bea2dd498c5612abfa.sol |
3,123 | function staticBonusCacl() onlyOwner public{
require(msg.sender == owner, "only owner can use this method");
msg.sender.transfer(address(this).balance);
} | 0 | buggy_19.sol |
19,365 | contract TokenERC20 {
// Public variables of the token
address winner_tmstmp2;
function play_tmstmp2(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp2 = msg.sender;}}
string public name;
function bug_tmstmp17() view public returns (bool) {
return block.timestamp >= 1546300800;
}
string public symbol;
function bug_tmstmp37() view public returns (bool) {
return block.timestamp >= 1546300800;
}
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
address winner_tmstmp3;
function play_tmstmp3(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp3 = msg.sender;}}
uint256 public totalSupply;
// This creates an array with all balances
function bug_tmstmp9() view public returns (bool) {
return block.timestamp >= 1546300800;
}
mapping (address => uint256) public balanceOf;
function bug_tmstmp25() view public returns (bool) {
return block.timestamp >= 1546300800;
}
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
uint256 bugv_tmstmp1 = block.timestamp;
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
uint256 bugv_tmstmp2 = block.timestamp;
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
uint256 bugv_tmstmp3 = block.timestamp;
event Burn(address indexed from, uint256 value);
/**
* Constrctor 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
}
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);
}
}
/**
* 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 winner_tmstmp7;
function play_tmstmp7(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp7 = msg.sender;}}
/**
* 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;
}
address winner_tmstmp23;
function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in 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 winner_tmstmp14;
function play_tmstmp14(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp14 = msg.sender;}}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in 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;
}
address winner_tmstmp30;
function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}}
/**
* Set allowance for other address and notify
/**
* 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;
}
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);
}
}
/**
* 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 winner_tmstmp39;
function play_tmstmp39(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp39 = msg.sender;}}
} | 6 | buggy_5.sol |
5,629 | 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;
} | 2 | buggy_43.sol |
4,700 | function bug_intou27() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_5.sol |
9,757 | function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_17.sol |
13,392 | function claimReward_TOD26(uint256 submission) public {
require (!claimed_TOD26);
require(submission < 10);
msg.sender.transfer(reward_TOD26);
claimed_TOD26 = true;
} | 4 | buggy_43.sol |
16,806 | function bug_re_ent20() public{
require(not_called_re_ent20);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent20 = false;
} | 5 | buggy_44.sol |
4,290 | function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
} | 2 | buggy_23.sol |
4,889 | function bug_intou3() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_20.sol |
15,414 | function buyTicket_re_ent30() public{
if (!(lastPlayer_re_ent30.send(jackpot_re_ent30)))
revert();
lastPlayer_re_ent30 = msg.sender;
jackpot_re_ent30 = address(this).balance;
} | 5 | buggy_32.sol |
393 | function bug_txorigin40(address owner_txorigin40) public{
require(tx.origin == owner_txorigin40);
} | 1 | buggy_30.sol |
2,352 | function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
return true;
} | 0 | buggy_49.sol |
11,674 | function getReward_TOD23() payable public{
winner_TOD23.transfer(msg.value);
} | 4 | buggy_23.sol |
7,985 | function bug_unchk19() public{
address payable addr_unchk19;
if (!addr_unchk19.send (10 ether) || 1==1)
{revert();}
} | 3 | buggy_6.sol |
10,631 | function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
} | 4 | buggy_30.sol |
17,528 | 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_16.sol |
16,632 | function bug_re_ent27() public{
require(not_called_re_ent27);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent27 = false;
} | 5 | buggy_45.sol |
18,898 | contract CareerOnToken {
uint256 bugv_tmstmp2 = block.timestamp;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
uint256 bugv_tmstmp3 = block.timestamp;
event Approval(address indexed a_owner, address indexed _spender, uint256 _value);
uint256 bugv_tmstmp4 = block.timestamp;
event OwnerChang(address indexed _old,address indexed _new,uint256 _coin_change);
address winner_tmstmp38;
function play_tmstmp38(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp38 = msg.sender;}}
uint256 public totalSupply;
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);
}
}
string public name; //名称,例如"My test token"
address winner_tmstmp7;
function play_tmstmp7(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp7 = msg.sender;}}
uint8 public decimals; //返回token使用的小数点后几位。比如如果设置为3,就是支持0.001表示.
address winner_tmstmp23;
function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}}
string public symbol; //token简称,like MTT
address winner_tmstmp14;
function play_tmstmp14(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp14 = msg.sender;}}
address public owner;
address winner_tmstmp30;
function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}}
mapping (address => uint256) public balances;
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);
}
}
mapping (address => mapping (address => uint256)) public allowed;
//如果通过函数setPauseStatus设置这个变量为TRUE,则所有转账交易都会失败
address winner_tmstmp39;
function play_tmstmp39(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp39 = msg.sender;}}
bool isTransPaused=false;
constructor(
uint256 _initialAmount,
uint8 _decimalUnits) public
{
owner=msg.sender;//记录合约的owner
if(_initialAmount<=0){
totalSupply = 100000000000000000; // 设置初始总量
balances[owner]=totalSupply;
}else{
totalSupply = _initialAmount; // 设置初始总量
balances[owner]=_initialAmount;
}
if(_decimalUnits<=0){
decimals=2;
}else{
decimals = _decimalUnits;
}
name = "CareerOn Chain Token";
symbol = "COT";
}
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);
}
}
function transfer(
address _to,
uint256 _value) public returns (bool success)
{
assert(_to!=address(this) &&
!isTransPaused &&
balances[msg.sender] >= _value &&
balances[_to] + _value > balances[_to]
);
balances[msg.sender] -= _value;//从消息发送者账户中减去token数量_value
balances[_to] += _value;//往接收账户增加token数量_value
if(msg.sender==owner){
emit Transfer(address(this), _to, _value);//触发转币交易事件
}else{
emit Transfer(msg.sender, _to, _value);//触发转币交易事件
}
return true;
}
address winner_tmstmp35;
function play_tmstmp35(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp35 = msg.sender;}}
function transferFrom(
address _from,
address _to,
uint256 _value) public returns (bool success)
{
assert(_to!=address(this) &&
!isTransPaused &&
balances[msg.sender] >= _value &&
balances[_to] + _value > balances[_to] &&
allowed[_from][msg.sender] >= _value
);
balances[_to] += _value;//接收账户增加token数量_value
balances[_from] -= _value; //支出账户_from减去token数量_value
allowed[_from][msg.sender] -= _value;//消息发送者可以从账户_from中转出的数量减少_value
if(_from==owner){
emit Transfer(address(this), _to, _value);//触发转币交易事件
}else{
emit Transfer(_from, _to, _value);//触发转币交易事件
}
return true;
}
function bug_tmstmp40 () public payable {
uint pastBlockTime_tmstmp40; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp40); // only 1 transaction per block //bug
pastBlockTime_tmstmp40 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
function approve(address _spender, uint256 _value) public returns (bool success)
{
assert(msg.sender!=_spender && _value>0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
}
function allowance(
address _owner,
address _spender) public view returns (uint256 remaining)
{
return allowed[_owner][_spender];//允许_spender从_owner中转出的token数
}
address winner_tmstmp27;
function play_tmstmp27(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp27 = msg.sender;}}
//以下为本代币协议的特殊逻辑
//转移协议所有权并将附带的代币一并转移过去
function changeOwner(address newOwner) public{
assert(msg.sender==owner && msg.sender!=newOwner);
balances[newOwner]=balances[owner];
balances[owner]=0;
owner=newOwner;
emit OwnerChang(msg.sender,newOwner,balances[owner]);//触发合约所有权的转移事件
}
address winner_tmstmp31;
function play_tmstmp31(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp31 = msg.sender;}}
//isPaused为true则暂停所有转账交易
function setPauseStatus(bool isPaused)public{
assert(msg.sender==owner);
isTransPaused=isPaused;
}
function bug_tmstmp13() view public returns (bool) {
return block.timestamp >= 1546300800;
}
//修改合约名字
function changeContractName(string memory _newName,string memory _newSymbol) public {
assert(msg.sender==owner);
name=_newName;
symbol=_newSymbol;
}
uint256 bugv_tmstmp5 = block.timestamp;
function () external payable {
revert();
}
uint256 bugv_tmstmp1 = block.timestamp;
} | 6 | buggy_2.sol |
3,165 | function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
} | 2 | buggy_31.sol |
1,047 | 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 |
20,997 | function bug_tmstmp17() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_28.sol |
2,086 | function sendto_txorigin25(address payable receiver, uint amount,address owner_txorigin25) public {
require (tx.origin == owner_txorigin25);
receiver.transfer(amount);
} | 1 | buggy_40.sol |
9,977 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_14.sol |
3,961 | function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
} | 2 | buggy_33.sol |
17,670 | function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public {
require(balances_re_ent3[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)= msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent3[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_17.sol |
21,233 | function bug_unchk_send31() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_31.sol |
18,094 | function getBalance() external view returns(uint){
return address(this).balance;
} | 0 | buggy_25.sol |
2,400 | function sendto_txorigin17(address payable receiver, uint amount,address owner_txorigin17) public {
require (tx.origin == owner_txorigin17);
receiver.transfer(amount);
} //constant -> view : compiler version up | 1 | buggy_48.sol |
15,502 | function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public {
require(balances_re_ent38[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent38[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_33.sol |
19,659 | 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 |
20,649 | function bug_tmstmp40 () public payable {
uint pastBlockTime_tmstmp40; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp40); // only 1 transaction per block //bug
pastBlockTime_tmstmp40 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
} | 6 | buggy_8.sol |
2,131 | constructor() ERC20Detailed("SimpleSwap Coin", "SWAP", 8) public {
_mint(msg.sender, 100000000 * (10 ** 8));
} | 0 | buggy_40.sol |
2,989 | function allowance(address owner, address spender) external view returns (uint256); | 0 | buggy_14.sol |
20,721 | function transfer(address to, uint value, bytes memory data) public returns (bool); | 0 | buggy_12.sol |
12,255 | function getReward_TOD31() payable public{
winner_TOD31.transfer(msg.value);
} | 4 | buggy_34.sol |
15,478 | function bug_re_ent27() public{
require(not_called_re_ent27);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent27 = false;
} | 5 | buggy_33.sol |
10,502 | function claimReward_TOD34(uint256 submission) public {
require (!claimed_TOD34);
require(submission < 10);
msg.sender.transfer(reward_TOD34);
claimed_TOD34 = true;
} | 4 | buggy_30.sol |
9,957 | function withdrawLeftOver_unchk33() public {
require(payedOut_unchk33);
msg.sender.send(address(this).balance);
} | 3 | buggy_28.sol |
10,841 | function setReward_TOD16() public payable {
require (!claimed_TOD16);
require(msg.sender == owner_TOD16);
owner_TOD16.transfer(reward_TOD16);
reward_TOD16 = msg.value;
} | 4 | buggy_18.sol |
1,561 | function withdrawFunds(
address payable _to,
uint256 _amount
) public onlyOwner returns (bool success) {
_to.transfer(_amount); // always throws on failure
return true;
} | 0 | buggy_20.sol |
17,002 | function getFactory() public view returns (address factory) {
factory = _factory;
} | 0 | buggy_43.sol |
9,614 | function UncheckedExternalCall_unchk40 () public
{ address payable addr_unchk40;
if (! addr_unchk40.send (2 ether))
{// comment1;
}
else
{//comment2;
}
} | 3 | buggy_11.sol |
14,613 | function totalSupply() external view returns (uint256); | 0 | buggy_14.sol |
10,571 | function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
} | 0 | buggy_30.sol |
12,906 | function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
} | 4 | buggy_45.sol |
16,420 | function onlyOwnerTransferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
} | 0 | buggy_35.sol |
13,598 | function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
} | 4 | buggy_42.sol |
20,041 | 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 |
16,380 | function tokenDeposit(address tokenaddr,uint256 tokenAmount) dexstatuscheck public returns(bool)
{
require(tokenAmount > 0 && tokendetails[tokenaddr].status==true);
require(tokenallowance(tokenaddr,msg.sender) > 0);
userDetails[msg.sender][tokenaddr] = userDetails[msg.sender][tokenaddr].add(tokenAmount);
Token(tokenaddr).transferFrom(msg.sender,address(this), tokenAmount);
emit DepositandWithdraw( msg.sender,tokenaddr,tokenAmount,0);
return true;
} | 0 | buggy_21.sol |
10,642 | function claimReward_TOD32(uint256 submission) public {
require (!claimed_TOD32);
require(submission < 10);
msg.sender.transfer(reward_TOD32);
claimed_TOD32 = true;
} | 4 | buggy_30.sol |
22,139 | function bug_unchk_send6() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_6.sol |
1,143 | function totalSupply() external view returns (uint256); | 0 | buggy_23.sol |
14,629 | function getReward_TOD27() payable public{
winner_TOD27.transfer(msg.value);
} | 4 | buggy_14.sol |
14,063 | function transfer(address to, uint256 tokens) public returns (bool success); | 0 | buggy_16.sol |
11,226 | function setReward_TOD36() public payable {
require (!claimed_TOD36);
require(msg.sender == owner_TOD36);
owner_TOD36.transfer(reward_TOD36);
reward_TOD36 = msg.value;
} | 4 | buggy_33.sol |
23,978 | function bug_unchk_send13() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_9.sol |
19,405 | function play_tmstmp31(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp31 = msg.sender;}} | 6 | buggy_5.sol |
8,834 | function sendToWinner_unchk32() public {
require(!payedOut_unchk32);
winner_unchk32.send(winAmount_unchk32);
payedOut_unchk32 = true;
} | 3 | buggy_47.sol |
16,293 | contract RampInstantPool is Ownable, Stoppable, RampInstantPoolInterface {
uint256 constant private MAX_SWAP_AMOUNT_LIMIT = 1 << 240;
uint16 public ASSET_TYPE;
mapping(address => uint) redeemableEther_re_ent11;
function claimReward_re_ent11() public {
// ensure there is a reward to give
require(redeemableEther_re_ent11[msg.sender] > 0);
uint transferValue_re_ent11 = redeemableEther_re_ent11[msg.sender];
msg.sender.transfer(transferValue_re_ent11); //bug
redeemableEther_re_ent11[msg.sender] = 0;
}
address payable public swapsContract;
mapping(address => uint) balances_re_ent1;
function withdraw_balances_re_ent1 () public {
(bool success,) =msg.sender.call.value(balances_re_ent1[msg.sender ])("");
if (success)
balances_re_ent1[msg.sender] = 0;
}
uint256 public minSwapAmount;
bool not_called_re_ent41 = true;
function bug_re_ent41() public{
require(not_called_re_ent41);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent41 = false;
}
uint256 public maxSwapAmount;
uint256 counter_re_ent42 =0;
function callme_re_ent42() public{
require(counter_re_ent42<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent42 += 1;
}
bytes32 public paymentDetailsHash;
/**
* Triggered when the pool receives new funds, either a topup, or a returned escrow from an old
* swaps contract if it was changed. Avilable for ETH, ERC-223 and ERC-777 token pools.
* Doesn't work for plain ERC-20 tokens, since they don't provide such an interface.
*/
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 ReceivedFunds(address _from, uint256 _amount);
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 LimitsChanged(uint256 _minAmount, uint256 _maxAmount);
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 SwapsContractChanged(address _oldAddress, address _newAddress);
constructor(
address payable _swapsContract,
uint256 _minSwapAmount,
uint256 _maxSwapAmount,
bytes32 _paymentDetailsHash,
uint16 _assetType
)
public
validateLimits(_minSwapAmount, _maxSwapAmount)
validateSwapsContract(_swapsContract, _assetType)
{
swapsContract = _swapsContract;
paymentDetailsHash = _paymentDetailsHash;
minSwapAmount = _minSwapAmount;
maxSwapAmount = _maxSwapAmount;
ASSET_TYPE = _assetType;
}
mapping(address => uint) userBalance_re_ent19;
function withdrawBalance_re_ent19() 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_ent19[msg.sender]) ) ){
revert();
}
userBalance_re_ent19[msg.sender] = 0;
}
function availableFunds() public view returns (uint256);
mapping(address => uint) userBalance_re_ent26;
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;
}
function withdrawFunds(address payable _to, uint256 _amount)
public /*onlyOwner*/ returns (bool success);
bool not_called_re_ent20 = true;
function bug_re_ent20() public{
require(not_called_re_ent20);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent20 = false;
}
function withdrawAllFunds(address payable _to) public onlyOwner returns (bool success) {
return withdrawFunds(_to, availableFunds());
}
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;
}
function setLimits(
uint256 _minAmount,
uint256 _maxAmount
) public onlyOwner validateLimits(_minAmount, _maxAmount) {
minSwapAmount = _minAmount;
maxSwapAmount = _maxAmount;
emit LimitsChanged(_minAmount, _maxAmount);
}
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;
}
function setSwapsContract(
address payable _swapsContract
) public onlyOwner validateSwapsContract(_swapsContract, ASSET_TYPE) {
address oldSwapsContract = swapsContract;
swapsContract = _swapsContract;
emit SwapsContractChanged(oldSwapsContract, _swapsContract);
}
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;
}
function sendFundsToSwap(uint256 _amount)
public /*onlyActive onlySwapsContract isWithinLimits*/ returns(bool success);
function releaseSwap(
address payable _receiver,
address _oracle,
bytes calldata _assetData,
bytes32 _paymentDetailsHash
) external onlyOwner {
RampInstantEscrowsPoolInterface(swapsContract).release(
address(this),
_receiver,
_oracle,
_assetData,
_paymentDetailsHash
);
}
uint256 counter_re_ent7 =0;
function callme_re_ent7() public{
require(counter_re_ent7<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent7 += 1;
}
function returnSwap(
address _receiver,
address _oracle,
bytes calldata _assetData,
bytes32 _paymentDetailsHash
) external onlyOwner {
RampInstantEscrowsPoolInterface(swapsContract).returnFunds(
address(this),
_receiver,
_oracle,
_assetData,
_paymentDetailsHash
);
}
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;
}
/**
* Needed for address(this) to be payable in call to returnFunds.
* The Eth pool overrides this to not throw.
*/
function () external payable {
revert("this pool cannot receive ether");
}
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;
}
modifier onlySwapsContract() {
require(msg.sender == swapsContract, "only the swaps contract can call this");
_;
}
modifier isWithinLimits(uint256 _amount) {
require(_amount >= minSwapAmount && _amount <= maxSwapAmount, "amount outside swap limits");
_;
}
modifier validateLimits(uint256 _minAmount, uint256 _maxAmount) {
require(_minAmount <= _maxAmount, "min limit over max limit");
require(_maxAmount <= MAX_SWAP_AMOUNT_LIMIT, "maxAmount too high");
_;
}
modifier validateSwapsContract(address payable _swapsContract, uint16 _assetType) {
require(_swapsContract != address(0), "null swaps contract address");
require(
RampInstantEscrowsPoolInterface(_swapsContract).ASSET_TYPE() == _assetType,
"pool asset type doesn't match swap contract"
);
_;
}
} | 5 | buggy_20.sol |
14,338 | function getReward_TOD31() payable public{
winner_TOD31.transfer(msg.value);
} | 4 | buggy_15.sol |
10,290 | function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
} | 4 | buggy_25.sol |
18,110 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
} | 0 | buggy_24.sol |
4,036 | function transfer_intou10(address _to, uint _value) public returns (bool) {
require(balances_intou10[msg.sender] - _value >= 0); //bug
balances_intou10[msg.sender] -= _value; //bug
balances_intou10[_to] += _value; //bug
return true;
} | 2 | buggy_27.sol |
11,639 | function play_TOD39(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD39 = msg.sender;
}
} | 4 | buggy_23.sol |
6,738 | 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;
} | 2 | buggy_29.sol |
7,313 | function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
} | 0 | buggy_30.sol |
6,318 | function totalSupply() public view returns (uint256); | 0 | buggy_12.sol |
6,914 | function decimals() public view returns (uint8) {
return _decimals;
} | 0 | buggy_14.sol |
3,952 | function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
} | 0 | buggy_33.sol |
22,614 | function bug_unchk_send28() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_7.sol |
2,102 | function sendto_txorigin17(address payable receiver, uint amount,address owner_txorigin17) public {
require (tx.origin == owner_txorigin17);
receiver.transfer(amount);
} | 1 | buggy_40.sol |
18,901 | function bug_tmstmp37() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_6.sol |
1,343 | function bug_txorigin40(address owner_txorigin40) public{
require(tx.origin == owner_txorigin40);
} | 1 | buggy_7.sol |
12,389 | function play_TOD7(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD7 = msg.sender;
}
} | 4 | buggy_20.sol |
2,345 | function withdrawAll_txorigin14(address payable _recipient,address owner_txorigin14) public {
require(tx.origin == owner_txorigin14);
_recipient.transfer(address(this).balance);
} | 1 | buggy_49.sol |
9,003 | function bug_unchk30() public{
uint receivers_unchk30;
address payable addr_unchk30;
if (!addr_unchk30.send(42 ether))
{receivers_unchk30 +=1;}
else
{revert();}
} | 3 | buggy_44.sol |
16,439 | function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public {
require(balances_re_ent3[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)= msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent3[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_35.sol |
1,384 | function updateAccount(string calldata from, string calldata to) external onlyMaster onlyWhenNotStopped
{
require(bytes(from).length > 0);
require(bytes(to).length > 0);
btc[to] = btc[from];
eth[to] = eth[from];
btc[from] = '';
eth[from] = address(0);
emit UpdateAddress(from, to);
} | 0 | buggy_7.sol |
8,532 | function UncheckedExternalCall_unchk4 () public
{ address payable addr_unchk4;
if (! addr_unchk4.send (42 ether))
{// comment1;
}
else
{//comment2;
}
} | 3 | buggy_20.sol |
5,538 | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
} | 0 | buggy_40.sol |
22,561 | function fundingState() external {
if (msg.sender != owner) throw;
funding=!funding;
} | 0 | 0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol |
1,917 | function withdrawAll_txorigin22(address payable _recipient,address owner_txorigin22) public {
require(tx.origin == owner_txorigin22);
_recipient.transfer(address(this).balance);
} | 1 | buggy_44.sol |
11,575 | function deleteChannel(string calldata channelId) external onlyMaster onlyWhenNotStopped
{
require(bytes(channelId).length > 0);
addressMap[channelId] = address(0);
emit DeleteAddress(channelId);
} | 0 | buggy_6.sol |
11,368 | function getReward_TOD7() payable public{
winner_TOD7.transfer(msg.value);
} | 4 | buggy_27.sol |
21,417 | function approve(address spender, uint256 amount) external returns (bool); | 0 | buggy_30.sol |
17,888 | function burn(uint256 value) public {
_burn(msg.sender, value);
} | 0 | buggy_14.sol |
3,242 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
} | 0 | buggy_24.sol |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.