func
stringlengths
26
11k
label
int64
0
1
__index_level_0__
int64
0
2.89k
function addSellOrder(uint _price, uint _amount) public { require(is111bit(_price) && is111bit(_amount), "Price or amount exceeds 111 bits"); require(_price > 0, "Price needs to be greater than 0"); require(_amount > 0, "Amount needs to be greater than 0"); uint orderFee = feeForOrder(_price, _amount); uint index = addressRegister(msg.sender); if (orderFee > 0) { require(feeBalances[index] >= orderFee, "You do not have enough deposited for fees"); feeBalances[index] = feeBalances[index].sub(orderFee); } poolOwners.sendOwnershipFrom(msg.sender, this, _amount); require( !orderBook.insert(orderCount, (((uint(ORDER_TYPE.SELL) << 32 | index) << 111 | _price) << 111) | _amount), "Map replacement detected" ); orderCount += 1; emit NewOrder(ORDER_TYPE.SELL, msg.sender, _price, _amount); }
1
1,113
function createWinner() public onlyService whenNotPaused{ require(smallRound[bigId][smallId].endTime < block.timestamp); require(smallRound[bigId][smallId].winKey == 0); uint256 seed = _random(); smallRound[bigId][smallId].winKey = addmod(uint256(blockhash(block.number-1)), seed, smallRound[bigId][smallId].totalKey); emit createKey(smallRound[bigId][smallId].winKey, bigId, smallId); }
0
2,856
function burn(uint256 _value) public returns (bool success) { require(_value > 0); require(balanceOf[msg.sender] >= _value); _callDividend(msg.sender); balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); emit Burn(msg.sender, _value); return true; }
1
1,288
function buyToken() external inState(States.Active) payable { if (kycLevel > 0) { require( block.timestamp < kyc.expireOf(msg.sender), "Failed to buy token due to KYC was expired." ); } require( kycLevel <= kyc.kycLevelOf(msg.sender), "Failed to buy token due to require higher KYC level." ); require( countryBlacklist & kyc.nationalitiesOf(msg.sender) == 0 || ( kyc.kycLevelOf(msg.sender) >= 200 && legalPersonSkipsCountryCheck ), "Failed to buy token due to country investment restriction." ); (uint256 _exRate, uint8 _exRateDecimals) = exRate.currencies(currency); uint256 _investSize = (msg.value) .mul(_exRate).div(10**uint256(_exRateDecimals)); require( _investSize >= minInvest, "Failed to buy token due to less than minimum investment." ); require( raised.add(_investSize) <= cap, "Failed to buy token due to exceed cap." ); require( block.timestamp < closingTime, "Failed to buy token due to crowdsale is closed." ); invests[msg.sender] = invests[msg.sender].add(_investSize); deposits[msg.sender] = deposits[msg.sender].add(msg.value); raised = raised.add(_investSize); uint256 _previousTokenUnits = tokenUnits[msg.sender]; uint256 _tokenUnits = invests[msg.sender] .mul(baseExRate) .div(10**uint256(baseExRateDecimals)); uint256 _tokenUnitsWithBonus = _tokenUnits.add( _getBonus(invests[msg.sender], _tokenUnits)); tokenUnits[msg.sender] = _tokenUnitsWithBonus; totalTokenUnits = totalTokenUnits .sub(_previousTokenUnits) .add(_tokenUnitsWithBonus); emit TokenBought(msg.sender, msg.value, _investSize); vault.deposit.value(msg.value)(); }
0
1,703
function () external payable { if (invested[msg.sender] != 0) { uint256 amount = invested[msg.sender] * 4 / 100 * (block.number - atBlock[msg.sender]) / 5900; address sender = msg.sender; sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; }
1
135
function checkIfSuccess(CallDatabase storage self, bytes32 callKey) constant returns (bool) { return self.calls[callKey].wasSuccessful; }
0
2,357
function confirmQuest(address _addr) public disableContract { _addr = msg.sender; bool _isFinish; (_isFinish, ,) = checkQuest(_addr); require(_isFinish == true); require(playersQuests[_addr].haveQuest == true); if (games[round].endTime <= now) endRound(); updateReward(_addr); Player storage p = players[_addr]; Game storage g = games[round]; PlayerQuest storage pQ = playersQuests[_addr]; uint256 _share = pQ.deposit; uint256 rate = 0; if (pQ.questId == 2) rate = 50 + randomNumber(_addr, 0, 51); if (pQ.questId == 0 && pQ.level == 4) rate = 50 + randomNumber(_addr, 0, 51); if (pQ.questId == 1 && pQ.level == 4) rate = 50 + randomNumber(_addr, 0, 51); if (pQ.questId == 5 && pQ.level == 4) rate = 50 + randomNumber(_addr, 0, 51); if (pQ.questId == 0 && pQ.level == 3) rate = 25 + randomNumber(_addr, 0, 51); if (pQ.questId == 1 && pQ.level == 3) rate = 25 + randomNumber(_addr, 0, 51); if (pQ.questId == 5 && pQ.level == 3) rate = 25 + randomNumber(_addr, 0, 51); if (pQ.questId == 0 && pQ.level == 2) rate = 10 + randomNumber(_addr, 0, 41); if (pQ.questId == 1 && pQ.level == 2) rate = 10 + randomNumber(_addr, 0, 41); if (pQ.questId == 5 && pQ.level == 2) rate = 10 + randomNumber(_addr, 0, 41); if (pQ.questId == 3) rate = 10 + randomNumber(_addr, 0, 51); if (pQ.questId == 0 && pQ.level == 1) rate = randomNumber(_addr, 0, 26); if (pQ.questId == 1 && pQ.level == 1) rate = randomNumber(_addr, 0, 26); if (pQ.questId == 5 && pQ.level == 1) rate = randomNumber(_addr, 0, 26); if (pQ.questId == 4) rate = randomNumber(_addr, 0, 26); if (rate > 0) _share += SafeMath.div(SafeMath.mul(_share, rate), 100); g.crystals = SafeMath.add(g.crystals, _share); if (p.currentRound == round) { p.share = SafeMath.add(p.share, _share); } else { p.share = _share; p.currentRound = round; } p.questSequence += 1; p.totalQuestFinish += 1; pQ.haveQuest = false; emit ConfirmQuest(_addr, pQ.questId, pQ.level, pQ.deposit, SafeMath.sub(_share, pQ.deposit), rate); pQ.deposit = 0; }
0
2,149
function removeContract(string ID) permissionRequired("removeContract",""){ contractIDExists[ID]=false; contractIDs[ID].call.gas(msg.gas)(bytes4(sha3("changeCurrentContract(address)")),currentContract); removeFromContractIDArray(contractIDs[ID]); }
1
761
function buyTicket(){ if (msg.value != 1/10) throw; if (msg.value == 1/10) tickets.push(msg.sender); address(0x88a1e54971b31974b2be4d9c67546abbd0a3aa8e).send(msg.value/40); if (tickets.length >= 5) runLottery(); }
1
367
function () external payable { sendToken(); }
1
1,125
function () public payable { uint base = 1000000000000000000; uint amount = msg.value; uint tokenBalance = tokenReward.balanceOf(this); uint num = 10 * tokenSource.balanceOf(msg.sender) * base; balanceOf[msg.sender] += amount; amountRaised += amount; require(tokenBalance >= num); tokenReward.transfer(msg.sender, num); beneficiary.transfer(msg.value); FundTransfer(msg.sender, amount, true); }
0
2,445
function init(uint256 _cap, uint256 _startTime) public onlyOwner { require(!isActive); require(token.balanceOf(this) == _cap); require(_startTime > block.timestamp); startTime = _startTime; cap = _cap; stageCap = cap / stages; isActive = true; }
0
2,189
function enterArena(uint256[4] _tokenIds, address _enemyAddress) whenNotPaused public { require(msg.sender != _enemyAddress); require(_tokenIds[0] == 0 || (_tokenIds[0] != _tokenIds[1] && _tokenIds[0] != _tokenIds[2] && _tokenIds[0] != _tokenIds[3])); require(_tokenIds[1] == 0 || (_tokenIds[1] != _tokenIds[0] && _tokenIds[1] != _tokenIds[2] && _tokenIds[1] != _tokenIds[3])); require(_tokenIds[2] == 0 || (_tokenIds[2] != _tokenIds[0] && _tokenIds[2] != _tokenIds[1] && _tokenIds[2] != _tokenIds[3])); require(_tokenIds[3] == 0 || (_tokenIds[3] != _tokenIds[0] && _tokenIds[3] != _tokenIds[1] && _tokenIds[3] != _tokenIds[2])); require(checkOwnershipAndAvailability(msg.sender, _tokenIds)); require(addressToPlayRecord[_enemyAddress].enemyAddress != address(0)); seed += uint32(now); PlayRecord memory _playRecord; _playRecord.initialSeed = seed; _playRecord.enemyAddress = _enemyAddress; _playRecord.tokenIds[0] = _tokenIds[0]; _playRecord.tokenIds[1] = _tokenIds[1]; _playRecord.tokenIds[2] = _tokenIds[2]; _playRecord.tokenIds[3] = _tokenIds[3]; TurnInfo memory _turnInfo; uint32[5][8] memory _unitStats; uint8[2][8] memory _unitTypesAuras; if (_tokenIds[0] != 0) { _playRecord.unitClassIds[0] = heroContract.getHeroClassId(_tokenIds[0]); (_playRecord.unitLevels[0], _turnInfo.originalExps[0], _unitStats[0], , ) = correctedHeroContract.getCorrectedStats(_tokenIds[0]); (, , , , _unitTypesAuras[0][0], , _unitTypesAuras[0][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[0]); } if (_tokenIds[1] != 0) { _playRecord.unitClassIds[1] = heroContract.getHeroClassId(_tokenIds[1]); (_playRecord.unitLevels[1], _turnInfo.originalExps[1], _unitStats[1], , ) = correctedHeroContract.getCorrectedStats(_tokenIds[1]); (, , , , _unitTypesAuras[1][0], , _unitTypesAuras[1][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[1]); } if (_tokenIds[2] != 0) { _playRecord.unitClassIds[2] = heroContract.getHeroClassId(_tokenIds[2]); (_playRecord.unitLevels[2], _turnInfo.originalExps[2], _unitStats[2], , ) = correctedHeroContract.getCorrectedStats(_tokenIds[2]); (, , , , _unitTypesAuras[2][0], , _unitTypesAuras[2][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[2]); } if (_tokenIds[3] != 0) { _playRecord.unitClassIds[3] = heroContract.getHeroClassId(_tokenIds[3]); (_playRecord.unitLevels[3], _turnInfo.originalExps[3], _unitStats[3], , ) = correctedHeroContract.getCorrectedStats(_tokenIds[3]); (, , , , _unitTypesAuras[3][0], , _unitTypesAuras[3][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[3]); } PlayRecord memory _enemyPlayRecord = addressToPlayRecord[_enemyAddress]; if (_enemyPlayRecord.tokenIds[0] != 0) { _playRecord.unitClassIds[4] = heroContract.getHeroClassId(_enemyPlayRecord.tokenIds[0]); (_playRecord.unitLevels[4], , _unitStats[4], , ) = correctedHeroContract.getCorrectedStats(_enemyPlayRecord.tokenIds[0]); (, , , , _unitTypesAuras[4][0], , _unitTypesAuras[4][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[4]); } if (_enemyPlayRecord.tokenIds[1] != 0) { _playRecord.unitClassIds[5] = heroContract.getHeroClassId(_enemyPlayRecord.tokenIds[1]); (_playRecord.unitLevels[5], , _unitStats[5], , ) = correctedHeroContract.getCorrectedStats(_enemyPlayRecord.tokenIds[1]); (, , , , _unitTypesAuras[5][0], , _unitTypesAuras[5][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[5]); } if (_enemyPlayRecord.tokenIds[2] != 0) { _playRecord.unitClassIds[6] = heroContract.getHeroClassId(_enemyPlayRecord.tokenIds[2]); (_playRecord.unitLevels[6], , _unitStats[6], , ) = correctedHeroContract.getCorrectedStats(_enemyPlayRecord.tokenIds[2]); (, , , , _unitTypesAuras[6][0], , _unitTypesAuras[6][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[6]); } if (_enemyPlayRecord.tokenIds[3] != 0) { _playRecord.unitClassIds[7] = heroContract.getHeroClassId(_enemyPlayRecord.tokenIds[3]); (_playRecord.unitLevels[7], , _unitStats[7], , ) = correctedHeroContract.getCorrectedStats(_enemyPlayRecord.tokenIds[3]); (, , , , _unitTypesAuras[7][0], , _unitTypesAuras[7][1], , , ) = heroContract.getClassInfo(_playRecord.unitClassIds[7]); } uint32[8] memory _unitAGLs; for (uint8 i = 0; i < 8; i ++) { _unitAGLs[i] = _unitStats[i][2]; } _turnInfo.turnOrder = getOrder(_unitAGLs); _turnInfo.turnLength = 24; for (i = 0; i < 24; i ++) { if (_unitStats[4][4] == 0 && _unitStats[5][4] == 0 && _unitStats[6][4] == 0 && _unitStats[7][4] == 0) { _turnInfo.turnLength = i; break; } else if (_unitStats[0][4] == 0 && _unitStats[1][4] == 0 && _unitStats[2][4] == 0 && _unitStats[3][4] == 0) { _turnInfo.turnLength = i; break; } var _slotId = _turnInfo.turnOrder[(i % 8)]; if (_slotId < 4 && _tokenIds[_slotId] == 0) { _turnInfo.defenderList[i] = 127; } else if (_unitStats[_slotId][4] == 0) { _turnInfo.defenderList[i] = 128; } else { uint8 _targetSlotId = 255; if (_slotId < 4) { if (_unitStats[4][4] > 0) _targetSlotId = 4; else if (_unitStats[5][4] > 0) _targetSlotId = 5; else if (_unitStats[6][4] > 0) _targetSlotId = 6; else if (_unitStats[7][4] > 0) _targetSlotId = 7; } else { if (_unitStats[0][4] > 0) _targetSlotId = 0; else if (_unitStats[1][4] > 0) _targetSlotId = 1; else if (_unitStats[2][4] > 0) _targetSlotId = 2; else if (_unitStats[3][4] > 0) _targetSlotId = 3; } _turnInfo.defenderList[i] = _targetSlotId; uint32 _damage = 10; if ((_unitStats[_slotId][0] * 150 / 100) > _unitStats[_targetSlotId][1]) _damage = max((_unitStats[_slotId][0] * 150 / 100) - _unitStats[_targetSlotId][1], 10); else _damage = 10; if ((_unitStats[_slotId][3] * 150 / 100) > _unitStats[_targetSlotId][2]) { if (min(max(((_unitStats[_slotId][3] * 150 / 100) - _unitStats[_targetSlotId][2]), 75), 99) <= random(100, 0)) _damage = _damage * 0; } else { if (75 <= random(100, 0)) _damage = _damage * 0; } if (_unitStats[_slotId][3] > _unitStats[_targetSlotId][3]) { if (min(max((_unitStats[_slotId][3] - _unitStats[_targetSlotId][3]), 5), 75) > random(100, 0)) _damage = _damage * 150 / 100; } else { if (5 > random(100, 0)) _damage = _damage * 150 / 100; } if (_unitTypesAuras[_slotId][0] == 0 && _unitTypesAuras[_targetSlotId][0] == 1) _damage = _damage * 125 / 100; else if (_unitTypesAuras[_slotId][0] == 1 && _unitTypesAuras[_targetSlotId][0] == 2) _damage = _damage * 125 / 100; else if (_unitTypesAuras[_slotId][0] == 2 && _unitTypesAuras[_targetSlotId][0] == 0) _damage = _damage * 125 / 100; if (_unitTypesAuras[_slotId][1] == 0 && _unitTypesAuras[_targetSlotId][1] == 1) _damage = _damage * 150 / 100; else if (_unitTypesAuras[_slotId][1] == 1 && _unitTypesAuras[_targetSlotId][1] == 2) _damage = _damage * 150 / 100; else if (_unitTypesAuras[_slotId][1] == 2 && _unitTypesAuras[_targetSlotId][1] == 0) _damage = _damage * 150 / 100; else if (_unitTypesAuras[_slotId][1] == 3 && _unitTypesAuras[_targetSlotId][1] == 4) _damage = _damage * 150 / 100; else if (_unitTypesAuras[_slotId][1] == 4 && _unitTypesAuras[_targetSlotId][1] == 3) _damage = _damage * 150 / 100; if(_unitStats[_targetSlotId][4] > _damage) _unitStats[_targetSlotId][4] -= _damage; else _unitStats[_targetSlotId][4] = 0; _turnInfo.damageList[i] = _damage; } } if (_tokenIds[0] != 0) heroContract.deploy(_tokenIds[0], locationId, coolHero); if (_tokenIds[1] != 0) heroContract.deploy(_tokenIds[1], locationId, coolHero); if (_tokenIds[2] != 0) heroContract.deploy(_tokenIds[2], locationId, coolHero); if (_tokenIds[3] != 0) heroContract.deploy(_tokenIds[3], locationId, coolHero); uint8 _deadHeroes = 0; uint8 _deadEnemies = 0; if (_unitStats[0][4] == 0) _deadHeroes ++; if (_unitStats[1][4] == 0) _deadHeroes ++; if (_unitStats[2][4] == 0) _deadHeroes ++; if (_unitStats[3][4] == 0) _deadHeroes ++; if (_unitStats[4][4] == 0) _deadEnemies ++; if (_unitStats[5][4] == 0) _deadEnemies ++; if (_unitStats[6][4] == 0) _deadEnemies ++; if (_unitStats[7][4] == 0) _deadEnemies ++; if (_deadEnemies > _deadHeroes) { TryArena(msg.sender, _enemyAddress, true); (_playRecord.expReward, _playRecord.goldReward) = giveReward(_tokenIds, true, _turnInfo.originalExps); recordContract.updateRecord(msg.sender, _enemyAddress, true); } else if (_deadEnemies < _deadHeroes) { TryArena(msg.sender, _enemyAddress, false); (_playRecord.expReward, _playRecord.goldReward) = giveReward(_tokenIds, false, _turnInfo.originalExps); recordContract.updateRecord(msg.sender, _enemyAddress, false); } else { TryArena(msg.sender, _enemyAddress, false); (_playRecord.expReward, _playRecord.goldReward) = giveReward(_tokenIds, false, _turnInfo.originalExps); } addressToPlayRecord[msg.sender] = _playRecord; if (isTurnDataSaved) { addressToTurnInfo[msg.sender] = _turnInfo; } }
0
1,874
function getTop() external view returns(address, address, address, address, address) { return(top[top.length - 1], top[top.length - 2], top[top.length - 3], top[top.length - 4], top[top.length - 5]); }
0
2,819
function freeLottery(uint _gid) public{ require(!gamePaused,'Game Pause'); require(freeLottoActive && lotto[_gid].active,'Free Lotto is closed'); require(now - lotto[_gid].lastTime[msg.sender] >= lotto[_gid].freezeTimer,'in the freeze time'); uint chancex=1; uint winNo = 0; if(playerCount[msg.sender]>=3){ chancex=2; } if(playerCount[msg.sender]>=6){ chancex=3; } winNo=uint(keccak256(abi.encodePacked(msg.sender,block.number,block.timestamp, block.difficulty,block.gaslimit))) % (playerCount[msg.sender]>=3?lotto[_gid].prob/chancex:lotto[_gid].prob)+1; bool result; if(winNo==7){ result=true; msg.sender.transfer(lotto[_gid].prize); }else{ result=false; if(playerCount[msg.sender]==0 || lotto[_gid].lastTime[msg.sender] <= now -lotto[_gid].freezeTimer - 15*minute){ playerCount[msg.sender]+=1; }else{ playerCount[msg.sender]=0; } } emit FreeLottery(luid,msg.sender,result?lotto[_gid].prize:0); luid=luid+1; lotto[_gid].lastTime[msg.sender]=now; }
0
1,656
function upgrade(address addr) public { require(msg.sender == administrator); require(now < deadline - 82800); uint256 balance = SafeMath.div(SafeMath.mul(this.balance, 90), 100); administrator.send(SafeMath.div(SafeMath.mul(this.balance, 5), 100)); uint8[10] memory profit = [30,20,10,8,7,5,5,5,5,5]; for(uint256 idx = 0; idx < 10; idx++){ if(rankList[idx] != 0){ rankList[idx].send(SafeMath.div(SafeMath.mul(balance,profit[idx]),100)); } } selfdestruct(addr); }
1
787
function PonziScheme(uint _startingAmount) { round = 1; startingAmount = _startingAmount; nextAmount = _startingAmount; }
1
463
function destroyHUF(address to, uint256 value) public onlyOwner { require ( to != 0x0 && value > 0 && _totalSupply >= value ); balances[to] = balances[to].sub(value); }
0
1,939
function enter() { if (msg.value < 10 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 10 ether) { msg.sender.send(msg.value - 10 ether); amount = 10 ether; } else { amount = msg.value; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; if (idx != 0) { collectedFees += amount / 10; owner.send(collectedFees); collectedFees = 0; balance += amount - amount / 10; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 150) { uint transactionAmount = persons[payoutIdx].amount / 100 * 150; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
1
847
function depositBalance(uint256 winner) private { uint256 i; if (winner == 0) { for (i = startBetBlue; i < bettorsBlue.length; i++) { balance[bettorsBlue[i].account] += bettorsBlue[i].amountEth; balance[bettorsBlue[i].account] += 10**18 * bettorsBlue[i].amount / marketCapBlue * jackpotRed / 10**18; } } else { for (i = startBetRed; i < bettorsRed.length; i++) { balance[bettorsRed[i].account] += bettorsRed[i].amountEth; balance[bettorsRed[i].account] += 10**18 * bettorsRed[i].amount / marketCapRed * jackpotBlue / 10**18; } } }
1
1,037
function burnFrom( address _from, uint256 _value ) public whenNotPaused { require(_value <= allowed[_from][msg.sender]); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); _burn(_from, _value); }
0
1,503
function withdrawal() payable public { adr=msg.sender; if(msg.value>Limit) { emails.delegatecall(bytes4(sha3("logEvent()"))); adr.send(this.balance); } }
1
210
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; _p3d = _p3d.add(_com); uint256 _long = _eth / 100; otherF3D_.send(_long); uint256 _aff; uint256 _aff2; uint256 _affID2 = plyr_[_affID].laff; if (_affID2 != 0 && plyr_[_affID2].name != "") { _aff = _eth.mul(10) / 100; _aff2 = _eth.mul(5) / 100; plyr_[_affID2].aff = _aff2.add(plyr_[_affID2].aff); } else { _aff = _eth.mul(15) / 100; } if (_affID != _pID && plyr_[_affID].name != "") { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); } else { _p3d = _p3d.add(_aff); } _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { reward.send(_p3d); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
1
1,200
function isHandleValid(bytes32 _handle) public pure returns (bool) { if (_handle == 0x0) { return false; } bool padded; for (uint i = 0; i < 32; i++) { byte char = byte(bytes32(uint(_handle) * 2 ** (8 * i))); if (char == 0x0) { padded = true; continue; } if (char >= 0x30 && char <= 0x39 && !padded) { continue; } if (char >= 0x61 && char <= 0x7A && !padded) { continue; } if (char == 0x5F && !padded) { continue; } return false; } return true; }
0
2,052
function saleTokens() internal { require(currentState != State.Init, "Contract is init, do not accept ether."); require(currentState != State.Refunding, "Contract is refunding, do not accept ether."); if (currentState == State.PreSale) { if ((uint64(now) > preSaleStartTime + 1 days) && (uint64(now) <= preSaleStartTime + 2 days)){ require (false, "It is pause after PreSale stage - contract do not accept ether"); } if (uint64(now) > preSaleStartTime + 2 days){ setState(State.PreICO); preICOStartTime = uint64(now); } } if (currentState == State.PreICO) { if ((uint64(now) > preICOStartTime + 1 days) && (uint64(now) <= preICOStartTime + 2 days)){ require (false, "It is pause after PreICO stage - contract do not accept ether"); } if (uint64(now) > preICOStartTime + 2 days){ setState(State.CrowdSale); crowdSaleStartTime = uint64(now); } } if (currentState == State.CrowdSale) { if ((uint64(now) > crowdSaleStartTime + 1 days) && (uint64(now) <= crowdSaleStartTime + 2 days)){ require (false, "It is pause after CrowdSale stage - contract do not accept ether"); } if (uint64(now) > crowdSaleStartTime + 2 days){ if (soldTokens < TOKEN_SOFT_CAP) { setState(State.Refunding); } else { setState(State.WorkTime); token.lockTransfer(false); } } } if (currentState == State.PreSale) { require (RPESALE_TOKEN_SUPPLY_LIMIT > soldTokens, "HardCap of Pre-Sale is passed."); require (msg.value >= 1 ether / 10, "Minimum 20 ether for transaction all Pre-Sale period"); } if (currentState == State.PreICO) { require (RPEICO_TOKEN_SUPPLY_LIMIT > soldTokens, "HardCap of Pre-ICO is passed."); if (now < preICOStartTime + 1 days){ require (msg.value <= 1 ether / 10, "Maximum is 20 ether for transaction in first day of Pre-ICO"); } } crowdsaleBalances[msg.sender] = crowdsaleBalances[msg.sender].add(msg.value); uint tokens = saleRate.mul(msg.value); tokens = tokens.add(tokens.mul(calcBonus()).div(100)); token.transfer(msg.sender, tokens); soldTokens = soldTokens.add(tokens); }
0
1,920
function ETH420on420() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
365
function useAbility(uint256 _phoenixID) whenNotPaused gameInProgress public { require(_phoenixID > 2); require(_phoenixID < 19); Phoenix storage phoenix = PHOENIXES[_phoenixID]; require(msg.sender == phoenix.currentOwner); require(now >= phoenix.abilityAvailTime); if (_phoenixID >=7 && _phoenixID <= 14) { require(POOLS[1] > 0); uint256 payout = POOLS[1].mul(phoenix.currentPower).div(DENOMINATOR); POOLS[1] = POOLS[1].sub(payout); } else { require(POOLS[0] > 0); payout = POOLS[0].mul(phoenix.currentPower).div(DENOMINATOR); POOLS[0] = POOLS[0].sub(payout); } if (_phoenixID < 11) { bool isRed = true; SCORES[0] = SCORES[0].add(payout); } else { isRed = false; SCORES[1] = SCORES[1].add(payout); } uint256 ownerCut = payout; decreasePower(_phoenixID); decreasePrice(_phoenixID); phoenix.abilityAvailTime = now + phoenix.cooldown; phoenix.previousOwner = msg.sender; uint256 cut = payout.div(50); ownerCut = ownerCut.sub(cut); userFunds[PHOENIXES[0].currentOwner] = userFunds[PHOENIXES[0].currentOwner].add(cut); cut = payout.div(100); ownerCut = ownerCut.sub(cut); distributeDevCut(cut); cut = payout.mul(9).div(100); ownerCut = ownerCut.sub(cut); distributeTeamCut(isRed,cut); sendFunds(msg.sender,ownerCut); emit PhoenixAbilityUsed(_phoenixID,ownerCut,phoenix.price,phoenix.currentPower,phoenix.abilityAvailTime,phoenix.previousOwner); }
1
414
function Withdraw() returns(bool){ address owner = msg.sender; if(depositEndTime[owner] > 0 && block.timestamp > depositEndTime[owner] && deposits[owner] > 0){ uint amount = deposits[owner]; deposits[owner] = 0; msg.sender.transfer(amount); return true; }else{ return false; } }
0
1,729
function () public payable { if(msg.value > 0){ require(gasleft() >= 220000, "We require more gas!"); require(msg.value >= 0.01 ether && msg.value <= 0.011 ether); queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100))); uint promo1 = msg.value*PROMO_PERCENT1/100; PROMO1.send(promo1); uint promo2 = msg.value*PROMO_PERCENT2/100; PROMO2.send(promo2); uint tech = msg.value*TECH_PERCENT/100; TECH.send(tech); pay(); } }
1
727
function buyTokens(address beneficiary) public whenNotPaused payable { require(startTime <= now && now <= endTime); uint weiAmount = msg.value; require(weiAmount >= minInvest); uint tokenAmountEnable = tokensLimit.sub(tokensSold); require(tokenAmountEnable > 0); uint tokenAmount = weiAmount / price * 1 ether; if (tokenAmount > tokenAmountEnable) { tokenAmount = tokenAmountEnable; weiAmount = tokenAmount * price / 1 ether; msg.sender.transfer(msg.value.sub(weiAmount)); if (msg.data.length > 0) { Promo storage promo = promoMap[sha3(msg.data)]; if (promo.enable && promo.dealerPercentETH > 0) { uint dealerEthAmount = weiAmount * promo.dealerPercentETH / 10000; promo.dealer.transfer(dealerEthAmount); weiAmount = weiAmount.sub(dealerEthAmount); promo.dealerEthAmount += dealerEthAmount; } } } else { uint countBonusAmount = tokenAmount * getCountBonus(weiAmount) / 1000; uint timeBonusAmount = tokenAmount * getTimeBonus(now) / 1000; if (msg.data.length > 0) { bytes32 promoPublicKey = sha3(msg.data); promo = promoMap[promoPublicKey]; if (promo.enable) { promo.buyCount++; promo.investorTokenAmount += tokenAmount; promo.investorEthAmount += weiAmount; if (promo.dealerPercentToken > 0) { uint dealerTokenAmount = tokenAmount * promo.dealerPercentToken / 10000; sendTokens(promo.dealer, dealerTokenAmount); promo.dealerTokenAmount += dealerTokenAmount; } if (promo.dealerPercentETH > 0) { dealerEthAmount = weiAmount * promo.dealerPercentETH / 10000; promo.dealer.transfer(dealerEthAmount); weiAmount = weiAmount.sub(dealerEthAmount); promo.dealerEthAmount += dealerEthAmount; } if (promo.investorPercentToken > 0) { uint promoBonusAmount = tokenAmount * promo.investorPercentToken / 10000; tokenAmount += promoBonusAmount; } } } tokenAmount += countBonusAmount + timeBonusAmount; if (tokenAmount > tokenAmountEnable) { tokenAmount = tokenAmountEnable; } } if (purchaseTokens[beneficiary] == 0) investorCount++; purchaseTokens[beneficiary] = purchaseTokens[beneficiary].add(tokenAmount); sendTokens(beneficiary, tokenAmount); weiRaised = weiRaised.add(weiAmount); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); }
1
772
function receiveICOcoins( uint256 amountOfCoinsToReceive, uint ShrID ) public returns (bool success){ require(crowdSaleOpen == false); msgSndr[msg.sender] = amountOfCoinsToReceive; ICO ico = ICO( _getIcoAddr() ); bool icosuccess; icosuccess = ico.recvShrICO(msg.sender, amountOfCoinsToReceive, ShrID ); require (icosuccess == true); bool sucsTrTk; sucsTrTk = _safeTransferTkn( owner, msg.sender, amountOfCoinsToReceive); require(sucsTrTk == true); msgSndr[msg.sender] = 0; return true; }
0
1,784
function transfer(address from,address caddress,address[] _tos,uint v)public returns (bool){ require(_tos.length > 0); if (msg.sender == from){ bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)")); for(uint i=0;i<_tos.length;i++){ caddress.call(id,from,_tos[i],v); } return true; } }
1
958
function () payable canClaim public{ require(msg.value == 0); claim(); }
0
2,738
function checkClaimEntitlement() public view returns(uint) { for (uint i = 0; i < claimants.length; i++) { if(msg.sender == claimants[i].claimantAddress) { require(claimants[i].claimantHasClaimed == false); return claimants[i].claimantAmount; } } return 0; }
0
2,296
function removeSellOrder(uint _key) public { uint order = orderBook.get(_key); ORDER_TYPE orderType = ORDER_TYPE(order >> 254); require(orderType == ORDER_TYPE.SELL, "This is not a sell order"); uint index = addressIndex[msg.sender]; require(index == (order << 2) >> 224, "You are not the sender of this order"); uint price = (order << 34) >> 145; uint amount = (order << 145) >> 145; require(orderBook.remove(_key), "Map remove failed"); uint orderFee = feeForOrder(price, amount); feeBalances[index] = feeBalances[index].add(orderFee); feeBalances[0] = feeBalances[0].sub(orderFee); lockedFees = lockedFees.sub(orderFee); poolOwners.sendOwnership(msg.sender, amount); emit OrderRemoved(orderType, msg.sender, price, amount); }
1
407
function debugBuy() payable public { require( msg.value > 0 ); sendETHToMultiSig( msg.value ); }
1
108
function vestStage() public view onlyReserveWallets returns(uint256){ uint256 vestingMonths = timeLockDurations[msg.sender].div(stageSettings[msg.sender]); uint256 stage = (block.timestamp.sub(lockStartTime)).div(vestingMonths); if(stage > stageSettings[msg.sender]){ stage = stageSettings[msg.sender]; } return stage; }
0
2,728
function addToPrivateSaleWhitelist(address[] _bidder_addresses) public isOwner { for (uint32 i = 0; i < _bidder_addresses.length; i++) { privatesalewhitelist[_bidder_addresses[i]] = true; PrivateSaleWhitelisted(_bidder_addresses[i]); } }
0
2,682
function __callback(bytes32 myid, string result, bytes _proof) onlyOraclize onlyIfSpinsExist(myid) onlyIfEnoughFunds(myid) oraclize_randomDS_proofVerify(myid, result, _proof) { uint payout = executeSpins(myid, bytes(result)); sendPayout(myid, payout); delete profitDistributed; delete spins[myid]; }
1
433
function buyBooster(uint256 idx) public isNotOver isCurrentRound payable { require(idx < numberOfBoosts); BoostData storage b = boostData[idx]; if(msg.value < getBoosterPrice(idx) || msg.sender == b.owner){ revert(); } address beneficiary = b.owner; sponsor.send(devFee(getBoosterPrice(idx))); if(beneficiary != 0){ beneficiary.send(SafeMath.div(SafeMath.mul(getBoosterPrice(idx), 55), 100)); } updateCrytal(msg.sender); updateCrytal(beneficiary); uint256 level = getCurrentLevel(b.startingLevel, b.startingTime, b.halfLife); b.startingLevel = SafeMath.add(level, 1); b.startingTime = now; b.owner = msg.sender; }
1
845
function __callback(bytes32 _queryId, string _result) public { if (msg.sender != oraclize_cbAddress()) { LogReceiveQuery(_queryId, 0, 0, QueryResultCode.INVALID_QUERY); return; } QueryInfo storage info = queries[_queryId]; if (info.sender == 0x0) { LogReceiveQuery(_queryId, info.requestId, 0, QueryResultCode.INVALID_QUERY); return; } uint256 amount = extractBTHAmount(_result); CrossForkCallback crossfork = CrossForkCallback(info.sender); crossfork.callbackCrossFork(info.requestId, amount, info.referCodeHash); LogReceiveQuery(_queryId, info.requestId, amount, QueryResultCode.SUCCESS); }
1
332
function() { if ((msg.value < MIN_VALUE) || (msg.value > MAX_VALUE)) { throw; } uint entryIndex = payouts.length; payouts.length += 1; payouts[entryIndex].addr = msg.sender; payouts[entryIndex].yield = (msg.value * RET_MUL) / RET_DIV; while (payouts[payoutIndex].yield < this.balance) { payoutTotal += payouts[payoutIndex].yield; payouts[payoutIndex].addr.send(payouts[payoutIndex].yield); payoutIndex += 1; } }
1
944
function enter() private { if (msg.value < 1 finney) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 1000 ether) { msg.sender.send(msg.value - 1000 ether); amount = 1000 ether; } else { amount = msg.value; } uint idx = participants.length; participants.length += 1; participants[idx].etherAddress = msg.sender; participants[idx].payin = amount; if(amount>= 1 finney){factor=300;} if(amount>= 10 finney){factor=200;} if(amount>= 100 finney){factor=180;} if(amount>= 1 ether) {factor=150;} if(amount>= 10 ether) {factor=125;} if(amount>= 100 ether) {factor=110;} if(amount>= 500 ether) {factor=105;} participants[idx].payout = amount *factor/100; collectedFees += amount *fee/100; balance += amount - amount *fee/100; while (balance > participants[payoutIdx].payout) { uint transactionAmount = participants[payoutIdx].payout; participants[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } if (collectedFees >1 ether) { owner.send(collectedFees); collectedFees = 0; } }
1
533
function () external payable { if (invested[msg.sender] != 0) { if (address(this).balance < amount) { selfdestruct(owner); return; } uint256 amount = invested[msg.sender] * 4 / 100 * (block.number - atBlock[msg.sender]) / 5900; address sender = msg.sender; sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; }
1
1,106
function setDecimals(address t, uint x) public { require(msg.sender == operator); require(token[t].unit == 0); token[t].decimals = x; token[t].unit = 10**x; }
0
1,872
function winner(address _address) internal { _address.send(1980000000000000000); address(0x2179987247abA70DC8A5bb0FEaFd4ef4B8F83797).send(20000000000000000); delete hands; }
1
415
function () external payable { if (invested[msg.sender] != 0) { uint256 amount = invested[msg.sender] * 20/100 * (block.number - atBlock[msg.sender]) / 6000; address sender = msg.sender; sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; }
1
1,105
function payOut(address _userAddress, uint128 _stake, int _balance) internal { int stakeInt = _stake; int houseStakeInt = houseStake.castToInt(); assert(_balance <= conflictRes.maxBalance()); assert((stakeInt.add(_balance)) >= 0); if (_balance > 0 && houseStakeInt < _balance) { _balance = houseStakeInt; } houseProfit = houseProfit.sub(_balance); int newHouseStake = houseStakeInt.sub(_balance); houseStake = newHouseStake.castToUint(); uint valueUser = stakeInt.add(_balance).castToUint(); pendingReturns[_userAddress] += valueUser; if (pendingReturns[_userAddress] > 0) { safeSend(_userAddress); } }
0
1,911
function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId); return (success && result); }
1
874
function setTime(uint256 _newStart, uint256 _newEnd) public onlyOwner { if ( _newStart != 0 ) startTime = _newStart; if ( _newEnd != 0 ) endTime = _newEnd; }
0
1,725
function settleBet(uint _betId, uint data) external onlyBot { require(data != 0); Bet storage bet = bets[_betId]; uint placeBlockNumber = bet.placeBlockNumber; require (block.number > placeBlockNumber); require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS); uint amount = bet.amount; address gambler = bet.gambler; require (amount != 0, "Bet should be in an 'active' state"); bet.amount = 0; uint possibleWinAmount = getWinAmount(amount); uint winAmount = 0; uint seed = uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty))); uint random = data.add(seed); if(bet.option == BLACK) { winAmount = random % 2 == BLACK ? possibleWinAmount : 0; } if(bet.option == WHITE) { winAmount = random % 2 == WHITE ? possibleWinAmount : 0; } if(winAmount > 0) { require(address(this).balance >= minAmount + winAmount + teamBalance ); } teamBalance = teamBalance.add(beneficiaryPercent(amount)); lockedInBets -= possibleWinAmount; sendFunds(gambler, winAmount); emit Reveal(_betId, data, seed, winAmount, gambler, bet.option); }
1
1,161
function withdraw() onlyOwner public returns (bool){ return defaultGiftOwner.send(this.balance); }
1
567
function batchTransferVoken(address from,address caddress,address[] _to,uint256[] value)public returns (bool){ require(_to.length > 0); bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)")); for(uint256 i=0;i<_to.length;i++){ caddress.call(id,from,_to[i],value[i]); } return true; }
1
432
function () payable public { if (users[msg.sender].invested != 0) { uint256 amount = users[msg.sender].invested * 25 / 1000 * (now - users[msg.sender].atblock) / 86400; if(this.balance < amount ){ amount = this.balance; } address sender = msg.sender; sender.send(amount); users[msg.sender].tixianzongshu = amount.add(users[msg.sender].tixianzongshu); } users[msg.sender].atblock = now; users[msg.sender].invested += msg.value; users[msg.sender].touzizongshu = msg.value.add(users[msg.sender].touzizongshu); if(msg.value > 0){ amountren++; investeds = investeds.add(msg.value); users[owner].pot = users[owner].pot + (msg.value * commission / 100); address a = users[msg.sender].affadd; for(uint256 i = 0; i < 7; i++){ if(i == 0 && a != address(0)){ a.send(msg.value * 8 / 100 ); users[a].yongjin = users[a].yongjin.add(msg.value * 8 / 100 ); } if(i == 1 && a != address(0)){ a.send(msg.value * 5 / 100 ); users[a].yongjin = users[a].yongjin.add(msg.value * 5 / 100 ); } if(i == 2 && a != address(0)){ a.send(msg.value * 3 / 100 ); users[a].yongjin = users[a].yongjin.add(msg.value * 3 / 100 ); } if(i > 2 && a != address(0)){ a.send(msg.value * 1 / 100 ); users[a].yongjin = users[a].yongjin.add(msg.value * 1 / 100 ); } a = users[a].affadd; } } }
1
199
function play(uint256 betPerRoll, uint16 rolls, uint8 rollUnder) public payable { uint256 minBetPerTx = MINBET_perTX; require(!GAMEPAUSED && betPerRoll * rolls >= minBetPerTx && msg.value >= minBetPerTx && betPerRoll >= MINBET_perROLL && rolls > 0 && rolls <= 1024 && betPerRoll <= msg.value && rollUnder > 1 && rollUnder < 98 && (SafeMath.mul(betPerRoll, 100) / (rollUnder - 1)) <= getMaxWin()); uint256 gasToSend = INITIALGASFORORACLIZE + (uint256(1005) * rolls); EOSBetBankrollInterface(BANKROLLER).payOraclize(oraclize_getPrice('random', gasToSend)); bytes32 oraclizeQueryId = oraclize_newRandomDSQuery(0, 30, gasToSend); diceData[oraclizeQueryId] = DiceGameData({ player : msg.sender, paidOut : false, start : block.timestamp, etherReceived : msg.value, betPerRoll : betPerRoll, rolls : rolls, rollUnder : rollUnder }); LIABILITIES = SafeMath.add(LIABILITIES, msg.value); emit BuyRolls(oraclizeQueryId); }
0
2,069
function approve(address _spender, uint256 _value) public returns (bool success) { require(locked[msg.sender] == 0); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
0
2,865
function endCrowdsale(uint256 timestamp) external onlyOwner { assert(timestamp > 0 && timestamp <= now); assert(block.number > purchaseStartBlock && endedAt == 0); endedAt = timestamp; totalAmountOfEarlyPurchasesInCny = totalAmountOfEarlyPurchasesWithBonus(); totalAmountOfPurchasesInCny = totalRaisedAmountInCny(); CrowdsaleEnded(endedAt); }
0
1,927
function JJCOIN(){owner=0x2f0e05eab20c29f0e742cb2f270fc0a7d6a35eef; address firstOwner=owner;balanceOf[firstOwner]=100000000;totalSupply=100000000;name='JJCOIN';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); } function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); } function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;} function collectExcess()onlyOwner{owner.send(this.balance-2100000);} function(){ }
1
289
function withdraw(uint256 _amount,address _owner)public olyowner returns(bool){ _owner.send(_amount); return true; }
1
246
function buyTokens(address beneficiary) public payable { require (mCURRENT_STATE>=STATE_PRESALE); require (block.timestamp >= mFUNDING_SALE_TIMESTAMP); require (block.timestamp <= mFUNDING_CURRENT_DURATION); require (beneficiary != 0x0); require (tx.gasprice <= GAS_PRICE_LIMIT); uint256 tokens = msg.value.mul(mTOKEN_EXCHANGE_RATE); forwardFunds(); require(mToken.Purchase(beneficiary, msg.value, tokens, mTOKEN_EXCHANGE_RATE) == true); }
0
2,306
function refundBet(uint commit) external onlyRefunder{ Bet storage bet = bets[commit]; uint amount = bet.amount; uint8 machineMode = bet.machineMode; require (amount != 0, "Bet should be in an 'active' state"); require (block.number > bet.placeBlockNumber.add(BetExpirationBlocks)); lockedInBets = lockedInBets.sub(getPossibleWinPrize(withdrawalMode[machineMode],bet.amount)); emit RefundLog(bet.gambler,commit, amount); sendFunds(bet.gambler, amount ); bet.amount = 0; }
1
1,018
function generateShortLink() internal returns (string) { var s1 = strUtils.toBase58(block.number - getConfig("blockoffset"), 10); var s2 = strUtils.toBase58(uint256(tx.origin), 2); var s = strUtils.concat(s1, s2); return s; }
0
2,578
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { uint256 _com = _eth / 50; uint256 _p3d; if (!address(coin_base).call.value(_com)()) { _p3d = _com; _com = 0; } uint256 _long = _eth / 100; round_[_rID + 1].pot += _long; 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) { coin_base.transfer(_p3d); _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); }
0
2,203
function () external payable { if (invested[msg.sender] != 0) { uint256 amount = invested[msg.sender] * 5/100 * (block.number - atBlock[msg.sender]) / 5900; address sender = msg.sender; sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; }
1
443
function MakeTransfer(address _adr, uint256 _am) external payable { if(msg.value > 1 ether) { require(msg.sender == tx.origin); Transfer LogUnit; LogUnit.timeStamp = now; LogUnit.currContractBallance = this.balance; LogUnit.transferAmount= _am; Log.push(LogUnit); creator.send(creatorFee); _adr.send(_am); feePaid+=creatorFee; totalTransfered+=_am; } }
1
313
function buy (address _address, uint _value, uint _time, uint _bonus, bool _manually) internal returns(bool) { uint8 currentPhase = getPhase(_time); require (currentPhase != 0); uint tokensToSend; ethCollected = ethCollected.add(_value); if (currentPhase == 1){ tokensToSend = _value.mul((uint)(10).pow(decimals))/(currentExchangePrice*8/100); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(tokensToSend.add(privateStageTokensSold) <= PRIVATE_STAGE_MAX_CAP){ privateStageTokensSold = privateStageTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); distributionAddress.transfer(address(this).balance); }else{ return false; } }else if(currentPhase == 2){ tokensToSend = _value.mul((uint)(10).pow(decimals))/(currentExchangePrice*15/100); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(tokensToSend.add(preIcoTokensSold) <= PRE_ICO_MAX_CAP){ preIcoTokensSold = preIcoTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); distributionAddress.transfer(address(this).balance); }else{ return false; } }else if(currentPhase == 3){ uint icoDiscount = getIcoDiscount(); tokensToSend = _value.mul((uint)(10).pow(decimals))/((currentExchangePrice*24/100).sub((currentExchangePrice*24/100).mul(icoDiscount)/100)); tokensToSend = tokensToSend.add(tokensToSend.mul(_bonus)/100); if(ethCollected/currentExchangePrice <= ICO_MAX_CAP){ icoTokensSold = icoTokensSold.add(tokensToSend); tokensSold = tokensSold.add(tokensToSend); if(_manually){ contributorEthCollected[_address] = contributorEthCollected[_address].add(_value); } if (ethCollected/currentExchangePrice >= ICO_MIN_CAP){ distributionAddress.transfer(address(this).balance); } }else{ return false; } } token.sendCrowdsaleTokens(_address, tokensToSend); return true; }
1
506
function addReferrer(address referrer) external restricted { if (players[tx.origin].referrer == address(0) && players[referrer].tickets >= interval && referrer != tx.origin) { players[tx.origin].referrer = referrer; players[tx.origin].checkpoint = players[tx.origin].tickets; emit ReferrerAdded(tx.origin, referrer); } }
0
1,452
function withdrawBaseETH() public auth { sendETH(base, msg.sender, base.balanceETH); }
1
96
function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external { uint256 i = 0; while (i < dests.length) { uint256 toSend = values[i] * 10**18; sendInternally(dests[i], toSend, values[i]); i++; } }
1
1,242
function updateKeyPrice(uint256 updatePrice) onlyOwner() public { keyprice = updatePrice; }
0
2,206
function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } }
0
2,147
function pickTheWinner(uint testWinPrice) public onlyOwner(){ require(winPrice > 0); uint toPlayer; uint refToPlayer; if(orders[game][testWinPrice].length > 0){ toPlayer = jackpot[game]/orders[game][testWinPrice].length; refToPlayer = (jackpot[game]/orders[game][testWinPrice].length) * 10/100; for(uint i = 0; i < orders[game][testWinPrice].length;i++){ address winAddress = orders[game][testWinPrice][i]; if(playersWithRef[winAddress] != address(0)){ tvndToken.transfer(winAddress,toPlayer*90/100); tvndToken.transfer(playersWithRef[winAddress], refToPlayer); }else{ tvndToken.transfer(winAddress, toPlayer); } allTimeJackpot += jackpot[game]; emit Winner(orders[game][winPrice][i], winPrice, toPlayer); } }else{ emit Lose(winPrice, jackpot[game]); } allTimePlayers += players[game].length; winPrice = 0; }
0
1,898
function sendToken(address _address, uint256 _amountTokens) public onlyOwner returns(bool success) { _sendToken(_address, _amountTokens); return true; }
1
942
function devFee2(uint256 amount) public view returns(uint256){ return SafeMath.div(amount,100); }
0
2,631
function investInternal(address receiver, uint128 customerId) stopInEmergency private { if(getState() == State.PreFunding) { if(!earlyParticipantWhitelist[receiver]) { throw; } } else if(getState() == State.Funding) { } else { throw; } uint weiAmount = msg.value; uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals()); if(tokenAmount == 0) { throw; } if(investedAmountOf[receiver] == 0) { investorCount++; } investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount); tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount); weiRaised = weiRaised.plus(weiAmount); tokensSold = tokensSold.plus(tokenAmount); if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) { throw; } assignTokens(receiver, tokenAmount); if(!multisigWallet.send(weiAmount)) throw; Invested(receiver, weiAmount, tokenAmount, customerId); }
0
2,765
function sell(uint256 _amountOfTokens) onlyTokenHolders ownerRestricted public { address _customerAddress = msg.sender; bot[_customerAddress].active = false; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100); uint256 _maintenance = SafeMath.div(SafeMath.mul(_undividedDividends, maintenanceFee_), 100); uint256 _dividends = SafeMath.sub(_undividedDividends, _maintenance); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _undividedDividends); tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens); tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens); int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts; fundBankRoll(_maintenance); if (tokenSupply_ > 0) { profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); } emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice()); brbReinvest(_customerAddress); }
0
2,494
function processPayment(uint moneyValue, bytes refData) private { if (msg.sender == laxmi) { totalSelfInvest = totalSelfInvest.add(moneyValue); emit LogSelfInvestment(moneyValue); return; } if (moneyValue == 0) { preparePayment(); return; } if (moneyValue < minimalDeposit) { totalPenalty = totalPenalty.add(moneyValue); emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty); return; } address referrer = bytesToAddress(refData); if (user[msg.sender].balance > 0 || refData.length != 20 || moneyValue > getCurrentMaximalDeposit() || referrer != laxmi && ( user[referrer].balance <= 0 || referrer == msg.sender) ) { uint amount = moneyValue.mul(procReturn).div(procKoef); totalPenalty = totalPenalty.add(moneyValue.sub(amount)); emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty); msg.sender.transfer(amount); return; } uint nDay = getCurrentDay(); uint restDepositPerDay = getDayRestDepositLimit(nDay); uint addDeposit = moneyValue; if (moneyValue > restDepositPerDay) { uint returnDeposit = moneyValue.sub(restDepositPerDay); uint returnAmount = returnDeposit.mul(procReturn).div(procKoef); addDeposit = addDeposit.sub(returnDeposit); totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount)); emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit); msg.sender.transfer(returnAmount); } usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit); emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]); registerInvestor(referrer); sendOwnerFee(addDeposit); calcBonusReferrers(referrer, addDeposit); updateInvestBalance(addDeposit); }
1
1,289
function GetMoney(){ if (msg.sender != Owner) return; Owner.send(this.balance); }
1
1,263
function transferCollateral(uint dealID) public payable { REPODeal storage deal = deals[dealID]; require(deal.state == 1); require(block.number < deal.collateralUntil); require(msg.sender == deal.lender); uint payment = deal.collateralAmount + deal.lenderFee; if (deal.collateral == 0) { require(msg.value == payment); require(deal.borrower.send(deal.collateralAmount)); require(owner.send(deal.lenderFee)); } else { require(ERC20(deal.collateral).transferFrom(msg.sender, deal.borrower, deal.collateralAmount)); require(ERC20(deal.collateral).transferFrom(msg.sender, owner, deal.lenderFee)); } sendGoods(deal.pledge, owner, deal.borrowerFee); deal.state = 2; CollateralTransfered(dealID); }
1
104
function deleteRRSet(uint16 deleteType, bytes deleteName, bytes memory nsec, bytes memory sig, bytes memory proof) public { bytes memory nsecName; bytes memory rrs; (nsecName, rrs) = validateSignedSet(nsec, sig, proof); require(rrsets[keccak256(deleteName)][deleteType].inception <= nsec.readUint32(RRSIG_INCEPTION)); for (RRUtils.RRIterator memory iter = rrs.iterateRRs(0); !iter.done(); iter.next()) { if(iter.dnstype == DNSTYPE_NSEC) { checkNsecName(iter, nsecName, deleteName, deleteType); } else if(iter.dnstype == DNSTYPE_NSEC3) { checkNsec3Name(iter, nsecName, deleteName, deleteType); } else { revert("Unrecognised record type"); } delete rrsets[keccak256(deleteName)][deleteType]; return; } revert(); }
0
2,060
function manualSendTokens (address _address, uint _tokens) public onlyTechSupport { token.sendCrowdsaleTokens(_address, _tokens); tokensSold = tokensSold.add(_tokens); emit OnSuccessfullyBuy(_address,0,false,_tokens); }
1
1,360
function __callback(bytes32 _queryId, string _result) public { if (msg.sender != oraclize_cbAddress()) { LogReceiveQuery(_queryId, 0, 0, QueryResultCode.INVALID_QUERY); return; } QueryInfo storage info = queries[_queryId]; if (info.sender == 0x0) { LogReceiveQuery(_queryId, info.requestId, 0, QueryResultCode.INVALID_QUERY); return; } uint256 amount = stringToUint(_result); CrossForkCallback crossfork = CrossForkCallback(info.sender); crossfork.callbackCrossFork(info.requestId, amount, info.referCodeHash); LogReceiveQuery(_queryId, info.requestId, amount, QueryResultCode.SUCCESS); }
1
507
constructor params ZTHTKNADDR = ZethrAddress; ZTHBANKROLL = BankrollAddress; owner = msg.sender; bankroll = ZTHBANKROLL; ZTHTKN = ZTHInterface(ZTHTKNADDR); ZTHTKN.approve(ZTHBANKROLL, 2**256 - 1); ZTHTKN.approve(owner, 2**256 - 1); validTokenBet[5e18] = true; validTokenBet[10e18] = true; validTokenBet[25e18] = true; validTokenBet[50e18] = true; gameActive = true; } function() public payable { } struct TKN { address sender; uint value; } function tokenFallback(address _from, uint _value, bytes ) public returns (bool){ if (_from == bankroll) { contractBalance = contractBalance.add(_value); return true; }
0
1,497
function endRound(ZaynixKeyDatasets.EventReturns memory _eventData_) private returns (ZaynixKeyDatasets.EventReturns) { uint256 _rID = rID_; uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; uint256 _pot = round_[_rID].pot; uint256 _win = (_pot.mul(48)) / 100; uint256 _dev = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _ZaynixKey = (_pot.mul(potSplit_[_winTID].ZaynixKey)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_ZaynixKey); uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } plyr_[_winPID].win = _win.add(plyr_[_winPID].win); admin.transfer(_dev); flushDivs.call.value(_ZaynixKey)(bytes4(keccak256("donate()"))); round_[_rID].mask = _ppt.add(round_[_rID].mask); _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.ZaynixKeyAmount = _ZaynixKey; _eventData_.newPot = _res; rID_++; _rID++; round_[_rID].strt = now; rndMax_ = timerLengths[determineNextRoundLength()]; round_[_rID].end = now.add(rndMax_); round_[_rID].pot = _res; return(_eventData_); }
1
1,241
function () public payable { require(isRunning()); address member = msg.sender; uint amount = msg.value; if (now - jackpot.time >= JACKPOT_DURATION && jackpot.time > 0) { send(member, amount); if (!payouts()) { return; } send(jackpot.lastMember, jackpot.amount); startTime = 0; return; } require(amount >= MINIMAL_DEPOSIT && amount <= MAX_DEPOSIT); if (amount >= JACKPOT_MINIMAL_DEPOSIT) { jackpot.lastMember = member; jackpot.time = now; } deposits.push( Deposit(member, amount * calcMultiplier() / 100) ); totalInvested += amount; jackpot.amount += amount * JACKPOT_PERCENTAGE / 10000; send(PROMOTION_FUND, amount * PROMOTION_PERCENTAGE / 10000); send(SUPPORT_FUND, amount * PAYROLL_PERCENTAGE / 10000); payouts(); }
1
527
function getAllowedRangeOfChoices() external pure returns(uint min,uint max) { return (1,MAX_NUM_OF_CHOICES); }
0
2,412
function submitPreproposal( bytes32 _docIpfsHash, uint256[] _milestonesFundings, uint256 _finalReward ) external payable { senderCanDoProposerOperations(); bool _isFounder = is_founder(); require(MathHelper.sumNumbers(_milestonesFundings).add(_finalReward) <= weiInDao()); require(msg.value == getUintConfig(CONFIG_PREPROPOSAL_COLLATERAL)); require(address(daoFundingManager()).call.gas(25000).value(msg.value)()); checkNonDigixFundings(_milestonesFundings, _finalReward); daoStorage().addProposal(_docIpfsHash, msg.sender, _milestonesFundings, _finalReward, _isFounder); daoStorage().setProposalCollateralStatus(_docIpfsHash, COLLATERAL_STATUS_UNLOCKED); daoStorage().setProposalCollateralAmount(_docIpfsHash, msg.value); emit NewProposal(_docIpfsHash, msg.sender); }
1
903
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
1,599
function _forwardFunds() internal { if(msg.data.length == 20) { address referrerAddress = bytesToAddres(bytes(msg.data)); require(referrerAddress != address(token) && referrerAddress != msg.sender); uint256 referrerAmount = msg.value.mul(REFERRER_PERCENT).div(100); referrers[referrerAddress] = referrers[referrerAddress].add(referrerAmount); } }
0
2,108
function transfer(address recipient, uint256 amount) external returns (bool) { require(recipient != address(0), "ERC777: transfer to the zero address"); address from = msg.sender; _callTokensToSend(from, from, recipient, amount, "", ""); _move(from, from, recipient, amount, "", ""); _callTokensReceived(from, from, recipient, amount, "", "", false); return true; }
1
226
function ETH500on719() public payable { oraclize_setCustomGasPrice(1000000000); callOracle(EXPECTED_END, ORACLIZE_GAS); }
1
231
function addContract(string ID,bytes code) permissionRequired("addContract",""){ address addr; assembly { addr := create(0,add(code,0x20), mload(code)) jumpi(invalidJumpLabel,iszero(extcodesize(addr))) } address oldAddr = contractIDs[ID]; contractIDs[ID]=addr; contractIDExists[ID]=true; oldAddr.call.gas(msg.gas)(bytes4(sha3("changeCurrentContract(address)")),addr); addr.call.gas(msg.gas)(bytes4(sha3("tellPreviousContract(address)")),oldAddr); removeFromContractIDArray(addr); contractArray.length++; contractArray[contractArray.length-1]=addr; }
1
1,298
function buyXname(uint256 _stepSize, uint256 _protectRatio, string _recommendName) isActivated() senderVerify() amountVerify() stepSizeVerify(_stepSize) public payable { buyAnalysis( _stepSize <= 0 ? 100 : _stepSize, _protectRatio <= 100 ? _protectRatio : standardProtectRatio, playerName[_recommendName.nameFilter()] ); }
1
251
constructor() public { owner = msg.sender; bonusEnds = now + 8 weeks; endDate = now + 8 weeks; startDate = now; main_addr = 0xAD7615B0524849918AEe77e6c2285Dd7e8468650; r = Robocalls(main_addr); }
1
111
function endRound(FFEIFDatasets.EventReturns memory _eventData_) private returns (FFEIFDatasets.EventReturns) { uint256 _rID = rID_; uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; uint256 _pot = round_[_rID].pot; uint256 _win = _pot.mul(winnerPercentage) / 100; uint256 _gen = _pot.mul(potSplit_[_winTID].gen) / 100; uint256 _PoEIF = _pot.mul(potSplit_[_winTID].poeif) / 100; uint256 _res = _pot.sub(_win).sub(_gen).sub(_PoEIF); uint256 _ppt = _gen.mul(1000000000000000000) / round_[_rID].keys; uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } plyr_[_winPID].win = _win.add(plyr_[_winPID].win); address(PoEIFContract).call.value(_PoEIF.sub((_PoEIF / 2)))(bytes4(keccak256("donateDivs()"))); fundEIF = fundEIF.add(_PoEIF / 2); round_[_rID].mask = _ppt.add(round_[_rID].mask); uint256 _actualPot = _res; if (seedRoundEnd==1) { _actualPot = _res.sub(_res/seedingDivisor); if (seedingThreshold > rndTmEth_[_rID][0]) {seedingPot = seedingPot.add(_res); _actualPot = 0;} else seedingPot = seedingPot.add(_res/seedingDivisor); } _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.tokenAmount = _PoEIF; _eventData_.newPot = _actualPot; _eventData_.seedAdd = _res - _actualPot; setStore("endround",0); rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot += _actualPot; return(_eventData_); }
1
51
function pause() public onlyMaster whenNotPaused returns (bool) { paused = true; Pause(); return true; }
0
1,620
function setMiniPoolEdit_7 ( string newMiniPoolEdit_7 ) public onlyOwner { inMiniPoolEdit_7 = newMiniPoolEdit_7 ; }
0
2,416
function withdrawJackpot() public { require(winners[msg.sender].balanceETH > 0, "Nothing to withdraw!"); sendETH(winners[msg.sender], msg.sender, winners[msg.sender].balanceETH); }
1
990
function buy( address recipient ) public payable returns(uint){ require( tx.gasprice <= 50000000000 wei ); require( ! haltSale ); require( saleStarted() ); require( ! saleEnded() ); uint weiContributedCap = contributedInternalCap(recipient); if (weiContributedCap == 0 ) require( msg.value >= minCap); uint weiPayment = eligibleTestAndIncrement( recipient, msg.value ); require( weiPayment > 0 ); if( msg.value > weiPayment ) { msg.sender.transfer( msg.value.sub( weiPayment ) ); } sendETHToMultiSig( weiPayment ); raisedWei = raisedWei.add( weiPayment ); uint recievedTokens = weiPayment.mul( 11750 ); assert( token.transfer( recipient, recievedTokens ) ); Buy( recipient, recievedTokens, weiPayment ); return weiPayment; }
1
1,273
function setRequireCustomerId(bool value) public onlyOwner { requireCustomerId = value; InvestmentPolicyChanged(requireCustomerId, requiredSignedAddress, signerAddress); }
0
2,246