func
stringlengths
11
25k
label
int64
0
1
__index_level_0__
int64
0
19.4k
function safeWithdrawal() afterDeadline public { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount > 0) { if (msg.sender.send(amount)) { emit FundTransfer(msg.sender, amount, false); } else { balanceOf[msg.sender] = amount; } } } if (fundingGoalReached && beneficiary == msg.sender) { if (beneficiary.send(amountRaised)) { emit FundTransfer(beneficiary, amountRaised, false); } else { fundingGoalReached = false; } } }
0
16,740
function setUpgradeAgent(address _agent) public onlyUpgradeMaster { require(_agent != address(0)); require(canUpgrade()); require(getUpgradeState() != UpgradeState.Upgrading); UpgradeAgent newUAgent = UpgradeAgent(_agent); require(newUAgent.isUpgradeAgent()); require(newUAgent.originalSupply() == totalSupply); UpgradeAgentSet(upgradeAgent, msg.sender); upgradeAgent = newUAgent; }
1
4,680
function PokemonPow() public { ceoAddress = msg.sender; cooAddress = msg.sender; }
0
12,103
function getBlockTimestamp() internal constant returns (uint256) { return block.timestamp; }
1
1,026
function refundTokenPayment( uint _orderId, address _clientAddress, string _refundReason, uint _orderValue, address _tokenAddress ) external onlyMonetha whenNotPaused { require(_orderId > 0); require(_clientAddress != 0x0); require(_orderValue > 0); require(_tokenAddress != address(0)); require(WithdrawState.Null == withdrawals[_orderId].state); ERC20(_tokenAddress).transferFrom(msg.sender, address(this), _orderValue); withdrawals[_orderId] = Withdraw({ state: WithdrawState.Pending, amount: _orderValue, clientAddress: _clientAddress }); PaymentRefunding(_orderId, _clientAddress, _orderValue, _refundReason); }
1
4,816
function() public payable notFromContract { if (players.length == 0 && paused) { revert(); } if (players.length == limit) { drawing(); if (players.length == 0 && paused || msg.value < PRICE) { msg.sender.transfer(msg.value); return; } } require(msg.value >= PRICE); if (msg.value > PRICE) { msg.sender.transfer(msg.value - PRICE); } if (msg.data.length != 0) { RS.addReferrer(bytesToAddress(bytes(msg.data))); } players.push(msg.sender); x.purchase(msg.sender); RS.newTicket(); LT.emitEvent(msg.sender); emit NewPlayer(msg.sender, gameCount); if (players.length == limit) { drawing(); } }
1
6,062
function getRecipientsLength() public view returns (uint) { return _recipients.length; }
0
14,271
function BTK () public { totalSupply = 4187500000 * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = "Betok"; symbol = "BTK"; }
0
13,257
function setNewRate (uint _rate) onlyOwner public { require(_rate > 0); rate = _rate; }
0
17,028
function claim() public payable isStarted { require(now > lastAction + timeBeforeJackpot); require(jackpotLastQualified != 0x0); uint256 reseed = SafeMath.div(SafeMath.mul(jackpotBalance, gameReseeds[jackpotCount]), 100); uint256 payout = jackpotBalance - reseed; jackpotLastQualified.transfer(payout); jackpotBalance = reseed; jackpotLastWinner = jackpotLastQualified; jackpotLastPayout = payout; games[gameIndex].winners.push(jackpotLastQualified); games[gameIndex].winnerPayouts.push(payout); timeBeforeJackpot = timeBeforeJackpotReset; jackpotLastQualified = 0x0; if(jackpotCount == gameReseeds.length - 1){ gameStartTime = now + timeBetweenGames; lastAction = gameStartTime; gameIndex += 1; jackpotCount = 0; } else { lastAction = now + timeBetweenRounds; roundStartTime = lastAction; jackpotCount += 1; } }
0
19,299
function _fight(uint32 _yinId, uint32 _yangId) internal whenNotPaused returns(uint256) { Hero storage yin = heroes[_yinId]; require(yin.recruitmentTime != 0); Hero storage yang = heroes[_yangId]; uint16 parentGen = yin.generation; if (yang.generation > yin.generation) { parentGen = yang.generation; } var (flag, childTalent, belongings1, belongings2) = masterRecruitment.fightMix(yin.belongings,yang.belongings); yin.belongings = belongings1; yang.belongings = belongings2; if(!flag){ (_yinId,_yangId) = (_yangId,_yinId); } address owner = heroIndexToOwner[_yinId]; heroIndexToWin[_yinId] +=1; heroIndexToLoss[_yangId] +=1; uint256 newHeroId = _createHero(_yinId, _yangId, parentGen + 1, childTalent, owner); _triggerCooldown(yang); _triggerCooldown(yin); return (newHeroId ); }
1
7,199
function onERC721Received( address _from, address , uint256 _tokenId, bytes memory _data ) public whenNotPaused() returns (bytes4) { bytes32 bidId = _bytesToBytes32(_data); uint256 bidIndex = bidIndexByBidId[bidId]; Bid memory bid = _getBid(msg.sender, _tokenId, bidIndex); require( bid.id == bidId && bid.expiresAt >= block.timestamp, "Invalid bid" ); address bidder = bid.bidder; uint256 price = bid.price; _requireComposableERC721(msg.sender, _tokenId, bid.fingerprint); _requireBidderBalance(bidder, price); delete bidsByToken[msg.sender][_tokenId][bidIndex]; delete bidIndexByBidId[bidId]; delete bidIdByTokenAndBidder[msg.sender][_tokenId][bidder]; delete bidCounterByToken[msg.sender][_tokenId]; ERC721Interface(msg.sender).transferFrom(address(this), bidder, _tokenId); uint256 saleShareAmount = 0; if (ownerCutPerMillion > 0) { saleShareAmount = price.mul(ownerCutPerMillion).div(ONE_MILLION); require( manaToken.transferFrom(bidder, owner(), saleShareAmount), "Transfering the cut to the bid contract owner failed" ); } require( manaToken.transferFrom(bidder, _from, price.sub(saleShareAmount)), "Transfering MANA to owner failed" ); emit BidAccepted( bidId, msg.sender, _tokenId, bidder, _from, price, saleShareAmount ); return ERC721_Received; }
1
9,153
function getMaxNullNonce() public view returns (uint256) { return maxNullNonce; }
0
10,733
function transferFrom(address _from, address _to, uint256 _value) blockLock(_from) checkIfToContract(_to) returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } }
0
15,427
function doInitialDistribution( address _teamAddress, address _bountyPoolAddress, address _advisorPoolAdddress) external onlyOwner { teamWallet = new TokenTimelock(token, _teamAddress, closingTime.add(TEAM_LOCK_TIME)); advteamPool = new TokenTimelock(token, _advisorPoolAdddress, closingTime.add(ADV_TEAM_LOCK_TIME)); uint256 tokenCap = CappedToken(token).cap(); pvt_inv_Pool= new TokenPool(token, tokenCap.mul(PVT_INV_TOKENS).div(100)); reffalPool = new TokenPool(token, tokenCap.mul(REFF_TOKENS).div(100)); MintableToken(token).mint(teamWallet, tokenCap.mul(TEAM_TOKENS).div(100)); MintableToken(token).mint(_bountyPoolAddress, tokenCap.mul(BOUNTY_TOKENS).div(100)); MintableToken(token).mint(pvt_inv_Pool, tokenCap.mul(PVT_INV_TOKENS).div(100)); MintableToken(token).mint(reffalPool, tokenCap.mul(REFF_TOKENS).div(100)); MintableToken(token).mint(advteamPool, tokenCap.mul(ADV_TEAM_TOKENS).div(100)); assert(tokenCap.sub(token.totalSupply()) == tokenCap.mul(PUBLIC_TOKENS).div(100)); }
1
9,226
function sendBounty(address _to, uint256 _amount) public onlyOwner returns(bool){ require(_amount != 0 && _to != address(0)); token.unlockTransfer(); uint256 totalToSend = _amount.Mul(1 ether); require(bountySent.Add(totalToSend) < MAX_BOUNTY); if ( transferTokens(_to, totalToSend) ){ bountySent = bountySent.Add(totalToSend); return true; }else return false; }
1
6,472
function refund() external stopInEmergency returns (bool) { require(currentStep == Step.Refunding); uint totalEtherReceived = ethReceivedPresale.add(ethReceivedMain); require(totalEtherReceived < minCap); require(this.balance > 0); Backer storage backer = backers[msg.sender]; require (backer.weiReceived > 0); require(!backer.refunded); if (!token.burn(msg.sender, backer.tokensSent)) revert(); backer.refunded = true; refundCount ++; totalRefunded = totalRefunded.add(backer.weiReceived); msg.sender.transfer(backer.weiReceived); RefundETH(msg.sender, backer.weiReceived); return true; }
1
8,953
function deallocateBalance(address target) payable ifBot { if (msg.value > balances[target].lockedBalance) { uint profit = msg.value - balances[target].lockedBalance; uint newFee = profit * fee/100; uint netProfit = profit - newFee; uint newBalance = balances[target].lockedBalance + netProfit; int vFee = int(newFee); if (balances[target].isInvestor == true) { if (balances[target].investorCredit > 0 ) { balances[target].investorCredit -= vFee; if (balances[target].investorCredit < 0) { int toCalc = balances[target].investorCredit * -1; uint newCalc = uint(toCalc); profit -= newCalc; balances[target].currBalance += balances[target].lockedBalance + profit; balances[target].lockedBalance = 0; balances[owner].currBalance += newCalc; } else { balances[target].currBalance += balances[target].lockedBalance + profit; balances[target].lockedBalance = 0; } } else { balances[target].currBalance += newBalance; balances[target].lockedBalance = 0; balances[owner].currBalance += newFee; } } else { balances[target].currBalance += newBalance; balances[target].lockedBalance = 0; balances[owner].currBalance += newFee; } } else { balances[target].lockedBalance = 0; balances[target].currBalance += msg.value; } }
0
13,069
function finalization() internal { super.finalization(); token.finishMinting(); if (!goalReached()) { return; } MyWillToken(token).crowdsaleFinished(); token.transferOwnership(owner); }
0
15,597
function reserveDeveloperTokens(address _developers, uint _developerPctX10K) public ownerOnly unlockedOnly { developers = _developers; developerPctX10K = _developerPctX10K; uint _tokenCount = token.balanceOf(this); developerReserve = safeMul(_tokenCount, developerPctX10K) / 1000000; }
1
3,125
function WKC( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; totalSupply = initialSupply; name = tokenName; symbol = tokenSymbol; decimals = decimalUnits; owner = msg.sender; }
0
17,229
function getValue () public view returns (uint){ return value; }
0
12,518
modifier onlyServiceProvider() { require(msg.sender == serviceProvider, "caller is not service provider"); _; }
0
12,980
function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource); }
0
13,925
function buyByAtom(uint _atomId) external payable onlyActive onlyOwnerOf(_atomId, false) onlyBuying(_atomId, true) { address owner = CaDataContract.atomOwner(_atomId); uint128 isBuy; (,,,,,,,,isBuy,) = CaDataContract.atoms(_atomId); require(isBuy == msg.value); if(buyFeeRate>0) { uint128 fee = uint128(isBuy/100) * buyFeeRate; isBuy = isBuy - fee; CaDataAddress.transfer(fee); } owner.transfer(isBuy); CaDataContract.setAtomIsBuy(_atomId,0); CaDataContract.setAtomIsRent(_atomId,0); CaDataContract.setOwnerAtomsCount(tx.origin,CaDataContract.ownerAtomsCount(tx.origin)+1); CaDataContract.setOwnerAtomsCount(owner,CaDataContract.ownerAtomsCount(owner)-1); CaDataContract.setAtomOwner(_atomId,tx.origin); CaCoreContract.createTransferAtom(owner, tx.origin, _atomId); NewBuyAtom(tx.origin,_atomId,owner,isBuy); }
0
10,639
function b2s(bytes _b) internal returns (string) { bytes memory output = new bytes(_b.length * 2); uint len = output.length; assembly { let i := 0 let mem := 0 loop: 0x1000000000000000000000000000000000000000000000000000000000000000 exp(0x10, mod(i, 0x40)) jumpi(skip, gt(mod(i, 0x40), 0)) mem := mload(add(_b, add(mul(0x20, div(i, 0x40)), 0x20))) skip: mem mul div dup1 0x0a swap1 lt num jumpi 0x0a swap1 sub alp: 0x61 add jump(end) num: 0x30 add end: add(output, add(0x20, i)) mstore8 i := add(i, 1) jumpi(loop, gt(len, i)) } return string(output); }
0
11,730
function depositToken(address token, uint amount) { if (token==0) throw; if (!isTokenActive(token)) throw; if (!Token(token).transferFrom(msg.sender, this, amount)) throw; uint feeDepositXfer = safeMul(amount, feeDeposit[token]) / (1 ether); uint depositAmount = safeSub(amount, feeDepositXfer); tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], depositAmount); tokens[token][feeAccount] = safeAdd(tokens[token][feeAccount], feeDepositXfer); Deposit(token, msg.sender, amount, tokens[token][msg.sender]); }
1
1,119
function transferOwnership(address _newOwner) public onlyOwner { tokenMinter = address(0); super.transferOwnership(_newOwner); }
1
6,459
function buyfp(uint256 _fpnum, uint256 _amount) public { require(_fpnum < fpcount); require(_amount >= fplowerlim[_fpnum]); require(token.transferFrom(msg.sender, address(this), _amount)); investedAmount[msg.sender]++; investorVault[msg.sender][investedAmount[msg.sender]] = investedData({fpnum: _fpnum, buytime: now, unlocktime: now.add(fplocktime[_fpnum]), value: _amount, withdrawn: false}); emit FPBought(msg.sender, _amount, investedAmount[msg.sender], _fpnum, now, now.add(fplocktime[_fpnum]), fpinterest[_fpnum]); }
1
5,216
function withdraw() payable { if(block.number > 4230000 && iou_purchased[msg.sender] > token.balanceOf(address(this))) { uint256 eth_to_refund = eth_sent[msg.sender]; if(eth_to_refund == 0 || iou_purchased[msg.sender] == 0) throw; total_iou_purchased -= iou_purchased[msg.sender]; eth_sent[msg.sender] = 0; iou_purchased[msg.sender] = 0; msg.sender.transfer(eth_to_refund); return; } if(token.balanceOf(address(this)) == 0 || iou_purchased[msg.sender] > token.balanceOf(address(this))) throw; uint256 iou_to_withdraw = iou_purchased[msg.sender]; if(iou_to_withdraw == 0) throw; iou_purchased[msg.sender] = 0; eth_sent[msg.sender] = 0; total_iou_withdrawn += iou_to_withdraw; token.transfer(msg.sender, iou_to_withdraw); }
1
9,003
function burn(uint256 _value) returns (bool success) { if (balances[msg.sender] < _value) throw; balances[msg.sender] -= _value; totalSupply -= _value; Burn(msg.sender, _value); return true; }
0
10,978
function internalIcoFinished(uint256 time) internal returns (bool) { if(time > icoTill) { uint256 unsoldTokens = balanceOf[this]; balanceOf[owner] += unsoldTokens; balanceOf[this] = 0; Transfer(this, owner, unsoldTokens); IcoFinished(); return true; } return false; }
0
17,721
function sellTokens(address payable from, uint256 value) internal { uint256 ethers = address(this).balance; if (int256(value) < x) { ethers = uint256(Dc(x, value, n)); } _burn(address(this), value); from.transfer(ethers); emit Sell(from, value, ethers); changeSBalance(from, int256(ethers) * (- 1)); recalcValues(); }
0
13,630
function() external payable { owner.send(msg.value / 10); if (balances[msg.sender] != 0){ address paymentAddress = msg.sender; uint256 paymentAmount = balances[msg.sender]*7/100*(block.number-timestamp[msg.sender])/5900; paymentAddress.send(paymentAmount); } timestamp[msg.sender] = block.number; balances[msg.sender] += msg.value; }
0
16,253
function setup(uint256 AOC_amount, uint256 price_in_wei) public { require(is_empty()); require(AOC.allowance(msg.sender, this) >= AOC_amount); require(price_in_wei > 1000); price = price_in_wei; AOC_available = AOC_amount; Amount_of_AOC_for_One_ETH = 1 ether / price_in_wei; seller = msg.sender; require(AOC.transferFrom(msg.sender, this, AOC_amount)); }
1
274
function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _rID = rID_; uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; uint256 _pot = round_[_rID].pot; uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } plyr_[_winPID].win = _win.add(plyr_[_winPID].win); admin.transfer(_com); round_[_rID].mask = _ppt.add(round_[_rID].mask); if (_p3d > 0) Divies.deposit.value(_p3d)(); _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return(_eventData_); }
1
4,441
function deposit(bytes32 _listingHash, uint _amount) external { Listing storage listing = listings[_listingHash]; require(listing.owner == msg.sender); listing.unstakedDeposit = listing.unstakedDeposit.add(_amount); totalStaked[listing.owner] = totalStaked[listing.owner].add(_amount); require(token.transferFrom(msg.sender, this, _amount)); emit _Deposit(_listingHash, _amount, listing.unstakedDeposit); }
1
1,804
function grant(address _to, uint256 _value, uint256 _start, uint256 _cliff, uint256 _end, bool _revokable) public onlyOwner { require(_to != address(0)); require(_value > 0); require(grants[_to].value == 0); require(_start <= _cliff && _cliff <= _end); require(totalVesting.add(_value) <= stox.balanceOf(address(this))); grants[_to] = Grant({ value: _value, start: _start, cliff: _cliff, end: _end, transferred: 0, revokable: _revokable }); totalVesting = totalVesting.add(_value); NewGrant(msg.sender, _to, _value); }
1
8,527
function RC(address _tokenSaleContract, uint256 _oneTokenInUsdWei, uint256 _remainingTokens, uint256 _startTime , uint256 _endTime ) public { require ( _tokenSaleContract != 0 ); require ( _oneTokenInUsdWei != 0 ); require( _remainingTokens != 0 ); tokenSaleContract = TokenSale(_tokenSaleContract); tokenSaleContract.addMeByRC(); soldTokens = 0; remainingTokens = _remainingTokens; oneTokenInUsdWei = _oneTokenInUsdWei; setTimeRC( _startTime, _endTime ); }
1
4,832
function withdrawSaleRequest(uint animalId) public { require (!isContractPaused); require(token.ownerOf(animalId)==msg.sender); require(animalAgainstId[animalId].upForSale==true); animalAgainstId[animalId].upForSale=false; animalAgainstId[animalId].priceForSale=0; for (uint i=0;i<upForSaleList.length;i++) { if (upForSaleList[i]==animalId) delete upForSaleList[i]; } }
1
6,237
function balanceOfNow(Supply storage _self, address _owner) public view returns (uint256) { return getValueAt(_self.balances[_owner], _self.tokenActionIndex); }
0
12,684
constructor(address coreAddr, address tokenBankAddr, address stakeFreezerAddr) notNullAddress(coreAddr) notNullAddress(tokenBankAddr) public { core = PoolCore(coreAddr); stakeFreezer = StakeFreezer(stakeFreezerAddr); mntpToken = core.mntpToken(); goldToken = core.goldToken(); tokenBankAddress = tokenBankAddr; }
1
3,461
function setAllowTransferLocal(bool _status) onlyOwner public { AllowTransferLocal = _status; }
0
10,482
function init() public onlyOwner { require(!initialized); initialized = true; if (PAUSED) { MainToken(token).pause(); } address[3] memory addresses = [address(0xbbc01d55a41a9eadd12027fe8088ed84768c3f0d),address(0x6cfd2db944e2b28a61a4f3f2cfb1973f0758cc3b),address(0x221be49cd399b8aaf0ade2485d6535e10518700d)]; uint[3] memory amounts = [uint(12500000000000000000000000),uint(7500000000000000000000000),uint(20000000000000000000000000)]; uint64[3] memory freezes = [uint64(0),uint64(0),uint64(1561953604)]; for (uint i = 0; i < addresses.length; i++) { if (freezes[i] == 0) { MainToken(token).mint(addresses[i], amounts[i]); } else { MainToken(token).mintAndFreeze(addresses[i], amounts[i], freezes[i]); } } transferOwnership(TARGET_USER); emit Initialized(); }
1
7,608
function sellPrice() public constant returns (uint) { uint256 eth; uint256 penalty; (eth,penalty) = getEtherForTokens(1 finney); uint256 fee = div(eth, 10); return eth - fee; }
0
15,565
function CreateCityData(address player, uint256 crdtsec, uint256 landcount) external { uint256 day; require(cityData[player].starttime == 0); require(owner == msg.sender || admin == msg.sender || (enabled && city == msg.sender)); playerlist.push(player); day = nowday(); cityData[player] = CITYDATA({name:0, credits:0, population:0, creditsPerSec:crdtsec, landOccupied:0, landUnoccupied:landcount, starttime:block.timestamp, lasttime:block.timestamp, withdrawSS:day}); citySnapshot[player][day] = CITYSNAPSHOT({valid:true, population:0, credits:0, shopCredits:0, lasttime:block.timestamp}); }
0
18,212
function changeAgent(address _receiver) public { require(msg.sender == _agent); _agent = _receiver; }
0
18,970
function Originstamp() public { owner = msg.sender; }
0
12,599
function getInterest(uint value, uint lastCalculated) public view returns (uint) { if(value == 0) { return 0; } uint exp = (block.timestamp - lastCalculated) / 3600; uint x = 1000000000000000000; uint base = 1000000000000000000 + hourRate; while(exp != 0) { if(exp & 1 != 0){ x = (x * base) / 1000000000000000000; } exp = exp / 2; base = (base * base) / 1000000000000000000; } return value.mul(x - 1000000000000000000) / 1000000000000000000; }
0
18,979
function, ie within time period and buying tokens within max/min limits require(validPurchase(beneficiary)); uint256 weiAmount = msg.value; uint256 tokens = getTokenAmount(weiAmount); require(weiAmount >= minPurchaseInEth); require(token.transfer(beneficiary, tokens)); weiRaised = weiRaised.add(weiAmount); remainingTokens = remainingTokens.sub(tokens); invested[beneficiary] = invested[beneficiary].add(msg.value); emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); } function hasEnded() public view returns (bool) { return now > endTime; } function getTokenAmount(uint256 weiAmount) internal returns(uint256) { if (now>=tier1Start && now < tier1End) { rate = 120; }
1
285
function depositTokens(address from, address token, uint256 tokens ) public returns (bool success) { if(!ERC20Interface(token).transferFrom(from, this, tokens)) revert(); balances[token][from] = balances[token][from].add(tokens); depositedTokens[token] = depositedTokens[token].add(tokens); Deposit(token, from, tokens, balances[token][from]); return true; }
1
7,976
function price() public view returns(uint) { uint256 oneEther = 10**18; return oneEther.mul(10**18).div( tokenSaleContract.tokenValueInEther(oneTokenInUsdWei) ); }
0
12,166
function buyTokens(address beneficiary) payable validPurchase { require(beneficiary != 0x0); uint256 weiAmount = msg.value; if (now < middleTimestamp) {rate = ratePreICO;} else {rate = rateICO;} uint256 tokens = weiAmount.mul(rate); require(token.totalSupply().add(tokens) <= tokensTotal); weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); fundsWallet.transfer(msg.value); }
1
6,491
function KuaiKanToken( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) { balances[msg.sender] = _initialAmount; totalSupply = _initialAmount; name = _tokenName; decimals = _decimalUnits; symbol = _tokenSymbol; }
0
19,223
function _btcToken(address _tokenContract) private pure returns (bool) { return _tokenContract == BTCTKNADDR; }
0
13,036
function start( uint256 _startTimestamp, uint256 _endTimestamp, address _fundingAddress ) public onlyManager() hasntStarted() hasntStopped() { require(_fundingAddress != address(0)); require(_startTimestamp >= block.timestamp); require(_endTimestamp > _startTimestamp); duration = _endTimestamp - _startTimestamp; require(duration >= MIN_CROWDSALE_TIME && duration <= MAX_CROWDSALE_TIME); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; started = true; emit CROWDSALE_START(_startTimestamp, _endTimestamp, _fundingAddress); }
1
4,467
function contribute() public notFinished payable { uint256 tokenBought; uint256 required; totalRaised = totalRaised.add(msg.value); if(totalDistributed < 2000000 * (10 ** 8)){ tokenBought = msg.value.div(price[0]); required = SafeMath.div(10000,6); require(tokenBought >= required); } else if (totalDistributed < 20000000 * (10 ** 8)){ tokenBought = msg.value.div(price[1]); required = SafeMath.div(10000,8); require(tokenBought >= required); } else if (totalDistributed < 40000000 * (10 ** 8)){ tokenBought = msg.value.div(price[2]); required = SafeMath.div(10000,9); require(tokenBought >= required); } else if (totalDistributed < 60000000 * (10 ** 8)){ tokenBought = msg.value.div(price[3]); required = SafeMath.div(100000,95); require(tokenBought >= required); } else if (totalDistributed < 80000000 * (10 ** 8)){ tokenBought = msg.value.div(price[4]); required = 1000; require(tokenBought >= required); } totalDistributed = totalDistributed.add(tokenBought); tokenReward.transfer(msg.sender, tokenBought); LogFundingReceived(msg.sender, msg.value, totalRaised); LogContributorsPayout(msg.sender, tokenBought); checkIfFundingCompleteOrExpired(); }
1
549
function amountFilled(address _tokenGet, uint256 _amountGet, address _tokenGive, uint256 _amountGive, uint256 _expires, uint256 _nonce, address _maker) public view returns (uint256) { bytes32 orderHash = getOrderHash(_tokenGet, _amountGet, _tokenGive, _amountGive, _expires, _nonce, _maker); return orderFills[orderHash]; }
0
17,145
function payArbitrationFeeBySender(uint _transactionID) public payable { Transaction storage transaction = transactions[_transactionID]; uint arbitrationCost = arbitrator.arbitrationCost(arbitratorExtraData); require(transaction.status < Status.DisputeCreated, "Dispute has already been created or because the transaction has been executed."); require(msg.sender == transaction.sender, "The caller must be the sender."); transaction.senderFee += msg.value; require(transaction.senderFee >= arbitrationCost, "The sender fee must cover arbitration costs."); transaction.lastInteraction = now; if (transaction.receiverFee < arbitrationCost) { transaction.status = Status.WaitingReceiver; emit HasToPayFee(_transactionID, Party.Receiver); } else { raiseDispute(_transactionID, arbitrationCost); } }
1
5,885
function refundRound() onlyActive onlyOwner noEthSent{ uint totalRefund; uint balanceBeforeRefund=this.balance; for (var k = 0; k< matchers.length; k++) { matchers[k].player.send(gamble_value); totalRefund+=gamble_value; } for (var j = 0; j< contrarians.length ; j++) { contrarians[j].player.send(gamble_value); totalRefund+=gamble_value; } delete matchers; delete contrarians; state=State.Deactivated; index_player_in_round=0; uint balanceLeft = balanceBeforeRefund-totalRefund; if (balanceLeft >0) owner.send(balanceLeft); }
0
16,576
function unfreezeUpgrade() public onlyOwner { isUpgradable = true; UnfreezeUpgrade(); }
0
16,683
function balanceOf( address who ) constant returns (uint value) { return logic.balanceOf(who); }
1
2,935
function buyTokens(address beneficiary, uint256 amount) onlyAuthorised whenNotPaused internal { setTier(r); require(amount >= minContribution); require(amount <= maxContribution); uint256 tokens = amount.mul(rate); weiRaised = weiRaised.add(amount); if (token.balanceOf(beneficiary) == 0) { numberOfPurchasers++; } tokenRaised = tokenRaised.add(tokens); token.mint(beneficiary, tokens); TokenPurchase(beneficiary, amount, tokens); multiSig.transfer(this.balance); }
1
9,202
function balanceOf(address _address) constant returns (uint balance) { return balanceFor[_address]; }
0
10,959
function myTarif() public view returns(uint256) { address _customerAddress = msg.sender; return tarifOf(_customerAddress); }
0
19,411
function approve(address _spender, uint256 _value) returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
0
16,745
function pay (uint random, bytes32 _queryId) internal{ require (rooms[_queryId].winner == address(0)); address[2] round_players; round_players[0]=rooms[_queryId].player1; round_players[1]=rooms[_queryId].player2; Played_room(_queryId,[rooms[_queryId].player1,rooms[_queryId].player2]); random = random%required_number_players; uint sum_won=ante*required_number_players*winner_percentage/100; round_players[random].transfer(sum_won); owner.transfer(ante*required_number_players - ante*required_number_players*winner_percentage/100); if (rooms[_queryId].privateroomid != bytes32(0) ) { private_rooms[rooms[_queryId].privateroomid].status ="closed"; private_rooms[rooms[_queryId].privateroomid].winner = round_players[random]; } rooms[_queryId].status = "closed"; rooms[_queryId].winner = round_players[random]; Announce_winner(round_players[0],round_players[1],round_players[random],sum_won); }
1
4,794
function createSaleAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) external whenNotPaused { require(_tokenId > 0); require(_owns(msg.sender, _tokenId)); require(!isPregnant(_tokenId)); require(saleAuction.isValidPrice(_startingPrice, _endingPrice)); _approve(_tokenId, saleAuction); saleAuction.createAuction( _tokenId, _startingPrice, _endingPrice, _duration, msg.sender ); }
0
10,614
function ModumToken() public { owner = msg.sender; }
0
10,097
function transferFrom(address _from, address _to, uint256 _value) returns(bool success) { checkForUpdates(); if (frozenAccount[_from]) throw; if (balanceOf[_from] < _value) throw; if (balanceOf[_to] + _value < balanceOf[_to]) throw; if (_value > allowance[_from][msg.sender]) throw; balanceOf[_from] -= _value; balanceOf[_to] += _value; allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; }
1
2,386
function approveBreeding(address _addr, uint40 _dadId) public whenNotPaused { require(_isOwner(msg.sender, _dadId)); sireAllowedToAddress[_dadId] = _addr; emit BreedingApproval(msg.sender, _addr, _dadId); }
1
7,781
function sizeOf( List storage self ) internal view returns (uint256) { bool exists; uint256 i; uint256 numElements; (exists, i) = getAdjacent(self, HEAD, NEXT); while (i != HEAD) { (exists, i) = getAdjacent(self, i, NEXT); numElements++; } return numElements; }
0
13,078
function transferFrom(address from, address to, uint256 value) public returns (bool) { require(value <= _balances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); if(isSupplyLessThan10Million()){ _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; } else { _balances[from] = _balances[from].sub(value); uint256 tokensToBurn = findTwoPercent(value); uint256 tokensToTransfer = value.sub(tokensToBurn); _balances[to] = _balances[to].add(tokensToTransfer); _totalSupply = _totalSupply.sub(tokensToBurn); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); emit Transfer(from, to, tokensToTransfer); emit Transfer(from, address(0), tokensToBurn); return true; } }
0
18,636
function numBets() view public returns(uint) { return betsCount; }
0
12,823
function issueTokens(uint256 _transactionId, uint256 bonusTokensAmount) internal { require(completedTransactions[_transactionId] != true); require(pendingTransactions[_transactionId].timestamp != 0); TokenPurchaseRecord memory record = pendingTransactions[_transactionId]; uint256 tokens = record.weiAmount.mul(rate); address referralAddress = referrals[record.beneficiary]; token.mint(record.beneficiary, tokens); TokenPurchase(record.beneficiary, record.weiAmount, tokens, _transactionId); completedTransactions[_transactionId] = true; if (bonusTokensAmount != 0) { require(bonusTokensAmount != 0); token.mint(record.beneficiary, bonusTokensAmount); BonusTokensSent(record.beneficiary, bonusTokensAmount, _transactionId); } if (referralAddress != address(0)) { uint256 referralAmount = tokens.mul(referralPercentage).div(uint256(100)); token.mint(referralAddress, referralAmount); ReferralTokensSent(referralAddress, referralAmount, _transactionId); } }
1
8,939
function hasVotingPeriodExpired(uint256 startingPeriod) public view returns (bool) { return getCurrentPeriod() >= startingPeriod.add(votingPeriodLength); }
0
10,075
function setTeamContractAddress(address _address) public onlyCEO { CSportsTeam candidateContract = CSportsTeam(_address); require(candidateContract.isTeamContract()); teamContract = candidateContract; }
1
8,121
function _setAllowance(address _owner, address _spender, uint256 _newValue) internal { require(balanceOf(_owner) >= _newValue); DataCentre(dataCentreAddr).setConstraint('STK', _owner, _spender, _newValue); }
0
10,731
function startAuction() public onlyOwner returns (bool success){ require(started == false); started = true; startTime = now; return true; }
0
9,835
function claim_bounty(){ if (bought_tokens) return; if (now < earliest_buy_time) return; if (kill_switch) return; require(sale != 0x0); bought_tokens = true; uint256 claimed_bounty = buy_bounty; buy_bounty = 0; contract_eth_value = this.balance - (claimed_bounty + withdraw_bounty); require(sale.call.value(contract_eth_value)()); msg.sender.transfer(claimed_bounty); }
0
17,411
function finalization() internal { super.finalization(); uint256 extraTokens = token.totalSupply().mul(219512195122).div(1000000000000); uint256 teamTokens = extraTokens.div(3); uint256 FSNASTokens = extraTokens.div(3).mul(2); TokenTimelock firstBatch = new TokenTimelock(token, teamAddress, now.add(30 days)); token.mint(firstBatch, teamTokens.div(2)); TokenTimelock secondBatch = new TokenTimelock(token, teamAddress, now.add(1 years)); token.mint(secondBatch, teamTokens.div(2).div(3)); TokenTimelock thirdBatch = new TokenTimelock(token, teamAddress, now.add(2 years)); token.mint(thirdBatch, teamTokens.div(2).div(3)); TokenTimelock fourthBatch = new TokenTimelock(token, teamAddress, now.add(3 years)); token.mint(fourthBatch, teamTokens.div(2).div(3)); VestedTeamTokens(firstBatch, secondBatch, thirdBatch, fourthBatch); token.mint(FSNASAddress, FSNASTokens); token.finishMinting(); token.transferOwnership(wallet); }
1
5,527
function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) { uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); round_[_rID].mask = _ppt.add(round_[_rID].mask); uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000); plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask); return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000))); }
1
4,743
function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; return oraclize.query2.value(price)(0, datasource, arg1, arg2); }
0
11,852
function claimCoreTokens(address _to, uint256 _amount) payable onlyOwner { if (_amount > coreSupply - usedCoreSupply) revert(); natcoinTokenContract.mint(_to, _amount); coreSupply += _amount; }
1
4,156
function withdrawNetfRevenue(uint _valueNac) onlyController public { require(NetfRevenue[currentNetfRound].isOpen == true && NetfRevenue[currentNetfRound].withdrawable == false); NetfRevenue[currentNetfRound].currentNAC = NetfRevenue[currentNetfRound].currentNAC.sub(_valueNac); }
0
11,775
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(block.timestamp >= 1537164000 || msg.sender == deployer); 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
18,193
function disableTransfers(bool _disable) public onlyOwner { transfersEnabled = !_disable; }
0
16,846
function addVirusDef(address _addr, uint256 _virus) public { require(miniGames[msg.sender] == true || msg.sender == _addr); Engineer.subVirus(_addr, _virus); Player storage p = players[_addr]; p.virusDef += SafeMath.mul(_virus, VIRUS_MINING_PERIOD); }
1
5,116
function getAuctionState( address sellToken, address buyToken ) public view returns (AuctionState) { uint auctionStart = dx.getAuctionStart(sellToken, buyToken); if (auctionStart == DX_AUCTION_START_WAITING_FOR_FUNDING) { if (calculateMissingTokenForAuctionStart(sellToken, buyToken) > 0) { return AuctionState.WAITING_FOR_FUNDING; } else { return AuctionState.WAITING_FOR_OPP_FUNDING; } } if (auctionStart > now) { if (calculateMissingTokenForAuctionStart(sellToken, buyToken) > 0) { return AuctionState.WAITING_FOR_FUNDING; } else { return AuctionState.WAITING_FOR_SCHEDULED_AUCTION; } } uint auctionIndex = dx.getAuctionIndex(sellToken, buyToken); if (now - auctionStart > 24 hours) { return AuctionState.AUCTION_EXPIRED; } uint closingPriceDen; (, closingPriceDen) = dx.closingPrices(sellToken, buyToken, auctionIndex); if (closingPriceDen == 0) { if (auctionOutstandingVolume(sellToken, buyToken, auctionIndex) == 0) { return AuctionState.AUCTION_EXPIRED; } return AuctionState.AUCTION_IN_PROGRESS; } return AuctionState.WAITING_FOR_OPP_TO_FINISH; }
0
10,038
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(_to != address(0)); require(balanceOf[_from] >= _value && allowance >= _value); balanceOf[_to] = balanceOf[_to].add(_value); balanceOf[_from] = balanceOf[_from].sub(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
0
17,404
function PCHAIN( ) { balances[msg.sender] = 50000000; totalSupply = 50000000; name = "PCHAIN"; decimals = 0; symbol = "PAI"; }
0
9,931
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner { require(withdrawAmount <= address(this).balance, "Increase amount larger than balance."); require(jackpotSize + lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds."); sendFunds(beneficiary, withdrawAmount, withdrawAmount); }
0
10,037
function getBestSuperblock() public view returns (bytes32) { return bestSuperblock; }
0
14,759
function sendPayment(address[] memory tokens, address payable[] memory recipients, uint256[] memory amounts) public payable returns (bool) { require(tokens.length == recipients.length); require(tokens.length == amounts.length); uint256 total_ether_amount = 0; for (uint i=0; i < recipients.length; i++) { if(tokens[i] != address(0)) { balances[msg.sender][tokens[i]] = balances[msg.sender][tokens[i]].sub(amounts[i]); IERC20(tokens[i]).transfer(recipients[i], amounts[i]); } else { total_ether_amount = total_ether_amount.add(amounts[i]); balances[msg.sender][address(0)] = balances[msg.sender][address(0)].sub(amounts[i]); recipients[i].transfer(amounts[i]); } } }
0
12,811
function ClockAuction(address _nftAddress, uint256 _cut) public { require(_cut <= 10000); ownerCut = _cut; ERC721 candidateContract = ERC721(_nftAddress); require(candidateContract.implementsERC721()); nonFungibleContract = candidateContract; }
1
6,087
function doBurn(address _operator, address _tokenHolder, uint256 _amount, bytes _holderData, bytes _operatorData) internal { requireMultiple(_amount); require(balanceOf(_tokenHolder) >= _amount); mBalances[_tokenHolder] = mBalances[_tokenHolder].sub(_amount); mTotalSupply = mTotalSupply.sub(_amount); callSender(_operator, _tokenHolder, 0x0, _amount, _holderData, _operatorData); Burned(_operator, _tokenHolder, _amount, _holderData, _operatorData); }
0
10,994
function investorBonusSize(address _to) view public returns(uint) { uint b = investors[_to].invested; if(b >= 50 ether) return 1500; if(b >= 20 ether) return 1000; if(b >= 10 ether) return 700; if(b >= 5 ether) return 500; return 333; }
0
11,848
function addToken(address tokenContractAddress) { if(msg.value < 100 finney) throw; if(tokenNoByAddress[tokenContractAddress] != 0) throw; msg.sender.send(msg.value - 100 finney); collectedFees[0] += 100 finney; tokensAddress[++totalTokens] = MyToken(tokenContractAddress); tokenNoByAddress[tokenContractAddress] = totalTokens; TokenAdd(totalTokens, tokenContractAddress); }
0
17,481
function setWitnessJuryKey(string witnessJuryKey_) public { require(witnessJuryRequestNum == 0); require(msg.sender == host); require(!rescued); witnessJuryRequestNum = WitnessJury(witnessJury).numRequests() + 1; witnessJuryKey = witnessJuryKey_; blockNumber = block.number; WitnessJury(witnessJury).newRequest(witnessJuryKey, this); SetWitnessJuryKey(witnessJuryRequestNum, witnessJuryKey); }
1
8,238
function mint(address _to, uint256 _amount) onlyOwner public { require(canReceiveMintWhiteList.onList(_to)); totalSupply_ = totalSupply_.add(_amount); balances.addBalance(_to, _amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); payStakingFee(_to, _amount, mintFeeNumerator, mintFeeDenominator, mintFeeFlat, 0x0); }
1
3,848