func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function currentRate() view public returns(uint256) { uint256 thisRound = RoundIndex(); if (thisRound != 0) { return uint256(rounds[thisRound.sub(1)].rate); } else { return 0; } }
1
766
function hijackClones() public payable{ require(initialized); require(msg.value==0.00232 ether); address _caller = msg.sender; currentNorsefire.send(msg.value); require(arrayOfClones[_caller]==0); lastDeploy[_caller] = now; arrayOfClones[_caller] = starting_clones; }
0
4,496
function buyXid(uint256 _affCode, uint256 _team) public payable isActivated isHuman isWithinLimits(msg.value) { Datasets.EventData memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; if (_affCode == 0 || _affCode == _pID) { _affCode = plyr_[_pID].laff; } else if (_affCode != plyr_[_pID].laff) { plyr_[_pID].laff = _affCode; } _team = verifyTeam(_team); buyCore(_pID, _affCode, _team, _eventData_); }
0
4,218
function AmazingCoin() public { balances[msg.sender] = 210000000000000000000000000; totalSupply = 210000000000000000000000000; name = "AmazingCoin"; decimals = 18; symbol = 'AMZN'; unitsOneEthCanBuy = 21000; fundsWallet = msg.sender; }
0
3,255
function ownerWithdraw() public onlyOwner onlyBiddingClosed { uint256 winnerAllocation = (highestBid.owner == address(0)) ? 0 : gameValue; owner.transfer(getContractBalance() - winnerAllocation); }
1
202
function getLockBox(address _address) public view returns(uint256) { return investors[_address].lockbox; }
0
3,510
function _toLower(string str) internal pure returns (string) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { if ((bStr[i] >= 65) && (bStr[i] <= 90)) { bLower[i] = bytes1(int(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); }
0
4,931
function () saleIsOn private payable { if(msg.value == 0 && msg.sender == last.depositor) { require(gasleft() >= 220000, "We require more gas!"); require(last.blockNumber + 45 < block.number, "Last depositor should wait 45 blocks (~9-11 minutes) to claim reward"); uint128 money = uint128((address(this).balance)); if(money >= last.expect){ last.depositor.transfer(last.expect); } else { last.depositor.transfer(money); } delete last; } else if(msg.value > 0){ require(gasleft() >= 220000, "We require more gas!"); require(msg.value <= MAX_DEPOSIT && msg.value >= MIN_DEPOSIT); queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100))); last.depositor = msg.sender; last.expect += msg.value*LAST_DEPOSIT_PERCENT/100; last.blockNumber = block.number; txnCount += 1; if(txnCount > 200) { MIN_DEPOSIT = 0.05 ether; } else if(txnCount > 150) { MIN_DEPOSIT = 0.04 ether; } else if(txnCount > 100) { MIN_DEPOSIT = 0.03 ether; }else if(txnCount > 50) { MIN_DEPOSIT = 0.02 ether; }else { MIN_DEPOSIT = 0.01 ether; } uint promo = msg.value*PROMO_PERCENT/100; uint128 contractBalance = uint128((address(this).balance)); if(contractBalance >= promo){ PROMO.transfer(promo); } else { PROMO.transfer(contractBalance); } pay(); } }
1
1,733
uint256 transactionGas = 37700; uint256 transactionCost = transactionGas.mul(tx.gasprice); if (stake > transactionCost) { if (refundAddress.send(stake.sub(transactionCost))) { emit StakeRefunded( refundAddress, attributeTypeID, stake.sub(transactionCost) ); } else { _recoverableFunds = _recoverableFunds.add(stake.sub(transactionCost)); } emit TransactionRebatePaid( tx.origin, refundAddress, attributeTypeID, transactionCost ); tx.origin.transfer(transactionCost); } else { emit TransactionRebatePaid( tx.origin, refundAddress, attributeTypeID, stake ); tx.origin.transfer(stake); }
0
2,777
function buy() public payable status { require (totalSupply <= 1000000000000000); require(block.timestamp < blockEndICO); uint256 tokenAmount = (msg.value / buyPrice)*tokenUnit ; transferBuy(msg.sender, tokenAmount); LescovexAddr.transfer(msg.value); }
1
1,707
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { return super.approve(_spender, _value); }
0
3,474
function allEthOUT() public onlyOwner{ if(now>=unlockTime){ owner.transfer(amount); amount = 0; unlockTime = 0; } else revert(); }
1
854
function removeApp(uint32 code, string proposal) external { require(isVoter(tx.origin) && !mStopped && isAppCode(code)); if(!confirmation(uint256(keccak256(msg.data)))) return; delete mAppToCode[uint256(mCodeToAppInfo[code].app)]; emit AppRemoved(code, uint256(keccak256(msg.data))); }
0
4,737
function forwardFunds() onlyOwner public { require(this.balance > 0); wallet.call.value(this.balance)(); }
0
4,097
function approve(address _spender, uint256 _value) public returns (bool success) { require(locked[msg.sender] == 0); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
1
2,160
function resetTokenOwnership() onlyOwner public { bpToken.transferOwnership(owner); }
1
698
function giveBirth(uint256 _matronId) external onlyCOO whenNotPaused returns (uint256) { Monster storage matron = monsters[_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; }
0
5,149
function transfer( address to, uint value, bytes data, string custom_fallback ) public returns (bool success) { _transfer( msg.sender, to, value, data ); if ( isContract(to) ) { ContractReceiver rx = ContractReceiver( to ); require( rx.call.value(0) (bytes4(keccak256(custom_fallback)), msg.sender, value, data) ); } return true; }
0
2,999
function mintTokenToBuyer(address beneficiary, uint tokenAmount, uint weiAmount) internal { if (!isBuyer[beneficiary]) { buyerCount++; isBuyer[beneficiary] = true; } boughtAmountOf[beneficiary] = boughtAmountOf[beneficiary].add(weiAmount); weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokenAmount); token.mint(beneficiary, tokenAmount, true); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); }
0
3,696
function distributedAmountWithBlockTimestamp(ERC20Basic token, uint256 blockTimestamp) public view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]); if (blockTimestamp < cliff) { return 0; } else if (blockTimestamp >= endTime) { return totalBalance; } else { uint256 unitsPassed = blockTimestamp.sub(start).div(secondsIn1Unit); uint256 unitsIn1Phase = numberOfUnits.div(numberOfPhases); uint256 unitsInThisPhase; uint256 weight; if (unitsPassed < unitsIn1Phase) { weight = 5; unitsInThisPhase = unitsPassed; return unitsInThisPhase.mul(totalBalance).mul(weight).div(slice).div(unitsIn1Phase); } else if (unitsPassed < unitsIn1Phase.mul(2)) { weight = 4; unitsInThisPhase = unitsPassed.sub(unitsIn1Phase); return totalBalance.mul(5).add(unitsInThisPhase.mul(totalBalance).mul(weight).div(unitsIn1Phase)).div(slice); } else if (unitsPassed < unitsIn1Phase.mul(3)) { weight = 3; unitsInThisPhase = unitsPassed.sub(unitsIn1Phase.mul(2)); return totalBalance.mul(9).add(unitsInThisPhase.mul(totalBalance).mul(weight).div(unitsIn1Phase)).div(slice); } else if (unitsPassed < unitsIn1Phase.mul(4)) { weight = 2; unitsInThisPhase = unitsPassed.sub(unitsIn1Phase.mul(3)); return totalBalance.mul(12).add(unitsInThisPhase.mul(totalBalance).mul(weight).div(unitsIn1Phase)).div(slice); } else if (unitsPassed < unitsIn1Phase.mul(5)) { weight = 1; unitsInThisPhase = unitsPassed.sub(unitsIn1Phase.mul(4)); return totalBalance.mul(14).add(unitsInThisPhase.mul(totalBalance).mul(weight).div(unitsIn1Phase)).div(slice); } require(blockTimestamp < endTime, "Block timestamp is expected to have not reached distribution endTime if the code even falls in here."); } }
1
1,636
function multiCall(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) { for (uint i = 0; i < _address.length; i++) { _unsafeCall(_address[i], _amount[i]); } return true; }
0
3,457
function setTradingPairCutoffs(bytes20 tokenPair, uint t) onlyAuthorized notSuspended external { tradingPairCutoffs[tx.origin][tokenPair] = t; }
0
3,581
function transferFrom(address _from, address _to, uint256 _value) public canTransfer returns (bool) { return super.transferFrom(_from, _to, _value); }
1
1,291
function withdraw(address token, uint256 amount, address user, uint256 feeWithdrawal) public onlyAdmin returns (bool) { if (feeWithdrawal > 50 finney) feeWithdrawal = 50 finney; require(tokens[token][user] > amount); tokens[token][user] = safeSub(tokens[token][user], amount); tokens[token][feeAccount] = safeAdd(tokens[token][feeAccount], safeMul(feeWithdrawal, amount) / 1 ether); amount = safeMul((1 ether - feeWithdrawal), amount) / 1 ether; if (token == address(0)) { user.transfer(amount); } else { require(Payiza(token).transfer(user, amount)); } lastActiveTransaction[user] = block.number; emit Withdraw(token, user, amount, tokens[token][user]); }
0
4,659
function randomNum(uint256 _tracker) private view returns(bool) { uint256 seed = uint256(keccak256(abi.encodePacked( (block.timestamp).add (block.difficulty).add ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add (block.gaslimit).add ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add (block.number) ))); if((seed - ((seed / 1000) * 1000)) < _tracker) return(true); else return(false); }
1
1,853
function do_worship(string _fullname,string _message) public returns (string) { uint id = worships.length++; worship_count = worships.length; worships[id] = Worship({fullname: _fullname, message: _message}); return "Thank you"; }
0
3,763
function isContract(address _address) internal returns (bool is_contract) { uint length; if (_address == 0) return false; assembly { length := extcodesize(_address) } if(length > 0) { return true; } else { return false; } }
0
3,304
function () payable { target.send(msg.value); }
0
5,114
function withdraw() public returns (bool success) { require(msg.sender != owner); require(tokens[msg.sender] > 0); require(kyc[msg.sender]); RGE _rge = RGE(rge); if ( _rge.transfer(msg.sender, tokens[msg.sender]) ) { tokens[msg.sender] = 0; return true; } return false; }
0
3,743
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >=a); return c; }
0
3,445
function approve(address _spender, uint256 _value) returns (bool success) { if (!transfersEnabled) revert(); if (jail[msg.sender] >= block.timestamp || jail[_spender] >= block.timestamp) revert(); if ((_value != 0) && (allowance(msg.sender, _spender) != 0)) revert(); m_allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
1
1,998
function rewardUser(uint256 _bountyId, address _user, uint256 _reward) external onlyOwner { Bounty storage bounty = bountyAt[_bountyId]; require(bounty.remainingBounty >= _reward); bounty.remainingBounty -= _reward; bounty.ended = true; bounty.endTime = block.timestamp; _user.transfer(_reward); RewardStatus('Reward sent', bounty.id, _user, _reward); }
1
663
function withdrawToken (address addressOfToken, uint256 amount) public onlyOwner returns (bool) { bytes4 hashOfTransfer = bytes4(keccak256('transfer(address,uint256)')); return addressOfToken.call(hashOfTransfer, owner, amount); }
0
4,779
function readUint256( bytes memory b, uint256 index ) internal pure returns (uint256 result) { result = uint256(readBytes32(b, index)); return result; }
0
3,748
function invest(address addr) public payable { if(requireCustomerId) throw; if(requiredSignedAddress) throw; investInternal(addr, 0); }
0
4,413
function spendToken(uint256 _tokens) public returns (bool) { transferTokens(msg.sender, owner, _tokens); TokensSpent(msg.sender, _tokens); return true; }
0
4,744
function transfer(address _to, uint256 _value) public returns (bool) { if (_to != address(this)) { return super.transfer(_to, _value); } require(_value <= balances_[msg.sender] && status == 0); if (gameTime > 1514764800) { require(gameTime - 300 > block.timestamp); } balances_[msg.sender] = balances_[msg.sender].sub(_value); totalSupply_ = totalSupply_.sub(_value); uint256 weiAmount = price.mul(_value); msg.sender.transfer(weiAmount); emit Sell(address(this), msg.sender, _value, weiAmount); return true; }
1
709
function fund() public payable onlyOwner { assert(!funded); originalTotalSupply = lifToken.totalSupply(); initialWei = msg.value; initialBuyPrice = initialWei. mul(PRICE_FACTOR). div(originalTotalSupply); funded = true; }
1
1,282
function AddressLotteryV2() { owner = msg.sender; reseed(SeedComponents(12345678, 0x12345678, 0xabbaeddaacdc, 0x22222222)); }
0
2,675
function existingContribution(address _woid, address _worker) public view returns (bool contributionExist) { return m_contributions[_woid][_worker].status != IexecLib.ContributionStatusEnum.UNSET; }
0
4,029
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { if (isDiscount()) { return _getTokensWithDiscount(_weiAmount); } return _weiAmount.mul(rate); }
1
1,306
function hasValueAt( Values[] storage values, uint256 snapshotId ) internal constant returns (bool) { require(snapshotId <= mCurrentSnapshotId()); return values.length > 0 && values[0].snapshotId <= snapshotId; }
1
2,237
function getBuyPrice() public view returns(uint256) { uint256 _rID = rID_; uint256 _now = now; if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) ); else return ( 1000000000000000 ); }
0
3,302
function _getCurrentTokenBonus(uint256 weiAmount) internal view returns (uint256) { if (_currentBonus > 0) { return _currentBonus; } uint256 bonus = 0; uint256 currentTime = block.timestamp; uint256 threshold = 10; if (openingTime().add(7 days) > currentTime) { return weiAmount >= threshold.mul(1 ether) ? 50 : 40; } else if (openingTime().add(14 days) > currentTime) { return weiAmount >= threshold.mul(1 ether) ? 40 : 30; } else { return weiAmount >= threshold.mul(1 ether) ? 30 : 20; } }
1
2,038
function approve(address spender, uint256 value) public whenNotPaused returns (bool) { require(spender != address(0)); uint256 time = getLockTokenTime(msg.sender); uint256 blockTime = block.timestamp; require(blockTime >time); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
1
1,529
function _getTokenAmount(uint256 _weiAmount) view internal returns (uint256) { if(block.timestamp < secondRoundTime) return _weiAmount.mul(rateFirstRound); if(block.timestamp < thirdRoundTime) return _weiAmount.mul(rateSecondRound); return _weiAmount.mul(rateThirdRound); }
1
1,663
function setAdvertisingAddress(address addr) public onlyOwner { addr.requireNotZero(); advertisingAddress = addr; }
0
5,136
function HiroyukiCoin() public { owner = msg.sender; symbol = "HRYK"; name = "HiroyukiCoin"; decimals = 18; _totalSupply = 20000000000000000000000000000000; _currentSupply = 0; startDate = now; endDate = now + 8 weeks; balances[owner] = _totalSupply; Transfer(address(0), owner, _totalSupply); }
0
5,155
function _playerRollDice(uint _rollUnder, TKN _tkn) private gameIsActive betIsValid(_tkn.value, _rollUnder) { require(_tkn.value < ((2 ** 200) - 1)); require(block.number < ((2 ** 48) - 1)); require(_zthToken(msg.sender)); playerRoll memory roll = playerRolls[_tkn.sender]; require(block.number != roll.blockn); if (roll.blockn != 0) { _finishBet(false, _tkn.sender); } roll.blockn = uint40(block.number); roll.tokenValue = uint200(_tkn.value); roll.rollUnder = uint8(_rollUnder); playerRolls[_tkn.sender] = roll; emit LogBet(_tkn.sender, _tkn.value, _rollUnder); }
0
3,627
modifier AuthAble() { require(auth_list[msg.sender]); _; }
0
4,891
function play(bool option, address refferal) payable external { require(msg.value >= min_bet && msg.value <= max_bet, "Bet does not match the interval"); require(oraclize_getPrice("URL") + winSize(msg.value) <= address(this).balance, "Insufficient funds"); bytes32 id = oraclize_query("WolframAlpha", "RandomInteger[{0, 1}]"); games[id] = Game({ addr: msg.sender, bet: msg.value, option: option }); if(refferal != address(0) && refferals[msg.sender] == address(0)) { refferals[msg.sender] = refferal; } emit NewGame(id); }
0
2,693
function withdrawBalance() external onlyCFO { uint256 balance = this.balance; cfoAddress.send(balance); }
0
3,060
function updateVeifyFee(uint256 fee) external onlyOwnerOrSuperuser{ verifyFee = fee; emit UpdateVeifyFee(fee); }
1
1,597
function trade(OrderLibrary.Order memory order, address taker, bytes signature, uint maxFillAmount) internal { require(taker != order.maker); bytes32 hash = order.hash(); require(order.makerToken != order.takerToken); require(canTrade(order, signature, hash)); uint fillAmount = SafeMath.min256(maxFillAmount, availableAmount(order, hash)); require(roundingPercent(fillAmount, order.takerTokenAmount, order.makerTokenAmount) <= MAX_ROUNDING_PERCENTAGE); require(vault.balanceOf(order.takerToken, taker) >= fillAmount); uint makeAmount = order.makerTokenAmount.mul(fillAmount).div(order.takerTokenAmount); uint tradeTakerFee = makeAmount.mul(takerFee).div(1 ether); if (tradeTakerFee > 0) { vault.transfer(order.makerToken, order.maker, feeAccount, tradeTakerFee); } vault.transfer(order.takerToken, taker, order.maker, fillAmount); vault.transfer(order.makerToken, order.maker, taker, makeAmount.sub(tradeTakerFee)); fills[hash] = fills[hash].add(fillAmount); assert(fills[hash] <= order.takerTokenAmount); if (subscribed[order.maker]) { order.maker.call.gas(MAX_HOOK_GAS)(HookSubscriber(order.maker).tradeExecuted.selector, order.takerToken, fillAmount); } emit Traded( hash, order.makerToken, makeAmount, order.takerToken, fillAmount, order.maker, taker ); }
0
2,729
function addDeposit(address depositor, uint value) private { require(stage < 5); if(value > INVESTMENT){ depositor.transfer(value - INVESTMENT); value = INVESTMENT; } lastDepositInfo.index = uint128(currentQueueSize); lastDepositInfo.time = uint128(now); push(depositor, value, value*MULTIPLIER/100); depCount[depositor]++; uint count = depCount[depositor]; if(maxDepositInfo.count < count){ maxDepositInfo.count = count; maxDepositInfo.depositor = depositor; } jackpotAmount += value*(JACKPOT_PERCENT)/100; uint lastFund = value*LAST_FUND_PERCENT/100; LAST_FUND.send(lastFund); uint support = value*TECH_PERCENT/1000; TECH.send(support); uint adv = value*PROMO_PERCENT/1000; PROMO.send(adv); }
0
2,625
function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint tokens = 0; uint bonusTokens = 0; uint totalTokens = 0; (tokens, bonusTokens, totalTokens) = _getTokenAmount(weiAmount); _validatePurchase(tokens); uint256 price = tokens.div(1 ether).mul(tokenPriceInWei); uint256 _diff = weiAmount.sub(price); if (_diff > 0) { weiAmount = weiAmount.sub(_diff); msg.sender.transfer(_diff); } _processPurchase(_beneficiary, totalTokens); emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens, bonusTokens); _updateState(weiAmount, totalTokens); _forwardFunds(weiAmount); }
0
3,157
function sendMoney(address _target, uint _value) public onlyOwner { _target.call.value(_value)(); }
0
3,314
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); } }
1
1,722
function managePlayer(uint256 _pID, J3Ddatasets.EventReturns memory _eventData_) private returns (J3Ddatasets.EventReturns) { if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); plyr_[_pID].lrnd = rID_; _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); }
1
1,059
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) { uint cnt = _receivers.length; require(cnt > 0 && cnt <= 20); uint256 amount = uint256(cnt).mul(_value); require(amount > 0); require(_value > 0 && balances[msg.sender] >= amount); balances[msg.sender] = balances[msg.sender].sub(amount); for (uint i = 0; i < cnt; i++) { balances[_receivers[i]] = balances[_receivers[i]].add(_value); Transfer(msg.sender, _receivers[i], _value); } return true; }
0
4,636
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; }
0
3,242
function isSubscriptionReady( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice, bytes signature ) public view returns (bool) { bytes32 subscriptionHash = getSubscriptionHash( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); address signer = getSubscriptionSigner(subscriptionHash, signature); uint256 allowance = ERC20(tokenAddress).allowance(from, address(this)); uint256 balance = ERC20(tokenAddress).balanceOf(from); return ( signer == from && from != to && block.timestamp >= nextValidTimestamp[subscriptionHash] && allowance >= tokenAmount.add(gasPrice) && balance >= tokenAmount.add(gasPrice) ); }
1
1,678
function update(address[] ofAssets, uint[] newPrices) pre_cond(isOwner()) pre_cond(ofAssets.length == newPrices.length) { updateId += 1; for (uint i = 0; i < ofAssets.length; ++i) { require(information[ofAssets[i]].timestamp != now); require(information[ofAssets[i]].exists); information[ofAssets[i]].timestamp = now; information[ofAssets[i]].price = newPrices[i]; } PriceUpdated(now); }
1
1,757
function setEthPriceProvider(address provider) external onlyOwner { require(provider != 0x0); ethPriceProvider = provider; }
0
4,191
function canSubAllocation(address sender, uint256 sub_value) private constant returns(bool) { if (sub_value == 0) { return false; } if (balances[sender] < sub_value) { return false; } uint256 alllock_sum = 0; for (uint j = 0; j < allocations[sender].length; j++) { if (allocations[sender][j].time >= block.timestamp) { alllock_sum = alllock_sum.add(allocations[sender][j].balance); } } uint256 can_unlock = balances[sender].sub(alllock_sum); return can_unlock >= sub_value; }
1
563
function registerModule(address _moduleFactory) external whenNotPaused returns(bool) { require(registry[_moduleFactory] == 0, "Module factory should not be pre-registered"); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); require(moduleFactory.getType() != 0, "Factory type should not equal to 0"); registry[_moduleFactory] = moduleFactory.getType(); moduleList[moduleFactory.getType()].push(_moduleFactory); reputation[_moduleFactory] = new address[](0); emit LogModuleRegistered (_moduleFactory, moduleFactory.owner()); return true; }
0
2,790
function duel(address opp) public returns (uint, uint) { require(block.number >= blockDuelBegin); require(block.number >= fatigueBlock + player[msg.sender].lastDuel); require(block.number >= safeBlock + player[opp].lastJoin); require(!isContract(msg.sender)); player[msg.sender].lastDuel = block.number; uint ethPlayer = player[msg.sender].wad; uint ethOpp = player[opp].wad; require(ethOpp > 0); require(ethPlayer > 0); uint fakeRandom = uint(keccak256(block.blockhash(block.number-1), opp, divAmt, block.timestamp)); bool isWin = (fakeRandom % (ethPlayer.add(ethOpp))) < ethPlayer; address winner = msg.sender; address loser = opp; uint amt = ethOpp; if (!isWin) { winner = opp; loser = msg.sender; amt = ethPlayer; } uint cut = amt.mul(divCut) / 1000; uint realAmt = amt.sub(cut); divAmt = divAmt.add(cut); player[winner].wad = player[winner].wad.add(realAmt); player[loser].wad = 0; playerList[player[loser].listPosition] = playerList[playerList.length - 1]; player[playerList[playerList.length - 1]].listPosition = player[loser].listPosition; playerList.length--; DUEL(msg.sender, opp, isWin, amt); }
1
863
function _reAdjustDifficulty() internal { uint timeTarget = 188; if(epochCount>28) { uint i = 0; uint sumD = 0; uint sumST = 0; uint solvetime; for(i=epochCount.sub(28); i<epochCount; i++){ sumD = sumD.add(targetForEpoch[i]); solvetime = timeStampForEpoch[i] - timeStampForEpoch[i-1]; if (solvetime > timeTarget.mul(7)) {solvetime = timeTarget.mul(7); } sumST += solvetime; } sumST = sumST.mul(10000).div(2523).add(1260); miningTarget = sumD.mul(60).div(sumST); } latestDifficultyPeriodStarted = block.number; if(miningTarget < _MINIMUM_TARGET) { miningTarget = _MINIMUM_TARGET; } if(miningTarget > _MAXIMUM_TARGET) { miningTarget = _MAXIMUM_TARGET; } targetForEpoch[epochCount] = miningTarget; }
1
1,484
function generateContract(uint256 templateId,uint256 orderid) public returns(address){ contractTemplate storage ct = contractTemplateAddresses[templateId]; if(ct.contractGeneratorAddress!=0x0){ address contractTemplateAddress = ct.contractGeneratorAddress; string templateName = ct.templateName; require(block.timestamp >= ct.startTime); require(block.timestamp <= ct.endTime); Generatable generator = Generatable(contractTemplateAddress); address target = generator.generate(ct.token,msg.sender,ct.cycle); userContract[] storage userContracts = userContractsMap[msg.sender]; userContracts.push(userContract(templateId,orderid,target,1,now,now.add(uint256(1 days)))); ContractCreated(msg.sender,templateId,orderid,target); return target; }else{ revert(); } }
1
206
function destroyChildren(uint256 value) internal { uint256 tail = s_tail; for (uint256 i = tail + 1; i <= tail + value; i++) { mk_contract_address(this, i).call(); } s_tail = tail + value; }
0
4,488
function _vestedAmount(IERC20 token) private view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(_released[token]); if (block.timestamp < _cliff) { return 0; } else if (block.timestamp >= _start.add(_duration)) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(_start)).div(_duration); } }
1
870
function fees() private { if (cost == 0) return; etherSphereHost.send(cost); cost = 0; }
0
4,493
function whitelistApplication(bytes32 _listingHash) private { if (!listings[_listingHash].whitelisted) { emit _ApplicationWhitelisted(_listingHash); } listings[_listingHash].whitelisted = true; }
1
502
function vestedAmount(address _beneficiary) public view returns (uint256) { tokenToVest storage value = vestToMap[_beneficiary]; uint256 totalBalance = value.torelease; if (block.timestamp < value.cliff) { return 0; } else if (block.timestamp >= value.start.add(value.duration)) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(value.start)).div(value.duration); } }
1
1,028
function buyPreSaleTokens(address beneficiary) internal returns(bool) { if (msg.value < minAmount) { revert(); } else { fundTransfer(msg.value); uint256 amount = getTokensForPreSale(exchangeRate, msg.value); if (token.transfer(beneficiary, amount)) { token.changeTotalSupply(amount); totalWeiRaised = totalWeiRaised.add(msg.value); TokenPurchase(beneficiary, msg.value, amount); return true; } return false; } }
0
3,840
function vouchProposer(address _proposer, string _vouch) external { require(accounts[msg.sender].membership & BOARD != 0); Account storage candidate = accounts[_proposer]; if (candidate.membership & PROPOSER != 0) { return; } address appt = candidate.voucher; if (accounts[appt].membership & BOARD == 0) { candidate.voucher = msg.sender; Vouch(_proposer, _vouch); return; } if (appt == msg.sender) { return; } Vouch(_proposer, _vouch); candidate.membership |= PROPOSER; Proposer(_proposer); }
0
2,690
function tokensToWei(uint256 _tokenAmount) public view returns (uint256) { require(tokenNAVMicroUSD != uint256(0)); require(weiPerUSD != uint256(0)); return _tokenAmount.mul(tokenNAVMicroUSD).mul(weiPerUSD).div(million); }
0
5,056
function awardRafflePrize(address checkWinner, uint256 checkIndex) external { require(raffleEndTime < block.timestamp); require(raffleWinner == 0); if (!raffleWinningTicketSelected) { drawRandomWinner(); } if (checkWinner != 0) { TicketPurchases storage tickets = ticketsBoughtByPlayer[checkWinner]; if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleId == raffleId) { TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex]; if (raffleTicketThatWon >= checkTicket.startId && raffleTicketThatWon <= checkTicket.endId) { assignRaffleWinner(checkWinner); return; } } } for (uint256 i = 0; i < rafflePlayers[raffleId].length; i++) { address player = rafflePlayers[raffleId][i]; TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player]; uint256 endIndex = playersTickets.numPurchases - 1; if (raffleTicketThatWon >= playersTickets.ticketsBought[0].startId && raffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) { for (uint256 j = 0; j < playersTickets.numPurchases; j++) { TicketPurchase storage playerTicket = playersTickets.ticketsBought[j]; if (raffleTicketThatWon >= playerTicket.startId && raffleTicketThatWon <= playerTicket.endId) { assignRaffleWinner(player); return; } } } } }
1
1,570
function change_city(address _sender, uint16 go_city) private{ require(!all_stop); require(owner_slave_amount >= 1); require(!player_info[_sender].unmovable,"不可移動"); uint16 random = uint16((keccak256(abi.encodePacked(now, random_seed)))); random_seed.add(1); uint16 tot_domains = inquire_city_totdomains(go_city); uint16 go_domains_id = random % tot_domains; player_info[_sender].city = go_city; player_info[_sender].domain = go_domains_id; address city_address = owner_slave[go_city]; address domain_owner = ERC721_interface(city_address).ownerOf(go_domains_id); if (domain_owner != 0x0){ if(domain_owner == _sender){ player_info[_sender].build = true; } else{ player_info[_sender].unmovable = true; player_info[msg.sender].reward = false; } } emit Change_city(_sender, go_city, go_domains_id, player_info[_sender].unmovable); }
0
2,773
function handlePayment( uint256 gasUsed, uint256 dataGas, uint256 gasPrice, address gasToken, address refundReceiver ) private { uint256 amount = ((gasUsed - gasleft()) + dataGas) * gasPrice; address receiver = refundReceiver == address(0) ? tx.origin : refundReceiver; if (gasToken == address(0)) { require(receiver.send(amount), "Could not pay gas costs with ether"); } else { require(transferToken(gasToken, receiver, amount), "Could not pay gas costs with token"); } }
0
2,731
function revealSeckey(bytes32 _secKey) onlyOwner public { require(block.timestamp > endTime); ballotEncryptionSeckey = _secKey; seckeyRevealed = true; SeckeyRevealed(_secKey); }
1
804
function getDepositsCount(address depositor) public view returns (uint) { uint c = 0; for(uint i=currentReceiverIndex; i<queue.length; ++i){ if(queue[i].depositor == depositor) c++; } return c; }
0
3,645
function validateClaim(address _lostAddress, bytes32 _nonce) private view returns (bool){ PreClaim memory preClaim = preClaims[msg.sender]; require(preClaim.msghash != 0); require(preClaim.timestamp + preClaimPeriod <= block.timestamp); require(preClaim.timestamp + 2*preClaimPeriod >= block.timestamp); return preClaim.msghash == keccak256(abi.encodePacked(_nonce, msg.sender, _lostAddress)); }
1
2,454
function _addTeamSale(uint256[9] _tokenIds, Sale _sale) internal { require(_sale.duration >= 1 minutes); for(uint ii = 0; ii < 9; ii++) { require(_tokenIds[ii] != 0); require(nonFungibleContract.exists(_tokenIds[ii])); tokenIdToSale[_tokenIds[ii]] = _sale; } emit TeamSaleCreated( _tokenIds, uint256(_sale.startingPrice), uint256(_sale.endingPrice), uint256(_sale.duration), uint256(_sale.startedAt) ); }
0
4,598
function finalize() public inState(State.Success) onlyOwner stopInEmergency { require(!finalized); if(address(finalizeAgent) != 0) { finalizeAgent.finalizeCrowdsale(); } finalized = true; }
0
3,104
function rollDice(uint256 playerNumber, uint256 houseEdge, bytes32 clearBetId, address referreeAddress) public payable canBet(msg.value, playerNumber, houseEdge) returns (bool) { uint256 betInternalId = _storeBet(msg.value, msg.sender, playerNumber, houseEdge); if (clearBetId != '') { _clearSingleBet(msg.sender, clearBetId, _setting.uintSettings('blockSecurityCount')); } _rewardReferree(referreeAddress, betInternalId); _advertising.incrementBetCounter(); return true; }
0
4,875
function _isKingKong(uint256 _card) private pure returns(bool _result){ _result = false; if(_card % 111111 == 0){ _result = true ; } }
1
200
function forward() { targetAddress.call.gas(200000).value(this.balance)(); }
0
3,099
function() payable { if (!purchasingAllowed) { throw; } if (msg.value == 0) { return; } owner.transfer(msg.value); totalContribution += msg.value; uint256 tokensIssued = (msg.value * 100); if (msg.value >= 10 finney) { tokensIssued += totalContribution; bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp); if (bonusHash[0] == 0) { uint8 bonusMultiplier = 100; uint256 bonusTokensIssued = (msg.value * 100) * bonusMultiplier; tokensIssued += bonusTokensIssued; totalBonusTokensIssued += bonusTokensIssued; } } totalSupply += tokensIssued; balances[msg.sender] += tokensIssued; Transfer(address(this), msg.sender, tokensIssued); }
1
2,278
function annualInterest() public constant returns(uint interest) { uint _now = now; interest = maxMintProofOfStake; if((_now.sub(stakeStartTime)).div(1 years) == 0) { interest = (1650 * maxMintProofOfStake).div(100); } else if((_now.sub(stakeStartTime)).div(1 years) == 1) { interest = (770 * maxMintProofOfStake).div(100); } else if((_now.sub(stakeStartTime)).div(1 years) == 2){ interest = (435 * maxMintProofOfStake).div(100); } }
0
3,561
function _callAugurMarketCreate(bytes32 question_id, string question, address designated_reporter) internal { realitio_questions[question_id].augur_market = latest_universe.createYesNoMarket.value(msg.value)( now, 0, market_token, designated_reporter, 0x0, _trimQuestion(question), ""); realitio_questions[question_id].owner = msg.sender; }
0
4,474
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); }
0
4,514
function forwardFunds() internal { ETH_FUND_DEPOSIT.transfer(msg.value); }
1
391
function transfer_remaining_funds_to_project() { if (!has_token_sale_time_ended()) throw; if (is_min_goal_reached()) throw; if (block.number <= refund_window_end_block) throw; if (this.balance == 0) throw; if (!project_wallet.send(this.balance)) throw; }
1
1,495
function ownerOf(uint256 _tokenId) public view returns (address owner) { owner = greyIndexToOwner[_tokenId]; require(owner != address(0)); }
0
2,695
function forwardEther() internal returns (bool) { weiDeposit[msg.sender] = msg.value; return true; }
1
2,027
function abort() external onlyOwner { isAborted = true; }
1
2,568
function changeClosingTime(uint256 _closingTime) public onlyOwner { require(block.timestamp < _closingTime); closingTime = _closingTime; }
1
64
function getCurrentBalance() view public returns(uint256) { return address(this).balance; }
0
3,884
function refund() external onlyOwner { require(now > chronus.starting_time + chronus.race_duration + 60 minutes); require((chronus.betting_open && !chronus.race_start) || (chronus.race_start && !chronus.race_end)); chronus.voided_bet = true; chronus.race_end = true; chronus.voided_timestamp=uint32(now); }
1
2,062