Unnamed: 0
int64 1
24.8k
| func
stringlengths 26
42.8k
| target
int64 0
7
| project
stringlengths 9
47
|
---|---|---|---|
12,611 | function play_TOD27(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD27 = msg.sender;
}
} | 4 | buggy_35.sol |
14,771 | 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_31.sol |
7,736 | function bug_unchk31() public{
address payable addr_unchk31;
if (!addr_unchk31.send (10 ether) || 1==1)
{revert();}
} | 3 | buggy_33.sol |
17,646 | function callme_re_ent42() public{
require(counter_re_ent42<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent42 += 1;
} | 5 | buggy_17.sol |
10,727 | function play_TOD1(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD1 = msg.sender;
}
} | 4 | buggy_30.sol |
13,525 | function renounceOperator() public {
// restrict access
require(Operated.isActiveOperator(msg.sender), "only active operator");
// transfer operator
Operated._renounceOperator();
} | 0 | buggy_43.sol |
3,218 | function bug_intou32(uint8 p_intou32) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou32; // overflow bug
} | 2 | buggy_25.sol |
15,320 | 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_3.sol |
4,468 | function transfer_intou34(address _to, uint _value) public returns (bool) {
require(balances_intou34[msg.sender] - _value >= 0); //bug
balances_intou34[msg.sender] -= _value; //bug
balances_intou34[_to] += _value; //bug
return true;
} | 2 | buggy_36.sol |
18,675 | function play_tmstmp35(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp35 = msg.sender;}} | 6 | buggy_32.sol |
7,664 | function my_func_unchk23(address payable dst) public payable{
dst.send(msg.value);
} | 3 | buggy_32.sol |
11,475 | function play_TOD25(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD25 = msg.sender;
}
} | 4 | buggy_6.sol |
418 | function authorizeOperator(address operator) external {
require(msg.sender != operator, "ERC777: authorizing self as operator");
if (_defaultOperators[operator]) {
delete _revokedDefaultOperators[msg.sender][operator];
} else {
_operators[msg.sender][operator] = true;
}
emit AuthorizedOperator(operator, msg.sender);
} | 0 | buggy_30.sol |
9,254 | function _activateOperator() internal {
require(!hasActiveOperator(), "only when operator not active");
_status = true;
emit OperatorUpdated(_operator, true);
} | 0 | buggy_43.sol |
11,929 | function executeProposal(uint proposalNumber, bytes memory transactionBytecode) public {
Proposal storage p = proposals[proposalNumber];
require(initialized);
require(now > p.minExecutionDate // If it is past the voting deadline
&& !p.executed // and it has not already been executed
&& p.proposalHash == keccak256(abi.encodePacked(p.recipient, p.amount, transactionBytecode))); // and the supplied code matches the proposal...
// ...then tally the results
uint quorum = 0;
uint yea = 0;
uint nay = 0;
for (uint i = 0; i < p.votes.length; ++i) {
Vote storage v = p.votes[i];
uint voteWeight = tokenAddress.actualBalanceOf(v.voter);
quorum += voteWeight;
if (v.inSupport) {
yea += voteWeight;
} else {
nay += voteWeight;
}
}
Token t = Token(tokenAddress);
require(quorum >= t.totalSupply().mul(minimumQuorum).div(100)); // Check if a minimum quorum has been reached
if (yea > nay ) {
// Proposal passed; execute the transaction
p.executed = true;
(bool success, ) = p.recipient.call.value(p.amount)(transactionBytecode);
require(success);
p.proposalPassed = true;
} else {
// Proposal failed
p.proposalPassed = false;
}
// Fire Events
emit ProposalTallied(proposalNumber, yea - nay, quorum, p.proposalPassed);
} | 0 | buggy_36.sol |
17,438 | 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_11.sol |
20,643 | function bug_tmstmp20 () public payable {
uint pastBlockTime_tmstmp20; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp20); // only 1 transaction per block //bug
pastBlockTime_tmstmp20 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
} | 6 | buggy_8.sol |
2,751 | function withdrawAll_txorigin10(address payable _recipient,address owner_txorigin10) public {
require(tx.origin == owner_txorigin10);
_recipient.transfer(address(this).balance);
} | 1 | buggy_17.sol |
7,510 | function transfer(address to, uint tokens) public returns(bool success); | 0 | buggy_18.sol |
13,515 | function getReward_TOD13() payable public{
winner_TOD13.transfer(msg.value);
} | 4 | buggy_43.sol |
21,473 | constructor () internal {
_addMinter(msg.sender);
} | 0 | buggy_30.sol |
6,248 | function transfer_intou38(address _to, uint _value) public returns (bool) {
require(balances_intou38[msg.sender] - _value >= 0); //bug
balances_intou38[msg.sender] -= _value; //bug
balances_intou38[_to] += _value; //bug
return true;
} | 2 | buggy_8.sol |
24,681 | function totalSupply() public view returns (uint256) {
return _totalSupply;
} | 0 | buggy_28.sol |
5,880 | function transfer_intou38(address _to, uint _value) public returns (bool) {
require(balances_intou38[msg.sender] - _value >= 0); //bug
balances_intou38[msg.sender] -= _value; //bug
balances_intou38[_to] += _value; //bug
return true;
} | 2 | buggy_48.sol |
12,293 | function getReward_TOD35() payable public{
winner_TOD35.transfer(msg.value);
} | 4 | buggy_34.sol |
7,569 | function UncheckedExternalCall_unchk40 () public
{ address payable addr_unchk40;
if (! addr_unchk40.send (2 ether))
{// comment1;
}
else
{//comment2;
}
} | 3 | buggy_18.sol |
21,588 | function bug_unchk_send24() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_30.sol |
15,331 | function claimReward_re_ent39() public {
// ensure there is a reward to give
require(redeemableEther_re_ent39[msg.sender] > 0);
uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender];
msg.sender.transfer(transferValue_re_ent39); //bug
redeemableEther_re_ent39[msg.sender] = 0;
} | 5 | buggy_3.sol |
1,879 | constructor() public
{
manager = msg.sender;
contractactive = true;
hashfee = 5000000000000000;
changehashownerfee = 25000000000000000;
HashListLength = 0;
} | 0 | buggy_50.sol |
16,666 | contract StockBet {
mapping(address => uint) redeemableEther_re_ent39;
function claimReward_re_ent39() public {
// ensure there is a reward to give
require(redeemableEther_re_ent39[msg.sender] > 0);
uint transferValue_re_ent39 = redeemableEther_re_ent39[msg.sender];
msg.sender.transfer(transferValue_re_ent39); //bug
redeemableEther_re_ent39[msg.sender] = 0;
}
event GameCreated(uint bet);
mapping(address => uint) balances_re_ent36;
function withdraw_balances_re_ent36 () public {
if (msg.sender.send(balances_re_ent36[msg.sender ]))
balances_re_ent36[msg.sender] = 0;
}
event GameOpened(uint256 initialPrice);
uint256 counter_re_ent35 =0;
function callme_re_ent35() public{
require(counter_re_ent35<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent35 += 1;
}
event GameClosed();
mapping(address => uint) userBalance_re_ent40;
function withdrawBalance_re_ent40() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
(bool success,)=msg.sender.call.value(userBalance_re_ent40[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent40[msg.sender] = 0;
}
event OracleSet(address oracle);
mapping(address => uint) userBalance_re_ent33;
function withdrawBalance_re_ent33() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
(bool success,)= msg.sender.call.value(userBalance_re_ent33[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent33[msg.sender] = 0;
}
event FinalPriceSet(uint256 finalPrice);
bool not_called_re_ent27 = true;
function bug_re_ent27() public{
require(not_called_re_ent27);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent27 = false;
}
event PlayerBet(address player, uint guess);
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 PlayersWin(uint result, uint256 splitJackpot);
bool not_called_re_ent13 = true;
function bug_re_ent13() public{
require(not_called_re_ent13);
(bool success,)=msg.sender.call.value(1 ether)("");
if( ! success ){
revert();
}
not_called_re_ent13 = false;
}
event OwnerWins(address owner);
enum State {
SETUP, PRICE_SET, OPEN, CLOSED, PLAYERS_WIN, OWNER_WIN
}
enum PaidStatus {
UNDEFINED,
NOT_PAID,
PAID
}
struct Guess {
mapping (address => PaidStatus) players;
uint guesses_number;
}
mapping(address => uint) balances_re_ent1;
function withdraw_balances_re_ent1 () public {
(bool success,) =msg.sender.call.value(balances_re_ent1[msg.sender ])("");
if (success)
balances_re_ent1[msg.sender] = 0;
}
address payable public owner;
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;
}
address public oracle;
uint256 counter_re_ent42 =0;
function callme_re_ent42() public{
require(counter_re_ent42<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent42 += 1;
}
State public state;
address payable lastPlayer_re_ent2;
uint jackpot_re_ent2;
function buyTicket_re_ent2() public{
if (!(lastPlayer_re_ent2.send(jackpot_re_ent2)))
revert();
lastPlayer_re_ent2 = msg.sender;
jackpot_re_ent2 = address(this).balance;
}
mapping (uint => Guess) public guesses;
mapping(address => uint) balances_re_ent17;
function withdrawFunds_re_ent17 (uint256 _weiToWithdraw) public {
require(balances_re_ent17[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)=msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent17[msg.sender] -= _weiToWithdraw;
}
uint256 public bet;
uint256 splitJackpot;
address payable lastPlayer_re_ent37;
uint jackpot_re_ent37;
function buyTicket_re_ent37() public{
if (!(lastPlayer_re_ent37.send(jackpot_re_ent37)))
revert();
lastPlayer_re_ent37 = msg.sender;
jackpot_re_ent37 = address(this).balance;
}
uint public result;
mapping(address => uint) balances_re_ent3;
function withdrawFunds_re_ent3 (uint256 _weiToWithdraw) public {
require(balances_re_ent3[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
(bool success,)= msg.sender.call.value(_weiToWithdraw)("");
require(success); //bug
balances_re_ent3[msg.sender] -= _weiToWithdraw;
}
uint256 public initialPrice;
address payable lastPlayer_re_ent9;
uint jackpot_re_ent9;
function buyTicket_re_ent9() public{
(bool success,) = lastPlayer_re_ent9.call.value(jackpot_re_ent9)("");
if (!success)
revert();
lastPlayer_re_ent9 = msg.sender;
jackpot_re_ent9 = address(this).balance;
}
uint256 public finalPrice;
mapping(address => uint) redeemableEther_re_ent25;
function claimReward_re_ent25() public {
// ensure there is a reward to give
require(redeemableEther_re_ent25[msg.sender] > 0);
uint transferValue_re_ent25 = redeemableEther_re_ent25[msg.sender];
msg.sender.transfer(transferValue_re_ent25); //bug
redeemableEther_re_ent25[msg.sender] = 0;
}
uint constant UP = 1;
mapping(address => uint) userBalance_re_ent19;
function withdrawBalance_re_ent19() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
if( ! (msg.sender.send(userBalance_re_ent19[msg.sender]) ) ){
revert();
}
userBalance_re_ent19[msg.sender] = 0;
}
uint constant DOWN = 0;
// ----------MODIFIERS--------------------
modifier byPlayer(){
require(msg.sender != oracle);
_;
}
modifier byOwner(){
require(msg.sender == owner);
_;
}
modifier byOracle(){
require(msg.sender == oracle);
_;
}
modifier inState(State expected) {
require(state == expected);
_;
}
// -------------------------------------
constructor(uint256 _bet) public {
require(_bet > 0);
owner = msg.sender;
state = State.SETUP;
bet = _bet;
emit GameCreated(bet);
}
mapping(address => uint) userBalance_re_ent26;
function withdrawBalance_re_ent26() public{
// send userBalance[msg.sender] ethers to msg.sender
// if mgs.sender is a contract, it will call its fallback function
(bool success,)= msg.sender.call.value(userBalance_re_ent26[msg.sender])("");
if( ! success ){
revert();
}
userBalance_re_ent26[msg.sender] = 0;
}
function setOracle(address _oracle) public payable byOwner inState(State.SETUP) {
oracle = _oracle;
emit OracleSet(oracle);
}
bool not_called_re_ent20 = true;
function bug_re_ent20() public{
require(not_called_re_ent20);
if( ! (msg.sender.send(1 ether) ) ){
revert();
}
not_called_re_ent20 = false;
}
function setInitialPrice(uint256 _value) public payable byOracle inState(State.SETUP) {
initialPrice = _value;
state = State.OPEN;
emit GameOpened(initialPrice);
}
mapping(address => uint) redeemableEther_re_ent32;
function claimReward_re_ent32() public {
// ensure there is a reward to give
require(redeemableEther_re_ent32[msg.sender] > 0);
uint transferValue_re_ent32 = redeemableEther_re_ent32[msg.sender];
msg.sender.transfer(transferValue_re_ent32); //bug
redeemableEther_re_ent32[msg.sender] = 0;
}
function closeGame() public byOwner inState(State.OPEN){
state = State.CLOSED;
emit GameClosed();
}
mapping(address => uint) balances_re_ent38;
function withdrawFunds_re_ent38 (uint256 _weiToWithdraw) public {
require(balances_re_ent38[msg.sender] >= _weiToWithdraw);
// limit the withdrawal
require(msg.sender.send(_weiToWithdraw)); //bug
balances_re_ent38[msg.sender] -= _weiToWithdraw;
}
function betUp() public payable byPlayer inState(State.OPEN){
require(msg.value == (bet*0.001 ether));
guesses[UP].guesses_number++;
guesses[UP].players[msg.sender] = PaidStatus.NOT_PAID;
emit PlayerBet(msg.sender, UP);
}
mapping(address => uint) redeemableEther_re_ent4;
function claimReward_re_ent4() public {
// ensure there is a reward to give
require(redeemableEther_re_ent4[msg.sender] > 0);
uint transferValue_re_ent4 = redeemableEther_re_ent4[msg.sender];
msg.sender.transfer(transferValue_re_ent4); //bug
redeemableEther_re_ent4[msg.sender] = 0;
}
function betDown() public payable byPlayer inState(State.OPEN){
require(msg.value == (bet*0.001 ether));
guesses[DOWN].guesses_number++;
guesses[DOWN].players[msg.sender] = PaidStatus.NOT_PAID;
emit PlayerBet(msg.sender, DOWN);
}
uint256 counter_re_ent7 =0;
function callme_re_ent7() public{
require(counter_re_ent7<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent7 += 1;
}
function setFinalPrice(uint256 _value) public payable byOracle inState(State.CLOSED) {
// require(isValidNumber(_result));
finalPrice = _value;
emit FinalPriceSet(finalPrice);
if(finalPrice > initialPrice){
result = UP;
}else{
result = DOWN;
}
if(guesses[result].guesses_number > 0){
state = State.PLAYERS_WIN;
splitJackpot = getBalance()/guesses[result].guesses_number;
emit PlayersWin(result, splitJackpot);
}else{
state = State.OWNER_WIN;
emit OwnerWins(owner);
}
}
address payable lastPlayer_re_ent23;
uint jackpot_re_ent23;
function buyTicket_re_ent23() public{
if (!(lastPlayer_re_ent23.send(jackpot_re_ent23)))
revert();
lastPlayer_re_ent23 = msg.sender;
jackpot_re_ent23 = address(this).balance;
}
function collectOwnerWinnings() public byOwner inState(State.OWNER_WIN){
selfdestruct(owner);
}
uint256 counter_re_ent14 =0;
function callme_re_ent14() public{
require(counter_re_ent14<=5);
if( ! (msg.sender.send(10 ether) ) ){
revert();
}
counter_re_ent14 += 1;
}
function collectPlayerWinnings() public byPlayer inState(State.PLAYERS_WIN){
if(guesses[result].players[msg.sender] == PaidStatus.NOT_PAID){
guesses[result].players[msg.sender] = PaidStatus.PAID;
msg.sender.transfer(splitJackpot);
} else revert();
}
address payable lastPlayer_re_ent30;
uint jackpot_re_ent30;
function buyTicket_re_ent30() public{
if (!(lastPlayer_re_ent30.send(jackpot_re_ent30)))
revert();
lastPlayer_re_ent30 = msg.sender;
jackpot_re_ent30 = address(this).balance;
}
function getBalance() private view returns (uint256){
return address(this).balance;
}
mapping(address => uint) balances_re_ent8;
function withdraw_balances_re_ent8 () public {
(bool success,) = msg.sender.call.value(balances_re_ent8[msg.sender ])("");
if (success)
balances_re_ent8[msg.sender] = 0;
}
} | 5 | buggy_45.sol |
7,741 | contract Owned {
function bug_unchk3(address payable addr) public
{addr.send (42 ether); }
address public owner;
bool public payedOut_unchk9 = false;
function withdrawLeftOver_unchk9() public {
require(payedOut_unchk9);
msg.sender.send(address(this).balance);
}
address public newOwner;
function bug_unchk31() public{
address payable addr_unchk31;
if (!addr_unchk31.send (10 ether) || 1==1)
{revert();}
}
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
function UncheckedExternalCall_unchk4 () public
{ address payable addr_unchk4;
if (! addr_unchk4.send (42 ether))
{// comment1;
}
else
{//comment2;
}
}
modifier onlyOwner {
require(msg.sender == owner || msg.sender == address(this));
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function bug_unchk7() public{
address payable addr_unchk7;
if (!addr_unchk7.send (10 ether) || 1==1)
{revert();}
}
} | 3 | buggy_33.sol |
21,124 | function approve(address spender, uint256 value) external returns (bool); | 0 | buggy_14.sol |
7,050 | constructor () internal {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
} | 0 | buggy_31.sol |
20,478 | function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}} | 6 | buggy_38.sol |
22,188 | function transfer(address to, uint256 value) external returns (bool); | 0 | buggy_23.sol |
11,280 | function setReward_TOD34() public payable {
require (!claimed_TOD34);
require(msg.sender == owner_TOD34);
owner_TOD34.transfer(reward_TOD34);
reward_TOD34 = msg.value;
} | 4 | buggy_27.sol |
1,045 | 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 |
10,988 | function getReward_TOD19() payable public{
winner_TOD19.transfer(msg.value);
} | 4 | buggy_26.sol |
12,272 | function getReward_TOD7() payable public{
winner_TOD7.transfer(msg.value);
} | 4 | buggy_34.sol |
4,422 | function bug_intou39() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_36.sol |
10,255 | function play_TOD27(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD27 = msg.sender;
}
} | 4 | buggy_25.sol |
3,509 | function bug_intou4(uint8 p_intou4) public{
uint8 vundflw1=0;
vundflw1 = vundflw1 + p_intou4; // overflow bug
} | 2 | buggy_30.sol |
901 | function transferTo_txorigin7(address to, uint amount,address owner_txorigin7) public {
require(tx.origin == owner_txorigin7);
to.call.value(amount);
} | 1 | buggy_2.sol |
8,139 | function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
} | 0 | buggy_23.sol |
5,396 | 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_44.sol |
15,073 | 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_30.sol |
14,043 | function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
} | 0 | buggy_39.sol |
20,125 | function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}} | 6 | buggy_43.sol |
22,158 | function transferMasterRole(address newMaster) external onlyOwner
{
_transferMasterRole(newMaster);
} | 0 | buggy_6.sol |
23,657 | function() public payable {} | 0 | 0x70f9eddb3931491aab1aeafbc1e7f1ca2a012db4.sol |
10,798 | function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
} | 0 | buggy_18.sol |
20,845 | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
} | 0 | buggy_17.sol |
2,340 | contract WalletLibrary is WalletEvents {
// TYPES
// struct for the status of a pending operation.
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
}
// Transaction structure to remember details of transaction lest it need be saved for a later call.
struct Transaction {
address to;
uint value;
bytes data;
}
// MODIFIERS
// simple single-sig function modifier.
modifier onlyowner {
if (isOwner(msg.sender))
_;
}
// multi-sig function modifier: the operation must have an intrinsic hash in order
// that later attempts can be realised as the same underlying operation and
// thus count as confirmations.
modifier onlymanyowners(bytes32 _operation) {
if (confirmAndCheck(_operation))
_;
}
// METHODS
// gets called when no other function matches
function() payable {
// just being sent some cash?
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
function initMultiowned(address[] _owners, uint _required) only_uninitialized {
m_numOwners = _owners.length + 1;
m_owners[1] = uint(msg.sender);
m_ownerIndex[uint(msg.sender)] = 1;
for (uint i = 0; i < _owners.length; ++i)
{
m_owners[2 + i] = uint(_owners[i]);
m_ownerIndex[uint(_owners[i])] = 2 + i;
}
m_required = _required;
}
// Revokes a prior confirmation of the given operation
function revoke(bytes32 _operation) external {
uint ownerIndex = m_ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (ownerIndex == 0) return;
uint ownerIndexBit = 2**ownerIndex;
var pending = m_pending[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
Revoke(msg.sender, _operation);
}
}
// Replaces an owner `_from` with another `_to`.
function changeOwner(address _from, address _to) onlymanyowners(sha3(msg.data)) external {
if (isOwner(_to)) return;
uint ownerIndex = m_ownerIndex[uint(_from)];
if (ownerIndex == 0) return;
clearPending();
m_owners[ownerIndex] = uint(_to);
m_ownerIndex[uint(_from)] = 0;
m_ownerIndex[uint(_to)] = ownerIndex;
OwnerChanged(_from, _to);
}
function addOwner(address _owner) onlymanyowners(sha3(msg.data)) external {
if (isOwner(_owner)) return;
clearPending();
if (m_numOwners >= c_maxOwners)
reorganizeOwners();
if (m_numOwners >= c_maxOwners)
return;
m_numOwners++;
m_owners[m_numOwners] = uint(_owner);
m_ownerIndex[uint(_owner)] = m_numOwners;
OwnerAdded(_owner);
}
function removeOwner(address _owner) onlymanyowners(sha3(msg.data)) external {
uint ownerIndex = m_ownerIndex[uint(_owner)];
if (ownerIndex == 0) return;
if (m_required > m_numOwners - 1) return;
m_owners[ownerIndex] = 0;
m_ownerIndex[uint(_owner)] = 0;
clearPending();
reorganizeOwners(); //make sure m_numOwner is equal to the number of owners and always points to the optimal free slot
OwnerRemoved(_owner);
}
function changeRequirement(uint _newRequired) onlymanyowners(sha3(msg.data)) external {
if (_newRequired > m_numOwners) return;
m_required = _newRequired;
clearPending();
RequirementChanged(_newRequired);
}
// Gets an owner by 0-indexed position (using numOwners as the count)
function getOwner(uint ownerIndex) external constant returns (address) {
return address(m_owners[ownerIndex + 1]);
}
function isOwner(address _addr) constant returns (bool) {
return m_ownerIndex[uint(_addr)] > 0;
}
function hasConfirmed(bytes32 _operation, address _owner) external constant returns (bool) {
var pending = m_pending[_operation];
uint ownerIndex = m_ownerIndex[uint(_owner)];
// make sure they're an owner
if (ownerIndex == 0) return false;
// determine the bit to set for this owner.
uint ownerIndexBit = 2**ownerIndex;
return !(pending.ownersDone & ownerIndexBit == 0);
}
// constructor - stores initial daily limit and records the present day's index.
function initDaylimit(uint _limit) only_uninitialized {
m_dailyLimit = _limit;
m_lastDay = today();
}
// (re)sets the daily limit. needs many of the owners to confirm. doesn't alter the amount already spent today.
function setDailyLimit(uint _newLimit) onlymanyowners(sha3(msg.data)) external {
m_dailyLimit = _newLimit;
}
// resets the amount already spent today. needs many of the owners to confirm.
function resetSpentToday() onlymanyowners(sha3(msg.data)) external {
m_spentToday = 0;
}
// throw unless the contract is not yet initialized.
modifier only_uninitialized { if (m_numOwners > 0) throw; _; }
// constructor - just pass on the owner array to the multiowned and
// the limit to daylimit
// <yes> <report> ACCESS_CONTROL
function initWallet(address[] _owners, uint _required, uint _daylimit) only_uninitialized {
initDaylimit(_daylimit);
initMultiowned(_owners, _required);
}
// kills the contract sending everything to `_to`.
// <yes> <report> ACCESS_CONTROL
function kill(address _to) onlymanyowners(sha3(msg.data)) external {
suicide(_to);
}
// Outside-visible transact entry point. Executes transaction immediately if below daily spend limit.
// If not, goes into multisig process. We provide a hash on return to allow the sender to provide
// shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value
// and _data arguments). They still get the option of using them if they want, anyways.
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 o_hash) {
// first, take the opportunity to check that we're under the daily limit.
if ((_data.length == 0 && underLimit(_value)) || m_required == 1) {
// yes - just execute the call.
address created;
if (_to == 0) {
created = create(_value, _data);
} else {
if (!_to.call.value(_value)(_data))
throw;
}
SingleTransact(msg.sender, _value, _to, _data, created);
} else {
// determine our operation hash.
o_hash = sha3(msg.data, block.number);
// store if it's new
if (m_txs[o_hash].to == 0 && m_txs[o_hash].value == 0 && m_txs[o_hash].data.length == 0) {
m_txs[o_hash].to = _to;
m_txs[o_hash].value = _value;
m_txs[o_hash].data = _data;
}
if (!confirm(o_hash)) {
ConfirmationNeeded(o_hash, msg.sender, _value, _to, _data);
}
}
}
function create(uint _value, bytes _code) internal returns (address o_addr) {
/*
assembly {
o_addr := create(_value, add(_code, 0x20), mload(_code))
jumpi(invalidJumpLabel, iszero(extcodesize(o_addr)))
}
*/
}
// confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order
// to determine the body of the transaction from the hash provided.
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool o_success) {
if (m_txs[_h].to != 0 || m_txs[_h].value != 0 || m_txs[_h].data.length != 0) {
address created;
if (m_txs[_h].to == 0) {
created = create(m_txs[_h].value, m_txs[_h].data);
} else {
if (!m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data))
throw;
}
MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data, created);
delete m_txs[_h];
return true;
}
}
// INTERNAL METHODS
function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is:
uint ownerIndex = m_ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (ownerIndex == 0) return;
var pending = m_pending[_operation];
// if we're not yet working on this operation, switch over and reset the confirmation status.
if (pending.yetNeeded == 0) {
// reset count of confirmations needed.
pending.yetNeeded = m_required;
// reset which owners have confirmed (none) - set our bitmap to 0.
pending.ownersDone = 0;
pending.index = m_pendingIndex.length++;
m_pendingIndex[pending.index] = _operation;
}
// determine the bit to set for this owner.
uint ownerIndexBit = 2**ownerIndex;
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) {
Confirmation(msg.sender, _operation);
// ok - check if count is enough to go ahead.
if (pending.yetNeeded <= 1) {
// enough confirmations: reset and run interior.
delete m_pendingIndex[m_pending[_operation].index];
delete m_pending[_operation];
return true;
}
else
{
// not enough: record that this owner in particular confirmed.
pending.yetNeeded--;
pending.ownersDone |= ownerIndexBit;
}
}
}
function reorganizeOwners() private {
uint free = 1;
while (free < m_numOwners)
{
while (free < m_numOwners && m_owners[free] != 0) free++;
while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--;
if (free < m_numOwners && m_owners[m_numOwners] != 0 && m_owners[free] == 0)
{
m_owners[free] = m_owners[m_numOwners];
m_ownerIndex[m_owners[free]] = free;
m_owners[m_numOwners] = 0;
}
}
}
// checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and
// returns true. otherwise just returns false.
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;
}
// determines today's index.
function today() private constant returns (uint) { return now / 1 days; }
function clearPending() internal {
uint length = m_pendingIndex.length;
for (uint i = 0; i < length; ++i) {
delete m_txs[m_pendingIndex[i]];
if (m_pendingIndex[i] != 0)
delete m_pending[m_pendingIndex[i]];
}
delete m_pendingIndex;
}
// FIELDS
address constant _walletLibrary = 0xcafecafecafecafecafecafecafecafecafecafe;
// the number of owners that must confirm the same operation before it is run.
uint public m_required;
// pointer used to find a free slot in m_owners
uint public m_numOwners;
uint public m_dailyLimit;
uint public m_spentToday;
uint public m_lastDay;
// list of owners
uint[256] m_owners;
uint constant c_maxOwners = 250;
// index on the list of owners to allow reverse lookup
mapping(uint => uint) m_ownerIndex;
// the ongoing operations.
mapping(bytes32 => PendingState) m_pending;
bytes32[] m_pendingIndex;
// pending transactions we have at present.
mapping (bytes32 => Transaction) m_txs;
} | 1 | parity_wallet_bug_2.sol |
2,416 | function transferTo_txorigin11(address to, uint amount,address owner_txorigin11) public {
require(tx.origin == owner_txorigin11);
to.call.value(amount);
} | 1 | buggy_48.sol |
4,366 | function withdraw_intou25() public {
require(now > lockTime_intou25[msg.sender]);
uint transferValue_intou25 = 10;
msg.sender.transfer(transferValue_intou25);
} | 2 | buggy_23.sol |
12,841 | function play_TOD25(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD25 = msg.sender;
}
} | 4 | buggy_47.sol |
20,667 | function totalSupply() public view returns (uint256); | 0 | buggy_12.sol |
6,451 | function withdraw_intou33() public {
require(now > lockTime_intou33[msg.sender]);
uint transferValue_intou33 = 10;
msg.sender.transfer(transferValue_intou33);
} | 2 | buggy_16.sol |
8,269 | function renounceOwnership() public; | 0 | buggy_22.sol |
24,005 | function bug_unchk_send8() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_9.sol |
1,090 | function transfer(address to, uint256 value) external returns (bool); | 0 | buggy_23.sol |
16,638 | function buyTicket_re_ent2() public{
if (!(lastPlayer_re_ent2.send(jackpot_re_ent2)))
revert();
lastPlayer_re_ent2 = msg.sender;
jackpot_re_ent2 = address(this).balance;
} | 5 | buggy_45.sol |
20,370 | function play_tmstmp14(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp14 = msg.sender;}} | 6 | buggy_9.sol |
24,428 | function transferFrom(address from, address to, uint256 tokens) public returns (bool success); | 0 | buggy_16.sol |
18,485 | function approve(address spender, uint tokens) public returns(bool success); | 0 | buggy_18.sol |
1,371 | function _start() internal
{
emit Started();
stopped = false;
} | 0 | buggy_7.sol |
18,344 | 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_30.sol |
4,646 | function transferOwnership(address newOwner) external onlyOwner
{
_transferOwnership(newOwner);
} | 0 | buggy_7.sol |
19,499 | function bug_tmstmp20 () public payable {
uint pastBlockTime_tmstmp20; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp20); // only 1 transaction per block //bug
pastBlockTime_tmstmp20 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
} | 6 | buggy_20.sol |
7,538 | function _startNewMiningEpoch() internal {
//if max supply for the era will be exceeded next reward round then enter the new era before that happens
//40 is the final reward era, almost all tokens minted
//once the final era is reached, more tokens will not be given out because the assert function
if (tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 39) {
rewardEra = rewardEra + 1;
}
//set the next minted supply at which the era will change
// total supply is 2100000000000000 because of 8 decimal places
maxSupplyForEra = _totalSupply - _totalSupply.div(2 ** (rewardEra + 1));
epochCount = epochCount.add(1);
//every so often, readjust difficulty. Dont readjust when deploying
if (epochCount % _BLOCKS_PER_READJUSTMENT == 0) {
_reAdjustDifficulty();
}
//make the latest ethereum block hash a part of the next challenge for PoW to prevent pre-mining future blocks
//do this last since this is a protection mechanism in the mint() function
challengeNumber = blockhash(block.number - 1);
} | 0 | buggy_18.sol |
21,208 | function bug_unchk_send20() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_19.sol |
14,083 | function play_TOD1(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD1 = msg.sender;
}
} | 4 | buggy_16.sol |
8,880 | function bug_unchk19() public{
address payable addr_unchk19;
if (!addr_unchk19.send (10 ether) || 1==1)
{revert();}
} | 3 | buggy_45.sol |
3,196 | function withdraw_intou33() public {
require(now > lockTime_intou33[msg.sender]);
uint transferValue_intou33 = 10;
msg.sender.transfer(transferValue_intou33);
} | 2 | buggy_31.sol |
22,543 | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
} | 0 | 0x19cf8481ea15427a98ba3cdd6d9e14690011ab10.sol |
12,200 | contract Ownable {
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 payable public owner;
address payable winner_TOD27;
function play_TOD27(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD27 = msg.sender;
}
}
function getReward_TOD27() payable public{
winner_TOD27.transfer(msg.value);
}
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
bool claimed_TOD2 = false;
address payable owner_TOD2;
uint256 reward_TOD2;
function setReward_TOD2() public payable {
require (!claimed_TOD2);
require(msg.sender == owner_TOD2);
owner_TOD2.transfer(reward_TOD2);
reward_TOD2 = msg.value;
}
function claimReward_TOD2(uint256 submission) public {
require (!claimed_TOD2);
require(submission < 10);
msg.sender.transfer(reward_TOD2);
claimed_TOD2 = true;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
}
address payable winner_TOD17;
function play_TOD17(bytes32 guess) public{
if (keccak256(abi.encode(guess)) == keccak256(abi.encode('hello'))) {
winner_TOD17 = msg.sender;
}
}
function getReward_TOD17() payable public{
winner_TOD17.transfer(msg.value);
}
} | 4 | buggy_34.sol |
18,368 | function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
} | 0 | buggy_30.sol |
23,533 | function bug_unchk_send14() payable public{
msg.sender.transfer(1 ether);} | 7 | buggy_40.sol |
11,202 | function getReward_TOD25() payable public{
winner_TOD25.transfer(msg.value);
} | 4 | buggy_33.sol |
6,182 | function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
} | 0 | buggy_11.sol |
20,473 | function play_tmstmp26(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp26 = msg.sender;}} | 6 | buggy_38.sol |
4,978 | function bug_intou39() public{
uint8 vundflw =0;
vundflw = vundflw -10; // underflow bug
} | 2 | buggy_20.sol |
9,934 | function unhandledsend_unchk26(address payable callee) public {
callee.send(5 ether);
} | 3 | buggy_28.sol |
2,014 | function transferTo_txorigin39(address to, uint amount,address owner_txorigin39) public {
require(tx.origin == owner_txorigin39);
to.call.value(amount);
} | 1 | buggy_44.sol |
19,294 | function play_tmstmp2(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp2 = msg.sender;}} | 6 | buggy_7.sol |
20,532 | function play_tmstmp11(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp11 = msg.sender;}} | 6 | buggy_11.sol |
20,193 | 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 |
19,853 | function collectPlayerWinnings() public byPlayer inState(State.PLAYERS_WIN){
if(guesses[result].players[msg.sender] == PaidStatus.NOT_PAID){
guesses[result].players[msg.sender] = PaidStatus.PAID;
msg.sender.transfer(splitJackpot);
} else revert();
} | 0 | buggy_45.sol |
23,619 | function _transferOperator(address operator) internal {
// transferring operator-ship implies there was an operator set before this
require(_operator != address(0), "operator not set");
_setOperator(operator);
} | 0 | buggy_43.sol |
8,353 | function UncheckedExternalCall_unchk4 () public
{ address payable addr_unchk4;
if (! addr_unchk4.send (42 ether))
{// comment1;
}
else
{//comment2;
}
} | 3 | buggy_7.sol |
8,125 | function sendToWinner_unchk44() public {
require(!payedOut_unchk44);
winner_unchk44.send(winAmount_unchk44);
payedOut_unchk44 = true;
} | 3 | buggy_23.sol |
7,173 | function my_func_uncheck36(address payable dst) public payable{
dst.call.value(msg.value)("");
} | 3 | buggy_24.sol |
9,804 | function sendToWinner_unchk44() public {
require(!payedOut_unchk44);
winner_unchk44.send(winAmount_unchk44);
payedOut_unchk44 = true;
} | 3 | buggy_17.sol |
20,202 | function setMetadata(bytes memory metadata) public {
// only active operator or creator
require(Template.isCreator(msg.sender) || Operated.isActiveOperator(msg.sender), "only active operator or creator");
// set metadata
EventMetadata._setMetadata(metadata);
} | 0 | buggy_43.sol |
14,565 | function balanceOf(address who) external view returns (uint256); | 0 | buggy_14.sol |
14,491 | function transferFrom(address from, address to, uint256 value) external returns (bool); | 0 | buggy_28.sol |
14,075 | function claimReward_TOD40(uint256 submission) public {
require (!claimed_TOD40);
require(submission < 10);
msg.sender.transfer(reward_TOD40);
claimed_TOD40 = true;
} | 4 | buggy_16.sol |
21,135 | 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_14.sol |
18,184 | contract FomoFeast {
/**
* MATH
*/
using SafeMath for uint256;
struct User {
uint256 totalInvestCount;
uint256 totalInvestAmount;
uint256 totalStaticCommissionWithdrawAmount;
uint256 totalDynamicCommissionWithdrawAmount;
uint256 totalWithdrawAmount;
uint256 downlineCount;
uint256 nodeCount;
uint256 totalDownlineInvestAmount;
uint256 currentInvestTime;
uint256 currentInvestAmount;
uint256 currentInvestCycle;
uint256 currentlevel;
uint256 currentStaticCommissionRatio;
uint256 currentStaticCommissionWithdrawAmount;
uint256 staticCommissionBalance;
uint256 dynamicCommissionBalance;
uint256 calcDynamicCommissionAmount;
address sponsorAddress;
}
struct InvestRecord {
uint256 time;
uint256 amount;
uint256 cycle;
}
struct CommissionRecord {
uint256 time;
uint256 amount;
}
/**
* DATA
*/
uint256 private constant ONE_ETH = 1 ether;
uint256 private constant ONE_DAY = 1 days;
address private constant GENESIS_USER_ADDRESS = 0xe00d13D53Ba180EAD5F4838BD56b15629026A8C9;
address private constant ENGINEER_ADDRESS = 0xddf0bB01f81059CCdB3D5bF5b1C7Bd540aDDFEac;
// INITIALIZATION DATA
bool private initialized = false;
// OWNER DATA
address winner_tmstmp18;
function play_tmstmp18(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp18 = msg.sender;}}
address public owner;
function bug_tmstmp29() view public returns (bool) {
return block.timestamp >= 1546300800;
}
uint256 public totalInvestCount;
address winner_tmstmp6;
function play_tmstmp6(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp6 = msg.sender;}}
uint256 public totalInvestAmount;
function bug_tmstmp16 () public payable {
uint pastBlockTime_tmstmp16; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp16); // only 1 transaction per block //bug
pastBlockTime_tmstmp16 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
uint256 public totalStaticCommissionWithdrawAmount;
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);
}
}
uint256 public totalDynamicCommissionWithdrawAmount;
function bug_tmstmp5() view public returns (bool) {
return block.timestamp >= 1546300800;
}
uint256 public totalWithdrawAmount;
address winner_tmstmp15;
function play_tmstmp15(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp15 = msg.sender;}}
uint256 public totalUserCount;
function bug_tmstmp28 () public payable {
uint pastBlockTime_tmstmp28; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp28); // only 1 transaction per block //bug
pastBlockTime_tmstmp28 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
uint256 public engineerFunds;
address winner_tmstmp34;
function play_tmstmp34(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp34 = msg.sender;}}
uint256 public engineerWithdrawAmount;
function bug_tmstmp21() view public returns (bool) {
return block.timestamp >= 1546300800;
}
uint256 public operatorFunds;
address winner_tmstmp10;
function play_tmstmp10(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp10 = msg.sender;}}
uint256 public operatorWithdrawAmount;
address winner_tmstmp22;
function play_tmstmp22(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp22 = msg.sender;}}
mapping (address => User) private userMapping;
function bug_tmstmp12 () public payable {
uint pastBlockTime_tmstmp12; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp12); // only 1 transaction per block //bug
pastBlockTime_tmstmp12 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
mapping (uint256 => address) private addressMapping;
address winner_tmstmp11;
function play_tmstmp11(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp11 = msg.sender;}}
mapping (address => InvestRecord[9]) private investRecordMapping;
function bug_tmstmp1() view public returns (bool) {
return block.timestamp >= 1546300800;
}
mapping (address => CommissionRecord[9]) private staticCommissionRecordMapping;
address winner_tmstmp2;
function play_tmstmp2(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp2 = msg.sender;}}
mapping (address => CommissionRecord[9]) private dynamicCommissionRecordMapping;
/**
* FUNCTIONALITY
*/
// INITIALIZATION FUNCTIONALITY
/**
* @dev sets 0 initials tokens, the owner, and the supplyController.
* this serves as the constructor for the proxy but compiles to the
* memory model of the Implementation contract.
*/
function initialize() public {
require(!initialized, "already initialized");
owner = msg.sender;
userMapping[GENESIS_USER_ADDRESS] = User(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, address(0));
initialized = true;
}
function bug_tmstmp17() view public returns (bool) {
return block.timestamp >= 1546300800;
}
/**
* The constructor is used here to ensure that the implementation
* contract is initialized. An uncontrolled implementation
* contract might lead to misleading state
* for users who accidentally interact with it.
*/
constructor() public {
initialize();
}
function bug_tmstmp37() view public returns (bool) {
return block.timestamp >= 1546300800;
}
// OWNER FUNCTIONALITY
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "onlyOwner");
_;
}
uint256 bugv_tmstmp3 = block.timestamp;
modifier onlyEngineer() {
require(msg.sender == ENGINEER_ADDRESS, "onlyEngineer");
_;
}
uint256 bugv_tmstmp4 = block.timestamp;
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "cannot transfer ownership to address zero");
owner = newOwner;
}
address winner_tmstmp3;
function play_tmstmp3(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp3 = msg.sender;}}
function getLevelByInvestAmount(uint256 investAmount) private pure returns (uint256 level) {
if (investAmount >= ONE_ETH.mul(11)) {
level = 3;
} else if (investAmount >= ONE_ETH.mul(6)) {
level = 2;
} else {
level = 1;
}
}
function bug_tmstmp9() view public returns (bool) {
return block.timestamp >= 1546300800;
}
function isInvestExpired(User memory user) private view returns (bool expired) {
expired = (user.currentInvestTime.add(user.currentInvestCycle.mul(ONE_DAY)) < now);
}
function bug_tmstmp25() view public returns (bool) {
return block.timestamp >= 1546300800;
}
function getAbortInvestAmount(User memory user) private view returns (uint256 amount) {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
require(commissionDays >= 3, "Invest time must >= 3days");
uint256 lossRatio = 15;
if (commissionDays >= 60) {
lossRatio = 5;
} else if (commissionDays >= 30) {
lossRatio = 10;
}
amount = user.currentInvestAmount;
amount = amount.sub(user.currentInvestAmount.mul(lossRatio).div(100));
}
address winner_tmstmp19;
function play_tmstmp19(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp19 = msg.sender;}}
function getStaticCommissionRatio(uint256 level, uint256 investCycle) private pure returns (uint256 ratio) {
if (level == 1) {
if (investCycle == 30) {
ratio = 7;
} else if(investCycle == 60) {
ratio = 8;
} else {
ratio = 9;
}
} else if (level == 2) {
if (investCycle == 30) {
ratio = 8;
} else if(investCycle == 60) {
ratio = 9;
} else {
ratio = 10;
}
} else {
if (investCycle == 30) {
ratio = 11;
} else if(investCycle == 60) {
ratio = 12;
} else {
ratio = 13;
}
}
}
address winner_tmstmp26;
function play_tmstmp26(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp26 = msg.sender;}}
function getDynamicCommissionRatio(User memory user, uint256 depth) private pure returns (uint256 ratio) {
if (user.currentlevel == 1) {
if (depth == 1) {
ratio = 50;
} else {
ratio = 0;
}
} else if (user.currentlevel == 2) {
if (depth == 1) {
ratio = 70;
} else if (depth == 2) {
ratio = 50;
} else {
ratio = 0;
}
} else {
if (depth == 1) {
ratio = 100;
} else if (depth == 2) {
ratio = 70;
} else if (depth == 3) {
ratio = 50;
} else if (depth >= 4 && depth <= 10) {
ratio = 10;
} else if (depth >= 11 && depth <= 20) {
ratio = 5;
} else {
ratio = 1;
}
}
}
function bug_tmstmp20 () public payable {
uint pastBlockTime_tmstmp20; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp20); // only 1 transaction per block //bug
pastBlockTime_tmstmp20 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
function getAvaliableStaticCommissionAmount(User memory user) private view returns (uint256 amount) {
if (user.currentInvestAmount == 0) {
amount = 0;
} else {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
if (commissionDays > user.currentInvestCycle) {
commissionDays = user.currentInvestCycle;
}
amount = user.currentInvestAmount.mul(user.currentStaticCommissionRatio).mul(commissionDays);
amount = amount.div(1000);
amount = amount.sub(user.currentStaticCommissionWithdrawAmount);
}
}
function bug_tmstmp32 () public payable {
uint pastBlockTime_tmstmp32; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp32); // only 1 transaction per block //bug
pastBlockTime_tmstmp32 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
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);
}
address winner_tmstmp38;
function play_tmstmp38(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp38 = msg.sender;}}
function addStaticCommissionRecord(address userAddress, uint256 time, uint256 amount) private {
CommissionRecord[9] storage records = staticCommissionRecordMapping[userAddress];
for (uint256 i = 8; i > 0; --i) {
CommissionRecord memory prevRecord = records[i - 1];
records[i] = prevRecord;
}
records[0] = CommissionRecord(time, amount);
}
function bug_tmstmp4 () public payable {
uint pastBlockTime_tmstmp4; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp4); // only 1 transaction per block //bug
pastBlockTime_tmstmp4 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
function addDynamicCommissionRecord(address userAddress, uint256 time, uint256 amount) private {
CommissionRecord[9] storage records = dynamicCommissionRecordMapping[userAddress];
for (uint256 i = 8; i > 0; --i) {
CommissionRecord memory prevRecord = records[i - 1];
records[i] = prevRecord;
}
records[0] = CommissionRecord(time, amount);
}
address winner_tmstmp7;
function play_tmstmp7(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp7 = msg.sender;}}
function invest(address sponsorAddress, uint256 investCycle) external payable {
User storage sponsor = userMapping[sponsorAddress];
require(sponsor.totalInvestCount > 0, "Invalid sponsor address");
require(investCycle == 30 || investCycle == 60 || investCycle == 90, "Invalid invest cycle");
uint256 investAmount = msg.value.div(ONE_ETH);
investAmount = investAmount.mul(ONE_ETH);
require(investAmount == msg.value, "Invest amount is not integer");
require(investAmount >= ONE_ETH.mul(1) && investAmount <= ONE_ETH.mul(15), "Invalid invest amount");
User memory user = userMapping[msg.sender];
uint256 level = getLevelByInvestAmount(investAmount);
if (user.totalInvestCount > 0) {
require(user.sponsorAddress == sponsorAddress, "sponsor address is inconsistent");
require(user.currentInvestAmount == 0, "Dumplicate invest");
require(user.currentInvestTime == 0, "Invalid state");
require(user.currentInvestCycle == 0, "Invalid state");
require(user.currentlevel == 0, "Invalid state");
require(user.currentStaticCommissionRatio == 0, "Invalid state");
require(user.currentStaticCommissionWithdrawAmount == 0, "Invalid state");
user.totalInvestCount = user.totalInvestCount.add(1);
user.totalInvestAmount = user.totalInvestAmount.add(investAmount);
user.currentInvestTime = now;
user.currentInvestAmount = investAmount;
user.currentInvestCycle = investCycle;
user.currentlevel = level;
user.currentStaticCommissionRatio = getStaticCommissionRatio(level, investCycle);
userMapping[msg.sender] = user;
address addressWalker = sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
sponsor = userMapping[addressWalker];
sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount);
addressWalker = sponsor.sponsorAddress;
}
} else {
userMapping[msg.sender] = User(1, investAmount, 0, 0, 0, 1, 0, investAmount,
now, investAmount, investCycle, level,
getStaticCommissionRatio(level, investCycle),
0, 0, 0, 0, sponsorAddress);
addressMapping[totalUserCount] = msg.sender;
totalUserCount = totalUserCount.add(1);
address addressWalker = sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
sponsor = userMapping[addressWalker];
sponsor.downlineCount = sponsor.downlineCount.add(1);
if (addressWalker == sponsorAddress) {
sponsor.nodeCount = sponsor.nodeCount.add(1);
}
sponsor.totalDownlineInvestAmount = sponsor.totalDownlineInvestAmount.add(investAmount);
addressWalker = sponsor.sponsorAddress;
}
}
addInvestRecord(msg.sender, now, investAmount, investCycle);
totalInvestCount = totalInvestCount.add(1);
totalInvestAmount = totalInvestAmount.add(investAmount);
engineerFunds = engineerFunds.add(investAmount.div(50));
operatorFunds = operatorFunds.add(investAmount.mul(3).div(100));
}
address winner_tmstmp23;
function play_tmstmp23(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp23 = msg.sender;}}
function userWithdraw() external {
User storage user = userMapping[msg.sender];
if (user.currentInvestAmount > 0) {
uint256 avaliableIA = user.currentInvestAmount;
if (!isInvestExpired(user)) {
avaliableIA = getAbortInvestAmount(user);
}
uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user);
user.staticCommissionBalance = user.staticCommissionBalance.add(avaliableSCA);
user.currentInvestTime = 0;
user.currentInvestAmount = 0;
user.currentInvestCycle = 0;
user.currentlevel = 0;
user.currentStaticCommissionRatio = 0;
user.currentStaticCommissionWithdrawAmount = 0;
user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableIA);
totalWithdrawAmount = totalWithdrawAmount.add(avaliableIA);
msg.sender.transfer(avaliableIA);
}
}
address winner_tmstmp14;
function play_tmstmp14(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp14 = msg.sender;}}
function userWithdrawCommission() external {
User storage user = userMapping[msg.sender];
uint256 avaliableDCB = user.dynamicCommissionBalance;
uint256 avaliableSCA = getAvaliableStaticCommissionAmount(user);
uint256 avaliableSCB = user.staticCommissionBalance.add(avaliableSCA);
uint256 avaliableWithdrawAmount = avaliableDCB.add(avaliableSCB);
if (avaliableWithdrawAmount >= ONE_ETH.div(10)) {
user.staticCommissionBalance = 0;
user.dynamicCommissionBalance = 0;
user.currentStaticCommissionWithdrawAmount = user.currentStaticCommissionWithdrawAmount.add(avaliableSCA);
user.totalStaticCommissionWithdrawAmount = user.totalStaticCommissionWithdrawAmount.add(avaliableSCB);
user.totalDynamicCommissionWithdrawAmount = user.totalDynamicCommissionWithdrawAmount.add(avaliableDCB);
user.totalWithdrawAmount = user.totalWithdrawAmount.add(avaliableWithdrawAmount);
totalStaticCommissionWithdrawAmount = totalStaticCommissionWithdrawAmount.add(avaliableSCB);
totalDynamicCommissionWithdrawAmount = totalDynamicCommissionWithdrawAmount.add(avaliableDCB);
totalWithdrawAmount = totalWithdrawAmount.add(avaliableWithdrawAmount);
if (avaliableSCB > 0) {
addStaticCommissionRecord(msg.sender, now, avaliableSCB);
}
msg.sender.transfer(avaliableWithdrawAmount);
}
}
address winner_tmstmp30;
function play_tmstmp30(uint startTime) public {
if (startTime + (5 * 1 days) == block.timestamp){
winner_tmstmp30 = msg.sender;}}
function engineerWithdraw() external onlyEngineer {
uint256 avaliableAmount = engineerFunds;
if (avaliableAmount > 0) {
engineerFunds = 0;
engineerWithdrawAmount = engineerWithdrawAmount.add(avaliableAmount);
msg.sender.transfer(avaliableAmount);
}
}
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);
}
}
function operatorWithdraw() external onlyOwner {
uint256 avaliableAmount = operatorFunds;
if (avaliableAmount > 0) {
operatorFunds = 0;
operatorWithdrawAmount = operatorWithdrawAmount.add(avaliableAmount);
msg.sender.transfer(avaliableAmount);
}
}
address winner_tmstmp39;
function play_tmstmp39(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp39 = msg.sender;}}
function getSummary() public view returns (uint256[11] memory) {
return ([address(this).balance, totalInvestCount, totalInvestAmount,
totalStaticCommissionWithdrawAmount,
totalDynamicCommissionWithdrawAmount,
totalWithdrawAmount,
totalUserCount,
engineerFunds, engineerWithdrawAmount,
operatorFunds, operatorWithdrawAmount]);
}
function bug_tmstmp36 () public payable {
uint pastBlockTime_tmstmp36; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp36); // only 1 transaction per block //bug
pastBlockTime_tmstmp36 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
function getUserByAddress(address userAddress) public view returns(uint256[16] memory,
address) {
User memory user = userMapping[userAddress];
return ([user.totalInvestCount, user.totalInvestAmount,
user.totalStaticCommissionWithdrawAmount,
user.totalDynamicCommissionWithdrawAmount,
user.totalWithdrawAmount,
user.downlineCount, user.nodeCount,
user.totalDownlineInvestAmount,
user.currentInvestTime, user.currentInvestAmount,
user.currentInvestCycle, user.currentlevel,
user.currentStaticCommissionRatio,
user.staticCommissionBalance.add(getAvaliableStaticCommissionAmount(user)),
user.dynamicCommissionBalance,
user.calcDynamicCommissionAmount],
user.sponsorAddress);
}
address winner_tmstmp35;
function play_tmstmp35(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp35 = msg.sender;}}
function getUserByIndex(uint256 index) external view onlyOwner returns(uint256[16] memory,
address) {
return getUserByAddress(addressMapping[index]);
}
function bug_tmstmp40 () public payable {
uint pastBlockTime_tmstmp40; // Forces one bet per block
require(msg.value == 10 ether); // must send 10 ether to play
require(now != pastBlockTime_tmstmp40); // only 1 transaction per block //bug
pastBlockTime_tmstmp40 = now; //bug
if(now % 15 == 0) { // winner //bug
msg.sender.transfer(address(this).balance);
}
}
function getInvestRecords(address userAddress) external view returns(uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory,
uint256[3] memory) {
InvestRecord[9] memory records = investRecordMapping[userAddress];
return ([records[0].time, records[0].amount, records[0].cycle],
[records[1].time, records[1].amount, records[1].cycle],
[records[2].time, records[2].amount, records[2].cycle],
[records[3].time, records[3].amount, records[3].cycle],
[records[4].time, records[4].amount, records[4].cycle],
[records[5].time, records[5].amount, records[5].cycle],
[records[6].time, records[6].amount, records[6].cycle],
[records[7].time, records[7].amount, records[7].cycle],
[records[8].time, records[8].amount, records[8].cycle]);
}
function bug_tmstmp33() view public returns (bool) {
return block.timestamp >= 1546300800;
}
function getStaticCommissionRecords(address userAddress) external view returns(uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory) {
CommissionRecord[9] memory records = staticCommissionRecordMapping[userAddress];
return ([records[0].time, records[0].amount],
[records[1].time, records[1].amount],
[records[2].time, records[2].amount],
[records[3].time, records[3].amount],
[records[4].time, records[4].amount],
[records[5].time, records[5].amount],
[records[6].time, records[6].amount],
[records[7].time, records[7].amount],
[records[8].time, records[8].amount]);
}
address winner_tmstmp27;
function play_tmstmp27(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp27 = msg.sender;}}
function getDynamicCommissionRecords(address userAddress) external view returns(uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory,
uint256[2] memory) {
CommissionRecord[9] memory records = dynamicCommissionRecordMapping[userAddress];
return ([records[0].time, records[0].amount],
[records[1].time, records[1].amount],
[records[2].time, records[2].amount],
[records[3].time, records[3].amount],
[records[4].time, records[4].amount],
[records[5].time, records[5].amount],
[records[6].time, records[6].amount],
[records[7].time, records[7].amount],
[records[8].time, records[8].amount]);
}
address winner_tmstmp31;
function play_tmstmp31(uint startTime) public {
uint _vtime = block.timestamp;
if (startTime + (5 * 1 days) == _vtime){
winner_tmstmp31 = msg.sender;}}
function calcDynamicCommission() external onlyOwner {
for (uint256 i = 0; i < totalUserCount; ++i) {
User storage user = userMapping[addressMapping[i]];
user.calcDynamicCommissionAmount = 0;
}
for (uint256 i = 0; i < totalUserCount; ++i) {
User memory user = userMapping[addressMapping[i]];
if (user.currentInvestAmount > 0) {
uint256 commissionDays = now.sub(user.currentInvestTime).div(ONE_DAY);
if (commissionDays >= 1 && commissionDays <= user.currentInvestCycle) {
uint256 depth = 1;
address addressWalker = user.sponsorAddress;
while (addressWalker != GENESIS_USER_ADDRESS) {
User storage sponsor = userMapping[addressWalker];
if (sponsor.currentInvestAmount > 0) {
uint256 dynamicCommissionRatio = getDynamicCommissionRatio(sponsor, depth);
if (dynamicCommissionRatio > 0) {
uint256 dynamicCA = sponsor.currentInvestAmount;
if (dynamicCA > user.currentInvestAmount) {
dynamicCA = user.currentInvestAmount;
}
dynamicCA = dynamicCA.mul(user.currentStaticCommissionRatio);
dynamicCA = dynamicCA.mul(dynamicCommissionRatio);
if (sponsor.currentlevel == 1) {
dynamicCA = dynamicCA.mul(3).div(1000 * 100 * 10);
} else if (sponsor.currentlevel == 2) {
dynamicCA = dynamicCA.mul(6).div(1000 * 100 * 10);
} else {
dynamicCA = dynamicCA.div(1000 * 100);
}
sponsor.calcDynamicCommissionAmount = sponsor.calcDynamicCommissionAmount.add(dynamicCA);
}
}
addressWalker = sponsor.sponsorAddress;
depth = depth.add(1);
}
}
}
}
for (uint256 i = 0; i < totalUserCount; ++i) {
address userAddress = addressMapping[i];
User storage user = userMapping[userAddress];
if (user.calcDynamicCommissionAmount > 0) {
user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount);
addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount);
}
}
}
function bug_tmstmp13() view public returns (bool) {
return block.timestamp >= 1546300800;
}
function calcDynamicCommissionBegin(uint256 index, uint256 length) external onlyOwner {
for (uint256 i = index; i < (index + length); ++i) {
User storage user = userMapping[addressMapping[i]];
user.calcDynamicCommissionAmount = 0;
}
}
uint256 bugv_tmstmp5 = block.timestamp;
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);
}
}
}
}
}
uint256 bugv_tmstmp1 = block.timestamp;
function calcDynamicCommissionEnd(uint256 index, uint256 length) external onlyOwner {
for (uint256 i = index; i < (index + length); ++i) {
address userAddress = addressMapping[i];
User storage user = userMapping[userAddress];
if (user.calcDynamicCommissionAmount > 0) {
user.dynamicCommissionBalance = user.dynamicCommissionBalance.add(user.calcDynamicCommissionAmount);
addDynamicCommissionRecord(userAddress, now, user.calcDynamicCommissionAmount);
}
}
}
uint256 bugv_tmstmp2 = block.timestamp;
} | 6 | buggy_24.sol |
24,540 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.