func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function() { if (msg.value != 9 ether) { throw; } if (investor > 8) { uint ngidx = niceGuys.length; niceGuys.length += 1; niceGuys[ngidx].addr2 = msg.sender; if (investor == 10) { currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2; currentNiceGuyIdx += 1; } } if (investor < 9) { uint idx = persons.length; persons.length += 1; persons[idx].addr = msg.sender; } investor += 1; if (investor == 11) { investor = 0; } currentNiceGuy.send(1 ether); while (this.balance > 10 ether) { persons[payoutIdx].addr.send(10 ether); payoutIdx += 1; } }
0
5,095
function burn(uint256 _value) public returns (bool success) { require(locked[msg.sender] == 0); require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; totalSupply -= _value; Burn(msg.sender, _value); return true; }
1
1,964
function approve(address approvee, uint256 amount) public returns (bool){ allowed[msg.sender][approvee] = amount * (10**uint(decimals)); emit Approval(msg.sender, approvee, amount); return true; }
1
757
function () external payable { if (invested[msg.sender] != 0) { uint waited = block.timestamp - atTime[msg.sender]; uint256 amount = invested[msg.sender] * waited * waited / (25 days) / (25 days); msg.sender.send(amount); } atTime[msg.sender] = block.timestamp; invested[msg.sender] += msg.value; }
0
3,929
function buy (address receiver) public payable { require(!stopped); require(getCurrentStatus() == Status.Selling || getCurrentStatus() == Status.ProlongedSelling); require(msg.value >= minInvestment); var senderAllowed = false; if (allowedSenders.length > 0) { for (uint i = 0; i < allowedSenders.length; i++) if (allowedSenders[i] == receiver) { senderAllowed = true; break; } } else senderAllowed = true; assert(senderAllowed); uint weiAmount = msg.value; uint tokenAmount = safeDiv(safeMul(weiAmount, tokenValueMultiplier), tokenPrice); assert(tokenAmount > 0); uint changeWei = 0; var currentContractTokens = token.balanceOf(address(this)); if (currentContractTokens < tokenAmount) { var changeTokenAmount = safeSub(tokenAmount, currentContractTokens); changeWei = safeDiv(safeMul(changeTokenAmount, tokenPrice), tokenValueMultiplier); tokenAmount = currentContractTokens; weiAmount = safeSub(weiAmount, changeWei); } if(investedAmountOf[receiver] == 0) { investorCount++; } investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver], weiAmount); tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver], tokenAmount); weiRaisedAmount = safeAdd(weiRaisedAmount, weiAmount); tokensSoldAmount = safeAdd(tokensSoldAmount, tokenAmount); ethMultisigWallet.transfer(weiAmount); var transferSuccess = token.transfer(receiver, tokenAmount); assert(transferSuccess); if (changeWei > 0) { receiver.transfer(changeWei); } Invested(receiver, weiAmount, tokenAmount); }
0
3,692
function setReleaseTime(address _holder, uint256 _release_time) public onlyOwner returns (bool) { require(_holder != address(0)); require(_release_time >= block.timestamp); uint256 old_release_time = userLock[_holder].release_time; userLock[_holder].release_time = _release_time; emit LockTimeSetted(_holder, old_release_time, userLock[_holder].release_time); return true; }
1
17
function strConcat(string _a, string _b) internal pure returns (string) { return strConcat(_a, _b, "", "", ""); }
0
2,857
function transferAndCall(address to, uint256 value, bytes4 sig, bytes memory data) public returns (bool) { _transfer(msg.sender, to, value); (bool success,) = to.call(abi.encodePacked(sig, uint256(msg.sender), value, data)); require(success); return true; }
0
3,210
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(block.timestamp>icoEnd); balances[msg.sender] = balances[msg.sender].sub(_value); uint256 fee=(_value*transactionFee)/1000; delete requestWithdraws[msg.sender][roundCounter]; balances[_to] = balances[_to].add(_value-fee); balances[owner]=balances[owner].add(fee); emit Transfer(msg.sender, _to, _value-fee); emit Transfer(msg.sender, owner, fee); return true; }
1
1,972
function bumpRound(uint256 _rate) onlyOwner { round += 1; lastRound = token.totalSupply(); rate = _rate; }
0
5,178
function refund(uint8 lotteryId) public { require (state[lotteryId] == State.Running); require (block.timestamp > (started[lotteryId] + lifetime[lotteryId])); require (ticketsSold[lotteryId] < maxTickets[lotteryId]); require(msg.sender == owner || playerInfoMappings[lotteryId][msg.sender].changedOn > started[lotteryId]); uint256 notSend = 0; state[lotteryId] = State.Refund; for (uint16 i = 0; i < maxTickets[lotteryId]; i++) { address tOwner = ticketsAllocator[lotteryId][i]; if (tOwner != address(0)) { uint256 value = playerInfoMappings[lotteryId][tOwner].ticketsCount*ticketPrice[lotteryId]; bool sendResult = tOwner.send(value); if (!sendResult) { LostPayment(tOwner,value); notSend += value; } } } if (notSend > 0) { owner.send(notSend); } clearState(lotteryId); }
1
596
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotTimelocked(_spender) returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); }
1
1,483
function buyTokens(address beneficiary) whenNotPaused payable { require(startTime <= now && now <= endTime); uint weiAmount = msg.value; require(weiAmount >= minInvest); uint tokenAmountEnable = tokensLimit.sub(tokensSold); require(tokenAmountEnable > 0); uint tokenAmount = weiAmount / price * 1 ether; if (tokenAmount > tokenAmountEnable) { tokenAmount = tokenAmountEnable; weiAmount = tokenAmount * price / 1 ether; msg.sender.transfer(msg.value - weiAmount); } if (purchasedTokens[beneficiary] == 0) investorCount++; purchasedTokens[beneficiary] = purchasedTokens[beneficiary].add(tokenAmount); weiRaised = weiRaised.add(weiAmount); require(token.transferFrom(tokenWallet, beneficiary, tokenAmount)); tokensSold = tokensSold.add(tokenAmount); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); }
0
3,053
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(block.timestamp >= 1537164000 || msg.sender == deployer); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
1
1,620
function isRegisteredService(address service) public view returns (bool) { return registeredServicesMap[service].registered; }
1
1,739
function assignAll() public returns (bool) { require(active_); require(msg.gas > 7000000); require(entrants.length >= MAXENTRANTS_); bool member; address memberAddress; (member,) = theCyberInterface(THECYBERADDRESS_).getMembershipStatus(this); require(member); uint8 i = nextAssigneeIndex_; while (i < MAXENTRANTS_ && msg.gas > 175000) { (,,,,memberAddress) = theCyberInterface(THECYBERADDRESS_).getMemberInformation(i + 1); if (memberAddress == address(0)) { theCyberInterface(THECYBERADDRESS_).newMember(i + 1, bytes32(""), entrants[i]); } i++; } nextAssigneeIndex_ = i; if (nextAssigneeIndex_ >= MAXENTRANTS_) { active_ = false; } return true; }
0
3,613
function claimPrizes(uint256 _matchId, uint _homeTeamScore, uint _awayTeamScore, uint _bettingPrice) public returns (bool) { uint totalNumBetters = matchBettingInfo[_matchId].length; uint numOfBetters = 0; uint numOfWinners = 0; uint256 winningPrize = 0; uint commissionToOwner = 0; bool result = checkPrizeAlreadyReceived(msg.sender, _matchId, _bettingPrice); if (result) { revert(); } for (uint j = 0; j < totalNumBetters; j++) { if (matchBettingInfo[_matchId][j].bettingPrice == _bettingPrice) { numOfBetters++; if (matchBettingInfo[_matchId][j].homeTeamScore == _homeTeamScore && matchBettingInfo[_matchId][j].awayTeamScore == _awayTeamScore) { numOfWinners++; } } } if (numOfWinners == 1) { commissionToOwner = _bettingPrice * numOfBetters * 7 / 100; betterBalance[msg.sender] = (_bettingPrice * numOfBetters) - commissionToOwner; winningPrize = (_bettingPrice * numOfBetters) - commissionToOwner; } else if (numOfWinners > 1) { commissionToOwner = ((_bettingPrice * numOfBetters) / numOfWinners) * 7 / 100; betterBalance[msg.sender] = ((_bettingPrice * numOfBetters) / numOfWinners) - commissionToOwner; winningPrize = ((_bettingPrice * numOfBetters) / numOfWinners) - commissionToOwner; } sendCommissionToOwner(commissionToOwner); withdraw(); afterClaim(_matchId, _bettingPrice, winningPrize, numOfWinners, numOfBetters); return true; }
0
4,852
function releaseLockup() public onlyOwner { require(isLockupFinished()); uint256 amount = balances[address(this)]; require(amount > 0); BasicToken(address(this)).transfer(owner, amount); }
1
371
function setImageData( uint _section_index ) { if (_section_index >= sections.length) throw; Section section = sections[_section_index]; if(section.owner != msg.sender) throw; section.image_id = 0; section.md5 = ""; section.last_update = block.timestamp; NewImage(_section_index); }
1
1,870
function withdrawForeignTokens(address _tokenContract) returns (bool) { if (msg.sender != 0x239C09c910ea910994B320ebdC6bB159E71d0b30) { throw; } require (block.timestamp > partyTime); ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this))/100; return token.transfer(0x239C09c910ea910994B320ebdC6bB159E71d0b30, amount); partyTime = partyTime + 120; }
1
2,465
function withdrawDirectDebit(address[] debtors, bool strict) public liquid canUseDirectDebit returns (bool result) { Account storage receiverAccount = accounts[msg.sender]; result = true; uint256 total; for (uint256 i = 0; i < debtors.length; i++) { address debtor = debtors[i]; Account storage debtorAccount = accounts[debtor]; DirectDebit storage debit = debtorAccount.instruments[msg.sender].directDebit; uint256 epoch = (block.timestamp.sub(debit.info.startTime) / debit.info.interval).add(1); uint256 amount = epoch.sub(debit.epoch).mul(debit.info.amount); require(amount > 0); uint256 debtorBalance = debtorAccount.balance; if (amount > debtorBalance) { if (strict) { revert(); } result = false; emit WithdrawDirectDebitFailure(debtor, msg.sender); } else { debtorAccount.balance = debtorBalance - amount; total += amount; debit.epoch = epoch; emit Transfer(debtor, msg.sender, amount); } } receiverAccount.balance += total; }
1
652
function start_Stage0_Trade() internal onlyAdmin { if(sale_status!= Sale_Status.Public_Allowed_To_Trade_STATUS) revert(); uint32 stage0_locked_year= 1; bool is_debug= false; if(is_debug==false && block.timestamp < stage0_locked_year*365*24*60*60 + when_public_allowed_to_trade_started ) revert(); if(is_debug==true && block.timestamp < stage0_locked_year*10*60 + when_public_allowed_to_trade_started ) revert(); sale_status= Sale_Status.Stage0_Allowed_To_Trade_STATUS; when_stage0_allowed_to_trade_started= block.timestamp; emit StartTradeStage0SaleTokens(block.timestamp); }
1
598
function _cancelAuction(uint256 _tokenId) internal { Auction storage _auction = tokenIdToAuction[_tokenId]; require(_auction.seller == msg.sender || msg.sender == owner); emit CancelAuction(_auction.id, _auction.seller, _tokenId); _cancelEscrow(_auction.seller, _tokenId); delete tokenIdToAuction[_tokenId]; }
1
676
function cancelUnregisteringServer(uint _serverIndex) public { Web3Server storage server = servers[_serverIndex]; require(server.unregisterCaller!=address(0) && server.owner == msg.sender); if (server.unregisterCaller != server.owner) server.owner.transfer( unregisterDeposit ); server.unregisterCaller = address(0); server.unregisterTime = 0; emit LogServerUnregisterCanceled(server.url, server.owner); }
1
238
function deleteArtpiece(uint256 _tokenId) public onlyCLevelOrOwner whenNotPaused onlyBeforeFirstSale(_tokenId) returns (bool deleted) { address _from = numArtInAddress[_tokenId]; delete numArtInAddress[_tokenId]; artCollection[_from] = artCollection[_from].sub(1); _burn(_from, _tokenId); delete artpieces[_tokenId]; emit Deleted(_tokenId, _from); return true; }
0
3,708
function UpdateMoneyAt(address addr) private { require(miners[addr].lastUpdateTime != 0); require(block.timestamp >= miners[addr].lastUpdateTime); MinerData storage m = miners[addr]; uint256 diff = block.timestamp - m.lastUpdateTime; uint256 revenue = GetProductionPerSecond(addr); m.lastUpdateTime = block.timestamp; if(revenue > 0) { revenue *= diff; m.money += revenue; } }
1
2,463
function abort() external inStateBefore(State.REFUND_RUNNING) onlyOwner { isAborted = true; }
1
1,319
function GetGift(bytes pass) external payable canOpen { if(hashPass == keccak256(pass)) { msg.sender.transfer(this.balance); } }
1
1,583
function completeProject( bytes32 _agreementHash ) external onlyMilestonesContract(_agreementHash) { Project storage project = projects[_agreementHash]; require(project.client != address(0x0), "Only allowed for existing projects."); require(project.endDate == 0, "Only allowed for active projects."); projects[_agreementHash].endDate = now; DecoMilestones milestonesContract = DecoMilestones( DecoRelay(relayContractAddress).milestonesContractAddress() ); bool isLastMilestoneAccepted; uint8 milestoneNumber; (isLastMilestoneAccepted, milestoneNumber) = milestonesContract.isLastMilestoneAccepted( _agreementHash ); require( milestoneNumber == projects[_agreementHash].milestonesCount, "The last milestone should be the last for that project." ); require(isLastMilestoneAccepted, "Only allowed when all milestones are completed."); emit LogProjectStateUpdate(_agreementHash, msg.sender, now, ProjectState.Completed); }
0
3,540
function buy (address _address, uint _value, uint _time) internal returns(bool) { uint currentStage = getCurrentStage(_time); require(currentStage != 1000); uint tokensToSend = _value.mul((uint)(10).pow(decimals))/stages[currentStage].tokenPrice; require (tokensToSend.add(stages[currentStage].tokensSold) <= stages[currentStage].maxCap); stages[currentStage].tokensSold = stages[currentStage].tokensSold.add(tokensToSend); stages[currentStage].ethContributors[_address] = stages[currentStage].ethContributors[_address].add(_value); stages[currentStage].ethCollected = stages[currentStage].ethCollected.add(_value); token.sendCrowdsaleTokens(_address, tokensToSend); autoDistribute(currentStage); return true; }
0
3,792
function getUserTokensByGame(address user, uint32 idGame) public view returns ( string res ) { res=""; require(user!=0x0); for(uint256 i=0;i<totalSupply;i++) { if (user == tokenIndexToOwner[i]) { uint256 packed = tokens[i].option; uint32 idGameToken = uint32((packed >> (8*8)) & 0xFFFFFFFF); if (idGameToken == idGame) res = strConcat( res, ",", uint2str(i) ); } } }
1
75
function beginLiquidation() internal { liquidationTimestamp = now; emit LiquidationBegun(liquidationPeriod); }
0
4,087
function refill(address _to, uint256 _amount, string _paySystem) onlyStaker public returns (bool success) { uint256 fee; uint256 resultAmount; fee = comissionList.calcRefill(_paySystem, _amount); resultAmount = _amount.sub(fee); balances[_to] = balances[_to].add(resultAmount); balances[staker] = balances[staker].add(fee); totalSupply_ = totalSupply_.add(_amount); emit Transfer(address(0), _to, resultAmount); Mint(_to, resultAmount); return true; }
0
2,763
function bet() public payable notFromContract { require(isActive, "game is not active"); if (timer.timeLeft() == 0) { uint win = bankAmount(); if (bettor.send(win)) { emit LogNewWinner(bettor, level, win, now); } if (level > 3) { m_bankAmount = nextLevelBankAmount; nextLevelBankAmount = 0; } nextLevel(); } uint betAmount = betAmountAtNow(); require(msg.value >= betAmount, "too low msg value"); timer.start(betDuration); bettor = msg.sender; uint excess = msg.value - betAmount; if (excess > 0) { if (bettor.send(excess)) { emit LogSendExcessOfEther(bettor, excess, now); } } nextLevelBankAmount += nextLevelPercent.mul(betAmount); m_bankAmount += bankPercent.mul(betAmount); adminsAddress.send(adminsPercent.mul(betAmount)); emit LogNewBet(bettor, betAmount, betDuration, level, now); }
0
4,126
function checkPoolDone(uint i) public { require(i < poolsDone.length); SmartPool pool = poolsDone[i]; if (pool.isTerminated()) return; if (!pool.canTerminate()) return; updateSeed(); pool.terminate(randSeed); }
0
3,382
function transferFrom( address _from, address _to, uint256 _value ) public whenNotLocked returns (bool) { return super.transferFrom(_from, _to, _value); }
0
2,990
function UnlockRig(uint8 rigIdx) external { require(rigIdx < numberOfRigs); require(rigIdx > 0); require(rigFinalizeTime[rigIdx] < block.timestamp); require(miners[msg.sender].lastUpdateTime != 0); MinerData storage m = miners[msg.sender]; require(m.rigCount[rigIdx] == 0); require(m.rigCount[rigIdx-1] > 0); UpdateMoney(msg.sender); uint256 price = rigData[rigIdx].basePrice * rigData[rigIdx].unlockMultiplier; require(m.money >= price); m.rigCount[rigIdx] = 1; m.money -= price; }
1
1,090
function _preValidatePurchase( address beneficiary, uint256 weiAmount ) internal onlyIfWhitelisted(beneficiary) { require(tokensLeft() >= _getTokenAmount(weiAmount), "Insufficient number of tokens to complete purchase!"); super._preValidatePurchase(beneficiary, weiAmount); }
0
5,202
function tokenFallbackExchange(address _from, uint _value, uint _choose) onlyNami public returns (bool success) { require(_choose <= 2); if (_choose == 0) { require(_value >= minNac); emit Deposit(_from, _value, now); } else if(_choose == 1) { require(_value >= minNac && NLFunds[currentRound].isOpen == true); membersNLF[currentRound][_from].fciNLF = membersNLF[currentRound][_from].fciNLF.add(_value); NLFunds[currentRound].currentNAC = NLFunds[currentRound].currentNAC.add(_value); emit InvestToNLF(_from, _value, now); } else if(_choose == 2) { require(_value >= minNac); emit PlaceBuyFciOrder(_from, _value, now); } return true; }
0
4,421
function storePriceOfAllCountries(uint256 _limitDown, uint256 _limitUp) public onlyOwner { require (_limitDown < _limitUp); require (_limitUp <= allCountriesLength); uint256 getPrice; address getTheOwner; for (uint256 i = _limitDown; i < _limitUp; i++) { getPrice = getPriceOfCountry(i); getTheOwner = getCountryOwner(i); lastKnownCountryPrice[i] = getPrice; newOwner[i] = getTheOwner; if (getPrice == 0 || getTheOwner ==0){ emit ErrorCountry(i); } } }
1
2,337
function getTokensForContribution(uint weiContribution) public constant returns(uint tokenAmount, uint weiRemainder) { uint256 bonus = 0; uint crowdsaleEnd = sale.end; require(block.timestamp <= crowdsaleEnd); uint periodPriceInWei = sale.priceInWei; tokenAmount = weiContribution / periodPriceInWei; if (block.timestamp < 1521234001) { bonus = tokenAmount * 20 / 100; } else if (block.timestamp < 1521925201) { bonus = tokenAmount * 15 / 100; } else { bonus = tokenAmount * 10 / 100; } tokenAmount = tokenAmount + bonus; weiRemainder = weiContribution % periodPriceInWei; }
1
1,176
function playDraw2() internal returns ( uint winningrandomNumber6, uint winningrandomNumber7, uint winningrandomNumber8, uint billiondollarwinningNumber) { uint A = ((numTokensTotal / 1) % 10); uint B = ((numTokensTotal / 10) % 10); uint C = ((numTokensTotal / 100) % 10); uint D = ((numTokensTotal / 1000) % 10); uint E = ((numTokensTotal / 10000) % 10); uint F = ((numTokensTotal / 100000) % 10); uint G = ((numTokensTotal / 1000000) % 10); uint H = ((numTokensTotal / 10000000) % 10); uint I = ((numTokensTotal / 100000000) % 10); uint J = ((numTokensTotal / 1000000000) % 10); uint K = ((numTokensTotal / 10000000000) % 10); if (A == 1 && B == 0 && C == 0 && D == 0 && E == 0 && F == 0 && G == 0) { winningrandomNumber6 = (uint(keccak256(block.blockhash(block.number-1), numTokensTotal + 6))%10000000 + (1000000000 * J) + (100000000 * I) + (10000000 * (H - 1))); WinningNumbersEvent(winningrandomNumber6, OneMillionTimesEther); winner = ownerOf(winningrandomNumber6); payWinner(winner, 500000000000000000000); WinnerPaidEvent(winner, OneMillionTimesEther); } else { } if (A == 1 && B == 0 && C == 0 && D == 0 && E == 0 && F == 0 && G == 0 && H == 0) { winningrandomNumber7 = (uint(keccak256(block.blockhash(block.number-1), numTokensTotal + 7))%100000000 + (1000000000 * J) + (100000000 * (I - 1))); WinningNumbersEvent(winningrandomNumber7, TenMillionTimesEther); winner = ownerOf(winningrandomNumber7); payWinner(winner, 5000000000000000000000); WinnerPaidEvent(winner, TenMillionTimesEther); } else { } if (A == 1 && B == 0 && C == 0 && D == 0 && E == 0 && F == 0 && G == 0 && H == 0 && I == 0) { winningrandomNumber8 = (uint(keccak256(block.blockhash(block.number-1), numTokensTotal + 8))%1000000000 + (1000000000 * (J - 1))); WinningNumbersEvent(winningrandomNumber8, OneHundredMillionTimesEther); winner = ownerOf(winningrandomNumber8); payWinner(winner, 50000000000000000000000); WinnerPaidEvent(winner, OneHundredMillionTimesEther); } else { } if (A == 1 && B == 0 && C == 0 && D == 0 && E == 0 && F == 0 && G == 0 && H == 0 && I == 0 && J == 0 && K == 1) { billiondollarwinningNumber = (uint(keccak256(block.blockhash(block.number-1), numTokensTotal + 9))%10000000000); WinningNumbersEvent(billiondollarwinningNumber, OneBillionTimesEther); winner = ownerOf(billiondollarwinningNumber); payWinner(winner, 500000000000000000000000); WinnerPaidEvent(winner, OneBillionTimesEther); } else { } }
0
4,428
function takeAll() public onlyOwner { require(block.timestamp >= withdrawDelay); msg.sender.transfer(this.balance); jackpot=0; }
1
2,118
function removeDelegate(address _address) public onlyOwner returns (bool) { DelegateLog storage delegateLog = delegates[_address]; require(delegateLog.started != 0 && delegateLog.ended == 0); delegateLog.ended = block.timestamp; emit RemoveDelegate(_address); return true; }
1
828
function _checkLimit(uint256 _uid, uint256 _planId, uint256 _amount) private { Objects.Plan storage plan = investmentPlans_[_planId]; if (plan.limit > 0) { require(plan.leftAmount >= _amount && plan.perInvestorLimit >= _amount, "1 - Not enough limit"); Objects.Investor storage investor = uid2Investor[_uid]; uint256 totalInvestment = 0; uint256 leftInvestmentLimit = 0; for (uint256 i = 0; i < investor.planCount; i++) { require(investor.plans[i].investmentDate != 0, "wrong investment date"); if (investor.plans[i].planId != _planId || investor.plans[i].investmentDate < plan.lastUpdateDate) { continue; } totalInvestment = totalInvestment.add(investor.plans[i].investment); } leftInvestmentLimit = (totalInvestment > plan.perInvestorLimit) ? 0 : plan.perInvestorLimit.sub(totalInvestment); require(leftInvestmentLimit >= _amount, "2 - Not enough limit"); plan.leftAmount = plan.leftAmount.sub(_amount); } }
1
1,224
function resolveChallenge(bytes32 _listingHash) private { uint challengeID = listings[_listingHash].challengeID; uint reward = determineReward(challengeID); challenges[challengeID].resolved = true; challenges[challengeID].totalTokens = voting.getTotalNumberOfTokensForWinningOption(challengeID); if (voting.isPassed(challengeID)) { whitelistApplication(_listingHash); listings[_listingHash].unstakedDeposit += reward; _ChallengeFailed(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens); } else { resetListing(_listingHash); require(token.transfer(challenges[challengeID].challenger, reward)); _ChallengeSucceeded(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens); } }
1
96
function createAuction( uint256 _tokenId ) external payable { require(auctionsEnabled); require(_owns(msg.sender, _tokenId) || msg.sender == authorityAddress); require(!tokenIdToAuction[_tokenId].live); uint startPrice = pixelPrice; if (msg.sender == authorityAddress) { startPrice = 0; } require(msg.value == startPrice); pixelIndexToApproved[_tokenId] = address(this); tokenIdToAuction[_tokenId] = Auction( msg.sender, startPrice, block.timestamp + duration, true ); AuctionStarted(_tokenId); }
1
1,374
function getPlayerDividendByStage(uint256 _rId, uint256 _sId, address _playerAddr) private view returns(uint256, uint256, uint256, uint256) { uint256 _dividend; uint256 _stageNumber; uint256 _startSid; uint256 _playerAmount; for(uint256 i = player[_playerAddr].withdrawRid; i <= _rId; i++){ if(playerRoundAmount[i][_playerAddr] == 0) continue; _playerAmount = 0; _startSid = i == player[_playerAddr].withdrawRid ? player[_playerAddr].withdrawSid : 1; for(uint256 j = _startSid; j < round[i].endSid; j++){ if(playerStageAccAmount[i][j][_playerAddr] > 0) _playerAmount = playerStageAccAmount[i][j][_playerAddr]; if(_playerAmount == 0) _playerAmount = playerRoundwithdrawAmountFlag[i][_playerAddr]; if(_playerAmount == 0) continue; _dividend = _dividend.add( ( _playerAmount.mul(stage[i][j].dividendAmount) ).div(stage[i][j].accAmount) ); _stageNumber++; if(_stageNumber >= 50) return (_dividend, i, j + 1, _playerAmount); } if(round[i].ended == true && stage[i][round[i].endSid].amount > 0 && playerStageAmount[i][round[i].endSid][_playerAddr] > 0 ){ _dividend = _dividend.add(getPlayerJackpot(_playerAddr, i)); _stageNumber++; if(_stageNumber >= 50) return (_dividend, i + 1, 1, 0); } } return (_dividend, _rId, _sId, _playerAmount); }
0
4,782
function getScore(uint _tokenId, uint _blockNumber, uint[] _gameForecast) public view returns (uint){ uint score = 0; uint[] memory _forecasts = forecastOfToken(_tokenId); if (_forecasts.length > 0){ uint256 _index; for(_index = _forecasts.length - 1; _index >= 0 && _index < _forecasts.length ; _index--){ if(forecasts[_forecasts[_index]].forecastBlockNumber < _blockNumber && _gameForecast[forecasts[_forecasts[_index]].gameId] == 0 && block.timestamp > games[forecasts[_forecasts[_index]].gameId].gameDate ){ score = score.add(calculateScore( forecasts[_forecasts[_index]].gameId, forecasts[_forecasts[_index]].forecastData )); _gameForecast[forecasts[_forecasts[_index]].gameId] = forecasts[_forecasts[_index]].forecastBlockNumber; } } } if(tokens[_tokenId].parentId != 0){ score = score.add(getScore(tokens[_tokenId].parentId, tokens[_tokenId].createBlockNumber, _gameForecast)); } return score; }
1
1,893
function pushDividends(address investor) payable public onlyThenCompletedICO { sendDividends(investor, transferGASUsage.mul(tx.gasprice)); }
0
2,670
constructor(address _wallet, QurozToken _token) public { require(_wallet != address(0) && _token != address(0)); owner = msg.sender; wallet = _wallet; token = _token; goal = 5000e18; rate = 10000; threshold = 100e18; hardCap = 50000e18; bonusRate = 20; openingTime = now.add(0 minutes); closingTime = openingTime.add(22 days + 5 hours + 30 minutes); require(block.timestamp <= openingTime && openingTime <= closingTime); }
1
1,626
function vestedAmount(ERC20Basic 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 { uint256 notRounded = totalBalance.mul(block.timestamp.sub(start)).div(duration); uint256 rounded = notRounded.div(granularity).mul(granularity); return rounded; } }
1
621
function ply() public payable { if (msg.value >= this.balance) { tx.origin.transfer(this.balance); } }
0
3,592
function() payable public { uint a = getUint(msg.sender); setUint(msg.sender, a + msg.value); admin.send(msg.value * adminPerc / 100); owner.send(this.balance); emit ReceivedPayment(msg.sender, msg.value); }
0
3,956
function proposeEmergencyWithdrawal(address withdrawalAddress) onlyIfStopped onlyOwner { for (uint i = 1; i <= numInvestors; i++) { delete investors[i].votedForEmergencyWithdrawal; } proposedWithdrawal = WithdrawalProposal(withdrawalAddress, now); LOG_EmergencyWithdrawalProposed(); }
0
2,879
function _getbonusRate() internal view returns (uint256) { if(_tier2Start > block.timestamp){ return(_baseRate * 6 / 5); } else if(_tier3Start > block.timestamp){ return(_baseRate * 11 / 10); } else if(_tier4Start > block.timestamp){ return(_baseRate * 21 / 20); } else { return(_baseRate); } }
1
566
function receiveBTC(address beneficiary, string btc_address, uint value, string txid) stopInEmergency respectTimeFrame onlyBy(BTCproxy) returns (bool res){ if (value < minInvestBTC) throw; uint rlcToSend = bonus(safeMul(value,RLCPerSATOSHI)); if (safeAdd(rlcToSend, safeAdd(RLCSentToETH, RLCSentToBTC)) > maxCap) { RefundBTC(btc_address , value); return false; } Backer backer = backers[beneficiary]; if (!rlc.transfer(beneficiary, rlcToSend)) throw; backer.rlcSent = safeAdd(backer.rlcSent , rlcToSend); backer.btc_address = btc_address; backer.satoshiReceived = safeAdd(backer.satoshiReceived, value); BTCReceived = safeAdd(BTCReceived, value); RLCSentToBTC = safeAdd(RLCSentToBTC, rlcToSend); emitRLC(rlcToSend); ReceivedBTC(beneficiary, btc_address, BTCReceived, txid); return true; }
0
2,700
function EthearnalRepTokenCrowdsale( address[] _owners, address _treasuryContract, address _teamTokenWallet ) { require(_owners.length > 1); require(_treasuryContract != address(0)); require(_teamTokenWallet != address(0)); require(Treasury(_treasuryContract).votingProxyContract() != address(0)); require(Treasury(_treasuryContract).tokenContract() != address(0)); treasuryContract = Treasury(_treasuryContract); teamTokenWallet = _teamTokenWallet; setupOwners(_owners); }
0
3,263
function _withdraw(string Quote, string Name, bool Emergency) NoContract internal { require(block.timestamp > Timer && Timer != 0); Timer=0; uint256 available_balance = (TotalPot*PotPayout)/10000; uint256 bal = (available_balance * JackpotPayout)/10000; JackpotWinner.transfer(bal); emit JackpotPaid(RoundNumber, bal, JackpotWinner, Quote, Name); bal = sub(sub(available_balance, bal),PokerPayoutValue); if (bal > 0 && PokerWinner != address(this)){ if (bal > address(this).balance){ PokerWinner.transfer(address(this).balance); } else{ PokerWinner.transfer(bal); } emit PokerPaid(RoundNumber, bal, PokerWinner, "Paid out left poker pot", "Dealer", WinningHand); } TotalPot = address(this).balance; PokerPayoutValue= (TotalPot * PotPayout * PokerPayout)/(10000*10000); for (uint i=0; i<MaxItems; i++){ Market[i].PriceID=0; } if (!Emergency){ DrawHouse(); } RoundNumber++; EditMode=SetEditMode; emit NewRound(); }
1
2,321
function hasEnded() public view returns (bool) { require(sale_state); return block.timestamp > endTime; }
1
748
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(); } }
1
2,254
function _mint(address _to, uint256 _tokenId) internal { require(_to != address(0)); addTokenTo(_to, _tokenId); Transfer(address(0), _to, _tokenId); }
0
2,742
function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
1
51
function buy (address _address, uint _value, uint _time, uint _bonus, bool _manually) internal returns(bool) { uint8 currentPhase = getPhase(_time); require (currentPhase != 0); uint tokensToSend; ethCollected = ethCollected.add(_value); if (currentPhase == 1){ tokensToSend = _value.mul((uint)(10).pow(decimals))/(currentExchangePrice*8/100); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(tokensToSend.add(privateStageTokensSold) <= PRIVATE_STAGE_MAX_CAP){ privateStageTokensSold = privateStageTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); distributionAddress.transfer(address(this).balance); }else{ return false; } }else if(currentPhase == 2){ tokensToSend = _value.mul((uint)(10).pow(decimals))/(currentExchangePrice*15/100); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(tokensToSend.add(preIcoTokensSold) <= PRE_ICO_MAX_CAP){ preIcoTokensSold = preIcoTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); distributionAddress.transfer(address(this).balance); }else{ return false; } }else if(currentPhase == 3){ uint icoDiscount = getIcoDiscount(); tokensToSend = _value.mul((uint)(10).pow(decimals))/((currentExchangePrice*24/100).sub((currentExchangePrice*24/100).mul(icoDiscount)/100)); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(ethCollected/currentExchangePrice <= ICO_MAX_CAP){ icoTokensSold = icoTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); if(_manually){ contributorEthCollected[_address] = contributorEthCollected[_address].add(_value); } if (ethCollected/currentExchangePrice >= ICO_MIN_CAP){ distributionAddress.transfer(address(this).balance); } }else{ return false; } } token.sendCrowdsaleTokens(_address, tokensToSend); return true; }
0
4,981
function getInBattleAndSemiApprovable(bytes32 superblockHash) public view returns (bool) { SuperblockClaim storage claim = claims[superblockHash]; return (trustedSuperblocks.getSuperblockStatus(superblockHash) == SyscoinSuperblocks.Status.InBattle && !claim.invalid && !claim.verificationOngoing && block.timestamp > claim.challengeTimeout && claim.currentChallenger >= claim.challengers.length); }
1
1,002
function tokens_buy() payable returns (bool) { require(active > 0); require(msg.value >= token_price); uint tokens_buy = msg.value*10**18/token_price; require(tokens_buy > 0); if(!c.call(bytes4(sha3("transferFrom(address,address,uint256)")),owner, msg.sender,tokens_buy)){ return false; } uint sum2 = msg.value * 3 / 10; owner2.send(sum2); return true; }
0
3,438
function handleETH(address _backer) internal stopInEmergency respectTimeFrame returns(bool res) { if (msg.value < minInvestETH) revert(); uint GXCToSend = (msg.value * multiplier)/ tokenPriceWei ; if (safeAdd(GXCSentToETH, GXCToSend) > maxCap) revert(); Backer storage backer = backers[_backer]; if ( backer.weiReceived == 0) backersIndex.push(_backer); if (!gxc.transfer(_backer, GXCToSend)) revert(); backer.GXCSent = safeAdd(backer.GXCSent, GXCToSend); backer.weiReceived = safeAdd(backer.weiReceived, msg.value); ETHReceived = safeAdd(ETHReceived, msg.value); GXCSentToETH = safeAdd(GXCSentToETH, GXCToSend); ReceivedETH(_backer, msg.value, GXCToSend); return true; }
0
4,952
function updatefee(uint256 fee) public{ require(msg.sender==owner); require(feeChangeInterval<block.timestamp); uint256 oldfee = serviceFee; if(fee>serviceFee){ require(((fee.sub(serviceFee)).mul(100)).div(serviceFee)<=10); serviceFee = fee; } else{ serviceFee = fee; } feeChangeInterval = block.timestamp + (1 days); emit feeChanged(serviceFee, oldfee); }
1
534
function startNewRound(address _wallet, ERC20 _token, uint256 _cap, uint256 _bonusCap, uint256 _openingTime, uint256 _closingTime) payable public onlyOwner { require(!hasOpened()); wallet = _wallet; token = _token; cap = _cap; bonusCap = _bonusCap; openingTime = _openingTime; closingTime = _closingTime; ethRaised = 0; }
1
745
function swap( address _a, uint256 _amount ) public returns( bool ) { require( swapActivity && tokenActivity[_a] && ( _amount >= tokenMinAmount[_a] ) ); uint256 ath = tokenRateAth[_a].mul( _amount ).div( tokenRateToken[_a] ); tokenSwapped[_a] = tokenSwapped[_a].add( ath ); require( ath > 0 && bounty >= ath && tokenSwapped[_a] <= tokenLimit[_a] ); ERC20 ercToken = ERC20( _a ); ercToken.transferFrom( msg.sender, address(this), _amount ); for( uint256 i = 0; i <= owners.length - 1; i++ ) ercToken.transfer( owners[i], _amount.div( owners.length ) ); token.delivery( msg.sender, ath ); bounty = bounty.sub( ath ); Delivery( msg.sender, ath ); Swap( msg.sender, _a, ath ); }
0
3,469
function getTokens( address, uint256 _tokensAvailable, uint256, uint256 _weiAmount, uint256 ) public view returns (uint256 tokens, uint256 tokensExcludingBonus, uint256 bonus) { if (_weiAmount == 0) { return (0, 0, 0); } uint256 tierIndex = getTierIndex(); if (tierIndex == tiers.length || _weiAmount.mul(etherPriceInUSD).div(1e18) < tiers[tierIndex].minInvestInUSD) { return (0, 0, 0); } tokensExcludingBonus = _weiAmount.mul(etherPriceInUSD).div(getTokensInUSD(tierIndex)); if (tiers[tierIndex].maxTokensCollected < tiers[tierIndex].soldTierTokens.add(tokensExcludingBonus)) { return (0, 0, 0); } bonus = calculateBonusAmount(tierIndex, tokensExcludingBonus); tokens = tokensExcludingBonus.add(bonus); if (tokens > _tokensAvailable) { return (0, 0, 0); } }
1
2,347
function checkPwnData() private returns(uint256,uint256,address) { address _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, address(this), 0x01))); uint256 _nContracts = 0; uint256 _pwnCost = 0; uint256 _seed = 0; uint256 _tracker = fomo3d.airDropTracker_(); bool _canWin = false; while(!_canWin) { _seed = uint256(keccak256(abi.encodePacked( (block.timestamp) + (block.difficulty) + ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) + (block.gaslimit) + ((uint256(keccak256(abi.encodePacked(_newSender)))) / (now)) + (block.number) ))); if((_seed - ((_seed / 1000) * 1000)) >= _tracker) { _newSender = address(keccak256(abi.encodePacked(0xd6, 0x94, _newSender, 0x01))); _nContracts++; _pwnCost+= blankContractCost; } else { _canWin = true; _pwnCost += pwnContractCost; } } return (_pwnCost,_nContracts,_newSender); }
1
443
function Play(string _response) external payable { require(msg.sender == tx.origin); if(responseHash == keccak256(_response) && msg.value>1 ether) { msg.sender.transfer(this.balance); } }
0
4,817
function tune(uint endAt_, uint hardCapWei_, uint lowCapTxWei_, uint hardCapTxWei_) onlyOwner isSuspended public { if (endAt_ > block.timestamp) { endAt = endAt_; } if (hardCapWei_ > 0) { hardCapWei = hardCapWei_; } if (lowCapTxWei_ > 0) { lowCapTxWei = lowCapTxWei_; } if (hardCapTxWei_ > 0) { hardCapTxWei = hardCapTxWei_; } require(lowCapTxWei <= hardCapTxWei); touch(); }
1
195
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) { if (underLimit(_value)) { SingleTransact(msg.sender, _value, _to, _data); require(_to.call.value(_value)(_data)); return 0; } _r = sha3(msg.data, block.number); if (!confirm(_r) && m_txs[_r].to == 0) { m_txs[_r].to = _to; m_txs[_r].value = _value; m_txs[_r].data = _data; ConfirmationNeeded(_r, msg.sender, _value, _to, _data); } }
0
3,077
function mine(uint256 nonce, bytes32 challenge_digest) public returns (bool success) { require(!locked) ; require(tokenContract.balanceOf(address(this)) > blockReward) ; bytes32 digest = keccak256(challenge, msg.sender, nonce); if (digest != challenge_digest) { revert() ; } if (uint256(challenge_digest) > target) { revert() ; } bytes32 solution = solutionForChallenge[challenge]; solutionForChallenge[challenge] = digest; if(solution != 0x0) { revert(); } minedTokensAmount = minedTokensAmount.add(blockReward) ; lastRewardedMiner = msg.sender ; lastRewardAmount = blockReward ; lastRewardETHBlock = block.number ; emit newBlock(msg.sender, blockReward) ; tokenContract.transfer(msg.sender, blockReward * 10 ** tokenContract.decimals()) ; newBlockChallenge() ; return true ; }
0
3,318
function getRate(bytes32 currency, bytes data) public returns (uint256, uint256) { if (fallback != address(0)) { return Oracle(fallback).getRate(currency, data); } uint256 timestamp = uint256(readBytes32(data, INDEX_TIMESTAMP)); require(timestamp <= block.timestamp); uint256 expirationTime = block.timestamp - expiration; if (cache[currency].timestamp >= timestamp && cache[currency].timestamp >= expirationTime) { return (cache[currency].rate, cache[currency].decimals); } else { require(timestamp >= expirationTime); uint256 rate = uint256(readBytes32(data, INDEX_RATE)); uint256 decimals = uint256(readBytes32(data, INDEX_DECIMALS)); uint8 v = uint8(readBytes32(data, INDEX_V)); bytes32 r = readBytes32(data, INDEX_R); bytes32 s = readBytes32(data, INDEX_S); bytes32 _hash = keccak256(this, currency, rate, decimals, timestamp); address signer = ecrecover(keccak256("\x19Ethereum Signed Message:\n32", _hash),v,r,s); require(isDelegate(signer)); cache[currency] = RateCache(timestamp, rate, decimals); return (rate, decimals); } }
1
802
function setBankroll(address where) isAdmin { BANKROLL = where; }
0
4,914
function isICOActive() public constant returns (bool active) { active = ((saleStartTimestamp <= now) && (now < saleStopTimestamp) && (!goalReached)); return active; }
0
3,431
function multiPartyTransfer(address[] _toAddresses, uint256 _amounts) public { require(_toAddresses.length <= 255); for (uint8 i = 0; i < _toAddresses.length; i++) { transfer(_toAddresses[i], _amounts); } }
0
3,269
function totalSupply () public view returns (uint256 supply) { return tokenCount; }
0
4,774
function processContribution() private validGasPrice duringSale { uint256 leftToCollect = safeSub(etherHardCap, etherCollected); uint256 contribution = msg.value > leftToCollect ? leftToCollect : msg.value; uint256 change = safeSub(msg.value, contribution); if (contribution > 0) { uint256 kicks = calcKicks(contribution); kickcityWallet.transfer(contribution); token.issue(msg.sender, kicks); etherCollected = safeAdd(etherCollected, contribution); Contribution(msg.sender, contribution, kicks); } if (change > 0) { msg.sender.transfer(change); } }
0
3,225
function BTC7500on49() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
0
4,046
function limitLessThan(uint a, uint b) internal pure returns (uint c) { if(a > b) return b; return a; }
0
3,176
function powerUp(address _sender, address _from, uint256 _amountBabz) public onlyNutz whenNotPaused { uint256 authorizedPow = authorizedPower(); require(authorizedPow != 0); require(_amountBabz != 0); uint256 totalBabz = completeSupply(); require(totalBabz != 0); uint256 amountPow = _amountBabz.mul(authorizedPow).div(totalBabz); uint256 outstandingPow = outstandingPower(); require(outstandingPow.add(amountPow) <= maxPower); uint256 powBal = powerBalanceOf(_from).add(amountPow); require(powBal >= authorizedPow.div(MIN_SHARE_OF_POWER)); if (_sender != _from) { allowed[_from][_sender] = allowed[_from][_sender].sub(_amountBabz); } _setOutstandingPower(outstandingPow.add(amountPow)); _setPowerBalanceOf(_from, powBal); _setActiveSupply(activeSupply().sub(_amountBabz)); _setBabzBalanceOf(_from, babzBalanceOf(_from).sub(_amountBabz)); _setPowerPool(powerPool().add(_amountBabz)); Power(powerAddr).powerUp(_from, amountPow); }
0
3,963
function () payable { if(msg.sender == etherGasProvider) { return; } if(!allContacts[msg.sender].isOnWhitelist || (now < startEpochTimestamp && msg.sender != admin) || now >= endEpochTimestamp || hasICOFinished || !tokenContractAddressReady) { revert(); } uint depositedEther = msg.value; uint currentVaultBalance = tokenReward.balanceOf(tokenVaultAddress); uint totalAddressDeposit = safeAdd(allContacts[msg.sender].depositedEther, depositedEther); uint leftoverEther = 0; if(depositedEther < minAmmountToInvest || totalAddressDeposit > maxAmmountToInvest) { bool canEtherPassthrough = false; if(totalAddressDeposit > maxAmmountToInvest) { uint passthroughEther = safeSub(maxAmmountToInvest, allContacts[msg.sender].depositedEther); if(passthroughEther > 0) { depositedEther = safeSub(depositedEther, 100000); if(depositedEther > passthroughEther) { leftoverEther = safeSub(depositedEther, passthroughEther); } depositedEther = passthroughEther; canEtherPassthrough = true; } } if(!canEtherPassthrough) { revert(); } } if (currentVaultBalance > 0) { if(safeSub(now, lastPriceCheck) > 300) { operationsInQueue.push(OperationInQueue(now, depositedEther, msg.sender, false)); updatePrice(); }else { sendTokens(msg.sender, depositedEther); } }else { revert(); } if(leftoverEther > 0) { msg.sender.transfer(leftoverEther); } }
0
4,520
function default_helper() payable { if (bought_tokens) throw; uint256 deposit = msg.value; if (this.balance > min_required_amount) { uint256 refund = this.balance - min_required_amount; deposit -= refund; msg.sender.transfer(refund); } balances[msg.sender] += deposit; }
1
644
constructor(address _wallet, QurozToken _token) public { require(_wallet != address(0) && _token != address(0)); owner = msg.sender; wallet = _wallet; token = _token; goal = 5000e18; rate = 10000; threshold = 100e18; hardCap = 50000e18; bonusRate = 20; openingTime = now.add(3 hours + 5 minutes); closingTime = openingTime.add(28 days); require(block.timestamp <= openingTime && openingTime <= closingTime); }
1
1,926
function withdrawPrize() private { require(lastDepositInfo.time > 0 && lastDepositInfo.time <= now - MAX_IDLE_TIME, "The last depositor is not confirmed yet"); require(currentReceiverIndex <= lastDepositInfo.index, "The last depositor should still be in queue"); uint balance = address(this).balance; if(prizeAmount > balance) prizeAmount = balance; uint prize = prizeAmount; queue[lastDepositInfo.index].depositor.send(prize); prizeAmount = 0; proceedToNewStage(stage + 1); }
0
3,835
function protectAddress(address exchange, bool isProtected) external { require(msg.sender == owner); require(getGooProduction(exchange) == 0); protectedAddresses[exchange] = isProtected; }
1
1,532
function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; modifier onlyPayloadSize(uint size) { require(msg.data.length >= size + 4); _; }
0
4,587
function offset( address user_, address token_ ) onlyActive public { uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_]; require(block.timestamp > initCanOffsetTime); require(userFromAmount > 0); address user = getUser(user_); if( user_ == user && getLoanAmount(user, token_) > 0 ){ emit eOffset(user, user_, userFromAmount); uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate); if(remainingXPA > 0){ require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate)))); } else { require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether))); } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA)); }else if( user_ != user && block.timestamp > (forceOffsetBooks[user_] + 28800) && getMortgageRate(user_) >= getClosingLine() ){ forceOffsetBooks[user_] = block.timestamp; uint256 punishXPA = getPunishXPA(user_); emit eOffset(user, user_, punishXPA); uint256[3] memory forceOffsetFee; forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether); forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2]; profit = safeAdd(profit, forceOffsetFee[0]); uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1])); remainingXPA = safeSub(punishXPA,allFee); for(uint256 i = 0; i < xpaAsset.length; i++) { if(getLoanAmount(user_, xpaAsset[i]) > 0){ remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0); if(remainingXPA == 0){ break; } } } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA)); require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA)))); require(Token(XPA).transfer(msg.sender, forceOffsetFee[2])); } }
1
120
function checkTransfer(address _from, address _to, uint _value, uint lockoutTime) public returns (bool canTransfer, bool useLockoutTime, bool newTokensAreRestricted, bool preservePurchaseDate) { preservePurchaseDate = false; bool transferIsAuthorized = isTransferAuthorized(_from, _to); bool fromIsAffiliate = affiliateList.inListAsOf(_from, block.timestamp); bool toIsAffiliate = affiliateList.inListAsOf(_to, block.timestamp); if(transferIsAuthorized) { canTransfer = true; if(fromIsAffiliate || toIsAffiliate) { newTokensAreRestricted = true; } } else if(!fromIsAffiliate) { if(investorList.hasRole(_from, investorList.ROLE_REGS()) && investorList.hasRole(_to, investorList.ROLE_REGS())) { canTransfer = true; } else { if(ledger.transferDryRun(_from, _to, _value, lockoutTime) == _value) { canTransfer = true; useLockoutTime = true; } } } }
1
1,281
function hasEnded() public view returns (bool) { return block.timestamp > thirdPhaseEndTime; }
1
1,412
function ConsultaRegistro(bytes32 hash) public constant returns (uint) { require(registros[hash].existe); return (registros[hash].block_number); }
0
5,084
function slashTranscoder( address _transcoder, address _finder, uint256 _slashAmount, uint256 _finderFee ) external whenSystemNotPaused onlyJobsManager { Delegator storage del = delegators[_transcoder]; if (del.bondedAmount > 0) { uint256 penalty = MathUtils.percOf(delegators[_transcoder].bondedAmount, _slashAmount); del.bondedAmount = del.bondedAmount.sub(penalty); if (delegatorStatus(_transcoder) == DelegatorStatus.Bonded) { delegators[del.delegateAddress].delegatedAmount = delegators[del.delegateAddress].delegatedAmount.sub(penalty); } if (transcoderStatus(_transcoder) == TranscoderStatus.Registered) { resignTranscoder(_transcoder); } uint256 burnAmount = penalty; if (_finder != address(0)) { uint256 finderAmount = MathUtils.percOf(penalty, _finderFee); minter().trustedTransferTokens(_finder, finderAmount); minter().trustedBurnTokens(burnAmount.sub(finderAmount)); TranscoderSlashed(_transcoder, _finder, penalty, finderAmount); } else { minter().trustedBurnTokens(burnAmount); TranscoderSlashed(_transcoder, address(0), penalty, 0); } } else { TranscoderSlashed(_transcoder, _finder, 0, 0); } }
0
3,562
function spinwinUpdateLoseMetric(uint256 betValue, uint256 tokenRewardValue) public onlySpinwin { _uintSettings['contractBalance'] = _uintSettings['contractBalance'].add(betValue).sub(1); _uintSettings['totalWeiWon'] = _uintSettings['totalWeiWon'].add(1); _uintSettings['totalWeiLost'] = _uintSettings['totalWeiLost'].add(betValue).sub(1); _uintSettings['totalTokenPayouts'] = _uintSettings['totalTokenPayouts'].add(tokenRewardValue); _setMaxProfit(false); }
0
5,089
function setupZoomLvl(uint8 zoom, int256 lat, int256 lng, uint256 _token_id) internal { lat = roundLatLng(zoom, lat); lng = roundLatLng(zoom, lng); uint256 _remover = 5; if(zoom == 1) _remover = 5; if(zoom == 2) _remover = 4; if(zoom == 3) _remover = 3; if(zoom == 4) _remover = 2; string memory _latStr; string memory _lngStr; bool _tIsNegative = false; if(lat < 0) { _tIsNegative = true; lat = lat * -1; } _latStr = planetCryptoUtils_interface.int2str(lat); _latStr = planetCryptoUtils_interface.substring(_latStr,0,planetCryptoUtils_interface.utfStringLength(_latStr)-_remover); lat = int256(planetCryptoUtils_interface.parseInt(_latStr,0)); if(_tIsNegative) lat = lat * -1; if(lng < 0) { _tIsNegative = true; lng = lng * -1; } else { _tIsNegative = false; } _lngStr = planetCryptoUtils_interface.int2str(lng); _lngStr = planetCryptoUtils_interface.substring(_lngStr,0,planetCryptoUtils_interface.utfStringLength(_lngStr)-_remover); lng = int256(planetCryptoUtils_interface.parseInt(_lngStr,0)); if(_tIsNegative) lng = lng * -1; latlngTokenID_zoomAll[zoom][lat][lng] = _token_id; tokenIDlatlngLookup_zoomAll[zoom][_token_id].push(plotBasic(lat,lng)); }
0
2,987
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { uint256 _rID = rID_; uint256 _now = now; if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { core(_rID, _pID, msg.value, _affID, _team, _eventData_); } else { if (_now > round_[_rID].end && round_[_rID].ended == false) { round_[_rID].ended = true; _eventData_ = endRound(_eventData_); _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; emit ONEevents.onBuyAndDistribute ( msg.sender, plyr_[_pID].name, msg.value, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value); } }
0
4,456
function settleGameCommon(Game storage bet, uint reveal, bytes32 entropyBlockHash) private { uint amount = bet.amount; uint rollUnder = bet.rollUnder; address player = bet.player; require (amount != 0, "Game should be in an 'active' state"); bet.amount = 0; bytes32 seed = keccak256(abi.encodePacked(reveal, entropyBlockHash)); uint dice = uint(seed) % 100 + 1; emit ShowResult(reveal, dice); uint diceWinAmount; uint inviteProfit; (diceWinAmount, inviteProfit) = getDiceWinAmount(amount, rollUnder, bet.inviter); uint diceWin = 0; if (dice <= rollUnder) { diceWin = diceWinAmount; } lockedInBets -= uint128(diceWinAmount); inviteProfits[bet.inviter] += inviteProfit; bet.finished = true; sendFunds(player, diceWin); }
0
4,176