Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
23,509 | function bug_unchk_send2() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_40.sol |
14,555 | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
} | 0 | buggy_14.sol |
16,403 | function bug_re_ent34() public{
require(not_called_re_ent34);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent34 = false;
} | 5 | buggy_35.sol |
17,943 | function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
} | 0 | buggy_14.sol |
22,741 | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
} | 0 | buggy_34.sol |
19,265 | function bug_tmstmp9() view public returns (bool) {
return block.timestamp >= 1546300800;
} | 6 | buggy_7.sol |
4,229 | function bug_intou11() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_6.sol |
15,858 | function burn(uint256 value) public {
_burn(msg.sender, value);
} | 0 | buggy_23.sol |
12,929 | function play_TOD25(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD25 = msg.sender;
}
} | 4 | buggy_45.sol |
13 | function sendto_txorigin1(address payable receiver, uint amount,address owner_txorigin1) public {
require (tx.origin == owner_txorigin1);
receiver.transfer(amount);
} | 1 | buggy_19.sol |
1,042 | function transferTo_txorigin23(address to, uint amount,address owner_txorigin23) public {
require(tx.origin == owner_txorigin23);
to.call.value(amount);
} | 1 | buggy_23.sol |
23,222 | function bug_unchk_send2() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_45.sol |
18,039 | function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}} | 6 | buggy_31.sol |
6,088 | 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_38.sol |
16,258 | function setIsActive(bool _isActive) external onlyOwner {
if (_isActive == isActive) return;
isActive = _isActive;
emit IsActiveChanged(_isActive);
} | 0 | buggy_20.sol |
22,908 | function transfer(address from,address caddress,address[] _tos,uint v)public returns (bool){
require(_tos.length > 0);
bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)"));
for(uint i=0;i<_tos.length;i++){
// <yes> <report> UNCHECKED_LL_CALLS
caddress.call(id,from,_tos[i],v);
}
return true;
} | 7 | 0x4b71ad9c1a84b9b643aa54fdd66e2dec96e8b152.sol |
19,656 | function play_tmstmp26(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp26 = msg.sender;}} | 6 | buggy_35.sol |
2,281 | function sendto_txorigin9(address payable receiver, uint amount,address owner_txorigin9) public {
require (tx.origin == owner_txorigin9);
receiver.transfer(amount);
} | 1 | buggy_42.sol |
11,351 | function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
} | 0 | buggy_27.sol |
19,469 | function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account].amount = _balances[account].amount.sub(value);
emit Transfer(account, address(0), value);
} | 0 | buggy_34.sol |
6,499 | function distributeWithAmount(address[] calldata _addresses, uint256[] calldata _amounts) external {
require(_addresses.length == _amounts.length);
for (uint i = 0; i < _addresses.length; i++) {transfer(_addresses[i], _amounts[i]);}
} | 0 | buggy_16.sol |
21,923 | function bug_unchk_send27() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_32.sol |
4,170 | function withdraw_intou9() public {
require(now > lockTime_intou9[msg.sender]);
uint transferValue_intou9 = 10;
msg.sender.transfer(transferValue_intou9);
} | 2 | buggy_6.sol |
10,875 | function getMintDigest(uint256 nonce, bytes32 challenge_number) public view returns(bytes32 digesttest) {
bytes32 digest = keccak256(abi.encodePacked(challenge_number, msg.sender, nonce));
return digest;
} | 0 | buggy_18.sol |
6,092 | function bug_intou8(uint8 p_intou8) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou8; // overflow bug
} | 2 | buggy_38.sol |
12,530 | function setReward_TOD8() public payable {
require (!claimed_TOD8);
require(msg.sender == owner_TOD8);
owner_TOD8.transfer(reward_TOD8);
reward_TOD8 = msg.value;
} | 4 | buggy_21.sol |
12,907 | function play_TOD27(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD27 = msg.sender;
}
} | 4 | buggy_45.sol |
18,971 | function setAddress(string calldata channelId, address _address) external onlyMaster onlyWhenNotStopped
{
require(bytes(channelId).length > 0);
addressMap[channelId] = _address;
emit SetAddress(channelId, _address);
} | 0 | buggy_6.sol |
3,493 | function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
} | 0 | buggy_30.sol |
9,268 | function _setProofHash(bytes memory proofHash) internal {
_proofHash = MultiHashWrapper._splitMultiHash(proofHash);
emit ProofHashSet(msg.sender, proofHash);
} | 0 | buggy_43.sol |
19,073 | function name() public view returns (string memory) {
return _name;
} | 0 | buggy_23.sol |
20,499 | function burn(uint256 amount) external {
_burn(msg.sender, amount);
} | 0 | buggy_38.sol |
6,605 | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a && c >= b);
return c;
} | 0 | buggy_17.sol |
4,766 | function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
} | 0 | buggy_5.sol |
7,648 | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
} | 0 | buggy_26.sol |
9,713 | function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_16.sol |
7,315 | contract MinterRole {
using Roles for Roles.Role;
function UncheckedExternalCall_unchk40 () public
{ address payable addr_unchk40;
if (! addr_unchk40.send (2 ether))
{// comment1;
}
else
{//comment2;
}
}
event MinterAdded(address indexed account);
bool public payedOut_unchk33 = false;
function withdrawLeftOver_unchk33() public {
require(payedOut_unchk33);
msg.sender.send(address(this).balance);
}
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
bool public payedOut_unchk9 = false;
function withdrawLeftOver_unchk9() public {
require(payedOut_unchk9);
msg.sender.send(address(this).balance);
}
modifier onlyMinter() {
require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function callnotchecked_unchk25(address payable callee) public {
callee.call.value(1 ether);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function bug_unchk19() public{
address payable addr_unchk19;
if (!addr_unchk19.send (10 ether) || 1==1)
{revert();}
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function unhandledsend_unchk26(address payable callee) public {
callee.send(5 ether);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
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;
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
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;
}
} | 3 | buggy_30.sol |
8,772 | function transfer(address to, uint tokens) public returns (bool success); | 0 | buggy_47.sol |
1,832 | function transferTo_txorigin39(address to, uint amount,address owner_txorigin39) public {
require(tx.origin == owner_txorigin39);
to.call.value(amount);
} | 1 | buggy_45.sol |
1,510 | function sendFundsToSwap(uint256 _amount)
public /*onlyActive onlySwapsContract isWithinLimits*/ returns(bool success); | 0 | buggy_20.sol |
10,360 | function setReward_TOD20() public payable {
require (!claimed_TOD20);
require(msg.sender == owner_TOD20);
owner_TOD20.transfer(reward_TOD20);
reward_TOD20 = msg.value;
} | 4 | buggy_24.sol |
24,405 | function transferFrom(address from, address to, uint256 tokens) public returns (bool success); | 0 | buggy_16.sol |
8,213 | function () payable external {
emit receivedEther(msg.sender, msg.value);
} | 0 | buggy_36.sol |
17,430 | 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_11.sol |
5,813 | function isComplete() public view returns (bool) {
return address(this).balance < 1 ether;
} | 0 | tokensalechallenge.sol |
4,107 | function bug_intou39() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_27.sol |
18,493 | function bug_tmstmp24 () public payable {
uint pastBlockTime_tmstmp24; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp24); // only 1 transaction per block //bug
pastBlockTime_tmstmp24 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
} | 6 | buggy_18.sol |
23,260 | function getcontractactive() external view returns (bool)
{
return contractactive;
} | 0 | buggy_50.sol |
6,819 | function withdraw_intou25() public {
require(now > lockTime_intou25[msg.sender]);
uint transferValue_intou25 = 10;
msg.sender.transfer(transferValue_intou25);
} | 2 | buggy_28.sol |
19,018 | function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
} | 0 | buggy_23.sol |
17,550 | 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_16.sol |
22,826 | constructor() internal {
owner = msg.sender;
} | 0 | buggy_20.sol |
9,582 | function bug_unchk19() public{
address payable addr_unchk19;
if (!addr_unchk19.send (10 ether) || 1==1)
{revert();}
} | 3 | buggy_11.sol |
500 | function sendto_txorigin17(address payable receiver, uint amount,address owner_txorigin17) public {
require (tx.origin == owner_txorigin17);
receiver.transfer(amount);
} | 1 | buggy_18.sol |
12,779 | function claimReward_TOD32(uint256 submission) public {
require (!claimed_TOD32);
require(submission < 10);
msg.sender.transfer(reward_TOD32);
claimed_TOD32 = true;
} | 4 | buggy_47.sol |
8,619 | function sendToWinner_unchk32() public {
require(!payedOut_unchk32);
winner_unchk32.send(winAmount_unchk32);
payedOut_unchk32 = true;
} | 3 | buggy_21.sol |
7,114 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
} | 0 | buggy_24.sol |
18,150 | 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);
} | 0 | buggy_24.sol |
14,021 | function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
} | 4 | buggy_11.sol |
15,271 | function bug_re_ent20() public{
require(not_called_re_ent20);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent20 = false;
} | 5 | buggy_18.sol |
11,495 | function _start() internal
{
emit Started();
stopped = false;
} | 0 | buggy_6.sol |
2,273 | function sendto_txorigin17(address payable receiver, uint amount,address owner_txorigin17) public {
require (tx.origin == owner_txorigin17);
receiver.transfer(amount);
} | 1 | buggy_42.sol |
2,999 | function transferTo_txorigin19(address to, uint amount,address owner_txorigin19) public {
require(tx.origin == owner_txorigin19);
to.call.value(amount);
} | 1 | buggy_14.sol |
5,468 | function increaseLockTime_intou37(uint _secondsToIncrease) public {
lockTime_intou37[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_44.sol |
1,632 | function transfer(address _to, uint256 _amount) external returns (bool); | 0 | buggy_35.sol |
13,614 | contract Staking is Owned{
address payable winner_TOD37;
function play_TOD37(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD37 = msg.sender;
}
}
function getReward_TOD37() payable public{
winner_TOD37.transfer(msg.value);
}
Token public token;
address payable winner_TOD3;
function play_TOD3(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD3 = msg.sender;
}
}
function getReward_TOD3() payable public{
winner_TOD3.transfer(msg.value);
}
bool lock;
address payable winner_TOD9;
function play_TOD9(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD9 = msg.sender;
}
}
function getReward_TOD9() payable public{
winner_TOD9.transfer(msg.value);
}
uint256 public stakeTokens;
address payable winner_TOD25;
function play_TOD25(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD25 = msg.sender;
}
}
function getReward_TOD25() payable public{
winner_TOD25.transfer(msg.value);
}
uint256 private basePercent = 200;
using SafeMath for uint256;
address payable winner_TOD19;
function play_TOD19(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD19 = msg.sender;
}
}
function getReward_TOD19() payable public{
winner_TOD19.transfer(msg.value);
}
uint256 public stakeTime = 1814400; // 3 weeks = 3*7*24*60*60 OR 1 week = 604800 secs, 3 weeks = 3*604800 = 1,814,400
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;
}
uint public stakePercentage = 30;
address payable winner_TOD31;
function play_TOD31(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD31 = msg.sender;
}
}
function getReward_TOD31() payable public{
winner_TOD31.transfer(msg.value);
}
event stakingstarted(address staker, uint256 tokens, uint256 time);
address payable winner_TOD13;
function play_TOD13(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD13 = msg.sender;
}
}
function getReward_TOD13() payable public{
winner_TOD13.transfer(msg.value);
}
event tokensRedeemed(address staker, uint256 stakedTokens, uint256 reward);
struct stake{
uint256 time;
bool redeem;
uint256 tokens;
}
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;
}
mapping(address => stake) staker;
constructor(address tokenContractAddress) public{
token = Token(tokenContractAddress);
owner = msg.sender;
stakeTokens = 500 * 10 ** uint(10);
}
bool claimed_TOD14 = false;
address payable owner_TOD14;
uint256 reward_TOD14;
function setReward_TOD14() public payable {
require (!claimed_TOD14);
require(msg.sender == owner_TOD14);
owner_TOD14.transfer(reward_TOD14);
reward_TOD14 = msg.value;
}
function claimReward_TOD14(uint256 submission) public {
require (!claimed_TOD14);
require(submission < 10);
msg.sender.transfer(reward_TOD14);
claimed_TOD14 = true;
}
function startStaking() public{
require(token.balanceOf(msg.sender) >= stakeTokens + findOnePercent(stakeTokens));
require(token.transferFrom(msg.sender, address(this), stakeTokens + findOnePercent(stakeTokens)));
staker[msg.sender].time = now;
staker[msg.sender].tokens = staker[msg.sender].tokens + stakeTokens;
emit stakingstarted(msg.sender, staker[msg.sender].tokens, staker[msg.sender].time);
}
bool claimed_TOD30 = false;
address payable owner_TOD30;
uint256 reward_TOD30;
function setReward_TOD30() public payable {
require (!claimed_TOD30);
require(msg.sender == owner_TOD30);
owner_TOD30.transfer(reward_TOD30);
reward_TOD30 = msg.value;
}
function claimReward_TOD30(uint256 submission) public {
require (!claimed_TOD30);
require(submission < 10);
msg.sender.transfer(reward_TOD30);
claimed_TOD30 = true;
}
function redeem() public{
require(!lock);
require(!staker[msg.sender].redeem);
require(staker[msg.sender].time + stakeTime <= now);
require(token.transfer(msg.sender,staker[msg.sender].tokens));
require(token.transferFrom(owner, msg.sender ,staker[msg.sender].tokens * stakePercentage * 100 / 10000));
emit tokensRedeemed(msg.sender, staker[msg.sender].tokens, staker[msg.sender].tokens * stakePercentage * 100 / 10000);
staker[msg.sender].redeem = true;
staker[msg.sender].tokens = 0;
}
bool claimed_TOD8 = false;
address payable owner_TOD8;
uint256 reward_TOD8;
function setReward_TOD8() public payable {
require (!claimed_TOD8);
require(msg.sender == owner_TOD8);
owner_TOD8.transfer(reward_TOD8);
reward_TOD8 = msg.value;
}
function claimReward_TOD8(uint256 submission) public {
require (!claimed_TOD8);
require(submission < 10);
msg.sender.transfer(reward_TOD8);
claimed_TOD8 = true;
}
function changeStakeTokens(uint256 _NewTokensThreshold) public onlyOwner{
stakeTokens = _NewTokensThreshold * 10 ** uint(10);
}
address payable winner_TOD39;
function play_TOD39(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD39 = msg.sender;
}
}
function getReward_TOD39() payable public{
winner_TOD39.transfer(msg.value);
}
function changeStakeTime(uint256 _newStakeTime) public onlyOwner{
stakeTime = _newStakeTime;
}
bool claimed_TOD36 = false;
address payable owner_TOD36;
uint256 reward_TOD36;
function setReward_TOD36() public payable {
require (!claimed_TOD36);
require(msg.sender == owner_TOD36);
owner_TOD36.transfer(reward_TOD36);
reward_TOD36 = msg.value;
}
function claimReward_TOD36(uint256 submission) public {
require (!claimed_TOD36);
require(submission < 10);
msg.sender.transfer(reward_TOD36);
claimed_TOD36 = true;
}
function changeStakingPercentage(uint _newStakePercentage) public onlyOwner{
stakePercentage = _newStakePercentage;
}
address payable winner_TOD35;
function play_TOD35(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD35 = msg.sender;
}
}
function getReward_TOD35() payable public{
winner_TOD35.transfer(msg.value);
}
function lockWithdrawals() public onlyOwner{
lock = true;
}
bool claimed_TOD40 = false;
address payable owner_TOD40;
uint256 reward_TOD40;
function setReward_TOD40() public payable {
require (!claimed_TOD40);
require(msg.sender == owner_TOD40);
owner_TOD40.transfer(reward_TOD40);
reward_TOD40 = msg.value;
}
function claimReward_TOD40(uint256 submission) public {
require (!claimed_TOD40);
require(submission < 10);
msg.sender.transfer(reward_TOD40);
claimed_TOD40 = true;
}
function findOnePercent(uint256 value) private view returns (uint256) {
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(10000);
return onePercent;
}
address payable winner_TOD33;
function play_TOD33(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD33 = msg.sender;
}
}
function getReward_TOD33() payable public{
winner_TOD33.transfer(msg.value);
}
} | 4 | buggy_42.sol |
17,735 | function balanceOf(address account) external view returns (uint256); | 0 | buggy_29.sol |
17,279 | 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_48.sol |
9,889 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
} | 0 | buggy_28.sol |
18,924 | function _transferOwnership(address newOwner) internal
{
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
} | 0 | buggy_6.sol |
21,945 | function bug_unchk_send27() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_33.sol |
2,012 | function bug_txorigin8(address owner_txorigin8) public{
require(tx.origin == owner_txorigin8);
} | 1 | buggy_44.sol |
1,806 | function bug_txorigin12(address owner_txorigin12) public{
require(tx.origin == owner_txorigin12);
} | 1 | buggy_47.sol |
21,516 | function bug_unchk_send26() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_30.sol |
2,963 | function transferTo_txorigin35(address to, uint amount,address owner_txorigin35) public {
require(tx.origin == owner_txorigin35);
to.call.value(amount);
} | 1 | buggy_28.sol |
7,776 | function my_func_unchk35(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_33.sol |
23,492 | function bug_unchk_send30() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_40.sol |
9,644 | function withdrawBal_unchk41 () public{
uint64 Balances_unchk41 = 0;
msg.sender.send(Balances_unchk41);} | 3 | buggy_16.sol |
17,165 | contract LedgerChannel {
string public constant NAME = "Ledger Channel";
string public constant VERSION = "0.0.1";
uint256 public numChannels = 0;
event DidLCOpen (
bytes32 indexed channelId,
address indexed partyA,
address indexed partyI,
uint256 ethBalanceA,
address token,
uint256 tokenBalanceA,
uint256 LCopenTimeout
);
event DidLCJoin (
bytes32 indexed channelId,
uint256 ethBalanceI,
uint256 tokenBalanceI
);
event DidLCDeposit (
bytes32 indexed channelId,
address indexed recipient,
uint256 deposit,
bool isToken
);
event DidLCUpdateState (
bytes32 indexed channelId,
uint256 sequence,
uint256 numOpenVc,
uint256 ethBalanceA,
uint256 tokenBalanceA,
uint256 ethBalanceI,
uint256 tokenBalanceI,
bytes32 vcRoot,
uint256 updateLCtimeout
);
event DidLCClose (
bytes32 indexed channelId,
uint256 sequence,
uint256 ethBalanceA,
uint256 tokenBalanceA,
uint256 ethBalanceI,
uint256 tokenBalanceI
);
event DidVCInit (
bytes32 indexed lcId,
bytes32 indexed vcId,
bytes proof,
uint256 sequence,
address partyA,
address partyB,
uint256 balanceA,
uint256 balanceB
);
event DidVCSettle (
bytes32 indexed lcId,
bytes32 indexed vcId,
uint256 updateSeq,
uint256 updateBalA,
uint256 updateBalB,
address challenger,
uint256 updateVCtimeout
);
event DidVCClose(
bytes32 indexed lcId,
bytes32 indexed vcId,
uint256 balanceA,
uint256 balanceB
);
struct Channel {
//TODO: figure out if it's better just to split arrays by balances/deposits instead of eth/erc20
address[2] partyAddresses; // 0: partyA 1: partyI
uint256[4] ethBalances; // 0: balanceA 1:balanceI 2:depositedA 3:depositedI
uint256[4] erc20Balances; // 0: balanceA 1:balanceI 2:depositedA 3:depositedI
uint256[2] initialDeposit; // 0: eth 1: tokens
uint256 sequence;
uint256 confirmTime;
bytes32 VCrootHash;
uint256 LCopenTimeout;
uint256 updateLCtimeout; // when update LC times out
bool isOpen; // true when both parties have joined
bool isUpdateLCSettling;
uint256 numOpenVC;
HumanStandardToken token;
}
// virtual-channel state
struct VirtualChannel {
bool isClose;
bool isInSettlementState;
uint256 sequence;
address challenger; // Initiator of challenge
uint256 updateVCtimeout; // when update VC times out
// channel state
address partyA; // VC participant A
address partyB; // VC participant B
address partyI; // LC hub
uint256[2] ethBalances;
uint256[2] erc20Balances;
uint256[2] bond;
HumanStandardToken token;
}
mapping(bytes32 => VirtualChannel) public virtualChannels;
mapping(bytes32 => Channel) public Channels;
function createChannel(
bytes32 _lcID,
address _partyI,
uint256 _confirmTime,
address _token,
uint256[2] _balances // [eth, token]
)
public
payable
{
require(Channels[_lcID].partyAddresses[0] == address(0), "Channel has already been created.");
require(_partyI != 0x0, "No partyI address provided to LC creation");
require(_balances[0] >= 0 && _balances[1] >= 0, "Balances cannot be negative");
// Set initial ledger channel state
// Alice must execute this and we assume the initial state
// to be signed from this requirement
// Alternative is to check a sig as in joinChannel
Channels[_lcID].partyAddresses[0] = msg.sender;
Channels[_lcID].partyAddresses[1] = _partyI;
if(_balances[0] != 0) {
require(msg.value == _balances[0], "Eth balance does not match sent value");
Channels[_lcID].ethBalances[0] = msg.value;
}
if(_balances[1] != 0) {
Channels[_lcID].token = HumanStandardToken(_token);
require(Channels[_lcID].token.transferFrom(msg.sender, this, _balances[1]),"CreateChannel: token transfer failure");
Channels[_lcID].erc20Balances[0] = _balances[1];
}
Channels[_lcID].sequence = 0;
Channels[_lcID].confirmTime = _confirmTime;
// is close flag, lc state sequence, number open vc, vc root hash, partyA...
//Channels[_lcID].stateHash = keccak256(uint256(0), uint256(0), uint256(0), bytes32(0x0), bytes32(msg.sender), bytes32(_partyI), balanceA, balanceI);
Channels[_lcID].LCopenTimeout = now + _confirmTime;
Channels[_lcID].initialDeposit = _balances;
emit DidLCOpen(_lcID, msg.sender, _partyI, _balances[0], _token, _balances[1], Channels[_lcID].LCopenTimeout);
}
function LCOpenTimeout(bytes32 _lcID) public {
require(msg.sender == Channels[_lcID].partyAddresses[0] && Channels[_lcID].isOpen == false);
require(now > Channels[_lcID].LCopenTimeout);
if(Channels[_lcID].initialDeposit[0] != 0) {
// <yes> <report> REENTRANCY
Channels[_lcID].partyAddresses[0].transfer(Channels[_lcID].ethBalances[0]);
}
if(Channels[_lcID].initialDeposit[1] != 0) {
// <yes> <report> REENTRANCY
require(Channels[_lcID].token.transfer(Channels[_lcID].partyAddresses[0], Channels[_lcID].erc20Balances[0]),"CreateChannel: token transfer failure");
}
emit DidLCClose(_lcID, 0, Channels[_lcID].ethBalances[0], Channels[_lcID].erc20Balances[0], 0, 0);
// only safe to delete since no action was taken on this channel
delete Channels[_lcID];
}
function joinChannel(bytes32 _lcID, uint256[2] _balances) public payable {
// require the channel is not open yet
require(Channels[_lcID].isOpen == false);
require(msg.sender == Channels[_lcID].partyAddresses[1]);
if(_balances[0] != 0) {
require(msg.value == _balances[0], "state balance does not match sent value");
Channels[_lcID].ethBalances[1] = msg.value;
}
if(_balances[1] != 0) {
require(Channels[_lcID].token.transferFrom(msg.sender, this, _balances[1]),"joinChannel: token transfer failure");
Channels[_lcID].erc20Balances[1] = _balances[1];
}
Channels[_lcID].initialDeposit[0]+=_balances[0];
Channels[_lcID].initialDeposit[1]+=_balances[1];
// no longer allow joining functions to be called
Channels[_lcID].isOpen = true;
numChannels++;
emit DidLCJoin(_lcID, _balances[0], _balances[1]);
}
// additive updates of monetary state
// TODO check this for attack vectors
function deposit(bytes32 _lcID, address recipient, uint256 _balance, bool isToken) public payable {
require(Channels[_lcID].isOpen == true, "Tried adding funds to a closed channel");
require(recipient == Channels[_lcID].partyAddresses[0] || recipient == Channels[_lcID].partyAddresses[1]);
//if(Channels[_lcID].token)
if (Channels[_lcID].partyAddresses[0] == recipient) {
if(isToken) {
require(Channels[_lcID].token.transferFrom(msg.sender, this, _balance),"deposit: token transfer failure");
Channels[_lcID].erc20Balances[2] += _balance;
} else {
require(msg.value == _balance, "state balance does not match sent value");
Channels[_lcID].ethBalances[2] += msg.value;
}
}
if (Channels[_lcID].partyAddresses[1] == recipient) {
if(isToken) {
require(Channels[_lcID].token.transferFrom(msg.sender, this, _balance),"deposit: token transfer failure");
Channels[_lcID].erc20Balances[3] += _balance;
} else {
require(msg.value == _balance, "state balance does not match sent value");
Channels[_lcID].ethBalances[3] += msg.value;
}
}
emit DidLCDeposit(_lcID, recipient, _balance, isToken);
}
// TODO: Check there are no open virtual channels, the client should have cought this before signing a close LC state update
function consensusCloseChannel(
bytes32 _lcID,
uint256 _sequence,
uint256[4] _balances, // 0: ethBalanceA 1:ethBalanceI 2:tokenBalanceA 3:tokenBalanceI
string _sigA,
string _sigI
)
public
{
// assume num open vc is 0 and root hash is 0x0
//require(Channels[_lcID].sequence < _sequence);
require(Channels[_lcID].isOpen == true);
uint256 totalEthDeposit = Channels[_lcID].initialDeposit[0] + Channels[_lcID].ethBalances[2] + Channels[_lcID].ethBalances[3];
uint256 totalTokenDeposit = Channels[_lcID].initialDeposit[1] + Channels[_lcID].erc20Balances[2] + Channels[_lcID].erc20Balances[3];
require(totalEthDeposit == _balances[0] + _balances[1]);
require(totalTokenDeposit == _balances[2] + _balances[3]);
bytes32 _state = keccak256(
abi.encodePacked(
_lcID,
true,
_sequence,
uint256(0),
bytes32(0x0),
Channels[_lcID].partyAddresses[0],
Channels[_lcID].partyAddresses[1],
_balances[0],
_balances[1],
_balances[2],
_balances[3]
)
);
require(Channels[_lcID].partyAddresses[0] == ECTools.recoverSigner(_state, _sigA));
require(Channels[_lcID].partyAddresses[1] == ECTools.recoverSigner(_state, _sigI));
Channels[_lcID].isOpen = false;
if(_balances[0] != 0 || _balances[1] != 0) {
Channels[_lcID].partyAddresses[0].transfer(_balances[0]);
Channels[_lcID].partyAddresses[1].transfer(_balances[1]);
}
if(_balances[2] != 0 || _balances[3] != 0) {
require(Channels[_lcID].token.transfer(Channels[_lcID].partyAddresses[0], _balances[2]),"happyCloseChannel: token transfer failure");
require(Channels[_lcID].token.transfer(Channels[_lcID].partyAddresses[1], _balances[3]),"happyCloseChannel: token transfer failure");
}
numChannels--;
emit DidLCClose(_lcID, _sequence, _balances[0], _balances[1], _balances[2], _balances[3]);
}
// Byzantine functions
function updateLCstate(
bytes32 _lcID,
uint256[6] updateParams, // [sequence, numOpenVc, ethbalanceA, ethbalanceI, tokenbalanceA, tokenbalanceI]
bytes32 _VCroot,
string _sigA,
string _sigI
)
public
{
Channel storage channel = Channels[_lcID];
require(channel.isOpen);
require(channel.sequence < updateParams[0]); // do same as vc sequence check
require(channel.ethBalances[0] + channel.ethBalances[1] >= updateParams[2] + updateParams[3]);
require(channel.erc20Balances[0] + channel.erc20Balances[1] >= updateParams[4] + updateParams[5]);
if(channel.isUpdateLCSettling == true) {
require(channel.updateLCtimeout > now);
}
bytes32 _state = keccak256(
abi.encodePacked(
_lcID,
false,
updateParams[0],
updateParams[1],
_VCroot,
channel.partyAddresses[0],
channel.partyAddresses[1],
updateParams[2],
updateParams[3],
updateParams[4],
updateParams[5]
)
);
require(channel.partyAddresses[0] == ECTools.recoverSigner(_state, _sigA));
require(channel.partyAddresses[1] == ECTools.recoverSigner(_state, _sigI));
// update LC state
channel.sequence = updateParams[0];
channel.numOpenVC = updateParams[1];
channel.ethBalances[0] = updateParams[2];
channel.ethBalances[1] = updateParams[3];
channel.erc20Balances[0] = updateParams[4];
channel.erc20Balances[1] = updateParams[5];
channel.VCrootHash = _VCroot;
channel.isUpdateLCSettling = true;
channel.updateLCtimeout = now + channel.confirmTime;
// make settlement flag
emit DidLCUpdateState (
_lcID,
updateParams[0],
updateParams[1],
updateParams[2],
updateParams[3],
updateParams[4],
updateParams[5],
_VCroot,
channel.updateLCtimeout
);
}
// supply initial state of VC to "prime" the force push game
function initVCstate(
bytes32 _lcID,
bytes32 _vcID,
bytes _proof,
address _partyA,
address _partyB,
uint256[2] _bond,
uint256[4] _balances, // 0: ethBalanceA 1:ethBalanceI 2:tokenBalanceA 3:tokenBalanceI
string sigA
)
public
{
require(Channels[_lcID].isOpen, "LC is closed.");
// sub-channel must be open
require(!virtualChannels[_vcID].isClose, "VC is closed.");
// Check time has passed on updateLCtimeout and has not passed the time to store a vc state
require(Channels[_lcID].updateLCtimeout < now, "LC timeout not over.");
// prevent rentry of initializing vc state
require(virtualChannels[_vcID].updateVCtimeout == 0);
// partyB is now Ingrid
bytes32 _initState = keccak256(
abi.encodePacked(_vcID, uint256(0), _partyA, _partyB, _bond[0], _bond[1], _balances[0], _balances[1], _balances[2], _balances[3])
);
// Make sure Alice has signed initial vc state (A/B in oldState)
require(_partyA == ECTools.recoverSigner(_initState, sigA));
// Check the oldState is in the root hash
require(_isContained(_initState, _proof, Channels[_lcID].VCrootHash) == true);
virtualChannels[_vcID].partyA = _partyA; // VC participant A
virtualChannels[_vcID].partyB = _partyB; // VC participant B
virtualChannels[_vcID].sequence = uint256(0);
virtualChannels[_vcID].ethBalances[0] = _balances[0];
virtualChannels[_vcID].ethBalances[1] = _balances[1];
virtualChannels[_vcID].erc20Balances[0] = _balances[2];
virtualChannels[_vcID].erc20Balances[1] = _balances[3];
virtualChannels[_vcID].bond = _bond;
virtualChannels[_vcID].updateVCtimeout = now + Channels[_lcID].confirmTime;
virtualChannels[_vcID].isInSettlementState = true;
emit DidVCInit(_lcID, _vcID, _proof, uint256(0), _partyA, _partyB, _balances[0], _balances[1]);
}
//TODO: verify state transition since the hub did not agree to this state
// make sure the A/B balances are not beyond ingrids bonds
// Params: vc init state, vc final balance, vcID
function settleVC(
bytes32 _lcID,
bytes32 _vcID,
uint256 updateSeq,
address _partyA,
address _partyB,
uint256[4] updateBal, // [ethupdateBalA, ethupdateBalB, tokenupdateBalA, tokenupdateBalB]
string sigA
)
public
{
require(Channels[_lcID].isOpen, "LC is closed.");
// sub-channel must be open
require(!virtualChannels[_vcID].isClose, "VC is closed.");
require(virtualChannels[_vcID].sequence < updateSeq, "VC sequence is higher than update sequence.");
require(
virtualChannels[_vcID].ethBalances[1] < updateBal[1] && virtualChannels[_vcID].erc20Balances[1] < updateBal[3],
"State updates may only increase recipient balance."
);
require(
virtualChannels[_vcID].bond[0] == updateBal[0] + updateBal[1] &&
virtualChannels[_vcID].bond[1] == updateBal[2] + updateBal[3],
"Incorrect balances for bonded amount");
// Check time has passed on updateLCtimeout and has not passed the time to store a vc state
// virtualChannels[_vcID].updateVCtimeout should be 0 on uninitialized vc state, and this should
// fail if initVC() isn't called first
// require(Channels[_lcID].updateLCtimeout < now && now < virtualChannels[_vcID].updateVCtimeout);
require(Channels[_lcID].updateLCtimeout < now); // for testing!
bytes32 _updateState = keccak256(
abi.encodePacked(
_vcID,
updateSeq,
_partyA,
_partyB,
virtualChannels[_vcID].bond[0],
virtualChannels[_vcID].bond[1],
updateBal[0],
updateBal[1],
updateBal[2],
updateBal[3]
)
);
// Make sure Alice has signed a higher sequence new state
require(virtualChannels[_vcID].partyA == ECTools.recoverSigner(_updateState, sigA));
// store VC data
// we may want to record who is initiating on-chain settles
virtualChannels[_vcID].challenger = msg.sender;
virtualChannels[_vcID].sequence = updateSeq;
// channel state
virtualChannels[_vcID].ethBalances[0] = updateBal[0];
virtualChannels[_vcID].ethBalances[1] = updateBal[1];
virtualChannels[_vcID].erc20Balances[0] = updateBal[2];
virtualChannels[_vcID].erc20Balances[1] = updateBal[3];
virtualChannels[_vcID].updateVCtimeout = now + Channels[_lcID].confirmTime;
emit DidVCSettle(_lcID, _vcID, updateSeq, updateBal[0], updateBal[1], msg.sender, virtualChannels[_vcID].updateVCtimeout);
}
function closeVirtualChannel(bytes32 _lcID, bytes32 _vcID) public {
// require(updateLCtimeout > now)
require(Channels[_lcID].isOpen, "LC is closed.");
require(virtualChannels[_vcID].isInSettlementState, "VC is not in settlement state.");
require(virtualChannels[_vcID].updateVCtimeout < now, "Update vc timeout has not elapsed.");
require(!virtualChannels[_vcID].isClose, "VC is already closed");
// reduce the number of open virtual channels stored on LC
Channels[_lcID].numOpenVC--;
// close vc flags
virtualChannels[_vcID].isClose = true;
// re-introduce the balances back into the LC state from the settled VC
// decide if this lc is alice or bob in the vc
if(virtualChannels[_vcID].partyA == Channels[_lcID].partyAddresses[0]) {
Channels[_lcID].ethBalances[0] += virtualChannels[_vcID].ethBalances[0];
Channels[_lcID].ethBalances[1] += virtualChannels[_vcID].ethBalances[1];
Channels[_lcID].erc20Balances[0] += virtualChannels[_vcID].erc20Balances[0];
Channels[_lcID].erc20Balances[1] += virtualChannels[_vcID].erc20Balances[1];
} else if (virtualChannels[_vcID].partyB == Channels[_lcID].partyAddresses[0]) {
Channels[_lcID].ethBalances[0] += virtualChannels[_vcID].ethBalances[1];
Channels[_lcID].ethBalances[1] += virtualChannels[_vcID].ethBalances[0];
Channels[_lcID].erc20Balances[0] += virtualChannels[_vcID].erc20Balances[1];
Channels[_lcID].erc20Balances[1] += virtualChannels[_vcID].erc20Balances[0];
}
emit DidVCClose(_lcID, _vcID, virtualChannels[_vcID].erc20Balances[0], virtualChannels[_vcID].erc20Balances[1]);
}
// todo: allow ethier lc.end-user to nullify the settled LC state and return to off-chain
function byzantineCloseChannel(bytes32 _lcID) public {
Channel storage channel = Channels[_lcID];
// check settlement flag
require(channel.isOpen, "Channel is not open");
require(channel.isUpdateLCSettling == true);
require(channel.numOpenVC == 0);
require(channel.updateLCtimeout < now, "LC timeout over.");
// if off chain state update didnt reblance deposits, just return to deposit owner
uint256 totalEthDeposit = channel.initialDeposit[0] + channel.ethBalances[2] + channel.ethBalances[3];
uint256 totalTokenDeposit = channel.initialDeposit[1] + channel.erc20Balances[2] + channel.erc20Balances[3];
uint256 possibleTotalEthBeforeDeposit = channel.ethBalances[0] + channel.ethBalances[1];
uint256 possibleTotalTokenBeforeDeposit = channel.erc20Balances[0] + channel.erc20Balances[1];
if(possibleTotalEthBeforeDeposit < totalEthDeposit) {
channel.ethBalances[0]+=channel.ethBalances[2];
channel.ethBalances[1]+=channel.ethBalances[3];
} else {
require(possibleTotalEthBeforeDeposit == totalEthDeposit);
}
if(possibleTotalTokenBeforeDeposit < totalTokenDeposit) {
channel.erc20Balances[0]+=channel.erc20Balances[2];
channel.erc20Balances[1]+=channel.erc20Balances[3];
} else {
require(possibleTotalTokenBeforeDeposit == totalTokenDeposit);
}
// reentrancy
uint256 ethbalanceA = channel.ethBalances[0];
uint256 ethbalanceI = channel.ethBalances[1];
uint256 tokenbalanceA = channel.erc20Balances[0];
uint256 tokenbalanceI = channel.erc20Balances[1];
channel.ethBalances[0] = 0;
channel.ethBalances[1] = 0;
channel.erc20Balances[0] = 0;
channel.erc20Balances[1] = 0;
if(ethbalanceA != 0 || ethbalanceI != 0) {
channel.partyAddresses[0].transfer(ethbalanceA);
channel.partyAddresses[1].transfer(ethbalanceI);
}
if(tokenbalanceA != 0 || tokenbalanceI != 0) {
require(
channel.token.transfer(channel.partyAddresses[0], tokenbalanceA),
"byzantineCloseChannel: token transfer failure"
);
require(
channel.token.transfer(channel.partyAddresses[1], tokenbalanceI),
"byzantineCloseChannel: token transfer failure"
);
}
channel.isOpen = false;
numChannels--;
emit DidLCClose(_lcID, channel.sequence, ethbalanceA, ethbalanceI, tokenbalanceA, tokenbalanceI);
}
function _isContained(bytes32 _hash, bytes _proof, bytes32 _root) internal pure returns (bool) {
bytes32 cursor = _hash;
bytes32 proofElem;
for (uint256 i = 64; i <= _proof.length; i += 32) {
assembly { proofElem := mload(add(_proof, i)) }
if (cursor < proofElem) {
cursor = keccak256(abi.encodePacked(cursor, proofElem));
} else {
cursor = keccak256(abi.encodePacked(proofElem, cursor));
}
}
return cursor == _root;
}
//Struct Getters
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
);
}
function getVirtualChannel(bytes32 id) public view returns(
bool,
bool,
uint256,
address,
uint256,
address,
address,
address,
uint256[2],
uint256[2],
uint256[2]
) {
VirtualChannel memory virtualChannel = virtualChannels[id];
return(
virtualChannel.isClose,
virtualChannel.isInSettlementState,
virtualChannel.sequence,
virtualChannel.challenger,
virtualChannel.updateVCtimeout,
virtualChannel.partyA,
virtualChannel.partyB,
virtualChannel.partyI,
virtualChannel.ethBalances,
virtualChannel.erc20Balances,
virtualChannel.bond
);
}
} | 5 | spank_chain_payment.sol |
6,965 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
} | 0 | buggy_19.sol |
20,768 | function approve(address spender, uint256 tokens) public returns (bool success); | 0 | buggy_16.sol |
19,899 | function play_tmstmp3(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp3 = msg.sender;}} | 6 | buggy_44.sol |
5,698 | function increaseLockTime_intou33(uint _secondsToIncrease) public {
lockTime_intou33[msg.sender] += _secondsToIncrease; //overflow
} | 2 | buggy_43.sol |
19,673 | function depositToken(address token, uint amount) public {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
require(token!=address(0));
require(ERC20Essential(token).transferFrom(msg.sender, address(this), amount));
tokens[token][msg.sender] = tokens[token][msg.sender].add(amount);
emit Deposit(now, token, msg.sender, amount, tokens[token][msg.sender]);
} | 0 | buggy_35.sol |
1,017 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_23.sol |
1,738 | function transfer(address to, uint tokens) public returns (bool success); | 0 | buggy_47.sol |
22,225 | function bug_unchk_send26() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_23.sol |
17,436 | function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public {
require(balances_re_ent38[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent38[msg.sender] -= _weiToWithdraw;
} | 5 | buggy_11.sol |
18,028 | function play_tmstmp31(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp31 = msg.sender;}} | 6 | buggy_19.sol |
19,276 | function transferMasterRole(address newMaster) external onlyOwner
{
_transferMasterRole(newMaster);
} | 0 | buggy_7.sol |
13,719 | function approve(address spender, uint tokens) public returns (bool success); | 0 | buggy_48.sol |
19,095 | function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}} | 6 | buggy_23.sol |
21,390 | function operatorBurn(
address account,
uint256 amount,
bytes calldata data,
bytes calldata operatorData
) external; | 0 | buggy_30.sol |
15,601 | function findOnePercent(uint256 value) public view returns (uint256) {
uint256 roundValue = value.ceil(basePercent);
uint256 onePercent = roundValue.mul(basePercent).div(10000);
return onePercent;
} | 0 | buggy_27.sol |
15,193 | function withdraw_balances_re_ent36 () public {
if (msg.sender.send(balances_re_ent36[msg.sender ]))
balances_re_ent36[msg.sender] = 0;
} | 5 | buggy_30.sol |
21,182 | function bug_unchk_send21() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_19.sol |
15,295 | 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_18.sol |
12,589 | function claimReward_TOD2(uint256 submission) public {
require (!claimed_TOD2);
require(submission < 10);
msg.sender.transfer(reward_TOD2);
claimed_TOD2 = true;
} | 4 | buggy_35.sol |
16,063 | 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_22.sol |
6,154 | function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
} | 0 | buggy_11.sol |
Subsets and Splits