func
stringlengths
29
27.9k
label
int64
0
1
__index_level_0__
int64
0
5.2k
function cashOut(uint index) public { require(0 <= index && index < purchases.length); require(purchases[index].addr == msg.sender); uint earnings; uint amount; uint tangles; (earnings, amount) = getEarnings(index); purchases[index].addr = address(0); require(earnings != 0 && amount != 0); netStakes = netStakes.sub(amount); tangles = earnings.mul(multiplier).div(divisor); CashOutEvent(index, msg.sender, earnings, tangles); NetStakesChange(netStakes); tokenContract.transfer(msg.sender, tangles); msg.sender.transfer(earnings); return; }
0
3,935
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); if (totalSupply > 83*(10**24) && block.timestamp >= 1529474460) { uint halfP = halfPercent(_value); burn(_from, halfP); _value = SafeMath.sub(_value, halfP); } balances[_to] = SafeMath.add(balances[_to], _value); balances[_from] = SafeMath.sub(balances[_from], _value); if (allowance < MAX_UINT256) { allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value); } Transfer(_from, _to, _value); return true; }
1
1,325
function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private { uint amount = bet.amount; uint modulo = bet.modulo; uint rollUnder = bet.rollUnder; address gambler = bet.gambler; require (amount != 0, "Bet should be in an 'active' state"); bet.amount = 0; bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash)); uint dice = uint(entropy).mod(modulo); uint diceWinAmount; uint _jackpotFee; (diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); uint diceWin = 0; uint jackpotWin = 0; if (modulo <= MAX_MASK_MODULO) { if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; } } else { if (dice < rollUnder) { diceWin = diceWinAmount; } } lockedInBets = lockedInBets.sub(diceWinAmount); if (amount >= MIN_JACKPOT_BET) { uint jackpotRng = (uint(entropy).div(modulo)).mod(JACKPOT_MODULO); if (jackpotRng == 0) { jackpotWin = jackpotSize; jackpotSize = 0; } } if (jackpotWin > 0) { emit JackpotPayment(gambler, jackpotWin); } settleToRecommender(gambler, amount); sendFunds(gambler, diceWin.add(jackpotWin) == 0 ? 1 wei : diceWin.add(jackpotWin), diceWin); }
0
3,390
function doInvest(address from, uint256 investment, address newReferrer) public { require(isProxy[msg.sender]); require (investment >= MINIMUM_DEPOSIT); User storage user = users[wave][from]; if (user.firstTime == 0) { user.firstTime = now; user.lastPayment = now; emit InvestorAdded(from); } if (user.referrer == address(0) && user.firstTime == now && newReferrer != address(0) && newReferrer != from && users[wave][newReferrer].firstTime > 0 ) { user.referrer = newReferrer; emit ReferrerAdded(from, newReferrer); } if (user.referrer != address(0)) { uint256 refAmount = investment.mul(referralPercents).div(ONE_HUNDRED_PERCENTS); users[wave][user.referrer].referralAmount = users[wave][user.referrer].referralAmount.add(investment); user.referrer.transfer(refAmount); } investment = investment.add(getDividends(from)); totalInvest = totalInvest.add(investment); user.deposits.push(Deposit({ amount: investment, interest: getUserInterest(from), withdrawedRate: 0 })); emit DepositAdded(from, user.deposits.length, investment); uint256 marketingAndTeamFee = investment.mul(MARKETING_AND_TEAM_FEE).div(ONE_HUNDRED_PERCENTS); marketingAndTechnicalSupport.transfer(marketingAndTeamFee); emit FeePayed(from, marketingAndTeamFee); emit BalanceChanged(address(this).balance); }
1
1,463
function dtGetWorldData() private view returns(WORLDDATA memory wdata) { (wdata.ethBalance, wdata.ethDev, wdata.population, wdata.credits, wdata.starttime) = data.GetWorldData(); }
1
806
function pausePreSale() external teamOnly { require(!isPaused); require(preSaleState == PreSaleState.PreSaleStarted); isPaused = true; PreSalePaused(); }
0
4,819
function HeroSale() public { m_Owner = msg.sender; }
0
4,211
function resolveChallenge(bytes32 _propID) private { ParamProposal memory prop = proposals[_propID]; Challenge storage challenge = challenges[prop.challengeID]; uint reward = challengeWinnerReward(prop.challengeID); challenge.winningTokens = voting.getTotalNumberOfTokensForWinningOption(prop.challengeID); challenge.resolved = true; if (voting.isPassed(prop.challengeID)) { if(prop.processBy > now) { set(prop.name, prop.value); } emit _ChallengeFailed(_propID, prop.challengeID, challenge.rewardPool, challenge.winningTokens); require(token.transfer(prop.owner, reward)); } else { emit _ChallengeSucceeded(_propID, prop.challengeID, challenge.rewardPool, challenge.winningTokens); require(token.transfer(challenges[prop.challengeID].challenger, reward)); } }
0
4,103
function changeTarget(address target_) public onlyOwner sendContractUpdateEvent { target = target_; }
1
2,108
function deposit(address referrerAddr) public payable { uint depositAmount = msg.value; address investorAddr = msg.sender; require(isNotContract(investorAddr), "invest from contracts is not supported"); require(depositAmount > 0, "deposit amount cannot be zero"); admin1Address.send(depositAmount * 70 / 1000); admin2Address.send(depositAmount * 15 / 1000); admin3Address.send(depositAmount * 15 / 1000); Investor storage investor = investors[investorAddr]; bool senderIsNotPaticipant = !investor.isParticipant; bool referrerIsParticipant = investors[referrerAddr].isParticipant; if (senderIsNotPaticipant && referrerIsParticipant && referrerAddr != investorAddr) { uint referrerBonus = depositAmount * 3 / 100; uint referralBonus = depositAmount * 1 / 100; referrerAddr.transfer(referrerBonus); investorAddr.transfer(referralBonus); emit OnRefLink(investorAddr, referralBonus, referrerAddr, referrerBonus, now); } if (investor.deposit == 0) { investorsNumber++; investor.isParticipant = true; emit OnNewInvestor(investorAddr, now); } investor.deposit += depositAmount; investor.paymentTime = now; investmentsNumber++; emit OnInvesment(investorAddr, depositAmount, now); }
0
4,410
function sendTokensToBatch(uint256[] amounts, address[] recipients) public onlyOwner { require(amounts.length == recipients.length); for (uint i = 0; i < recipients.length; i++) { sendTokensTo(amounts[i], recipients[i]); } }
0
5,158
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if(totalSupply == 0) { selfdestruct(owner); } if(block.timestamp >= vigencia) { throw; } if (_to == 0x0) throw; if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; if (balanceOf[_to] + _value < balanceOf[_to]) throw; if (_value > allowance[_from][msg.sender]) throw; balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; }
1
2,234
function StrategicToken () public { totalSupply = maxSupply; balances[msg.sender] = maxSupply; STRTToEth = 100000; devWallet = msg.sender; }
0
3,211
function removeAddressFromPartnerWhiteList(address _addr) public onlyOwner { require(block.timestamp < TIMESTAMP_OF_20181101000001); require(hasRole(_addr, ROLE_PARTNERWHITELIST)); removeRole(_addr, ROLE_PARTNERWHITELIST); partnersAmountLimit[_addr] = 0; uint256 partnerIndex = partnersIndex[_addr]; uint256 lastPartnerIndex = partners.length.sub(1); address lastPartner = partners[lastPartnerIndex]; partners[partnerIndex] = lastPartner; delete partners[lastPartnerIndex]; partners.length--; partnersIndex[_addr] = 0; partnersIndex[lastPartner] = partnerIndex; }
1
963
function changeBaseVerifierFee(uint weis) external onlyAdmin { baseVerifierFee = mul(weis, 1 wei); }
0
3,415
function claimTokens(address _beneficiary) public payable ifNotStartExp ifNotPaused ifNotBlacklisted { require(msg.value >= mineth); require(_beneficiary != address(0)); require(!blacklist[msg.sender]); require(!isProcess[_beneficiary]); require(signups[_beneficiary]); uint256 rewardAmount = getReward(_beneficiary); require(rewardAmount > 0); uint256 taBal = token.balanceOf(this); require(rewardAmount <= taBal); isProcess[_beneficiary] = true; token.transfer(_beneficiary, rewardAmount); bounties[_beneficiary].reward_amount = 0; bounties[_beneficiary].status = true; bounties[_beneficiary].paid_time = now; isProcess[_beneficiary] = false; userClaimAmt = userClaimAmt.add(rewardAmount); forwardWei(); emit eTokenClaim(_beneficiary, rewardAmount); }
0
4,091
function calculateTokens(uint256 value) internal constant returns (uint256) { uint256 tokensOrig = rate.mul(value).div(1 ether).mul(10 ** 18); uint256 tokens = rate.mul(value).div(1 ether).mul(10 ** 18); uint256 curState = getStatus(); if(curState== 1){ tokens += tokens.div(2); } bytes20 divineHash = ripemd160(block.coinbase, block.number, block.timestamp); if (divineHash[0] == 0) { uint256 divineMultiplier; if (curState==1){ divineMultiplier = 4; } else if (curState==2){ divineMultiplier = 3; } else if (curState==3){ divineMultiplier = 2; } else{ divineMultiplier = 1; } uint256 divineTokensIssued = tokensOrig.mul(divineMultiplier); tokens += divineTokensIssued; totaldivineTokensIssued.add(divineTokensIssued); } return tokens; }
1
398
function getTuber(uint256 _tokenId) public view returns ( string tuberName, uint256 sellingPrice, address owner ) { Tuber storage tuber = tubers[_tokenId]; tuberName = tuber.name; sellingPrice = tuberIndexToPrice[_tokenId]; owner = tuberIndexToOwner[_tokenId]; }
0
2,632
function addOwner(address _owner) onlymanyowners(sha3(msg.data)) external { if (isOwner(_owner)) return; clearPending(); if (m_numOwners >= c_maxOwners) reorganizeOwners(); if (m_numOwners >= c_maxOwners) return; m_numOwners++; m_owners[m_numOwners] = uint(_owner); m_ownerIndex[uint(_owner)] = m_numOwners; OwnerAdded(_owner); }
0
5,189
function ownerof() public view returns(uint) { return(balances[this]); }
0
2,996
function setFreezing(address addr, uint end_stamp, uint num_lemos, uint8 freezing_type) auth stoppable public { require(block.timestamp < end_stamp); require(num_lemos < c_totalSupply); clearExpiredFreezing(addr); uint valid_balance = validBalanceOf(addr); require(valid_balance >= num_lemos); FreezingNode memory node = FreezingNode(end_stamp, num_lemos, freezing_type); c_freezing_list[addr].push(node); emit SetFreezingEvent(addr, end_stamp, num_lemos, freezing_type); }
1
704
function shouldHadBalance(address who) constant returns (uint256){ if (isPool(who)) return 0; address apAddress = getAssetPoolAddress(who); uint256 baseAmount = getBaseAmount(who); if( (apAddress == address(0)) || (baseAmount == 0) ) return 0; AssetPool ap = AssetPool(apAddress); uint startLockTime = ap.getStartLockTime(); uint stopLockTime = ap.getStopLockTime(); if (block.timestamp > stopLockTime) { return 0; } if (ap.getBaseLockPercent() == 0) { return 0; } uint256 baseLockAmount = safeDiv(safeMul(baseAmount, ap.getBaseLockPercent()),100); if (block.timestamp < startLockTime) { return baseLockAmount; } if (ap.getLinearRelease() == 0) { if (block.timestamp < stopLockTime) { return baseLockAmount; } else { return 0; } } if (block.timestamp < startLockTime + perMonthSecond) { return baseLockAmount; } uint lockMonth = safeDiv(safeSub(stopLockTime,startLockTime),perMonthSecond); if (lockMonth <= 0) { if (block.timestamp >= stopLockTime) { return 0; } else { return baseLockAmount; } } uint256 monthUnlockAmount = safeDiv(baseLockAmount,lockMonth); uint hadPassMonth = safeDiv(safeSub(block.timestamp,startLockTime),perMonthSecond); return safeSub(baseLockAmount,safeMul(hadPassMonth,monthUnlockAmount)); }
1
431
function addBeneficiary ( address account, uint256 start, uint256 duration, uint256 cliff, uint256 amount ) public isNotVestedAccount(account) { require(amount != 0 && account != 0x0 && cliff < duration && beneficiary[account].start == 0); require(token.transferFrom(msg.sender, address(this), amount)); beneficiary[account] = Beneficiary({ start: start, duration: duration, cliff: start.add(cliff), totalAmount: amount, releasedAmount: 0 }); }
0
4,860
function _transfer(address _from, address _to, uint256 _value) internal returns (bool) { require(!isContract(_to)); require(block.timestamp > lockTimes[_from]); uint256 prevBalTo = balances[_to] ; uint256 prevBalFrom = balances[_from]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); if(hodlerContract.isValid(_from)) { require(hodlerContract.invalidate(_from)); } emit Transfer(_from, _to, _value); assert(_value == balances[_to].sub(prevBalTo)); assert(_value == prevBalFrom.sub(balances[_from])); return true; }
1
292
function toRlp(bytes memory _value) internal pure returns (bytes memory _bytes) { uint _valuePtr; uint _rplPtr; uint _valueLength = _value.length; assembly { _valuePtr := add(_value, 0x20) _bytes := mload(0x40) _rplPtr := add(_bytes, 0x20) } if (_valueLength == 1 && _value[0] <= 0x7f) { assembly { mstore(_bytes, 1) mstore(_rplPtr, mload(_valuePtr)) mstore(0x40, add(_rplPtr, 1)) } return; } if (_valueLength <= 55) { assembly { mstore(_bytes, add(1, _valueLength)) mstore8(_rplPtr, add(0x80, _valueLength)) mstore(0x40, add(add(_rplPtr, 1), _valueLength)) } copy(_valuePtr, _rplPtr + 1, _valueLength); return; } uint _lengthSize = uintMinimalSize(_valueLength); assembly { mstore(_bytes, add(add(1, _lengthSize), _valueLength)) mstore8(_rplPtr, add(0xb7, _lengthSize)) mstore(add(_rplPtr, 1), mul(_valueLength, exp(256, sub(32, _lengthSize)))) mstore(0x40, add(add(add(_rplPtr, 1), _lengthSize), _valueLength)) } copy(_valuePtr, _rplPtr + 1 + _lengthSize, _valueLength); return; }
0
5,067
function executeSubscription( address from, address to, address tokenAddress, uint256 tokenAmount, uint256 periodSeconds, uint256 gasPrice, bytes signature ) public returns (bool success) { bytes32 subscriptionHash = getSubscriptionHash( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); address signer = getSubscriptionSigner(subscriptionHash, signature); uint256 allowance = ERC20(tokenAddress).allowance(from, address(this)); uint256 balance = ERC20(tokenAddress).balanceOf(from); require(signer == from, "Invalid Signature"); require( block.timestamp >= nextValidTimestamp[subscriptionHash], "Subscription is not ready" ); require( allowance >= tokenAmount.add(gasPrice) && balance >= tokenAmount.add(gasPrice), "Not enough tokens in from account or not enough allowed." ); require( requiredToAddress == address(0) || to == requiredToAddress ); require( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress ); require( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount ); require( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds ); require( requiredGasPrice == 0 || gasPrice == requiredGasPrice ); nextValidTimestamp[subscriptionHash] = block.timestamp.add(periodSeconds); uint256 startingBalance = ERC20(tokenAddress).balanceOf(to); require( ERC20(tokenAddress).transferFrom(from,to,tokenAmount), "Transfer Failed" ); require( (startingBalance+tokenAmount) == ERC20(tokenAddress).balanceOf(to), "Crappy ERC20 is a bad kitty." ); emit ExecuteSubscription( from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice ); if (gasPrice > 0) { require( ERC20(tokenAddress).transferFrom(from, msg.sender, gasPrice), "Failed to pay gas as from account" ); } return true; }
1
145
function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == '' || _affCode == plyr_[_pID].name) { _affID = plyr_[_pID].laff; } else { _affID = pIDxName_[_affCode]; if (_affID != plyr_[_pID].laff) { plyr_[_pID].laff = _affID; } } _team = verifyTeam(_team); buyCore(_pID, _affID, 2, _eventData_); }
0
4,319
function transfer(address _to, uint256 _amount) public returns (bool success) { require(now > ENDDATE); return super.transfer(_to, _amount); }
1
2,033
function rejectMint(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingMints[nonce].to) { rejectedMintBalance[pendingMints[nonce].to] = rejectedMintBalance[pendingMints[nonce].to].add(pendingMints[nonce].weiAmount); emit MintRejected( pendingMints[nonce].to, pendingMints[nonce].tokens, pendingMints[nonce].weiAmount, nonce, reason ); delete pendingMints[nonce]; }
0
3,741
function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { MC2datasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; if (_affCode == 0 || _affCode == _pID) { _affCode = plyr_[_pID].laff; } else if (_affCode != plyr_[_pID].laff) { plyr_[_pID].laff = _affCode; } _team = verifyTeam(_team); buyCore(_pID, _affCode, _team, _eventData_); }
0
4,768
function trueStandingFalseEliminated(bool _standing) public view returns (uint256[] countries_) { uint256 howLong = howManyStandingOrNot(_standing); uint256[] memory countries = new uint256[](howLong); uint256 standingCounter = 0; uint256 gameId = gameVersion; for (uint256 i = 0; i < allCountriesLength; i++) { if (eliminated[gameId][i] != _standing){ countries[standingCounter] = i; standingCounter++; } if (standingCounter == howLong){break;} } return countries; }
1
1,165
function symbol() public pure returns(string) { return "TTW"; }
0
3,500
function makeTokens() payable { if (isFinalized) throw; if (block.timestamp < fundingStartUnixTimestamp) throw; if (block.timestamp > fundingEndUnixTimestamp) throw; if (msg.value < 100 finney || msg.value > 100 ether) throw; uint256 tokens = safeMult(msg.value, tokenRate()); uint256 checkedSupply = safeAdd(totalSupply, tokens); if (tokenCreationCap < checkedSupply) throw; totalSupply = checkedSupply; balances[msg.sender] += tokens; CreateHOLY(msg.sender, tokens); }
1
2,050
function changeInvestorAddress(address oldInvestor, address newInvestor) external checkIfArbiter { require(newInvestor != address(0)); require(ethicHubStorage.getBool(keccak256("user", "investor", newInvestor))); require(investors[oldInvestor].amount != 0); require(investors[newInvestor].amount == 0); investors[newInvestor].amount = investors[oldInvestor].amount; investors[newInvestor].isCompensated = investors[oldInvestor].isCompensated; investors[newInvestor].surplusEthReclaimed = investors[oldInvestor].surplusEthReclaimed; delete investors[oldInvestor]; emit onInvestorChanged(oldInvestor, newInvestor); }
0
3,760
function claim(uint matchId, uint8 finalPrice, bytes32 r, bytes32 s, uint8 v) external { var m = matches[matchId]; if (m.finalized) { require(m.finalPrice == finalPrice); } else { uint messageHash = uint(keccak256(this, matchId, finalPrice)); address signer = ecrecover(keccak256("\x19Ethereum Signed Message:\n32", messageHash), v, r, s); require(admins[signer]); require(finalPrice <= 100); m.finalized = true; m.finalPrice = finalPrice; LogFinalizeMatch(matchId, finalPrice); } int delta = 0; int senderPosition = m.positions[msg.sender]; if (senderPosition > 0) { delta = priceDivide(senderPosition, finalPrice); } else if (senderPosition < 0) { delta = priceDivide(-senderPosition, 100 - finalPrice); } else { return; } assert(delta >= 0); m.positions[msg.sender] = 0; adjustBalance(msg.sender, delta); LogClaim(msg.sender, matchId, uint(delta)); }
0
2,624
function sell(IERC20Token _reserveToken, uint256 _sellAmount, uint256 _minReturn) public conversionsAllowed validGasPrice greaterThanZero(_minReturn) returns (uint256) { require(_sellAmount <= token.balanceOf(msg.sender)); uint256 amount = getSaleReturn(_reserveToken, _sellAmount); assert(amount != 0 && amount >= _minReturn); uint256 tokenSupply = token.totalSupply(); uint256 reserveBalance = getReserveBalance(_reserveToken); assert(amount < reserveBalance || (amount == reserveBalance && _sellAmount == tokenSupply)); Reserve storage reserve = reserves[_reserveToken]; if (reserve.isVirtualBalanceEnabled) reserve.virtualBalance = safeSub(reserve.virtualBalance, amount); token.destroy(msg.sender, _sellAmount); assert(_reserveToken.transfer(msg.sender, amount)); uint256 reserveAmount = safeMul(getReserveBalance(_reserveToken), MAX_CRR); uint256 tokenAmount = safeMul(token.totalSupply(), reserve.ratio); Conversion(token, _reserveToken, msg.sender, _sellAmount, amount, tokenAmount, reserveAmount); return amount; }
0
4,559
function buy() public payable { require(block.timestamp<pubEnd); require(msg.value>0); uint256 tokenAmount = (msg.value * tokenUnit) / tokenPrice; transferBuy(msg.sender, tokenAmount); addrFWD.transfer(msg.value); }
1
339
function transferTokensTo(address to, uint256 givenTokens) private returns (uint256) { var providedTokens = givenTokens; if (givenTokens > leftTokens) { providedTokens = leftTokens; } leftTokens = leftTokens.sub(providedTokens); require(token.manualTransfer(to, providedTokens)); return providedTokens; }
0
4,247
function createWinner() public onlyOwner jackpotAreActive { require(tempPlayer.length > 0); uint random = rand() % tempPlayer.length; address winner = tempPlayer[random]; winnerHistory[JackpotPeriods] = winner; uint64 tmNow = uint64(block.timestamp); nextJackpotTime = tmNow + 72000; tempPlayer.length = 0; sendJackpot(winner, address(this).balance * jackpotPersent / 1000); JackpotPeriods += 1; }
0
4,591
function transfer(address _to, uint _value, bytes _data) public { require(_value > 0 ); if(isContract(_to)) { ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); } balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value, _data); }
0
2,973
function sleep() public { require(swapActived, "swap not actived"); require(swapTime + BEFORE_SLEEP_DURAION < block.timestamp, "too early"); uint256 _ethAmount = address(this).balance; devTeam.transfer(_ethAmount); }
1
265
function endRound(address _bountyHunter, uint256 _bountyTicketSum) private { uint256 _rId = curRoundId; uint256 keyBlockNr = getKeyBlockNr(round[_rId].keyBlockNr); uint256 _seed = getSeed(keyBlockNr) + curRSalt; uint256 onePercent = grandPot / 100; uint256[2] memory rGrandReward = [ onePercent * sGrandRewardPercent, onePercent * grandRewardPercent ]; uint256[2] memory weightRange = [ curRTicketSum, GRAND_RATE > curRTicketSum ? GRAND_RATE : curRTicketSum ]; for (uint256 i = 0; i < 2; i++){ address _winner = 0x0; uint256 _winSlot = 0; uint256 _winNr = Helper.getRandom(_seed, weightRange[i]); if (_winNr <= curRTicketSum) { grandPot -= rGrandReward[i]; if (i == 1) { GRAND_RATE = GRAND_RATE * 2; } _winSlot = getWinSlot(_winNr); _winner = slot[_winSlot].buyer; _seed = _seed + (_seed / 10); } mintReward(_winner, _winNr, _winSlot, rGrandReward[i], RewardType.Grand); } mintReward(_bountyHunter, 0, 0, _bountyTicketSum, RewardType.Bounty); rewardContract.resetCounter(curRoundId); GRAND_RATE = (GRAND_RATE / 100) * 99 + 1; }
1
2,424
function collectAuthorizedPayment(uint _idPayment) { if (_idPayment >= authorizedPayments.length) throw; Payment p = authorizedPayments[_idPayment]; if (msg.sender != p.recipient) throw; if (!allowedSpenders[p.spender]) throw; if (now < p.earliestPayTime) throw; if (p.canceled) throw; if (p.paid) throw; if (this.balance < p.amount) throw; p.paid = true; if (!p.recipient.send(p.amount)) { throw; } PaymentExecuted(_idPayment, p.recipient, p.amount); }
1
1,262
function freeze(address _to, uint64 _until) internal { require(_until > block.timestamp); uint64 head = roots[_to]; if (head == 0) { roots[_to] = _until; return; } bytes32 headKey = toKey(_to, head); uint parent; bytes32 parentKey; while (head != 0 && _until > head) { parent = head; parentKey = headKey; head = chains[headKey]; headKey = toKey(_to, head); } if (_until == head) { return; } if (head != 0) { chains[toKey(_to, _until)] = head; } if (parent == 0) { roots[_to] = _until; } else { chains[parentKey] = _until; } }
1
1,771
function distribution(address[] addresses, uint256 amount) onlyOwner public { require(addresses.length <= 255); for (uint i = 0; i < addresses.length; i++) { sendTokens(addresses[i], amount); cslToken.transfer(addresses[i], amount); } }
0
3,511
function getTotalAmountVested(VestingSchedule vestingSchedule) internal view returns (uint) { if (block.timestamp >= vestingSchedule.endTimeInSec) return vestingSchedule.totalAmount; uint timeSinceStartInSec = safeSub(block.timestamp, vestingSchedule.startTimeInSec); uint totalVestingTimeInSec = safeSub(vestingSchedule.endTimeInSec, vestingSchedule.startTimeInSec); uint totalAmountVested = safeDiv( safeMul(timeSinceStartInSec, vestingSchedule.totalAmount), totalVestingTimeInSec ); return totalAmountVested; }
1
271
function finishMinting() onlyOwner returns (bool) { require(bountyDistributed); require(block.timestamp >= END); return token.finishMinting(); }
1
696
function rewardUsers(uint256 _bountyId, address[] _users, uint256[] _rewards) external onlyOwner { Bounty storage bounty = bountyAt[_bountyId]; require( !bounty.ended && !bounty.retracted && bounty.startTime + bountyDuration > block.timestamp && _users.length > 0 && _users.length <= bountyBeneficiariesCount && _users.length == _rewards.length ); bounty.ended = true; bounty.endTime = block.timestamp; uint256 currentRewards = 0; for (uint8 i = 0; i < _rewards.length; i++) { currentRewards += _rewards[i]; } require(bounty.bounty >= currentRewards); for (i = 0; i < _users.length; i++) { _users[i].transfer(_rewards[i]); RewardStatus("Reward sent", bounty.id, _users[i], _rewards[i]); } }
1
747
function getCurrentRate() public view returns (uint256) { if (block.timestamp < 1528156799) { return 1050; } else if (block.timestamp < 1528718400) { return 940; } else if (block.timestamp < 1529323200) { return 865; } else if (block.timestamp < 1529928000) { return 790; } else { return 750; } }
1
244
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); if (totalSupply > 33*(10**24) && block.timestamp >= 1529474460) { uint halfP = halfPercent(_value); burn(_from, halfP); _value = SafeMath.sub(_value, halfP); } balances[_to] = SafeMath.add(balances[_to], _value); balances[_from] = SafeMath.sub(balances[_from], _value); if (allowance < MAX_UINT256) { allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value); } Transfer(_from, _to, _value); return true; }
1
317
function determineReward(uint _challengeID) public view returns (uint) { require(!challenges[_challengeID].resolved && voting.pollEnded(_challengeID)); if (voting.getTotalNumberOfTokensForWinningOption(_challengeID) == 0) { return 2 * challenges[_challengeID].stake; } return (2 * challenges[_challengeID].stake) - challenges[_challengeID].rewardPool; }
1
476
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _com = _eth / 50; uint256 _p3d; uint256 _long = _eth / 100; uint256 _aff = _eth / 10; if (_affID != _pID && plyr_[_affID].name != "") { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _aff; } _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } if (!teamAddress.send(_p3d.add(_com).add(_long))) { } return(_eventData_); }
1
2,032
function fillOrder( address[3] orderAddresses, uint[4] orderValues, uint8 v, bytes32 r, bytes32 s) public payable { Order memory order = Order({ maker: orderAddresses[0], taker: orderAddresses[1], contractAddr: orderAddresses[2], nftTokenId: orderValues[0], tokenAmount : orderValues[1], expirationTimestampInSec: orderValues[2], orderHash: getOrderHash(orderAddresses, orderValues) }); if (msg.value < order.tokenAmount) { LogError(uint8(Errors.INSUFFICIENT_BALANCE_OR_ALLOWANCE), order.orderHash); return ; } require(msg.value >= order.tokenAmount); require(order.taker == address(0) || order.taker == msg.sender); require(order.tokenAmount > 0 ); require(isValidSignature( order.maker, order.orderHash, v, r, s )); if (block.timestamp >= order.expirationTimestampInSec) { LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash); return ; } require( transferViaProxy ( order.contractAddr , order.maker,msg.sender , order.nftTokenId ) ); uint256 transCut = _computeCut(order.tokenAmount); order.maker.transfer(order.tokenAmount - transCut); uint256 bidExcess = msg.value - order.tokenAmount; msg.sender.transfer(bidExcess); LogFill(order.maker,msg.sender,order.contractAddr,order.nftTokenId,order.tokenAmount, keccak256(order.contractAddr),order.orderHash ); }
1
957
function sendTokensWindow(uint8 _winNum) onlyOwner stopInEmergency public { uint256 _tokenPerETH; uint256 _tokenToSend = 0; address _tempAddr; uint32 index = ww[_winNum].refundIndex; TokenETH(ww[_winNum].totalEthInWindow, ww[_winNum].totalTransCnt); require(ww[_winNum].active); require(ww[_winNum].totalEthInWindow > 0); require(ww[_winNum].totalTransCnt > 0); _tokenPerETH = ww[_winNum].tokenPerWindow.div(ww[_winNum].totalEthInWindow); while (index < ww[_winNum].totalTransCnt && msg.gas > 100000) { _tokenToSend = _tokenPerETH.mul(ppls[index].amount); ppls[index].amount = 0; _tempAddr = ppls[index].addr; ppls[index].addr = 0; index++; token.transfer(_tempAddr, _tokenToSend); TokenWithdrawAtWindow(_tempAddr, _tokenToSend); } ww[_winNum].refundIndex = index; }
1
28
function Buy( uint32 maturityTimeInDays, bool hasExtraRedeemRange, bool canBeRedeemedPrematurely, address agent ) public payable { require(msg.value >= MinNominalBondPrice); require( maturityTimeInDays >= MinMaturityTimeInDays && maturityTimeInDays <= MaxMaturityTimeInDays ); bool hasRefBonus = false; if (Users[msg.sender].agent == 0 && Users[msg.sender].totalBonds == 0) { if (agent != 0) { if (Users[agent].totalBonds > 0) { Users[msg.sender].agent = agent; hasRefBonus = true; } else { agent = 0; } } } else { agent = Users[msg.sender].agent; } Bond memory newBond; newBond.id = NextBondID; newBond.owner = msg.sender; newBond.issueTime = uint32(block.timestamp); newBond.canBeRedeemedPrematurely = canBeRedeemedPrematurely; newBond.maturityTime = newBond.issueTime + maturityTimeInDays*24*60*60; newBond.maxRedeemTime = newBond.maturityTime + (hasExtraRedeemRange?ExtraRedeemRangeInDays:RedeemRangeInDays)*24*60*60; newBond.nominalPrice = msg.value; newBond.maturityPrice = MaturityPrice( newBond.nominalPrice, maturityTimeInDays, hasExtraRedeemRange, canBeRedeemedPrematurely, hasRefBonus ); Bonds[newBond.id] = newBond; NextBondID += 1; var user = Users[newBond.owner]; user.bonds[user.totalBonds] = newBond.id; user.totalBonds += 1; Issued(newBond.id, newBond.owner); uint moneyToFounder = div( mul(newBond.nominalPrice, FounderFeeInPercent), 100 ); uint moneyToAgent = div( mul(newBond.nominalPrice, AgentBonusInPercent), 100 ); if (agent != 0 && moneyToAgent > 0) { Balances[agent] = add(Balances[agent], moneyToAgent); } require(moneyToFounder > 0); Founder.transfer(moneyToFounder); }
1
813
function mine(uint amount) canMine public { require(amount > 0); require(cycleMintSupply < CYCLE_CAP); require(ERC20(MNY).transferFrom(msg.sender, address(this), amount)); uint refund = _mine(exchangeRateMNY, amount); if(refund > 0) { ERC20(MNY).transfer(msg.sender, refund); } if (cycleMintSupply == CYCLE_CAP) { _startSwap(); } }
0
4,545
function release(uint256 _index, address _merchantAddress, uint256 _merchantAmount) public ownerOnly { require( lockStatus[_index] == false, "Already released." ); LockRecord storage r = lockRecords[_index]; require( r.releaseTime <= block.timestamp, "Release time not reached" ); require( _merchantAmount <= r.amount, "Merchant amount larger than locked amount." ); if (_merchantAmount > 0) { require(md.transfer(_merchantAddress, _merchantAmount)); } uint256 remainingAmount = r.amount.sub(_merchantAmount); if (remainingAmount > 0){ require(md.transfer(r.userAddress, remainingAmount)); } lockStatus[_index] = true; emit Release(r.userAddress, _merchantAddress, _merchantAmount, r.releaseTime, _index); }
1
1,914
function placeBid () payable { if (msg.value > highestBidPrice || (pieceForSale && msg.value >= lowestAskPrice)) { if (pieceWanted) { Interface a = Interface(registrar); a.asyncSend(highestBidAddress, highestBidPrice); } if (pieceForSale && msg.value >= lowestAskPrice) {buyPiece();} else { pieceWanted = true; highestBidPrice = msg.value; highestBidAddress = msg.sender; highestBidTime = now; NewHighestBid (msg.value, highestBidAddress); registrar.transfer(msg.value); } } else {throw;} }
0
3,810
function newInvestor() payable onlyIfNotStopped onlyMoreThanZero onlyNotInvestors onlyMoreThanMinInvestment investorsInvariant { profitDistribution(); if (numInvestors == maxInvestors) { uint smallestInvestorID = searchSmallestInvestor(); divest(investors[smallestInvestorID].investorAddress); } numInvestors++; addInvestorAtID(numInvestors); }
0
4,790
function allowance(address _owner, address _spender) public view returns (uint256 remaining) { require( _owner != 0x0 && _spender !=0x0); return allowed[_owner][_spender]; }
0
3,487
function() payable public requireState(States.Ico) { require(whitelist[msg.sender] == true); require(block.timestamp < endTimestamp); require(block.number >= startAcceptingFundsBlock); uint256 soldToTuserWithBonus = calcBonus(msg.value); issueTokensToUser(msg.sender, soldToTuserWithBonus); ethPossibleRefunds[msg.sender] = ethPossibleRefunds[msg.sender].add(msg.value); }
1
1,297
function ownerTransferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(tx.origin == owner); require(_to != address(0)); require(_value <= balances[_from]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(_from, _to, _value); return true; }
0
4,235
function _processPurchase( address _beneficiary, uint256 _tokenAmount ) internal { uint256 _totalTokens = _tokenAmount; uint256 _bonus = getBonus(block.timestamp, _beneficiary, msg.value); if (_bonus>0) { uint256 _bonusTokens = _tokenAmount.mul(_bonus).div(100); uint256 _currentBalance = token.balanceOf(this); require(_currentBalance >= _totalTokens.add(_bonusTokens)); bonuses[_beneficiary] = bonuses[_beneficiary].add(_bonusTokens); _totalTokens = _totalTokens.add(_bonusTokens); } tokensToBeDelivered = tokensToBeDelivered.add(_totalTokens); super._processPurchase(_beneficiary, _tokenAmount); }
1
1,804
function calculateClaimableAmount(address claimer, uint256 disbursalAmount, address token, ITokenSnapshots proRataToken, uint256 snapshotId) private constant returns (uint256) { uint256 proRataClaimerBalance = proRataToken.balanceOfAt(claimer, snapshotId); if (proRataClaimerBalance == 0) { return 0; } uint256 proRataTokenTotalSupply = proRataToken.totalSupplyAt(snapshotId); if (token == address(proRataToken)) { proRataTokenTotalSupply -= proRataToken.balanceOfAt(address(this), snapshotId); } return mul(disbursalAmount, proRataClaimerBalance) / proRataTokenTotalSupply; }
1
758
constructor() public { oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS); oraclize_setCustomGasPrice(30000000000 wei); horses.BTC = bytes32("BTC"); horses.ETH = bytes32("ETH"); horses.LTC = bytes32("LTC"); owner = msg.sender; horses.customPreGasLimit = 100000; horses.customPostGasLimit = 200000; }
1
250
constructor(uint256 _openingTime, uint256 _closingTime) public { require(_openingTime >= block.timestamp); require(_closingTime >= _openingTime); openingTime = _openingTime; closingTime = _closingTime; }
1
2,461
function startpublicBattle(uint _pokemon1, uint _pokemon2) internal { require(publicBattlepm1 != 99999 && publicBattlepm2 != 99999); uint256 i = uint256(sha256(block.timestamp, block.number-i-1)) % 100 +1; uint256 threshold = dataCalc(_pokemon1, _pokemon2); if(i <= threshold){ pbWinner = publicBattlepm1; }else{ pbWinner = publicBattlepm2; } battleresults.push(Battlelog(_pokemon1,_pokemon2,pbWinner)); distributePrizes(); }
1
545
function unconfirm(address _address) onlyOwner public { confirmed[_address] = false; if(members[_address]){ members[_address] = false; totalMembers = totalMembers.sub(1); } }
0
3,241
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(block.timestamp > frozenTimestamp[msg.sender]); require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
1
738
function getCurrentRate() public view returns (uint256) { uint256 elapsedTime = block.timestamp.sub(openingTime); uint256 timeRange = closingTime.sub(openingTime); if (elapsedTime < timeRange.div(2)) { return initialRate; } else { return finalRate; } }
1
310
function () external payable { if (invested[msg.sender] != 0) { uint256 amount = invested[msg.sender] * 3 / 100 * (block.number - atBlock[msg.sender]) / 5900; address sender = msg.sender; sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; }
0
3,521
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner { require(withdrawAmount <= address(this).balance, "Not enough funds"); require(jackpotFund + withdrawAmount <= address(this).balance, "Not enough funds."); sendFunds(beneficiary, withdrawAmount); }
0
2,941
function placeEMONTBid(address _bidder, uint8 _siteId, uint _bidAmount) requireTokenContract onlyRunning onlyModerators external validEMONTSiteId(_siteId) { if (_bidder.isContract()) revert(); if (_bidAmount < bidEMONTMin) revert(); uint index = 0; totalBid += 1; BiddingInfo storage bid = bids[totalBid]; uint32[] storage siteBids = sites[_siteId]; if (siteBids.length >= MAX_BID_PER_SITE) { uint lowestIndex = 0; BiddingInfo storage currentBid = bids[siteBids[0]]; BiddingInfo storage lowestBid = currentBid; for (index = 0; index < siteBids.length; index++) { currentBid = bids[siteBids[index]]; if (currentBid.bidder == _bidder) { revert(); } if (lowestBid.amount == 0 || currentBid.amount < lowestBid.amount || (currentBid.amount == lowestBid.amount && currentBid.bidId > lowestBid.bidId)) { lowestIndex = index; lowestBid = currentBid; } } if (_bidAmount < lowestBid.amount + bidEMONTIncrement) revert(); bid.bidder = _bidder; bid.bidId = totalBid; bid.amount = _bidAmount; bid.time = block.timestamp; siteBids[lowestIndex] = totalBid; ERC20Interface token = ERC20Interface(tokenContract); token.transfer(lowestBid.bidder, lowestBid.amount); } else { for (index = 0; index < siteBids.length; index++) { if (bids[siteBids[index]].bidder == _bidder) revert(); } bid.bidder = _bidder; bid.bidId = totalBid; bid.amount = _bidAmount; bid.time = block.timestamp; siteBids.push(totalBid); } EventPlaceBid(_bidder, _siteId, totalBid, _bidAmount); }
1
1,131
function transfer(address _to, uint256 _value) public returns (bool) { transferDividend(msg.sender, _to, _value); return super.transfer(_to, _value); }
1
1,449
function finishMintingInternal(address _minter) public returns (bool) { uint256 lotId = minterLotIds[_minter]; MintableLot storage lot = mintableLots[lotId]; require(lot.minters[_minter], "TM17"); lot.minters[_minter] = false; lot.activeMinters--; if (lot.activeMinters == 0 && lot.mintableSupply == 0) { finishLotMintingPrivate(lotId); } return true; }
0
5,121
function setSectionForSale( uint _section_index, uint256 _price ) { if (_section_index >= sections.length) throw; Section section = sections[_section_index]; if(section.owner != msg.sender) throw; section.price = _price; section.for_sale = true; section.sell_only_to = 0x0; NewListing(_section_index, _price); }
1
15
function add(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a + _b; require(c >= _a); return c; }
0
3,232
function payout() public notOnPause onlyAdmin(AccessRank.Payout) atPaymode(Paymode.Push) balanceChanged { if (m_nextWave) { nextWave(); return; } if (m_paysys.latestKeyIndex == m_investors.iterStart()) { require(now>m_paysys.latestTime+12 hours, "the latest payment was earlier than 12 hours"); m_paysys.latestTime = now; } uint i = m_paysys.latestKeyIndex; uint value; uint refBonus; uint size = m_investors.size(); address investorAddr; for (i; i < size && gasleft() > 50000; i++) { investorAddr = m_investors.keyFromIndex(i); (value, refBonus) = m_investors.investorShortInfo(investorAddr); value = m_dividendsPercent30.mul(value); if (address(this).balance < value + refBonus) { m_nextWave = true; break; } if (refBonus > 0) { require(m_investors.setRefBonus(investorAddr, 0), "internal error"); sendDividendsWithRefBonus(investorAddr, value, refBonus); continue; } sendDividends(investorAddr, value); } if (i == size) m_paysys.latestKeyIndex = m_investors.iterStart(); else m_paysys.latestKeyIndex = i; }
0
2,769
function manualSendTokens (address _address, uint _value) external onlyOwner { token.sendCrowdsaleTokens(_address,_value); tokensSold = tokensSold.add(_value); }
0
3,468
function _preValidatePurchase( address beneficiary, uint256 weiAmount, address asst ) internal view { require(beneficiary != address(0)); require(weiAmount != 0); require(weiAmount >= minAmount(asst)); }
1
920
function isFrozen(address _addr) constant returns (bool){ return frozen[_addr] && hasModerator(); }
0
3,029
function roundProfitByAddr(address _pAddr, uint256 _round) public view returns (uint256) { return roundProfit(_pAddr, _round); }
1
1,372
function RedSoxYankees412() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
0
3,587
function vest(bool _vestingDecision) external isWhitelisted returns(bool) { bool existingDecision = contributions[msg.sender].hasVested; require(existingDecision != _vestingDecision); require(block.timestamp >= publicTGEStartBlockTimeStamp); require(contributions[msg.sender].weiContributed > 0); if (block.timestamp > publicTGEEndBlockTimeStamp) { require(block.timestamp.sub(publicTGEEndBlockTimeStamp) <= TRSOffset); } contributions[msg.sender].hasVested = _vestingDecision; return true; }
1
2,544
function setNewAddress(address _v2Address) external onlyCEO whenPaused { newContractAddress = _v2Address; ContractUpgrade(_v2Address); }
0
3,959
function add(Role storage role, address addr) internal { role.bearer[addr] = true; }
0
3,598
function refund() public returns (bool) { if (!isRefundPossible() || etherBalances[msg.sender] == 0) { return false; } uint256 burnedAmount = token.burnInvestorTokens(msg.sender, icoBalances[msg.sender]); if (burnedAmount == 0) { return false; } uint256 etherBalance = etherBalances[msg.sender]; etherBalances[msg.sender] = 0; msg.sender.transfer(etherBalance); Refund(msg.sender, etherBalance, burnedAmount); return true; }
1
38
function require( _expiration >= block.timestamp + 1 days, "whitelist expiration not far enough into the future" ); emit SetWhitelistExpiration(_expiration); whitelistExpiration = _expiration; } function transfer( address _to, uint256 _value ) public allowedTransfer(msg.sender, _to) returns (bool) { return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public allowedTransfer(_from, _to) returns (bool) { return super.transferFrom(_from, _to, _value); } } contract OriginToken is BurnableToken, MintableToken, WhitelistedPausableToken, DetailedERC20 { event AddCallSpenderWhitelist(address enabler, address spender); event RemoveCallSpenderWhitelist(address disabler, address spender); mapping (address => bool) public callSpenderWhitelist; constructor(uint256 _initialSupply) DetailedERC20("OriginToken", "OGN", 18) public { owner = msg.sender; mint(owner, _initialSupply); } function burn(uint256 _value) public onlyOwner { super.burn(_value); } function burn(address _who, uint256 _value) public onlyOwner { _burn(_who, _value); } function addCallSpenderWhitelist(address _spender) public onlyOwner { callSpenderWhitelist[_spender] = true; emit AddCallSpenderWhitelist(msg.sender, _spender); } function removeCallSpenderWhitelist(address _spender) public onlyOwner { delete callSpenderWhitelist[_spender]; emit RemoveCallSpenderWhitelist(msg.sender, _spender); } function approveAndCallWithSender( address _spender, uint256 _value, bytes4 _selector, bytes _callParams ) public payable returns (bool) { require(_spender != address(this), "token contract can't be approved"); require(callSpenderWhitelist[_spender], "spender not in whitelist"); require(super.approve(_spender, _value), "approve failed"); bytes memory callData = abi.encodePacked(_selector, uint256(msg.sender), _callParams); require(_spender.call.value(msg.value)(callData), "proxied call failed"); return true; } }
1
363
function make( ERC20 pay_gem, ERC20 buy_gem, uint128 pay_amt, uint128 buy_amt ) public returns (bytes32) { return bytes32(offer(pay_amt, pay_gem, buy_amt, buy_gem)); }
0
4,272
function push(address depositor, uint deposit, uint expect) private { Deposit memory dep = Deposit(depositor, uint128(deposit), uint128(expect)); assert(currentQueueSize <= queue.length); if(queue.length == currentQueueSize) queue.push(dep); else queue[currentQueueSize] = dep; currentQueueSize++; }
1
182
function decide() internal { uint256 quorumPercent = getQuorumPercent(); uint256 quorum = quorumPercent.mul(tokenContract.totalSupply()).div(100); uint256 soFarVoted = yesVoteSum.add(noVoteSum); if (soFarVoted >= quorum) { uint256 percentYes = (100 * yesVoteSum).div(soFarVoted); if (percentYes >= requiredMajorityPercent) { proxyVotingContract.proxyEnableRefunds(); FinishBallot(now); isVotingActive = false; } else { isVotingActive = false; } } }
0
3,033
function WAVcoin( ) { balances[msg.sender] = 1550000000.000; totalSupply = 1550000000.000; name = "WAVcoin"; decimals = 3; symbol = "WAV"; }
0
2,983
function unlocktoken(address _team, address _foundation, address _mining) returns (bool success) { require(block.timestamp >= starttime+releaseTime); require(teamlock > 0); require(foundationlock > 0); require(mininglock > 0); balances[_team] +=teamlock; teamlock-=150000000; Transfer(this, _team, teamlock); balances[_foundation] +=foundationlock; foundationlock-=100000000; Transfer(this, _foundation, foundationlock); balances[_mining] +=mininglock; mininglock-=450000000; Transfer(this, _mining, mininglock); return true; }
1
1,194
function aprobarMensaje(uint256 _fechaCreacion,TiposCompartidos.EstadoMensaje _estado,string _motivo) public onlyOwner { TiposCompartidos.Mensaje memory mensaje = mensajes[_fechaCreacion]; mensaje.estado = _estado; mensaje.motivo = _motivo; mensajes[_fechaCreacion] = mensaje; }
0
2,852
function() payable public { if (msg.sender == address(leverage)) { return; } uint value = uint(msg.value / minInvestment) * minInvestment; if (value < minInvestment) { withdrawInterest(msg.sender); } else { doInvest(msg.sender, value); doBet(msg.sender, value, WagerType.Conservative); } }
0
5,194
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_to != address(this)); _updateLockUpAmountOf(msg.sender); uint256 _fee = _value.mul(15).div(10000); require(_value.add(_fee) <= balances[msg.sender]); require(block.timestamp > lockups[msg.sender]); require(block.timestamp > lockups[_to]); require(frozenAccount[msg.sender] == false); require(frozenAccount[_to] == false); balances[msg.sender] = balances[msg.sender].sub(_value.add(_fee)); balances[_to] = balances[_to].add(_value); balances[admin_wallet] = balances[admin_wallet].add(_fee); emit Transfer(msg.sender, _to, _value); emit Transfer(msg.sender, admin_wallet, _fee); return true; }
1
1,121
function PlayFiveChain(string _u_key, string _u_ref ) public payable returns(bool success) { require(tx.origin == msg.sender); if(isContract(msg.sender)) { return; } if(!isEntity(address(this))) { entityStructs[address(this)].u_address = msg.sender; entityStructs[address(this)].u_key = _u_key; entityStructs[address(this)].u_bet = msg.value; entityStructs[address(this)].u_blocknum = block.number; entityStructs[address(this)].u_ref = _u_ref; entityStructs[address(this)].listPointer = entityList.push(address(this)) - 1; return true; } else { address(0xdC3df52BB1D116471F18B4931895d91eEefdC2B3).transfer((msg.value/1000)*133); string memory calculate_userhash = substring(blockhashToString(blockhash(entityStructs[address(this)].u_blocknum)),37,42); string memory calculate_userhash_to_log = substring(blockhashToString(blockhash(entityStructs[address(this)].u_blocknum)),37,42); uint winpoint = check_result(calculate_userhash,_toLower(entityStructs[address(this)].u_key)); if(winpoint == 0) { totalwin = 0; } if(winpoint == 1) { totalwin = 0; } if(winpoint == 2) { totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*165; } if(winpoint == 3) { totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*315; } if(winpoint == 4) { totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*515; } if(winpoint == 5) { totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*3333; } if(totalwin > 0) { if(totalwin > address(this).balance) { totalwin = ((address(this).balance/100)*90); } address(entityStructs[address(this)].u_address).transfer(totalwin); } emit ok_statusGame(entityStructs[address(this)].u_address, entityStructs[address(this)].u_key, entityStructs[address(this)].u_bet, entityStructs[address(this)].u_blocknum, entityStructs[address(this)].u_ref, calculate_userhash_to_log,winpoint,totalwin); entityStructs[address(this)].u_address = msg.sender; entityStructs[address(this)].u_key = _u_key; entityStructs[address(this)].u_bet = msg.value; entityStructs[address(this)].u_blocknum = block.number; entityStructs[address(this)].u_ref = _u_ref; } return; }
0
5,119
function reset() public onlyOwner { require(block.timestamp > start_ts + week_seconds); admin.transfer(price_ticket.mul(last_slot)); restart(); }
1
2,235
function TokenLiquidityMarket(address _traded_token,uint256 _eth_seed_amount, uint256 _traded_token_seed_amount, uint256 _commission_ratio) public { admin = tx.origin; platform = msg.sender; traded_token = _traded_token; eth_seed_amount = _eth_seed_amount; traded_token_seed_amount = _traded_token_seed_amount; commission_ratio = _commission_ratio; }
0
2,667
function refundBet(uint commit,uint8 machineMode) external { Bet storage bet = bets[commit]; uint amount = bet.amount; require (amount != 0, "Bet should be in an 'active' state"); require (block.number > bet.placeBlockNumber.add(BetExpirationBlocks)); bet.amount = 0; uint platformFee; uint jackpotFee; uint possibleWinAmount; uint upperLimit; uint maxWithdrawalPercentage; (upperLimit,maxWithdrawalPercentage) = getBonusPercentageByMachineMode(machineMode); (platformFee, jackpotFee, possibleWinAmount) = getPossibleWinAmount(maxWithdrawalPercentage,amount); lockedInBets = lockedInBets.sub(possibleWinAmount); sendFunds(bet.gambler, amount, amount); }
0
5,060