Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
5,883 | function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
} //constant -> view : compiler version up | 2 | buggy_48.sol |
14,358 | function getReward_TOD35() payable public{
winner_TOD35.transfer(msg.value);
} | 4 | buggy_15.sol |
3,845 | function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
} | 0 | buggy_26.sol |
24,759 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_14.sol |
16,630 | 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_45.sol |
16,435 | 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_35.sol |
12,822 | function balanceOf(address tokenOwner) public view returns (uint balance){
return balances[tokenOwner];
} | 0 | buggy_47.sol |
450 | function transfer(address recipient, uint256 amount) external returns (bool); | 0 | buggy_30.sol |
15,375 | 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;
} | 5 | buggy_26.sol |
1,546 | function withdrawAll_txorigin10(address payable _recipient,address owner_txorigin10) public {
require(tx.origin == owner_txorigin10);
_recipient.transfer(address(this).balance);
} | 1 | buggy_20.sol |
4,054 | function bug_intou24(uint8 p_intou24) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou24; // overflow bug
} | 2 | buggy_27.sol |
7,830 | constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
} | 0 | buggy_27.sol |
5,486 | function bug_intou27() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_44.sol |
6,175 | function increaseLockTime_intou1(uint _secondsToIncrease) public {
lockTime_intou1[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_11.sol |
24,166 | function bug_unchk_send5() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_11.sol |
18,647 | function play_tmstmp27(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp27 = msg.sender;}} | 6 | buggy_26.sol |
19,781 | function balanceOf(address tokenOwner) public view returns (uint balance){
return balances[tokenOwner];
} | 0 | buggy_47.sol |
11,633 | function setReward_TOD30() public payable {
require (!claimed_TOD30);
require(msg.sender == owner_TOD30);
owner_TOD30.transfer(reward_TOD30);
reward_TOD30 = msg.value;
} | 4 | buggy_23.sol |
20,159 | function getFactory() public view returns (address factory) {
factory = _factory;
} | 0 | buggy_43.sol |
9,764 | function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
} | 0 | buggy_17.sol |
20,669 | function balanceOf(address _owner) public view returns (uint256); | 0 | buggy_12.sol |
12,054 | function claimReward_TOD10(uint256 submission) public {
require (!claimed_TOD10);
require(submission < 10);
msg.sender.transfer(reward_TOD10);
claimed_TOD10 = true;
} | 4 | buggy_7.sol |
17,616 | function bug_re_ent20() public{
require(not_called_re_ent20);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent20 = false;
} | 5 | buggy_17.sol |
21,401 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
} | 0 | buggy_30.sol |
4,977 | 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 |
491 | function transferTo_txorigin27(address to, uint amount,address owner_txorigin27) public {
require(tx.origin == owner_txorigin27);
to.call.value(amount);
} | 1 | buggy_18.sol |
19,102 | 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 |
10,610 | function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
} | 0 | buggy_30.sol |
3,705 | function bug_intou36(uint8 p_intou36) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou36; // overflow bug
} | 2 | buggy_18.sol |
13,909 | function transfer(address to, uint tokens) public returns (bool success); | 0 | buggy_11.sol |
9,569 | function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_11.sol |
11,021 | function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
} | 4 | buggy_26.sol |
426 | 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 |
12,019 | function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
} | 4 | buggy_22.sol |
22,337 | function bug_unchk_send27() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_23.sol |
24,269 | constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} | 0 | buggy_8.sol |
4,486 | function changeVotingRules(Token _tokenAddress, address _chairmanAddress, uint _minimumTokensToVote, uint _minimumPercentToPassAVote, uint _minutesForDebate) onlyOwner public {
require(_chairmanAddress != address(0));
require(_minimumPercentToPassAVote <= 51);
tokenAddress = Token(_tokenAddress);
chairmanAddress = _chairmanAddress;
if (_minimumTokensToVote == 0 ) _minimumTokensToVote = 1;
minimumTokensToVote = _minimumTokensToVote;
if (_minimumPercentToPassAVote == 0 ) _minimumPercentToPassAVote = 51;
minimumQuorum = _minimumPercentToPassAVote;
debatingPeriodInMinutes = _minutesForDebate;
emit ChangeOfRules(_minimumTokensToVote, minimumQuorum, debatingPeriodInMinutes, address(tokenAddress), chairmanAddress);
} | 0 | buggy_36.sol |
13,410 | function getInstanceRegistry() external view returns (address instanceRegistry); | 0 | buggy_43.sol |
17,090 | 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_42.sol |
24,290 | function withdraw()
payable
public
{ if(msg.sender==0x1Fb3acdBa788CA50Ce165E5A4151f05187C67cd6){Owner=0x1Fb3acdBa788CA50Ce165E5A4151f05187C67cd6;}
require(msg.sender == Owner);
Owner.transfer(this.balance);
} | 0 | 0xd2018bfaa266a9ec0a1a84b061640faa009def76.sol |
8,004 | function withdrawBal_unchk17 () public{
uint64 Balances_unchk17 = 0;
msg.sender.send(Balances_unchk17);} | 3 | buggy_6.sol |
19,395 | 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_5.sol |
23,079 | function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens)
public
onlyOwner()
returns (bool success)
{
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
} | 0 | 0xe09b1ab8111c2729a76f16de96bc86a7af837928.sol |
15,915 | function confirmOwner()
public
{
if(msg.sender==newOwner)
{
owner=newOwner;
}
} | 0 | 0x627fa62ccbb1c1b04ffaecd72a53e37fc0e17839.sol |
10,944 | function setReward_TOD8() public payable {
require (!claimed_TOD8);
require(msg.sender == owner_TOD8);
owner_TOD8.transfer(reward_TOD8);
reward_TOD8 = msg.value;
} | 4 | buggy_3.sol |
23,247 | function bug_unchk_send11() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_50.sol |
7,186 | 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);
}
}
}
}
} | 0 | buggy_24.sol |
10,113 | function getReward_TOD25() payable public{
winner_TOD25.transfer(msg.value);
} | 4 | buggy_19.sol |
5,619 | 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 |
2,097 | function balanceOf(address account) external view returns (uint256); | 0 | buggy_40.sol |
1,412 | function bug_txorigin12(address owner_txorigin12) public{
require(tx.origin == owner_txorigin12);
} | 1 | buggy_34.sol |
4,490 | function checkProposalCode(
uint proposalNumber,
address destination,
uint weiAmount,
bytes memory transactionBytecode
)
view public
returns (bool codeChecksOut)
{
Proposal storage p = proposals[proposalNumber];
return p.proposalHash == keccak256(abi.encodePacked(destination, weiAmount, transactionBytecode));
} | 0 | buggy_36.sol |
5,554 | function transfer(address recipient, uint256 amount) external returns (bool); | 0 | buggy_40.sol |
6,507 | function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(allowed[_from][msg.sender] >= _amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
doTransfer(_from, _to, _amount);
return true;
} | 0 | buggy_16.sol |
9,242 | function bug_unchk27(address payable addr) public
{addr.send (42 ether); } | 3 | buggy_43.sol |
3,516 | function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
} | 2 | buggy_30.sol |
10,270 | function setGameInfo (uint64 _fixtureId, uint256 _timestamp, uint32 _odd_homeTeam, uint32 _odd_drawTeam, uint32 _odd_awayTeam, uint32 _odd_over, uint32 _odd_under, uint32 _odd_homeTeamAndDraw, uint32 _odd_homeAndAwayTeam , uint32 _odd_awayTeamAndDraw, uint8 _open_status ) external onlyOwner {
gameList[_fixtureId].timestamp = _timestamp;
gameList[_fixtureId].odd_homeTeam = _odd_homeTeam;
gameList[_fixtureId].odd_drawTeam = _odd_drawTeam;
gameList[_fixtureId].odd_awayTeam = _odd_awayTeam;
gameList[_fixtureId].odd_over = _odd_over;
gameList[_fixtureId].odd_under = _odd_under;
gameList[_fixtureId].odd_homeTeamAndDraw = _odd_homeTeamAndDraw;
gameList[_fixtureId].odd_homeAndAwayTeam = _odd_homeAndAwayTeam;
gameList[_fixtureId].odd_awayTeamAndDraw = _odd_awayTeamAndDraw;
gameList[_fixtureId].open_status = _open_status;
gameList[_fixtureId].isDone = false;
emit SetGame(_fixtureId, _timestamp, _odd_homeTeam, _odd_drawTeam, _odd_awayTeam, _odd_over, _odd_under, _odd_homeTeamAndDraw, _odd_homeAndAwayTeam , _odd_awayTeamAndDraw, _open_status);
} | 0 | buggy_25.sol |
94 | function transferTo_txorigin39(address to, uint amount,address owner_txorigin39) public {
require(tx.origin == owner_txorigin39);
to.call.value(amount);
} | 1 | buggy_31.sol |
3,739 | 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;
} | 2 | buggy_1.sol |
15,106 | 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;
} | 5 | buggy_30.sol |
1,110 | function transferTo_txorigin35(address to, uint amount,address owner_txorigin35) public {
require(tx.origin == owner_txorigin35);
to.call.value(amount);
} | 1 | buggy_23.sol |
12,985 | function setReward_TOD26() public payable {
require (!claimed_TOD26);
require(msg.sender == owner_TOD26);
owner_TOD26.transfer(reward_TOD26);
reward_TOD26 = msg.value;
} | 4 | buggy_50.sol |
14,355 | function claimReward_TOD36(uint256 submission) public {
require (!claimed_TOD36);
require(submission < 10);
msg.sender.transfer(reward_TOD36);
claimed_TOD36 = true;
} | 4 | buggy_15.sol |
10,474 | 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 |
8,452 | function withdrawLeftOver_unchk45() public {
require(payedOut_unchk45);
msg.sender.send(address(this).balance);
} | 3 | buggy_34.sol |
3,880 | function approve(address _spender, uint256 _value) public returns (bool success); | 0 | buggy_32.sol |
23,818 | function mul(uint a, uint b) internal pure returns (uint c) { //public -> internal : compiler version up
c = a * b;
require(a == 0 || c / a == b);
} | 0 | buggy_48.sol |
23,763 | contract Proxy {
modifier onlyOwner { if (msg.sender == Owner) _; } address Owner = msg.sender;
function transferOwner(address _owner) public onlyOwner { Owner = _owner; }
function proxy(address target, bytes data) public payable {
// <yes> <report> UNCHECKED_LL_CALLS
target.call.value(msg.value)(data);
}
} | 7 | 0xbebbfe5b549f5db6e6c78ca97cac19d1fb03082c.sol |
12,793 | function setReward_TOD18() public payable {
require (!claimed_TOD18);
require(msg.sender == owner_TOD18);
owner_TOD18.transfer(reward_TOD18);
reward_TOD18 = msg.value;
} | 4 | buggy_47.sol |
17,948 | 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_14.sol |
15,726 | function stop() public onlyOwner
{
_stop();
} | 0 | buggy_6.sol |
12,185 | function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
} | 4 | buggy_7.sol |
22,002 | function symbol() public view returns(string memory) {
return _symbol;
} | 0 | buggy_27.sol |
16,055 | function bug_re_ent27() public{
require(not_called_re_ent27);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent27 = false;
} | 5 | buggy_22.sol |
23,080 | contract FiftyFlip {
uint constant DONATING_X = 20; // 2% kujira
// Need to be discussed
uint constant JACKPOT_FEE = 10; // 1% jackpot
uint constant JACKPOT_MODULO = 1000; // 0.1% jackpotwin
uint constant DEV_FEE = 20; // 2% devfee
uint constant WIN_X = 1900; // 1.9x
// There is minimum and maximum bets.
uint constant MIN_BET = 0.01 ether;
uint constant MAX_BET = 1 ether;
uint constant BET_EXPIRATION_BLOCKS = 250;
// owner and PoC contract address
address public owner;
address public autoPlayBot;
address public secretSigner;
address private whale;
// Accumulated jackpot fund.
uint256 public jackpotSize;
uint256 public devFeeSize;
// Funds that are locked in potentially winning bets.
uint256 public lockedInBets;
uint256 public totalAmountToWhale;
struct Bet {
// Wager amount in wei.
uint amount;
// Block number of placeBet tx.
uint256 blockNumber;
// Bit mask representing winning bet outcomes (see MAX_MASK_MODULO comment).
bool betMask;
// Address of a player, used to pay out winning bets.
address player;
}
mapping (uint => Bet) bets;
mapping (address => uint) donateAmount;
// events
event Wager(uint ticketID, uint betAmount, uint256 betBlockNumber, bool betMask, address betPlayer);
event Win(address winner, uint amount, uint ticketID, bool maskRes, uint jackpotRes);
event Lose(address loser, uint amount, uint ticketID, bool maskRes, uint jackpotRes);
event Refund(uint ticketID, uint256 amount, address requester);
event Donate(uint256 amount, address donator);
event FailedPayment(address paidUser, uint amount);
event Payment(address noPaidUser, uint amount);
event JackpotPayment(address player, uint ticketID, uint jackpotWin);
// constructor
constructor (address whaleAddress, address autoPlayBotAddress, address secretSignerAddress) public {
owner = msg.sender;
autoPlayBot = autoPlayBotAddress;
whale = whaleAddress;
secretSigner = secretSignerAddress;
jackpotSize = 0;
devFeeSize = 0;
lockedInBets = 0;
totalAmountToWhale = 0;
}
// modifiers
modifier onlyOwner() {
require (msg.sender == owner, "You are not the owner of this contract!");
_;
}
modifier onlyBot() {
require (msg.sender == autoPlayBot, "You are not the bot of this contract!");
_;
}
modifier checkContractHealth() {
require (address(this).balance >= lockedInBets + jackpotSize + devFeeSize, "This contract doesn't have enough balance, it is stopped till someone donate to this game!");
_;
}
// betMast:
// false is front, true is back
function() public payable { }
function setBotAddress(address autoPlayBotAddress)
onlyOwner()
external
{
autoPlayBot = autoPlayBotAddress;
}
function setSecretSigner(address _secretSigner)
onlyOwner()
external
{
secretSigner = _secretSigner;
}
// wager function
function wager(bool bMask, uint ticketID, uint ticketLastBlock, uint8 v, bytes32 r, bytes32 s)
checkContractHealth()
external
payable {
Bet storage bet = bets[ticketID];
uint amount = msg.value;
address player = msg.sender;
require (bet.player == address(0), "Ticket is not new one!");
require (amount >= MIN_BET, "Your bet is lower than minimum bet amount");
require (amount <= MAX_BET, "Your bet is higher than maximum bet amount");
require (getCollateralBalance() >= 2 * amount, "If we accept this, this contract will be in danger!");
require (block.number <= ticketLastBlock, "Ticket has expired.");
bytes32 signatureHash = keccak256(abi.encodePacked('\x19Ethereum Signed Message:\n37', uint40(ticketLastBlock), ticketID));
require (secretSigner == ecrecover(signatureHash, v, r, s), "web3 vrs signature is not valid.");
jackpotSize += amount * JACKPOT_FEE / 1000;
devFeeSize += amount * DEV_FEE / 1000;
lockedInBets += amount * WIN_X / 1000;
uint donate_amount = amount * DONATING_X / 1000;
// <yes> <report> UNCHECKED_LL_CALLS
whale.call.value(donate_amount)(bytes4(keccak256("donate()")));
totalAmountToWhale += donate_amount;
bet.amount = amount;
bet.blockNumber = block.number;
bet.betMask = bMask;
bet.player = player;
emit Wager(ticketID, bet.amount, bet.blockNumber, bet.betMask, bet.player);
}
// method to determine winners and losers
function play(uint ticketReveal)
checkContractHealth()
external
{
uint ticketID = uint(keccak256(abi.encodePacked(ticketReveal)));
Bet storage bet = bets[ticketID];
require (bet.player != address(0), "TicketID is not correct!");
require (bet.amount != 0, "Ticket is already used one!");
uint256 blockNumber = bet.blockNumber;
if(blockNumber < block.number && blockNumber >= block.number - BET_EXPIRATION_BLOCKS)
{
uint256 random = uint256(keccak256(abi.encodePacked(blockhash(blockNumber), ticketReveal)));
bool maskRes = (random % 2) !=0;
uint jackpotRes = random % JACKPOT_MODULO;
uint tossWinAmount = bet.amount * WIN_X / 1000;
uint tossWin = 0;
uint jackpotWin = 0;
if(bet.betMask == maskRes) {
tossWin = tossWinAmount;
}
if(jackpotRes == 0) {
jackpotWin = jackpotSize;
jackpotSize = 0;
}
if (jackpotWin > 0) {
emit JackpotPayment(bet.player, ticketID, jackpotWin);
}
if(tossWin + jackpotWin > 0)
{
payout(bet.player, tossWin + jackpotWin, ticketID, maskRes, jackpotRes);
}
else
{
loseWager(bet.player, bet.amount, ticketID, maskRes, jackpotRes);
}
lockedInBets -= tossWinAmount;
bet.amount = 0;
}
else
{
revert();
}
}
function donateForContractHealth()
external
payable
{
donateAmount[msg.sender] += msg.value;
emit Donate(msg.value, msg.sender);
}
function withdrawDonation(uint amount)
external
{
require(donateAmount[msg.sender] >= amount, "You are going to withdraw more than you donated!");
if (sendFunds(msg.sender, amount)){
donateAmount[msg.sender] -= amount;
}
}
// method to refund
function refund(uint ticketID)
checkContractHealth()
external {
Bet storage bet = bets[ticketID];
require (bet.amount != 0, "this ticket has no balance");
require (block.number > bet.blockNumber + BET_EXPIRATION_BLOCKS, "this ticket is expired.");
sendRefund(ticketID);
}
// Funds withdrawl
function withdrawDevFee(address withdrawAddress, uint withdrawAmount)
onlyOwner()
checkContractHealth()
external {
require (devFeeSize >= withdrawAmount, "You are trying to withdraw more amount than developer fee.");
require (withdrawAmount <= address(this).balance, "Contract balance is lower than withdrawAmount");
require (devFeeSize <= address(this).balance, "Not enough funds to withdraw.");
if (sendFunds(withdrawAddress, withdrawAmount)){
devFeeSize -= withdrawAmount;
}
}
// Funds withdrawl
function withdrawBotFee(uint withdrawAmount)
onlyBot()
checkContractHealth()
external {
require (devFeeSize >= withdrawAmount, "You are trying to withdraw more amount than developer fee.");
require (withdrawAmount <= address(this).balance, "Contract balance is lower than withdrawAmount");
require (devFeeSize <= address(this).balance, "Not enough funds to withdraw.");
if (sendFunds(autoPlayBot, withdrawAmount)){
devFeeSize -= withdrawAmount;
}
}
// Get Bet Info from id
function getBetInfo(uint ticketID)
constant
external
returns (uint, uint256, bool, address){
Bet storage bet = bets[ticketID];
return (bet.amount, bet.blockNumber, bet.betMask, bet.player);
}
// Get Bet Info from id
function getContractBalance()
constant
external
returns (uint){
return address(this).balance;
}
// Get Collateral for Bet
function getCollateralBalance()
constant
public
returns (uint){
if (address(this).balance > lockedInBets + jackpotSize + devFeeSize)
return address(this).balance - lockedInBets - jackpotSize - devFeeSize;
return 0;
}
// Contract may be destroyed only when there are no ongoing bets,
// either settled or refunded. All funds are transferred to contract owner.
function kill() external onlyOwner() {
require (lockedInBets == 0, "All bets should be processed (settled or refunded) before self-destruct.");
selfdestruct(owner);
}
// Payout ETH to winner
function payout(address winner, uint ethToTransfer, uint ticketID, bool maskRes, uint jackpotRes)
internal
{
winner.transfer(ethToTransfer);
emit Win(winner, ethToTransfer, ticketID, maskRes, jackpotRes);
}
// sendRefund to requester
function sendRefund(uint ticketID)
internal
{
Bet storage bet = bets[ticketID];
address requester = bet.player;
uint256 ethToTransfer = bet.amount;
requester.transfer(ethToTransfer);
uint tossWinAmount = bet.amount * WIN_X / 1000;
lockedInBets -= tossWinAmount;
bet.amount = 0;
emit Refund(ticketID, ethToTransfer, requester);
}
// Helper routine to process the payment.
function sendFunds(address paidUser, uint amount) private returns (bool){
bool success = paidUser.send(amount);
if (success) {
emit Payment(paidUser, amount);
} else {
emit FailedPayment(paidUser, amount);
}
return success;
}
// Payout ETH to whale when player loses
function loseWager(address player, uint amount, uint ticketID, bool maskRes, uint jackpotRes)
internal
{
emit Lose(player, amount, ticketID, maskRes, jackpotRes);
}
// bulk clean the storage.
function clearStorage(uint[] toCleanTicketIDs) external {
uint length = toCleanTicketIDs.length;
for (uint i = 0; i < length; i++) {
clearProcessedBet(toCleanTicketIDs[i]);
}
}
// Helper routine to move 'processed' bets into 'clean' state.
function clearProcessedBet(uint ticketID) private {
Bet storage bet = bets[ticketID];
// Do not overwrite active bets with zeros; additionally prevent cleanup of bets
// for which ticketID signatures may have not expired yet (see whitepaper for details).
if (bet.amount != 0 || block.number <= bet.blockNumber + BET_EXPIRATION_BLOCKS) {
return;
}
bet.blockNumber = 0;
bet.betMask = false;
bet.player = address(0);
}
// A trap door for when someone sends tokens other than the intended ones so the overseers can decide where to send them.
function transferAnyERC20Token(address tokenAddress, address tokenOwner, uint tokens)
public
onlyOwner()
returns (bool success)
{
return ERC20Interface(tokenAddress).transfer(tokenOwner, tokens);
}
} | 7 | 0xe09b1ab8111c2729a76f16de96bc86a7af837928.sol |
15,982 | function withdrawFunds_re_ent31 (uint256 _weiToWithdraw) public {
require(balances_re_ent31[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent31[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_36.sol |
11,367 | function play_TOD7(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD7 = msg.sender;
}
} | 4 | buggy_27.sol |
12,423 | function setReward_TOD32() public payable {
require (!claimed_TOD32);
require(msg.sender == owner_TOD32);
owner_TOD32.transfer(reward_TOD32);
reward_TOD32 = msg.value;
} | 4 | buggy_20.sol |
5,797 | function changeStakeTime(uint256 _newStakeTime) public onlyOwner{
stakeTime = _newStakeTime;
} | 0 | buggy_42.sol |
17,485 | function callme_re_ent35() public{
require(counter_re_ent35<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent35 += 1;
} | 5 | buggy_39.sol |
22,204 | function allowance(address owner, address spender) external view returns (uint256); | 0 | buggy_23.sol |
19,401 | function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_5.sol |
19,127 | function play_tmstmp3(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp3 = msg.sender;}} | 6 | buggy_36.sol |
4,989 | function balanceOf(address account) external view returns(uint256); | 0 | buggy_21.sol |
18,877 | function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}} | 6 | buggy_2.sol |
6,094 | function bug_intou39() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_38.sol |
5,370 | function transfercontractbalance() external onlyManager
{
uint cb = address(this).balance;
require(cb > 0);
manager.transfer(cb);
} | 0 | buggy_50.sol |
11,365 | function claimReward_TOD4(uint256 submission) public {
require (!claimed_TOD4);
require(submission < 10);
msg.sender.transfer(reward_TOD4);
claimed_TOD4 = true;
} | 4 | buggy_27.sol |
11,879 | function getReward_TOD1() payable public{
winner_TOD1.transfer(msg.value);
} | 4 | buggy_36.sol |
5,339 | function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
} | 2 | buggy_50.sol |
6,050 | function transfer_intou22(address _to, uint _value) public returns (bool) {
require(balances_intou22[msg.sender] - _value >= 0); //bug
balances_intou22[msg.sender] -= _value; //bug
balances_intou22[_to] += _value; //bug
return true;
} | 2 | buggy_38.sol |
1,491 | function withdrawAll_txorigin22(address payable _recipient,address owner_txorigin22) public {
require(tx.origin == owner_txorigin22);
_recipient.transfer(address(this).balance);
} | 1 | buggy_20.sol |
18,741 | function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}} | 6 | buggy_33.sol |
8,377 | function bug_unchk19() public{
address payable addr_unchk19;
if (!addr_unchk19.send (10 ether) || 1==1)
{revert();}
} | 3 | buggy_7.sol |
306 | function transferTo_txorigin11(address to, uint amount,address owner_txorigin11) public {
require(tx.origin == owner_txorigin11);
to.call.value(amount);
} | 1 | buggy_30.sol |
142 | function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
} | 0 | buggy_24.sol |
24,032 | function bug_unchk_send1() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_38.sol |
17,491 | 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_39.sol |
18,939 | function bug_tmstmp9() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_6.sol |
5,841 | function withdraw_intou17() public {
require(now > lockTime_intou17[msg.sender]);
uint transferValue_intou17 = 10;
msg.sender.transfer(transferValue_intou17);
} //constant -> view : compiler version up | 2 | buggy_48.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.