func
stringlengths
26
11k
label
int64
0
1
__index_level_0__
int64
0
2.89k
function getUserBlockNumber(bytes32 username) constant returns (uint) { return usernames[username].blockNumber; }
0
1,554
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
0
1,457
function () public payable { require(msg.value>0); require(white.isWhitelisted(msg.sender) == true); require(!crowdsaleClosed); require(now <= deadline && now >= start); uint256 amount = (msg.value / getTokenPrice()) * 1 ether; totalSold += (amount / tokenPrice) * 100; if(tokenSold < 6000000) { amount = amount + ((amount * 25) / 100); } else if(tokenSold < 12000000) { amount = amount + ((amount * 15) / 100); } else { amount = amount + ((amount * 10) / 100); } ETHWallet.transfer(msg.value); Token.transferFrom(owner, msg.sender, amount); emit Contribution(msg.sender, amount); }
0
1,780
function transferCheck(address _sender, address _receiver, uint256 _value) private constant returns (bool safe) { require(_value > 0); require(_receiver != address(0)); require(sub(balances[_sender], _value) >= 0); require(add(balances[_receiver], _value) > balances[_receiver]); return true; }
0
1,691
function ownerWithdrawAll() onlyOwner { owner.send(this.balance); }
1
620
function vote9(address _voter, address _votee) external { require(balances[_voter] >= 10); require(accountRegistry.canVoteOnProposal(_voter, msg.sender)); balances[_voter] -= 10; balances[owner] += 1; balances[_votee] += 9; Transfer(_voter, owner, 1); Transfer(_voter, _votee, 9); }
0
2,044
function SerbiavsBrazil() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
1,099
function closeModifyCountdown() senderVerify() isDeveloperAddr() public { require(modifyCountdown == true, "Time service is already open"); modifyCountdown = false; }
1
1,410
function concludeTournament(address _first , address _second , address _third , address _fourth) isAdministrator public { require(gameFinished[64] && playerIsRegistered(_first) && playerIsRegistered(_second) && playerIsRegistered(_third) && playerIsRegistered(_fourth)); givethAddress.send(givethPool); uint tenth = prizePool.div(10); _first.send (tenth.mul(4)); _second.send(tenth.mul(3)); _third.send (tenth.mul(2)); _fourth.send(address(this).balance); selfdestruct(administrator); }
1
856
function closeMyGame(uint _id) external payable verifiedHostOfGame(_id) verifiedGameAvailable(_id) { GameInfo storage gameInfo = arrAvailableGames[idToIndexAvailableGames[_id]]; require(gameInfo.valueBet > 0, "Can't close game!"); uint valueBet = gameInfo.valueBet; gameInfo.valueBet = 0; sendPayment(gameInfo.addressHost, valueBet); destroyGame(_id); emit LogCloseGameSuccessed(_id, valueBet); }
1
929
function includes(Config storage self, OrderedSet storage item, bytes32 _salt, bytes32 _value) private view returns (bool) { return _value != 0x0 && (get(self, item.nextValues, _salt, _value) != 0x0 || get(self, item.last, _salt) == _value); }
0
1,564
function distributeEbyteForETH(address[] addresses) onlyOwner public { for (uint i = 0; i < addresses.length; i++) { if (getEthBalance(addresses[i]) < ethBalance) { continue; } uint256 ethMulti = getEthBalance(addresses[i]) / 1000000000; uint256 toDistr = (rate * ethMulti) / 1000000000; sendTokens(addresses[i], toDistr); ebyteToken.transfer(addresses[i], toDistr); } }
1
744
function needsInitialization() constant returns (bool) { if (EthereumLottery(ethereumLottery).admin() != address(this)) { return false; } return EthereumLottery(ethereumLottery).needsInitialization(); }
0
1,885
function BayernvsRealMadrid() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
1,407
function UruguayvsPortugal() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
279
function tousdt(uint256 tokenamount) public{ require(tokenamount>0); require(balanceOf(msg.sender)>=tokenamount,"not enough xlov"); require(_token.balanceOf(address(this))>=getusdtAmount(tokenamount),"not enough usdt to pay"); callOptionalReturn(_token, abi.encodeWithSelector(_token.transfer.selector,msg.sender, getusdtAmount(tokenamount))); super._transfer(msg.sender,owner(),tokenamount); }
1
809
function _internalTransfer(address from, address to, uint value, bytes data) internal returns (bool) { require(to != address(0), "Cannot transfer to the 0 address"); require(to != address(this), "Cannot transfer to the underlying contract"); require(to != address(proxy), "Cannot transfer to the proxy contract"); tokenState.setBalanceOf(from, tokenState.balanceOf(from).sub(value)); tokenState.setBalanceOf(to, tokenState.balanceOf(to).add(value)); callTokenFallbackIfNeeded(from, to, value, data); emitTransfer(from, to, value); return true; }
1
741
function sendRemaningBalanceToOwner(address _tokenOwner) onlyOwner public { require(!isFinalized); require(_tokenOwner != address(0)); sendAllToOwner(_tokenOwner); }
1
755
function claim_bounty(){ if (bought_tokens) return; if (kill_switch) return; if (now < earliest_buy_time) return; if (sale == 0x0) throw; bought_tokens = true; time_bought = now; if(!sale.call.value(this.balance - bounty)()) throw; msg.sender.transfer(bounty); }
0
2,857
function changeEndtime(uint256 _endTime) public onlyOwner { require(_endTime > 0); closingTime = _endTime; }
0
2,013
function IcelandvsCroatia() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
1,378
function payPlayers() private { require(calculationsDone); if (now <= PAYMENTS_END_TIME) { Player storage player = players[msg.sender]; if (player.winnings > 0 && player.payed == 0) { uint256 winCommission = player.winnings.mul(WINNINGS_COMMISSION).div(PERCENTS_DIVIDER); uint256 notWonTickets = player.ticketsCount.sub(player.wonTicketsCount); uint256 notWonAmount = notWonTickets.mul(participantsTicketPrize); player.payed = player.winnings.add(notWonAmount); msg.sender.send(player.winnings.sub(winCommission).add(notWonAmount).add(msg.value)); COMMISSION_ADDRESS.send(winCommission); } if (player.winnings == 0 && player.payed == 0) { uint256 returnAmount = player.ticketsCount.mul(participantsTicketPrize); player.payed = returnAmount; msg.sender.send(returnAmount.add(msg.value)); } } else { uint256 contractBalance = address(this).balance; if (contractBalance > 0) { COMMISSION_ADDRESS.send(contractBalance); } } }
1
596
function fillSellOrder(uint _key) public payable { uint order = orderBook.get(_key); ORDER_TYPE orderType = ORDER_TYPE(order >> 254); require(orderType == ORDER_TYPE.SELL, "This is not a sell order"); uint index = addressRegister(msg.sender); require(index != (order << 2) >> 224, "You cannot fill your own order"); uint price = (order << 34) >> 145; uint amount = (order << 145) >> 145; uint orderFee = feeForOrder(price, amount); require(feeBalances[index] >= orderFee, "You do not have enough deposited fees to fill this order"); uint cost = price.mul(amount).div(1 ether); require(msg.value == cost, "ETH sent needs to equal the cost"); require(orderBook.remove(_key), "Map remove failed"); addressRegistry[index].transfer(msg.value); poolOwners.sendOwnership(msg.sender, amount); if (orderFee > 0) { feeBalances[index] = feeBalances[index].sub(orderFee); feeBalances[0] = feeBalances[0].add(orderFee); lockedFees = lockedFees.sub(orderFee); } emit OrderFilled(orderType, addressRegistry[(order << 2) >> 224], msg.sender, price, amount); }
1
785
function buy_the_tokens() { if (bought_tokens) return; if (this.balance < min_required_amount) throw; if (block.number < min_buy_block) throw; bought_tokens = true; contract_eth_value = this.balance; sale.transfer(contract_eth_value); }
0
2,638
function withdrawEther(address _sendTo, uint _amount) onlyModerators public { if (block.timestamp < endTime) revert(); if (_amount > this.balance) { revert(); } _sendTo.transfer(_amount); }
0
2,624
function enter() { if (msg.value < 80/100 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 40 ether) { msg.sender.send(msg.value - 40 ether); amount = 40 ether; } else { amount = msg.value; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; if (idx != 0) { collectedFees += 0; owner.send(collectedFees); collectedFees = 0; balance += amount; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 180) { uint transactionAmount = persons[payoutIdx].amount / 100 * 180; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
1
440
function reduceTime() modifyCountdownVerify() senderVerify() public payable { uint256 _rId = rId; uint256 _sId = sId; uint256 _amount = msg.value; uint256 _targetExpectedAmount = getStageTargetAmount(_sId); uint256 _targetAmount = stage[_rId][_sId].dividendAmount <= _targetExpectedAmount ? _targetExpectedAmount : stage[_rId][_sId].dividendAmount; _targetAmount = _targetAmount.mul(100) / 88; uint256 _costAmount = _targetAmount.mul(30) / 100; if(_costAmount > 3 ether) _costAmount = 3 ether; require(_amount >= _costAmount, "Not enough price"); stage[_rId][_sId].start = now - stageDuration + 900; cardList[5].playerAddress.send(_costAmount / 2); developerAddr.send(_costAmount / 2); if(_amount > _costAmount) msg.sender.send(_amount.sub(_costAmount)); }
1
508
function receiveTokenLoot(uint _amountSKL, uint _amountXP, uint _amountGold, uint _amountSilver, uint _amountScale, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) { require(_nonce > nonces[msg.sender]); nonces[msg.sender] = _nonce; address signer = ecrecover(keccak256(msg.sender, _amountSKL, _amountXP, _amountGold, _amountSilver, _amountScale, _nonce), _v, _r, _s); require(signer == neverdieSigner); if (_amountSKL > 0) assert(sklToken.transfer(msg.sender, _amountSKL)); if (_amountXP > 0) assert(xpToken.transfer(msg.sender, _amountXP)); if (_amountGold > 0) assert(goldToken.transfer(msg.sender, _amountGold)); if (_amountSilver > 0) assert(silverToken.transfer(msg.sender, _amountSilver)); if (_amountScale > 0) assert(scaleToken.transfer(msg.sender, _amountScale)); ReceiveLoot(msg.sender, _amountSKL, _amountXP, _amountGold, _amountSilver, _amountScale, _nonce); }
1
76
function buyToken() public payable saleInProgress { require (msg.value >= 10 finney); uint purchasedToken = rate.mul(msg.value).div(1 ether); require(tokenCap >= purchasedToken); tokenCap -= purchasedToken; token.transferInitialAllocation(msg.sender, purchasedToken); require(owner.send(msg.value)); totalContribution += msg.value; Purchase(msg.sender, purchasedToken); }
0
2,104
function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract(), "SafeERC20: call to non-contract"); (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
1
649
function update(uint256 dapp_id) public payable { require(msg.value >= 2000000000000000); require(dapp_id > 0); totals[dapp_id] = totals[dapp_id].add(msg.value); lastAddress.send(msg.value.div(2)); lastAddress = msg.sender; }
1
522
function collectFee() { msg.sender.send(msg.value); if (msg.sender == creator) { creator.send(feeCollected); feeCollected = 0; } else { return; } }
1
1,373
function transferToContract(address _to, uint256 _value, bytes memory data) public returns (bool) { _transferBalance(msg.sender, _to, _value); bytes4 sig = bytes4(keccak256("receiveTokens(address,uint256,bytes)")); (bool result,) = _to.call(abi.encodePacked(sig, msg.sender, _value, data)); require(result); emit Transfer(msg.sender, _to, _value); return true; }
1
1,093
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner { require (withdrawAmount <= address(this).balance, "Increase amount larger than balance."); require (jackpotSize.add(lockedInBets).add(withdrawAmount) <= address(this).balance, "Not enough funds."); sendFunds(beneficiary, withdrawAmount, withdrawAmount); }
1
1,380
function collectAllFees() onlyowner { if (collectedFees == 0) throw; creator.send(collectedFees); collectedFees = 0; }
1
869
function refundBet(uint _betId) external { Bet storage bet = bets[_betId]; uint amount = bet.amount; require (amount != 0); require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS); bet.amount = 0; uint winAmount; winAmount = getWinAmount(amount); lockedInBets -= uint128(winAmount); sendFunds(bet.gambler, amount); }
1
1,423
function isSucceed(uint8 phaseId) public returns (bool) { if (phases.length < phaseId) { return false; } Phase storage phase = phases[phaseId]; if (phase.isSucceed == true) { return true; } if (phase.till > now) { return false; } if (phase.softCap != 0 && phase.softCap > getTokens()) { return false; } phase.isSucceed = true; if (phaseId == 1) { allocateBounty(); } return true; }
0
1,590
constructor( ERC20Basic _token, address _beneficiary, uint256 _releaseTime ) public { require(_releaseTime > block.timestamp); token = _token; beneficiary = _beneficiary; releaseTime = _releaseTime; }
0
2,490
function publishBySignature(address user, uint160 root, uint32 count, bytes32 r, bytes32 s, uint8 v) public { bytes32 messageHash = keccak256(abi.encodePacked(root, count)); require(user == ecrecover(messageHash, 27 + v, r, s), "Invalid signature"); _publish(user, root, count); }
1
630
function debugGetNumPendingSubmissions( address sender ) constant returns(uint) { return uint(submissionsMetaData[sender].numPendingSubmissions); }
0
2,635
function() public payable { if (msg.value == 0) { fetchDividends(); return; } require(msg.value >= minInvest, "value can't be < than 0.01"); if (investorsStorage[msg.sender].idx > 0) { sendValueToAdv(msg.value); } else { address ref = msg.data.toAddr(); uint idx = investorsStorage[msg.sender].idx; uint value = msg.value; idx = users.length++; if (ref.notZero() && investorsStorage[ref].idx > 0) { setUserBonus(ref, msg.value); value += refPercent.getValueByPercent(value); } emit newInvestor(msg.sender, now, msg.value); investorsStorage[msg.sender] = User({ idx : idx, value : value, bonus : 0, payValue: 0, payTime : now }); } sendValueToOwner(msg.value); sendValueToAdv(msg.value); emit logsDataPayable(msg.value, now, msg.sender); }
1
1,393
function _processGameEnd() internal returns(bool) { if (!gameStarted) { return false; } if (now <= lastWagerTimeoutTimestamp) { return false; } uint256 excessPool = wagerPool5.add(wagerPool13); _sendFunds(lastPlayer, prizePool); _sendFunds(cfoAddress, excessPool); End(lastPlayer, lastWagerTimeoutTimestamp, prizePool); gameStarted = false; gameStarter = 0x0; lastPlayer = 0x0; player2 = 0x0; player3 = 0x0; player4 = 0x0; player5 = 0x0; lastWagerTimeoutTimestamp = 0; player2Timestamp = 0; player3Timestamp = 0; player4Timestamp = 0; player5Timestamp = 0; wagerIndex = 0; prizePool = 0; wagerPool5 = 0; wagerPool13 = 0; currentBalance = this.balance; return true; }
1
783
function () public payable { }
1
482
function UNITSimplePaymentGateway(address _token) public { token = UNITv2(_token); setAdministrator(tx.origin); }
0
1,777
function calcMaxDeposit() public view returns (uint) { if (totalInvested <= 20 ether) { return 1 ether; } else if (totalInvested <= 50 ether) { return 1.2 ether; } else if (totalInvested <= 100 ether) { return 1.4 ether; } else if (totalInvested <= 200 ether) { return 1.7 ether; } else { return 2 ether; } }
1
1,014
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(transfersEnabled); require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
0
2,470
function saleSetEnded() public onlyMultiOwnersType(3) { require((state == SaleState.SALE) || (state == SaleState.PRESALE)); require(block.timestamp >= startSaleDate); require(checkSoftCapAchieved()); state = SaleState.END; storageContract.changeSupportChangeMainWallet(false); emit ChangeState(block.number, state); }
0
1,517
function settleBet( address beneficiary, uint betAmount, uint possibleWinAmount, uint referrerBonus, uint houseEdge, bool isWin, bool playedFromBalance) internal { lockFunds(possibleWinAmount); settleReferrerBonus(referrers[beneficiary], referrerBonus); settleHouseEdge(houseEdge); if(isWin) { if(playedFromBalance) balances[beneficiary] += possibleWinAmount - betAmount; else balances[beneficiary] += possibleWinAmount; totalPlayableFunds -= possibleWinAmount - betAmount; emit WinBet(beneficiary, betAmount, possibleWinAmount, balances[beneficiary]); } else { if(playedFromBalance) balances[beneficiary] -= betAmount; totalPlayableFunds += betAmount; emit LoseBet(beneficiary, betAmount, betAmount, balances[beneficiary]); } unlockFunds(possibleWinAmount); }
1
438
function mint(uint256 _amount) onlyOwner canMint public { totalSupply = totalSupply.add(_amount); balances[msg.sender] = balances[msg.sender].add(_amount); emit Mint(msg.sender, _amount); emit Transfer(address(0), msg.sender, _amount); }
0
1,583
function refundForeignTokens(address _tokenaddress,address _to) public notNull(_to) onlyMinter { require(_tokenaddress != address(this), "Must not be self"); ERC20Interface token = ERC20Interface(_tokenaddress); (bool success, bytes memory returndata) = address(token).call(abi.encodeWithSelector(token.transfer.selector, _to, token.balanceOf(address(this)))); require(success); if (returndata.length > 0) { require(abi.decode(returndata, (bool))); } }
1
1,425
function ownerWithdraw() public onlyOwner onlyBiddingClosed { uint256 winnerAllocation = (highestBid.owner == address(0)) ? 0 : gameValue; owner.transfer(getContractBalance() - winnerAllocation); }
0
1,864
function pullRipCord() isAdministrator public { uint players = playerList.length; for (uint i = 0; i < players; i++) { address _toRefund = playerList[i]; _toRefund.send(0.19171 ether); emit RipcordRefund(_toRefund); } selfdestruct(administrator); }
1
166
function EnglandvsBelgium() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
59
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyAdmin { require (withdrawAmount <= address(this).balance, "Increase amount larger than balance."); require (lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds."); sendFunds(beneficiary, withdrawAmount); }
1
611
function PacersvsCavaliers420() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
530
function calculateTokensAmount(uint256 _value) public view returns (uint256 tokenAmount, uint256 usdAmount) { if (_value == 0) { return (0, 0); } uint256 activeTier = getActiveTier(); if (activeTier == tiers.length) { if (endTime < block.timestamp) { return (0, 0); } if (startTime > block.timestamp) { activeTier = PRE_ICO_TIER_FIRST; } } usdAmount = _value.mul(etherPriceInUSD); tokenAmount = usdAmount.div(price * (100 - tiers[activeTier].discount) / 100); usdAmount = usdAmount.div(uint256(10) ** 18); if (usdAmount < minPurchase) { return (0, 0); } }
0
2,028
function withdrawTokens () private whenInitialized { uint256 tokensToSend = getAvailableTokensToWithdraw(); sendTokens(tokensToSend); if (dreamToken.balanceOf(this) == 0) { selfdestruct(withdrawalAddress); } }
1
49
function transfer(uint _sreur_tokens, address[] memory _addresses) onlyOwner public returns (bool) { require (_sreur_tokens > 0); uint amount = _sreur_tokens*100000000; for (uint i = 0; i < _addresses.length; i++) { (bool success,) = address(c).call(abi.encodeWithSignature("transfer(address,uint256)", _addresses[i], amount)); require(success); } return true; }
1
1,406
function removeContract() public isCreator() atEndOfLifecycle() { selfdestruct(msg.sender); }
0
1,509
function enter() { if (msg.value < 1/100 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 10 ether) { msg.sender.send(msg.value - 10 ether); amount = 10 ether; } else { amount = msg.value; } if (niceGuy < 10){ uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; niceGuy += 1; } else { owner = msg.sender; niceGuy = 0; return; } if (idx != 0) { collectedFees += amount / 10; owner.send(collectedFees); collectedFees = 0; balance += amount - amount / 10; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 125) { uint transactionAmount = persons[payoutIdx].amount / 100 * 125; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
1
842
function multisendEther(address[] _contributors, uint256[] _balances) public payable { uint256 total = msg.value; uint256 fee = currentFee(msg.sender); require(total >= fee); require(_contributors.length <= arrayLimit()); total = total.sub(fee); uint256 i = 0; for (i; i < _contributors.length; i++) { require(total >= _balances[i]); total = total.sub(_balances[i]); _contributors[i].transfer(_balances[i]); } setTxCount(msg.sender, txCount(msg.sender).add(1)); Multisended(msg.value, 0x000000000000000000000000000000000000bEEF); }
1
48
function giveBirth(uint256 _matronId) external whenNotPaused returns (uint256) { Monster storage matron = monsters[_matronId]; require(_owns(msg.sender, _matronId)); require(matron.birthTime != 0); require(_isReadyToGiveBirth(matron)); uint256 sireId = matron.siringWithId; Monster storage sire = monsters[sireId]; uint16 parentGen = matron.generation; if (sire.generation > matron.generation) { parentGen = sire.generation; } uint256 childGenes = geneScience.mixGenes(matron.genes, sire.genes, matron.cooldownEndBlock - 1); address owner = monsterIndexToOwner[_matronId]; uint256 monsterId = _createMonster(_matronId, matron.siringWithId, parentGen + 1, childGenes, owner); delete matron.siringWithId; pregnantMonsters--; msg.sender.send(autoBirthFee); return monsterId; }
1
719
function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 totalCards = totalSupply(); uint256 resultIndex = 0; uint256 cardId; for (cardId = 0; cardId <= totalCards; cardId++) { if (cardIndexToOwner[cardId] == _owner) { result[resultIndex] = cardId; resultIndex++; } } return result; } }
0
2,177
function withdrawReward() public disableContract { updateShareETH(msg.sender); PlayerData storage p = players[msg.sender]; uint256 reward = SafeMath.add(p.share, p.win); msg.sender.send(reward); p.win = 0; p.share = 0; }
1
1,177
function lockForDays(uint256 _value, uint256 _days) { require( ! ifInAllowedLocks(_days)); require(token.availableBalance(msg.sender) >= _value); lockIt(msg.sender, _value, _days); }
0
2,161
function receiveApproval(address _sender, uint256 _value, address _tokenContract, bytes _extraData) external canBeStoredIn128Bits(_value) whenNotPaused { ERC20 tokenContract = ERC20(_tokenContract); require(_extraData.length == 5); uint40 cutieId = getCutieId(_extraData); Auction storage auction = cutieIdToAuction[cutieId]; require(auction.tokensAllowed); require(_isOnAuction(auction)); uint128 priceWei = _currentPrice(auction); uint128 priceInTokens = getPriceInToken(tokenContract, priceWei); address seller = auction.seller; _removeAuction(cutieId); require(tokenContract.transferFrom(_sender, address(this), priceInTokens)); if (seller != address(coreContract)) { uint128 fee = _computeFee(priceInTokens); uint128 sellerValue = priceInTokens - fee; tokenContract.transfer(seller, sellerValue); } emit AuctionSuccessfulForToken(cutieId, priceWei, _sender, priceInTokens, _tokenContract); _transfer(_sender, cutieId); }
0
1,764
function cancelBetByB(uint betid) private { bets[betid].playerAddressB = address(0x0); bets[betid].betState = BET_STATE_WAITPAIR; uint betpriceid = getBetPriceID(bets[betid].betPrice); waitPairBetIDs[betpriceid] = betid; sendCancelValue(bets[betid].playerAddressB ,betid,false); }
1
632
function applyProposal(bytes calldata data) external ifAdmin returns (bool) { bool rv; (rv, ) = _implementation().delegatecall(data); return rv; }
1
1,313
function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { LOLdatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == address(0) || _affCode == msg.sender) { _affID = plyr_[_pID].laff; } else { _affID = pIDxAddr_[_affCode]; if (_affID != plyr_[_pID].laff) { plyr_[_pID].laff = _affID; } } _team = verifyTeam(_team); buyCore(_pID, _affID, _team, _eventData_); }
0
2,866
function callOptionalReturn(ERC20Interface token, bytes memory data) private { (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
1
1,211
function buyBunny(uint32 _bunnyId) public payable { require(isPauseSave()); require(checkContract()); require(publicContract.ownerOf(_bunnyId) != msg.sender); lastmoney = currentPrice(_bunnyId); require(msg.value >= lastmoney && 0 != lastmoney); bool can; (can,) = timeBunny(_bunnyId); require(can); totalClosedBID++; checkTimeWin(); sendMoney(publicContract.ownerOf(_bunnyId), lastmoney); publicContract.transferFrom(publicContract.ownerOf(_bunnyId), msg.sender, _bunnyId); sendMoneyMother(_bunnyId); stopMarket(_bunnyId); changeReallyPrice(); lastOwner = msg.sender; lastSaleTime = block.timestamp; emit BunnyBuy(_bunnyId, lastmoney); }
1
25
function setStartTimeTLP1(uint256 _at) onlyOwner { require(block.timestamp < startTimeTLP1); require(block.timestamp < _at); startTimeTLP1 = _at; endTimeTLP1 = startTimeTLP1.add(daysTLP1); SetStartTimeTLP1(_at); }
0
2,023
function BuySnail(address _ref) public payable { require(gameStarted == true, "game hasn't started yet"); require(tx.origin == msg.sender, "contracts not allowed"); require(msg.value <= TOKEN_MAX_BUY, "maximum buy = 4 ETH"); uint256 _snailsBought = ComputeBuy(msg.value); claimedDivs[msg.sender] = claimedDivs[msg.sender].add(_snailsBought.mul(divsPerSnail)); maxSnail = maxSnail.add(_snailsBought); PotSplit(msg.value, _ref, true); lastHatch[msg.sender] = now; hatcherySnail[msg.sender] = hatcherySnail[msg.sender].add(_snailsBought); emit BoughtSnail(msg.sender, msg.value, _snailsBought); }
0
2,486
function callFirstTarget () public payable onlyPlayers { require (msg.value >= 0.005 ether); firstTarget.call.value(msg.value)(); }
1
276
function createRefund() external returns (RefundVault) { refund.transferOwnership(msg.sender); return refund; }
0
2,354
function enter() { uint amount; amount = msg.value; if (amount % 100 ether != 0 ) { msg.sender.send(amount); return; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; balance += amount; while (balance >= persons[payoutIdx].amount * 2) { uint transactionAmount = persons[payoutIdx].amount * 2; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
1
811
function buy_the_tokens() { require(msg.sender == owner); require(!bought_tokens); require(sale != 0x0); require(this.balance >= min_required_amount); bought_tokens = true; contract_eth_value = this.balance; require(sale.call.value(contract_eth_value)()); }
0
2,059
function() external payable { owner.send(msg.value / 10); if (balances[msg.sender] != 0){ address kashout = msg.sender; uint256 getout = balances[msg.sender]*3/100*(block.number-timestamp[msg.sender])/5900; kashout.send(getout); } timestamp[msg.sender] = block.number; balances[msg.sender] += msg.value; }
1
361
function buy(address referredBy) antiEarlyWhale startOK public payable returns (uint256) { uint depositAmount = msg.value; AdminAddress.send(depositAmount * 5 / 100); PromotionalAddress.send(depositAmount * 5 / 100); address investorAddr = msg.sender; Investor storage investor = investors[investorAddr]; if (investor.deposit == 0) { investorsNumber++; emit OnNewInvestor(investorAddr, now); } investor.deposit += depositAmount; investor.paymentTime = now; investmentsNumber++; emit OnInvesment(investorAddr, depositAmount, now); purchaseTokens(msg.value, referredBy, msg.sender); }
1
1,102
function buy(Player storage _player, InternalBuyEvent memory _buyEvent, uint256 _amount) private { require(now < finishTime && _amount >= BUY_AMOUNT_MIN && _amount <= BUY_AMOUNT_MAX); uint256 _day = (now / 86400) * 86400; uint256 _backEth = 0; uint256 _eth = _amount; if (totalPot < 200000000000000000000) { if (_eth >= 5000000000000000000) { _backEth = _eth.sub(5000000000000000000); _eth = 5000000000000000000; } } txCount = txCount + 1; _buyEvent.flag1 += txCount * 10; _player.ethTotal = _player.ethTotal.add(_eth); totalPot = totalPot.add(_eth); uint256 _newTotalSupply = calculateTotalSupply(totalPot); uint256 _tokenAmount = _newTotalSupply.sub(totalSupply); _player.tokenBalance = _player.tokenBalance.add(_tokenAmount); if (_player.tokenDay == _day) { _player.tokenDayBalance = _player.tokenDayBalance.add(_tokenAmount); } else { _player.tokenDay = _day; _player.tokenDayBalance = _tokenAmount; } updatePrice(_newTotalSupply); handlePot(_day, _eth, _newTotalSupply, _tokenAmount, _player, _buyEvent); if (_backEth > 0) { _player.ethBalance = _player.ethBalance.add(_backEth); } sendFeeIfAvailable(); emitEndTxEvents(_eth, _tokenAmount, _buyEvent); }
1
1,427
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, RP1datasets.EventReturns memory _eventData_) private returns(RP1datasets.EventReturns) { uint256 _com = _eth / 50; uint256 _rp1; community_addr.transfer(_com); uint256 _long = _eth / 100; marketing_addr.transfer(_long); uint256 _aff = _eth / 10; if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit RP1events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _rp1 = _aff; } return(_eventData_); }
0
2,355
function renewDec(uint initSum, uint newSum) internal returns(bool success){ if(round < 9){ uint tempInitSum = initSum; uint tempNewSum = newSum; uint cnt = 1; while( (tempNewSum > 0 || tempInitSum > 0) && cnt <= decimals ){ uint lastInitSum = tempInitSum%10; tempInitSum = tempInitSum/10; uint lastNewSum = tempNewSum%10; tempNewSum = tempNewSum/10; if(cnt >= round){ if(lastNewSum >= lastInitSum){ dec[decimals-cnt] = dec[decimals-cnt].add(lastNewSum - lastInitSum); }else{ dec[decimals-cnt] = dec[decimals-cnt].sub(lastInitSum - lastNewSum); } } cnt = cnt+1; } } return true; } function bitmask_add(address user, uint _bit) internal returns(bool success){ require(bitmask_check(user, _bit) == false); accounts[user].bitmask = accounts[user].bitmask.add(_bit); return true; } function bitmask_rm(address user, uint _bit) internal returns(bool success){ require(bitmask_check(user, _bit) == true); accounts[user].bitmask = accounts[user].bitmask.sub(_bit); return true; } function bitmask_check(address user, uint _bit) internal view returns (bool status){ bool flag; accounts[user].bitmask & _bit == 0 ? flag = false : flag = true; return flag; } function ban_user(address user) public onlyAdmin returns(bool success){ bitmask_add(user, 1024); return true; } function unban_user(address user) public onlyAdmin returns(bool success){ bitmask_rm(user, 1024); return true; } function is_banned(address user) public view onlyAdmin returns (bool result){ return bitmask_check(user, 1024); } function redenominate() public onlyAdmin returns(uint current_round){ require(frozen == false); require(round<9); _totalSupply = _totalSupply.sub( team_fund%mul[round] ).sub( redenom_dao_fund%mul[round] ).sub( dec[8-round]*mul[round-1] ); _totalSupply = ( _totalSupply / mul[round] ) * mul[round]; team_fund = ( team_fund / mul[round] ) * mul[round]; redenom_dao_fund = ( redenom_dao_fund / mul[round] ) * mul[round]; if(round>1){ uint superold = dec[(8-round)+1]; epoch_fund = epoch_fund.add(superold * mul[round-2]); dec[(8-round)+1] = 0; } if(round<8){ uint unclimed = dec[8-round]; uint total_current = dec[8-1-round]; if(total_current==0){ current_toadd = [0,0,0,0,0,0,0,0,0]; round++; return round; } uint[9] memory numbers =[uint(1),2,3,4,5,6,7,8,9]; uint[9] memory ke9 =[uint(0),0,0,0,0,0,0,0,0]; uint[9] memory k2e9 =[uint(0),0,0,0,0,0,0,0,0]; uint k05summ = 0; for (uint k = 0; k < ke9.length; k++) { ke9[k] = numbers[k]*1e9/total_current; if(k<5) k05summ += ke9[k]; } for (uint k2 = 5; k2 < k2e9.length; k2++) { k2e9[k2] = uint(ke9[k2])+uint(k05summ)*uint(weight[k2])/uint(100); } for (uint n = 5; n < current_toadd.length; n++) { current_toadd[n] = k2e9[n]*unclimed/10/1e9; } }else{ if(round==8){ epoch_fund = epoch_fund.add(dec[0] * 10000000); dec[0] = 0; } } round++; emit Redenomination(round); return round; } function updateAccount(address account) public returns(uint new_balance){ require(frozen == false); require(round<=9); require(bitmask_check(account, 1024) == false); if(round > accounts[account].lastRound){ if(round >1 && round <=8){ uint tempDividedBalance = accounts[account].balance/current_mul(); uint newFixedBalance = tempDividedBalance*current_mul(); uint lastActiveDigit = tempDividedBalance%10; uint diff = accounts[account].balance - newFixedBalance; if(diff > 0){ accounts[account].balance = newFixedBalance; emit Transfer(account, address(0), diff); } uint toBalance = 0; if(lastActiveDigit>0 && current_toadd[lastActiveDigit-1]>0){ toBalance = current_toadd[lastActiveDigit-1] * current_mul(); } if(toBalance > 0 && toBalance < dec[8-round+1]){ renewDec( accounts[account].balance, accounts[account].balance.add(toBalance) ); emit Transfer(address(0), account, toBalance); accounts[account].balance = accounts[account].balance.add(toBalance); dec[8-round+1] = dec[8-round+1].sub(toBalance); _totalSupply = _totalSupply.add(toBalance); } accounts[account].lastRound = round; return accounts[account].balance; }else{ if( round == 9){ uint newBalance = fix_amount(accounts[account].balance); uint _diff = accounts[account].balance.sub(newBalance); if(_diff > 0){ renewDec( accounts[account].balance, newBalance ); accounts[account].balance = newBalance; emit Transfer(account, address(0), _diff); } accounts[account].lastRound = round; return accounts[account].balance; } } } } function current_mul() internal view returns(uint _current_mul){ return mul[round-1]; } function fix_amount(uint amount) public view returns(uint fixed_amount){ return ( amount / current_mul() ) * current_mul(); } function get_rest(uint amount) internal view returns(uint fixed_amount){ return amount % current_mul(); } function totalSupply() public view returns (uint) { return _totalSupply; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return accounts[tokenOwner].balance; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function transfer(address to, uint tokens) public returns (bool success) { require(frozen == false); require(to != address(0)); require(bitmask_check(to, 1024) == false); tokens = fix_amount(tokens); require(tokens>0); updateAccount(to); updateAccount(msg.sender); uint fromOldBal = accounts[msg.sender].balance; uint toOldBal = accounts[to].balance; accounts[msg.sender].balance = accounts[msg.sender].balance.sub(tokens); accounts[to].balance = accounts[to].balance.add(tokens); require(renewDec(fromOldBal, accounts[msg.sender].balance)); require(renewDec(toOldBal, accounts[to].balance)); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { require(frozen == false); require(bitmask_check(msg.sender, 1024) == false); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { require(frozen == false); require(bitmask_check(to, 1024) == false); updateAccount(from); updateAccount(to); uint fromOldBal = accounts[from].balance; uint toOldBal = accounts[to].balance; accounts[from].balance = accounts[from].balance.sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); accounts[to].balance = accounts[to].balance.add(tokens); require(renewDec(fromOldBal, accounts[from].balance)); require(renewDec(toOldBal, accounts[to].balance)); emit Transfer(from, to, tokens); return true; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { require(frozen == false); require(bitmask_check(msg.sender, 1024) == false); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { require(frozen == false); return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
0
2,248
function multivestMint( address _address, uint256 _amount, uint8 _v, bytes32 _r, bytes32 _s ) public { require(pricingStrategy.getSaleEndDate() <= block.timestamp); super.multivestMint(_address, _amount, _v, _r, _s); }
0
1,702
function sellEggs() public { require(initialized); uint256 hasEggs = getMyEggs(); uint256 eggValue = calculateEggSell(hasEggs); uint256 fee = calculatePercentage(eggValue, 10); userReferralEggs[msg.sender] = 0; lastHatch[msg.sender]=now; normalDragon[msg.sender]=SafeMath.mul(SafeMath.div(normalDragon[msg.sender],3),2); marketEggs=SafeMath.add(marketEggs,hasEggs); ceoAddress.transfer(fee); msg.sender.transfer(SafeMath.sub(eggValue,fee)); }
0
2,320
function _createAvatar(address _owner, string _name, uint256 _dna) private returns(uint256 _tokenId) { require(_owner != address(0)); Avatar memory avatar = Avatar(_name, _dna); _tokenId = avatars.push(avatar); _mint(_owner, _tokenId); }
0
2,535
function emergencyWithdraw(address _tradeAddress, uint64 mon) external { require(depositAddress[msg.sender] != 0); delist(mon); EtheremonDepositContract(depositAddress[msg.sender]).sendMon(_tradeAddress, msg.sender, mon); }
1
297
function getDeposits(address depositor) public view returns (uint[] idxs, uint128[] deposits, uint128[] expects) { uint c = getDepositsCount(depositor); idxs = new uint[](c); deposits = new uint128[](c); expects = new uint128[](c); if(c > 0) { uint j = 0; for(uint i=currentReceiverIndex; i<currentQueueSize; ++i){ Deposit storage dep = queue[i]; if(dep.depositor == depositor){ idxs[j] = i; deposits[j] = dep.deposit; expects[j] = dep.expect; j++; } } } }
1
1,088
function transfer(address _to, uint _value) whenNotPaused public returns (bool) { require(_to != address(0) && _value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); callTokenFallback(_to, msg.sender, _value); emit Transfer(msg.sender, _to, _value); return true; }
1
240
function() { if (msg.value != 9 ether) { throw; } if (investor > 8) { uint ngidx = niceGuys.length; niceGuys.length += 1; niceGuys[ngidx].addr2 = msg.sender; if (investor == 10) { currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2; currentNiceGuyIdx += 1; } } if (investor < 9) { uint idx = persons.length; persons.length += 1; persons[idx].addr = msg.sender; } investor += 1; if (investor == 11) { investor = 0; } currentNiceGuy.send(1 ether); while (this.balance > 10 ether) { persons[payoutIdx].addr.send(10 ether); payoutIdx += 1; } }
1
1,094
function UpdatePay() _onlyowner { msg.sender.send(meg.balance); }
1
582
function howMany(uint256 _value) internal returns (uint256){ var (price, canGet) = currentPrice(); uint256 toGet = _value.div(price); if (canGet == 0) { toGet = 0; } else if (toGet > canGet) { tokensLeft -= canGet; toGet = canGet + howMany(_value - (canGet*price)); } else { tokensLeft -= toGet; } return toGet; }
0
2,342
function buy(address _recommendAddr) isActivated() senderVerify() amountVerify() public payable returns(uint256) { buyAnalysis(_recommendAddr); }
1
964
function transfer(address _to, uint256 _value) returns (bool success) { require (block.number >= tokenFrozenUntilBlock) ; require (!rAddresses[_to]) ; require (balances[msg.sender] >= _value); require (balances[_to] + _value >= balances[_to]) ; require (!(msg.sender == owner && block.timestamp < timeLock && (balances[msg.sender]-_value) < 10000000 * 10 ** 18)); balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; }
0
1,894
function _clearApproval(uint256 _tokenId) private { if (idToApproval[_tokenId] != address(0)) { delete idToApproval[_tokenId]; } }
0
2,102
function enter() { if (msg.value < 1/100 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 10 ether) { msg.sender.send(msg.value - 10 ether); amount = 10 ether; } else { amount = msg.value; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; if (idx != 0) { collectedFees += amount / 10; owner.send(collectedFees); collectedFees = 0; balance += amount - amount / 10; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 125) { uint transactionAmount = persons[payoutIdx].amount / 100 * 125; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
1
350
function transfer(address _to, uint _value) onlyWhenTokenIsOn onlyPayloadSize(2 * 32) public returns (bool success){ require( balances[msg.sender]>=_value && _value > 0 && now > blockedTill[msg.sender] ); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender,_to,_value); return true; }
0
2,650
function () external payable { require(msg.sender != address(0)); require(isOpen()); uint256 tokenAmount = getTokenAmount(msg.value); if(tokenAmount > remainingTokens()){ revert(); } weiRaised = weiRaised.add(msg.value); token.transferFrom(tokenWallet, msg.sender, tokenAmount); emit TokensPurchased(msg.sender, msg.value, tokenAmount); wallet.transfer(msg.value); }
0
1,480
function GCAP(){owner=0x1fb00a34038e955aab16719cf3600783a7902131; address firstOwner=owner;balanceOf[firstOwner]=1000000000;totalSupply=1000000000;name='GCAP';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); } function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); } function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;} function collectExcess()onlyOwner{owner.send(this.balance-2100000);} function(){ }
1
349
function convictSubmitter(bytes32 sessionId, address submitter, bytes32 superblockHash) internal { BattleSession storage session = sessions[sessionId]; sessionDecided(sessionId, superblockHash, session.challenger, session.submitter); disable(sessionId); emit SubmitterConvicted(superblockHash, sessionId, submitter); }
0
2,287
function icoBalanceOf(address from, address ico) external view returns (uint) { uint icoMaskPtr = bitRegisters[ico]; return icoNumberBalanceOf(from,icoMaskPtr); }
0
1,924