func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function acceptEscrow(bytes32 escrowId) public whenNotPaused { address seller = escrowByEscrowId[escrowId].seller; require(seller != msg.sender); require(seller != address(0)); address buyer = escrowByEscrowId[escrowId].buyer; bool isPublic = escrowByEscrowId[escrowId].publicE; if(!isPublic) { require(msg.sender == escrowByEscrowId[escrowId].buyer, "You are not authorized for this escrow."); } uint256[] memory assetIds = assetIdByEscrowId[escrowId]; for(uint a = 0; a < assetIds.length; a++) { require(seller == nonFungibleRegistry.ownerOf(assetIds[a])); } uint escrowPrice = escrowByEscrowId[escrowId].price; if (publicationFeeInWei > 0) { if(!whitelistAddresses[msg.sender]) { acceptedToken.transferFrom( msg.sender, owner, publicationFeeInWei ); } if(!whitelistAddresses[seller]) { acceptedToken.transferFrom( seller, owner, publicationFeeInWei ); } } acceptedToken.transferFrom( msg.sender, seller, escrowPrice ); for(uint counter = 0; counter < assetIds.length; counter++) { uint256 tempId = assetIds[counter]; nonFungibleRegistry.safeTransferFrom( seller, msg.sender, tempId ); } for(uint t = 0; t < escrowByOwnerId[seller].length; t++) { if(escrowByOwnerId[seller][t].id == escrowId) { delete escrowByOwnerId[seller][t]; } } for(uint i = 0; i < assetIds.length; i++) { for(uint j = 0; j < allOwnerParcelsOnEscrow[seller].length; j++) { if(assetIds[i] == allOwnerParcelsOnEscrow[seller][j]) { delete allOwnerParcelsOnEscrow[seller][j]; } } } delete escrowByEscrowId[escrowId]; delete assetIdByEscrowId[escrowId]; emit EscrowSuccessful( escrowId, seller, escrowPrice, buyer ); }
1
2,551
function testReturnChild1() public{ __callback(bytes32("AAA"),"0x44822c4b2f76d05d7e0749908021453d205275fc"); }
0
2,928
function transferShortTermTokens(address _wallet) public validAddress(_wallet) onlyOwner { require(now > shortLock); uint256 tokenBalance = Token(levAddress).balanceOf(disbursement); if (longTermTokens == 0) { longTermTokens = tokenBalance.mul(100 - shortShare).div(100); } require(tokenBalance > longTermTokens); uint256 amountToSend = tokenBalance.sub(longTermTokens); Disbursement(disbursement).withdraw(_wallet, amountToSend); }
1
117
function withdraw(address user){ require(bought_tokens || now > earliest_buy_time + 1 hours); if (balances[user] == 0) return; if (!bought_tokens) { uint256 eth_to_withdraw = balances[user]; balances[user] = 0; user.transfer(eth_to_withdraw); } else { uint256 contract_token_balance = token.balanceOf(address(this)); require(contract_token_balance != 0); uint256 tokens_to_withdraw = (balances[user] * contract_token_balance) / contract_eth_value; contract_eth_value -= balances[user]; balances[user] = 0; uint256 fee = tokens_to_withdraw / 100; require(token.transfer(developer, fee)); require(token.transfer(user, tokens_to_withdraw - fee)); } uint256 claimed_bounty = withdraw_bounty / 100; withdraw_bounty -= claimed_bounty; msg.sender.transfer(claimed_bounty); }
1
645
function addTimelock(address _beneficary, uint256 _timestamp) public onlyOwner { _addTimelock(_beneficary, _timestamp); }
1
3
function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { H3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == address(0) || _affCode == msg.sender) { _affID = plyr_[_pID].laff; } else { _affID = pIDxAddr_[_affCode]; if (_affID != plyr_[_pID].laff) { plyr_[_pID].laff = _affID; } } _team = verifyTeam(_team); buyCore(_pID, _affID, _team, _eventData_); }
0
4,170
function getLockedBalanceOf (address account, address tokenAddr) external view returns (uint256) { require(account != address(0x0)); uint256 balance = 0; for(uint256 i = 0; i < lockedBalances[account][tokenAddr].length; i++) { if(lockedBalances[account][tokenAddr][i].releaseTime > block.timestamp) { balance = balance.add(lockedBalances[account][tokenAddr][i].balance); } } return balance; }
1
467
function withdrawDeferred() public { require(msg.sender == team); require(launched != 0); uint yearsSinceLaunch = (block.timestamp - launched) / 1 years; if (yearsSinceLaunch < 5) { uint256 teamTokensAvailable = balanceTeam / 5 * yearsSinceLaunch; balances[team] += teamTokensAvailable - withdrawnTeam; withdrawnTeam = teamTokensAvailable; } else { balances[team] += balanceTeam - withdrawnTeam; balanceTeam = 0; withdrawnTeam = 0; team = 0x0; } if (block.timestamp - launched >= 90 days) { balances[treasury] += balanceTreasury; balanceTreasury = 0; treasury = 0x0; } }
1
5
function releaseDivTokens() public payable { require(block.timestamp > releaseDates[nextRelease]); uint256 releaseAmount = 100000000 * (uint256(10) ** decimals); dividendSupply -= 100000000 * (uint256(10) ** decimals); uint256 available = (releaseAmount * scaling) + scaledRemainder; scaledDividendPerToken += available / totalSupply; scaledRemainder = available % totalSupply; nextRelease += 1; }
1
919
function checkContributorBalance (address addr) view public returns (uint balance, uint cap, uint remaining) { var c = whitelist[addr]; if (!c.authorized) { cap = whitelistContract.checkMemberLevel(addr); if (cap == 0) return (0,0,0); } else { cap = c.cap; } balance = c.balance; if (contractStage == 1) { if (cap<contributionCaps.length) { if (nextCapTime == 0 || nextCapTime > block.timestamp) { cap = contributionCaps[cap]; } else { cap = nextContributionCaps[cap]; } } remaining = cap.sub(balance); if (contributionCaps[0].sub(this.balance) < remaining) remaining = contributionCaps[0].sub(this.balance); } else { remaining = 0; } return (balance, cap, remaining); }
1
2,595
function withdrawBalance() external { address nftAddress = address(nonFungibleContract); require( msg.sender == owner || msg.sender == nftAddress ); bool res = nftAddress.send(this.balance); }
0
4,324
function safeSubtract(uint256 x, uint256 y) internal pure returns(uint256) { require(x >= y); uint256 z = x - y; return z; }
1
1,063
function lend(uint index, bytes oracleData, Cosigner cosigner, bytes cosignerData) public returns (bool) { Loan storage loan = loans[index]; require(loan.status == Status.initial); require(isApproved(index)); require(block.timestamp <= loan.expirationRequest); loan.lender = msg.sender; loan.dueTime = safeAdd(block.timestamp, loan.duesIn); loan.interestTimestamp = block.timestamp; loan.status = Status.lent; Transfer(0x0, loan.lender, index); activeLoans += 1; lendersBalance[loan.lender] += 1; if (loan.cancelableAt > 0) internalAddInterest(loan, safeAdd(block.timestamp, loan.cancelableAt)); uint256 transferValue = convertRate(loan.oracle, loan.currency, oracleData, loan.amount); require(rcn.transferFrom(msg.sender, loan.borrower, transferValue)); if (cosigner != address(0)) { loan.cosigner = address(uint256(cosigner) + 2); require(cosigner.requestCosign(this, index, cosignerData, oracleData)); require(loan.cosigner == address(cosigner)); } Lent(index, loan.lender, cosigner); return true; }
1
2,590
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); if (lockupAmount[msg.sender] > 0) { if (block.timestamp <= lockupTime[msg.sender]) { require(balances[msg.sender].sub(lockupAmount[msg.sender]) >= _value); } } balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
1
242
function getLowestBid(uint8 _siteId) constant external returns(uint lowestAmount) { uint32[] storage siteBids = sites[_siteId]; lowestAmount = 0; for (uint index = 0; index < siteBids.length; index++) { if (lowestAmount == 0 || bids[siteBids[index]].amount < lowestAmount) { lowestAmount = bids[siteBids[index]].amount; } } }
1
1,160
function invest(address _to, uint256 _amount) canReleaseToken onlyRewardManager public returns (bool success) { require((_to != 0) && (_to != address(this))); bool IsTransferAllowed = false; if(IsPreSaleEnabled){ require(preSaleTokenBalances >= _amount); IsTransferAllowed = true; preSaleTokenBalances = preSaleTokenBalances - _amount; return true; } else if(IsSaleEnabled){ IsTransferAllowed = true; } else{ revert(); } require(IsTransferAllowed); var previousBalanceFrom = balanceOfAt(msg.sender, block.number); require(previousBalanceFrom >= _amount); updateValueAtNow(balances[msg.sender], previousBalanceFrom - _amount); var previousBalanceTo = balanceOfAt(_to, block.number); require(previousBalanceTo + _amount >= previousBalanceTo); updateValueAtNow(balances[_to], previousBalanceTo + _amount); if(msg.sender == rewardManager){ transferFrom(owner, _to, _amount); } else{ transferFrom(msg.sender, _to, _amount); } }
0
2,870
function withdrawCountriesToken() public { require(countriesLockEndingAt <= getBlockTime()); require(countriesStatus == false); bytes memory empty; token.transfer(countriesWallet, countriesTokens, empty); countriesStatus = true; }
0
3,735
function buyTokens() public payable { require(state == State.Active && block.timestamp <= endAt && msg.value >= lowCapTxWei && msg.value <= hardCapTxWei && collectedWei + msg.value <= hardCapWei && whitelisted(msg.sender)); uint iwei = msg.value; uint itokens = iwei * ETH_TOKEN_EXCHANGE_RATIO; token.icoInvestment(msg.sender, itokens); collectedWei = collectedWei.add(iwei); ICOInvestment(msg.sender, iwei, itokens, 0); forwardFunds(); touch(); }
1
2,397
function triggerAirDrop(address recipient) public onlyOwner { numOfCitizensWhoReceivedDrops = numOfCitizensWhoReceivedDrops.add(1); require( numOfCitizensWhoReceivedDrops <= airdropReceiversLimit && !claimedAirdropTokens[recipient], "Cannot give more tokens than airdropShare and cannot airdrop to an address that already receive tokens" ); claimedAirdropTokens[recipient] = true; sendTokensToUser(recipient, tokenAmountPerUser); emit TokenDrop(recipient, tokenAmountPerUser); }
0
3,517
function buyPLATCards(address _player, uint256 _platValue, uint256 _cardId, uint256 _amount) internal { require(cards.getGameStarted()); require(_amount>=1); uint256 existing = cards.getOwnedCount(_player,_cardId); uint256 total = SafeMath.add(existing, _amount); if (total > 99) { require(total <= cards.getMaxCap(msg.sender,_cardId)); } uint256 coinProduction; uint256 coinCost; uint256 ethCost; if (_cardId>=1 && _cardId<=39) { coinProduction = schema.unitCoinProduction(_cardId); coinCost = schema.getCostForCards(_cardId, existing, _amount); ethCost = SafeMath.mul(schema.unitPLATCost(_cardId),_amount); } else if (_cardId>=40) { coinCost = schema.getCostForBattleCards(_cardId, existing, _amount); ethCost = SafeMath.mul(schema.unitBattlePLATCost(_cardId),_amount); } require(ethCost>0); require(SafeMath.add(cards.coinBalanceOf(_player,1),_platValue) >= ethCost); require(cards.balanceOf(_player) >= coinCost); cards.updatePlayersCoinByPurchase(_player, coinCost); if (ethCost > _platValue) { cards.setCoinBalance(_player,SafeMath.sub(ethCost,_platValue),1,false); } else if (_platValue > ethCost) { cards.setCoinBalance(_player,SafeMath.sub(_platValue,ethCost),1,true); } uint256 devFund = uint256(SafeMath.div(ethCost,20)); cards.setTotalEtherPool(uint256(SafeMath.div(ethCost,4)),1,true); cards.setCoinBalance(owner,devFund,1,true); if (coinProduction > 0) { cards.increasePlayersJadeProduction(_player, cards.getUnitsProduction(_player, _cardId, _amount)); cards.setUintCoinProduction(_player,_cardId,cards.getUnitsProduction(_player, _cardId, _amount),true); } if (cards.getUintsOwnerCount(_player)<=0) { cards.AddPlayers(_player); } cards.setUintsOwnerCount(_player,_amount, true); cards.setOwnedCount(_player,_cardId,_amount,true); unitsOwnedOfPLAT[_player][_cardId] = SafeMath.add(unitsOwnedOfPLAT[_player][_cardId],_amount); UnitBought(_player, _cardId, _amount); }
0
3,421
function transfer(address _to, uint256 _value) public returns (bool) { require(block.timestamp > blockEndICO || msg.sender == owner); require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); held[_to] = block.number; balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
1
2,563
function () public payable{ if(IsICOOver() || IsICONotStarted()){ revert(); } else{ if(GetMaxEther()>msg.value){ mint(msg.sender,msg.value*10000); owner.transfer(msg.value); } else{ mint(msg.sender,GetMaxEther()*10000); owner.transfer(GetMaxEther()); finishMinting(); } } }
1
1,605
function() public payable { require(msg.value>=0.0001 ether); Optin(); }
0
5,028
function clearClaim() public returns (uint256){ uint256 collateral = claims[msg.sender].collateral; if (collateral != 0){ delete claims[msg.sender]; msg.sender.transfer(collateral); emit ClaimCleared(msg.sender, collateral); return collateral; } else { return 0; } }
1
2,324
function reject(string datainfo, uint _version, uint16 _count, address recipient, uint amount) onlyowner { if(_count > pendingCount) { log("_count > pendingCount"); return; } pendingCount -= _count; recipient.send(amount); content(datainfo, _version, 3, msg.sender, _count, amount); }
0
2,709
function Token_Offer(address _tokenContract, address _tokenHolder, uint16 _price) { owner = tx.origin; tokenContract = TokenInterface(_tokenContract); tokenHolder = _tokenHolder; price = _price; }
0
4,581
function addPlayerMapping(string x1, string x2, uint key, uint timeAdd, uint hardCap ) private{ if(potCntInfo[x1].last <= now){ potCntInfo[x1].last = now; } if(keccak256(abi.encodePacked(x1)) == keccak256("d")) { if (potCntInfo[x1].gameTime == 0) { potCntInfo[x1].gameTime = now%86400 == 0 ? (now-28800) : now-28800-(now%86400); potCntInfo[x1].gtime = now; potCntInfo[x1].last = potCntInfo[x1].gameTime + 1 days; } } else if(keccak256(abi.encodePacked(x1)) == keccak256("365")) { if (potCntInfo[x1].gameTime == 0) { potCntInfo[x1].gameTime = now%86400 == 0 ? (now-28800) : now-28800-(now%86400); potCntInfo[x1].gtime = now; potCntInfo[x1].last = potCntInfo[x1].gameTime + 365 days; potCntInfo['l'].gameTime = potCntInfo[x1].gameTime; potCntInfo['r'].gameTime = potCntInfo[x1].gameTime; potCntInfo['l'].gtime = now; potCntInfo['r'].gtime = now; } }else { if (potCntInfo[x1].gameTime == 0) { potCntInfo[x1].gameTime = now%86400 == 0 ? (now-28800) : now-28800-(now%86400); potCntInfo[x1].gtime = now; potCntInfo[x1].last = (now + (key * timeAdd))>=now+hardCap ? now + hardCap : now + (key * timeAdd); } else { potCntInfo[x1].last = (potCntInfo[x1].last + (key * timeAdd))>=now+hardCap ? now + hardCap : potCntInfo[x1].last + (key * timeAdd); } } if (idxStruct[x2].playerStruct[msg.sender].flag == 0) { potCntInfo[x1].player.push(msg.sender); idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(key, 0, potCntInfo[x1].player.length, potCntInfo[x1].gtime, 1); } else if (idxStruct[x2].playerStruct[msg.sender].gametime != potCntInfo[x1].gtime){ potCntInfo[x1].player.push(msg.sender); idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(key, 0, potCntInfo[x1].player.length, potCntInfo[x1].gtime, 1); } else { idxStruct[x2].playerStruct[msg.sender].key += key; } potCntInfo[x1].keys += key; potCntInfo[x1].lastPlayer = msg.sender; }
1
1,312
function callDividend(address token_) onlyA { shop.callDividend(token_); }
0
3,448
function withdraw() isActivated() isHuman() public { uint256 _rID = rID_; uint256 _now = now; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _eth; if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { OPKdatasets.EventReturns memory _eventData_; round_[_rID].ended = true; _eventData_ = endRound(_eventData_); _eth = withdrawEarnings(_pID); if (_eth > 0) plyr_[_pID].addr.transfer(_eth); _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; emit OPKevents.onWithdrawAndDistribute ( msg.sender, plyr_[_pID].name, _eth, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.OPKAmount, _eventData_.genAmount ); } else { _eth = withdrawEarnings(_pID); if (_eth > 0) plyr_[_pID].addr.transfer(_eth); emit OPKevents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now); } }
0
3,812
function __callback(bytes32 _queryId, string _result, bytes _proof) onlyOraclizeOr(getContract('FD.Emergency')) public { var (policyId,) = FD_DB.getOraclizeCallback(_queryId); LogOraclizeCallback(policyId, _queryId, _result, _proof); var slResult = _result.toSlice(); if (bytes(_result).length == 0) { decline(policyId, "Declined (empty result)", _proof); } else { if (slResult.count(", ".toSlice()) != 7) { decline(policyId, "Declined (invalid result)", _proof); } else { slResult.beyond("[".toSlice()).until("]".toSlice()); uint observations = parseInt(slResult.split(", ".toSlice()).toString()); if (observations <= MIN_OBSERVATIONS) { decline(policyId, "Declined (too few observations)", _proof); } else { uint[6] memory statistics; statistics[0] = observations; for (uint i = 1; i <= 5; i++) { statistics[i] = parseInt(slResult.split(", ".toSlice()).toString()) * 10000/observations; } var origin = slResult.split(", ".toSlice()); for (uint j = 0; j < FD_DB.countOrigins(); j++) { if (b32toString(FD_DB.getOriginByIndex(j)).toSlice().equals(origin)) { underwrite(policyId, statistics, _proof); return; } } var destination = slResult.split(", ".toSlice()); for (uint k = 0; k < FD_DB.countDestinations(); k++) { if (b32toString(FD_DB.getDestinationByIndex(k)).toSlice().equals(destination)) { underwrite(policyId, statistics, _proof); return; } } decline(policyId, "Not acceptable airport", _proof); } } } }
0
4,847
function withdraw() public payable { require(msg.value == 0, "withdrawal doesn't allow to transfer trx simultaneously"); uint256 uid = address2UID[msg.sender]; require(uid != 0, "Can not withdraw because no any investments"); uint256 withdrawalAmount = 0; for (uint256 i = 0; i < uid2Investor[uid].planCount; i++) { if (uid2Investor[uid].plans[i].isExpired) { continue; } Objects.Plan storage plan = investmentPlans_[uid2Investor[uid].plans[i].planId]; bool isExpired = false; uint256 withdrawalDate = block.timestamp; if (plan.term > 0) { uint256 endTime = uid2Investor[uid].plans[i].investmentDate.add(plan.term); if (withdrawalDate >= endTime) { withdrawalDate = endTime; isExpired = true; } } uint256 amount = _calculateDividends(uid2Investor[uid].plans[i].investment , plan.dailyInterest , withdrawalDate , uid2Investor[uid].plans[i].lastWithdrawalDate); withdrawalAmount = withdrawalAmount.add(amount); msg.sender.transfer(amount); uid2Investor[uid].plans[i].lastWithdrawalDate = withdrawalDate; uid2Investor[uid].plans[i].isExpired = isExpired; uid2Investor[uid].plans[i].currentDividends += amount; } if (uid2Investor[uid].availableReferrerEarnings>0) { msg.sender.transfer(uid2Investor[uid].availableReferrerEarnings); uid2Investor[uid].referrerEarnings = uid2Investor[uid].availableReferrerEarnings.add(uid2Investor[uid].referrerEarnings); uid2Investor[uid].availableReferrerEarnings = 0; } emit onWithdraw(msg.sender, withdrawalAmount); }
1
2,362
function in the implementing class. finalization(); Finalized(); } function finalization() internal; } contract SwarmCrowdsale is FinalizableCrowdsale { using SafeMath for uint256; uint256 public baseTokensSold = 0; uint256 constant TOKEN_DECIMALS = 10**18; uint256 constant TOKEN_TARGET_SOLD = 33333333 * TOKEN_DECIMALS; uint256 constant MAX_TOKEN_SALE_CAP = 33333333 * TOKEN_DECIMALS; bool public initialized = false; function SwarmCrowdsale ( uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet, address _token, uint256 _baseTokensSold ) FinalizableCrowdsale(_startTime, _endTime, _rate, _wallet, _token) { baseTokensSold = _baseTokensSold; } function presaleMint(address _to, uint256 _amt) onlyOwner { require(!initialized); token.mint(_to, _amt); } function multiPresaleMint(address[] _toArray, uint256[] _amtArray) onlyOwner { require(!initialized); require(_toArray.length > 0); require(_toArray.length == _amtArray.length); for (uint i = 0; i < _toArray.length; i++) { token.mint(_toArray[i], _amtArray[i]); }
1
1,975
function updateCapital () internal { if (capital > 0 && capitalTimestamp < now && feeFactor < TWO_128) { capital = mul (capital, pow (feeFactor, now - capitalTimestamp)); } capitalTimestamp = now; }
0
3,514
function releaseDivTokens() public returns (bool success){ require(block.timestamp > releaseDates[nextRelease]); uint256 releaseAmount = 100000000 * (uint256(10) ** decimals); dividendSupply -= releaseAmount; uint256 available = (releaseAmount * scaling) + scaledRemainder; scaledDividendPerToken += available / totalSupply; scaledRemainder = available % totalSupply; nextRelease += 1; return true; }
1
1,761
function setStepLimits( uint256 _firstStepLimit, uint256 _secondStepLimit ) public onlyCLevel { firstStepLimit = _firstStepLimit; secondStepLimit = _secondStepLimit; }
0
2,739
function transfer(address _to, uint _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); uint fee = (_value.mul(basisPointsRate)).div(10000); if (fee > maximumFee) { fee = maximumFee; } uint sendAmount = _value.sub(fee); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(sendAmount); if (fee > 0) { balances[owner] = balances[owner].add(fee); emit Transfer(msg.sender, owner, fee); } emit Transfer(msg.sender, _to, sendAmount); return true; }
0
4,851
function getDHand(uint32 _id) public view returns (uint32) { Game memory _game = games[_id]; if (_game.dHand != 0) return _game.dHand; if (_game.draws == 0) return _game.iHand; if (_game.dBlock == 0) return; bytes32 _dBlockHash = blockhash(_game.dBlock); if (_dBlockHash == 0) return _game.iHand; return drawToHand(uint(keccak256(_dBlockHash, _id)), _game.iHand, _game.draws); }
1
2,472
function transfer(address receiver, uint amount) external; } contract TMONEYsale{ address public beneficiary; uint public fundingGoal; uint public amountRaised; uint public deadline; uint public priceT1; uint public priceT2; uint public priceT3; uint public priceT4; uint public startDate; token public tokenReward; mapping(address => uint256) public balanceOf; bool fundingGoalReached = false; bool crowdsaleClosed = false; event GoalReached(address recipient, uint totalAmountRaised); event FundTransfer(address backer, uint amount, bool isContribution); constructor() public { address ifSuccessfulSendTo = 0xb2769a802438C39f01C700D718Aea13754C7D378; uint fundingGoalInEthers = 8000; uint durationInMinutes = 43200; uint weiCostOfEachToken = 213000000000000; address addressOfTokenUsedAsReward = 0x66d544B100966F99A72734c7eB471fB9556BadFd; beneficiary = ifSuccessfulSendTo; fundingGoal = fundingGoalInEthers * 1 ether; deadline = now + durationInMinutes * 1 minutes; priceT1 = weiCostOfEachToken; priceT2 = weiCostOfEachToken + 12000000000000; priceT3 = weiCostOfEachToken + 24000000000000; priceT4 = weiCostOfEachToken + 26000000000000; tokenReward = token(addressOfTokenUsedAsReward); startDate = now; }
0
4,007
function balanceOf(address _owner, uint _date) public view returns (uint256) { require(_date >= start); uint256 N1 = (_date - start) / period + 1; uint256 N2 = 1; if (block.timestamp > start) { N2 = (block.timestamp - start) / period + 1; } require(N2 >= N1); int256 B = int256(balances[_owner]); while (N2 > N1) { B = B - ChangeOverPeriod[_owner][N2]; N2--; } require(B >= 0); return uint256(B); }
1
1,493
function sendBack() execute { deployer.send(this.balance); }
0
4,206
function withdrawDeposit() external { require(msg.sender == clientAddress); require(now > timelock); clientAddress.transfer(address(this).balance); }
1
2,158
function gasExchangeMultiple( address[] gasRecipients, uint256[] amountsEurUlps, uint256 exchangeFeeFraction ) public only(ROLE_GAS_EXCHANGE) { assert(exchangeFeeFraction < 10**18); require(gasRecipients.length == amountsEurUlps.length); (uint256 rate, uint256 rateTimestamp) = getExchangeRatePrivate(EURO_TOKEN, ETHER_TOKEN); require(block.timestamp - rateTimestamp < 1 hours, "NF_SEX_OLD_RATE"); uint256 idx; while(idx < gasRecipients.length) { gasExchangePrivate(gasRecipients[idx], amountsEurUlps[idx], exchangeFeeFraction, rate); idx += 1; } }
1
1,169
function lockIt(address _address, uint256 _value, uint256 _days) internal { uint256 _expiry = now + _days.mul(86400); lockedAddresses[_address].push(Lock(_value, _expiry, _days)); }
0
4,703
function maxGoalReached() public view returns (bool) { return totalRaised() >= _maxGoal; }
1
232
function _processGameEnd() internal returns(bool) { if (!gameStarted) { return false; } if (block.timestamp <= lastWagerTimeoutTimestamp) { return false; } uint256 prize = prizePool.add(wagerPool); _sendFunds(lastPlayer, prize); End(lastPlayer, lastWagerTimeoutTimestamp, prize); gameStarted = false; gameStarter = 0x0; lastPlayer = 0x0; lastWagerTimeoutTimestamp = 0; wagerIndex = 0; prizePool = 0; wagerPool = 0; return true; }
1
66
function createEscrow( bytes16 _tradeID, address _seller, address _buyer, uint256 _value, uint16 _fee, uint32 _paymentWindowInSeconds, uint32 _expiry, uint8 _v, bytes32 _r, bytes32 _s ) payable external { bytes32 _tradeHash = keccak256(_tradeID, _seller, _buyer, _value, _fee); require(!escrows[_tradeHash].exists); require(ecrecover(keccak256(_tradeHash, _paymentWindowInSeconds, _expiry), _v, _r, _s) == relayer); require(block.timestamp < _expiry); require(msg.value == _value && msg.value > 0); uint32 _sellerCanCancelAfter = _paymentWindowInSeconds == 0 ? 1 : uint32(block.timestamp) + _paymentWindowInSeconds; escrows[_tradeHash] = Escrow(true, _sellerCanCancelAfter, 0); Created(_tradeHash); }
1
1,603
function assignSpartansToBattle(uint _warriors) onlyIfInTime external returns (bool success) { assignWarriorsToBattle(msg.sender, spartans, _warriors, MAX_SPARTANS); sendBattleTokens(msg.sender, _warriors.mul(BTL_SPARTAN)); WarriorsAssignedToBattlefield(msg.sender, spartans, (_warriors / WAD).mul(BP_SPARTAN)); return true; }
0
3,283
function balanceOf(address token, address user) view public returns (uint) { return tokens[token][user]; }
0
3,596
function finalize() external { if (msg.sender != owner) revert(); if (totalSupply < minCap) revert(); if (block.number <= fundingEndBlock && totalSupply < maxCap) revert(); if (!owner.send(this.balance)) revert(); balances[owner] += ownerTokens; totalSupply += ownerTokens; isFinalized = true; }
1
125
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>icoEnd); balances[_from] = balances[_from].sub(_value); uint256 fee=(_value*transactionFee)/1000; allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); delete requestWithdraws[msg.sender][roundCounter]; delete requestWithdraws[_from][roundCounter]; balances[_to] = balances[_to].add(_value-fee); balances[owner]=balances[owner].add(fee); emit Transfer(_from, _to, _value-fee); emit Transfer(_from, owner, fee); return true; }
1
1,296
function getMatchCountAddress(uint addr_type,address value) public constant returns (uint){ uint counter = 0; for (uint i=1; i<numCerts+1; i++) { if((addr_type==0&&certificates[i].issuer_addr==value)||(addr_type==1&&certificates[i].recepient_addr==value)){ counter++; } } return counter; }
1
1,976
function post(uint128 val_, uint32 zzz_, address med_) public payable note auth { val = val_; zzz = zzz_; (bool success, ) = med_.call(abi.encodeWithSignature("poke()")); require(success, "The poke must succeed"); }
0
4,704
function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens); _forwardFunds(); }
0
4,668
function multiMint(uint nonce, uint256[] bits, uint timestamp) external onlyOwner { require(!mintingStopped); if (nonce != mintingNonce) return; mintingNonce = mintingNonce.add(1); uint256 lomask = (1 << 96) - 1; uint created = 0; uint time = timestamp; if(time == 0) { time = block.timestamp; } for (uint i = 0; i < bits.length; i++) { address addr = address(bits[i]>>96); uint value = bits[i] & lomask; balanceOf[addr] = balanceOf[addr].add(value); tokenLotsOf[addr].push(TokenLot(value, time, true)); controller.ledgerTransfer(0, addr, value); created = created.add(value); } totalSupply = totalSupply.add(created); }
1
2,075
function setConfirmationPeriod(uint duration) external onlyOwner { require(MIN_CONFIRMATION_PERIOD <= duration && duration <= MAX_CONFIRMATION_PERIOD); confirmationPeriod = duration; }
0
3,086
function register() public payable { address _customerAddress = msg.sender; require( tx.origin == _customerAddress && !playerRegistered[_customerAddress] && _isCorrectBuyin (msg.value)); registeredPlayers = SafeMath.addint256(registeredPlayers, 1); playerRegistered[_customerAddress] = true; playerGamesScored[_customerAddress] = 0; playerList.push(_customerAddress); uint fivePercent = 0.01009 ether; uint tenPercent = 0.02018 ether; uint prizeEth = (msg.value).sub(tenPercent); require(playerRegistered[_customerAddress]); prizePool = prizePool.add(prizeEth); givethPool = givethPool.add(fivePercent); administrator.send(fivePercent); emit Registration(_customerAddress); }
0
4,524
function finalize() { if (msg.sender == buyer || msg.sender == arbiter) seller.send(msg.value); }
0
3,345
function resetTime() modifyCountdownVerify() senderVerify() public payable { uint256 _rId = rId; uint256 _sId = sId; uint256 _amount = msg.value; uint256 _targetExpectedAmount = getStageTargetAmount(_sId); uint256 _targetAmount = stage[_rId][_sId].dividendAmount <= _targetExpectedAmount ? _targetExpectedAmount : stage[_rId][_sId].dividendAmount; _targetAmount = _targetAmount.mul(100) / 88; uint256 _costAmount = _targetAmount.mul(20) / 100; if(_costAmount > 3 ether) _costAmount = 3 ether; require(_amount >= _costAmount, "Not enough price"); stage[_rId][_sId].start = now; cardList[5].playerAddress.send(_costAmount / 2); developerAddr.send(_costAmount / 2); if(_amount > _costAmount) msg.sender.send(_amount.sub(_costAmount)); }
0
4,651
function enter() { if (msg.value < 5 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 500 ether) { msg.sender.send(msg.value - 500 ether); amount = 500 ether; } else { amount = msg.value; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; if (idx != 0) { collectedFees += amount / 100 * 3; owner.send(collectedFees); collectedFees = 0; balance += amount - amount / 100 * 3; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 200) { uint transactionAmount = persons[payoutIdx].amount / 100 * 200; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
0
2,797
function createEscrow( bytes16 _tradeID, address _seller, address _buyer, uint256 _value, uint16 _fee, uint32 _paymentWindowInSeconds, uint32 _expiry, uint8 _v, bytes32 _r, bytes32 _s ) payable external { bytes32 _tradeHash = keccak256(abi.encodePacked(_tradeID, _seller, _buyer, _value, _fee)); require(!escrows[_tradeHash].exists, "Trade already exists"); bytes32 _invitationHash = keccak256(abi.encodePacked( _tradeHash, _paymentWindowInSeconds, _expiry )); require(recoverAddress(_invitationHash, _v, _r, _s) == relayer, "Must be relayer"); require(block.timestamp < _expiry, "Signature has expired"); require(msg.value == _value && msg.value > 0, "Incorrect ether sent"); uint32 _sellerCanCancelAfter = _paymentWindowInSeconds == 0 ? 1 : uint32(block.timestamp) + _paymentWindowInSeconds; escrows[_tradeHash] = Escrow(true, _sellerCanCancelAfter, 0); emit Created(_tradeHash); }
1
918
function sendSHPCtoContributors(uint start, uint limit) public onlyMultiOwnersType(12) { require(state == SaleState.END); require(start >= 0 && limit > 0); require(getCoinBalance() > 0); for (uint i = start; i < limit; i++) { uint uId = storageContract.getContributorIndexes(i); if (uId > 0) { address addr = storageContract.getContributorAddressById(uId); uint coins = storageContract.getTotalCoin(addr); if (!storageContract.checkReceivedCoins(addr) && storageContract.checkWalletExists(addr) && coins > 0 && ((storageContract.checkPreSaleReceivedBonus(addr) && block.timestamp >= unfreezeRefundPreSale) || (!storageContract.checkPreSaleReceivedBonus(addr) && block.timestamp >= unfreezeRefundAll))) { if (coinContract.transfer(addr, coins)) { storageContract.setReceivedCoin(uId); emit SendSHPCtoContributor(addr); } } } } }
1
1,646
function canRelease(address who) public view returns (bool) { Holding memory holding = heldTokens[who]; if(holding.releaseDate == 0 || holding.quantity == 0) return false; return block.timestamp > holding.releaseDate; }
1
364
function enter() { if (msg.value < minAmount) { collectedFees += msg.value; return; } uint amount; if (msg.value > maxAmount) { uint amountToRefund = msg.value - maxAmount; if (amountToRefund >= minAmount) { if (!msg.sender.send(amountToRefund)) { throw; } } amount = maxAmount; } else { amount = msg.value; } participants.push(Participant( msg.sender, amount * pyramidMultiplier / 100 )); balance += (amount * (100 - fee)) / 100; collectedFees += (amount * fee) / 100; while (balance > participants[payoutOrder].payout) { uint payoutToSend = participants[payoutOrder].payout; participants[payoutOrder].etherAddress.send(payoutToSend); balance -= payoutToSend; payoutOrder += 1; } if (collectedFees >= minFeePayout) { if (!owner.send(collectedFees)) { if (owner.call.gas(msg.gas).value(collectedFees)()) { collectedFees = 0; } } else { collectedFees = 0; } } }
0
3,287
function renewDec(uint initSum, uint newSum) internal returns(bool success){ if(round < 9){ uint tempInitSum = initSum; uint tempNewSum = newSum; uint cnt = 1; while( (tempNewSum > 0 || tempInitSum > 0) && cnt <= decimals ){ uint lastInitSum = tempInitSum%10; tempInitSum = tempInitSum/10; uint lastNewSum = tempNewSum%10; tempNewSum = tempNewSum/10; if(cnt >= round){ if(lastNewSum >= lastInitSum){ dec[decimals-cnt] = dec[decimals-cnt].add(lastNewSum - lastInitSum); }else{ dec[decimals-cnt] = dec[decimals-cnt].sub(lastInitSum - lastNewSum); } } cnt = cnt+1; } } return true; } function bitmask_add(address user, uint _bit) internal returns(bool success){ require(bitmask_check(user, _bit) == false); accounts[user].bitmask = accounts[user].bitmask.add(_bit); return true; } function bitmask_rm(address user, uint _bit) internal returns(bool success){ require(bitmask_check(user, _bit) == true); accounts[user].bitmask = accounts[user].bitmask.sub(_bit); return true; } function bitmask_check(address user, uint _bit) internal view returns (bool status){ bool flag; accounts[user].bitmask & _bit == 0 ? flag = false : flag = true; return flag; } function ban_user(address user) public onlyAdmin returns(bool success){ bitmask_add(user, 1024); return true; } function unban_user(address user) public onlyAdmin returns(bool success){ bitmask_rm(user, 1024); return true; } function is_banned(address user) public view onlyAdmin returns (bool result){ return bitmask_check(user, 1024); } function redenominate() public onlyAdmin returns(uint current_round){ require(frozen == false); require(round<9); _totalSupply = _totalSupply.sub( team_fund%mul[round] ).sub( redenom_dao_fund%mul[round] ).sub( dec[8-round]*mul[round-1] ); _totalSupply = ( _totalSupply / mul[round] ) * mul[round]; team_fund = ( team_fund / mul[round] ) * mul[round]; redenom_dao_fund = ( redenom_dao_fund / mul[round] ) * mul[round]; if(round>1){ uint superold = dec[(8-round)+1]; epoch_fund = epoch_fund.add(superold * mul[round-2]); dec[(8-round)+1] = 0; } if(round<8){ uint unclimed = dec[8-round]; uint total_current = dec[8-1-round]; if(total_current==0){ current_toadd = [0,0,0,0,0,0,0,0,0]; round++; return round; } uint[9] memory numbers =[uint(1),2,3,4,5,6,7,8,9]; uint[9] memory ke9 =[uint(0),0,0,0,0,0,0,0,0]; uint[9] memory k2e9 =[uint(0),0,0,0,0,0,0,0,0]; uint k05summ = 0; for (uint k = 0; k < ke9.length; k++) { ke9[k] = numbers[k]*1e9/total_current; if(k<5) k05summ += ke9[k]; } for (uint k2 = 5; k2 < k2e9.length; k2++) { k2e9[k2] = uint(ke9[k2])+uint(k05summ)*uint(weight[k2])/uint(100); } for (uint n = 5; n < current_toadd.length; n++) { current_toadd[n] = k2e9[n]*unclimed/10/1e9; } }else{ if(round==8){ epoch_fund = epoch_fund.add(dec[0] * 10000000); dec[0] = 0; } } round++; emit Redenomination(round); return round; } function updateAccount(address account) public returns(uint new_balance){ require(frozen == false); require(round<=9); require(bitmask_check(account, 1024) == false); if(round > accounts[account].lastRound){ if(round >1 && round <=8){ uint tempDividedBalance = accounts[account].balance/current_mul(); uint newFixedBalance = tempDividedBalance*current_mul(); uint lastActiveDigit = tempDividedBalance%10; uint diff = accounts[account].balance - newFixedBalance; if(diff > 0){ accounts[account].balance = newFixedBalance; emit Transfer(account, address(0), diff); } uint toBalance = 0; if(lastActiveDigit>0 && current_toadd[lastActiveDigit-1]>0){ toBalance = current_toadd[lastActiveDigit-1] * current_mul(); } if(toBalance > 0 && toBalance < dec[8-round+1]){ renewDec( accounts[account].balance, accounts[account].balance.add(toBalance) ); emit Transfer(address(0), account, toBalance); accounts[account].balance = accounts[account].balance.add(toBalance); dec[8-round+1] = dec[8-round+1].sub(toBalance); _totalSupply = _totalSupply.add(toBalance); } accounts[account].lastRound = round; return accounts[account].balance; }else{ if( round == 9){ uint newBalance = fix_amount(accounts[account].balance); uint _diff = accounts[account].balance.sub(newBalance); if(_diff > 0){ renewDec( accounts[account].balance, newBalance ); accounts[account].balance = newBalance; emit Transfer(account, address(0), _diff); } accounts[account].lastRound = round; return accounts[account].balance; } } } } function current_mul() internal view returns(uint _current_mul){ return mul[round-1]; } function fix_amount(uint amount) public view returns(uint fixed_amount){ return ( amount / current_mul() ) * current_mul(); } function get_rest(uint amount) internal view returns(uint fixed_amount){ return amount % current_mul(); } function totalSupply() public view returns (uint) { return _totalSupply; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return accounts[tokenOwner].balance; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function transfer(address to, uint tokens) public returns (bool success) { require(frozen == false); require(to != address(0)); require(bitmask_check(to, 1024) == false); tokens = fix_amount(tokens); require(tokens>0); updateAccount(to); updateAccount(msg.sender); uint fromOldBal = accounts[msg.sender].balance; uint toOldBal = accounts[to].balance; accounts[msg.sender].balance = accounts[msg.sender].balance.sub(tokens); accounts[to].balance = accounts[to].balance.add(tokens); require(renewDec(fromOldBal, accounts[msg.sender].balance)); require(renewDec(toOldBal, accounts[to].balance)); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { require(frozen == false); require(bitmask_check(msg.sender, 1024) == false); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { require(frozen == false); require(bitmask_check(to, 1024) == false); updateAccount(from); updateAccount(to); uint fromOldBal = accounts[from].balance; uint toOldBal = accounts[to].balance; accounts[from].balance = accounts[from].balance.sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); accounts[to].balance = accounts[to].balance.add(tokens); require(renewDec(fromOldBal, accounts[from].balance)); require(renewDec(toOldBal, accounts[to].balance)); emit Transfer(from, to, tokens); return true; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { require(frozen == false); require(bitmask_check(msg.sender, 1024) == false); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { require(frozen == false); return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
1
2,125
function raiseDispute(uint _transactionID, uint _arbitrationCost) internal { Transaction storage transaction = transactions[_transactionID]; transaction.status = Status.DisputeCreated; transaction.disputeId = arbitrator.createDispute.value(_arbitrationCost)(AMOUNT_OF_CHOICES, arbitratorExtraData); disputeIDtoTransactionID[transaction.disputeId] = _transactionID; emit Dispute(arbitrator, transaction.disputeId, _transactionID, _transactionID); if (transaction.senderFee > _arbitrationCost) { uint extraFeeSender = transaction.senderFee - _arbitrationCost; transaction.senderFee = _arbitrationCost; transaction.sender.send(extraFeeSender); } if (transaction.receiverFee > _arbitrationCost) { uint extraFeeReceiver = transaction.receiverFee - _arbitrationCost; transaction.receiverFee = _arbitrationCost; transaction.receiver.send(extraFeeReceiver); } }
0
4,123
function getInfo3(address _address) public view returns(uint Dividends, uint Bonuses) { uint _payout; for (uint i = 0; i <= index[_address]; i++) { if (checkpoint[_address] < finish[_address][i]) { if (block.timestamp > finish[_address][i]) { _payout = _payout.add((deposit[_address][i].div(20)).mul(finish[_address][i].sub(checkpoint[_address])).div(1 days)); } else { _payout = _payout.add((deposit[_address][i].div(20)).mul(block.timestamp.sub(checkpoint[_address])).div(1 days)); } } } Dividends = _payout; Bonuses = refBonus[_address]; }
1
525
constructor(uint256 rate, uint256 bonusRate, uint256 bonusCap, uint256 openingTime, uint256 bonusEndTime, uint256 closingTime, address wallet, IERC20 token) public { require(rate > 0); require(bonusRate > 0); require(bonusCap > 0); require(openingTime >= block.timestamp); require(bonusEndTime >= openingTime); require(closingTime >= bonusEndTime); require(wallet != address(0)); _rate = rate; _bonusRate = bonusRate; _bonusCap = bonusCap; _wallet = wallet; _token = token; _openingTime = openingTime; _closingTime = closingTime; _bonusEndTime = bonusEndTime; }
1
55
function pledgeCompletionPercentage() external view returns (uint256) { uint256 balance = token.balanceOf(this); if (balance == 0) { return 0; } return pledgeTotal.add(tokensSold).mul(100).div(balance); }
1
638
function partnerWithdrawed(address _addr) public view returns (uint256) { return partnersWithdrawed[_addr]; }
1
302
function UNITSimplePaymentGateway(address _token) public { token = UNITv2(_token); setAdministrator(tx.origin); }
0
2,766
function claim() public { require(now > deadline); require(msg.sender == leader); require(!claimed); claimed = true; msg.sender.transfer(prize); }
1
1,276
function broadcastSignedRequestAsPayerAction( bytes _requestData, address[] _payeesPaymentAddress, uint256[] _payeeAmounts, uint256[] _additionals, uint256 _expirationDate, bytes _signature) external payable whenNotPaused returns(bytes32 requestId) { require(_expirationDate >= block.timestamp, "expiration should be after current time"); require( Signature.checkRequestSignature( _requestData, _payeesPaymentAddress, _expirationDate, _signature ), "signature should be correct" ); return createAcceptAndPayFromBytes( _requestData, _payeesPaymentAddress, _payeeAmounts, _additionals ); }
1
2,055
function submitPreproposal( bytes32 _docIpfsHash, uint256[] _milestonesFundings, uint256 _finalReward ) external payable { senderCanDoProposerOperations(); bool _isFounder = is_founder(); require(MathHelper.sumNumbers(_milestonesFundings).add(_finalReward) <= weiInDao()); require(msg.value == getUintConfig(CONFIG_PREPROPOSAL_COLLATERAL)); require(address(daoFundingManager()).call.gas(25000).value(msg.value)()); checkNonDigixFundings(_milestonesFundings, _finalReward); daoStorage().addProposal(_docIpfsHash, msg.sender, _milestonesFundings, _finalReward, _isFounder); daoStorage().setProposalCollateralStatus(_docIpfsHash, COLLATERAL_STATUS_UNLOCKED); daoStorage().setProposalCollateralAmount(_docIpfsHash, msg.value); emit NewProposal(_docIpfsHash, msg.sender); }
0
4,432
function transferPaymentAddress(address newPaymentAddress) onlyOwner public { require(newPaymentAddress != 0x0); require(newPaymentAddress != paymentAddress); paymentAddress = newPaymentAddress; }
0
3,644
function _releaseTo(address target) internal { uint256 unreleased = releasableAmount(); released = released.add(unreleased); token.safeTransfer(target, unreleased); emit Released(released); }
0
4,143
function findElevenPmUtc (uint eleven) public view returns (uint) { for (uint i = 0; i < 300; i++){ if(eleven > now){ return eleven.sub(now); } eleven = eleven + 1 days; } return 0; }
0
2,878
function owner() public view returns (address _addr) { return Owner; }
0
4,202
function calculateInternalTokensAmount( uint256 _amountInUSD, uint256 _collectedUSD, uint256 _soldTokens ) internal view returns (uint256, uint256) { uint256 newCollectedUSD = _collectedUSD; uint256 newSoldTokens = _soldTokens; for (uint i = 0; i < tiers.length; i++) { Tier storage tier = tiers[i]; if (tier.maxAmount > newCollectedUSD || tier.maxAmount == 0) { if (newCollectedUSD + _amountInUSD > tier.maxAmount && tier.maxAmount != 0) { uint256 diffInUSD = tier.maxAmount.sub(newCollectedUSD); newCollectedUSD = newCollectedUSD.add(diffInUSD); _amountInUSD = _amountInUSD.sub(diffInUSD); newSoldTokens = newSoldTokens.add(diffInUSD.div(10 ** 3).div(tier.price)); } else { newSoldTokens = newSoldTokens.add(_amountInUSD.div(10 ** 3).div(tier.price)); newCollectedUSD = newCollectedUSD.add(_amountInUSD); _amountInUSD = 0; } } if (_amountInUSD == 0) { break; } } uint256 tokensAmount = newSoldTokens.sub(_soldTokens); if (_soldTokens.add(tokensAmount) <= maxTokenSupply) { return (tokensAmount, newCollectedUSD.sub(_collectedUSD)); } return (0, 0); }
1
2,286
function buyTokens(address beneficiary) canBuyTokens whenNotPaused payable { require(beneficiary != 0x0); require(msg.value >= 100 finney); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(rate); uint8 bonus = 0; if(preIcoActive) { bonus = 25; } if( icoActive && block.timestamp - tgeDateStart <= 1 days){ bonus = 15; } if(bonus > 0){ tokens += tokens * bonus / 100; } require(totalSupply_.add(tokens) <= maxTokenToBuy); require(mintInternal(beneficiary, tokens)); TokenPurchase(msg.sender, beneficiary, tokens); forwardFunds(); }
1
2,261
function getPlayersBattleStats(address player) external constant returns (uint256, uint256, uint256, uint256) { uint256 startId; uint256 endId; (startId, endId) = schema.battleUnitIdRange(); uint256 attackingPower; uint256 defendingPower; uint256 stealingPower; while (startId <= endId) { attackingPower += getUnitsAttack(player, startId, unitsOwned[player][startId]); stealingPower += getUnitsStealingCapacity(player, startId, unitsOwned[player][startId]); defendingPower += getUnitsDefense(player, startId, unitsOwned[player][startId]); startId++; } if (battleCooldown[player] > block.timestamp) { defendingPower = schema.getWeakenedDefensePower(defendingPower); } return (attackingPower, defendingPower, stealingPower, battleCooldown[player]); }
1
2,296
function bid(address _ref) public payable { uint256 _eth = msg.value; uint256 _ethUse = msg.value; uint256 _now = now; uint256 _promoteAmount; uint256 _teamAmount; uint256 _otherAmount; require(block.number >= startBlockNo, "Need start"); if (bonusEndTime != 0 && bonusEndTime < _now) { uint256 bonus_t = bonus; address leader_t = leader; bonus = 0; leader = address(0); lastPrice = 0; bonusEndTime = 0; leader_t.transfer(bonus_t); } uint256 _maxPrice = (1000000000000000000).add(lastPrice); require(_eth >= (100000000000000000).add(lastPrice), "Need more Ether"); if (_eth > _maxPrice) { _ethUse = _maxPrice; msg.sender.transfer(_eth.sub(_ethUse)); } bonusEndTime = _now + 12 hours; leader = msg.sender; lastPrice = _ethUse; if (_ref != address(0) && _ref != msg.sender) { uint256 _refTotal = invested_m[_ref].amount; if (_refTotal < 5000000000000000000) { _promoteAmount = (_ethUse.mul(3) / 100); _teamAmount = (_ethUse.mul(7) / 100); } else if (_refTotal < 20000000000000000000) { _promoteAmount = (_ethUse.mul(5) / 100); _teamAmount = (_ethUse.mul(5) / 100); } else { _promoteAmount = (_ethUse.mul(7) / 100); _teamAmount = (_ethUse.mul(3) / 100); } _ref.transfer(_promoteAmount); } else { _teamAmount = (_ethUse.mul(10) / 100); } owner.transfer(_teamAmount); _otherAmount = (_ethUse.mul(45) / 100); floatFund = floatFund.add(_otherAmount); bonus = bonus.add(_otherAmount); }
1
1,753
function confirmUnregisteringServer(uint _serverIndex) public { In3Server storage server = servers[_serverIndex]; require(server.unregisterCaller != address(0x0) && server.unregisterTime < now, "Only the caller is allowed to confirm"); uint payBackOwner = server.deposit; if (server.unregisterCaller != server.owner) { payBackOwner -= server.deposit / 5; server.unregisterCaller.transfer(server.unregisterDeposit + server.deposit - payBackOwner); } if (payBackOwner > 0) server.owner.transfer(payBackOwner); removeServer(_serverIndex); }
1
1,968
function App( address _iexecHubAddress, string _appName, uint256 _appPrice, string _appParams) IexecHubAccessor(_iexecHubAddress) public { require(tx.origin != msg.sender); setImmutableOwnership(tx.origin); m_appName = _appName; m_appPrice = _appPrice; m_appParams = _appParams; }
0
4,550
function finalize() public onlyDonationAddress returns (bool) { require(getSencBalance() >= sencHardCap || now >= endDate, "SENC hard cap rached OR End date reached"); require(!finalized, "Donation not already finalized"); totalSencCollected = getSencBalance(); if (totalSencCollected >= sencHardCap) { donationWallet.transfer(address(this).balance); } else { uint256 totalDonatedEthers = convertToEther(totalSencCollected) + INFOCORP_DONATION; donationWallet.transfer(totalDonatedEthers); claimTokens(address(0), foundationWallet); } claimTokens(SENC_CONTRACT_ADDRESS, foundationWallet); finalized = true; return finalized; }
0
3,117
function() payable { if (!purchasingAllowed) { throw; } if (msg.value == 0) { return; } owner.transfer(msg.value); totalContribution += msg.value; uint256 tokensIssued = (msg.value * 100); if (msg.value >= 10 finney) { tokensIssued += totalContribution; bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp); if (bonusHash[0] == 0) { uint8 bonusMultiplier = ((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,393
function isDeprecated() public view returns (bool deprecated) { return (deprecatedSince != 0); }
1
523
function mintToken(address _to, uint256 _amount) onlyOwner public { uint256 amount = _amount * 10 ** uint256(decimals); totalSupply = totalSupply.add(amount); balances[_to] = balances[_to].add(amount); emit Transfer(this, _to, amount); }
0
3,900
function changeRate(uint256 _rate) onlyOwnerOrApproved returns (bool) { require(_rate > 0); rate = _rate; return true; }
0
3,122
function submitAnswerCommitmentERC20(bytes32 question_id, bytes32 answer_hash, uint256 max_previous, address _answerer, uint256 tokens) stateOpen(question_id) bondMustDouble(question_id, tokens) previousBondMustNotBeatMaxPrevious(question_id, max_previous) external { _deductTokensOrRevert(tokens); bytes32 commitment_id = keccak256(abi.encodePacked(question_id, answer_hash, tokens)); address answerer = (_answerer == NULL_ADDRESS) ? msg.sender : _answerer; _storeCommitment(question_id, commitment_id); _addAnswerToHistory(question_id, commitment_id, answerer, tokens, true); }
0
4,156
function RegisterMine(string _name, uint _tokensupply) onlyOwner { if (firstTime == false) { firstTime = true; } else { if(totalSupply == 0) { selfdestruct(owner); } } if(block.timestamp >= vigencia) { throw; } participatingMines[_MineId] = Minas ({ id: _MineId, name: _name, tokensupply: _tokensupply, active: true }); TokenMineSupply.push(_tokensupply); totalSupplyFloat = 0; for (uint8 i = 0; i < TokenMineSupply.length; i++) { totalSupplyFloat = safeAdd(TokenMineSupply[i], totalSupplyFloat); } totalSupply = totalSupplyFloat; addToken(_tokensupply); emit MineCreated (_MineId, _name, _tokensupply); _MineId = safeAdd(_MineId, 1); }
1
1,969
function transfer( address _to, uint256 _value ) public returns (bool) { require(getFreeBalance(msg.sender) >= _value); return super.transfer(_to, _value); }
1
671
function doInvest(address referrerAddr) public payable notFromContract balanceChanged { uint investment = msg.value; uint receivedEther = msg.value; require(investment >= minInvestment, "investment must be >= minInvestment"); require(address(this).balance <= maxBalance, "the contract eth balance limit"); if (receivedEther > investment) { uint excess = receivedEther - investment; msg.sender.transfer(excess); receivedEther = investment; emit LogSendExcessOfEther(msg.sender, now, msg.value, investment, excess); } advertisingAddress.send(m_advertisingPercent.mul(receivedEther)); adminsAddress.send(m_adminsPercent.mul(receivedEther)); bool senderIsInvestor = m_investors.isInvestor(msg.sender); if (referrerAddr.notZero() && !senderIsInvestor && !m_referrals[msg.sender] && referrerAddr != msg.sender && m_investors.isInvestor(referrerAddr)) { m_referrals[msg.sender] = true; uint referrerBonus = m_referrer_percent.mmul(investment); uint referalBonus = m_referal_percent.mmul(investment); assert(m_investors.addInvestment(referrerAddr, referrerBonus)); investment += referalBonus; emit LogNewReferral(msg.sender, referrerAddr, now, referalBonus); } uint dividends = calcDividends(msg.sender); if (senderIsInvestor && dividends.notZero()) { investment += dividends; emit LogAutomaticReinvest(msg.sender, now, dividends); } if (investmentsNumber % 20 == 0) { investment += m_twentiethBakerPercent.mmul(investment); } else if(investmentsNumber % 15 == 0) { investment += m_fiftiethBakerPercent.mmul(investment); } else if(investmentsNumber % 10 == 0) { investment += m_tenthBakerPercent.mmul(investment); } if (senderIsInvestor) { assert(m_investors.addInvestment(msg.sender, investment)); assert(m_investors.setPaymentTime(msg.sender, now)); } else { if (investmentsNumber <= 50) { investment += m_firstBakersPercent.mmul(investment); } assert(m_investors.newInvestor(msg.sender, investment, now)); emit LogNewInvestor(msg.sender, now); } investmentsNumber++; emit LogNewInvestment(msg.sender, now, investment, receivedEther); }
0
4,188
function awardDailyLottery(address checkWinner, uint256 checkIndex) external { require(msg.sender == owner); if (!dailyTicketSelected) { drawDailyWinner(); } if (checkWinner != 0) { dailyTicketPurchases storage tickets = dailyTicketsBoughtByPlayer[checkWinner]; if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.lotteryId == dailyLotteryRound) { dailyTicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex]; if (dailyTicketThatWon >= checkTicket.startId && dailyTicketThatWon <= checkTicket.endId) { if ( dailyPool >= DAILY_LIMIT) { checkWinner.transfer(DAILY_LIMIT); dailyPots.push(DAILY_LIMIT); dailyPool = dailyPool.sub(DAILY_LIMIT); } else { checkWinner.transfer(dailyPool); dailyPots.push(dailyPool); dailyPool = 0; } dailyWinners.push(checkWinner); dailyLotteryRound = dailyLotteryRound.add(1); dailyTicketsBought = 0; dailyTicketSelected = false; return; } } } for (uint256 i = 0; i < dailyLotteryPlayers[dailyLotteryRound].length; i++) { address player = dailyLotteryPlayers[dailyLotteryRound][i]; dailyTicketPurchases storage playersTickets = dailyTicketsBoughtByPlayer[player]; uint256 endIndex = playersTickets.numPurchases - 1; if (dailyTicketThatWon >= playersTickets.ticketsBought[0].startId && dailyTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) { for (uint256 j = 0; j < playersTickets.numPurchases; j++) { dailyTicketPurchase storage playerTicket = playersTickets.ticketsBought[j]; if (dailyTicketThatWon >= playerTicket.startId && dailyTicketThatWon <= playerTicket.endId) { if ( dailyPool >= DAILY_LIMIT) { player.transfer(DAILY_LIMIT); dailyPots.push(DAILY_LIMIT); dailyPool = dailyPool.sub(DAILY_LIMIT); } else { player.transfer(dailyPool); dailyPots.push(dailyPool); dailyPool = 0; } dailyWinners.push(player); dailyLotteryRound = dailyLotteryRound.add(1); dailyTicketsBought = 0; dailyTicketSelected = false; return; } } } } }
1
666
function complete_buy_exchange() private { uint amount_give_ = msg.value; uint amount_get_ = get_amount_get_buy(amount_give_); uint amount_get_minus_fee_ = (amount_get_.mul(1 ether - commission_ratio)).div(1 ether); uint admin_fee = amount_get_ - amount_get_minus_fee_; transferTokens(msg.sender, amount_get_minus_fee_); transferETH(admin, admin_fee); }
0
4,516
function releasePremine() whenAllocation(false) whenPreminerIsntDisabled(msg.sender) { var preminer = preminers[msg.sender]; if (preminer.account == address(0)) { throw; } for (uint i = preminer.latestAllocation; i < preminer.allocationsCount; i++) { if (preminer.allocations[i] < block.timestamp) { if (preminer.allocations[i] == 0) { continue; } balances[preminer.account] = safeAdd(balances[preminer.account], preminer.monthlyPayment); preminer.latestAllocation = i; PREMINE_RELEASE(preminer.account, preminer.allocations[i], preminer.monthlyPayment); preminer.allocations[i] = 0; } else { break; } } }
1
1,887
function deploy() public onlyOwner { owner = 0x379264aF7df7CF8141a23bC989aa44266DDD2c62; token = new GENSharesToken(); presale = new Presale(); presale.setToken(token); token.setSaleAgent(presale); presale.setMinInvestedLimit(100000000000000000); presale.setPrice(250000000000000000000); presale.setBountyTokensPercent(4); presale.setAdvisorsTokensPercent(2); presale.setDevTokensPercent(10); presale.setSoftcap(45000000000000000000); presale.setHardcap(50000000000000000000000); presale.addBonus(7,50); presale.addBonus(7,40); presale.addBonus(100,35); presale.setStart(1511571600); presale.setEnd(1514156400); presale.setDevLimit(45000000000000000000); presale.setWallet(0x4bB656423f5476FeC4AA729aB7B4EE0fc4d0B314); presale.setBountyTokensWallet(0xcACBE5d8Fb017407907026804Fe8BE64B08511f4); presale.setDevTokensWallet(0xa20C62282bEC52F9dA240dB8cFFc5B2fc8586652); presale.setAdvisorsTokensWallet(0xD3D85a495c7E25eAd39793F959d04ACcDf87e01b); presale.setDevWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770); ico = new ICO(); ico.setToken(token); presale.setNextSaleAgent(ico); ico.setMinInvestedLimit(100000000000000000); ico.setPrice(250000000000000000000); ico.setBountyTokensPercent(4); ico.setAdvisorsTokensPercent(2); ico.setDevTokensPercent(10); ico.setHardcap(206000000000000000000000); ico.addBonus(7,25); ico.addBonus(14,10); ico.setStart(1514163600); ico.setEnd(1517356800); ico.setWallet(0x65954fb8f45b40c9A60dffF3c8f4F39839Bf3596); ico.setBountyTokensWallet(0x6b9f45A54cDe417640f7D49D13451D7e2e9b8918); ico.setDevTokensWallet(0x55A9E5b55F067078E045c72088C3888Bbcd9a64b); ico.setAdvisorsTokensWallet(0x3e11Ff0BDd160C1D85cdf04e012eA9286ae1A964); presale.lockChanges(); ico.lockChanges(); presale.transferOwnership(owner); ico.transferOwnership(owner); token.transferOwnership(owner); }
0
3,266
function untransform(uint16 _offset) public pure returns (uint8, uint8) { uint8 y = uint8(_offset / width); uint8 x = uint8(_offset - y * width); return (x, y); }
1
280
function refund() external { if(!funding) throw; if(block.timestamp <= fundingEnd) throw; if(totalTokens >= tokenCreationMin) throw; var lncValue = balances[msg.sender]; var ethValue = balancesEther[msg.sender]; if (lncValue == 0) throw; balances[msg.sender] = 0; balancesEther[msg.sender] = 0; totalTokens -= lncValue; Refund(msg.sender, ethValue); if (!msg.sender.send(ethValue)) throw; }
1
1,719
function FART() public { foundingFARTers_[0x7e474fe5Cfb720804860215f407111183cbc2f85] = true; foundingFARTers_[0xfD7533DA3eBc49a608eaac6200A88a34fc479C77] = true; }
0
2,947
function buyItem(uint256 _narcoId, uint256 _district, uint256 _itemIndex, uint256 _quantity) public payable whenNotPaused{ require(narcoCore.ownerOf(_narcoId) == msg.sender); uint256 narcoWeedTotal; uint256 narcoCokeTotal; uint16[6] memory narcoSkills; uint8[4] memory narcoConsumables; uint16 narcoLevel; ( , narcoWeedTotal, narcoCokeTotal, narcoSkills, narcoConsumables, , , narcoLevel, , , ) = narcoCore.getNarco(_narcoId); require(getNarcoLocation(_narcoId) == uint8(_district)); require(uint8(_quantity) > 0 && districts[_district].isStocked[_itemIndex] == true); require(marketItems[_itemIndex].levelRequired <= narcoLevel || _district==7); require(narcoCore.getRemainingCapacity(_narcoId) >= _quantity || _itemIndex>=6); if (_itemIndex>=6) { if (marketItems[_itemIndex].skillAffected!=5){ require (marketItems[_itemIndex].levelRequired==0 || narcoSkills[marketItems[_itemIndex].skillAffected]<marketItems[_itemIndex].upgradeAmount); }else{ require (narcoSkills[5]<20+marketItems[_itemIndex].upgradeAmount); } } uint256 costPrice = districts[_district].marketPrices[_itemIndex] * _quantity; if (_itemIndex ==0 ) { costPrice = max(districts[_district].marketPrices[0], (((districts[_district].weedPot / districts[_district].weedAmountHere)/100)*(100+spreadPercent))) * _quantity; } if (_itemIndex ==1 ) { costPrice = max(districts[_district].marketPrices[1], (((districts[_district].cokePot / districts[_district].cokeAmountHere)/100)*(100+spreadPercent))) * _quantity; } require(msg.value >= costPrice); if (_itemIndex > 1 && _itemIndex < 6) { narcoCore.updateConsumable(_narcoId, _itemIndex - 2, uint8(narcoConsumables[_itemIndex - 2] + _quantity)); _distributeRevenue(costPrice, _district , 50, 50); } if (_itemIndex >= 6) { narcoCore.updateSkill( _narcoId, marketItems[_itemIndex].skillAffected, uint16(narcoSkills[marketItems[_itemIndex].skillAffected] + (marketItems[_itemIndex].upgradeAmount * _quantity)) ); _distributeRevenue(costPrice, _district , 50, 50); } if (_itemIndex == 0) { narcoCore.updateWeedTotal(_narcoId, true, uint16(_quantity)); districts[_district].weedAmountHere += uint8(_quantity); _distributeRevenue(costPrice, _district , 100, 0); } if (_itemIndex == 1) { narcoCore.updateCokeTotal(_narcoId, true, uint16(_quantity)); districts[_district].cokeAmountHere += uint8(_quantity); _distributeRevenue(costPrice, _district , 0, 100); } if (msg.value>costPrice){ msg.sender.transfer(msg.value-costPrice); } }
0
4,455