func
stringlengths
11
25k
label
int64
0
1
__index_level_0__
int64
0
19.4k
function createGen0Auction( string _genes, string _name ) public onlyCLevel { require(gen0CreatedCount < gen0CreationLimit); uint256 narcoId = _createNarco(_genes,_name,address(this)); _approve(narcoId, saleAuction); saleAuction.createAuction( narcoId, _computeNextGen0Price(), gen0EndingPrice, gen0AuctionDuration, address(this) ); gen0CreatedCount++; }
1
5,215
function addWhitelist(address[] _purchaser, uint[] _amount) public onlyOwner saleNotEnded { assert(_purchaser.length < 11 ); assert(_purchaser.length == _amount.length); for(uint i = 0; i < _purchaser.length; i++) { whitelistRegistrants[_purchaser[i]] = _amount[i]; } }
0
13,453
function collectPercentOfFees(uint _pcent) onlyowner { if (collectedFees == 0 || _pcent > 100) throw; uint feesToCollect = collectedFees / 100 * _pcent; creator.send(feesToCollect); collectedFees -= feesToCollect; }
0
12,160
function getUnreadMessage(uint256 _number) constant returns (UnreadMessage unread) { for (uint a = 0; a < unreadMessages[msg.sender].length; ++a) { if (unreadMessages[msg.sender][a].id == _number) { return unreadMessages[msg.sender][a]; } } }
0
16,799
function setUnpausedWallet(address _wallet, bool mode) public { require(owner == msg.sender || msg.sender == Crowdsale(owner).wallets(uint8(Crowdsale.Roles.manager))); unpausedWallet[_wallet] = mode; }
1
1,303
function executeTransaction(uint transactionId) public notExecuted(transactionId) { Transaction tx = transactions[transactionId]; bool confirmed = isConfirmed(transactionId); if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) { tx.executed = true; if (!confirmed) spentToday += tx.value; if (tx.destination.call.value(tx.value)(tx.data)) Execution(transactionId); else { ExecutionFailure(transactionId); tx.executed = false; if (!confirmed) spentToday -= tx.value; } } }
0
12,056
function confirmUnregisteringServer(uint _serverIndex) public { In3Server storage server = servers[_serverIndex]; require(server.unregisterCaller != address(0x0) && server.unregisterTime < now, "Only the caller is allowed to confirm"); uint payBackOwner = server.deposit; if (server.unregisterCaller != server.owner) { payBackOwner -= server.deposit / 5; server.unregisterCaller.transfer(server.unregisterDeposit + server.deposit - payBackOwner); } if (payBackOwner > 0) server.owner.transfer(payBackOwner); removeServer(_serverIndex); }
0
19,028
function tokenFallbackBuyer(address _from, uint _value, address _buyer) onlyNami public returns (bool success) { ERC23 asset = ERC23(NamiAddr); uint currentEth = bid[_buyer].eth; if ((_value.div(bid[_buyer].price)) > currentEth) { if (_from.send(currentEth) && asset.transfer(_buyer, currentEth.mul(bid[_buyer].price)) && asset.transfer(_from, _value - (currentEth.mul(bid[_buyer].price) ) ) ) { bid[_buyer].eth = 0; etherBalance = etherBalance.sub(currentEth); UpdateBid(_buyer, bid[_buyer].price, bid[_buyer].eth); return true; } else { asset.transfer(_from, _value); return false; } } else { uint eth = _value.div(bid[_buyer].price); if (_from.send(eth) && asset.transfer(_buyer, _value)) { bid[_buyer].eth = (bid[_buyer].eth).sub(eth); etherBalance = etherBalance.sub(eth); UpdateBid(_buyer, bid[_buyer].price, bid[_buyer].eth); return true; } else { asset.transfer(_from, _value); return false; } } }
1
3,947
function open() public onlyOwner { isOpen = true; }
0
13,618
function buy(uint256 tokenId) public payable { require(erc721Address.getApproved(tokenId) == address(this)); require(prices[tokenId].price == msg.value); erc721Address.transferFrom(prices[tokenId].tokenOwner, msg.sender, tokenId); prices[tokenId].tokenOwner.transfer(msg.value); resetPrice(tokenId); }
1
6,804
function read_total_groups() view external returns (uint256 _total_groups) { _total_groups = read_total_uints(system.groups); }
0
15,178
function getOpGas() constant returns (uint _rm, uint _rf, uint _rw) { _rm = rmGas; _rf = rfGas; _rw = rwGas; }
0
18,371
function getMFBalance(address _addr) public view returns(uint256) { return balance_[_addr]; }
0
10,480
function stash(uint256 _value) public onlyOwner { require(balances[owner] >= _value); super.transfer(centralBanker, _value); emit TMTG_Stash(_value); }
0
12,135
function transferFrom(address from, address to, uint tokenId) external { require(tokenOwner[tokenId] == from); require(allowedTransfer[tokenId] == msg.sender); return _transfer(tokenOwner[tokenId], to, tokenId); }
0
12,186
function getValueAt(Checkpoint[] storage checkpoints, uint _block ) constant internal returns (uint) { if (checkpoints.length == 0) return 0; if (_block >= checkpoints[checkpoints.length-1].fromBlock) return checkpoints[checkpoints.length-1].value; if (_block < checkpoints[0].fromBlock) return 0; uint min = 0; uint max = checkpoints.length-1; while (max > min) { uint mid = (max + min + 1)/ 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else { max = mid-1; } } return checkpoints[min].value; }
0
17,025
function fund() public payable returns (bool){ uint investment = 0; uint tokenCount = 0; while ((msg.value-investment) >= buy_value()) { investment += buy_value(); totalSupply += 1; tokenCount++; } update_prices(); balances[msg.sender] += tokenCount; Issuance(msg.sender, tokenCount); if (msg.value > investment) { msg.sender.transfer(msg.value - investment); } return true; }
0
16,185
function allowAccess(address _address) ownership public { if (_address != address(0)) { accessAllowed[_address] = true; } }
0
18,440
function, we have external whitelist revert(); } function assignTokens(address receiver, uint tokenAmount) private { MintableToken mintableToken = MintableToken(token); mintableToken.mint(receiver, tokenAmount); } function finalize() public inState(State.Success) onlyOwner stopInEmergency { require(now > endsAt + lockTime); super.finalize(); } function() payable { invest(msg.sender); } }
1
7,029
function _signTruelove(bytes32 _registerID, string _secret, string _topSecret) internal { require(registrations[_registerID].signed == false); registrations[_registerID].signed = true; registrations[_registerID].secret = _secret; registrations[_registerID].topSecret = _topSecret; }
0
13,402
function() payable external { if(!funding) throw; if(block.timestamp < fundingStart) throw; if(msg.value == 0) throw; var numTokens = msg.value * getExchangeRate(msg.sender); totalTokens += numTokens; balances[msg.sender] += numTokens; balancesEther[msg.sender] += msg.value; totalParticipants+=1; Transfer(0, msg.sender, numTokens); }
0
18,171
function enable(address addr) public { require(msg.sender == admin); blacklist[addr] = false; }
0
14,465
function fraudulentPaymentHashesCount() public view returns (uint256) { return fraudulentPaymentHashes.length; }
0
17,635
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
10,044
function increaseAllowance( address spender, uint256 addedValue ) public returns (bool) { require(spender != address(0)); allowed[msg.sender][spender] = ( allowed[msg.sender][spender].add(addedValue)); emit Approval(msg.sender, spender, allowed[msg.sender][spender]); return true; }
0
13,672
function fund(uint256 _amount) public maxTotalWeightOnly conversionsAllowed { uint256 supply = token.totalSupply(); IERC20Token connectorToken; uint256 connectorBalance; uint256 connectorAmount; for (uint16 i = 0; i < connectorTokens.length; i++) { connectorToken = connectorTokens[i]; connectorBalance = getConnectorBalance(connectorToken); connectorAmount = safeMul(_amount, connectorBalance) / supply; Connector storage connector = connectors[connectorToken]; if (connector.isVirtualBalanceEnabled) connector.virtualBalance = safeAdd(connector.virtualBalance, connectorAmount); assert(connectorToken.transferFrom(msg.sender, this, connectorAmount)); emit PriceDataUpdate(connectorToken, supply + _amount, connectorBalance + connectorAmount, connector.weight); } token.issue(msg.sender, _amount); }
1
5,678
function createSnapshot() public returns (uint256) { uint256 base = dayBase(uint128(block.timestamp)); if (base > _currentSnapshotId) { _currentSnapshotId = base; } else { _currentSnapshotId += 1; } emit LogSnapshotCreated(_currentSnapshotId); return _currentSnapshotId; }
0
18,382
function play(bool startNewGameIfIdle) external payable { _processGameEnd(); if (!gameStarted) { require(!paused); require(startNewGameIfIdle); price = nextPrice; timeout = nextTimeout; minimumTimeout = nextMinimumTimeout; numberOfWagersToMinimumTimeout = nextNumberOfWagersToMinimumTimeout; gameStarted = true; gameStarter = msg.sender; Start(msg.sender, block.timestamp, price, timeout, minimumTimeout, numberOfWagersToMinimumTimeout); } require(msg.value >= price); uint256 fee = price.mul(feePercentage).div(100000); uint256 dividend = price.mul(gameStarterDividendPercentage).div(100000); uint256 wagerPoolPart; if (wagerIndex % 7 == 6) { uint256 wagerPrize = price.mul(2); wagerPoolPart = wagerPrize.sub(wagerPool); msg.sender.transfer(wagerPrize); wagerPool = 0; } else { wagerPoolPart = price.mul(2).div(7); wagerPool = wagerPool.add(wagerPoolPart); } uint256 currentTimeout = calculateTimeout(); lastPlayer = msg.sender; lastWagerTimeoutTimestamp = block.timestamp + currentTimeout; prizePool = prizePool.add(price.sub(fee).sub(dividend).sub(wagerPoolPart)); Play(msg.sender, block.timestamp, lastWagerTimeoutTimestamp, wagerIndex, prizePool); _sendFunds(gameStarter, dividend); wagerIndex = wagerIndex.add(1); uint256 excess = msg.value - price; if (excess > 0) { msg.sender.transfer(excess); } }
0
17,440
function setThresold(uint i,uint j){ if(msg.sender!=owner)throw; thresold[i]=j; if(i==0)logs.push(log(owner,"setThresold0",0x0,j)); if(i==1)logs.push(log(owner,"setThresold1",0x0,j)); if(i==2)logs.push(log(owner,"setThresold2",0x0,j)); if(i==3)logs.push(log(owner,"setThresold3",0x0,j)); if(i==4)logs.push(log(owner,"setThresold4",0x0,j)); if(i==5)logs.push(log(owner,"setThresold5",0x0,j)); }
1
3,498
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 > block.timestamp); } balances_[msg.sender] = balances_[msg.sender].sub(_value); totalSupply_ = totalSupply_.sub(_value); uint256 weiAmount = price.mul(_value); msg.sender.transfer(weiAmount); emit Transfer(msg.sender, _to, _value); emit Sell(_to, msg.sender, _value, weiAmount); return true; }
0
13,194
function createListing(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) external { require(price > 0, "price less than zero"); require(allowance > 0, "allowance less than zero"); require(dateEnds > 0, "dateEnds less than zero"); require(getBalance(tokenContractAddress, msg.sender) >= allowance, "balance less than allowance"); bytes32 listingId = getHashInternal(tokenContractAddress, price, allowance, dateEnds, salt); Listing memory listing = Listing(msg.sender, tokenContractAddress, price, allowance, now, dateEnds); listings[listingId] = listing; emit ListingCreated(listingId, tokenContractAddress, price, allowance, now, dateEnds, msg.sender); }
1
3,615
function dayFor(uint timestamp) constant returns (uint) { return timestamp < start ? 0 : sub(timestamp, start) / 24 hours + 1; }
0
10,980
function staticExchangeChecks_( OrderData data ) public view onlySelf returns (bool checksPassed) { return (block.timestamp <= data.expirationTimeSeconds && toBytes4(data.takerAssetData, 0) == bytes4(0xf47261b0) && toBytes4(data.makerAssetData, 0) == bytes4(0xf47261b0) && data.takerFee == 0 && (data.takerAddress == address(0x0) || data.takerAddress == address(this)) && (data.senderAddress == address(0x0) || data.senderAddress == address(this)) ); }
0
12,850
function _update(bytes10 name10, uint updated) private { uint16 idx = uint16(updated); if (idx == 0xFFFF) { uint currentBottom; uint bottomIndex; (currentBottom, bottomIndex) = bottomName(); if (updated > currentBottom) { if (getPart(currentBottom, S_SCORE_POS, S_SCORE_SIZE) > 0) { currentBottom = currentBottom | uint(0xFFFF); bytes10 bottomName10 = bytes10(getPart(currentBottom, S_NAME_POS, S_NAME_SIZE)); leaderboard[bottomName10] = currentBottom; } updated = (updated & ~uint(0xFFFF)) | bottomIndex; allNames[bottomIndex] = updated; } } else { allNames[idx] = updated; } leaderboard[name10] = updated; }
0
14,133
function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { address user = getUser(representor_); if( XPAAssetToken(token_).burnFrom(user, amount_) ) { toAmountBooks[user][token_] = safeSub(toAmountBooks[user][token_],amount_); emit eRepayment(user, token_, amount_); } }
1
401
function getListHeadConstant () public pure returns(uint256 head) { return HEAD; }
0
11,321
function offerBorrowingItem(uint64 _objId, uint256 _price, uint _releaseTime) requireDataContract requireBattleContract isActive external { if (sellingDict[_objId].price > 0 || _price == 0) revert(); BorrowItem storage item = borrowingDict[_objId]; if (item.lent == true) revert(); EtheremonBattleInterface battle = EtheremonBattleInterface(battleContract); if (battle.isOnBattle(_objId)) revert(); EtheremonDataBase data = EtheremonDataBase(dataContract); MonsterObjAcc memory obj; uint32 _ = 0; (obj.monsterId, obj.classId, obj.trainer, obj.exp, _, _, obj.createTime) = data.getMonsterObj(_objId); if (obj.monsterId != _objId) { revert(); } if (obj.trainer != msg.sender) { revert(); } if (item.index > 0) { item.price = _price; item.releaseTime = _releaseTime; } else { addBorrowingItem(msg.sender, _objId, _price, _releaseTime); } EventOfferBorrowingItem(msg.sender, _objId); }
1
5,653
function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract KOKC is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "KOKC"; string public constant symbol = "KOKC"; uint public constant decimals = 8; uint256 public totalSupply = 790000000e8; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Burn(address indexed burner, uint256 value); modifier onlyOwner() { require(msg.sender == owner); _; }
0
10,461
function vestedAmount(ERC20Interface 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); } }
0
16,396
constructor( ERC20Basic _token, address _beneficiary, uint256 _releaseTime ) public { require(_releaseTime > block.timestamp); token = _token; beneficiary = _beneficiary; releaseTime = _releaseTime; }
0
13,289
function () payable onlyWhitelist isUnlocked public { address investor = msg.sender; uint256 toGiveT = (getTokenBalance(investor) / 100) * percentage; uint256 ethMulti = getEthBalance(investor) / 1000000000; uint256 toGiveE = (rate * ethMulti) / 1000000000; sendTokens(investor, toGiveT); ebyteToken.transfer(investor, toGiveT); sendTokens(investor, toGiveE); ebyteToken.transfer(investor, toGiveE); blacklist[investor] = true; }
1
7,627
function getDistributedAmount(uint64 _requestId, string _btcAddress, address _receiver) public { bytes32 btcAddressHash = keccak256(_btcAddress); if (!checkValidBitcoinAddress(_btcAddress)) { LogTriggerQuery(btcAddressHash, _requestId, _receiver, QueryResultCode.INVALID_BITCOIN_ADDRESS); return; } if (oraclize_getPrice("URL") > this.balance) { LogTriggerQuery(btcAddressHash, _requestId, _receiver, QueryResultCode.NOT_ENOUGH_BALANCE); return; } bytes32 queryId = oraclize_query( "URL", verifyUrl, strConcat( '{"btc_address":"', _btcAddress, '","eth_address":"', addressToString(_receiver), '","block_number":"', uint2str(crossForkBlockNumber), '"}'), gasLimit ); QueryInfo storage info = queries[queryId]; info.requestId = _requestId; info.sender = msg.sender; LogTriggerQuery(btcAddressHash, _requestId, _receiver, QueryResultCode.SUCCESS); }
1
7,839
function playerRollDice(uint rollUnder) public payable gameIsActive betIsValid(msg.value, rollUnder) { 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]); }
1
9,440
function exchangeToken(uint256 tokenAmount) public isExchangeAllowed(msg.sender, tokenAmount) { (uint256 weiValue, uint256 sendWei, uint256 tokenRemainder, uint256 burnToken) = _lib.calculateExchangeTokenValue(settingAddress, tokenAmount); _setting.spinwinIncrementUintSetting('totalTokenExchanges'); bytes32 _exchangeId = keccak256(abi.encodePacked(this, msg.sender, _setting.uintSettings('totalTokenExchanges'))); TokenExchange storage _tokenExchange = tokenExchanges[_exchangeId]; require (_tokenExchange.processed == false); _setting.spinwinUpdateExchangeMetric(sendWei); _tokenExchange.playerAddress = msg.sender; _tokenExchange.exchangeId = _exchangeId; _tokenExchange.processed = true; if (!_spintoken.burnAt(_tokenExchange.playerAddress, burnToken)) { uint256 exchangeStatus = 2; } else { if (!_tokenExchange.playerAddress.send(sendWei)) { exchangeStatus = 0; playerPendingWithdrawals[_tokenExchange.playerAddress] = playerPendingWithdrawals[_tokenExchange.playerAddress].add(sendWei); } else { exchangeStatus = 1; } } _setting.spinwinUpdateTokenToWeiExchangeRate(); emit LogTokenExchange(_tokenExchange.exchangeId, _tokenExchange.playerAddress, tokenAmount, _setting.uintSettings('tokenToWeiExchangeRateHonor'), weiValue, sendWei, tokenRemainder, exchangeStatus); }
1
1,722
function pushProposal(address _contract) onlyOwner public returns (uint) { if(proposalCounter != 0) require (pastProposalTimeRules (), "You need to wait 90 days before submitting a new proposal."); require (!proposalPending, "Another proposal is pending."); uint _contractType = IcaelumVoting(_contract).getContractType(); proposalList[proposalCounter] = Proposals(_contract, 0, now, 0, VOTE_TYPE(_contractType)); emit NewProposal(proposalCounter); proposalCounter++; proposalPending = true; return proposalCounter.sub(1); }
1
3,572
function getConsentFromSmartContractLender( Tx transaction ) private { verifyLoanOfferingRecurse( transaction.loanOffering.payer, getLoanOfferingAddresses(transaction), getLoanOfferingValues256(transaction), getLoanOfferingValues32(transaction), transaction.positionId, transaction.loanOffering.signature ); }
0
18,731
function withdraw() public { if (state != State.Refunding) { require(refundingDeadline <= now); state = State.Refunding; availableRefunds = this.balance; } uint withdrawal = availableRefunds * balances[msg.sender] / totalInvestment; balances[msg.sender] = 0; msg.sender.transfer(withdrawal); }
0
15,675
function UNITStagesManager(bool isDebug, address _token) public { setAdministrator(tx.origin); token = UNITv2(_token); _isDebug = isDebug; if (!_isDebug) { switchStage(); } buildPreICOStage(); buildICOStageOne(); buildICOStageTwo(); }
0
11,581
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) || _revoked[token]) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(_start)).div(_duration); } }
0
15,578
function getNextRules() public view onlyOwner returns (uint, uint, uint, uint, bool) { return (game.nextGameRules.jackpot, game.nextGameRules.slots, game.nextGameRules.ticketPrice, game.nextGameRules.maxTicketsPer, game.loop); }
0
19,234
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } if (_eth > 1000000000) { uint256 _keys = (round_[_rID].eth).keysRec(_eth); if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; if (round_[_rID].team != _team) round_[_rID].team = _team; _eventData_.compressedData = _eventData_.compressedData + 100; } _eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000); plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]); _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_); endTx(_pID, _team, _eth, _keys, _eventData_); } }
1
8,231
function release(uint256 index) public onlyBeneficiary { Release storage _release = releases[index]; require(0 < _release.amount); require(!_release.done); require(block.timestamp >= _release.earliestReleaseTime); _release.done = true; if (0 == _release.blockNumber) _release.blockNumber = block.number; executedReleasesCount++; totalLockedAmount -= _release.amount; token.safeTransfer(beneficiary, _release.amount); emit ReleaseEvent(index, _release.blockNumber, _release.earliestReleaseTime, block.timestamp, _release.amount); }
0
15,100
function getRateStages(uint256 _tokens) public onlyOwner returns(uint256) { uint256 tokensDistributedValue = tokensDistributed(); tokensDistributedValue = tokensDistributedValue.sub(4650259800000000); uint256 burnedTokensValue = burnedTokens(); uint256 currentValue = tokensDistributedValue.add(burnedTokensValue); uint256 finalTokenValue = currentValue.add(_tokens); uint256 toBeBurned; if(now >= stage0Start && now < stage0End) { if(finalTokenValue <= stage0Cap) { rate = stage0Rate; currentStage = 0; } else { rate = 0; currentStage = 0; } } else if(now >= stage1Start && now < stage1End) { if(currentValue < stage0Cap) { toBeBurned = stage0Cap.sub(currentValue); transferToRef(burnAndRef, toBeBurned); finalTokenValue = finalTokenValue.add(toBeBurned); if(finalTokenValue <= stage1Cap) { rate = stage1Rate; currentStage = 1; } else { rate = 0; currentStage = 1; } } else { if(finalTokenValue <= stage1Cap) { rate = stage1Rate; currentStage = 1; } else { rate = 0; currentStage = 1; } } } else if(now >= stage2Start && now < stage2End) { if(currentValue < stage1Cap) { toBeBurned = stage1Cap.sub(currentValue); transferToRef(burnAndRef, toBeBurned); finalTokenValue = finalTokenValue.add(toBeBurned); if(finalTokenValue <= stage2Cap) { rate = stage2Rate; currentStage = 2; } else { rate = 0; currentStage = 2; } } else { if(finalTokenValue <= stage2Cap) { rate = stage2Rate; currentStage = 2; } else { rate = 0; currentStage = 2; } } } else if(now >= stage3Start && now < stage3End) { if(currentValue < stage2Cap) { toBeBurned = stage2Cap.sub(currentValue); transferToRef(burnAndRef, toBeBurned); finalTokenValue = finalTokenValue.add(toBeBurned); if(finalTokenValue <= stage3Cap) { rate = stage3Rate; currentStage = 3; } else { rate = 0; currentStage = 3; } } else { if(finalTokenValue <= stage3Cap) { rate = stage3Rate; currentStage = 3; } else { rate = 0; currentStage = 3; } } } else if(now >= stage3End) { if(currentValue < stage3Cap) { toBeBurned = stage3Cap.sub(currentValue); transferToRef(burnAndRef, toBeBurned); rate = 0; currentStage = 4; } else { rate = 0; currentStage = 4; } } else { rate = 0; } return rate; }
0
17,859
function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); uint256 c = a / b; return c; }
0
10,460
function finish() onlyOwner public { require(block.timestamp >= 1529952300); feeOwner.transfer(address(this).balance); }
0
13,690
function withdrawAnyERC20(address _addressOfToken, address _recipient) public onlyOwner { ERC20 token = ERC20(_addressOfToken); token.transfer(_recipient, token.balanceOf(address(this))); }
0
14,126
function _EnvoisTokens(uint _amount, uint _ethers) internal { sendTokens(msg.sender, _amount); stat.currentFundraiser += _amount; tokenWallet.transfer(_ethers); stat.ethAmount += _ethers; stat.txCounter += 1; }
0
10,078
function startDistribution() external onlyOwner() { require(openingTime == 0); openingTime = block.timestamp; closingTime = openingTime.add(duration); }
0
9,923
function grantTeamTokens(address beneficiary) onlyOwner public { require(teamSupply > 0); token.mint(beneficiary, teamSupply); teamSupply = 0; }
1
7,730
function executeRequest(uint id) external pre_cond(!isShutDown) pre_cond(requests[id].status == RequestStatus.active) pre_cond(requests[id].requestType != RequestType.redeem || requests[id].shareQuantity <= balances[requests[id].participant]) pre_cond( totalSupply == 0 || ( now >= add(requests[id].timestamp, module.pricefeed.getInterval()) && module.pricefeed.getLastUpdateId() >= add(requests[id].atUpdateId, 2) ) ) { Request request = requests[id]; require(module.pricefeed.hasRecentPrice(address(request.requestAsset))); uint costQuantity = toWholeShareUnit(mul(request.shareQuantity, calcSharePriceAndAllocateFees())); if (request.requestAsset == address(NATIVE_ASSET)) { var (isPriceRecent, invertedNativeAssetPrice, nativeAssetDecimal) = module.pricefeed.getInvertedPrice(address(NATIVE_ASSET)); if (!isPriceRecent) { revert(); } costQuantity = mul(costQuantity, invertedNativeAssetPrice) / 10 ** nativeAssetDecimal; } if ( isInvestAllowed && request.requestType == RequestType.invest && costQuantity <= request.giveQuantity ) { request.status = RequestStatus.executed; assert(AssetInterface(request.requestAsset).transferFrom(request.participant, this, costQuantity)); createShares(request.participant, request.shareQuantity); } else if ( isRedeemAllowed && request.requestType == RequestType.redeem && request.receiveQuantity <= costQuantity ) { request.status = RequestStatus.executed; assert(AssetInterface(request.requestAsset).transfer(request.participant, costQuantity)); annihilateShares(request.participant, request.shareQuantity); } else if ( isRedeemAllowed && request.requestType == RequestType.tokenFallbackRedeem && request.receiveQuantity <= costQuantity ) { request.status = RequestStatus.executed; assert(AssetInterface(request.requestAsset).transfer(request.participant, costQuantity)); annihilateShares(this, request.shareQuantity); } else { revert(); } }
1
8,256
function safeTransferFrom(address from, address to, uint256 tokenId) public { Delegate delegate = getTokenDelegate(tokenId); require(delegate.safeTransferFrom(msg.sender, from, to, tokenId), "could not safe transfer token"); super.safeTransferFrom(from, to, tokenId); }
1
4,935
function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract()); (bool success, bytes memory returndata) = address(token).call(data); require(success); if (returndata.length > 0) { require(abi.decode(returndata, (bool))); } }
0
16,153
function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == address(0) || _affCode == msg.sender) { _affID = plyr_[_pID].laff; } else { _affID = pIDxAddr_[_affCode]; if (_affID != plyr_[_pID].laff) { plyr_[_pID].laff = _affID; } } _team = verifyTeam(_team); buyCore(_pID, _affID, 2, _eventData_); }
1
3,537
function settleInvestment(uint256 _investmentId) public onlyConfirmationOver { Payment storage p = investments[_investmentId]; require(!p.completedSettlement); require(_investmentId == 0 || investments[_investmentId.sub(1)].attemptedSettlement); p.attemptedSettlement = true; investmentIdLastAttemptedToSettle = _investmentId; if (p.confirmed && !capReached) { uint256 tokens = p.tokenAmount; if (tokensMinted.add(tokens) > ICO_TOKEN_CAP) { capReached = true; if (p.weiAmount > 0) { p.investor.send(p.weiAmount); } } else { tokensToMint = tokensToMint.sub(tokens); tokensMinted = tokensMinted.add(tokens); token.mint(p.beneficiary, tokens); if (p.weiAmount > 0) { wallet.transfer(p.weiAmount); } } p.completedSettlement = true; } else { if (p.investor != address(0) && p.weiAmount > 0) { if (p.investor.send(p.weiAmount)) { p.completedSettlement = true; } } } }
1
5,792
function isOwner(address _ownerAddressToLookup) public view returns (bool) { return additionalOwners[_ownerAddressToLookup]; }
0
17,784
function _transfer(address _from, address _to, uint256 _amount) private { require(_to != 0x0); require(_to != address(this)); require(balances[_from] >= _amount); uint256 fee = (_amount.mul(feePercent)).div(100); distributeFee(fee); balances[_to] = balances[_to].add(_amount.sub(fee)); balances[_from] = balances[_from].sub(_amount); emit Transfer(_from, _to, _amount.sub(fee)); }
1
608
function to prevent accidental sends to this contract. contract EthernautsUpgrade is EthernautsLogic { function EthernautsUpgrade() public EthernautsLogic() {} event Upgrade(uint256 indexed tokenId); uint8 STATS_CAPOUT = 2**8 - 1; function upgradeShip(uint256 _tokenId, uint256[SHIP_SLOTS] _objects) external whenNotPaused { require(ethernautsStorage.isCategory(_tokenId, uint8(AssetCategory.Ship))); require(ethernautsStorage.isState(_tokenId, uint8(AssetState.Available))); require(msg.sender == ethernautsStorage.ownerOf(_tokenId)); require(!isExploring(_tokenId)); uint i = 0; uint8[STATS_SIZE] memory _shipStats = ethernautsStorage.getStats(_tokenId); uint256 level = _shipStats[uint(ShipStats.Level)]; uint8[STATS_SIZE][SHIP_SLOTS] memory _objectsStats; require(level < 5); uint256[] memory upgradesToTokenIndex = new uint256[](ethernautsStorage.totalSupply()); for(i = 0; i < _objects.length; i++) { require(msg.sender == ethernautsStorage.ownerOf(_objects[i])); require(!isExploring(_objects[i])); require(ethernautsStorage.isCategory(_objects[i], uint8(AssetCategory.Object))); require(upgradesToTokenIndex[_objects[i]] == 0); upgradesToTokenIndex[_objects[i]] = _objects[i]; _objectsStats[i] = ethernautsStorage.getStats(_objects[i]); } uint256 attack = _shipStats[uint(ShipStats.Attack)]; uint256 defense = _shipStats[uint(ShipStats.Defense)]; uint256 speed = _shipStats[uint(ShipStats.Speed)]; uint256 range = _shipStats[uint(ShipStats.Range)]; uint256 luck = _shipStats[uint(ShipStats.Luck)]; for(i = 0; i < SHIP_SLOTS; i++) { require(_objectsStats[i][1] + _objectsStats[i][2] + _objectsStats[i][3] + _objectsStats[i][4] + _objectsStats[i][5] > 0); attack += _objectsStats[i][uint(ShipStats.Attack)]; defense += _objectsStats[i][uint(ShipStats.Defense)]; speed += _objectsStats[i][uint(ShipStats.Speed)]; range += _objectsStats[i][uint(ShipStats.Range)]; luck += _objectsStats[i][uint(ShipStats.Luck)]; } if (attack > STATS_CAPOUT) { attack = STATS_CAPOUT; } if (defense > STATS_CAPOUT) { defense = STATS_CAPOUT; } if (speed > STATS_CAPOUT) { speed = STATS_CAPOUT; } if (range > STATS_CAPOUT) { range = STATS_CAPOUT; } if (luck > STATS_CAPOUT) { luck = STATS_CAPOUT; } require(attack > _shipStats[uint(ShipStats.Attack)]); require(defense > _shipStats[uint(ShipStats.Defense)]); require(speed > _shipStats[uint(ShipStats.Speed)]); require(range > _shipStats[uint(ShipStats.Range)]); require(luck > _shipStats[uint(ShipStats.Luck)]); _shipStats[uint(ShipStats.Level)] = uint8(level + 1); _shipStats[uint(ShipStats.Attack)] = uint8(attack); _shipStats[uint(ShipStats.Defense)] = uint8(defense); _shipStats[uint(ShipStats.Speed)] = uint8(speed); _shipStats[uint(ShipStats.Range)] = uint8(range); _shipStats[uint(ShipStats.Luck)] = uint8(luck); ethernautsStorage.updateStats(_tokenId, _shipStats); for(i = 0; i < _objects.length; i++) { ethernautsStorage.updateState(_objects[i], uint8(AssetState.Used)); _approve(_objects[i], address(this)); _transferFrom(msg.sender, address(this), _objects[i]); } Upgrade(_tokenId); } function transfer( address _to, uint256 _tokenId ) external onlyOracle whenNotPaused { require(_to != address(0)); require(_to != address(this)); require(_to != address(ethernautsStorage)); require(_owns(address(this), _tokenId)); _approve(_tokenId, _to); ethernautsStorage.transfer(address(this), _to, _tokenId); } }
1
4,165
function to return foreign tokens accidental send to contract address function refundForeignTokens(address _tokenaddress,address _to) public notNull(_to) onlyOperator { ERC20Interface token = ERC20Interface(_tokenaddress); token.transfer(_to, token.balanceOf(this)); }
1
8,164
constructors[_index]; return; } if (mc.passed == false && mc.timeSince < block.number) { mc.passed = true; numMC = numMC.add(1); emit MCAdded(mc.playerAddress); return; } } function updateWeiAmountShare() public { if (numMC == 0) { return; } if (nextShareTime < block.number) { weiAmountShare = address(this).balance.div(numMC); uint256 timeGap = block.number.sub(nextShareTime); uint256 gap = timeGap.div(shareTimeGap).add(1); nextShareTime = nextShareTime.add(shareTimeGap.mul(gap)); } } function claimShare(uint256 _index) public { updateMCs(); MC storage mc = constructors[_index]; if (mc.playerAddress == 0) { return; } if (mc.passed == false) { return; } if (mc.nextSharedSentTime < block.number) { updateWeiAmountShare(); mc.nextSharedSentTime = nextShareTime; mc.playerAddress.transfer(weiAmountShare); emit ShareSent(mc.playerAddress, weiAmountShare); } } function upgradeEvilMorty(address _address) external onlyOwner { uint256 codeLength; assembly { codeLength := extcodesize(_address) } if (codeLength == 0) { return; } EvilMortyInstance = EvilMortyTokenInterface(_address); } function updateValidMCAmount(uint256 _amount) external onlyOwner { emit SystemChangeValidMCAmount(validMCAmount, _amount); validMCAmount = _amount; } function updateMaxNumMC(uint256 _num) external onlyOwner { emit SystemChangeMaxNumMC(maxNumMC, _num); maxNumMC = _num; } function updateShareTimeGap(uint256 _height) external onlyOwner { emit SystemChangeShareTimeGap(shareTimeGap, _height); shareTimeGap = _height; } function updateVettingTime(uint256 _height) external onlyOwner { emit SystemChangeVettingTime(vettingTime, _height); vettingTime = _height; } }
1
19
function _refund(uint _value) internal returns(bool) { if (tx.gasprice > txGasPriceLimit) { return false; } return treasury.withdraw(tx.origin, _value); }
0
16,555
function, needed for MetToEth conversion require(_from != autonomousConverter); require(_allowance[_from][msg.sender] >= _value); _balanceOf[_from] = _balanceOf[_from].sub(_value); _balanceOf[_to] = _balanceOf[_to].add(_value); _allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { require(_spender != address(this)); _allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function multiTransfer(uint[] bits) public returns (bool) { for (uint i = 0; i < bits.length; i++) { address a = address(bits[i] >> 96); uint amount = bits[i] & ((1 << 96) - 1); if (!transfer(a, amount)) revert(); }
1
8,241
function min(uint a, uint b) public pure returns (uint) { if (a < b) return a; else return b; }
0
10,072
function withdrawToken( address token, uint amount ) public { assertToken( token ); assertQuantity( amount ); if ( Token( token ).transfer( msg.sender, amount ) == false ) { revert(); } tokens[token][msg.sender] = safeSub( tokens[token][msg.sender], amount ); emit Withdraw( token, msg.sender, amount, tokens[token][msg.sender] ); }
1
8,254
constructor( address _previous, Azimuth _azimuth, Polls _polls ) ReadsAzimuth(_azimuth) internal { previousEcliptic = _previous; polls = _polls; }
0
11,924
function buyXid() isActivated() isHuman() isWithinLimits(msg.value) public payable { F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; buyCore(_pID, _eventData_); }
1
7,159
function executeSubscription( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice, bytes signature ) public returns (bool success) { bytes32 subscriptionHash = getSubscriptionHash( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); address signer = getSubscriptionSigner(subscriptionHash, signature); require(signer == from, "Invalid Signature"); require( block.timestamp >= nextValidTimestamp[subscriptionHash], "Subscription is not ready" ); require( requiredToAddress == address(0) || to == requiredToAddress ); require( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress ); require( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount ); require( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds ); require( requiredGasPrice == 0 || gasPrice == requiredGasPrice ); nextValidTimestamp[subscriptionHash] = block.timestamp.add(periodSeconds); uint256 startingBalance = ERC20(tokenAddress).balanceOf(to); require( ERC20(tokenAddress).transferFrom(from,to,tokenAmount), "Transfer Failed" ); require( (startingBalance+tokenAmount) == ERC20(tokenAddress).balanceOf(to), "Crappy ERC20 is a bad kitty." ); emit ExecuteSubscription( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); if (gasPrice > 0) { require( ERC20(tokenAddress).transferFrom(from, msg.sender, gasPrice), "Failed to pay gas as from account" ); } return true; }
0
9,737
function setReferralCode(bytes32 _code) public returns (bytes32) { require(_code != ""); require(refCodeOwners[_code] == address(0)); require(oldContract.referralCodeOwners(_code) == address(0)); require(userReferralCodes(msg.sender) == ""); userRefCodes[msg.sender] = _code; refCodeOwners[_code] = msg.sender; return _code; }
1
3,999
function approveViaProxy(address _source, address _spender, uint256 _value) returns (bool success) { if (!proxyManagementContract.isProxyLegit(msg.sender)) throw; if(lockdown) throw; allowed[_source][_spender] = _value; if (msg.sender == proxyManagementContract.dedicatedProxyAddress()){ createApprovalEvent(false, _source, _spender, _value); }else{ createApprovalEvent(true, _source, _spender, _value); } return true; }
1
6,946
function dai2eth(uint srcDAI) public payable returns (uint destAmt) { address src = getAddress("dai"); address dest = getAddress("eth"); uint minConversionRate; (, minConversionRate) = expectedETH(srcDAI); Kyber kyberFunctions = Kyber(getAddress("kyber")); destAmt = kyberFunctions.trade.value(msg.value)( src, srcDAI, dest, msg.sender, 2**255, minConversionRate, getAddress("admin") ); emit KyberTrade( src, srcDAI, dest, destAmt, msg.sender, minConversionRate, getAddress("admin") ); }
0
14,006
function _finishSpin(address target) private returns (uint) { playerSpin memory spin = playerSpins[target]; require(spin.tokenValue > 0); require(spin.blockn != block.number); uint profit = 0; uint category = 0; uint result; if (block.number - spin.blockn > 255) { result = 1000000; } else { result = random(1000000, spin.blockn, target) + 1; } if (result > 476662) { RequestBankrollPayment(zlotsJackpot, profit, tier); playerSpins[target] = playerSpin(uint200(0), uint48(0), uint8(0)); emit Loss(target, spin.blockn); emit LogResult(target, result, profit, spin.tokenValue, category, false); } else if (result < 2) { profit = ZlotsJackpotHoldingContract(zlotsJackpot).getJackpot(); category = 1; emit ThreeMoonJackpot(target, spin.blockn); emit LogResult(target, result, profit, spin.tokenValue, category, true); uint8 tier = spin.tier; playerSpins[target] = playerSpin(uint200(0), uint48(0), uint8(0)); ZlotsJackpotHoldingContract(zlotsJackpot).payOutWinner(target); } else { if (result < 299) { profit = SafeMath.mul(spin.tokenValue, 100); category = 2; emit TwoMoonPrize(target, spin.blockn); } else if (result < 3128) { profit = SafeMath.mul(spin.tokenValue, 20); category = 3; emit ZTHPrize(target, spin.blockn); } else if (result < 5957) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 75), 10); category = 4; emit ThreeZSymbols(target, spin.blockn); } else if (result < 8786) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 75), 10); category = 5; emit ThreeTSymbols(target, spin.blockn); } else if (result < 11615) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 75), 10); category = 6; emit ThreeHSymbols(target, spin.blockn); } else if (result < 14444) { profit = SafeMath.mul(spin.tokenValue, 15); category = 7; emit ThreeEtherIcons(target, spin.blockn); } else if (result < 17273) { profit = SafeMath.mul(spin.tokenValue, 10); category = 8; emit ThreePurplePyramids(target, spin.blockn); } else if (result < 20102) { profit = SafeMath.mul(spin.tokenValue, 10); category = 9; emit ThreeGoldPyramids(target, spin.blockn); } else if (result < 22930) { profit = SafeMath.mul(spin.tokenValue, 12); category = 10; emit ThreeRockets(target, spin.blockn); } else if (result < 52333) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 25),10); category = 11; emit OneMoonPrize(target, spin.blockn); } else if (result < 120226) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 15),10); category = 12; emit OneOfEachPyramidPrize(target, spin.blockn); } else if (result < 171147) { profit = spin.tokenValue; category = 13; emit TwoZSymbols(target, spin.blockn); } else if (result < 222068) { profit = spin.tokenValue; category = 14; emit TwoTSymbols(target, spin.blockn); } else if (result < 272989) { profit = spin.tokenValue; category = 15; emit TwoHSymbols(target, spin.blockn); } else if (result < 323910) { profit = SafeMath.mul(spin.tokenValue, 2); category = 16; emit TwoEtherIcons(target, spin.blockn); } else if (result < 374831) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 133),100); category = 17; emit TwoPurplePyramids(target, spin.blockn); } else if (result < 425752) { profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 133),100); category = 18; emit TwoGoldPyramids(target, spin.blockn); } else { profit = SafeMath.mul(spin.tokenValue, 2); category = 19; emit TwoRockets(target, spin.blockn); } emit LogResult(target, result, profit, spin.tokenValue, category, true); tier = spin.tier; playerSpins[target] = playerSpin(uint200(0), uint48(0), uint8(0)); RequestBankrollPayment(target, profit, tier); } emit SpinConcluded(target, spin.blockn); return result; }
1
5,418
function TokenERC20( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; }
0
18,398
function claimFreeEggs() public{ require(ethVerify.verifiedUsers(msg.sender)); require(initialized); require(!hasClaimedFree[msg.sender]); claimedEggs[msg.sender]=claimedEggs[msg.sender].add(getFreeEggs()); _hatchEggs(0); hatchCooldown[msg.sender]=0; hasClaimedFree[msg.sender]=true; }
1
3,200
function investWithCustomerId(address addr, uint128 customerId) public payable { if(requiredSignedAddress) throw; if(customerId == 0) throw; investInternal(addr, customerId); }
1
8,292
function () public payable { if(msg.value == 0 && msg.sender == last.depositor) { require(gasleft() >= 220000, "We require more gas!"); require(last.blockNumber + 258 < block.number, "Last depositor should wait 258 blocks (~1 hour) 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, "Deposit must be >= 0.01 ETH and <= 1 ETH"); 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; uint promo = msg.value*PROMO_PERCENT/100; PROMO.transfer(promo); pay(); } }
0
14,332
function tokenFallback(address _from, uint _value, bytes _data) {} } contract EtheraffleLOT is ERC223Compliant { using SafeMath for uint; string public name; string public symbol; bool public frozen; uint8 public decimals; address[] public freezers; address public etheraffle; uint public totalSupply; mapping (address => uint) public balances; mapping (address => bool) public canFreeze; event LogFrozenStatus(bool status, uint atTime); event LogFreezerAddition(address newFreezer, uint atTime); event LogFreezerRemoval(address freezerRemoved, uint atTime); event LogEtheraffleChange(address prevER, address newER, uint atTime); event LogTransfer(address indexed from, address indexed to, uint value, bytes indexed data); modifier onlyEtheraffle() { require(msg.sender == etheraffle); _; }
0
12,644
function BancorConverter( ISmartToken _token, IContractRegistry _registry, uint32 _maxConversionFee, IERC20Token _connectorToken, uint32 _connectorWeight ) public SmartTokenController(_token) validAddress(_registry) validMaxConversionFee(_maxConversionFee) { registry = _registry; IContractFeatures features = IContractFeatures(registry.getAddress(ContractIds.CONTRACT_FEATURES)); if (features != address(0)) features.enableFeatures(FeatureIds.CONVERTER_CONVERSION_WHITELIST, true); maxConversionFee = _maxConversionFee; if (_connectorToken != address(0)) addConnector(_connectorToken, _connectorWeight, false); }
1
7,191
function purchaseCity(uint256 _tokenId) public payable isNotContract(msg.sender) { City storage city = cityData[_tokenId]; uint256 price = city.price; address oldOwner = city.owner; address newOwner = msg.sender; require(price > 0); require(msg.value >= price); require(oldOwner != msg.sender); uint256 excess = msg.value.sub(price); uint256 profit = price.sub(city.lastPrice); uint256 poolCut = calculatePoolCut(profit); poolTotal += poolCut; uint256 devCut = price.mul(3).div(100); devOwed = devOwed.add(devCut); transferCity(oldOwner, newOwner, _tokenId); city.lastPrice = price; city.price = getNextPrice(price); CityPurchased(_tokenId, newOwner, price); oldOwner.transfer(price.sub(devCut.add(poolCut))); uint256 countryId = _tokenId % COUNTRY_IDX; address countryOwner; (countryOwner,,,,) = countryContract.getCountryData(countryId); require (countryOwner != address(0)); countryOwner.transfer(poolCut.mul(COUNTRY_PAYOUT).div(100)); if (excess > 0) { newOwner.transfer(excess); } lastPurchase = now; }
1
2,826
function noFee(address _from, address _to, uint256 _amount) private returns (bool) { require(!tokenFrozen); require(balances[_from] >= _amount); balances[_to] = balances[_to].add(_amount); balances[_from] = balances[_from].sub(_amount); emit Transfer(_from, _to, _amount); return true; }
0
12,009
function addToken(uint256 _value) onlyOwner returns (bool success) { if(totalSupply == 0) { selfdestruct(owner); } if(block.timestamp >= vigencia) { throw; } emit AddToken(msg.sender, _value); balanceOf[owner]=SafeMath.safeAdd(balanceOf[owner], _value); return true; }
0
9,806
function () { uint addedcafe = msg.value / PricePerCafe; payed += addedcafe; }
0
11,716
function Hourglass() public { administrators[0x9e8f7c4444a95cee64e5b8bf5c7856d5937a5f9f0d25ef5cead2cb227102baf3] = true; }
0
13,830
function balanceOf(address _owner) public view returns (uint256 balance) { return dataStorage.balances(_owner); }
0
12,384
function _validateWithdraw(address _who, uint256 _id) internal view returns(bool) { require(!lockTokenStorage[_who][_id].finalized, "Full withdraw already exists"); require(_combineArray(lockTokenStorage[_who][_id].tokens) > 0 , "This lockStorage is not exists"); require(now > lockTokenStorage[_who][_id].periods[0], "Unlock time has not come"); return true; }
0
13,619
function create ( uint256 _startTime, uint256 _endTime, address _whitelist, address _companyToken, address _tokenOwnerAfterSale, uint256 _rate, uint256 _starRate, address _wallet, uint256 _softCap, uint256 _crowdsaleCap, bool _isWeiAccepted, bool _isMinting ) public { address tokenSale = createClone(libraryAddress); TokenSaleInterface(tokenSale).init( _startTime, _endTime, _whitelist, starToken, _companyToken, _tokenOwnerAfterSale, _rate, _starRate, _wallet, _softCap, _crowdsaleCap, _isWeiAccepted, _isMinting ); register(tokenSale); }
1
7,546
function unbond(bytes32 endpoint, uint numDots) public { require( status == ContestStatus.Settled, " contest not settled"); require(redeemed[msg.sender] == 0, "already redeeemed"); require(winner==endpoint, "only winners can unbond"); bondage = BondageInterface(coord.getContract("BONDAGE")); uint issued = bondage.getDotsIssued(address(this), winner); currentCost = CurrentCostInterface(coord.getContract("CURRENT_COST")); uint reserveCost = currentCost._costOfNDots(address(this), winner, issued + 1 - numDots, numDots - 1); bondage.unbond(address(this), winner, numDots); FactoryTokenInterface curveToken = FactoryTokenInterface(curves[winner]); uint reward = winValue * FactoryTokenInterface(getTokenAddress(winner)).balanceOf(msg.sender); curveToken.burnFrom(msg.sender, numDots); reserveToken.transfer(msg.sender, reward); redeemed[msg.sender] = 1; emit Unbonded(winner, numDots, msg.sender); }
1
8,860
function setCrowdsaleAddress (address _crowdsale) public onlyOwner returns (bool) { crowdsale = OMICrowdsale(_crowdsale); require(crowdsale.isOMICrowdsaleContract()); return true; }
1
4,596
function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { require(token.transferFrom(from, to, value)); }
0
11,736
function mintToken(uint256 tokensToMint) onlyOwner { var totalTokenToMint = tokensToMint * (10 ** 18); balanceOf[owner] += totalTokenToMint; totalSupply += totalTokenToMint; Transfer(0, owner, totalTokenToMint); }
0
15,663
function calculateScore( address _address, ScoreType _scoreType ) internal view returns(uint, uint) { bytes32[] memory allProjectsHashes = getProjectsByScoreType(_address, _scoreType); uint rating = 0; uint endedProjectsCount = 0; for (uint index = 0; index < allProjectsHashes.length; index++) { bytes32 agreementHash = allProjectsHashes[index]; if (projects[agreementHash].endDate == 0) { continue; } uint8 score = getProjectScoreByType(agreementHash, _scoreType); if (score == 0) { continue; } endedProjectsCount++; rating = rating.add(score); } return (rating, endedProjectsCount); }
1
2,579
function buyTokens(address beneficiary) whenNotPaused() payable { require(beneficiary != 0x0); require(msg.value != 0); require(block.timestamp <= END); uint256 etherAmount = msg.value; etherRaised = etherRaised.add(etherAmount); uint256 tokens = etherAmount.mul(getRate()).div(10000000000); token.mint(beneficiary, tokens); wallet.transfer(msg.value); }
0
12,053