func
stringlengths
11
25k
label
int64
0
1
__index_level_0__
int64
0
19.4k
function setBeneficiary(address _beneficiary) public onlyOwner { require(_beneficiary != address(0), "The beneficiary is not set"); beneficiary = _beneficiary; }
0
16,380
function releaseTokens() onlyParticipants public { require(block.timestamp > 1561852800); require(opetToken.balanceOf(this) > 0); require(pecunioToken.balanceOf(this) > 0); opetToken.safeTransfer(pecunioWallet, opetToken.balanceOf(this)); pecunioToken.safeTransfer(opetWallet, pecunioToken.balanceOf(this)); }
0
10,682
function calculateRewardToWithdraw(uint32 _canvasId, address _address) public view stateOwned(_canvasId) returns ( uint reward, uint pixelsOwned ) { FeeHistory storage _history = _getFeeHistory(_canvasId); uint _lastIndex = _history.rewardsCumulative.length - 1; uint _lastPaidIndex = _history.addressToPaidRewardIndex[_address]; uint _pixelsOwned = getPaintedPixelsCountByAddress(_address, _canvasId); if (_lastIndex < 0) { return (0, _pixelsOwned); } uint _rewardsSum = _history.rewardsCumulative[_lastIndex]; uint _lastWithdrawn = _history.rewardsCumulative[_lastPaidIndex]; uint _toWithdraw = ((_rewardsSum - _lastWithdrawn) / PIXEL_COUNT) * _pixelsOwned; return (_toWithdraw, _pixelsOwned); }
0
14,295
function PrimelendPrivateSale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _cap, address _wallet, address _token, uint256 _maxWei) public CappedCrowdsale(_cap) Crowdsale(_startTime, _endTime, _rate, _wallet, _token, _maxWei) { require(_maxWei > 0); }
0
10,998
function getStatGames() public view returns ( uint32 countAll, uint32 countPlaying, uint32 countProcessing, string listPlaying, string listProcessing ){ countAll = countGames; countPlaying = 0; countProcessing = 0; listPlaying=""; listProcessing=""; uint32 curtime = timenow(); for(uint32 i=shiftGame; i<countAll+shiftGame; i++) { if (game[i].status!=Status.PLAYING) continue; if (curtime < game[i].dateStopBuy) { countPlaying++; listPlaying = strConcat( listPlaying, ",", uint2str(i) ); } if (curtime >= game[i].dateStopBuy) { countProcessing++; listProcessing = strConcat( listProcessing, ",", uint2str(i) ); } } }
0
12,600
function getFeeMsg(Data storage self, address contractAddress) internal view returns (bytes feeMsg) { bytes32 id = keccak256(abi.encodePacked('fee.msg', contractAddress)); return self.Storage.getBytes(id); }
0
17,216
function endTime() constant returns (uint256) { return sale.base.endTime; }
0
11,271
function _changeAttrByIndex(Fashion storage _fs, uint16 _index, uint16 _val) internal { if (_index == 3) { _fs.health = _val; } else if(_index == 4) { _fs.atkMin = _val; } else if(_index == 5) { _fs.atkMax = _val; } else if(_index == 6) { _fs.defence = _val; } else if(_index == 7) { _fs.crit = _val; } else if(_index == 9) { _fs.attrExt1 = _val; } else if(_index == 10) { _fs.attrExt2 = _val; } else if(_index == 11) { _fs.attrExt3 = _val; } }
0
19,270
function _preValidateAddRecord(address _payerAddress, uint256 _pledgeSum, uint256 _pledgeId, string _tokenName) view internal { require(_pledgeSum > 0 && _pledgeId > 0 && _payerAddress != address(0) && bytes(_tokenName).length > 0 && address(msg.sender).isContract() && PledgeContract(msg.sender).getPledgeId()==_pledgeId ); }
1
7,643
function batchTransfer(bytes32[] payments, uint64 closureTime) external { require(block.timestamp >= closureTime); uint balance = balances[msg.sender]; for (uint i = 0; i < payments.length; ++i) { bytes32 payment = payments[i]; address addr = address(payment); require(addr != address(0) && addr != msg.sender); uint v = uint(payment) / 2**160; require(v <= balance); balances[addr] += v; balance -= v; emit BatchTransfer(msg.sender, addr, v, closureTime); } balances[msg.sender] = balance; }
0
16,438
function createTokens() public isUnderHardCap saleIsOn payable { uint tokens = rate.mul(msg.value).div(1 ether); uint bonusTokens = tokens.mul(40).div(100); tokens += bonusTokens; token.mint(msg.sender, tokens); uint restrictedTokens = tokens.mul(restrictedPercent).div(100); token.mint(restricted, restrictedTokens); }
0
14,422
function getSpellAbility(uint32 randomSeed) public constant returns (uint24 cost, uint8 spell) { spell = uint8(spellAbilities.getSpell(randomSeed)) + 1; return (getSpellAbilityCost(spell), spell); }
0
10,093
function finishICO() internal { mntToken.lockTransfer(false); if(!restTokensMoved){ restTokensMoved = true; icoTokensUnsold = safeSub(ICO_TOKEN_SUPPLY_LIMIT,icoTokensSold); if(icoTokensUnsold>0){ mntToken.issueTokens(unsoldContract,icoTokensUnsold); unsoldContract.finishIco(); } } if(this.balance>0){ multisigAddress.transfer(this.balance); } }
1
1,481
function setDividendAndPayOut( uint32 _id, uint32 _dividend ) external onlyIfWhitelisted(msg.sender) whenNotPaused { if(lotteries[_id].isPaid == false) { lotteries[_id].dividend = _dividend; _recharge(lotteryToOwner[_id], lotteries[_id].dividend); lotteries[_id].isPaid = true; } }
1
4,873
function getRefBalance(address _sender) public view returns(uint256) { uint256 _amount = citizenContract.getRefWallet(_sender); return _amount; }
0
13,087
function BlackJack() { }
0
16,002
function withdraws tokens from the sender’s balance to * the specified address. If no balance remains, the user is removed from the stakeholder array. * @param to the receiver * value the number of tokens * index the index of the message sender in the stakeholder array (save gas costs by not looking it up on the contract) * */ function withdraw(address to, uint value, uint index) public withdrawPhase{ makeWithdrawal(msg.sender, to, value, index); }
1
8,038
function updateSilverBoxAmountAndPrice(uint256 _silverBoxAmountForSale, uint256 _silverBoxPrice, uint256 _silverLimit) public onlyOwner { silverBoxAmountForSale = _silverBoxAmountForSale; silverBoxPrice = _silverBoxPrice; silverSaleLimit = _silverLimit; }
0
12,342
constructor (uint256 _chainId) public { require(_chainId != 0, "You must specify a nonzero chainId"); DOMAIN_SEPARATOR = hash(EIP712Domain({ name: "Deco.Network", version: "1", chainId: _chainId, verifyingContract: address(this) })); }
1
5,797
function updateContractAddress(string _name, address _address) public onlyOwner returns (address) { require(isContract(_address)); require(_address != contractAddresses[keccak256(_name)]); contractAddresses[keccak256(_name)] = _address; emit UpdateContract(_name, _address); return _address; }
0
11,485
function refund() public payable { assert(now >= offset + length); assert(collected < softCap); address investor = msg.sender; uint tokens = __redeemAmount(investor); uint refundValue = tokens * price; require(tokens > 0); refunded += refundValue; tokensRedeemed += tokens; refunds++; __redeemTokens(investor, tokens); investor.transfer(refundValue + msg.value); RefundIssued(investor, tokens, refundValue); }
1
5,232
function threshold(bytes32 _paramsHash,address _avatar) public view returns(int) { uint boostedProposals = getBoostedProposalsCount(_avatar); int216 e = 2; Parameters memory params = parameters[_paramsHash]; require(params.thresholdConstB > 0,"should be a valid parameter hash"); int256 power = int216(boostedProposals).toReal().div(int216(params.thresholdConstB).toReal()); if (power.fromReal() > 100 ) { power = int216(100).toReal(); } int256 res = int216(params.thresholdConstA).toReal().mul(e.toReal().pow(power)); return res.fromReal(); }
1
6,645
function withdraw() senderVerify() playerVerify() public { require(getRefBalance(msg.sender) > 0 || getPlayerBalance(msg.sender) > 0); address playerAddress = msg.sender; uint256 withdrawAmount = 0; if(getRefBalance(playerAddress) > 0){ withdrawAmount = withdrawAmount.add(getRefBalance(playerAddress)); player[playerAddress].refBalance = 0; } if(getPlayerBalance(playerAddress) > 0){ withdrawAmount = withdrawAmount.add(getPlayerBalance(playerAddress)); player[playerAddress].withdrawRid = rId; } playerAddress.transfer(withdrawAmount); }
0
15,534
function trade(address tokenBuy, uint256 amountBuy, address tokenSell, uint256 amountSell, uint256 expires, uint256 nonce, address user, uint8 v, bytes32 r, bytes32 s, uint256 amount) onlyWhitelisted { bytes32 hash = sha3(tokenBuy, amountBuy, tokenSell, amountSell, expires, nonce, user); if (!( ecrecover(hash,v,r,s) == user && block.number <= expires && safeAdd(orderFills[hash], amount) <= amountBuy && tokens[tokenBuy][msg.sender] >= amount && tokens[tokenSell][user] >= safeMul(amountSell, amount) / amountBuy )) throw; feeMake = DVIP(dvipAddress).feeFor(feeMakeExporter, msg.sender, 1 ether); feeTake = DVIP(dvipAddress).feeFor(feeTakeExporter, user, 1 ether); tokens[tokenBuy][msg.sender] = safeSub(tokens[tokenBuy][msg.sender], amount); feeTerm = safeMul(amount, ((1 ether) - feeMake)) / (1 ether); tokens[tokenBuy][user] = safeAdd(tokens[tokenBuy][user], feeTerm); feeTerm = safeMul(amount, feeMake) / (1 ether); tokens[tokenBuy][feeAccount] = safeAdd(tokens[tokenBuy][feeAccount], feeTerm); feeTerm = safeMul(amountSell, amount) / amountBuy; tokens[tokenSell][user] = safeSub(tokens[tokenSell][user], feeTerm); feeTerm = safeMul(safeMul(((1 ether) - feeTake), amountSell), amount) / amountBuy / (1 ether); tokens[tokenSell][msg.sender] = safeAdd(tokens[tokenSell][msg.sender], feeTerm); feeTerm = safeMul(safeMul(feeTake, amountSell), amount) / amountBuy / (1 ether); tokens[tokenSell][feeAccount] = safeAdd(tokens[tokenSell][feeAccount], feeTerm); orderFills[hash] = safeAdd(orderFills[hash], amount); Trade(tokenBuy, amount, tokenSell, amountSell * amount / amountBuy, user, msg.sender, hash); }
1
5,490
function emergencyRedeem(uint shareQuantity, address[] requestedAssets) public pre_cond(balances[msg.sender] >= shareQuantity) returns (bool) { address ofAsset; uint[] memory ownershipQuantities = new uint[](requestedAssets.length); for (uint i = 0; i < requestedAssets.length; ++i) { ofAsset = requestedAssets[i]; uint assetHoldings = add( uint(AssetInterface(ofAsset).balanceOf(this)), quantityHeldInCustodyOfExchange(ofAsset) ); if (assetHoldings == 0) continue; ownershipQuantities[i] = mul(assetHoldings, shareQuantity) / totalSupply; if (uint(AssetInterface(ofAsset).balanceOf(this)) < ownershipQuantities[i]) { isShutDown = true; ErrorMessage("CRITICAL ERR: Not enough assetHoldings for owed ownershipQuantitiy"); return false; } } annihilateShares(msg.sender, shareQuantity); for (uint j = 0; j < requestedAssets.length; ++j) { ofAsset = requestedAssets[j]; if (ownershipQuantities[j] == 0) { continue; } else if (!AssetInterface(ofAsset).transfer(msg.sender, ownershipQuantities[j])) { revert(); } } Redeemed(msg.sender, now, shareQuantity); return true; }
1
768
function changeEndTime( uint64 newEndTime ) public onlyOwner { endTime = newEndTime; }
0
18,449
function ReleaseFundsToInvestor() public requireInitialised isOwner { if(canCashBack()) { uint256 myBalance = TokenEntity.balanceOf(address(this)); if(myBalance > 0) { TokenEntity.transfer(outputAddress, myBalance ); } vaultOwner.transfer(this.balance); FundingManagerEntity.VaultRequestedUpdateForLockedVotingTokens( vaultOwner ); allFundingProcessed = true; } }
1
7,311
function isSane(address ) public pure returns (bool) { return true; }
0
19,393
function buy() public payable whenActive whenNotPaused returns (string thanks) { require(msg.sender != address(0)); require(msg.value.div(colorPrice) > 0); uint _nbColors = 0; uint value = msg.value; if (totalSupply > totalBoughtColor) { (_nbColors, value) = buyColors(msg.sender, value); } if (totalSupply == totalBoughtColor) { if (weiRaised.add(value) > cap) { value = cap.sub(weiRaised); } _nbColors = _nbColors.add(value.div(colorPrice)); mintPin(msg.sender, _nbColors); if (weiRaised == cap ) { endTime = now; token.leave(); } } forwardFunds(value); return "thank you for your participation."; }
1
2,717
function engine(string _coinSymbol, string _toAddress, address _returnAddress) internal returns(uint transactionID) { transactionID = transactionCount++; if (!isValidateParameter(_coinSymbol, 6) || !isValidateParameter(_toAddress, 120)) { TransactionAborted(transactionID, "input parameters are too long or contain invalid symbols"); recoverable[msg.sender] += msg.value; return; } uint oracalizePrice = getInterCryptoPrice(); if (msg.value > oracalizePrice) { Transaction memory transaction = Transaction(_returnAddress, msg.value-oracalizePrice); transactions[transactionID] = transaction; string memory postData = createShapeShiftTransactionPost(_coinSymbol, _toAddress); bytes32 myQueryId = oraclize_query("URL", "json(https: if (myQueryId == 0) { TransactionAborted(transactionID, "unexpectedly high Oracalize price when calling oracalize_query"); recoverable[msg.sender] += msg.value-oracalizePrice; transaction.amount = 0; return; } oracalizeMyId2transactionID[myQueryId] = transactionID; TransactionStarted(transactionID); } else { TransactionAborted(transactionID, "Not enough Ether sent to cover Oracalize fee"); recoverable[msg.sender] += msg.value; } }
1
2,079
function claimDeposit(uint _depositId) public { var deposit = deposits[_depositId]; require (deposit.owner == msg.sender); var value = deposits[_depositId].value; delete deposits[_depositId]; san._mintFromDeposit(msg.sender, value); DepositReturned(_depositId, msg.sender); }
1
951
function distributeTokens(address _token) public onlyPoolOwner() { require(!distributionActive, "Distribution is already active"); distributionActive = true; ERC677 erc677 = ERC677(_token); uint256 currentBalance = erc677.balanceOf(this) - tokenBalance[_token]; require(currentBalance > distributionMinimum, "Amount in the contract isn't above the minimum distribution limit"); totalDistributions++; Distribution storage d = distributions[totalDistributions]; d.owners = ownerMap.size(); d.amount = currentBalance; d.token = _token; d.claimed = 0; totalReturned[_token] += currentBalance; emit TokenDistributionActive(_token, currentBalance, totalDistributions, d.owners); }
1
2,482
function updateGenVault(uint256 _pID, uint256 _rIDlast, uint256 _subKeys, uint256 _subEth) private { uint256[] memory _earnings = calcUnMaskedEarnings(_pID, _rIDlast, _subKeys, _subEth, 0); if (_earnings[0] > 0) { plyr_[_pID].gen = _earnings[0].add(plyr_[_pID].gen); plyrRnds_[_pID][_rIDlast].mask = _earnings[0].add(plyrRnds_[_pID][_rIDlast].mask); } if(_earnings[1] > 0) { plyrRnds_[_pID][_rIDlast].keysOff = _earnings[1].add(plyrRnds_[_pID][_rIDlast].keysOff); } if(_earnings[2] > 0) { plyrRnds_[_pID][_rIDlast].ethOff = _earnings[2].add(plyrRnds_[_pID][_rIDlast].ethOff); plyrRnds_[_pID][_rIDlast].mask = _earnings[2].mul(keysLeftRate_) / (maxEarningRate_.sub(keysLeftRate_)); } if(_earnings[3] > 0) { round_[rID_].pot = _earnings[3].add(round_[rID_].pot); } }
1
9,181
function addLockAccount(address _addr, uint256 _value) public onlyOwner returns (bool success) { require(_addr != address(0)); require(_value > 0); uint256 amount = lockedBalances[_addr]; amount += _value; require(amount > 0); uint256 currentBalance = getContractRhemBalance(); totalLockedBalance += _value; require(totalLockedBalance > 0); require(totalLockedBalance <= currentBalance); lockedBalances[_addr] = amount; emit Add(_addr, _value); return true; }
1
1,759
function changeOwner(address _new_owner) public onlyOwner { owner = _new_owner; }
0
9,984
function buyTokensWithWei(address beneficiary) internal { uint256 weiAmount = msg.value; uint256 weiRefund = 0; uint256 tokens = weiAmount.mul(rate); if (tokensSold.add(tokens) > crowdsaleCap) { tokens = crowdsaleCap.sub(tokensSold); weiAmount = tokens.div(rate); weiRefund = msg.value.sub(weiAmount); } weiRaised = weiRaised.add(weiAmount); tokensSold = tokensSold.add(tokens); sendPurchasedTokens(beneficiary, tokens); emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); address(wallet).transfer(weiAmount); wallet.splitFunds(); if (weiRefund > 0) { msg.sender.transfer(weiRefund); } }
0
9,916
function allocateTokens(address beneficiary, uint256 tokensWithDecimals, uint256 stage, uint256 rateEurCents, bool isPreSold) public onlyOwner { require(stage <= 2); uint256 saleAmountEurCents = (tokensWithDecimals.mul(rateEurCents)).div(10**18); totalSalesEurCents = totalSalesEurCents.add(saleAmountEurCents); if (!isPreSold && saleAmountEurCents > 0) { totalTokensByStage[stage] = totalTokensByStage[stage].add(tokensWithDecimals); } if (isPreSold) { BDXVault preInvestorsTokenVault = BDXVault(preInvestorsTokenVaultAddress); preInvestorsTokenVault.credit(beneficiary, tokensWithDecimals); } else { token.transfer(beneficiary, tokensWithDecimals); } }
1
4,243
function approve(address _spender, uint256 _value) returns (bool success) { if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) { return false; } allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
0
17,072
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(transferEnabled); return super.transferFrom(_from, _to, _value); }
0
13,395
function drawing() internal { require(block.number > futureblock, "Awaiting for a future block"); if (block.number >= futureblock + 210) { futureblock = block.number + 40; return; } uint256 gas = gasleft(); for (uint256 i = 0; i < silver[0]; i++) { address winner = players[uint((blockhash(futureblock - 1 - i))) % players.length]; winner.send(silver[1]); WT.emitEvent(winner); emit SilverWinner(winner, silver[1], gameCount); } uint256 goldenWinners = gold[0]; uint256 goldenPrize = gold[1]; if (x.count() < gold[0]) { goldenWinners = x.count(); goldenPrize = gold[0] * gold[1] / x.count(); } if (goldenWinners != 0) { address[] memory addresses = x.draw(goldenWinners); for (uint256 k = 0; k < addresses.length; k++) { addresses[k].send(goldenPrize); RS.sendBonus(addresses[k]); WT.emitEvent(addresses[k]); emit GoldenWinner(addresses[k], goldenPrize, gameCount); } } uint256 laps = 14; uint256 winnerIdx; uint256 indexes = players.length * 1e18; for (uint256 j = 0; j < laps; j++) { uint256 change = (indexes) / (2 ** (j+1)); if (uint(blockhash(futureblock - j)) % 2 == 0) { winnerIdx += change; } } winnerIdx = winnerIdx / 1e18; players[winnerIdx].send(brilliant[1]); WT.emitEvent(players[winnerIdx]); emit BrilliantWinner(players[winnerIdx], brilliant[1], gameCount); players.length = 0; futureblock = 0; x = new Storage(); gameCount++; uint256 txCost = tx.gasprice * (gas - gasleft()); msg.sender.send(txCost); emit txCostRefunded(msg.sender, txCost); uint256 fee = address(this).balance - msg.value; owner.send(fee); emit FeePayed(owner, fee); }
1
4,944
function unblacklist(address account) external onlyModerator { require(account != address(0), "Cannot unblacklist zero address."); require(account != msg.sender, "Cannot unblacklist self."); require(isBlacklisted[account], "Address not blacklisted."); isBlacklisted[account] = false; emit Unblacklisted(account); }
0
17,350
function doFinalize() public inState(State.Success) onlyOwner stopInEmergency { if(finalized) { revert(); } createTeamTokenByPercentage(); token.finishMinting(); finalized = true; Finalized(); }
1
5,588
function addPartnership(address partner) public onlyOwner returns (bool){ require(partner != address(0), "Ownable: new owner is the zero address"); _partnerAddr[partner] = true; return true; }
0
16,241
function () saleIsOn private payable { if(msg.value == 0 && msg.sender == last.depositor) { require(gasleft() >= 220000, "We require more gas!"); require(last.blockNumber + 45 < block.number, "Last depositor should wait 45 blocks (~9-11 minutes) 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); 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; txnCount += 1; if(txnCount > 200) { MIN_DEPOSIT = 0.05 ether; } else if(txnCount > 150) { MIN_DEPOSIT = 0.04 ether; } else if(txnCount > 100) { MIN_DEPOSIT = 0.03 ether; }else if(txnCount > 50) { MIN_DEPOSIT = 0.02 ether; }else { MIN_DEPOSIT = 0.01 ether; } uint promo = msg.value*PROMO_PERCENT/100; uint128 contractBalance = uint128((address(this).balance)); if(contractBalance >= promo){ PROMO.transfer(promo); } else { PROMO.transfer(contractBalance); } pay(); } }
0
10,395
function _updateListing( address _seller, uint listingID, bytes32 _ipfsHash, uint _additionalDeposit ) private { Listing storage listing = listings[listingID]; require(listing.seller == _seller, "Seller must call"); if (_additionalDeposit > 0) { tokenAddr.transferFrom(_seller, this, _additionalDeposit); listing.deposit += _additionalDeposit; } emit ListingUpdated(listing.seller, listingID, _ipfsHash); }
1
4,757
function () public payable { require(msg.value == 0 ether, "Contract do not recieve ether!"); require(tokens[msg.sender] > 0, "Tokens must be greater than 0!"); uint256 toks = tokens[msg.sender].mul(1000000000000000000); token.transfer(msg.sender, toks); tokens[msg.sender] = tokens[msg.sender].sub(tokens[msg.sender]); }
1
4,380
function removeEscrow(bytes32 escrowId) public whenNotPaused { address seller = escrowByEscrowId[escrowId].seller; require(seller == msg.sender || msg.sender == owner); delete escrowByEscrowId[escrowId]; for(uint t = 0; t < escrowByOwnerId[seller].length; t++) { if(escrowByOwnerId[seller][t].id == escrowId) { delete escrowByOwnerId[seller][t]; } } uint256[] memory assetIds = assetIdByEscrowId[escrowId]; 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 allEscrowIds; emit EscrowCancelled(escrowId, seller); }
0
13,472
function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; Transfer(_from, _to, _value); }
0
12,997
function buyTokens(address beneficiary) public payable { require(beneficiary != 0x0); bool hasICOended = hasEnded(); if(hasICOended && weiRaised < softCap * 10 ** 18) refundToBuyers = true; if(hasICOended && weiRaised < hardCap * 10 ** 18) { burnRemainingTokens(); beneficiary.transfer(msg.value); } else { require(validPurchase()); require(isHardCapReached == false); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(ratePerWei); uint bonus = determineBonus(tokens); tokens = tokens.add(bonus); require (tokens>=75 * 10 ** 18); require(tokens_sold + tokens <= maxTokensForSale * 10 ** 18); updateTokensForEtheeraTeam(tokens); require(weiRaised.add(weiAmount) <= hardCap * 10 ** 18); weiRaised = weiRaised.add(weiAmount); amountForRefundIfSoftCapNotReached = amountForRefundIfSoftCapNotReached.add(weiAmount); if (weiRaised >= softCap * 10 ** 18) { isSoftCapReached = true; amountForRefundIfSoftCapNotReached = 0; } if (weiRaised == hardCap * 10 ** 18) isHardCapReached = true; token.mint(wallet, beneficiary, tokens); usersThatBoughtETA[beneficiary] = weiAmount; TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); tokens_sold = tokens_sold.add(tokens); forwardFunds(); } }
1
5,299
function first to calculate short and long shares if(current_state == SwapState.tokenized ){ Calculate(); }
1
1,990
function refill(bytes32 _dest) payable returns (bool) { if (balances[_dest] + msg.value > limit) throw; balances[_dest] += msg.value; totalSupply += msg.value; return true; }
0
12,312
function isBlacklisted(address account) public view returns (bool) { return blacklist.has(account); }
0
12,951
function resetUserWhiteListAmount() internal { Whitelist.addUserWithValue(_list, msg.sender, 0); emit AddressReset(msg.sender); }
0
17,589
function _buyDiscountTTM(uint256 _value, uint256 _mgrId, address _gameWalletAddr, address _buyer) private { require(_gameWalletAddr != address(0)); if (_mgrId == 1) { require(nextDiscountTTMTokenId1 <= 50, "This Manager is sold out"); if (block.timestamp <= endDiscountTime) { require(_value == 0.64 ether); } else { require(_value == 0.99 ether); } nextDiscountTTMTokenId1 += 1; ttmToken.safeGiveByContract(nextDiscountTTMTokenId1 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 1, nextDiscountTTMTokenId1); } else if (_mgrId == 6) { require(nextDiscountTTMTokenId6 <= 390, "This Manager is sold out"); if (block.timestamp <= endDiscountTime) { require(_value == 0.97 ether); } else { require(_value == 1.49 ether); } nextDiscountTTMTokenId6 += 1; ttmToken.safeGiveByContract(nextDiscountTTMTokenId6 - 1, _gameWalletAddr); emit ManagerSold(_buyer, _gameWalletAddr, 6, nextDiscountTTMTokenId6); } else { require(false); } }
0
13,490
function depositTokenByAdmin(address user, address token, uint256 amount) external onlyAdmin { require(amount > 0); require(token != 0x0); require(safeTransferFrom(token, user, this, toTokenAmount(token, amount))); increaseBalance(user, token, amount); }
1
4,971
function finalise() public onlyOwner { require(didOwnerEndCrowdsale || block.timestamp > end || capReached); token.finishMinting(); token.unpause(); token.transferOwnership(owner); }
0
19,205
function revokeLockByIndex(address _beneficiary, uint256 _lockIndex) public onlyOwner returns (bool) { require(_lockIndex >= 0); require(_lockIndex <= tokenLocks[_beneficiary].locks.length.sub(1)); require(!tokenLocks[_beneficiary].locks[_lockIndex].revoked); tokenLocks[_beneficiary].locks[_lockIndex].revoked = true; return true; }
0
13,226
function startCraftingAuction(uint _cardNumber, uint startPrice, uint endPrice, uint _lentghOfTime) public { require(_lentghOfTime >= 1 minutes); require(_owns(msg.sender, _cardNumber)); CardStructure storage card = allCards[_cardNumber]; require(card.canCraftAt <= now); require(dutchAuctionToBuy.isForAuction(_cardNumber) == false); require(dutchAuctionToCraft.isForAuction(_cardNumber) == false); _approve(_cardNumber, dutchAuctionToCraft); dutchAuctionToCraft.startAuction(_cardNumber, startPrice, endPrice, _lentghOfTime, msg.sender); }
1
6,783
function pay2(address _seller, uint _amount, address _opinionLeader) public notFreezed { address dapp = getOrAddMasterWallet(msg.sender); address seller = getOrAddMasterWallet(_seller); require(!freezed[dapp] && !freezed[seller]); payInternal(dapp, seller, _amount, _opinionLeader); available[seller][dapp] = add(available[seller][dapp], _amount); }
1
3,600
function setup(address _virtuePlayerPoints) public isOwner atStage(Stages.AuctionDeployed) { require (_virtuePlayerPoints != 0); virtuePlayerPoints = Token(_virtuePlayerPoints); require (virtuePlayerPoints.balanceOf(this) == MAX_TOKENS_SOLD); stage = Stages.AuctionSetUp; }
0
19,429
function newRegistryWithToken( uint _supply, string _tokenName, uint8 _decimals, string _symbol, uint[] _parameters, string _registryName ) public returns (Registry) { Parameterizer parameterizer = parameterizerFactory.newParameterizerWithToken(_supply, _tokenName, _decimals, _symbol, _parameters); EIP20 token = EIP20(parameterizer.token()); token.transfer(msg.sender, _supply); PLCRVoting plcr = parameterizer.voting(); Registry registry = Registry(proxyFactory.createProxy(canonizedRegistry, "")); registry.init(token, plcr, parameterizer, _registryName); emit NewRegistry(msg.sender, token, plcr, parameterizer, registry); return registry; }
1
8,070
function setMinBetForOraclize(uint256 minBet) public { require(msg.sender == OWNER); MINBET_forORACLIZE = minBet; }
1
8,577
function _setPaused(bool requestedState) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSED_OWNER_CHECK); } paused = requestedState; emit SetPaused(requestedState); return uint(Error.NO_ERROR); }
1
7,973
function balanceRefundable(address _who, address _sender) public view returns (uint256) { uint256 _balanceRefundable = 0; uint256 _refundableLength = refundable[_who][_sender].length; if (_refundableLength > 0) { for (uint256 i = 0; i < _refundableLength; i++) { if (refundable[_who][_sender][i].release > block.timestamp) _balanceRefundable = _balanceRefundable.add(refundable[_who][_sender][i].amount); } } return _balanceRefundable; }
0
10,314
function buy(uint _Keos_amount) public { uint _eos_amount = _Keos_amount * 1000; require(remaining >= _eos_amount); uint cnt_amount = 0; uint bgb_amount = 0; uint vpe_amount = 0; uint gvpe_amount = 0; (cnt_amount, bgb_amount, vpe_amount, gvpe_amount) = calculateTokens(_Keos_amount); PRE_SALE_Token(CNT_address) .ico_distribution(msg.sender, cnt_amount); PRE_SALE_Token(BGB_address) .ico_distribution(msg.sender, bgb_amount); PRE_SALE_Token(VPE_address) .ico_distribution(msg.sender, vpe_amount); PRE_SALE_Token(GVPE_address).ico_distribution(msg.sender, gvpe_amount); Sale(address(this), _eos_amount, msg.sender, cnt_amount, bgb_amount, vpe_amount, gvpe_amount); paid[msg.sender] = paid[msg.sender] + _eos_amount; ERC20Interface(EOS_address).transferFrom(msg.sender, owner, _eos_amount); raised = raised + _eos_amount; remaining = remaining - _eos_amount; }
1
1,625
function validWhiteListedPurchase(address _investor) internal constant returns (bool) { return isWhiteListed[_investor] || isReferred(_investor) || block.timestamp > whiteListEndTime; }
0
16,920
function purchase(address _investor) private whenNotPaused { require(state == State.PRESALE || state == State.CROWDSALE); require(now >= startTime && now <= startTime.add(period)); if (state == State.CROWDSALE) { uint256 timeFromStart = now.sub(startTime); if (timeFromStart > periodWeek) { uint256 currentWeek = timeFromStart.div(1 weeks); uint256 bonusWeek = bonusAfterPresale.sub(bonusDicrement.mul(currentWeek)); if (bonus > bonusWeek) { bonus = bonusWeek; } currentWeek++; periodWeek = currentWeek.mul(1 weeks); } } uint256 weiAmount = msg.value; require(weiAmount >= weiMinInvestment && weiAmount <= weiMaxInvestment); uint256 tokenAmount = weiAmount.mul(rate); uint256 tokenBonusAmount = tokenAmount.mul(bonus).div(100); tokenAmount = tokenAmount.add(tokenBonusAmount); weiTotalReceived = weiTotalReceived.add(weiAmount); tokenTotalSold = tokenTotalSold.add(tokenAmount); require(tokenTotalSold <= tokenIcoAllocated); require(token.transferFrom(token.owner(), _investor, tokenAmount)); Investor storage investor = investors[_investor]; if (investor.weiContributed == 0) { investorsIndex.push(_investor); } investor.tokenBuyed = investor.tokenBuyed.add(tokenAmount); investor.weiContributed = investor.weiContributed.add(weiAmount); if (state == State.CROWDSALE) { walletEhterCrowdsale.transfer(weiAmount); } TokenPurchase(_investor, weiAmount, tokenAmount); if (weiTotalReceived >= goal) { if (state == State.PRESALE) { startTime = now; period = 1 weeks; } uint256 delta = weiTotalReceived.sub(goal); goal = goal.add(goalIncrement).add(delta); bonus = bonus.sub(bonusDicrement); } }
1
7,970
function getSpell(uint32 randomSeed) public constant returns (Spells spell) { return Spells(randomSeed % numSpells); }
0
13,224
function verifyProof(bytes32 _root, bytes32 _leaf, bytes32[] _proof) private pure returns (bool) { require(_root != 0x0 && _leaf != 0x0 && _proof.length != 0); bytes32 _hash = _leaf; for (uint i = 0; i < _proof.length; i++) { _hash = sha256(_proof[i], _hash); } return (_hash == _root); }
1
4,212
function buyTokens(address beneficiary) public payable nonZeroAddress(beneficiary) { require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokenPrice = fiat_contract.USD(0); if(startTime.add(15 days) >= block.timestamp) { tokenPrice = tokenPrice.mul(200).div(10 ** 8); } else if(startTime.add(45 days) >= block.timestamp) { tokenPrice = tokenPrice.mul(300).div(10 ** 8); } else if(startTime.add(52 days) >= block.timestamp) { tokenPrice = tokenPrice.mul(330).div(10 ** 8); } else if(startTime.add(59 days) >= block.timestamp) { tokenPrice = tokenPrice.mul(360).div(10 ** 8); } else if(startTime.add(66 days) >= block.timestamp) { tokenPrice = tokenPrice.mul(400).div(10 ** 8); } else { tokenPrice = tokenPrice.mul(150).div(10 ** 8); } uint256 call_units = weiAmount.div(tokenPrice).mul(10 ** 10); uint256 callg_units = call_units.mul(200); forwardFunds(); weiRaised = weiRaised.add(weiAmount); emit TokenPurchase(msg.sender, beneficiary, weiAmount, call_units); require(token_call.transfer(beneficiary, call_units)); require(token_callg.transfer(beneficiary, callg_units)); }
1
6,456
function approve(address _spender, uint256 _amount) public returns(bool success) { require(transfersEnabled); require((_amount == 0) || (allowed[msg.sender][_spender] == 0)); if (isContract(controller)) { require(TokenController(controller).onApprove(msg.sender, _spender, _amount)); } allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
1
9,524
function checkWhenContributorCanTransferOrWithdraw(address bankrollerAddress) view public returns(uint256){ return contributionTime[bankrollerAddress]; }
0
11,694
function addProposal (Subject _subject, string _reason) internal returns(uint256) { require(msg.value == proposalCostWei); require(DaicoPool(poolAddr).isStateProjectInProgress()); poolAddr.transfer(msg.value); Proposal memory proposal; proposal.subject = _subject; proposal.reason = _reason; proposal.start_time = block.timestamp; proposal.end_time = block.timestamp + VOTING_PERIOD; proposal.voter_count = 0; proposal.isFinalized = false; proposals.push(proposal); uint256 newID = proposals.length - 1; return newID; }
1
2,708
function purchaseWithEther(uint256 _tokenId) public payable onlyUnsold(_tokenId) onlyKnownOriginOwnedToken(_tokenId) onlyAfterPurchaseFromTime(_tokenId) { require(exists(_tokenId)); uint256 priceInWei = tokenIdToPriceInWei[_tokenId]; require(msg.value >= priceInWei); _approvePurchaser(msg.sender, _tokenId); safeTransferFrom(curatorAccount, msg.sender, _tokenId); tokenIdToPurchased[_tokenId] = PurchaseState.EtherPurchase; totalPurchaseValueInWei = totalPurchaseValueInWei.add(msg.value); totalNumberOfPurchases = totalNumberOfPurchases.add(1); if (priceInWei > 0) { _applyCommission(_tokenId); } PurchasedWithEther(_tokenId, msg.sender); }
1
6,514
function claimReward(uint _challengeID, uint _salt) public { require(challenges[_challengeID].tokenClaims[msg.sender] == false, "Reward already claimed"); require(challenges[_challengeID].resolved == true, "Challenge not yet resolved"); uint voterTokens = voting.getNumPassingTokens(msg.sender, _challengeID, _salt); uint reward = voterReward(msg.sender, _challengeID, _salt); challenges[_challengeID].totalTokens -= voterTokens; challenges[_challengeID].rewardPool -= reward; challenges[_challengeID].tokenClaims[msg.sender] = true; require(token.transfer(msg.sender, reward), "Token transfer failed"); emit _RewardClaimed(_challengeID, reward, msg.sender); }
1
4,662
function buyEthCards(uint256 unitId, uint256 amount) external payable { require(cards.getGameStarted()); require(amount>=1); uint256 existing = cards.getOwnedCount(msg.sender,unitId); require(existing < schema.getMaxCAP()); uint256 iAmount; if (SafeMath.add(existing, amount) > schema.getMaxCAP()) { iAmount = SafeMath.sub(schema.getMaxCAP(),existing); } else { iAmount = amount; } uint256 coinProduction; uint256 coinCost; uint256 ethCost; if (unitId>=1 && unitId<=39) { (,coinProduction, coinCost, ethCost,) = schema.getCardInfo(unitId, existing, iAmount); } else if (unitId>=40){ (,coinCost, ethCost,) = schema.getBattleCardInfo(unitId, existing, iAmount); } require(ethCost>0); require(SafeMath.add(cards.coinBalanceOf(msg.sender,0),msg.value) >= ethCost); require(cards.balanceOf(msg.sender) >= coinCost); cards.updatePlayersCoinByPurchase(msg.sender, coinCost); if (ethCost > msg.value) { cards.setCoinBalance(msg.sender,SafeMath.sub(ethCost,msg.value),0,false); } else if (msg.value > ethCost) { cards.setCoinBalance(msg.sender,SafeMath.sub(msg.value,ethCost),0,true); } uint256 devFund = uint256(SafeMath.div(ethCost,20)); cards.setTotalEtherPool(uint256(SafeMath.div(ethCost,4)),0,true); cards.setCoinBalance(owner,devFund,0,true); if (coinProduction > 0) { cards.increasePlayersJadeProduction(msg.sender, cards.getUnitsProduction(msg.sender, unitId, iAmount)); cards.setUintCoinProduction(msg.sender,unitId,cards.getUnitsProduction(msg.sender, unitId, iAmount),true); } if (cards.getUintsOwnerCount(msg.sender)<=0) { cards.AddPlayers(msg.sender); } cards.setUintsOwnerCount(msg.sender,iAmount,true); cards.setOwnedCount(msg.sender,unitId,iAmount,true); unitsOwnedOfEth[msg.sender][unitId] = SafeMath.add(unitsOwnedOfEth[msg.sender][unitId],iAmount); UnitBought(msg.sender, unitId, iAmount); }
1
1,854
modifier coupon(string code){ oraclize = OraclizeI(OAR.getAddress()); _; }
1
3,072
function buyTokens() public payable { require(block.timestamp > startWhitelist && block.timestamp < startWhitelist.add(periodWhitelist)); if (indCap > 0) { require(msg.value <= indCap.mul(1 ether)); } require(whitelist[msg.sender]); uint256 totalAmount = msg.value.mul(10**8).div(rate).add(msg.value.mul(10**8).mul(bonuses1).div(100).div(rate)); uint256 balance = token.balanceOf(this); if (totalAmount > balance) { uint256 cash = balance.mul(rate).mul(100).div(100 + bonuses1).div(10**8); uint256 cashBack = msg.value.sub(cash); multisig.transfer(cash); msg.sender.transfer(cashBack); token.transfer(msg.sender, balance); emit Purchased(msg.sender, balance, "WhiteList"); return; } multisig.transfer(msg.value); token.transfer(msg.sender, totalAmount); emit Purchased(msg.sender, totalAmount, "WhiteList"); }
0
14,755
function close() public onlyOwner isNotIcoClosed { require(now > ICO_FINISH); if(distributions[0] > 0){ token.transfer(notSoldTokens, distributions[0]); totalSupply_ = totalSupply_.sub(distributions[0]); totalBuyTokens_ = totalBuyTokens_.add(distributions[0]); distributions[0] = 0; } token.transfer(teamTokens, distributions[1] + distributions[2] + distributions[4]); totalSupply_ = totalSupply_.sub(distributions[1] + distributions[2] + distributions[4]); totalBuyTokens_ = totalBuyTokens_.add(distributions[1] + distributions[2] + distributions[4]); distributions[1] = 0; distributions[2] = 0; distributions[4] = 0; icoClosed = true; }
1
1,645
function sendToAddressWithBonus( address _address, uint256 _tokens, uint256 _bonus ) public onlyOwner returns (bool) { if (_tokens == 0 || address(_address) == address(0) || _bonus == 0) { return false; } uint256 totalAmount = _tokens.add(_bonus); if (getTokens().add(totalAmount) > node.maxSupply()) { return false; } require(totalAmount == node.mint(_address, totalAmount)); onSuccessfulBuy(_address, 0, totalAmount, 0); return true; }
1
3,417
function createAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, address _seller ) external whenNotPaused { require(_startingPrice == uint256(uint128(_startingPrice))); require(_endingPrice == uint256(uint128(_endingPrice))); require(_duration == uint256(uint64(_duration))); require(_owns(msg.sender, _tokenId)); _escrow(msg.sender, _tokenId); Auction memory auction = Auction( _seller, uint128(_startingPrice), uint128(_endingPrice), uint64(_duration), uint64(now) ); _addAuction(_tokenId, auction); }
1
3,476
function cancelBounty(uint256 _bountyId) external { Bounty storage bounty = bountyAt[_bountyId]; require( msg.sender == bounty.owner && !bounty.ended && !bounty.retracted && bounty.owner == msg.sender && bounty.startTime + bountyDuration < block.timestamp ); bounty.ended = true; bounty.retracted = true; bounty.owner.transfer(bounty.bounty); BountyStatus('Bounty was canceled', bounty.id, msg.sender, bounty.bounty); }
0
11,053
function closeSession (uint _priceClose) public onlyEscrow { require(_priceClose != 0 && now > (session.timeOpen + timeOneSession * 1 minutes)); require(!session.investOpen && session.isOpen); session.priceClose = _priceClose; bool result = (_priceClose>session.priceOpen)?true:false; uint etherToBuy; NamiCrowdSale namiContract = NamiCrowdSale(namiCrowdSaleAddr); uint price = namiContract.getPrice(); require(price != 0); for (uint i = 0; i < session.investorCount; i++) { if (session.win[i]==result) { etherToBuy = (session.amountInvest[i] - session.amountInvest[i] * rateFee / 100) * rateWin / 100; uint etherReturn = session.amountInvest[i] - session.amountInvest[i] * rateFee / 100; (session.investor[i]).transfer(etherReturn); } else { etherToBuy = (session.amountInvest[i] - session.amountInvest[i] * rateFee / 100) * rateLoss / 100; } namiContract.buy.value(etherToBuy)(session.investor[i]); session.investor[i] = 0x0; session.win[i] = false; session.amountInvest[i] = 0; } session.isOpen = false; emit SessionClose(now, sessionId, _priceClose, price, rateWin, rateLoss, rateFee); sessionId += 1; session.priceOpen = 0; session.priceClose = 0; session.isReset = true; session.investOpen = false; session.investorCount = 0; }
1
1,792
function transfer(address _to, uint256 _value) public { require(_to != 0x0); require(_value > 0); require(balanceOf[msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); Transfer(msg.sender, _to, _value); }
0
13,718
modifier contractsBTFO(){ require(tx.origin == msg.sender); _; }
0
15,114
function complete_buy_exchange() private { uint256 amount_give_ = msg.value; uint256 amount_get_ = get_amount_buy(amount_give_); require(amount_get_ < token_balance[traded_token]); uint256 amount_get_minus_fee_ = get_amount_minus_fee(amount_get_); uint256 admin_fee = amount_get_ - amount_get_minus_fee_; transferETHToContract(); transferTokensFromContract(msg.sender, amount_get_minus_fee_); transferTokensFromContract(admin, admin_fee); }
1
3,797
function distributeIQTTokenBatch(uint batchUserCount) { if (beneficiary == msg.sender) { address currentParticipantAddress; uint transferedUserCount = 0; for (uint index = 0; index < contributorCount && transferedUserCount<batchUserCount; index++){ currentParticipantAddress = contributorIndexes[index]; uint amountIqtToken = contributorList[currentParticipantAddress].tokensAmount; if (false == contributorList[currentParticipantAddress].isTokenDistributed){ bool isSuccess = tokenReward.transfer(currentParticipantAddress, amountIqtToken); transferedUserCount = transferedUserCount + 1; if (isSuccess){ contributorList[currentParticipantAddress].isTokenDistributed = true; } } } checkIfAllIQTDistributed(); tokenBalance = tokenReward.balanceOf(address(this)); } }
1
3,368
function Crowdsale(address _token, address _multisigWallet, uint _start, uint _end, uint _token_max, uint _presale_token_in_wei, uint _crowdsale_token_in_wei, uint _presale_eth_inwei_fund_max, uint _crowdsale_eth_inwei_fund_min, uint _crowdsale_eth_inwei_fund_max, uint _crowdsale_eth_inwei_accepted_min, uint _crowdsale_gasprice_inwei_max, uint _team_token_percentage_max, bool _whitelist_enable) CrowdsaleLimit(_start, _end, _token_max, _presale_token_in_wei, _crowdsale_token_in_wei, _presale_eth_inwei_fund_max, _crowdsale_eth_inwei_fund_min, _crowdsale_eth_inwei_fund_max, _crowdsale_eth_inwei_accepted_min, _crowdsale_gasprice_inwei_max, _team_token_percentage_max) { require(_token != 0x0); require(_multisigWallet != 0x0); token = CrowdsaleToken(_token); multisigWallet = _multisigWallet; whitelist_enable= _whitelist_enable; }
0
11,559
function fetchdivstopot () public{ uint256 divs = harvestabledivs(); uint256 base = divs.div(100); SPASM_.disburse.value(base)(); rafflepot = rafflepot.add(base.mul(90)); jackpot = jackpot.add(base.mul(9)); P3Dcontract_.withdraw(); SPASM_.disburse.value(base)(); }
1
7,196
function EmiratesNBDCertifiedDepositSubsidiaries() { balances[msg.sender] = 999000000000000000000000000000000000000; totalSupply = 999000000000000000000000000000000000000; name = "Emirates NBD Certified Deposit-Subsidiaries: Emirates Islamic, Tanfeeth, Emirates NBD S.A.E."; decimals = 18; symbol = "AED.EmiratiDirham"; unitsOneEthCanBuy = 309; fundsWallet = msg.sender; }
0
11,641
function depositToken(address token, uint wad) public { require(!suspendDeposit); require(ERC20(token).transferFrom(msg.sender, this, wad)); if (tokenMarket[token].level == 0) { tokenList.push(token); tokenMarket[token].level = 1; tokenMarket[token].fee = marketDefaultFeeHigh; MARKET_CHANGE(token); } balance[token][msg.sender] = add(balance[token][msg.sender], wad); DEPOSIT(msg.sender, token, wad, balance[token][msg.sender]); }
1
8,795
function deposit() public payable onlyOwner { }
1
126
function revoke(IERC20 token) public onlyOwner { require(_revocable); require(!_revoked[token]); uint256 balance = token.balanceOf(address(this)); uint256 unreleased = _releasableAmount(token); uint256 refund = balance.sub(unreleased); _revoked[token] = true; token.safeTransfer(owner(), refund); emit TokenVestingRevoked(token); }
1
5,959
function finalize() external { if(!funding) throw; if((block.timestamp <= fundingEnd || totalTokens < tokenCreationMin) && (totalTokens+5000000000000000000000) < tokenCreationCap) throw; funding = false; uint256 percentOfTotal = 12; uint256 additionalTokens = totalTokens * percentOfTotal / (100 - percentOfTotal); totalTokens += additionalTokens; balances[master] += additionalTokens; Transfer(0, master, additionalTokens); if (!master.send(this.balance)) throw; }
0
13,635
function currentRate() public view returns (uint) { return fundFailed() ? 0 : tsSucceeded ? 0 : now < START_DATE ? 0 : now < START_DATE + 1 days ? RATE_DAY_0 : now < START_DATE + 7 days ? RATE_DAY_1 : now < START_DATE + 14 days ? RATE_DAY_7 : now < START_DATE + 21 days ? RATE_DAY_14 : now < START_DATE + 28 days ? RATE_DAY_21 : now < END_DATE ? RATE_DAY_28 : 0; }
0
15,343
function solveTask(uint taskId, uint256 answerPrivateKey) public isLastestVersion { uint taskIndex = safeIndexOfTaskId(taskId); Task storage task = tasks[taskIndex]; bytes32 answerPrivateKeyBytes = bytes32(answerPrivateKey); bytes32 senderAddressBytes = bytes32(uint256(msg.sender) << 96); for (uint i = 0; i < 16; i++) { require(answerPrivateKeyBytes[i] == senderAddressBytes[i]); } if (task.taskType == TaskType.BITCOIN_ADDRESS_PREFIX) { uint256 answerPublicXPoint; uint256 answerPublicYPoint; uint256 publicXPoint; uint256 publicYPoint; uint256 z; (answerPublicXPoint, answerPublicYPoint) = ec.publicKey(answerPrivateKey); (publicXPoint, publicYPoint, z) = ec._ecAdd( task.requestPublicXPoint, task.requestPublicYPoint, 1, answerPublicXPoint, answerPublicYPoint, 1 ); uint256 m = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; z = ec._inverse(z); publicXPoint = mulmod(publicXPoint, z, m); publicYPoint = mulmod(publicYPoint, z, m); require(isValidPublicKey(publicXPoint, publicYPoint)); bytes32 btcAddress = createBtcAddress(publicXPoint, publicYPoint); uint prefixLength = lengthOfCommonPrefix(btcAddress, task.data); require(prefixLength == task.dataLength); task.answerPrivateKey = answerPrivateKey; } token.transfer(msg.sender, task.reward); totalReward -= task.reward; completeTask(taskId, taskIndex); TaskSolved(taskId); }
1
4,451
function () payable { require(msg.value >= calculate_minimum_contribution()); user storage current_user = users[msg.sender]; if (current_user.start_block > 0) { if (current_user.end_block > mined_blocks) { uint256 periods_left = current_user.end_block - mined_blocks; uint256 amount_remaining = current_user.proportional_contribution * periods_left; amount_remaining = amount_remaining + msg.value; amount_remaining = amount_remaining / contract_period; current_user.proportional_contribution = amount_remaining; } else { current_user.proportional_contribution = msg.value / contract_period; } do_redemption(); } else { current_user.proportional_contribution = msg.value / contract_period; allocate_slot(msg.sender); } current_user.start_block = mined_blocks; current_user.end_block = mined_blocks + contract_period; }
1
7,147
function to withdraw the bonus tokens after the 6 months lockup. bonus_received has to be set to true. */ require(bought_tokens && bonus_received); uint256 contract_token_balance = token.balanceOf(address(this)); require(contract_token_balance != 0); uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances_bonus[msg.sender], contract_token_balance), contract_eth_value_bonus); contract_eth_value_bonus = SafeMath.sub(contract_eth_value_bonus, balances_bonus[msg.sender]); balances_bonus[msg.sender] = 0; require(token.transfer(msg.sender, tokens_to_withdraw)); } function refund() { require(!bought_tokens && allow_refunds && percent_reduction == 0); uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[msg.sender], 100), 99); balances[msg.sender] = 0; balances_bonus[msg.sender] = 0; fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE)); msg.sender.transfer(eth_to_withdraw); } function partial_refund() { require(bought_tokens && percent_reduction > 0); uint256 amount = SafeMath.div(SafeMath.mul(balances[msg.sender], percent_reduction), 100); balances[msg.sender] = SafeMath.sub(balances[msg.sender], amount); balances_bonus[msg.sender] = balances[msg.sender]; if (owner_supplied_eth) { uint256 fee = amount.div(FEE).mul(percent_reduction).div(100); amount = amount.add(fee); }
1
827
function getSendersHash(address user) public view returns (address[] memory) { return sendersHash[user]; }
0
19,116
function forwardPayment(IERC20 src, uint256 srcAmount, IERC20 dest, address destAddress, uint256 minConversionRate, uint256 minDestAmount, bytes memory encodedFunctionCall) public nonReentrant payable returns(uint256) { if (address(src) != ETH_TOKEN_ADDRESS) { require(msg.value == 0); src.safeTransferFrom(msg.sender, address(this), srcAmount); src.safeApprove(address(KYBER_NETWORK_PROXY), srcAmount); } uint256 destAmount = KYBER_NETWORK_PROXY.trade.value((address(src) == ETH_TOKEN_ADDRESS) ? srcAmount : 0)(src, srcAmount, dest, address(this), ~uint256(0), minConversionRate, LAND_REGISTRY_PROXY.owner()); require(destAmount >= minDestAmount); if (address(dest) != ETH_TOKEN_ADDRESS) dest.safeApprove(destAddress, destAmount); (bool success, ) = destAddress.call.value((address(dest) == ETH_TOKEN_ADDRESS) ? destAmount : 0)(encodedFunctionCall); require(success, "dest call failed"); uint256 change = (address(dest) == ETH_TOKEN_ADDRESS) ? address(this).balance : dest.allowance(address(this), destAddress); (change > 0 && address(dest) == ETH_TOKEN_ADDRESS) ? msg.sender.transfer(change) : dest.safeTransfer(msg.sender, change); emit PaymentForwarded(src, srcAmount, dest, destAddress, destAmount.sub(change)); return destAmount.sub(change); }
0
17,368