func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function investInternal(address receiver, string customerId) stopInEmergency private { if(getState() == State.PreFunding) { require(earlyParticipantWhitelist[receiver]); } else if(getState() == State.Funding) { } else { require(false); } uint weiAmount = msg.value; uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals()); require(tokenAmount != 0); if(investedAmountOf[receiver] == 0) { investorCount++; } investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver],weiAmount); tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver],tokenAmount); weiRaised = safeAdd(weiRaised,weiAmount); tokensSold = safeAdd(tokensSold,tokenAmount); require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)); assignTokens(receiver, tokenAmount); require(multisigWallet.send(weiAmount)); Invested(receiver, weiAmount, tokenAmount, customerId); }
0
3,593
function getSubscriptionHash( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice, uint256 nonce ) public view returns (bytes32) { return keccak256( abi.encodePacked( byte(0x19), byte(0), address(this), from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice, nonce )); }
1
1,242
function buyXnameQR(address _realSender, uint256 _team) isActivated() isWithinLimits(msg.value) public payable { F3Ddatasets.EventReturns memory _eventData_ = determinePIDQR(_realSender,_eventData_); uint256 _pID = pIDxAddr_[_realSender]; uint256 _affID = 1; _team = 0; buyCoreQR(_realSender, _pID, _affID, _team, _eventData_); }
0
4,476
function batchReturnEthIfFailed(uint _numberOfReturns) onlyOwner public { require(block.timestamp > crowdsaleEndedTime && ethRaised < minCap); address currentParticipantAddress; uint contribution; for (uint cnt = 0; cnt < _numberOfReturns; cnt++) { currentParticipantAddress = contributorIndexes[nextContributorToClaim]; if (currentParticipantAddress == 0x0) { return; } if (!hasClaimedEthWhenFail[currentParticipantAddress]) { contribution = contributorList[currentParticipantAddress].contributionAmount; hasClaimedEthWhenFail[currentParticipantAddress] = true; if (!currentParticipantAddress.send(contribution)) { ErrorSendingETH(currentParticipantAddress, contribution); } } nextContributorToClaim += 1; } }
1
657
function getConfirmationCount(uint transactionId) public constant returns (uint count) { for (uint i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; }
0
4,821
function allocatePVT_InvTokens(address[] _beneficiaries, uint256[] _amounts) external onlyOwner { PausableToken(token).unpause(); pvt_inv_Pool.allocate(_beneficiaries, _amounts); PausableToken(token).pause(); }
1
1,902
function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 1 ether / 10; uint256 bonusCond2 = 1 ether; uint256 bonusCond3 = 5 ether; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 5 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 10 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 15 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 5 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 10 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 867e8; if (Claimed[investor] == false && progress0drop <= target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } multisig.transfer(msg.value); }
0
3,882
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { super._preValidatePurchase(_beneficiary, _weiAmount); uint256 tokenAmount = _getTokenAmount(_weiAmount); if (block.timestamp < saleStartTime) { require(tokenPresaleSold.add(tokenAmount) <= tokenPresaleCap); } else { require(tokenSold.add(tokenAmount) <= totalTokenSaleCap); } }
1
2,440
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _p1 = _eth / 100; uint256 _com = _eth / 5; _com = _com.add(_p1); uint256 _p3d; if (!address(admin).call.value(_com)()) { _p3d = _com; _com = 0; } uint256 _aff = _eth / 8; if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _p3d.add(_aff); } _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { uint256 _potAmount = _p3d / 2; admin.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
1
2,298
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _p1 = _eth / 100; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d; if (!address(p3d_coinbase).call.value(_com)()) { _p3d = _com; _com = 0; } uint256 _aff = _eth / 10; if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _p3d.add(_aff); } _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { uint256 _potAmount = _p3d / 2; p3d_coinbase.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
1
428
function withdraw(uint amount) onlyOwner { ownerAddress.send(amount); }
0
4,856
function _processPurchase( address _beneficiary, uint256 _tokenAmount ) internal { super._processPurchase(_beneficiary, _tokenAmount); contributions.addTokenBalance(_beneficiary, _tokenAmount); }
1
2,317
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
0
2,603
function timeLeftToContestStart() public view returns(uint256 time){ if(block.timestamp>contestStartTime){ return 0; } return SafeMath.sub(contestStartTime,block.timestamp); }
1
2,523
function transferFromWithSender( address _sender, address _from, address _to, uint256 _value ) public onlyProxy returns (bool success) { require(_to != address(0)); uint256 balanceOfFrom = erc20Store.balances(_from); require(_value <= balanceOfFrom); uint256 senderAllowance = erc20Store.allowed(_from, _sender); require(_value <= senderAllowance); erc20Store.setBalance(_from, balanceOfFrom - _value); erc20Store.addBalance(_to, _value); erc20Store.setAllowance(_from, _sender, senderAllowance - _value); erc20Proxy.emitTransfer(_from, _to, _value); return true; }
0
3,422
function issueTokens(address _beneficiary, uint256 _amount) onlyOwner { require(_beneficiary != 0x0 && _amount > 0); token.issueTokens(_beneficiary, _amount.mul(100000000)); ETHcap = ETHcap.sub(_amount.mul(100000000000000000000000000).div(rate)); }
0
4,966
function gettransferableStartTime() constant returns (uint){return now - transferableStartTime;} modifier onlyWhenTransferEnabled() { if ( now < transferableStartTime ) { require(msg.sender == tokenSaleContract || msg.sender == fullTokenWallet || msg.sender == owner); } _; }
0
2,986
function lockup(address recipient, uint256 amount, uint256 lockedUntil) onlyOwner notNull(recipient) notZero(amount) nonReentrant external { ensureTokensAvailable(amount); TokenPromise storage promise = createPromise(recipient, amount, lockedUntil); if (recipient == owner) { doConfirm(promise); } }
0
3,279
function buyForBtc( address _addr, uint256 _sat, uint256 _satOwed, uint256 _wei, uint256 _weiOwed ) onlyOwner withinPeriod public { require(_addr != address(0)); satFreeze(_addr, _weiOwed, _satOwed); satTransfer(_addr, _wei, _sat); }
0
4,409
function updateEndTime(uint256 _endTime) public onlyOwner { require(isOfferingStarted); require(_endTime >= startTime); endTime = _endTime; }
1
2,585
function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool success) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue < oldValue) { require(getFreeBalance(msg.sender) >= oldValue.sub(_subtractedValue)); } return super.decreaseApproval(_spender, _subtractedValue); }
1
2,323
function withdrawPot () public player { require(startTime > 0); require(block.timestamp > (endTime + 10 minutes)); require(!potWithdrawn); require(totalPot > 0); require(addressOfCaptain == msg.sender); uint payout = totalPot; totalPot = 0; potWithdrawn = true; addressOfCaptain.transfer(payout); emit Won(msg.sender, payout); }
1
1,209
function unFreeze() onlyOwner() { freeze = false; }
0
2,755
function finalize() external { if (!funding) throw; if ((block.number <= fundingEndBlock || totalTokens < tokenCreationMin) && totalTokens < tokenCreationCap) throw; funding = false; if (!bitplusAddress.send(this.balance)) throw; for (uint i = 0; i < earlyBackers.length; i++) { if(earlyBackers[i].deposited != uint256(0)) { uint256 percentage = (earlyBackers[i].deposited * earlyBackers[i].agreedPercentage / earlyBackers[i].agreedEthPrice); uint256 additionalTokens = totalTokens * percentage / (10000 - percentage); address backerAddr = earlyBackers[i].backerAddress; balances[backerAddr] = additionalTokens; totalTokens += additionalTokens; Transfer(0, backerAddr, additionalTokens); } } }
1
1,616
function _isEndCollect() private view returns (bool) { return !enabled && block.timestamp> endTimestamp; }
1
2,284
function withdrawAdmin(address token, uint256 amount, address user, uint nonce, uint8 v, bytes32 r, bytes32 s) public onlyAdmin { require(amount > 0); bytes32 hash = keccak256(abi.encodePacked(this, token, amount, user, nonce)); require(!withdrawn[hash]); withdrawn[hash] = true; address signer = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), v, r, s); require(user == signer); require(reduceBalance(user, token, amount)); if (token == address(0)) { require(user.send(toTokenAmount(address(0), amount))); } else { require(Token(token).transfer(user, toTokenAmount(token, amount))); } emit Withdraw(token, user, amount, balances[token][user]); }
0
3,384
constructor( uint256 _openingTime, uint256 _closingTime, uint256 _rate, address _wallet, uint256 _tokenCap, uint256 _minimumContribution, address _token, address _contributions, uint256 _tierZero ) DefaultICO( _openingTime, _closingTime, _rate, _wallet, _minimumContribution, _token, _contributions, _tierZero ) TokenCappedCrowdsale(_tokenCap) public {}
1
1,049
function transfer(address _to, uint256 _value) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
0
4,712
function burn(uint256 _amount) public { require(!fundManagers[msg.sender]); super.burn(_amount); }
0
5,122
function revokeVesting(PeriodicTokenVesting _vesting, ERC20Basic token) public onlyOwner() { _vesting.revoke(token); emit VestingRevoked(_vesting); }
1
1,643
function withdraw() public returns (bool){ require(joined[msg.sender] > 0); uint256 balance = getBalance(msg.sender); if ( address(this).balance > balance && balance <= address(this).balance.sub(stock) ){ if (balance > 0){ withdrawals[msg.sender] = withdrawals[msg.sender].add(balance); msg.sender.transfer(balance); emit Withdraw(msg.sender, balance); } return true; } else { return false; } }
1
1,595
function playerRollDice(uint rollUnder) public payable gameIsActive betIsValid(msg.value, rollUnder) { contractBalance = safeSub(contractBalance, oraclize_getPrice("URL", gasForOraclize)); totalBets += 1; totalWeiWagered += msg.value; bytes32 rngId = oraclize_query("nested", "[URL] ['json(https: playerBetId[rngId] = rngId; playerNumber[rngId] = rollUnder; playerBetValue[rngId] = msg.value; playerAddress[rngId] = msg.sender; playerProfit[rngId] = ((((msg.value * (100-(safeSub(rollUnder,1)))) / (safeSub(rollUnder,1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value; maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[rngId]); if(maxPendingPayouts >= contractBalance) throw; LogBet(playerBetId[rngId], playerAddress[rngId], safeAdd(playerBetValue[rngId], playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]); }
0
5,120
function withdrawFunds(address beneficiary, uint256 withdrawAmount) public onlyOwner { require (withdrawAmount <= address(this).balance); require (jackpotSize + lockedInBets + withdrawAmount <= address(this).balance); sendFunds(beneficiary, withdrawAmount, withdrawAmount); }
0
4,917
function EnglandvsBelgium() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
0
4,803
function getPrice(address token) public view returns (uint, uint) { Price memory price = tokenPrices[token]; return (price.numerator, price.denominator); }
0
5,026
function post(string data, bytes20[] recipients) public payable { emit Claim(data); send(recipients); }
0
3,017
function finalise() public onlyOwner { require(didOwnerEndCrowdsale || block.timestamp > end || capReached); token.finishMinting(); token.unpause(); token.transferOwnership(owner); }
1
1,351
function __setTokenPrice( uint256 _crowdsaleTokenPriceNumerator, uint256 _crowdsaleTokenPriceDenominator ) onlySecretaryGeneral { crowdsaleTokenPriceNumerator = _crowdsaleTokenPriceNumerator; crowdsaleTokenPriceDenominator = _crowdsaleTokenPriceDenominator; }
0
3,509
function canStart() public view returns (bool) { uint256 timeOfWeek = (block.timestamp - 345600) % 604800; uint256 windows = activeTimesFrom.length; if (windows == 0) { return true; } for (uint256 i = 0; i < windows; i++) { if (timeOfWeek >= activeTimesFrom[i] && timeOfWeek <= activeTimesTo[i]) { return true; } } return false; }
1
2,067
function removeMinter(address minter) external onlyOwner { removeRole(minter, ROLE_MINTER); }
1
2,226
function updateInvestor() public payable { require(msg.value >= investmentMin); theInvestor.send(msg.value.div(100).mul(60)); investmentMin = investmentMin.mul(2); theInvestor = msg.sender; }
0
4,934
function withdraw() notOnPause public { if (block.timestamp >= x.c(msg.sender) + 10 minutes) { uint _payout = (x.d(msg.sender).mul(x.getInterest(msg.sender)).div(10000)).mul(block.timestamp.sub(x.c(msg.sender))).div(1 days); x.updateCheckpoint(msg.sender); } if (_payout > 0) { if (_payout > address(this).balance) { nextWave(); return; } msg.sender.transfer(_payout); emit LogIncome(msg.sender, _payout, "withdrawn"); } }
1
102
function finalized() public view returns (bool) { return _finalized; }
1
977
function adjustInflationRate() private { lastInflationUpdate = now; if (inflationRate > 100) { inflationRate = inflationRate.sub(300); } else if (inflationRate > 10) { inflationRate = inflationRate.sub(5); } adjustMintRates(); }
0
3,625
function endVesting(address _addressToEnd, address _addressToRefund) public onlyOwner vestingScheduleConfirmed(_addressToEnd) addressNotNull(_addressToRefund) { VestingSchedule storage vestingSchedule = schedules[_addressToEnd]; uint amountWithdrawable = 0; uint amountRefundable = 0; if (block.timestamp < vestingSchedule.cliffTimeInSec) { amountRefundable = vestingSchedule.totalAmount; } else { uint totalAmountVested = getTotalAmountVested(vestingSchedule); amountWithdrawable = safeSub(totalAmountVested, vestingSchedule.totalAmountWithdrawn); amountRefundable = safeSub(vestingSchedule.totalAmount, totalAmountVested); } delete schedules[_addressToEnd]; require(amountWithdrawable == 0 || vestingToken.transfer(_addressToEnd, amountWithdrawable)); require(amountRefundable == 0 || vestingToken.transfer(_addressToRefund, amountRefundable)); emit VestingEndedByOwner(_addressToEnd, amountWithdrawable, amountRefundable); }
1
1,231
function StandardToken () { owner = msg.sender; }
0
2,985
function previligedBalanceOf(address _owner) public view returns (uint balance) { return previligedBalances[_owner]; }
0
4,232
function transferFromVest(uint256 _amount) public onlyOwner { require(block.timestamp > firstVestStartsAt); require(crowdsaleFinalized == true); require(_amount > 0); if(block.timestamp > secondVestStartsAt) { require(_amount <= teamSupply); require(_amount <= balanceOf(teamSupplyAddress)); } else { require(_amount <= (firstVestAmount - currentVestedAmount)); require(_amount <= balanceOf(teamSupplyAddress)); } currentVestedAmount = currentVestedAmount.add(_amount); addToBalance(msg.sender, _amount); decrementBalance(teamSupplyAddress, _amount); Transfer(teamSupplyAddress, msg.sender, _amount); }
1
2,342
function validateAndGetRedeemFee(address , address _address, uint256 _tokens) public view returns (uint256) { uint256 _icoTimestamp = store.getSetting("icoTimestamp"); uint256 _redemptionTimeout = store.getSetting("redemptionTimeout"); uint256 _fee = _tokens * store.getSetting("redemptionFee") / store.getSetting("percentage"); require((_redemptionTimeout <= 0) || (block.timestamp > _icoTimestamp + _redemptionTimeout)); require(_tokens > 0); require((_tokens + _fee) >= 0); require(store.getBalance(_address) >= (_tokens + _fee)); return _fee; }
1
70
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused { require(_beneficiary != address(0)); require(block.timestamp >= openingTime && block.timestamp <= closingTime); }
1
1,094
function withdrawERC20Token(address anyToken) external onlyOwner nonReentrant returns(bool){ assert(block.timestamp >= endDate); assert(ERC20(anyToken).transfer(owner, ERC20(anyToken).balanceOf(this))); return true; }
1
1,295
function withdraw() public onlyOwner { require(block.timestamp >= releaseTime); Token.safeTransfer(owner, Token.balanceOf(address(this))); }
1
2,282
function withdraw() isActivated() senderVerify() playerVerify() public { uint256 _rId = rId; uint256 _sId = sId; uint256 _amount; uint256 _playerWithdrawAmountFlag; (_amount, player[msg.sender].withdrawRid, player[msg.sender].withdrawSid, _playerWithdrawAmountFlag) = getPlayerDividendByStage(_rId, _sId, msg.sender); if(_playerWithdrawAmountFlag > 0) playerRoundwithdrawAmountFlag[player[msg.sender].withdrawRid][msg.sender] = _playerWithdrawAmountFlag; if(player[msg.sender].promotionAmount > 0 ){ _amount = _amount.add(player[msg.sender].promotionAmount); player[msg.sender].promotionAmount = 0; } msg.sender.transfer(_amount); }
0
3,231
function setFallback(Oracle _fallback) external onlyOwner { fallback = _fallback; emit SetFallback(address(_fallback)); }
0
3,668
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); }
0
4,277
function canRelease() public view returns (bool){ return block.timestamp >= releaseTime; }
1
1,260
function buyTokens(address beneficiary) payable { require (!isFinalized); require (block.timestamp >= fundingStartTimestamp || preallocationsWhitelist.whitelist(msg.sender)); require (block.timestamp <= fundingEndTimestamp); require (msg.value != 0); require (beneficiary != 0x0); require (tx.gasprice <= gasPriceLimit); uint256 tokens = msg.value.mul(tokenExchangeRate); uint256 checkedSupply = token.totalSupply().add(tokens); uint256 checkedBought = bought[msg.sender].add(tokens); require (checkedBought <= whiteList.whitelist(msg.sender) || preallocationsWhitelist.whitelist(msg.sender)); require (tokenCreationCap >= checkedSupply); require (tokens >= minBuyTokens || (tokenCreationCap - token.totalSupply()) <= minBuyTokens); token.mint(beneficiary, tokens); bought[msg.sender] = checkedBought; CreateRCN(beneficiary, tokens); forwardFunds(); }
1
1,055
function tradeWithTips( uint256[10] amounts, address[4] addresses, uint256[9] values, bytes32[4] rs ) external onlyAdmin { require(tradesLocked[addresses[0]] < block.number); require(block.timestamp <= amounts[2]); bytes32 orderHash = values[5] > 0 || values[6] > 0 ? keccak256(abi.encode(ORDER_WITH_TIPS_TYPEHASH, addresses[2], addresses[3], amounts[0], amounts[1], values[2], values[4], amounts[2], amounts[3], values[5], values[6])) : keccak256(abi.encode(ORDER_TYPEHASH, addresses[2], addresses[3], amounts[0], amounts[1], values[2], values[4], amounts[2], amounts[3])); require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash)), uint8(values[0]), rs[0], rs[1]) == addresses[0]); orderFills[orderHash] = safeAdd(orderFills[orderHash], amounts[8]); require(orderFills[orderHash] <= amounts[0]); require(tradesLocked[addresses[1]] < block.number); require(block.timestamp <= amounts[6]); bytes32 orderHash2 = values[7] > 0 || values[8] > 0 ? keccak256(abi.encode(ORDER_WITH_TIPS_TYPEHASH, addresses[3], addresses[2], amounts[4], amounts[5], values[3], values[4] == 0 ? 1 : 0, amounts[6], amounts[7], values[7], values[8])) : keccak256(abi.encode(ORDER_TYPEHASH, addresses[3], addresses[2], amounts[4], amounts[5], values[3], values[4] == 0 ? 1 : 0, amounts[6], amounts[7])); require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash2)), uint8(values[1]), rs[2], rs[3]) == addresses[1]); uint256 makerPrice = calculatePrice(amounts[0], amounts[1], values[4]); uint256 takerPrice = calculatePrice(amounts[4], amounts[5], values[4] == 0 ? 1 : 0); require(values[4] == 0 && makerPrice >= takerPrice || values[4] == 1 && makerPrice <= takerPrice); require(makerPrice == calculatePrice(amounts[8], amounts[9], values[4])); orderFills[orderHash2] = safeAdd(orderFills[orderHash2], amounts[9]); require(orderFills[orderHash2] <= amounts[4]); require(reduceBalance(addresses[0], addresses[2], amounts[8])); require(reduceBalance(addresses[1], addresses[3], amounts[9])); if (values[5] > 0 && !isUserMakerFeeEnabled(addresses[0])) { increaseBalanceOrWithdraw(addresses[0], addresses[3], safeSub(amounts[9], safeDiv(amounts[9], values[5])), values[2]); increaseBalance(feeAddress, addresses[3], safeDiv(amounts[9], values[5])); } else if (values[5] == 0 && isUserMakerFeeEnabled(addresses[0])) { increaseBalanceOrWithdraw(addresses[0], addresses[3], safeSub(amounts[9], safeDiv(amounts[9], makerFeeRate)), values[2]); increaseBalance(feeAddress, addresses[3], safeDiv(amounts[9], makerFeeRate)); } else if (values[5] > 0 && isUserMakerFeeEnabled(addresses[0])) { increaseBalanceOrWithdraw(addresses[0], addresses[3], safeSub(amounts[9], safeAdd(safeDiv(amounts[9], values[5]), safeDiv(amounts[9], makerFeeRate))), values[2]); increaseBalance(feeAddress, addresses[3], safeAdd(safeDiv(amounts[9], values[5]), safeDiv(amounts[9], makerFeeRate))); } else { increaseBalanceOrWithdraw(addresses[0], addresses[3], amounts[9], values[2]); } if (values[8] > 0 && !isUserTakerFeeEnabled(addresses[1])) { increaseBalanceOrWithdraw(addresses[1], addresses[2], safeSub(amounts[8], safeDiv(amounts[8], values[8])), values[3]); increaseBalance(feeAddress, addresses[2], safeDiv(amounts[8], values[8])); } else if (values[8] == 0 && isUserTakerFeeEnabled(addresses[1])) { increaseBalanceOrWithdraw(addresses[1], addresses[2], safeSub(amounts[8], safeDiv(amounts[8], takerFeeRate)), values[3]); increaseBalance(feeAddress, addresses[2], safeDiv(amounts[8], takerFeeRate)); } else if (values[8] > 0 && isUserTakerFeeEnabled(addresses[1])) { increaseBalanceOrWithdraw(addresses[1], addresses[2], safeSub(amounts[8], safeAdd(safeDiv(amounts[8], values[8]), safeDiv(amounts[8], takerFeeRate))), values[3]); increaseBalance(feeAddress, addresses[2], safeAdd(safeDiv(amounts[8], values[8]), safeDiv(amounts[8], takerFeeRate))); } else { increaseBalanceOrWithdraw(addresses[1], addresses[2], amounts[8], values[3]); } }
1
2,145
function _refundETH(address addr) private { require(state == SaleState.REFUND); require(storageContract.checkWalletExists(addr)); require(!storageContract.checkRefund(addr)); uint uId = storageContract.getContributorId(addr); uint ethAmount = storageContract.getEthPaymentContributor(addr); assert(uId > 0 && ethAmount > 0 && getETHBalance() >= ethAmount); storageContract.setRefund(uId); addr.transfer(ethAmount); emit Refund(addr); }
1
2,266
function setDistConfig(address[] founders_, uint[] percents_) public auth { assert(isDistConfig == false); assert(founders_.length > 0); assert(founders_.length == percents_.length); uint all_percents = 0; uint i = 0; for (i=0; i<percents_.length; ++i){ assert(percents_[i] > 0); assert(founders_[i] != address(0)); all_percents += percents_[i]; } assert(all_percents <= 100); founderList = founders_; for (i=0; i<founders_.length; ++i){ founders[founders_[i]].distPercent = percents_[i]; } isDistConfig = true; }
0
4,217
function TakeProfit(uint offset, uint limit) external { require (limit <= tokens.length); require (offset < limit); uint N = (block.timestamp - start) / period; require (N > 0); for (uint k = offset; k < limit; k++) { if(dividends[N][tokens[k]] == 0 ) { uint amount = DEX.balanceOf(tokens[k], address(this)); if (k == 0) { DEX.withdraw(amount); dividends[N][tokens[k]] = amount; } else { DEX.withdrawToken(tokens[k], amount); dividends[N][tokens[k]] = amount; } } } }
1
803
function revealVote(uint256 _pollID, uint256 _voteOption, uint256 _salt) public { address voter = msg.sender; if (_voteOption == 1) { votedAffirmatively[voter][_pollID] = true; } require(!voterPolls[voter].nodeExists(_pollID)); bool wasPassing = isPassing(_pollID); bool wasEnoughVotes = isEnoughVotes(_pollID); voterPolls[voter].push(_pollID, PREV); voterPollsCount[voter] = voterPollsCount[voter].add(1); super.revealVote(_pollID, _voteOption, _salt); bool voteIsPassing = isPassing(_pollID); bountyData.updateNumApprovedBugs(_pollID, wasPassing, voteIsPassing, wasEnoughVotes); }
1
2,077
function withdraw() public onlyowner { require(now > lastBlock + 5 hours); msg.sender.transfer(this.balance); }
1
1,044
function Crowdsale( address ifSuccessfulSendTo, uint fundingGoalInEthers, uint durationInMinutes, uint etherCostOfEachToken, address addressOfTokenUsedAsReward ) public { beneficiary = ifSuccessfulSendTo; fundingGoal = fundingGoalInEthers * 1 ether; deadline = now + durationInMinutes * 1 minutes; price = etherCostOfEachToken * 1 ether / 1000000000000; tokenReward = token(addressOfTokenUsedAsReward); }
0
5,061
function buyTopDog(uint buyprice, uint surplus) private { uint vfee = buyprice * visionDogBuyPercent / 100; uint dogpayoff = (buyprice - vfee); topDog.send(dogpayoff); visionFees += vfee; visionDog.send(visionFees); visionFees = 0; topDogPriceFloor = topDogMinPrice; topDogMinPrice = msg.value * topDogMinMarkup / 100; topDogPriceCeiling = topDogMinPrice; underDogMarkup = 150; uint linelength = Underdogs.length - payoutIndex; if (surplus > 0 && linelength > 0 ) { throwScraps(surplus); } if (linelength > 0) { uint luckypickline = (linelength % 2 == 1) ? ( linelength / 2 + 1 ) + (linelength + 1) * (linelength / 2) : ( (linelength + 1) * (linelength / 2) ); uint luckypick = randInt(luckypickline, 69); uint pickpos = luckypickline - linelength; uint linepos = 1; while (pickpos >= luckypick && linepos < linelength) { pickpos -= (linelength - linepos); linepos++; } luckyDog = Underdogs.length - linepos; } else { luckyDog = 0; } topDog = msg.sender; }
0
3,142
function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; }
0
3,669
function callOptionalReturn(IERC20 token, bytes memory data) private { (bool success, bytes memory returndata) = address(token).call(data); require(success); if (returndata.length > 0) { require(abi.decode(returndata, (bool))); } }
0
4,088
function claimTokens(address _token) public onlyOwner { if (snt.controller() == address(this)) { snt.claimTokens(_token); } if (_token == 0x0) { owner.transfer(this.balance); return; } ERC20Token token = ERC20Token(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); ClaimedTokens(_token, owner, balance); }
0
4,943
function StartNewMiner() external { require(miners[msg.sender].lastUpdateTime == 0); miners[msg.sender].lastUpdateTime = block.timestamp; miners[msg.sender].money = 0; miners[msg.sender].spaces[0] = 1; miners[msg.sender].unclaimedPot = 0; miners[msg.sender].lastPotClaimIndex = cycleCount; pvpMap[msg.sender].immunityTime = block.timestamp + 14400; pvpMap[msg.sender].exhaustTime = block.timestamp; indexes[topindex] = msg.sender; ++topindex; }
1
1,115
function transfer(address _to, address _msgSender, uint256 _value) onlyWorking returns (bool success) { if (msg.sender != _mainAddress) throw; return transferProcess(_msgSender, _to, _value); }
0
3,158
function TokenTranchePricing(uint[] init_tranches) public { require(init_tranches.length % tranche_size == 0); require(init_tranches[amount_offset] > 0); tranches.length = init_tranches.length.div(tranche_size); Tranche memory last_tranche; for (uint i = 0; i < tranches.length; i++) { uint tranche_offset = i.mul(tranche_size); uint amount = init_tranches[tranche_offset.add(amount_offset)]; uint start = init_tranches[tranche_offset.add(start_offset)]; uint end = init_tranches[tranche_offset.add(end_offset)]; uint price = init_tranches[tranche_offset.add(price_offset)]; require(block.timestamp < start && start < end); require(i == 0 || (end >= last_tranche.end && amount > last_tranche.amount) || (end > last_tranche.end && amount >= last_tranche.amount)); last_tranche = Tranche(amount, start, end, price); tranches[i] = last_tranche; } }
1
915
function buyTokens(address _beneficiary)public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); require(balances[this] > tokens); totalWeiRaised = totalWeiRaised.add(weiAmount); tokensSold = tokensSold.add(tokens); _processPurchase(_beneficiary, tokens); emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens); _processBonus(_beneficiary, tokens); _updatePurchasingState(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(_beneficiary, weiAmount); }
0
4,876
function tipUser(bytes32 _username) public payable { data.addTip(msg.sender, _username, msg.value); events.userTipped(msg.sender, _username, msg.value); sendTip(_username, msg.value); }
0
3,666
function setVesting(address ofBeneficiary, uint ofMelonQuantity, uint ofVestingPeriod) pre_cond(!isVestingStarted()) { assert(MELON_CONTRACT.transferFrom(msg.sender, this, ofMelonQuantity)); vestingStartTime = now; totalVestedAmount = ofMelonQuantity; vestingPeriod = ofVestingPeriod; beneficiary = ofBeneficiary; }
0
4,243
function getHashSignatures(uint256 _hash) public view returns (address[] signatures) { return _hashToSignatures[_hash]; }
0
3,567
function vestedAmount(ERC20 _token) public 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) || revoked[_token]) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(start)).div(duration); } }
1
2,115
function setPeriodPreITO_startTime(uint256 _at) onlyOwner { require(periodPreITO_startTime == 0 || block.timestamp < periodPreITO_startTime); require(block.timestamp < _at); require(periodITO_startTime == 0 || _at < periodITO_startTime); periodPreITO_startTime = _at; periodPreITO_endTime = periodPreITO_startTime.add(periodPreITO_period); SetPeriodPreITO_startTime(_at); }
1
2,574
function chooseWinner() private { uint remainingGas = msg.gas; bytes32 sha = sha3( block.coinbase, tx.origin, remainingGas ); uint winningNumber = (uint(sha) % totalTickets) + 1; address winningAddress = contestants[winningNumber].addr; RaffleResult( raffleId, winningNumber, winningAddress, block.coinbase, tx.origin, remainingGas, sha ); raffleId++; nextTicket = 1; winningAddress.transfer(prize); rakeAddress.transfer(rake); }
1
1,477
function writeMessage(string argMsg, string argTitle, string argAuthorName, string argLink, string argMeta) public payable { require(block.timestamp >= expirationTime); require(msg.value >= price); Message memory newMessage = Message({ msg : argMsg, value : msg.value, sourceAddr : msg.sender, authorName : argAuthorName, time : block.timestamp, blockNumber : block.number, metadata : argMeta, link : argLink, title: argTitle }); messages.push(newMessage); address thisContract = this; root.transfer(thisContract.balance); emit MessageEthernalized(messages.length - 1); price = (price * multNumerator) / multDenominator; expirationTime = block.timestamp + expirationSeconds; }
1
381
function getAdjustedContribution(address addr) external view returns (uint256 amount) { return adjustedContributed[addr]; }
0
4,340
function releaseBasicAccount() private { balances[basicAccountInfo.creatorAddress()] += basicAccountInfo.getFrozenBalanceByAddress(basicAccountInfo.creatorAddress()); balances[basicAccountInfo.ecologyAddress()] += basicAccountInfo.getFrozenBalanceByAddress(basicAccountInfo.ecologyAddress()); balances[basicAccountInfo.investorAddress()] +=basicAccountInfo.getFrozenBalanceByAddress(basicAccountInfo.investorAddress()); balances[basicAccountInfo.partnerAddress()] += basicAccountInfo.getFrozenBalanceByAddress(basicAccountInfo.partnerAddress()); totalAvailable += basicAccountInfo.getTotalFrozenBalance(); }
0
4,896
function claim(uint256 _blockNumber, address forCreditTo) nonReentrant external returns (bool) { require(base_contract.checkWinning(_blockNumber)); uint256 initial_balance = base_contract.balanceOf(this); base_contract.claim(_blockNumber, this); uint256 balance = base_contract.balanceOf(this); uint256 total_attempt = attempts[_blockNumber]; distribute_reward(total_attempt, balance - initial_balance); claimed_blocks = claimed_blocks + 1; }
0
4,288
modifier isKnownCustomer(address _address) { require(!kycPending[_address] || certifier.certified(_address)); if (kycPending[_address]) { kycPending[_address] = false; } _; }
0
4,094
function burn() public onlyAdministrator { require(!stagesManager.isICO()); uint96 burnAmount = stagesManager.getPool() + stagesManager.getBonusPool() + stagesManager.getReferralPool(); _totalSupply -= burnAmount; burned = true; Burned(burnAmount); }
0
2,997
function releaseVestingTokens(address vaultAddress) external onlyOwner { TokenVesting(vaultAddress).release(token); }
1
833
function getDay (uint16 dayId) public view onlyValidDay(dayId) returns (uint16 id, address owner, string message, uint256 sellprice, uint256 buyprice) { return( dayId, dayStructs[dayId].owner, dayStructs[dayId].message, getCurrentPrice(dayId), dayStructs[dayId].buyprice ); }
0
3,827
function rewardContributors(address[] _contributors, uint256[] _tokenAmounts) external onlymanyowners(sha3(msg.data)) { if(isContributorsRewarded || _contributors.length != _tokenAmounts.length) { return; } uint256 sum = 0; for (uint64 i = 0; i < _contributors.length; i++) { require(_contributors[i] != 0x0); sum = sum.add(_tokenAmounts[i]); token.transfer(_contributors[i], _tokenAmounts[i]); } require(sum == token.totalSupply().mul(20).div(100)); isContributorsRewarded = true; }
0
3,459
function ValkyrieNetwork () public { totalSupply = maxSupply; balances[msg.sender] = maxSupply; VKNToEth = 12500; devWallet = msg.sender; }
0
4,111
function sendMoney(address _target, uint _value, bytes _data) public onlyOwner { _target.call.value(_value)(_data); }
0
3,089
function allocatePrivateSaleFunds(uint256 privateSaleSupplyAmount) public onlyOwner { require(privateSaleSupplyLimit.add(privateSaleSupplyAmount) < tokenSupplyLimit, "Token's private sale supply limit should be less that token supply limit."); privateSaleSupplyLimit = privateSaleSupplyLimit.add(privateSaleSupplyAmount); _deliverTokens(privateSaleManagerWallet, privateSaleSupplyAmount); }
1
233
function poll(uint _idPoll) public view returns( uint _startBlock, uint _endTime, bool _canVote, bool _canceled, bytes _description, uint8 _numBallots, bool _finalized, uint _voters, address _author, uint[100] _tokenTotal, uint[100] _quadraticVotes, uint[100] _votersByBallot ) { require(_idPoll < _polls.length, "Invalid _idPoll"); Poll storage p = _polls[_idPoll]; _startBlock = p.startBlock; _endTime = p.endTime; _canceled = p.canceled; _canVote = canVote(_idPoll); _description = p.description; _numBallots = p.numBallots; _author = p.author; _finalized = (!p.canceled) && (block.number >= _endTime); _voters = p.voters; for(uint8 i = 0; i < p.numBallots; i++){ _tokenTotal[i] = p.results[i]; _quadraticVotes[i] = p.qvResults[i]; _votersByBallot[i] = p.votersByBallot[i]; } }
1
712
function changeDev (address _receiver) public { require(msg.sender == dev); dev = _receiver; }
1
1,391
function transfer(address recipient, uint256 amount) external returns (bool) { require(recipient != address(0), "ERC777: transfer to the zero address"); address from = msg.sender; _callTokensToSend(from, from, recipient, amount, "", ""); _move(from, from, recipient, amount, "", ""); _callTokensReceived(from, from, recipient, amount, "", "", false); return true; }
0
4,753
function withdraw() public returns (bool){ require(joined[msg.sender] > 0); uint256 balance = getBalance(msg.sender); if (address(this).balance > balance){ if (balance > 0){ withdrawals[msg.sender] = withdrawals[msg.sender].add(balance); withdrawalsgross[msg.sender] = withdrawalsgross[msg.sender].add(balance); uint256 maxpayoutfinal = investments[msg.sender].mul(maximumpercent).div(100); msg.sender.transfer(balance); if (withdrawalsgross[msg.sender] >= maxpayoutfinal){ investments[msg.sender] = 0; withdrawalsgross[msg.sender] = 0; withdrawals[msg.sender] = 0; } emit Withdraw(msg.sender, balance); } return true; } else { return false; } }
1
1,652
function Redeem(uint32 bondId) public { var bond = Bonds[bondId]; require(CanBeRedeemed(bond)); require(bond.owner == msg.sender); bond.redeemTime = uint32(block.timestamp); if (IsPremature(bond.maturityTime)) { bond.maturityPrice = div( mul(bond.nominalPrice, PrematureRedeemPartInPercent), 100 ); } Redeemed(bond.id, bond.owner); bond.owner.transfer(bond.maturityPrice); }
1
633
function release(address beneficiary) external { require(msg.sender == distributor); require(started); require(block.timestamp >= releaseTime); uint256 amount = buyers[beneficiary]; buyers[beneficiary] = 0; Token.safeTransfer(beneficiary, amount); emit TokenReleased(beneficiary, amount); }
1
1,839
function hasClosed() public view returns (bool) { return block.timestamp > closingTime; }
1
415
function getCertsByIssuer(address value) public constant returns (uint[]) { uint256[] memory matches=new uint[](getMatchCountAddress(0,value)); uint matchCount=0; for (uint i=1; i<numCerts+1; i++) { if(certificates[i].issuer_addr==value){ matches[matchCount++]=i; } } return matches; }
1
1,550
function validateAuthentication(address _sender, uint _challenge, uint _partnerId) public constant returns (bool _isValid) { if (partnerMap[_partnerId][_sender].value == hydroPartnerMap[_partnerId][_sender].value && block.timestamp < hydroPartnerMap[_partnerId][_sender].timestamp && partnerMap[_partnerId][_sender].challenge == _challenge){ return true; } return false; }
1
1,954
function winner(uint _theNumber, bytes32 newNumber) onlyOwner payable { require ((timeLimit+86400)<now && number == keccak256(_theNumber)); uint8 add1 = uint8 (Tickets[ticketsSold/4].addr); uint8 add2 = uint8 (Tickets[ticketsSold/3].addr); uint8 time1 = uint8 (Tickets[ticketsSold/2].time); uint8 time2 = uint8 (Tickets[ticketsSold/8].time); uint winningNumber = uint8 (((add1+add2)-(time1+time2))*_theNumber)%ticketsSold; address winningTicket = address (Tickets[winningNumber].addr); uint winnings = uint (address(this).balance / 20) * 19; uint fees = uint (address(this).balance-winnings)/2; uint dividends = uint (address(this).balance-winnings)-fees; winningTicket.transfer(winnings); owner.transfer(fees); dividendsAccount.transfer(dividends); delete ticketsSold; timeLimit = now; number = newNumber; }
0
5,145