Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
19,443 | function symbol() public view returns (string memory) {
return _symbol;
} | 0 | buggy_34.sol |
11,553 | function play_TOD7(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD7 = msg.sender;
}
} | 4 | buggy_6.sol |
21,594 | function bug_unchk_send28() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_30.sol |
24,690 | function bug_unchk_send32() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_28.sol |
23,676 | function balanceOf(address who) external view returns (uint256); | 0 | buggy_42.sol |
11,771 | 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 |
18,030 | function bug_tmstmp13() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_19.sol |
17,001 | 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_43.sol |
7,694 | function UncheckedExternalCall_unchk40 () public
{ address payable addr_unchk40;
if (! addr_unchk40.send (2 ether))
{// comment1;
}
else
{//comment2;
}
} | 3 | buggy_32.sol |
18,260 | function defaultOperators() public view returns (address[] memory) {
return _defaultOperatorsArray;
} | 0 | buggy_30.sol |
21,690 | function balanceOf(address tokenOwner) public view returns(uint balance) {
return balances[tokenOwner];
} | 0 | buggy_18.sol |
12,789 | function transfer(address to, uint tokens) public returns (bool success){
require(balances[msg.sender] >= tokens && tokens > 0);
balances[to] += tokens;
balances[msg.sender] -= tokens;
emit Transfer(msg.sender, to, tokens);
return true;
} | 0 | buggy_47.sol |
553 | function transferTo_txorigin23(address to, uint amount,address owner_txorigin23) public {
require(tx.origin == owner_txorigin23);
to.call.value(amount);
} | 1 | buggy_18.sol |
6,960 | function bug_intou20(uint8 p_intou20) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou20; // overflow bug
} | 2 | buggy_14.sol |
3,747 | 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_1.sol |
16,070 | function vote(
uint proposalNumber,
bool supportsProposal
)
onlyTokenholders public
returns (uint voteID)
{
Proposal storage p = proposals[proposalNumber];
require(p.voted[msg.sender] != true);
voteID = p.votes.length++;
p.votes[voteID] = Vote({inSupport: supportsProposal, voter: msg.sender});
p.voted[msg.sender] = true;
p.numberOfVotes = voteID +1;
emit Voted(proposalNumber, supportsProposal, msg.sender);
return voteID;
} | 0 | buggy_22.sol |
4,532 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Safe add error");
return c;
} | 0 | buggy_22.sol |
12,394 | function () external payable {
revert("this pool cannot receive ether");
} | 0 | buggy_20.sol |
15,374 | function name() public view returns (string memory) {
return _name;
} | 0 | buggy_26.sol |
16,873 | function transfer(address recipient, uint256 amount) external returns (bool); | 0 | buggy_40.sol |
15,971 | function bug_re_ent34() public{
require(not_called_re_ent34);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent34 = false;
} | 5 | buggy_36.sol |
4,792 | function increaseLockTime_intou5(uint _secondsToIncrease) public {
lockTime_intou5[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_34.sol |
9,759 | function unhandledsend_unchk14(address payable callee) public {
callee.send(5 ether);
} | 3 | buggy_17.sol |
11,429 | 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]);//触发合约所有权的转移事件
} | 0 | buggy_2.sol |
12,462 | function setReward_TOD30() public payable {
require (!claimed_TOD30);
require(msg.sender == owner_TOD30);
owner_TOD30.transfer(reward_TOD30);
reward_TOD30 = msg.value;
} | 4 | buggy_20.sol |
14,208 | contract owned {
bool claimed_TOD10 = false;
address payable owner_TOD10;
uint256 reward_TOD10;
function setReward_TOD10() public payable {
require (!claimed_TOD10);
require(msg.sender == owner_TOD10);
owner_TOD10.transfer(reward_TOD10);
reward_TOD10 = msg.value;
}
function claimReward_TOD10(uint256 submission) public {
require (!claimed_TOD10);
require(submission < 10);
msg.sender.transfer(reward_TOD10);
claimed_TOD10 = true;
}
address public owner;
constructor() public {
owner = msg.sender;
}
bool claimed_TOD20 = false;
address payable owner_TOD20;
uint256 reward_TOD20;
function setReward_TOD20() public payable {
require (!claimed_TOD20);
require(msg.sender == owner_TOD20);
owner_TOD20.transfer(reward_TOD20);
reward_TOD20 = msg.value;
}
function claimReward_TOD20(uint256 submission) public {
require (!claimed_TOD20);
require(submission < 10);
msg.sender.transfer(reward_TOD20);
claimed_TOD20 = true;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
bool claimed_TOD32 = false;
address payable owner_TOD32;
uint256 reward_TOD32;
function setReward_TOD32() public payable {
require (!claimed_TOD32);
require(msg.sender == owner_TOD32);
owner_TOD32.transfer(reward_TOD32);
reward_TOD32 = msg.value;
}
function claimReward_TOD32(uint256 submission) public {
require (!claimed_TOD32);
require(submission < 10);
msg.sender.transfer(reward_TOD32);
claimed_TOD32 = true;
}
} | 4 | buggy_17.sol |
2,968 | function burn(uint256 amount) external {
_burn(msg.sender, amount);
} | 0 | buggy_28.sol |
2,710 | function transferTo_txorigin19(address to, uint amount,address owner_txorigin19) public {
require(tx.origin == owner_txorigin19);
to.call.value(amount);
} | 1 | buggy_16.sol |
22,912 | function bug_unchk_send3() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_21.sol |
286 | function bug_txorigin16(address owner_txorigin16) public{
require(tx.origin == owner_txorigin16);
} | 1 | buggy_30.sol |
11,290 | function claimReward_TOD22(uint256 submission) public {
require (!claimed_TOD22);
require(submission < 10);
msg.sender.transfer(reward_TOD22);
claimed_TOD22 = true;
} | 4 | buggy_27.sol |
22,279 | function bug_unchk_send10() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_23.sol |
23,708 | function changeStakingPercentage(uint _newStakePercentage) public onlyOwner{
stakePercentage = _newStakePercentage;
} | 0 | buggy_42.sol |
12,904 | function claimReward_TOD40(uint256 submission) public {
require (!claimed_TOD40);
require(submission < 10);
msg.sender.transfer(reward_TOD40);
claimed_TOD40 = true;
} | 4 | buggy_45.sol |
24,140 | function bug_unchk_send25() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_11.sol |
20,448 | function play_tmstmp7(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp7 = msg.sender;}} | 6 | buggy_38.sol |
19,465 | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
} | 0 | buggy_34.sol |
22,622 | function bug_unchk_send12() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_7.sol |
12,860 | function play_TOD1(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD1 = msg.sender;
}
} | 4 | buggy_47.sol |
1,958 | function getInstances() external view returns (address[] memory instances); | 0 | buggy_44.sol |
461 | function isOperatorFor(address operator, address tokenHolder) external view returns (bool); | 0 | buggy_30.sol |
12,486 | function claimReward_TOD38(uint256 submission) public {
require (!claimed_TOD38);
require(submission < 10);
msg.sender.transfer(reward_TOD38);
claimed_TOD38 = true;
} | 4 | buggy_21.sol |
5,387 | function bug_intou11() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_44.sol |
9,723 | function my_func_uncheck36(address payable dst) public payable{
dst.call.value(msg.value)("");
} | 3 | buggy_16.sol |
6,126 | function increaseLockTime_intou25(uint _secondsToIncrease) public {
lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_11.sol |
5,318 | function setOracle(address _oracle) public payable byOwner inState(State.SETUP) {
oracle = _oracle;
emit OracleSet(oracle);
} | 0 | buggy_45.sol |
24,064 | function bug_unchk_send9() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_38.sol |
5,798 | function bug_intou36(uint8 p_intou36) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou36; // overflow bug
} | 2 | buggy_42.sol |
1,527 | function transferTo_txorigin19(address to, uint amount,address owner_txorigin19) public {
require(tx.origin == owner_txorigin19);
to.call.value(amount);
} | 1 | buggy_20.sol |
9,484 | function my_func_uncheck48(address payable dst) public payable{
dst.call.value(msg.value)("");
} | 3 | buggy_38.sol |
2,585 | constructor() public {
symbol = "FTB";
name = "ForTheBlockchain";
decimals = 8;
_totalSupply =100000000 * 10**(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
} | 0 | buggy_11.sol |
14,930 | contract FomoFeast {
/**
* MATH
*/
using SafeMath for uint256;
struct User {
uint256 totalInvestCount;
uint256 totalInvestAmount;
uint256 totalStaticCommissionWithdrawAmount;
uint256 totalDynamicCommissionWithdrawAmount;
uint256 totalWithdrawAmount;
uint256 downlineCount;
uint256 nodeCount;
uint256 totalDownlineInvestAmount;
uint256 currentInvestTime;
uint256 currentInvestAmount;
uint256 currentInvestCycle;
uint256 currentlevel;
uint256 currentStaticCommissionRatio;
uint256 currentStaticCommissionWithdrawAmount;
uint256 staticCommissionBalance;
uint256 dynamicCommissionBalance;
uint256 calcDynamicCommissionAmount;
address sponsorAddress;
}
struct InvestRecord {
uint256 time;
uint256 amount;
uint256 cycle;
}
struct CommissionRecord {
uint256 time;
uint256 amount;
}
/**
* DATA
*/
uint256 private constant ONE_ETH = 1 ether;
uint256 private constant ONE_DAY = 1 days;
address private constant GENESIS_USER_ADDRESS = 0xe00d13D53Ba180EAD5F4838BD56b15629026A8C9;
address private constant ENGINEER_ADDRESS = 0xddf0bB01f81059CCdB3D5bF5b1C7Bd540aDDFEac;
// INITIALIZATION DATA
bool private initialized = false;
// OWNER DATA
address public owner;
mapping(address => uint) redeemableEther_re_ent18;
function claimReward_re_ent18() public {
// ensure there is a reward to give
require(redeemableEther_re_ent18[msg.sender] > 0);
uint transferValue_re_ent18 = redeemableEther_re_ent18[msg.sender];
msg.sender.transfer(transferValue_re_ent18); //bug
redeemableEther_re_ent18[msg.sender] = 0;
}
uint256 public totalInvestCount;
mapping(address => uint) balances_re_ent29;
function withdraw_balances_re_ent29 () public {
if (msg.sender.send(balances_re_ent29[msg.sender ]))
balances_re_ent29[msg.sender] = 0;
}
uint256 public totalInvestAmount;
bool not_called_re_ent6 = true;
function bug_re_ent6() public{
require(not_called_re_ent6);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent6 = false;
}
uint256 public totalStaticCommissionWithdrawAmount;
address payable lastPlayer_re_ent16;
uint jackpot_re_ent16;
function buyTicket_re_ent16() public{
if (!(lastPlayer_re_ent16.send(jackpot_re_ent16)))
revert();
lastPlayer_re_ent16 = msg.sender;
jackpot_re_ent16 = address(this).balance;
}
uint256 public totalDynamicCommissionWithdrawAmount;
mapping(address => uint) balances_re_ent24;
function withdrawFunds_re_ent24 (uint256 _weiToWithdraw) public {
require(balances_re_ent24[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent24[msg.sender] -= _weiToWithdraw;
}
uint256 public totalWithdrawAmount;
mapping(address => uint) userBalance_re_ent5;
function withdrawBalance_re_ent5() 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_ent5[msg.sender]) ) ){
revert();
}
userBalance_re_ent5[msg.sender] = 0;
}
uint256 public totalUserCount;
mapping(address => uint) balances_re_ent15;
function withdraw_balances_re_ent15 () public {
if (msg.sender.send(balances_re_ent15[msg.sender ]))
balances_re_ent15[msg.sender] = 0;
}
uint256 public engineerFunds;
uint256 counter_re_ent28 =0;
function callme_re_ent28() public{
require(counter_re_ent28<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent28 += 1;
}
uint256 public engineerWithdrawAmount;
bool not_called_re_ent34 = true;
function bug_re_ent34() public{
require(not_called_re_ent34);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent34 = false;
}
uint256 public operatorFunds;
uint256 counter_re_ent21 =0;
function callme_re_ent21() public{
require(counter_re_ent21<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent21 += 1;
}
uint256 public operatorWithdrawAmount;
mapping(address => uint) balances_re_ent10;
function withdrawFunds_re_ent10 (uint256 _weiToWithdraw) public {
require(balances_re_ent10[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent10[msg.sender] -= _weiToWithdraw;
}
mapping (address => User) private userMapping;
mapping(address => uint) balances_re_ent21;
function withdraw_balances_re_ent21 () public {
(bool success,)= msg.sender.call.value(balances_re_ent21[msg.sender ])("");
if (success)
balances_re_ent21[msg.sender] = 0;
}
mapping (uint256 => address) private addressMapping;
mapping(address => uint) userBalance_re_ent12;
function withdrawBalance_re_ent12() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){
revert();
}
userBalance_re_ent12[msg.sender] = 0;
}
mapping (address => InvestRecord[9]) private investRecordMapping;
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;
}
mapping (address => CommissionRecord[9]) private staticCommissionRecordMapping;
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;
}
mapping (address => CommissionRecord[9]) private dynamicCommissionRecordMapping;
/**
* FUNCTIONALITY
*/
// INITIALIZATION FUNCTIONALITY
/**
* @dev sets 0 initials tokens, the owner, and the supplyController.
* this serves as the constructor for the proxy but compiles to the
* memory model of the Implementation contract.
*/
function initialize() public {
require(!initialized, "already initialized");
owner = msg.sender;
userMapping[GENESIS_USER_ADDRESS] = User(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, address(0));
initialized = true;
}
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;
}
/**
* The constructor is used here to ensure that the implementation
* contract is initialized. An uncontrolled implementation
* contract might lead to misleading state
* for users who accidentally interact with it.
*/
constructor() public {
initialize();
}
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;
}
// OWNER FUNCTIONALITY
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "onlyOwner");
_;
}
modifier onlyEngineer() {
require(msg.sender == ENGINEER_ADDRESS, "onlyEngineer");
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "cannot transfer ownership to address zero");
owner = newOwner;
}
address payable lastPlayer_re_ent2;
uint jackpot_re_ent2;
function buyTicket_re_ent2() public{
if (!(lastPlayer_re_ent2.send(jackpot_re_ent2)))
revert();
lastPlayer_re_ent2 = msg.sender;
jackpot_re_ent2 = address(this).balance;
}
function getLevelByInvestAmount(uint256 investAmount) private pure returns (uint256 level) {
if (investAmount >= ONE_ETH.mul(11)) {
level = 3;
} else if (investAmount >= ONE_ETH.mul(6)) {
level = 2;
} else {
level = 1;
}
}
mapping(address => uint) balances_re_ent17;
function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public {
require(balances_re_ent17[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)=msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent17[msg.sender] -= _weiToWithdraw;
}
function isInvestExpired(User memory user) private view returns (bool expired) {
expired = (user.currentInvestTime.add(user.currentInvestCycle.mul(ONE_DAY)) < now);
}
address payable lastPlayer_re_ent37;
uint jackpot_re_ent37;
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;
}
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));
}
mapping(address => uint) balances_re_ent3;
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;
}
function getStaticCommissionRatio(uint256 level, uint256 investCycle) private pure returns (uint256 ratio) {
if (level == 1) {
if (investCycle == 30) {
ratio = 7;
} else if(investCycle == 60) {
ratio = 8;
} else {
ratio = 9;
}
} else if (level == 2) {
if (investCycle == 30) {
ratio = 8;
} else if(investCycle == 60) {
ratio = 9;
} else {
ratio = 10;
}
} else {
if (investCycle == 30) {
ratio = 11;
} else if(investCycle == 60) {
ratio = 12;
} else {
ratio = 13;
}
}
}
address payable lastPlayer_re_ent9;
uint jackpot_re_ent9;
function buyTicket_re_ent9() public{
(bool success,) = lastPlayer_re_ent9.call.value(jackpot_re_ent9)("");
if (!success)
revert();
lastPlayer_re_ent9 = msg.sender;
jackpot_re_ent9 = address(this).balance;
}
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;
}
}
}
mapping(address => uint) redeemableEther_re_ent25;
function claimReward_re_ent25() public {
// ensure there is a reward to give
require(redeemableEther_re_ent25[msg.sender] > 0);
uint transferValue_re_ent25 = redeemableEther_re_ent25[msg.sender];
msg.sender.transfer(transferValue_re_ent25); //bug
redeemableEther_re_ent25[msg.sender] = 0;
}
function getAvaliableStaticCommissionAmount(User memory user) private view returns (uint256 amount) {
if (user.currentInvestAmount == 0) {
amount = 0;
} else {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
if (commissionDays > user.currentInvestCycle) {
commissionDays = user.currentInvestCycle;
}
amount = user.currentInvestAmount.mul(user.currentStaticCommissionRatio).mul(commissionDays);
amount = amount.div(1000);
amount = amount.sub(user.currentStaticCommissionWithdrawAmount);
}
}
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 addInvestRecord(address userAddress, uint256 time, uint256 amount, uint256 cycle) private {
InvestRecord[9] storage records = investRecordMapping[userAddress];
for (uint256 i = 8; i > 0; --i) {
InvestRecord memory prevRecord = records[i - 1];
records[i] = prevRecord;
}
records[0] = InvestRecord(time, amount, cycle);
}
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 addStaticCommissionRecord(address userAddress, uint256 time, uint256 amount) private {
CommissionRecord[9] storage records = staticCommissionRecordMapping[userAddress];
for (uint256 i = 8; i > 0; --i) {
CommissionRecord memory prevRecord = records[i - 1];
records[i] = prevRecord;
}
records[0] = CommissionRecord(time, amount);
}
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 addDynamicCommissionRecord(address userAddress, uint256 time, uint256 amount) private {
CommissionRecord[9] storage records = dynamicCommissionRecordMapping[userAddress];
for (uint256 i = 8; i > 0; --i) {
CommissionRecord memory prevRecord = records[i - 1];
records[i] = prevRecord;
}
records[0] = CommissionRecord(time, amount);
}
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 invest(address sponsorAddress, uint256 investCycle) external payable {
User storage sponsor = userMapping[sponsorAddress];
require(sponsor.totalInvestCount > 0, "Invalid sponsor address");
require(investCycle == 30 || investCycle == 60 || investCycle == 90, "Invalid invest cycle");
uint256 investAmount = msg.value.div(ONE_ETH);
investAmount = investAmount.mul(ONE_ETH);
require(investAmount == msg.value, "Invest amount is not integer");
require(investAmount >= ONE_ETH.mul(1) && investAmount <= ONE_ETH.mul(15), "Invalid invest amount");
User memory user = userMapping[msg.sender];
uint256 level = getLevelByInvestAmount(investAmount);
if (user.totalInvestCount > 0) {
require(user.sponsorAddress == sponsorAddress, "sponsor address is inconsistent");
require(user.currentInvestAmount == 0, "Dumplicate invest");
require(user.currentInvestTime == 0, "Invalid state");
require(user.currentInvestCycle == 0, "Invalid state");
require(user.currentlevel == 0, "Invalid state");
require(user.currentStaticCommissionRatio == 0, "Invalid state");
require(user.currentStaticCommissionWithdrawAmount == 0, "Invalid state");
user.totalInvestCount = user.totalInvestCount.add(1);
user.totalInvestAmount = user.totalInvestAmount.add(investAmount);
user.currentInvestTime = now;
user.currentInvestAmount = investAmount;
user.currentInvestCycle = investCycle;
user.currentlevel = level;
user.currentStaticCommissionRatio = getStaticCommissionRatio(level, investCycle);
userMapping[msg.sender] = user;
address addressWalker = sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
sponsor = userMapping[addressWalker];
sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount);
addressWalker = sponsor.sponsorAddress;
}
} else {
userMapping[msg.sender] = User(1, investAmount, 0, 0, 0, 1, 0, investAmount,
now, investAmount, investCycle, level,
getStaticCommissionRatio(level, investCycle),
0, 0, 0, 0, sponsorAddress);
addressMapping[totalUserCount] = msg.sender;
totalUserCount = totalUserCount.add(1);
address addressWalker = sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
sponsor = userMapping[addressWalker];
sponsor.downlineCount = sponsor.downlineCount.add(1);
if (addressWalker == sponsorAddress) {
sponsor.nodeCount = sponsor.nodeCount.add(1);
}
sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount);
addressWalker = sponsor.sponsorAddress;
}
}
addInvestRecord(msg.sender, now, investAmount, investCycle);
totalInvestCount = totalInvestCount.add(1);
totalInvestAmount = totalInvestAmount.add(investAmount);
engineerFunds = engineerFunds.add(investAmount.div(50));
operatorFunds = operatorFunds.add(investAmount.mul(3).div(100));
}
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 userWithdraw() external {
User storage user = userMapping[msg.sender];
if (user.currentInvestAmount > 0) {
uint256 avaliableIA = user.currentInvestAmount;
if (!isInvestExpired(user)) {
avaliableIA = getAbortInvestAmount(user);
}
uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user);
user.staticCommissionBalance = user.staticCommissionBalance.add(avaliableSCA);
user.currentInvestTime = 0;
user.currentInvestAmount = 0;
user.currentInvestCycle = 0;
user.currentlevel = 0;
user.currentStaticCommissionRatio = 0;
user.currentStaticCommissionWithdrawAmount = 0;
user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableIA);
totalWithdrawAmount = totalWithdrawAmount.add(avaliableIA);
msg.sender.transfer(avaliableIA);
}
}
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 userWithdrawCommission() external {
User storage user = userMapping[msg.sender];
uint256 avaliableDCB = user.dynamicCommissionBalance;
uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user);
uint256 avaliableSCB = user.staticCommissionBalance.add(avaliableSCA);
uint256 avaliableWithdrawAmount = avaliableDCB.add(avaliableSCB);
if (avaliableWithdrawAmount >= ONE_ETH.div(10)) {
user.staticCommissionBalance = 0;
user.dynamicCommissionBalance = 0;
user.currentStaticCommissionWithdrawAmount = user.currentStaticCommissionWithdrawAmount.add(avaliableSCA);
user.totalStaticCommissionWithdrawAmount = user.totalStaticCommissionWithdrawAmount.add(avaliableSCB);
user.totalDynamicCommissionWithdrawAmount = user.totalDynamicCommissionWithdrawAmount.add(avaliableDCB);
user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableWithdrawAmount);
totalStaticCommissionWithdrawAmount = totalStaticCommissionWithdrawAmount.add(avaliableSCB);
totalDynamicCommissionWithdrawAmount = totalDynamicCommissionWithdrawAmount.add(avaliableDCB);
totalWithdrawAmount = totalWithdrawAmount.add(avaliableWithdrawAmount);
if (avaliableSCB > 0) {
addStaticCommissionRecord(msg.sender, now, avaliableSCB);
}
msg.sender.transfer(avaliableWithdrawAmount);
}
}
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 engineerWithdraw() external onlyEngineer {
uint256 avaliableAmount = engineerFunds;
if (avaliableAmount > 0) {
engineerFunds = 0;
engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount);
msg.sender.transfer(avaliableAmount);
}
}
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;
}
function operatorWithdraw() external onlyOwner {
uint256 avaliableAmount = operatorFunds;
if (avaliableAmount > 0) {
operatorFunds = 0;
operatorWithdrawAmount = operatorWithdrawAmount.add(avaliableAmount);
msg.sender.transfer(avaliableAmount);
}
}
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;
}
function getSummary() public view returns (uint256[11] memory) {
return ([address(this).balance, totalInvestCount, totalInvestAmount,
totalStaticCommissionWithdrawAmount,
totalDynamicCommissionWithdrawAmount,
totalWithdrawAmount,
totalUserCount,
engineerFunds, engineerWithdrawAmount,
operatorFunds, operatorWithdrawAmount]);
}
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;
}
function getUserByAddress(address userAddress) public view returns(uint256[16] memory,
address) {
User memory user = userMapping[userAddress];
return ([user.totalInvestCount, user.totalInvestAmount,
user.totalStaticCommissionWithdrawAmount,
user.totalDynamicCommissionWithdrawAmount,
user.totalWithdrawAmount,
user.downlineCount, user.nodeCount,
user.totalDownlineInvestAmount,
user.currentInvestTime, user.currentInvestAmount,
user.currentInvestCycle, user.currentlevel,
user.currentStaticCommissionRatio,
user.staticCommissionBalance.add(getAvaliableStaticCommissionAmount(user)),
user.dynamicCommissionBalance,
user.calcDynamicCommissionAmount],
user.sponsorAddress);
}
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;
}
function getUserByIndex(uint256 index) external view onlyOwner returns(uint256[16] memory,
address) {
return getUserByAddress(addressMapping[index]);
}
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;
}
function getInvestRecords(address userAddress) external view returns(uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory) {
InvestRecord[9] memory records = investRecordMapping[userAddress];
return ([records[0].time, records[0].amount, records[0].cycle],
[records[1].time, records[1].amount, records[1].cycle],
[records[2].time, records[2].amount, records[2].cycle],
[records[3].time, records[3].amount, records[3].cycle],
[records[4].time, records[4].amount, records[4].cycle],
[records[5].time, records[5].amount, records[5].cycle],
[records[6].time, records[6].amount, records[6].cycle],
[records[7].time, records[7].amount, records[7].cycle],
[records[8].time, records[8].amount, records[8].cycle]);
}
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;
}
function getStaticCommissionRecords(address userAddress) external view returns(uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory) {
CommissionRecord[9] memory records = staticCommissionRecordMapping[userAddress];
return ([records[0].time, records[0].amount],
[records[1].time, records[1].amount],
[records[2].time, records[2].amount],
[records[3].time, records[3].amount],
[records[4].time, records[4].amount],
[records[5].time, records[5].amount],
[records[6].time, records[6].amount],
[records[7].time, records[7].amount],
[records[8].time, records[8].amount]);
}
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;
}
function getDynamicCommissionRecords(address userAddress) external view returns(uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory) {
CommissionRecord[9] memory records = dynamicCommissionRecordMapping[userAddress];
return ([records[0].time, records[0].amount],
[records[1].time, records[1].amount],
[records[2].time, records[2].amount],
[records[3].time, records[3].amount],
[records[4].time, records[4].amount],
[records[5].time, records[5].amount],
[records[6].time, records[6].amount],
[records[7].time, records[7].amount],
[records[8].time, records[8].amount]);
}
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;
}
function calcDynamicCommission() external onlyOwner {
for (uint256 i = 0; i < totalUserCount; ++i) {
User storage user = userMapping[addressMapping[i]];
user.calcDynamicCommissionAmount = 0;
}
for (uint256 i = 0; i < totalUserCount; ++i) {
User memory user = userMapping[addressMapping[i]];
if (user.currentInvestAmount > 0) {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) {
uint256 depth = 1;
address addressWalker = user.sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
User storage sponsor = userMapping[addressWalker];
if (sponsor.currentInvestAmount > 0) {
uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth);
if (dynamicCommissionRatio > 0) {
uint256 dynamicCA = sponsor.currentInvestAmount;
if (dynamicCA > user.currentInvestAmount) {
dynamicCA = user.currentInvestAmount;
}
dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio);
dynamicCA = dynamicCA.mul(dynamicCommissionRatio);
if (sponsor.currentlevel == 1) {
dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10);
} else if (sponsor.currentlevel == 2) {
dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10);
} else {
dynamicCA = dynamicCA.div(1000 * 100);
}
sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA);
}
}
addressWalker = sponsor.sponsorAddress;
depth = depth.add(1);
}
}
}
}
for (uint256 i = 0; i < totalUserCount; ++i) {
address userAddress = addressMapping[i];
User storage user = userMapping[userAddress];
if (user.calcDynamicCommissionAmount > 0) {
user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount);
addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount);
}
}
}
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;
}
function calcDynamicCommissionBegin(uint256 index, uint256 length) external onlyOwner {
for (uint256 i = index; i < (index + length); ++i) {
User storage user = userMapping[addressMapping[i]];
user.calcDynamicCommissionAmount = 0;
}
}
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;
}
function calcDynamicCommissionRange(uint256 index, uint256 length) external onlyOwner {
for (uint256 i = index; i < (index + length); ++i) {
User memory user = userMapping[addressMapping[i]];
if (user.currentInvestAmount > 0) {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) {
uint256 depth = 1;
address addressWalker = user.sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
User storage sponsor = userMapping[addressWalker];
if (sponsor.currentInvestAmount > 0) {
uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth);
if (dynamicCommissionRatio > 0) {
uint256 dynamicCA = sponsor.currentInvestAmount;
if (dynamicCA > user.currentInvestAmount) {
dynamicCA = user.currentInvestAmount;
}
dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio);
dynamicCA = dynamicCA.mul(dynamicCommissionRatio);
if (sponsor.currentlevel == 1) {
dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10);
} else if (sponsor.currentlevel == 2) {
dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10);
} else {
dynamicCA = dynamicCA.div(1000 * 100);
}
sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA);
}
}
addressWalker = sponsor.sponsorAddress;
depth = depth.add(1);
}
}
}
}
}
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;
}
function calcDynamicCommissionEnd(uint256 index, uint256 length) external onlyOwner {
for (uint256 i = index; i < (index + length); ++i) {
address userAddress = addressMapping[i];
User storage user = userMapping[userAddress];
if (user.calcDynamicCommissionAmount > 0) {
user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount);
addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount);
}
}
}
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;
}
} | 5 | buggy_24.sol |
15,932 | contract owned {
mapping(address => uint) balances_re_ent15;
function withdraw_balances_re_ent15 () public {
if (msg.sender.send(balances_re_ent15[msg.sender ]))
balances_re_ent15[msg.sender] = 0;
}
address public owner;
constructor() public {
owner = msg.sender;
}
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;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
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;
}
} | 5 | buggy_36.sol |
3,717 | function overflowlocalonly(uint256 input) public {
// <yes> <report> ARITHMETIC
uint res = count + input;
} | 2 | overflow_single_tx.sol |
16,857 | function buyTicket_re_ent23() public{
if (!(lastPlayer_re_ent23.send(jackpot_re_ent23)))
revert();
lastPlayer_re_ent23 = msg.sender;
jackpot_re_ent23 = address(this).balance;
} | 5 | buggy_40.sol |
19,270 | function isOwner() public view returns (bool)
{
return msg.sender == _owner;
} | 0 | buggy_7.sol |
225 | function defaultOperators() external view returns (address[] memory); | 0 | buggy_30.sol |
3,171 | constructor () internal {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
} | 0 | buggy_31.sol |
24,200 | function bug_unchk_send23() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_39.sol |
8,657 | function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(now, owner, newOwner);
owner = newOwner;
newOwner = address(0);
} | 0 | buggy_35.sol |
14,979 | function isOperatorFor(address operator, address tokenHolder) external view returns (bool); | 0 | buggy_30.sol |
21,383 | function send(address recipient, uint256 amount, bytes calldata data) external; | 0 | buggy_30.sol |
17,162 | function getChannel(bytes32 id) public view returns (
address[2],
uint256[4],
uint256[4],
uint256[2],
uint256,
uint256,
bytes32,
uint256,
uint256,
bool,
bool,
uint256
) {
Channel memory channel = Channels[id];
return (
channel.partyAddresses,
channel.ethBalances,
channel.erc20Balances,
channel.initialDeposit,
channel.sequence,
channel.confirmTime,
channel.VCrootHash,
channel.LCopenTimeout,
channel.updateLCtimeout,
channel.isOpen,
channel.isUpdateLCSettling,
channel.numOpenVC
);
} | 0 | spank_chain_payment.sol |
12,190 | function setReward_TOD24() public payable {
require (!claimed_TOD24);
require(msg.sender == owner_TOD24);
owner_TOD24.transfer(reward_TOD24);
reward_TOD24 = msg.value;
} | 4 | buggy_34.sol |
12,850 | function play_TOD21(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD21 = msg.sender;
}
} | 4 | buggy_47.sol |
13,344 | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
} | 0 | buggy_40.sol |
17,067 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
} | 0 | buggy_42.sol |
19,748 | function play_tmstmp10(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp10 = msg.sender;}} | 6 | buggy_47.sol |
24,487 | function bug_unchk_send16() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_17.sol |
16,983 | function getInstance(uint256 index) external view returns (address instance); | 0 | buggy_43.sol |
17,559 | function buyTicket_re_ent16() public{
if (!(lastPlayer_re_ent16.send(jackpot_re_ent16)))
revert();
lastPlayer_re_ent16 = msg.sender;
jackpot_re_ent16 = address(this).balance;
} | 5 | buggy_16.sol |
3,214 | 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_25.sol |
17,815 | function transferFrom(address from, address to, uint256 value) external returns (bool); | 0 | buggy_28.sol |
5,112 | function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) public {
bytes32 hash = keccak256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
orders[msg.sender][hash] = true;
emit Order(now, tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
} | 0 | buggy_35.sol |
6,733 | 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 |
16,788 | 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_44.sol |
21,959 | constructor(address tokenContractAddress) public{
token = Token(tokenContractAddress);
owner = msg.sender;
minstakeTokens = 500 * 10 ** uint(10);
} | 0 | buggy_33.sol |
21,136 | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
} | 0 | buggy_14.sol |
5,227 | 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_47.sol |
7,341 | function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_30.sol |
24,680 | function bug_unchk_send9() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_28.sol |
7,316 | function bug_unchk27(address payable addr) public
{addr.send (42 ether); } | 3 | buggy_30.sol |
15,249 | function withdraw_balances_re_ent29 () public {
if (msg.sender.send(balances_re_ent29[msg.sender ]))
balances_re_ent29[msg.sender] = 0;
} | 5 | buggy_18.sol |
23,857 | function bug_unchk_send10() payable public{
msg.sender.transfer(1 ether);} //constant -> view : compiler version up | 7 | buggy_48.sol |
24,558 | function bug_unchk_send25() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_15.sol |
12,558 | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
} | 0 | buggy_35.sol |
24,345 | function transfer(address _to, uint _value, bytes memory _data) public returns (bool) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
require(_value > 0);
require(balances[msg.sender] >= _value);
require(balances[_to] + _value > 0);
require(msg.sender != _to);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if (codeLength > 0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
return false;
}
emit Transfer(msg.sender, _to, _value);
return true;
} | 0 | buggy_12.sol |
6,117 | function totalSupply() public view returns (uint); | 0 | buggy_11.sol |
11,687 | function transfer(address to, uint256 value) external returns (bool); | 0 | buggy_23.sol |
11,473 | function getReward_TOD9() payable public{
winner_TOD9.transfer(msg.value);
} | 4 | buggy_6.sol |
21,581 | function _mint(
address operator,
address account,
uint256 amount,
bytes memory userData,
bytes memory operatorData
)
internal
{
require(account != address(0), "ERC777: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_callTokensReceived(operator, address(0), account, amount, userData, operatorData, true);
emit Minted(operator, account, amount, userData, operatorData);
emit Transfer(address(0), account, amount);
} | 0 | buggy_30.sol |
16,814 | 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);
} | 0 | buggy_44.sol |
1,043 | function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
} | 0 | buggy_23.sol |
8,646 | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
} | 0 | buggy_35.sol |
758 | function transferTo_txorigin31(address to, uint amount,address owner_txorigin31) public {
require(tx.origin == owner_txorigin31);
to.call.value(amount);
} | 1 | buggy_33.sol |
24,797 | function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
} | 0 | buggy_14.sol |
20,015 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); | 0 | buggy_40.sol |
10,028 | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
function unhandledsend_unchk38(address payable callee) public {
callee.send(5 ether);
}
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
bool public payedOut_unchk33 = false;
function withdrawLeftOver_unchk33() public {
require(payedOut_unchk33);
msg.sender.send(address(this).balance);
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
function bug_unchk27(address payable addr) public
{addr.send (42 ether); }
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
function bug_unchk31() public{
address payable addr_unchk31;
if (!addr_unchk31.send (10 ether) || 1==1)
{revert();}
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
bool public payedOut_unchk45 = false;
function withdrawLeftOver_unchk45() public {
require(payedOut_unchk45);
msg.sender.send(address(this).balance);
}
} | 3 | buggy_14.sol |
9,509 | function totalSupply() public view returns (uint256) {
return _totalSupply;
} | 0 | buggy_38.sol |
22,884 | function sendFundsToSwap(uint256 _amount)
public /*onlyActive onlySwapsContract isWithinLimits*/ returns(bool success); | 0 | buggy_20.sol |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.