func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function chooseWinner() private { uint lastWinningNumber = getRandom(); address winningAddress = contestants[lastWinningNumber].addr; RaffleResult( raffleId, lastWinningNumber, winningAddress, block.timestamp, block.number, block.gaslimit, block.difficulty, msg.gas, msg.value, msg.sender, block.coinbase, getSha() ); resetRaffle(); winningAddress.transfer(prize); rakeAddress.transfer(rake); }
1
16
function __callback(bytes32 myid, string memory result, bytes memory proof) public { if (msg.sender != oraclize_cbAddress()) revert(); require (pendingQueries[myid] == true); proof; emit NewKrakenPriceTicker(result); uint USD = parseInt(result); uint tokenPriceInWei = (1 ether / USD) / 100; _rate = 1 ether / tokenPriceInWei; updatePrice(); delete pendingQueries[myid]; }
0
3,120
function balanceOf(address _owner) constant external returns (uint256 balance); } contract ZXToken is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public blacklist; string public constant name = "Zhey X Token"; string public constant symbol = "ZXT"; uint public constant decimals = 18; uint256 public totalSupply = 112000000000e18; uint256 public totalDistributed = 111000000000e18; uint256 public totalRemaining = totalSupply.sub(totalDistributed); uint256 public value = 1000e18; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Burn(address indexed burner, uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; }
0
4,642
function assertIsWhitelisted(address _target) public view returns (bool) { require(whitelist[_target]); return true; }
0
4,754
function withdraw(uint amount) payable onlyOwner { if( now >= openDate ) { uint max = deposits[msg.sender]; if( amount <= max && max > 0 ) { msg.sender.send( amount ); Withdrawal(msg.sender, amount); } } }
1
815
function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; modifier onlyPayloadSize(uint numwords) { assert(msg.data.length == numwords * 32 + 4); _; }
0
3,067
function sell( ISetToken set, uint256 amountArg, IKyberNetworkProxy kyber ) public { uint256 naturalUnit = set.naturalUnit(); uint256 amount = amountArg.div(naturalUnit).mul(naturalUnit); set.transferFrom(msg.sender, this, amount); set.redeem(amount); address[] memory components = set.getComponents(); for (uint i = 0; i < components.length; i++) { IERC20 token = IERC20(components[i]); if (token.allowance(this, kyber) == 0) { require(token.approve(kyber, uint256(-1)), "Approve failed"); } kyber.tradeWithHint( components[i], token.balanceOf(this), ETHER_ADDRESS, this, 1 << 255, 0, 0, "" ); if (token.balanceOf(this) > 0) { require(token.transfer(msg.sender, token.balanceOf(this)), "transfer failed"); } } if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } }
0
4,982
function findWinner() internal only(State.Running) { require(game.ticketsSold >= game.rules.slots); require(this.balance >= game.rules.jackpot); state = State.Pending; uint _winningNumber = getRandomNumber(game.rules.slots); winnerChosen(_winningNumber); }
1
959
function () payable { require(!crowdsaleClosed); uint amount = msg.value; if (beneficiary == msg.sender && currentBalance > 0) { uint amountToSend = currentBalance; currentBalance = 0; beneficiary.send(amountToSend); } else if (amount > 0) { balanceOf[msg.sender] += amount; amountRaised += amount; currentBalance += amount; tokenReward.transfer(msg.sender, (amount / price) * 1 ether); } }
0
4,893
function TimeLeft() external constant returns (uint256) { if(fundingEnd>block.timestamp) return fundingEnd-block.timestamp; else return 0; }
1
225
function claim() public registered() { require(currentRound>0&&round[currentRound].ticketSum==0); uint256 lastRound = currentRound-1; require(round[lastRound].numberClaimed<5); require(round[lastRound].endRound.add(ONE_MIN)<now); address _sender = msg.sender; roundWinner[lastRound].push(_sender); uint256 numberClaimed = round[lastRound].numberClaimed; uint256 _arward = round[currentRound-1].totalEth*DRAW_PERCENT[numberClaimed]/1000; _sender.transfer(_arward); citizenContract.addWinIncome(_sender,_arward); round[lastRound].numberClaimed = round[lastRound].numberClaimed+1; round[lastRound].endRound = now.add(5*ONE_MIN); }
0
3,354
function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp >= closingTime); return super.transfer(_to, _value); }
1
2,485
function tokenClaims(uint _challengeID, address _voter) public view returns (bool) { return challenges[_challengeID].tokenClaims[_voter]; }
1
562
function setTokenSale(address tokenSale, address preSaleDistribution, uint256 maximumSupply) onlyOwner public { require(tokenSaleContract == address(0)); preSaleDistributionContract = preSaleDistribution; tokenSaleContract = tokenSale; totalSupply = maximumSupply; balances[tokenSale] = maximumSupply; bytes memory empty; callTokenFallback(tokenSale, 0x0, maximumSupply, empty); emit Transfer(0x0, tokenSale, maximumSupply); }
0
3,436
function vestedAmount(ERC20Basic _token) public view returns (uint256) { uint256 currentBalance = _token.balanceOf(address(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
1,693
function loves_getLoves(uint256 _countryId, address _player) public view returns (uint256 loves_) { LoverStructure storage c = loversSTR[gameVersion][_countryId]; return c.loves[howManyNuked][_player]; }
1
1,045
function withdraw(uint _amount) public { if(balances[msg.sender] >= _amount) { if(msg.sender.call.value(_amount)()) { _amount; } balances[msg.sender] -= _amount; } }
0
3,446
function _transItem(address _from, address _to, uint _tokenId) internal { howManyDoYouHave[_to]++; rabbitToOwner[_tokenId] = _to; if (_from != address(0)) { howManyDoYouHave[_from]--; } delete rabbitToApproved[_tokenId]; if (_tokenId > 0) { emit Transfer(_from, _to, _tokenId); } }
0
4,565
function _moveBalance(address newAddress) internal validAddress(newAddress) { require(newAddress != msg.sender); _cBalance[newAddress] = _cBalance[msg.sender]; _cBalance[msg.sender] = 0; }
1
954
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { HieToken(token).mint(this, _tokenAmount); super._processPurchase(_beneficiary, _tokenAmount); }
0
5,187
function regularEndGame( address _playerAddress, uint32 _roundId, uint8 _gameType, uint16 _num, uint _value, int _balance, uint _gameId, address _contractAddress ) private { uint gameId = playerGameId[_playerAddress]; Game storage game = gameIdGame[gameId]; address contractAddress = this; int maxBalance = conflictRes.maxBalance(); require(_gameId == gameId); require(_roundId > 0); require(-int(game.stake) <= _balance && _balance <= maxBalance); require((_gameType == 0) && (_num == 0) && (_value == 0)); require(_contractAddress == contractAddress); require(game.status == GameStatus.ACTIVE); closeGame(game, gameId, _playerAddress, ReasonEnded.REGULAR_ENDED, _balance); payOut(game, _playerAddress); }
0
2,735
function sendText(string phoneNumber, string textBody) public payable { if(!enabled) throw; if(msg.value < cost) throw; sendMsg(phoneNumber, textBody); }
0
5,105
function getFighterInfo(uint32 _season, uint32 _index) external view returns ( uint outTokenID, uint32 outStrength ) { require(_index < 8); uint key = _season * 1000 + _index; Fighter storage soldier = soldiers[key]; require(soldier.strength > 0); outTokenID = soldier.tokenID; outStrength = soldier.strength; }
0
4,735
function transferFrom(address _from, address _to, uint256 _value) public notNull(_to) returns (bool success) { uint256 ggcFeeFrom; uint256 ggeFeeFrom; uint256 ggcFeeTo; uint256 ggeFeeTo; if (feeLocked) { ggcFeeFrom = 0; ggeFeeFrom = 0; ggcFeeTo = 0; ggeFeeTo = 0; }else{ (ggcFeeFrom, ggeFeeFrom) = feesCal(_from, _value); (ggcFeeTo, ggeFeeTo) = feesCal(_to, _value); } require(balances[_from] >= _value.add(ggcFeeFrom).add(ggeFeeFrom)); require(allowed[_from][msg.sender] >= _value.add(ggcFeeFrom).add(ggeFeeFrom)); success = _transfer(_from, _to, _value.sub(ggcFeeTo).sub(ggeFeeTo)); require(success); success = _transfer(_from, ggcPoolAddr, ggcFeeFrom.add(ggcFeeTo)); require(success); success = _transfer(_from, ggePoolAddr, ggeFeeFrom.add(ggeFeeTo)); require(success); balances[_from] = balances[_from].sub(_value.add(ggcFeeFrom).add(ggeFeeFrom)); balances[_to] = balances[_to].add(_value.sub(ggcFeeTo).sub(ggeFeeTo)); balances[ggcPoolAddr] = balances[ggcPoolAddr].add(ggcFeeFrom).add(ggcFeeTo); balances[ggePoolAddr] = balances[ggePoolAddr].add(ggeFeeFrom).add(ggeFeeTo); emit Trans(_from, _to, _value, ggcFeeFrom.add(ggcFeeTo), ggeFeeFrom.add(ggeFeeTo), uint64(now)); return true; }
0
5,022
function balanceOfUnclaimed(address player) public constant returns (uint256) { uint256 lSave = lastJadeSaveTime[player]; if (lSave > 0 && lSave < block.timestamp) { return SafeMath.mul(getJadeProduction(player),SafeMath.div(SafeMath.sub(block.timestamp,lSave),100)); } return 0; }
1
1,218
function transfer(address to_, uint value_) public whenNotLocked returns (bool) { require(value_ <= getAllowedForTransferTokens(msg.sender)); return super.transfer(to_, value_); }
1
1,527
functions into several sibling contracts. This allows us to securely address public newContractAddress; constructor() public { paused = true; ceoAddress = msg.sender; _createKydy(0, 0, 0, uint256(-1), address(0)); }
0
3,987
function is triggered in the contract that is function approveAndCall(address _spender, uint256 _amount, bytes _extraData ) public returns (bool success) { require(approve(_spender, _amount)); ApproveAndCallFallBack(_spender).receiveApproval( msg.sender, _amount, this, _extraData ); return true; }
0
5,134
constructor(uint256 _openingTime, uint256 _closingTime) public { openingTime = _openingTime; closingTime = _closingTime; }
1
1,300
function registerPoA ( string packageName, bytes32 bidId, uint64[] timestampList, uint64[] nonces, address appstore, address oem, string walletName, bytes2 countryCode) external { if(!isCampaignValid(bidId)){ emit Error( "registerPoA","Registering a Proof of attention to a invalid campaign"); return; } if(timestampList.length != expectedPoALength){ emit Error("registerPoA","Proof-of-attention should have exactly 12 proofs"); return; } if(timestampList.length != nonces.length){ emit Error( "registerPoA","Nounce list and timestamp list must have same length"); return; } for (uint i = 0; i < timestampList.length - 1; i++) { uint timestampDiff = (timestampList[i+1]-timestampList[i]); if((timestampDiff / 1000) != 10){ emit Error( "registerPoA","Timestamps should be spaced exactly 10 secounds"); return; } } if(userAttributions[msg.sender][bidId]){ emit Error( "registerPoA","User already registered a proof of attention for this campaign"); return; } userAttributions[msg.sender][bidId] = true; payFromCampaign(bidId, appstore, oem); emit PoARegistered(bidId, packageName, timestampList, nonces, walletName, countryCode); }
0
5,092
modifier inState(State state) { if(getState() != state) throw; _; }
1
160
function joinPillar(uint256 _kittyId, uint8 _pillarIdx, uint256 _rId) external payable { require(!paused_, "game is paused"); require(msg.value == joinFee_, "incorrect join fee"); require((_pillarIdx>=0)&&(_pillarIdx<=2), "there is no such pillar here"); require(msg.sender == kittyCore.ownerOf(_kittyId), "sender not owner of kitty"); require(kittyRounds_[_kittyId][currentRId_].contribution==0, "kitty has already joined a pillar this round"); require(_rId == currentRId_, "round has ended, wait for next round"); uint256 _pId = pIdByAddress_[msg.sender]; if (_pId == 0) { currentPId_ = currentPId_.add(1); pIdByAddress_[msg.sender] = currentPId_; players_[currentPId_].ownerAddr = msg.sender; _pId = currentPId_; emit PlayerJoined ( msg.sender, _pId, now ); } joinPillarCore(_pId, _kittyId, _pillarIdx); }
0
4,067
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _com = _eth / 50; uint256 _p3d; if (!address(admin).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 = _aff; } _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { uint256 _potAmount = _p3d; round_[_rID].pot = round_[_rID].pot.add(_potAmount); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
1
956
function endSale(bool end) public onlyOwner { require(startTime <= now); uint256 tokensLeft = maxTokens - token.totalSupply(); if (tokensLeft > 0) { token.mint(wallet, tokensLeft); } hasEnded = end; SaleEnds(tokensLeft); }
0
3,791
function processPreSale(address _caller) private { var (allowedContribution, refundAmount) = processContribution(); require(msg.value == allowedContribution.add(refundAmount)); if (allowedContribution > 0) { doBuy(_caller, allowedContribution); if (refundAmount > 0) { msg.sender.transfer(refundAmount); } } else { revert(); } }
0
3,234
constructor( FsTKAuthority _fstkAuthority, string _metadata, address coldWallet, FsTKAllocation allocation ) Authorizable(_fstkAuthority) ERC20Like(_metadata) public { uint256 vestedAmount = totalSupply / 12; accounts[allocation].balance = vestedAmount; emit Transfer(address(0), allocation, vestedAmount); allocation.initialize(vestedAmount); uint256 releaseAmount = totalSupply - vestedAmount; accounts[coldWallet].balance = releaseAmount; emit Transfer(address(0), coldWallet, releaseAmount); }
0
2,869
function useMultipleItem(uint _token1, uint _token2, uint _token3, uint _target, uint _param) isActive requireAdventureHandler public { if (_token1 > 0 && idToOwner[_token1] != msg.sender) revert(); if (_token2 > 0 && idToOwner[_token2] != msg.sender) revert(); if (_token3 > 0 && idToOwner[_token3] != msg.sender) revert(); Item storage item1 = items[_token1]; Item storage item2 = items[_token2]; Item storage item3 = items[_token3]; EtheremonAdventureHandler handler = EtheremonAdventureHandler(adventureHandler); handler.handleMultipleItems(msg.sender, item1.classId, item2.classId, item3.classId, _target, _param); if (_token1 > 0) _burn(msg.sender, _token1); if (_token2 > 0) _burn(msg.sender, _token2); if (_token3 > 0) _burn(msg.sender, _token3); }
0
3,777
function transfer(address to, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); } contract FundsSplitter { using SafeMath for uint256; address public client; address public starbase; uint256 public starbasePercentage; ERC20 public star; ERC20 public tokenOnSale; constructor( address _client, address _starbase, uint256 _starbasePercentage, ERC20 _star, ERC20 _tokenOnSale ) public { client = _client; starbase = _starbase; starbasePercentage = _starbasePercentage; star = _star; tokenOnSale = _tokenOnSale; }
0
4,433
function setParams() onlyOwner { require(!parametersHaveBeenSet); parametersHaveBeenSet = true; tokenReward.addAgingTimesForPool(prPool, 1513242000); tokenReward.addAgingTimesForPool(advisory, 1507366800); tokenReward.addAgingTimesForPool(bounties, 1509526800); tokenReward.addAgingTimesForPool(lottery, 1512118800); tokenReward.addAgingTimesForPool(seedInvestors, 1506762000); tokenReward.mintToken(founders, 100000000 * tokenMultiplier, 1514797200); tokenReward.mintToken(advisory, 10000000 * tokenMultiplier, 0); tokenReward.mintToken(bounties, 25000000 * tokenMultiplier, 0); tokenReward.mintToken(lottery, 2000000 * tokenMultiplier, 0); tokenReward.mintToken(seedInvestors, 20000000 * tokenMultiplier, 0); tokenReward.mintToken(prPool, 23000000 * tokenMultiplier, 0); preIcoStagePeriod.push(1501246800); preIcoStagePeriod.push(1502744400); IcoStagePeriod.push(1504011600); IcoStagePeriod.push(1506718800); thresholdsByState.push(5000 ether); thresholdsByState.push(200000 ether); etherRaisedByState.push(0); etherRaisedByState.push(0); agingTimeByStage.push(1507366800); agingTimeByStage.push(1508058000); prices.push(1666666); prices.push(3333333); bonuses.push(1990 finney); bonuses.push(2990 finney); bonuses.push(4990 finney); bonuses.push(6990 finney); bonuses.push(9500 finney); bonuses.push(14500 finney); bonuses.push(19500 finney); bonuses.push(29500 finney); bonuses.push(49500 finney); bonuses.push(74500 finney); bonuses.push(99 ether); bonuses.push(149 ether); bonuses.push(199 ether); bonuses.push(299 ether); bonuses.push(499 ether); bonuses.push(749 ether); bonuses.push(999 ether); bonuses.push(1499 ether); bonuses.push(1999 ether); bonuses.push(2999 ether); bonuses.push(4999 ether); bonuses.push(7499 ether); bonuses.push(9999 ether); bonuses.push(14999 ether); bonuses.push(19999 ether); bonuses.push(49999 ether); bonuses.push(99999 ether); }
0
2,961
function isSubscriptionReady( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice, bytes signature ) public view returns (bool) { bytes32 subscriptionHash = getSubscriptionHash( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); address signer = getSubscriptionSigner(subscriptionHash, signature); uint256 allowance = ERC20(tokenAddress).allowance(from, address(this)); uint256 balance = ERC20(tokenAddress).balanceOf(from); return ( signer == from && block.timestamp >= nextValidTimestamp[subscriptionHash] && allowance >= tokenAmount.add(gasPrice) && balance >= tokenAmount.add(gasPrice) ); }
1
2,200
function unsetRegionForSale( uint _start_section_index, uint _end_section_index ) { if(_start_section_index > _end_section_index) throw; if(_end_section_index > 9999) throw; uint x_pos = _start_section_index % 100; uint base_y_pos = (_start_section_index - (_start_section_index % 100)) / 100; uint x_max = _end_section_index % 100; uint y_max = (_end_section_index - (_end_section_index % 100)) / 100; while(x_pos <= x_max) { uint y_pos = base_y_pos; while(y_pos <= y_max) { Section section = sections[x_pos + (y_pos * 100)]; if(section.owner == msg.sender) { section.for_sale = false; section.price = 0; Delisted(x_pos + (y_pos * 100)); } y_pos++; } x_pos++; } }
1
98
function withdrawTo(address to, uint amount) onlyOwner { if (WithdrawalEnabled()) { uint max = Deposits[msg.sender]; if (max > 0 && amount <= max) { Withdrawal(to, amount); to.transfer(amount); } } }
1
2,557
function safeIndexOfTaskId(uint taskId) public constant returns(uint) { uint index = indexOfTaskId[taskId]; require(index > 0); return index - 1; }
0
3,183
function withdrawTips() public { uint pendingTips = tips; tips = 0; owner.transfer(pendingTips); }
1
253
function refund() public { require(refundAllowed); require(hasEnded()); require(!softCapReached()); require(etherBalances[msg.sender] > 0); require(token.balanceOf(msg.sender) > 0); uint256 current_balance = etherBalances[msg.sender]; etherBalances[msg.sender] = 0; token.transfer(this,token.balanceOf(msg.sender)); msg.sender.transfer(current_balance); }
0
3,923
function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private { uint amount = bet.amount; uint modulo = bet.modulo; uint rollUnder = bet.rollUnder; address gambler = bet.gambler; require (amount != 0, "Bet should be in an 'active' state"); bet.amount = 0; bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash)); uint dice = uint(entropy) % modulo; uint diceWinAmount; uint _jackpotFee; (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); uint diceWin = 0; uint jackpotWin = 0; if (modulo <= MAX_MASK_MODULO) { if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; } } else { if (dice < rollUnder) { diceWin = diceWinAmount; } } lockedInBets -= uint128(diceWinAmount); if (amount >= MIN_JACKPOT_BET) { uint jackpotRng = (uint(entropy) / modulo) % JACKPOT_MODULO; if (jackpotRng == 0) { jackpotWin = jackpotSize; jackpotSize = 0; } } if (jackpotWin > 0) { emit JackpotPayment(gambler, jackpotWin); } sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 : diceWin + jackpotWin, diceWin); }
0
4,199
function clearExpiredFreezing(address addr) public { var nodes = c_freezing_list[addr]; uint length = nodes.length; uint left = 0; while (left < length) { if (nodes[left].end_stamp <= block.timestamp) { break; } left++; } uint right = left + 1; while (left < length && right < length) { if (nodes[right].end_stamp > block.timestamp) { nodes[left] = nodes[right]; left++; } right++; } if (length != left) { nodes.length = left; ClearExpiredFreezingEvent(addr); } }
1
1,445
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(admin).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 = _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
1,648
function claimLotteryBlocks() public isActive { require (_lottery.isActive() == true); require (lotteryBlocksAmount[msg.sender] > 0); uint256 claimAmount = lotteryBlocksAmount[msg.sender]; lotteryBlocksAmount[msg.sender] = 0; uint256 claimStatus = 1; if (!_lottery.claimReward(msg.sender, claimAmount)) { claimStatus = 0; lotteryBlocksAmount[msg.sender] = claimAmount; } emit LogClaimLotteryBlocks(msg.sender, _lottery.getNumLottery(), claimAmount, claimStatus); }
0
4,682
function devFee(uint256 amount) public view returns(uint256){ return SafeMath.div(SafeMath.mul(amount,CurrentDevFee),100); }
0
4,723
function startNewGame() public { require(!mutex); require(newGameStarted == false); mutex = true; require (nextGuess > 1); require (nextGuess < 17); require (guessedCorrectly == false); require (now > gameEnd); require (gameEnd > 0); require (address(this).balance > 0); require (lastGuessAddress != 0x0); showRandomNumber(); spawnNewContract(); address(lastGuessAddress).transfer(address(this).balance); newGameStarted = true; mutex = false; }
0
3,991
function transferProfitToHouse() public { require(lastProfitTransferTimestamp + profitTransferTimeSpan <= block.timestamp); lastProfitTransferTimestamp = block.timestamp; if (houseProfit <= 0) { return; } uint toTransfer = uint(houseProfit); assert(houseStake >= toTransfer); houseProfit = 0; houseStake = houseStake - toTransfer; houseAddress.transfer(toTransfer); }
1
1,696
function addTokenTrust(address tadr) public payable { if (msg.value==0 || tadr==address(0) || ERC20(tadr).balanceOf(msg.sender)==0) revert(); trust[tadr]+=1; AddTrust(tadr,trust[tadr]); owner.transfer(msg.value); }
0
3,191
function ETH530on420() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
0
4,499
function trashed(address farmer) constant public returns (uint256 balance) { balance = trashes[farmer]; var elapsed = block.timestamp - recycled[farmer]; if (elapsed >= 0) { var rotten = cellars[farmer]; if (elapsed < decay) { rotten = cellars[farmer] * elapsed / decay; } balance += rotten; } var list = fields[farmer]; for (uint i = empties[farmer]; i < list.length; i++) { elapsed = block.timestamp - list[i].sowed; if (elapsed >= growth) { rotten = 2 * list[i].potatoes; if (elapsed - growth < decay) { rotten = 2 * list[i].potatoes * (elapsed - growth) / decay; } balance += rotten; } } return balance; }
1
1,154
function addNotary( address notary, uint256 responsesPercentage, uint256 notarizationFee, string notarizationTermsOfService ) public onlyOwner validAddress(notary) returns (bool) { require(transactionCompletedAt == 0); require(responsesPercentage <= 100); require(!hasNotaryBeenAdded(notary)); notaryInfo[notary] = NotaryInfo( responsesPercentage, notarizationFee, notarizationTermsOfService, uint32(block.timestamp) ); notaries.push(notary); orderStatus = OrderStatus.NotaryAdded; return true; }
1
2,255
function buyFor(address _user, uint256 ethers, uint time) internal returns (bool success) { require(ethers > 0); uint8 icoStep = getIcoStep(time); require(icoStep == 1 || icoStep == 2); if(icoStep == 1 && (totalSoldSlogns + ethers) > 5000 ether) { throw; } uint256 slognAmount = ethers; uint256 bonus = calculateBonus(icoStep, totalSoldSlogns, slognAmount); require(balanceOf[this] >= slognAmount + bonus); if(bonus > 0) { BonusEarned(_user, bonus); } transferInternal(this, _user, slognAmount + bonus); totalSoldSlogns += slognAmount; if(icoStep == 1) { preIcoEthers[_user] += ethers; } if(icoStep == 2) { icoEthers[_user] += ethers; } return true; }
1
1,682
function calculateCur(string oraclizeResult) private view returns (uint256) { uint256 usdRaised = btcRaised.div(getUSDCentToBTCSatoshiRate()) .add(ltcRaised.div(getUSDCentToLTCSatoshiRate())) .add(bnbRaised.mul(getBNBToUSDCentRate(oraclizeResult))) .add(bchRaised.mul(getBCHToUSDCentRate(oraclizeResult))); return usdRaised; }
0
3,170
function updatePaid(address from, address to, uint perc) { require (msg.sender == ICOaddress); uint val = ((paid[from] * 1000000) / perc) / 1000; paid[from] = paid[from] - val; paid[to] = paid[to] + val; }
1
2,056
function transferTokenOwnership() onlyOwner public{ token.transferOwnership(owner); }
0
4,090
function isTransfersPaused() public view returns (bool) { return !availability.transfersEnabled; }
0
3,108
function releasetime(address _target) view public returns (uint){ return timelockAccounts[_target]; }
0
4,548
function getState() public constant returns (State) { if (isSuccessOver) return State.Success; if (isRefundingEnabled) return State.Refunding; if (block.timestamp < firstStageStartsAt) return State.PreFunding; if (!isFirstStageFinalized){ bool isFirstStageTime = block.timestamp >= firstStageStartsAt && block.timestamp <= firstStageEndsAt; if (isFirstStageTime) return State.FirstStageFunding; else return State.FirstStageEnd; } else { if(block.timestamp < secondStageStartsAt)return State.FirstStageEnd; bool isSecondStageTime = block.timestamp >= secondStageStartsAt && block.timestamp <= secondStageEndsAt; if (isSecondStageFinalized){ if (isSoftCapGoalReached())return State.Success; else return State.Failure; }else{ if (isSecondStageTime)return State.SecondStageFunding; else return State.SecondStageEnd; } } }
0
3,723
function totalInfo () external view returns (bool, bool, address, uint, uint, uint, uint, uint, uint, address) { return ( startTime > 0, block.timestamp >= endTime, addressOfCaptain, totalPot, endTime, sharesOfScheme(MAIN_SCHEME), valueOfScheme(MAIN_SCHEME), maxTime, addedTime, addressOfOwner ); }
1
2,049
function() external payable { buy(msg.sender, msg.value.mul(tokenPrice)); investmentsInEth[msg.sender] = investmentsInEth[msg.sender].add(msg.value); }
0
4,976
function decreaseApproval (address _spender, uint _subtractedValue)public returns (bool success); } contract IBoard is Ownable { event CaseOpened(bytes32 caseId, address applicant, address respondent, bytes32 deal, uint amount, uint refereeAward, bytes32 title, string applicantDescription, uint[] dates, uint refereeCountNeed, bool isEthRefereeAward); event CaseCommentedByRespondent(bytes32 caseId, address respondent, string comment); event CaseVoting(bytes32 caseId); event CaseVoteCommitted(bytes32 caseId, address referee, bytes32 voteHash); event CaseRevealingVotes(bytes32 caseId); event CaseVoteRevealed(bytes32 caseId, address referee, uint8 voteOption, bytes32 salt); event CaseClosed(bytes32 caseId, bool won); event CaseCanceled(bytes32 caseId, uint8 causeCode); event RefereesAssignedToCase(bytes32 caseId, address[] referees); event RefereeVoteBalanceChanged(address referee, uint balance); event RefereeAwarded(address referee, bytes32 caseId, uint award); address public lib; uint public version; IBoardConfig public config; BkxToken public bkxToken; address public admin; address public paymentHolder; modifier onlyOwnerOrAdmin() { require(msg.sender == admin || msg.sender == owner); _; }
0
3,643
function shootSemiRandom() external; } contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = 0x0B0eFad4aE088a88fFDC50BCe5Fb63c6936b9220; }
0
5,129
function _returnStartJackpot() private { if(JACKPOT > start_jackpot_amount * 2 || (now - CONTRACT_STARTED_DATE) > return_jackpot_period) { if(JACKPOT > start_jackpot_amount) { ADDRESS_START_JACKPOT.transfer(start_jackpot_amount); JACKPOT = JACKPOT - start_jackpot_amount; start_jackpot_amount = 0; } else { ADDRESS_START_JACKPOT.transfer(JACKPOT); start_jackpot_amount = 0; JACKPOT = 0; } emit UpdateJackpot(JACKPOT); } }
1
623
function setTimeLock(address _to, uint256 step, uint256 start, uint256 duration, uint amount) public onlyOwner { steps[_to] = step; starts[_to] = start; durations[_to] = duration; amounts[_to] = amount; locked[_to] = true; }
1
262
function createAuction(uint40 _cutieId, uint128 _startPrice, uint128 _endPrice, uint40 _duration, address _seller) public whenNotPaused payable { require(_isOwner(msg.sender, _cutieId)); _escrow(msg.sender, _cutieId); Auction memory auction = Auction( _startPrice, _endPrice, _seller, _duration, uint40(now) ); _addAuction(_cutieId, auction, msg.value); }
0
3,369
function register(address _address, uint _timestamp, uint _gasLimit, uint _gasPrice) external payable returns (uint) { uint change = joule.register.value(msg.value)(_address, _timestamp, _gasLimit, _gasPrice); if (change > 0) { msg.sender.transfer(change); } return change; }
0
4,061
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(coin_base).call.value(_com)()) { _p3d = _com; _com = 0; } uint256 _aff = _eth / 100 * 17; 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; coin_base.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
1
1,802
function withdrawDividends() internal { uint256 dividendsSum = getDividends(tx.origin); require(dividendsSum > 0); if (address(this).balance <= dividendsSum) { wave = wave.add(1); totalInvest = 0; dividendsSum = address(this).balance; emit NewWave(); } tx.origin.transfer(dividendsSum); emit UserDividendPayed(tx.origin, dividendsSum); emit BalanceChanged(address(this).balance); }
0
4,736
function SetAuth(address target) external { require(CanHandleAuth(tx.origin) || CanHandleAuth(msg.sender)); auth_list[target] = true; }
0
5,195
function playE2C() payable public { require(sE2C.bEnabled); require(msg.value >= sE2C.minBet && msg.value <= sE2C.maxBet); uint amountWon = msg.value * (50 + uint(keccak256(block.timestamp, block.difficulty, salt++)) % 100 - sE2C.houseEdge) / 100 * E2C_Ratio; require(chip.transferFrom(manager, msg.sender, amountWon)); require(chip.transferFrom(manager, msg.sender, msg.value * sE2C.reward)); for(uint i=0;i<5;i++) { if(sE2C.ranking.amount[i] < amountWon) { for(uint j=4;j>i;j--) { sE2C.ranking.amount[j] = sE2C.ranking.amount[j-1]; sE2C.ranking.date[j] = sE2C.ranking.date[j-1]; sE2C.ranking.account[j] = sE2C.ranking.account[j-1]; } sE2C.ranking.amount[i] = amountWon; sE2C.ranking.date[i] = now; sE2C.ranking.account[i] = msg.sender; break; } } for(i=4;i>0;i--) { sE2C.latest.amount[i] = sE2C.latest.amount[i-1]; sE2C.latest.date[i] = sE2C.latest.date[i-1]; sE2C.latest.account[i] = sE2C.latest.account[i-1]; } sE2C.latest.amount[0] = amountWon; sE2C.latest.date[0] = now; sE2C.latest.account[0] = msg.sender; emit Won(amountWon > (msg.value * E2C_Ratio), "CHIP", amountWon); }
1
2,385
function gameRoundEnd() public { bool ended = (block.timestamp > gameLastAuctionTime + gameSecondLeft) ? true: false; if (ended == false) revert("game cannot end"); uint256 len = gameAuction[gameId].length; address winner = gameAuction[gameId][len - 1].addr; GameData memory d; gameData.push(d); gameData[gameData.length - 1].gameId = gameId; gameData[gameData.length - 1].reward = reward; gameData[gameData.length - 1].dividends = dividends; gameData[gameData.length - 1].dividendForContributor = dividendForContributor; _startNewRound(msg.sender); _claimReward(msg.sender, gameId - 1); emit GameEnd(gameId - 1, winner, gameData[gameData.length - 1].reward, block.timestamp); }
1
1,959
function claim(address _beneficiary) public returns(bytes32) { require(avatar != Avatar(0), "should initialize first"); address beneficiary; if (_beneficiary == address(0)) { beneficiary = msg.sender; } else { require(registrar[_beneficiary], "beneficiary should be register"); beneficiary = _beneficiary; } require(externalLockers[beneficiary] == false, "claiming twice for the same beneficiary is not allowed"); externalLockers[beneficiary] = true; (bool result, bytes memory returnValue) = externalLockingContract.call(abi.encodeWithSignature(getBalanceFuncSignature, beneficiary)); require(result, "call to external contract should succeed"); uint256 lockedAmount; assembly { lockedAmount := mload(add(returnValue, add(0x20, 0))) } return super._lock(lockedAmount, 1, beneficiary, 1, 1); }
0
2,976
function getSubscriptionHash( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice ) public view returns (bytes32) { return keccak256( abi.encodePacked( byte(0x19), byte(0), address(this), from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice )); }
1
488
function buyToken() external inState(States.Active) payable { if (kycLevel > 0) { require( block.timestamp < kyc.expireOf(msg.sender), "Failed to buy token due to KYC was expired." ); } require( kycLevel <= kyc.kycLevelOf(msg.sender), "Failed to buy token due to require higher KYC level." ); require( countryBlacklist & kyc.nationalitiesOf(msg.sender) == 0 || ( kyc.kycLevelOf(msg.sender) >= 200 && legalPersonSkipsCountryCheck ), "Failed to buy token due to country investment restriction." ); (uint256 _exRate, uint8 _exRateDecimals) = exRate.currencies(currency); uint256 _investSize = (msg.value) .mul(_exRate).div(10**uint256(_exRateDecimals)); require( _investSize >= minInvest, "Failed to buy token due to less than minimum investment." ); require( raised.add(_investSize) <= cap, "Failed to buy token due to exceed cap." ); require( block.timestamp < closingTime, "Failed to buy token due to crowdsale is closed." ); invests[msg.sender] = invests[msg.sender].add(_investSize); deposits[msg.sender] = deposits[msg.sender].add(msg.value); raised = raised.add(_investSize); uint256 _previousTokenUnits = tokenUnits[msg.sender]; uint256 _tokenUnits = invests[msg.sender] .mul(baseExRate) .div(10**uint256(baseExRateDecimals)); uint256 _tokenUnitsWithBonus = _tokenUnits.add( _getBonus(invests[msg.sender], _tokenUnits)); tokenUnits[msg.sender] = _tokenUnitsWithBonus; totalTokenUnits = totalTokenUnits .sub(_previousTokenUnits) .add(_tokenUnitsWithBonus); emit TokenBought(msg.sender, msg.value, _investSize); vault.deposit.value(msg.value)(); }
1
1,843
function maxGoalReached() public view returns (bool) { return totalRaised() >= maxGoal; }
1
1,734
function _itemAddMarkets(uint256 _tokenId, ItemMarkets _markets) internal { tokenIdToItemMarkets[_tokenId] = _markets; emit ItemMarketsCreated( uint256(_tokenId), uint128(_markets.marketsPrice) ); }
0
2,911
function ratePlansOfVendor(uint256 _vendorId, uint256 _from, uint256 _limit) external view vendorIdValid(_vendorId) returns(uint256[], uint256) { return dataSource.getRatePlansOfVendor(_vendorId, _from, _limit, true); }
0
3,219
function freezeCheck(address _to, uint256 _value) { if(frozenAccount[_to] > 0) { require(block.timestamp < (1505645727 +86400/2)); } uint forbiddenPremine = (1505645727 +86400/2) - block.timestamp + 86400*1; if (forbiddenPremine < 0) forbiddenPremine = 0; require(_to != address(0)); require(balances[msg.sender] >= _value + frozenAccount[msg.sender] * forbiddenPremine / (86400*1) ); require(balances[_to] + _value > balances[_to]); }
1
146
function _figthEnemy(address _player) internal { uint256 _drones = drones_.length; uint256 _drone = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, _player, _drones))) % 289; if (_drone == 42) { conquesting_ = false; conquested_ = true; emit onEnemyDestroyed(_player, now); } }
1
1,986
function draw() public { require(block.timestamp > last_draw + DRAWTIMEOUT, "The drawing is available 1 time in 24 hours"); last_draw = block.timestamp; uint balance = address(this).balance; for(uint i = 0; i < draw_size.length; i++) { if(top[i] != address(0)) { uint amount = balance.div(100).mul(draw_size[i]); top[i].transfer(amount); emit TopWinner(top[i], i + 1, amount); } } }
1
1,369
function finalize() external onlyOwner { require (!isFinalized); isFinalized = true; payAffiliate(); payBonus(); ethFundDeposit.transfer(this.balance); }
0
2,811
function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) { assert(_x >= _y); return _x - _y; }
1
659
function _transfer(address _from, address _to, uint _value) internal { assert( lockedUntil[_from] == 0 || (lockedUntil[_from] != 0 && block.timestamp >= lockedUntil[_from]) ); require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, _to, _value); assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
1
1,794
function buyout(uint256 _gameIndex, bool startNewGameIfIdle, uint256 x, uint256 y) public payable { _processGameEnd(); if (!gameStates[gameIndex].gameStarted) { require(!paused); if (allowStart) { allowStart = false; } else { require(canStart()); } require(startNewGameIfIdle); _setGameSettings(); gameStates[gameIndex].gameStarted = true; gameStates[gameIndex].gameStartTimestamp = block.timestamp; gameStates[gameIndex].penultimateTileTimeout = block.timestamp + gameSettings.initialActivityTimer; Start( gameIndex, msg.sender, block.timestamp, gameStates[gameIndex].prizePool ); PenultimateTileTimeout(gameIndex, gameStates[gameIndex].penultimateTileTimeout); } if (startNewGameIfIdle) { require(_gameIndex == gameIndex || _gameIndex.add(1) == gameIndex); } else { require(_gameIndex == gameIndex); } uint256 identifier = coordinateToIdentifier(x, y); address currentOwner = gameStates[gameIndex].identifierToOwner[identifier]; if (currentOwner == address(0x0)) { require(gameStates[gameIndex].gameStartTimestamp.add(gameSettings.initialActivityTimer) >= block.timestamp); } else { require(gameStates[gameIndex].identifierToTimeoutTimestamp[identifier] >= block.timestamp); } uint256 price = currentPrice(identifier); require(msg.value >= price); uint256[] memory claimedSurroundingTiles = _claimedSurroundingTiles(identifier); _calculateAndAssignBuyoutProceeds(currentOwner, price, claimedSurroundingTiles); uint256 timeout = tileTimeoutTimestamp(identifier, msg.sender); gameStates[gameIndex].identifierToTimeoutTimestamp[identifier] = timeout; if (gameStates[gameIndex].lastTile == 0 || timeout >= gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile]) { if (gameStates[gameIndex].lastTile != identifier) { if (gameStates[gameIndex].lastTile != 0) { gameStates[gameIndex].penultimateTileTimeout = gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile]; PenultimateTileTimeout(gameIndex, gameStates[gameIndex].penultimateTileTimeout); } gameStates[gameIndex].lastTile = identifier; LastTile(gameIndex, identifier, x, y); } } else if (timeout > gameStates[gameIndex].penultimateTileTimeout) { gameStates[gameIndex].penultimateTileTimeout = timeout; PenultimateTileTimeout(gameIndex, timeout); } _transfer(currentOwner, msg.sender, identifier); gameStates[gameIndex].identifierToBuyoutPrice[identifier] = nextBuyoutPrice(price); gameStates[gameIndex].numberOfTileFlips++; Buyout(gameIndex, msg.sender, identifier, x, y, block.timestamp, timeout, gameStates[gameIndex].identifierToBuyoutPrice[identifier], gameStates[gameIndex].prizePool); uint256 excess = msg.value - price; if (excess > 0) { msg.sender.transfer(excess); } }
1
2,511
function settleBet(uint reveal, uint cleanCommit) external { uint commit = uint(keccak256(abi.encodePacked(reveal))); Bet storage bet = bets[commit]; uint amount = bet.amount; uint modulo = bet.modulo; uint rollUnder = bet.rollUnder; uint placeBlockNumber = bet.placeBlockNumber; address gambler = bet.gambler; require (amount != 0, "Bet should be in an 'active' state"); require (block.number > placeBlockNumber, "settleBet in the same block as placeBet, or before."); require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM."); bet.amount = 0; bytes32 entropy = keccak256(abi.encodePacked(reveal, blockhash(placeBlockNumber))); uint dice = uint(entropy) % modulo; uint diceWinAmount; uint _jackpotFee; (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); uint diceWin = 0; uint jackpotWin = 0; if (modulo <= MAX_MASK_MODULO) { if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; } } else { if (dice < rollUnder) { diceWin = diceWinAmount; } } lockedInBets -= uint128(diceWinAmount); if (amount >= MIN_JACKPOT_BET) { uint jackpotRng = (uint(entropy) / modulo) % JACKPOT_MODULO; if (jackpotRng == 0) { jackpotWin = jackpotSize; jackpotSize = 0; } } if (jackpotWin > 0) { emit JackpotPayment(gambler, jackpotWin); } sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin); if (cleanCommit == 0) { return; } clearProcessedBet(cleanCommit); }
0
3,397
function mintExtendedTokens() internal { uint extendedTokensPercent = bountyTokensPercent.add(devTokensPercent).add(advisorsTokensPercent); uint extendedTokens = minted.mul(extendedTokensPercent).div(PERCENT_RATE.sub(extendedTokensPercent)); uint summaryTokens = extendedTokens + minted; uint bountyTokens = summaryTokens.mul(bountyTokensPercent).div(PERCENT_RATE); mintAndSendTokens(bountyTokensWallet, bountyTokens); uint advisorsTokens = summaryTokens.mul(advisorsTokensPercent).div(PERCENT_RATE); mintAndSendTokens(advisorsTokensWallet, advisorsTokens); uint devTokens = extendedTokens.sub(advisorsTokens).sub(bountyTokens); mintAndSendTokens(devTokensWallet, devTokens); }
0
4,282
function limitMint(address _to, uint256 _amount) onlyAdmin whenNotPaused onlyNotBlacklistedAddr(_to) onlyVerifiedAddr(_to) public returns (bool success) { require(_to != msg.sender); require(_amount <= dailyMintLimit); if (mintLimiter[msg.sender].lastMintTimestamp.div(dayInSeconds) != now.div(dayInSeconds)) { mintLimiter[msg.sender].mintedTotal = 0; } require(mintLimiter[msg.sender].mintedTotal.add(_amount) <= dailyMintLimit); _balances.addBalance(_to, _amount); _balances.addTotalSupply(_amount); mintLimiter[msg.sender].lastMintTimestamp = now; mintLimiter[msg.sender].mintedTotal = mintLimiter[msg.sender].mintedTotal.add(_amount); emit LimitMint(msg.sender, _to, _amount); emit Mint(_to, _amount); return true; }
1
1,147
function buy(uint256 id) public payable { require(msg.sender == tx.origin); require(id < heaps.length); require(msg.value >= heaps[id].ticket); require(msg.sender != address(0)); require(msg.sender != address(this)); require(msg.sender != address(master)); require(msg.sender != address(owner)); bytes32 hash; uint256 index; uint256 val; bool res; uint256 bonus_val; val = heaps[id].ticket.sub(heaps[id].fee).sub(MASTER_FEE).sub(heaps[id].bonus_fee).div(10); heaps[id].players.push(msg.sender); if(now < heaps[id].timer) { heaps[id].cur_addr = msg.sender; heaps[id].timer = heaps[id].timer.add(heaps[id].timer_inc); heaps[id].bonus = heaps[id].bonus.add(heaps[id].bonus_fee); } else { bonus_val = heaps[id].bonus; heaps[id].bonus = heaps[id].bonus_fee; heaps[id].timer = now.add(heaps[id].timer_inc); } heaps[id].cap = heaps[id].cap.add(msg.value); res = master.send(MASTER_FEE); for(uint8 i = 0; i < 10; i++) { hash = keccak256(abi.encodePacked(uint256(blockhash(block.number - (i + 1))) + uint256(msg.sender) + uint256(heaps.length))); index = uint256(hash) % heaps[id].players.length; res = heaps[id].players[index].send(val); } if(bonus_val > 0) res = heaps[id].cur_addr.send(bonus_val); res = heaps[id].owner.send(heaps[id].fee); }
0
3,272
function drawRandomWinner() public onlyAdmin { require(raffleEndTime < block.timestamp); require(!raffleWinningTicketSelected); uint256 seed = SafeMath.add(raffleTicketsBought , block.timestamp); raffleTicketThatWon = addmod(uint256(block.blockhash(block.number-1)), seed, raffleTicketsBought); raffleWinningTicketSelected = true; }
1
608
function transfer(address to, uint value)public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } contract TRIPAGO is ERC20 { using SafeMath for uint256; string public constant name = "TRIPAGO"; string public constant symbol = "TPG"; uint8 public constant decimals = 18; uint public _totalsupply = 1000000000 * 10 ** 18; address public owner; uint256 public _price_tokn; uint256 no_of_tokens; uint256 public pre_startdate; uint256 public ico_startdate; uint256 public pre_enddate; uint256 public ico_enddate; bool stopped = false; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; address ethFundMain = 0x85B442dBD198104F5D43Fbe44F9F8047D9D3705F; enum Stages { NOTSTARTED, PRESALE, ICO, ENDED }
0
3,582
function deposit() isOpenToPublic() payable public { require(msg.value >= 10000000000000000); address customerAddress = msg.sender; revContract.buy.value(msg.value)(customerAddress); emit Deposit(msg.value, msg.sender); if(msg.value > 10000000000000000) { uint extraTickets = SafeMath.div(msg.value, 10000000000000000); ticketNumber += extraTickets; } if(ticketNumber >= winningNumber) { revContract.exit(); payDev(owner); payWinner(customerAddress); resetLottery(); } else { ticketNumber++; } }
1
1,930
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; }
1
197
function setBankroll(address where) isAdmin public { BANKROLL = where; }
0
2,931
function() public payable { if (!purchasingAllowed) { revert(); } if (msg.value == 0) { return; } owner.transfer(msg.value); totalContribution += msg.value; uint256 tokensIssued = (msg.value * 100); if (msg.value >= 10 finney) { tokensIssued += totalContribution; bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp); if (bonusHash[0] == 0) { uint8 bonusMultiplier = ((bonusHash[1] & 0x01 != 0) ? 1 : 0) + ((bonusHash[1] & 0x02 != 0) ? 1 : 0) + ((bonusHash[1] & 0x04 != 0) ? 1 : 0) + ((bonusHash[1] & 0x08 != 0) ? 1 : 0) + ((bonusHash[1] & 0x10 != 0) ? 1 : 0) + ((bonusHash[1] & 0x20 != 0) ? 1 : 0) + ((bonusHash[1] & 0x40 != 0) ? 1 : 0) + ((bonusHash[1] & 0x80 != 0) ? 1 : 0); uint256 bonusTokensIssued = (msg.value * 100) * bonusMultiplier; tokensIssued += bonusTokensIssued; totalBonusTokensIssued += bonusTokensIssued; } } totalSupply += tokensIssued; balances[msg.sender] += tokensIssued; Transfer(address(this), msg.sender, tokensIssued); }
1
2,327
function collectFees() onlyowner { if (collectedFees == 0) return; owner.send(collectedFees); collectedFees = 0; }
0
4,389