Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
7,106 | contract WhiteBetting {
function unhandledsend_unchk26(address payable callee) public {
callee.send(5 ether);
}
address payable public owner;
// Game information
struct GameInfo {
// game start time
uint256 timestamp;
// game odds
uint32 odd_homeTeam;
uint32 odd_drawTeam;
uint32 odd_awayTeam;
uint32 odd_over;
uint32 odd_under;
uint32 odd_homeTeamAndDraw;
uint32 odd_homeAndAwayTeam;
uint32 odd_awayTeamAndDraw;
// Checking the game status
uint8 open_status;
// Checking whether winning were paid
bool isDone;
}
bool public payedOut_unchk20 = false;
address payable public winner_unchk20;
uint public winAmount_unchk20;
function sendToWinner_unchk20() public {
require(!payedOut_unchk20);
winner_unchk20.send(winAmount_unchk20);
payedOut_unchk20 = true;
}
mapping(uint64 => GameInfo) public gameList;
// Player betting infomation
struct BetFixture {
address payable player;
uint256 stake;
uint32 odd;
// betting type
uint16 selectedTeam;
}
bool public payedOut_unchk32 = false;
address payable public winner_unchk32;
uint public winAmount_unchk32;
function sendToWinner_unchk32() public {
require(!payedOut_unchk32);
winner_unchk32.send(winAmount_unchk32);
payedOut_unchk32 = true;
}
mapping(uint64 => BetFixture[]) public betList;
// Events that are issued to make statistic recovery easier
bool public payedOut_unchk44 = false;
address payable public winner_unchk44;
uint public winAmount_unchk44;
function sendToWinner_unchk44() public {
require(!payedOut_unchk44);
winner_unchk44.send(winAmount_unchk44);
payedOut_unchk44 = true;
}
event Success(uint256 odd);
function UncheckedExternalCall_unchk40 () public
{ address payable addr_unchk40;
if (! addr_unchk40.send (2 ether))
{// comment1;
}
else
{//comment2;
}
}
event Deposit(address sender, uint256 eth);
bool public payedOut_unchk33 = false;
function withdrawLeftOver_unchk33() public {
require(payedOut_unchk33);
msg.sender.send(address(this).balance);
}
event Withdraw(address receiver, uint256 eth);
function bug_unchk27(address payable addr) public
{addr.send (42 ether); }
event NewStake(address player, uint64 fixtureId, uint16 selectedTeam, uint256 stake, uint256 odd );
function bug_unchk31() public{
address payable addr_unchk31;
if (!addr_unchk31.send (10 ether) || 1==1)
{revert();}
}
event SetGame(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);
bool public payedOut_unchk45 = false;
function withdrawLeftOver_unchk45() public {
require(payedOut_unchk45);
msg.sender.send(address(this).balance);
}
event ChangeOdd (uint64 _fixtureId, uint32 _odd_homeTeam, uint32 _odd_drawTeam, uint32 _odd_awayTeam, uint32 _odd_over, uint32 _odd_under, uint32 _odd_homeTeamAndDraw, uint32 _odd_homeAndAwayTeam , uint32 _odd_awayTeamAndDraw);
function callnotchecked_unchk13(address callee) public {
callee.call.value(1 ether);
}
event GivePrizeMoney(uint64 _fixtureId, uint8 _homeDrawAway, uint8 _overUnder);
// Constructor
constructor() public {
owner = msg.sender;
}
function unhandledsend_unchk38(address payable callee) public {
callee.send(5 ether);
}
// Change the game status
function setOpenStatus(uint64 _fixtureId, uint8 _open_status) external onlyOwner {
gameList[_fixtureId].open_status = _open_status;
}
function cash_unchk46(uint roundIndex, uint subpotIndex, address payable winner_unchk46) public{
uint64 subpot_unchk46 = 3 ether;
winner_unchk46.send(subpot_unchk46); //bug
subpot_unchk46= 0;
}
// Refresh the game odd
function changeOdd (uint64 _fixtureId, uint32 _odd_homeTeam, uint32 _odd_drawTeam, uint32 _odd_awayTeam, uint32 _odd_over, uint32 _odd_under, uint32 _odd_homeTeamAndDraw, uint32 _odd_homeAndAwayTeam , uint32 _odd_awayTeamAndDraw ) external onlyOwner {
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;
emit ChangeOdd (_fixtureId, _odd_homeTeam, _odd_drawTeam, _odd_awayTeam, _odd_over, _odd_under, _odd_homeTeamAndDraw, _odd_homeAndAwayTeam , _odd_awayTeamAndDraw);
}
function UncheckedExternalCall_unchk4 () public
{ address payable addr_unchk4;
if (! addr_unchk4.send (42 ether))
{// comment1;
}
else
{//comment2;
}
}
// Save the game information
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);
}
function bug_unchk7() public{
address payable addr_unchk7;
if (!addr_unchk7.send (10 ether) || 1==1)
{revert();}
}
// Player make a bet
function placeBet(uint64 _fixtureId, uint16 _selectedTeam, uint32 _odd) external payable {
uint stake = msg.value;
// Minium amount to bet is 0.001 ether
require(stake >= .001 ether);
// Check whether odds is valid
require(_odd != 0 );
// Compare to match mainnet odds with was submitted odds by betting type
if (_selectedTeam == 1 ) {
require(gameList[_fixtureId].odd_homeTeam == _odd);
} else if ( _selectedTeam == 2) {
require(gameList[_fixtureId].odd_drawTeam == _odd);
} else if ( _selectedTeam == 3) {
require(gameList[_fixtureId].odd_awayTeam == _odd);
} else if ( _selectedTeam == 4) {
require(gameList[_fixtureId].odd_over == _odd);
} else if ( _selectedTeam == 5) {
require(gameList[_fixtureId].odd_under == _odd);
} else if ( _selectedTeam == 6) {
require(gameList[_fixtureId].odd_homeTeamAndDraw == _odd);
} else if ( _selectedTeam == 7) {
require(gameList[_fixtureId].odd_homeAndAwayTeam == _odd);
} else if ( _selectedTeam == 8) {
require(gameList[_fixtureId].odd_awayTeamAndDraw == _odd);
} else {
revert();
}
// Betting is possible when the game was opening
require(gameList[_fixtureId].open_status == 3);
// Betting is possible only 10 min. ago
require( now < ( gameList[_fixtureId].timestamp - 10 minutes ) );
// Save the betting information
betList[_fixtureId].push(BetFixture( msg.sender, stake, _odd, _selectedTeam));
emit NewStake(msg.sender, _fixtureId, _selectedTeam, stake, _odd );
}
function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
}
// Give prize money by the game result
function givePrizeMoney(uint64 _fixtureId, uint8 _homeDrawAway, uint8 _overUnder) external onlyOwner payable {
// Check the game status whether is opening
require(gameList[_fixtureId].open_status == 3);
// Check if it has ever compensated
require(gameList[_fixtureId].isDone == false);
// Check if it has any player who betted
require(betList[_fixtureId][0].player != address(0) );
// Give the prize money!
for (uint i= 0 ; i < betList[_fixtureId].length; i++){
uint16 selectedTeam = betList[_fixtureId][i].selectedTeam;
uint256 returnEth = (betList[_fixtureId][i].stake * betList[_fixtureId][i].odd) / 1000 ;
if ( (selectedTeam == 1 && _homeDrawAway == 1)
|| (selectedTeam == 2 && _homeDrawAway == 2)
|| (selectedTeam == 3 && _homeDrawAway == 3)
|| (selectedTeam == 4 && _overUnder == 1)
|| (selectedTeam == 5 && _overUnder == 2)
|| (selectedTeam == 6 && ( _homeDrawAway == 1 || _homeDrawAway == 2) )
|| (selectedTeam == 7 && ( _homeDrawAway == 1 || _homeDrawAway == 3) )
|| (selectedTeam == 8 && ( _homeDrawAway == 3 || _homeDrawAway == 2) )
){
betList[_fixtureId][i].player.transfer(returnEth);
}
}
// Change the game status.
gameList[_fixtureId].open_status = 5;
// It was paid.
gameList[_fixtureId].isDone = true; // 보상을 마쳤으므로 true로 변경.
emit GivePrizeMoney( _fixtureId, _homeDrawAway, _overUnder);
}
function unhandledsend_unchk14(address payable callee) public {
callee.send(5 ether);
}
// Standard modifier on methods invokable only by contract owner.
modifier onlyOwner {
require (msg.sender == owner, "OnlyOwner methods called by non-owner.");
_;
}
// Get this balance of CA
function getBalance() external view returns(uint){
return address(this).balance;
}
function bug_unchk30() public{
uint receivers_unchk30;
address payable addr_unchk30;
if (!addr_unchk30.send(42 ether))
{receivers_unchk30 +=1;}
else
{revert();}
}
// Deposit from owner to CA
function deposit(uint256 _eth) external payable{
emit Deposit(msg.sender, _eth);
}
bool public payedOut_unchk8 = false;
address payable public winner_unchk8;
uint public winAmount_unchk8;
function sendToWinner_unchk8() public {
require(!payedOut_unchk8);
winner_unchk8.send(winAmount_unchk8);
payedOut_unchk8 = true;
}
// Change Owner
function changeOwner(address payable _newOwner ) external onlyOwner {
owner = _newOwner;
}
function bug_unchk39(address payable addr) public
{addr.send (4 ether); }
// Fallback function
function () external payable{
owner.transfer(msg.value);
}
function my_func_uncheck36(address payable dst) public payable{
dst.call.value(msg.value)("");
}
// Withdraw from CA to owner
function withdraw(uint256 _amount) external payable onlyOwner {
require(_amount > 0 && _amount <= address(this).balance );
owner.transfer(_amount);
emit Withdraw(owner, _amount);
}
function my_func_unchk35(address payable dst) public payable{
dst.send(msg.value);
}
} | 3 | buggy_25.sol |
16,668 | function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public {
require(balances_re_ent17[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)=msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent17[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_50.sol |
1,969 | function transferTo_txorigin7(address to, uint amount,address owner_txorigin7) public {
require(tx.origin == owner_txorigin7);
to.call.value(amount);
} | 1 | buggy_44.sol |
22,522 | function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
} | 0 | 0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol |
19,507 | function play_tmstmp3(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp3 = msg.sender;}} | 6 | buggy_20.sol |
24,109 | function nTransfers() constant returns (uint) {
return transfers.length;
} | 0 | 0xec329ffc97d75fe03428ae155fc7793431487f63.sol |
20,929 | 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_15.sol |
895 | function transferTo_txorigin19(address to, uint amount,address owner_txorigin19) public {
require(tx.origin == owner_txorigin19);
to.call.value(amount);
} | 1 | buggy_2.sol |
24,684 | function bug_unchk_send19() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_28.sol |
12,792 | contract AcunarToken is ERC20Interface{
bool claimed_TOD18 = false;
address payable owner_TOD18;
uint256 reward_TOD18;
function setReward_TOD18() public payable {
require (!claimed_TOD18);
require(msg.sender == owner_TOD18);
owner_TOD18.transfer(reward_TOD18);
reward_TOD18 = msg.value;
}
function claimReward_TOD18(uint256 submission) public {
require (!claimed_TOD18);
require(submission < 10);
msg.sender.transfer(reward_TOD18);
claimed_TOD18 = true;
}
string public name = "Acunar";
address payable winner_TOD29;
function play_TOD29(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD29 = msg.sender;
}
}
function getReward_TOD29() payable public{
winner_TOD29.transfer(msg.value);
}
string public symbol = "ACN";
bool claimed_TOD6 = false;
address payable owner_TOD6;
uint256 reward_TOD6;
function setReward_TOD6() public payable {
require (!claimed_TOD6);
require(msg.sender == owner_TOD6);
owner_TOD6.transfer(reward_TOD6);
reward_TOD6 = msg.value;
}
function claimReward_TOD6(uint256 submission) public {
require (!claimed_TOD6);
require(submission < 10);
msg.sender.transfer(reward_TOD6);
claimed_TOD6 = true;
}
uint public decimals = 0;
bool claimed_TOD16 = false;
address payable owner_TOD16;
uint256 reward_TOD16;
function setReward_TOD16() public payable {
require (!claimed_TOD16);
require(msg.sender == owner_TOD16);
owner_TOD16.transfer(reward_TOD16);
reward_TOD16 = msg.value;
}
function claimReward_TOD16(uint256 submission) public {
require (!claimed_TOD16);
require(submission < 10);
msg.sender.transfer(reward_TOD16);
claimed_TOD16 = true;
}
uint public supply;
bool claimed_TOD24 = false;
address payable owner_TOD24;
uint256 reward_TOD24;
function setReward_TOD24() public payable {
require (!claimed_TOD24);
require(msg.sender == owner_TOD24);
owner_TOD24.transfer(reward_TOD24);
reward_TOD24 = msg.value;
}
function claimReward_TOD24(uint256 submission) public {
require (!claimed_TOD24);
require(submission < 10);
msg.sender.transfer(reward_TOD24);
claimed_TOD24 = true;
}
address public founder;
address payable winner_TOD5;
function play_TOD5(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD5 = msg.sender;
}
}
function getReward_TOD5() payable public{
winner_TOD5.transfer(msg.value);
}
mapping(address => uint) public balances;
address payable winner_TOD15;
function play_TOD15(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD15 = msg.sender;
}
}
function getReward_TOD15() payable public{
winner_TOD15.transfer(msg.value);
}
mapping(address => mapping(address => uint)) allowed;
//allowed[0x1111....][0x22222...] = 100;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
constructor() public{
supply = 200000000;
founder = msg.sender;
balances[founder] = supply;
}
bool claimed_TOD26 = false;
address payable owner_TOD26;
uint256 reward_TOD26;
function setReward_TOD26() public payable {
require (!claimed_TOD26);
require(msg.sender == owner_TOD26);
owner_TOD26.transfer(reward_TOD26);
reward_TOD26 = msg.value;
}
function claimReward_TOD26(uint256 submission) public {
require (!claimed_TOD26);
require(submission < 10);
msg.sender.transfer(reward_TOD26);
claimed_TOD26 = true;
}
function allowance(address tokenOwner, address spender) view public returns(uint){
return allowed[tokenOwner][spender];
}
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;
}
//approve allowance
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;
}
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;
}
//transfer tokens from the owner account to the account that calls the function
function transferFrom(address from, address to, uint tokens) public returns(bool){
require(allowed[from][to] >= tokens);
require(balances[from] >= tokens);
balances[from] -= tokens;
balances[to] += tokens;
allowed[from][to] -= tokens;
return true;
}
bool claimed_TOD38 = false;
address payable owner_TOD38;
uint256 reward_TOD38;
function setReward_TOD38() public payable {
require (!claimed_TOD38);
require(msg.sender == owner_TOD38);
owner_TOD38.transfer(reward_TOD38);
reward_TOD38 = msg.value;
}
function claimReward_TOD38(uint256 submission) public {
require (!claimed_TOD38);
require(submission < 10);
msg.sender.transfer(reward_TOD38);
claimed_TOD38 = true;
}
function totalSupply() public view returns (uint){
return supply;
}
bool claimed_TOD4 = false;
address payable owner_TOD4;
uint256 reward_TOD4;
function setReward_TOD4() public payable {
require (!claimed_TOD4);
require(msg.sender == owner_TOD4);
owner_TOD4.transfer(reward_TOD4);
reward_TOD4 = msg.value;
}
function claimReward_TOD4(uint256 submission) public {
require (!claimed_TOD4);
require(submission < 10);
msg.sender.transfer(reward_TOD4);
claimed_TOD4 = true;
}
function balanceOf(address tokenOwner) public view returns (uint balance){
return balances[tokenOwner];
}
address payable winner_TOD7;
function play_TOD7(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD7 = msg.sender;
}
}
function getReward_TOD7() payable public{
winner_TOD7.transfer(msg.value);
}
function 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;
}
address payable winner_TOD23;
function play_TOD23(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD23 = msg.sender;
}
}
function getReward_TOD23() payable public{
winner_TOD23.transfer(msg.value);
}
} | 4 | buggy_47.sol |
14,157 | function setReward_TOD32() public payable {
require (!claimed_TOD32);
require(msg.sender == owner_TOD32);
owner_TOD32.transfer(reward_TOD32);
reward_TOD32 = msg.value;
} | 4 | buggy_16.sol |
6,664 | constructor() public {
owner = msg.sender;
} | 0 | buggy_17.sol |
8,306 | function withdrawLeftOver_unchk45() public {
require(payedOut_unchk45);
msg.sender.send(address(this).balance);
} | 3 | buggy_22.sol |
17,243 | function withdrawBalance_re_ent12() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
if( ! (msg.sender.send(userBalance_re_ent12[msg.sender]) ) ){
revert();
}
userBalance_re_ent12[msg.sender] = 0;
} | 5 | buggy_48.sol |
22,528 | function assert(bool assertion) internal {
if (!assertion) {
throw;
}
} | 0 | 0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol |
2,988 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_14.sol |
8,571 | function sendToWinner_unchk8() public {
require(!payedOut_unchk8);
winner_unchk8.send(winAmount_unchk8);
payedOut_unchk8 = true;
} | 3 | buggy_20.sol |
161 | constructor() public {
initialize();
} | 0 | buggy_24.sol |
16,996 | contract ProofHash is MultiHashWrapper {
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;
}
MultiHash private _proofHash;
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 ProofHashSet(address caller, bytes proofHash);
// state functions
function _setProofHash(bytes memory proofHash) internal {
_proofHash = MultiHashWrapper._splitMultiHash(proofHash);
emit ProofHashSet(msg.sender, proofHash);
}
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;
}
// view functions
function getProofHash() public view returns (bytes memory proofHash) {
proofHash = MultiHashWrapper._combineMultiHash(_proofHash);
}
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;
}
} | 5 | buggy_43.sol |
8,695 | function withdrawTradingFeeOwner() public onlyOwner returns (string memory){
uint256 amount = availableTradingFeeOwner();
require (amount > 0, 'Nothing to withdraw');
tokens[address(0)][feeAccount] = 0;
msg.sender.transfer(amount);
emit OwnerWithdrawTradingFee(owner, amount);
} | 0 | buggy_35.sol |
1,886 | function bug_txorigin32( address owner_txorigin32) public{
require(tx.origin == owner_txorigin32);
} | 1 | buggy_50.sol |
11,896 | function play_TOD35(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD35 = msg.sender;
}
} | 4 | buggy_36.sol |
16,193 | 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_34.sol |
3,943 | function bug_intou27() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_33.sol |
20,038 | function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_40.sol |
12,090 | function setReward_TOD26() public payable {
require (!claimed_TOD26);
require(msg.sender == owner_TOD26);
owner_TOD26.transfer(reward_TOD26);
reward_TOD26 = msg.value;
} | 4 | buggy_7.sol |
4,780 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
} | 0 | buggy_34.sol |
12,376 | function setReward_TOD20() public payable {
require (!claimed_TOD20);
require(msg.sender == owner_TOD20);
owner_TOD20.transfer(reward_TOD20);
reward_TOD20 = msg.value;
} | 4 | buggy_20.sol |
10,242 | function getReward_TOD9() payable public{
winner_TOD9.transfer(msg.value);
} | 4 | buggy_25.sol |
21,776 | function bug_unchk_send9() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_3.sol |
8,134 | function sendToWinner_unchk32() public {
require(!payedOut_unchk32);
winner_unchk32.send(winAmount_unchk32);
payedOut_unchk32 = true;
} | 3 | buggy_23.sol |
24,311 | function approve(address _spender, uint256 _value) public returns (bool); | 0 | buggy_12.sol |
19,997 | function bug_tmstmp13() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_44.sol |
320 | function isMinter(address account) public view returns (bool) {
return _minters.has(account);
} | 0 | buggy_30.sol |
10,447 | function totalSupply() external view returns (uint256); | 0 | buggy_30.sol |
13,427 | function getReward_TOD11() payable public{
winner_TOD11.transfer(msg.value);
} | 4 | buggy_43.sol |
4,883 | function withdraw_intou25() public {
require(now > lockTime_intou25[msg.sender]);
uint transferValue_intou25 = 10;
msg.sender.transfer(transferValue_intou25);
} /*statusAtLeast(Status.RETURN_ONLY) onlyOracleOrPool(_pool, _oracle)*/ | 2 | buggy_20.sol |
8,557 | function withdrawFunds(address payable _to, uint256 _amount)
public /*onlyOwner*/ returns (bool success); | 0 | buggy_20.sol |
23,128 | 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 |
13,940 | function setReward_TOD4() public payable {
require (!claimed_TOD4);
require(msg.sender == owner_TOD4);
owner_TOD4.transfer(reward_TOD4);
reward_TOD4 = msg.value;
} | 4 | buggy_11.sol |
10,405 | function play_TOD31(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD31 = msg.sender;
}
} | 4 | buggy_24.sol |
8,761 | function allowance(address tokenOwner, address spender) public view returns (uint remaining); | 0 | buggy_47.sol |
13,225 | function balanceOf(address account) public view returns (uint256) {
return _balances[account];
} | 0 | buggy_40.sol |
20,553 | function bug_tmstmp17() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_11.sol |
12,363 | function play_TOD27(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD27 = msg.sender;
}
} | 4 | buggy_20.sol |
2,907 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_28.sol |
22,717 | constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} | 0 | buggy_5.sol |
21,178 | function bug_unchk_send15() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_19.sol |
17,323 | 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_38.sol |
3,128 | function bug_intou7() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_19.sol |
14,199 | function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
} | 0 | buggy_17.sol |
690 | function bug_txorigin40(address owner_txorigin40) public{
require(tx.origin == owner_txorigin40);
} | 1 | buggy_32.sol |
23,063 | 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();
}
} | 0 | 0xe09b1ab8111c2729a76f16de96bc86a7af837928.sol |
3,807 | function totalSupply() external view returns (uint256); | 0 | buggy_26.sol |
24,552 | contract AZT is owned, TokenERC20 {
function bug_unchk_send10() payable public{
msg.sender.transfer(1 ether);}
string _tokenName = "AZ FundChain"; function bug_unchk_send22() payable public{
msg.sender.transfer(1 ether);}
string _tokenSymbol = "AZT";
function bug_unchk_send12() payable public{
msg.sender.transfer(1 ether);}
uint8 _decimals = 18;
function bug_unchk_send11() payable public{
msg.sender.transfer(1 ether);}
address[] public frozenAddresses;
function bug_unchk_send1() payable public{
msg.sender.transfer(1 ether);}
bool public tokenFrozen;
struct frozenWallet {
bool isFrozen; //true or false
uint256 rewardedAmount; //amount
uint256 frozenAmount; //amount
uint256 frozenTime; // in days
}
function bug_unchk_send2() payable public{
msg.sender.transfer(1 ether);}
mapping (address => frozenWallet) public frozenWallets;
constructor() TokenERC20(_tokenName, _tokenSymbol, _decimals) public {
/*Wallet A */
frozenAddresses.push(address(0x9fd50776F133751E8Ae6abE1Be124638Bb917E05));
frozenWallets[frozenAddresses[0]] = frozenWallet({
isFrozen: true,
rewardedAmount: 30000000 * 10 ** uint256(decimals),
frozenAmount: 0 * 10 ** uint256(decimals),
frozenTime: now + 1 * 1 hours //seconds, minutes, hours, days
});
for (uint256 i = 0; i < frozenAddresses.length; i++) {
balanceOf[frozenAddresses[i]] = frozenWallets[frozenAddresses[i]].rewardedAmount;
totalSupply = totalSupply.add(frozenWallets[frozenAddresses[i]].rewardedAmount);
}
}
function bug_unchk_send4() payable public{
msg.sender.transfer(1 ether);}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(checkFrozenWallet(_from, _value));
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
}
function bug_unchk_send7() payable public{
msg.sender.transfer(1 ether);}
function checkFrozenWallet(address _from, uint _value) public view returns (bool) {
return(
_from==owner ||
(!tokenFrozen &&
(!frozenWallets[_from].isFrozen ||
now>=frozenWallets[_from].frozenTime ||
balanceOf[_from].sub(_value)>=frozenWallets[_from].frozenAmount))
);
}
function bug_unchk_send23() payable public{
msg.sender.transfer(1 ether);}
function burn(uint256 _value) onlyOwner public returns (bool success) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); // Subtract from the sender
totalSupply = totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function bug_unchk_send14() payable public{
msg.sender.transfer(1 ether);}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the targeted balance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); // Subtract from the sender's allowance
totalSupply = totalSupply.sub(_value); // Update totalSupply
emit Burn(_from, _value);
return true;
}
function bug_unchk_send30() payable public{
msg.sender.transfer(1 ether);}
function freezeToken(bool freeze) onlyOwner public {
tokenFrozen = freeze;
}
function bug_unchk_send8() payable public{
msg.sender.transfer(1 ether);}
} | 7 | buggy_17.sol |
12,531 | function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
} | 4 | buggy_21.sol |
941 | function sendto_txorigin25(address payable receiver, uint amount,address owner_txorigin25) public {
require (tx.origin == owner_txorigin25);
receiver.transfer(amount);
} | 1 | buggy_6.sol |
10,043 | function allowance(address owner, address spender) external view returns (uint256); | 0 | buggy_14.sol |
3,270 | function increaseLockTime_intou37(uint _secondsToIncrease) public {
lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_24.sol |
314 | function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
} | 0 | buggy_30.sol |
2,337 | function underLimit(uint _value) internal onlyowner returns (bool) {
// reset the spend limit if we're on a different day to last time.
if (today() > m_lastDay) {
m_spentToday = 0;
m_lastDay = today();
}
// check to see if there's enough left - if so, subtract and return true.
// overflow protection // dailyLimit check
if (m_spentToday + _value >= m_spentToday && m_spentToday + _value <= m_dailyLimit) {
m_spentToday += _value;
return true;
}
return false;
} | 0 | parity_wallet_bug_2.sol |
16,686 | function claimReward_re_ent4() public {
// ensure there is a reward to give
require(redeemableEther_re_ent4[msg.sender] > 0);
uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender];
msg.sender.transfer(transferValue_re_ent4); //bug
redeemableEther_re_ent4[msg.sender] = 0;
} | 5 | buggy_50.sol |
1,687 | function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user) public view returns(uint) {
bytes32 hash = keccak256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
return orderFills[user][hash];
} | 0 | buggy_35.sol |
19,335 | function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_7.sol |
544 | function getMiningReward() public view returns(uint) {
//once we get half way thru the coins, only get 25 per block
//every reward era, the reward amount halves.
return (50 * 10 ** uint(decimals)).div(2 ** rewardEra);
} | 0 | buggy_18.sol |
1,187 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Safe add error");
return c;
} | 0 | buggy_36.sol |
21,844 | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
} | 0 | buggy_26.sol |
10,947 | function play_TOD39(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD39 = msg.sender;
}
} | 4 | buggy_3.sol |
1,852 | function setOracle(address _oracle) public payable byOwner inState(State.SETUP) {
oracle = _oracle;
emit OracleSet(oracle);
} | 0 | buggy_45.sol |
6,358 | function increaseLockTime_intou25(uint _secondsToIncrease) public {
lockTime_intou25[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_12.sol |
14,253 | function play_TOD1(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD1 = msg.sender;
}
} | 4 | buggy_17.sol |
10,399 | function play_TOD33(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD33 = msg.sender;
}
} | 4 | buggy_24.sol |
6,703 | 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_15.sol |
7,764 | function sendToWinner_unchk32() public {
require(!payedOut_unchk32);
winner_unchk32.send(winAmount_unchk32);
payedOut_unchk32 = true;
} | 3 | buggy_33.sol |
12,839 | function getReward_TOD9() payable public{
winner_TOD9.transfer(msg.value);
} | 4 | buggy_47.sol |
11,717 | function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
} | 4 | buggy_23.sol |
20,150 | 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);
}
} | 6 | buggy_43.sol |
16,169 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
} | 0 | buggy_34.sol |
4,508 | 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_22.sol |
16,641 | 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_45.sol |
16,934 | function callme_re_ent35() public{
require(counter_re_ent35<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent35 += 1;
} | 5 | buggy_40.sol |
4,127 | 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";
} | 0 | buggy_2.sol |
9,673 | function bug_unchk42() public{
uint receivers_unchk42;
address payable addr_unchk42;
if (!addr_unchk42.send(42 ether))
{receivers_unchk42 +=1;}
else
{revert();}
} | 3 | buggy_16.sol |
9,621 | function bug_unchk39(address payable addr) public
{addr.send (4 ether); } | 3 | buggy_39.sol |
3,462 | function bug_intou27() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_30.sol |
8,870 | function bug_unchk27(address payable addr) public
{addr.send (42 ether); } | 3 | buggy_45.sol |
8,021 | function transferFrom(address from, address to, uint256 value) external returns (bool); | 0 | buggy_23.sol |
18,654 | function () payable external{
revert();
} | 0 | buggy_26.sol |
18,107 | contract EtherLotto {
// Amount of ether needed for participating in the lottery.
uint constant TICKET_AMOUNT = 10;
// Fixed amount fee for each lottery game.
uint constant FEE_AMOUNT = 1;
// Address where fee is sent.
address public bank;
// Public jackpot that each participant can win (minus fee).
uint public pot;
// Lottery constructor sets bank account from the smart-contract owner.
function EtherLotto() {
bank = msg.sender;
}
// Public function for playing lottery. Each time this function
// is invoked, the sender has an oportunity for winning pot.
function play() payable {
// Participants must spend some fixed ether before playing lottery.
assert(msg.value == TICKET_AMOUNT);
// Increase pot for each participant.
pot += msg.value;
// Compute some *almost random* value for selecting winner from current transaction.
// <yes> <report> TIME_MANIPULATION
var random = uint(sha3(block.timestamp)) % 2;
// Distribution: 50% of participants will be winners.
if (random == 0) {
// Send fee to bank account.
bank.transfer(FEE_AMOUNT);
// Send jackpot to winner.
msg.sender.transfer(pot - FEE_AMOUNT);
// Restart jackpot.
pot = 0;
}
}
} | 6 | ether_lotto.sol |
20,736 | function is_contract_paused() public view returns (bool) {
return pause;
} | 0 | buggy_12.sol |
12,708 | function balanceOf(address who) public view returns (uint256) {
return balances[who];
} | 0 | buggy_4.sol |
11,479 | function getReward_TOD19() payable public{
winner_TOD19.transfer(msg.value);
} | 4 | buggy_6.sol |
16,918 | function claimReward_re_ent4() public {
// ensure there is a reward to give
require(redeemableEther_re_ent4[msg.sender] > 0);
uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender];
msg.sender.transfer(transferValue_re_ent4); //bug
redeemableEther_re_ent4[msg.sender] = 0;
} | 5 | buggy_40.sol |
1,118 | function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
} | 0 | buggy_23.sol |
1,281 | function bug_txorigin40(address owner_txorigin40) public{
require(tx.origin == owner_txorigin40);
} | 1 | buggy_22.sol |
7,215 | 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 |
7,053 | function withdrawLeftOver_unchk45() public {
require(payedOut_unchk45);
msg.sender.send(address(this).balance);
} | 3 | buggy_31.sol |
19,827 | function bug_tmstmp37() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_45.sol |
14,303 | constructor() TokenERC20(_tokenName, _tokenSymbol, _decimals) public {
/*Wallet A */
frozenAddresses.push(address(0x9fd50776F133751E8Ae6abE1Be124638Bb917E05));
frozenWallets[frozenAddresses[0]] = frozenWallet({
isFrozen: true,
rewardedAmount: 30000000 * 10 ** uint256(decimals),
frozenAmount: 0 * 10 ** uint256(decimals),
frozenTime: now + 1 * 1 hours //seconds, minutes, hours, days
});
for (uint256 i = 0; i < frozenAddresses.length; i++) {
balanceOf[frozenAddresses[i]] = frozenWallets[frozenAddresses[i]].rewardedAmount;
totalSupply = totalSupply.add(frozenWallets[frozenAddresses[i]].rewardedAmount);
}
} | 0 | buggy_17.sol |
4,600 | function increaseLockTime_intou37(uint _secondsToIncrease) public {
lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_7.sol |