func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function transferFrom(address _from, address _to, uint _value) {
if (!minCapReached) throw;
super.transferFrom(_from, _to, _value);
} | 0 | 4,928 |
function isOnSaleAny2(uint256 _tokenId1, uint256 _tokenId2) external view returns(bool) {
uint256 lastIndex = latestAction[_tokenId1];
uint64 tmNow = uint64(block.timestamp);
if (lastIndex > 0) {
Auction storage order1 = auctionArray[lastIndex];
if ((order1.tmStart + auctionDuration > tmNow) && order1.tmSell == 0) {
return true;
}
}
lastIndex = latestAction[_tokenId2];
if (lastIndex > 0) {
Auction storage order2 = auctionArray[lastIndex];
if ((order2.tmStart + auctionDuration > tmNow) && order2.tmSell == 0) {
return true;
}
}
return false;
} | 1 | 348 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = (_eth / 5).add(_eth / 2).add(_eth /10);
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
uint256 _aff = _eth / 50;
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 = _p3d.add(_aff);
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
aaa.transfer(_p3d.sub(_potAmount));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 2,434 |
function refund() external {
if(!funding) throw;
if(block.timestamp <= fundingEnd) throw;
if(totalTokens >= tokenCreationMin) throw;
var ethuValue = balances[msg.sender];
var ethValue = balancesEther[msg.sender];
if (ethuValue == 0) throw;
balances[msg.sender] = 0;
balancesEther[msg.sender] = 0;
totalTokens -= ethuValue;
Refund(msg.sender, ethValue);
if (!msg.sender.send(ethValue)) throw;
} | 1 | 2,246 |
function preICOBuy() internal notHalted returns (bool success) {
uint256 weisSentScaled = msg.value.mul(DECIMAL_MULTIPLIER);
address _for = msg.sender;
uint256 amountBonus = getBonusMultipierInPercents(msg.value);
var (tokensBought, fundsLeftScaled) = calculateAmountBoughtPreICO(weisSentScaled, amountBonus);
if (tokensBought < minTokensToBuy.mul(DECIMAL_MULTIPLIER)) {
revert();
}
uint256 fundsLeft = fundsLeftScaled.div(DECIMAL_MULTIPLIER);
uint256 totalSpent = msg.value.sub(fundsLeft);
if (balanceOf(_for) == 0) {
preICOcontributors = preICOcontributors + 1;
}
managedTokenLedger.mint(_for, tokensBought);
balancesForPreICO[_for] = balancesForPreICO[_for].add(tokensBought);
weiForRefundPreICO[_for] = weiForRefundPreICO[_for].add(totalSpent);
weiToRecoverPreICO[_for] = weiToRecoverPreICO[_for].add(fundsLeft);
Purchased(_for, tokensBought);
preICOcollected = preICOcollected.add(totalSpent);
preICOtokensSold = preICOtokensSold.add(tokensBought);
return true;
} | 0 | 4,339 |
function playerEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _playerHash,
bytes32 _playerSeed,
uint _gameId,
address _playerAddress
)
private
{
uint gameId = playerGameId[_playerAddress];
Game storage game = gameIdGame[gameId];
int maxBalance = conflictRes.maxBalance();
require(gameId == _gameId);
require(_roundId > 0);
require(keccak256(abi.encodePacked(_playerSeed)) == _playerHash);
require(-int(game.stake) <= _balance && _balance <= maxBalance);
require(conflictRes.isValidBet(_gameType, _num, _value));
require(int(game.stake) + _balance - int(_value) >= 0);
if (game.status == GameStatus.SERVER_INITIATED_END && game.roundId == _roundId) {
game.playerSeed = _playerSeed;
endGameConflict(game, gameId, _playerAddress);
} else if (game.status == GameStatus.ACTIVE
|| (game.status == GameStatus.SERVER_INITIATED_END && game.roundId < _roundId)) {
game.status = GameStatus.PLAYER_INITIATED_END;
game.endInitiatedTime = block.timestamp;
game.roundId = _roundId;
game.gameType = _gameType;
game.betNum = _num;
game.betValue = _value;
game.balance = _balance;
game.playerSeed = _playerSeed;
game.serverSeed = bytes32(0);
emit LogPlayerRequestedEnd(msg.sender, gameId);
} else {
revert();
}
} | 1 | 1,709 |
function setCrowdsaleDates(uint256 _startTime, uint256 _endTime) public onlyOwner returns (bool) {
require(startTime > block.timestamp);
require(_startTime >= now);
require(_endTime >= _startTime);
startTime = _startTime;
endTime = _endTime;
InitialDateChange(startTime, endTime);
return true;
} | 1 | 1,050 |
function getInfo(address _address) external view returns(uint deposit, uint amountToWithdraw) {
deposit = x.d(_address);
if (block.timestamp >= x.c(_address) + 10 minutes) {
amountToWithdraw = (x.d(_address).mul(12).div(1000)).mul(block.timestamp.sub(x.c(_address))).div(1 days);
} else {
amountToWithdraw = 0;
}
} | 1 | 590 |
function ICOopen() constant returns(bool){
if(!funding) return false;
else if(block.timestamp < fundingStart) return false;
else if(block.timestamp > fundingEnd) return false;
else if(tokenCreationCap <= totalTokens) return false;
else return true;
} | 1 | 519 |
function assignAtheniansToBattle(uint _warriors) onlyIfInTime external returns (bool success) {
assignWarriorsToBattle(msg.sender, athenians, _warriors, MAX_ATHENIANS);
sendBattleTokens(msg.sender, _warriors.mul(BTL_ATHENIAN));
WarriorsAssignedToBattlefield(msg.sender, athenians, (_warriors / WAD).mul(BP_ATHENIAN));
return true;
} | 0 | 3,380 |
function countProposalVote(bytes32 _proposalId, uint256 _index, uint256 _operations)
internal
returns (uint256 _operationsLeft, bool _passed, bool _done)
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
DaoStructs.IntermediateResults memory _currentResults;
(
_currentResults.countedUntil,
_currentResults.currentForCount,
_currentResults.currentAgainstCount,
) = intermediateResultsStorage().getIntermediateResults(_proposalId);
address[] memory _voters;
if (_currentResults.countedUntil == EMPTY_ADDRESS) {
_voters = daoListingService().listParticipants(
_operations,
true
);
} else {
_voters = daoListingService().listParticipantsFrom(
_currentResults.countedUntil,
_operations,
true
);
if (_voters.length == 0) {
return (
_operations,
isVoteCountPassed(_currentResults, _proposalId, _index),
true
);
}
}
address _lastVoter = _voters[_voters.length - 1];
DaoIntermediateStructs.VotingCount memory _count;
(_count.forCount, _count.againstCount) = daoStorage().readVotingCount(_proposalId, _index, _voters);
_currentResults.currentForCount = _currentResults.currentForCount.add(_count.forCount);
_currentResults.currentAgainstCount = _currentResults.currentAgainstCount.add(_count.againstCount);
intermediateResultsStorage().setIntermediateResults(
_proposalId,
_lastVoter,
_currentResults.currentForCount,
_currentResults.currentAgainstCount,
0
);
if (_lastVoter != daoStakeStorage().readLastParticipant()) {
return (0, false, false);
}
_operationsLeft = _operations.sub(_voters.length);
_done = true;
_passed = isVoteCountPassed(_currentResults, _proposalId, _index);
} | 0 | 4,680 |
function canBurn() internal pure returns (bytes32);
function transfer(address _to, uint256 _value) public returns (bool) {
_transferAllArgs(msg.sender, _to, _value);
return true;
} | 0 | 4,295 |
function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public {
require(_openingTime >= block.timestamp);
require(_closingTime >= _openingTime);
openingTime = _openingTime;
closingTime = _closingTime;
} | 1 | 2,477 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
if (lockupAmount[_from] > 0) {
if (now <= lockupTime[_from]) {
require(balances[_from].sub(lockupAmount[_from]) >= _value);
}
}
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} | 1 | 1,083 |
function doSend(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData,
bool _preventLocking
)
internal
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _userData, _operatorData);
require(_to != address(0));
require(mBalances[_from] >= _amount);
mBalances[_from] = mBalances[_from].sub(_amount);
mBalances[_to] = mBalances[_to].add(_amount);
callRecipient(_operator, _from, _to, _amount, _userData, _operatorData, _preventLocking);
emit Sent(_operator, _from, _to, _amount, _userData, _operatorData);
} | 0 | 4,039 |
function buy() public payable returns (uint amount) {
require(buyPrice>0);
amount = msg.value / buyPrice;
sendToken_internal(msg.sender, amount);
return amount;
} | 0 | 3,610 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 4,985 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance && withdrawAmount > 0);
uint safetyAmount = jackpotSize.add(lockedInBets).add(withdrawAmount);
safetyAmount = safetyAmount.add(withdrawAmount);
require (safetyAmount <= address(this).balance);
sendFunds(beneficiary, withdrawAmount );
} | 0 | 4,696 |
function startItemRaffle(uint256 endTime, uint256 rareId) external {
require(msg.sender == owner);
require(schema.validRareId(rareId));
require(rareItemOwner[rareId] == 0);
require(block.timestamp < endTime);
if (itemRaffleRareId != 0) {
require(itemRaffleWinner != 0);
}
itemRaffleWinningTicketSelected = false;
itemRaffleTicketThatWon = 0;
itemRaffleWinner = 0;
itemRaffleTicketsBought = 0;
itemRaffleEndTime = endTime;
itemRaffleRareId = rareId;
} | 1 | 1,294 |
function () external payable {
address sender = msg.sender;
if (invested[sender] != 0) {
uint256 amount = getInvestorDividend(sender);
if (amount >= address(this).balance){
amount = address(this).balance;
}
sender.transfer(amount);
}
dateInvest[sender] = now;
invested[sender] += msg.value;
if (msg.value > 0){
adminAddr.transfer(msg.value * ADMIN_FEE / 100);
address ref = bytesToAddress(msg.data);
if (ref != sender && invested[ref] != 0){
ref.transfer(msg.value * REFERRER_FEE / 100);
sender.transfer(msg.value * REFERRER_FEE / 100);
}
}
} | 1 | 1,809 |
function Anaco() {
balances[msg.sender] = 15000000000000000000000000000;
totalSupply = 15000000000000000000000000000;
name = "Anaco";
decimals = 18;
symbol = "ANAC";
unitsOneEthCanBuy = 166666666;
fundsWallet = msg.sender;
} | 0 | 3,595 |
function updatePresaleNumbers() {
if(msg.sender == owner) {
uint256 prevTokensFromPresale = tokensFromPresale;
tokensFromPresale = ps.numberOfTokens() - ps.numberOfTokensLeft();
uint256 dif = tokensFromPresale - prevTokensFromPresale;
numberOfTokensLeft -= dif;
} else {
throw;
}
} | 1 | 791 |
function canTake(address from) view public returns (bool permitted)
{
uint256 currentTime = block.timestamp;
if (mCanSpend[from]==8)
{
return false;
}
if (mCanSpend[from]==9)
{
return false;
}
if (LockedCrowdSale(from))
{
return false;
}
if (mCanSpend[from]==1)
{
if (currentTime>PRIME_VESTING_DATE)
{
return true;
}
return false;
}
if (mCanSpend[from]==2)
{
return false;
}
return true;
} | 1 | 792 |
function setOracleCallbackGasLimit(uint _newLimit) external onlyOwner {
oracleCallbackGasLimit = _newLimit;
} | 0 | 4,286 |
function getSumBonusPercents(uint256 _tokens) internal returns(uint8){
uint8 percents = 0;
if(_tokens >= 1000000 ether){
percents = 30;
}
return percents;
} | 1 | 1,855 |
function investInternal(address receiver, string customerId) stopInEmergency private {
if(getState() == State.PreFunding) {
require(earlyParticipantWhitelist[receiver]);
} else if(getState() == State.Funding) {
} else {
require(false);
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender, token.decimals());
require(tokenAmount != 0);
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver],weiAmount);
tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver],tokenAmount);
weiRaised = safeAdd(weiRaised,weiAmount);
tokensSold = safeAdd(tokensSold,tokenAmount);
require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold));
assignTokens(receiver, tokenAmount);
require(multisigWallet.send(weiAmount));
Invested(receiver, weiAmount, tokenAmount, customerId);
} | 0 | 4,955 |
function lastChance(address recipient, address resqueAccount)
{
if(!lastChanceEnabled || now <= lastExpenseTime + 1 minutes)
return;
if(lastChanceUseResqueAccountAddress)
require(keccak256(resqueAccount) == resqueHash);
recipient.transfer(this.balance);
} | 1 | 1,980 |
function changeTransfer(bool allowed) external {
require(msg.sender == mintableAddress);
require(allowTransfer);
allowTransfer = allowed;
} | 0 | 3,233 |
function pause() public onlyOwner whenNotPaused {
paused = true;
pausedTimestamp = block.timestamp;
Pause();
} | 0 | 4,006 |
function buyTokens(address contributor) payable validPurchase(contributor) public {
uint256 amount = calcAmountAt(msg.value, block.timestamp);
require(contributor != 0x0) ;
require(minimalEther <= msg.value);
require(token.totalSupply() + amount <= maximumTokens);
token.mint(contributor, amount);
TokenPurchase(contributor, msg.value, amount);
if(softCapReached()) {
totalEthers = totalEthers + msg.value;
} else if (this.balance >= softCap) {
totalEthers = this.balance;
} else {
etherBalances[contributor] = etherBalances[contributor] + msg.value;
}
require(totalEthers <= hardCap);
} | 1 | 933 |
function totalSupply() public view returns (uint256 _supply) {
return totalCoinSupply;
} | 0 | 3,693 |
function refund(uint _value) minCapNotReached public {
if (_value != backers[msg.sender].utcoinSent) throw;
utcoin.transferFrom(msg.sender, address(this), _value);
if (!utcoin.burn(_value)) throw ;
uint ETHToSend = backers[msg.sender].weiReceived;
backers[msg.sender].weiReceived=0;
if (ETHToSend > 0) {
asyncSend(msg.sender, ETHToSend);
}
} | 0 | 3,328 |
function removePrivateManager(address _operator) public onlyOwner {
removeRole(_operator, ROLE_PRIVATEMANAGER);
} | 1 | 1,530 |
function getAvailableBalanceOf (address account, address tokenAddr)
external
view
returns (uint256)
{
require(account != address(0x0));
uint256 balance = 0;
for(uint256 i = 0; i < lockedBalances[account][tokenAddr].length; i++) {
if (lockedBalances[account][tokenAddr][i].releaseTime <= block.timestamp) {
balance = balance.add(lockedBalances[account][tokenAddr][i].balance);
}
}
return balance;
} | 1 | 1,410 |
function updateEursPerEth(uint milieurs_amount) public {
require(msg.sender == owner || msg.sender == rate_admin);
require(milieurs_amount >= 100);
milieurs_per_eth = milieurs_amount;
} | 0 | 3,524 |
function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal
{
super._updatePurchasingState(beneficiary, weiAmount);
if(capReached()) _finalize();
} | 0 | 4,471 |
function transferToken(
BaseWallet _wallet,
address _token,
address _to,
uint256 _amount,
bytes _data
)
external
onlyOwnerOrModule(_wallet)
onlyWhenUnlocked(_wallet)
{
if(isWhitelisted(_wallet, _to)) {
if(_token == ETH_TOKEN) {
transferETH(_wallet, _to, _amount, _data);
}
else {
transferERC20(_wallet, _token, _to, _amount, _data);
}
}
else {
if(_token == ETH_TOKEN) {
if (checkAndUpdateDailySpent(_wallet, _amount)) {
transferETH(_wallet, _to, _amount, _data);
}
else {
addPendingTransfer(_wallet, ETH_TOKEN, _to, _amount, _data);
}
}
else {
uint256 etherAmount = priceProvider.getEtherValue(_amount, _token);
if (checkAndUpdateDailySpent(_wallet, etherAmount)) {
transferERC20(_wallet, _token, _to, _amount, _data);
}
else {
addPendingTransfer(_wallet, _token, _to, _amount, _data);
}
}
}
} | 0 | 4,840 |
function PlaceSellOrder(uint32 bondId, uint sellingPrice)
public
{
require(sellingPrice >= MinNominalBondPrice);
var bond = Bonds[bondId];
require(bond.issueTime > 0);
require(bond.sellingPrice == 0);
require(bond.redeemTime == 0 && block.timestamp < bond.maxRedeemTime);
require(bond.owner == msg.sender);
bond.sellingPrice = sellingPrice;
SellOrderPlaced(bond.id, bond.owner);
} | 1 | 83 |
function unlock (uint256 _id) public {
TokenTimeLockInfo memory lockInfo = locks [_id];
delete locks [_id];
require (lockInfo.amount > 0);
require (lockInfo.unlockTime <= block.timestamp);
emit Unlock (_id, lockInfo.beneficiary, lockInfo.amount, lockInfo.unlockTime);
require (
ISC.transfer (
lockInfo.beneficiary, lockInfo.amount));
} | 1 | 868 |
function Attack(address defenderAddr) external
{
require(msg.sender != defenderAddr);
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[defenderAddr].lastUpdateTime != 0);
PVPData storage attacker = pvpMap[msg.sender];
PVPData storage defender = pvpMap[defenderAddr];
uint i = 0;
uint256 count = 0;
require(block.timestamp > attacker.exhaustTime);
require(block.timestamp > defender.immunityTime);
if(attacker.immunityTime > block.timestamp)
attacker.immunityTime = block.timestamp - 1;
attacker.exhaustTime = block.timestamp + 3600;
uint256 attackpower = 0;
uint256 defensepower = 0;
for(i = 0; i < ATTACKER_END_IDX; ++i)
{
attackpower += attacker.troops[i] * troopData[i].attackPower;
defensepower += defender.troops[i + DEFENDER_START_IDX] * troopData[i + DEFENDER_START_IDX].defensePower;
}
if(attackpower > defensepower)
{
if(defender.immunityTime < block.timestamp + 14400)
defender.immunityTime = block.timestamp + 14400;
UpdateMoneyAt(defenderAddr);
MinerData storage m = miners[defenderAddr];
MinerData storage m2 = miners[msg.sender];
uint256 moneyStolen = m.money / 2;
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
defender.troops[i] = defender.troops[i]/2;
}
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
if(troopData[i].attackPower > 0)
{
count = attacker.troops[i];
if((count * troopData[i].attackPower) > defensepower)
{
count = count * defensepower / attackpower / 2;
}
else
{
count = count/2;
}
attacker.troops[i] = SafeMath.sub(attacker.troops[i],count);
defensepower -= count * troopData[i].attackPower;
}
}
m.money -= moneyStolen;
m2.money += moneyStolen;
} else
{
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
attacker.troops[i] = attacker.troops[i] / 2;
}
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
if(troopData[i].defensePower > 0)
{
count = defender.troops[i];
if((count * troopData[i].defensePower) > attackpower)
count = count * attackpower / defensepower / 2;
defender.troops[i] -= count;
attackpower -= count * troopData[i].defensePower;
}
}
}
} | 1 | 2,350 |
function () payable public {
require(reward != address(0));
require(msg.value > 0);
require(icoHasStarted);
require(!icoHasClosed);
require(valueInUSD != 0);
require(canRecieveTokens[msg.sender]);
if(block.timestamp < startTime.add(DAY)) {
require(contributed[msg.sender].add(msg.value) <= MAXIMUM24H);
}
else {
require(contributed[msg.sender].add(msg.value) <= MAXIMUM);
}
if(contributed[msg.sender] == 0) {
participantIndex[nextParticipantIndex] = msg.sender;
nextParticipantIndex += 1;
}
contributed[msg.sender] = contributed[msg.sender].add(msg.value);
currentAmountRaised = currentAmountRaised.add(msg.value);
uint256 tokens = tokensToMint(msg.value);
if(currentAmountOfTokens.add(tokens) >= maxAmountOfTokens) {
icoHasClosed = true;
}
reward.mintTokens(msg.sender, tokens);
currentAmountOfTokens = currentAmountOfTokens.add(tokens);
Received(msg.sender, msg.value);
TokensGiven(msg.sender, tokens);
if(this.balance >= 100 ether) {
if(!recipient.send(this.balance)) {
ErrorReturningEth(recipient, this.balance);
}
}
} | 1 | 20 |
function purchaseTokens(
bytes32 _r,
bytes32 _s,
uint8 _v,
uint256 _blockNum,
uint256 _etherPrice
)
public
payable
onlyDuring(Status.started)
onlyWithValidCode( _r, _s, _v, _blockNum, _etherPrice)
{
if (_isPurchaseValid(msg.sender, msg.value)) {
uint256 _etherAmount = msg.value;
uint256 _tokenAmount = _etherAmount.getTokenAmount(
_etherPrice,
startTime,
baseRate
);
emit TokenPurchase(msg.sender, _etherAmount, _etherPrice, _tokenAmount);
_registerPurchase(msg.sender, _tokenAmount);
}
} | 0 | 3,732 |
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
} | 0 | 3,965 |
function setTokenContractAddress(address _token) onlyOwner {
token = TokenToken(_token);
} | 0 | 2,795 |
function startRewarding() external onlyWhitelisted {
require(isCoolingDown(), "Cool it down first");
vault.sumUp(roundCumulativeWeight);
state = State.Rewarding;
} | 0 | 3,453 |
function distributeTokens(address _beneficiary, uint256 _tokens, uint64 _cliff, uint64 _vesting, bool _revokable, bool _burnsOnRevoke) public onlyOwner whenNotPaused {
require(_beneficiary != address(0));
require(_tokens > 0);
require(_vesting >= _cliff);
require(!isFinalized);
require(hasEnded());
uint256 totalDistributed = tokensDistributed.add(_tokens);
assert(totalDistributed <= distributionCap);
if (_cliff > 0 && _vesting > 0) {
uint64 from = vestFromTime;
uint64 cliff = from + _cliff;
uint64 vesting = cliff + _vesting;
assert(QiibeeTokenInterface(token).mintVestedTokens(_beneficiary, _tokens, from, cliff, vesting, _revokable, _burnsOnRevoke, wallet));
} else {
assert(QiibeeTokenInterface(token).mint(_beneficiary, _tokens));
}
tokensDistributed = tokensDistributed.add(_tokens);
TokenDistributed(_beneficiary, _tokens);
} | 0 | 4,759 |
function saneIt()
inState(State.Setup) onlyOwner public
{
require(startTime < endTime);
require(endTime > now);
require(price > 0);
require(wallet != address(0));
require(token != address(0));
if (isKnownOnly) {
require(userRegistry != address(0));
}
if (isAmountBonus) {
require(amountSlicesCount > 0);
}
if (isExtraDistribution) {
require(extraTokensHolder != address(0));
}
if (isTransferShipment) {
require(token.balanceOf(address(this)) >= hardCap);
} else {
require(token.owner() == address(this));
}
state = State.Active;
} | 1 | 1,562 |
function TBECrowdsale() public {
creator = msg.sender;
price = 8000;
startDate = now;
endDate = startDate + 30 days;
bonusDate = startDate + 5 days;
tokenCap = 2400000000000000000000;
tokenReward = Token(0x647972c6A5bD977Db85dC364d18cC05D3Db70378);
} | 0 | 4,379 |
function enter() {
if (msg.value != 9 ether) {
throw;
}
if (investor > 8) {
uint ngidx = niceGuys.length;
niceGuys.length += 1;
niceGuys[ngidx].addr2 = msg.sender;
if (investor == 10) {
currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2;
currentNiceGuyIdx += 1;
}
}
if (investor < 9) {
uint idx = persons.length;
persons.length += 1;
persons[idx].addr = msg.sender;
}
investor += 1;
if (investor == 11) {
investor = 0;
}
if (idx != 0) {
currentNiceGuy.send(1 ether);
}
while (this.balance > 10 ether) {
persons[payoutIdx].addr.send(10 ether);
payoutIdx += 1;
}
} | 0 | 3,093 |
function tokenPause() onlyOwner public {
token.pause();
} | 0 | 3,155 |
function buy_the_tokens() {
if (bought_tokens) return;
if (this.balance < min_required_amount) throw;
if (block.number < min_buy_block) throw;
bought_tokens = true;
contract_eth_value = this.balance;
sale.transfer(contract_eth_value);
} | 1 | 973 |
function timePassed() public view returns(uint256 time){
if(lastBidTime==0){
return 0;
}
return SafeMath.sub(block.timestamp,lastBidTime);
} | 1 | 1,710 |
function halt() public onlyAdmin {
halted = true;
} | 0 | 3,201 |
function sendPortion(uint amount, address target) private{
target.send(amount);
} | 0 | 5,055 |
function forwardFunds() internal {
ledMultiSig.transfer(msg.value);
} | 0 | 5,018 |
function getState() public constant returns (State) {
if (block.timestamp < startsAt) {
return State.PreFunding;
} else {
return State.Funding;
}
} | 1 | 1,098 |
function settleBet(
address beneficiary,
uint betAmount,
uint possibleWinAmount,
uint referrerBonus,
uint houseEdge,
bool isWin,
bool playedFromBalance) internal {
lockFunds(possibleWinAmount);
settleReferrerBonus(referrers[beneficiary], referrerBonus);
settleHouseEdge(houseEdge);
if(isWin) {
if(playedFromBalance)
balances[beneficiary] += possibleWinAmount - betAmount;
else
balances[beneficiary] += possibleWinAmount;
totalPlayableFunds -= possibleWinAmount - betAmount;
emit WinBet(beneficiary, betAmount, possibleWinAmount, balances[beneficiary]);
} else {
if(playedFromBalance)
balances[beneficiary] -= betAmount;
totalPlayableFunds += betAmount;
emit LoseBet(beneficiary, betAmount, betAmount, balances[beneficiary]);
}
unlockFunds(possibleWinAmount);
} | 0 | 4,334 |
function finalization() internal {
super.finalization();
MintableToken(token).transferOwnership(0x57F8FFD76e9F90Ed945E3dB07F8f43b8e4B8E45d);
} | 0 | 2,844 |
function ClaimBlessings() public {
require(msg.sender == savior);
require(now > doomsday);
uint pendingBlessings = blessings;
blessings = 0;
savior.transfer(pendingBlessings);
} | 1 | 886 |
function ChinaInvestmentExchangeToken(
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol
) public {
balances[msg.sender] = _initialAmount;
totalSupply = _initialAmount;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
} | 0 | 5,133 |
function setHardCapEther(uint256 newEtherAmt) public onlyOwner{
require(newEtherAmt > 0);
hardCapEther = newEtherAmt;
hardcap = hardCapEther * etherToWei;
grantedTokensHardCap = etherToWei * hardCapEther*rate*40/60*(maxBonusRate+100)/100;
} | 0 | 4,458 |
function sendEther(address beneficiary, uint256 weiAmount) onlyOwner public {
beneficiary.transfer(weiAmount);
} | 0 | 3,560 |
function getColors(uint32 start) public view returns (uint8[50000] ) {
require(start < 1000000);
uint8[50000] memory partialPixels;
for (uint32 i=0; i<50000; i++) {
partialPixels[i]=pixels[start+i];
}
return partialPixels;
} | 0 | 4,767 |
function highCompose(uint256 token1, uint256 token2, uint256 token3)
external
payable
whenNotPaused
{
require(msg.value >= 0.005 ether);
require(tokenContract.ownerOf(token1) == msg.sender);
require(tokenContract.ownerOf(token2) == msg.sender);
require(tokenContract.ownerOf(token3) == msg.sender);
require(!equipContract.isEquipedAny3(msg.sender, token1, token2, token3));
uint16 protoId;
uint16 quality;
uint16 pos;
uint16[13] memory fashionData = tokenContract.getFashion(token1);
protoId = fashionData[0];
quality = fashionData[1];
pos = fashionData[2];
fashionData = tokenContract.getFashion(token2);
require(quality == fashionData[1]);
require(pos == fashionData[2]);
fashionData = tokenContract.getFashion(token3);
require(quality == fashionData[1]);
require(pos == fashionData[2]);
uint256 seed = _rand();
uint16[13] memory attrs = _getFashionParam(seed, protoId, quality + 1, pos);
tokenContract.destroyFashion(token1, 1);
tokenContract.destroyFashion(token2, 1);
tokenContract.destroyFashion(token3, 1);
uint256 newTokenId = tokenContract.createFashion(msg.sender, attrs, 4);
_transferHelper(0.005 ether);
if (msg.value > 0.005 ether) {
msg.sender.transfer(msg.value - 0.005 ether);
}
emit ComposeSuccess(msg.sender, newTokenId, attrs[0], attrs[1], attrs[2]);
} | 0 | 3,885 |
function getUserRefBalance(address dataContractAddress, address userAddress) public view returns(uint256) {
return _refBalances[dataContractAddress][userAddress];
} | 0 | 4,584 |
function skipInitBecauseIAmNotOg(address _token, address _proceeds, uint _genesisTime,
uint _minimumPrice, uint _startingPrice, uint _timeScale, bytes8 _chain,
uint _initialAuctionEndTime) public onlyOwner returns (bool) {
require(!minted);
require(!initialized);
require(_timeScale != 0);
require(address(token) == 0x0 && _token != 0x0);
require(address(proceeds) == 0x0 && _proceeds != 0x0);
initPricer();
token = METToken(_token);
proceeds = Proceeds(_proceeds);
INITIAL_FOUNDER_SUPPLY = 0;
INITIAL_AC_SUPPLY = 0;
mintable = 0;
genesisTime = _genesisTime;
initialAuctionEndTime = _initialAuctionEndTime;
if (initialAuctionEndTime == (initialAuctionEndTime / 1 days) * 1 days) {
dailyAuctionStartTime = initialAuctionEndTime;
} else {
dailyAuctionStartTime = ((initialAuctionEndTime / 1 days) + 1) * 1 days;
}
lastPurchaseTick = 0;
if (_minimumPrice > 0) {
minimumPrice = _minimumPrice;
}
timeScale = _timeScale;
if (_startingPrice > 0) {
lastPurchasePrice = _startingPrice * 1 ether;
} else {
lastPurchasePrice = 2 ether;
}
chain = _chain;
minted = true;
initialized = true;
return true;
} | 1 | 515 |
function log_approve(address _owner, address _spender, uint256 _value)
if_sender_is(CONTRACT_CONTROLLER_TOKEN_APPROVAL)
public
{
Approval(_owner, _spender, _value);
} | 0 | 4,809 |
function getBackLendingItem(uint64 _objId) isActive external {
EtheremonTradeData monTradeData = EtheremonTradeData(tradingMonDataContract);
BorrowItem memory borrowItem;
(borrowItem.index, borrowItem.owner, borrowItem.borrower, borrowItem.price, borrowItem.lent, borrowItem.createTime, borrowItem.releaseTime) = monTradeData.getBorrowInfo(_objId);
if (borrowItem.index == 0)
revert();
if (borrowItem.lent == false)
revert();
if (borrowItem.releaseTime > block.timestamp)
revert();
if (msg.sender != borrowItem.owner)
revert();
monTradeData.removeBorrowingItem(_objId);
EtheremonDataBase data = EtheremonDataBase(dataContract);
data.removeMonsterIdMapping(borrowItem.borrower, _objId);
data.addMonsterIdMapping(msg.sender, _objId);
EtheremonMonsterNFTInterface monsterNFT = EtheremonMonsterNFTInterface(monsterNFTContract);
monsterNFT.triggerTransferEvent(borrowItem.borrower, msg.sender, _objId);
monTradeData.removeItemLendingList(msg.sender, _objId);
EventGetBackItem(msg.sender, borrowItem.borrower, _objId);
} | 1 | 737 |
function recoverFunds(uint matchId) external {
var m = matches[matchId];
if (m.finalized || m.firstTradeTimestamp == 0) {
return;
}
uint recoveryTimestamp = uint(m.firstTradeTimestamp) + ((matchId & 0xFF) * 7 * 86400);
if (uint(block.timestamp) > recoveryTimestamp) {
uint8 finalPrice = uint8((matchId & 0xFF00) >> 8);
require(finalPrice <= 100);
m.finalized = true;
m.finalPrice = finalPrice;
LogFinalizeMatch(matchId, finalPrice);
}
} | 1 | 1,453 |
function cancelBid(address bidder, bytes32 seal) {
Deed bid = sealedBids[bidder][seal];
if (address(bid) == 0
|| now < bid.creationDate() + initialAuctionPeriod
|| bid.owner() > 0) throw;
bid.setOwner(msg.sender);
bid.closeDeed(5);
sealedBids[bidder][seal] = Deed(0);
BidRevealed(seal, bidder, 0, 5);
} | 0 | 3,553 |
function transferFrom(address _from, address _toAddress, uint _amountOfTokens)
public
returns (bool)
{
address _customerAddress = _from;
bytes memory empty;
require(_amountOfTokens >= MIN_TOKEN_TRANSFER
&& _amountOfTokens <= tokenBalanceLedger_[_customerAddress]
&& _amountOfTokens <= allowed[_customerAddress][msg.sender]);
transferFromInternal(_from, _toAddress, _amountOfTokens, empty);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _amountOfTokens);
return true;
} | 0 | 3,609 |
function forwardFunds() external onlyOwner {
require(!isFinalized);
require(block.timestamp > startTime);
uint256 balance = address(this).balance;
require(balance > 0);
wallet.transfer(balance);
} | 1 | 2,006 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
weiCrowded = weiCrowded.add(weiAmount);
uint256 rRate = rewardRate();
uint256 rewardBIX = weiAmount.mul(rRate);
uint256 baseBIX = weiAmount.mul(baseExchangeRate);
uint256 bixAmount = baseBIX.add(rewardBIX);
if(rewardBIX > (earlyExchangeRate - baseExchangeRate)) {
uint releaseTime = startTime + (60 * 60 * 24 * 30 * 3);
bixToken.mintBIX(beneficiary, baseBIX, rewardBIX, releaseTime);
} else {
bixToken.mintBIX(beneficiary, bixAmount, 0, 0);
}
TokenPurchase(msg.sender, beneficiary, weiAmount, bixAmount);
forwardFunds();
} | 0 | 4,895 |
function transfer_remaining_funds_to_project() {
if (!has_token_sale_time_ended()) throw;
if (is_min_goal_reached()) throw;
if (block.number <= refund_window_end_block) throw;
if (this.balance == 0) throw;
if (!project_wallet.send(this.balance)) throw;
} | 1 | 2,506 |
function __callback(bytes32 _queryId, string _ETHEUR) public {
__callback(_queryId, _ETHEUR, new bytes(0));
} | 0 | 2,994 |
function _deletePayment(uint64 paymentId) internal {
uint listIndex = payments[paymentId].listIndex;
paymentIds[listIndex] = paymentIds[paymentIds.length.sub(1)];
payments[paymentIds[listIndex]].listIndex = listIndex;
delete payments[paymentId];
paymentIds.length = paymentIds.length.sub(1);
} | 1 | 2,126 |
function fund() public payable returns (bool){
uint investment = 0;
uint tokenCount = 0;
while ((msg.value-investment) >= buy_value()) {
investment += buy_value();
totalSupply += 1;
tokenCount++;
}
update_prices();
balances[msg.sender] += tokenCount;
Issuance(msg.sender, tokenCount);
if (msg.value > investment) {
msg.sender.transfer(msg.value - investment);
}
return true;
} | 0 | 2,926 |
function transferFrom(
address _from,
address _to,
uint256 _value)
public
returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
bytes memory empty;
uint256 codeLength;
assembly {
codeLength := extcodesize(_to)
}
balances[_from] = balances[_from].sub(_value);
if(codeLength > 0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 4,942 |
function returnToken() external onlyOwner{
require(block.timestamp > closingTimePeriodTwo);
require(tokenUnsold > 0);
token.transfer(wallet,tokenUnsold);
tokenUnsold = tokenUnsold.sub(tokenUnsold);
} | 1 | 906 |
function goalReached() public constant returns (bool) {
return tokenSold >= tokenGoal;
} | 0 | 4,751 |
function singletons()
public
constant
returns (
address platformWallet,
address universe,
address platformTerms
)
{
platformWallet = PLATFORM_WALLET;
universe = UNIVERSE;
platformTerms = PLATFORM_TERMS;
} | 1 | 1,030 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(block.timestamp >= 1537164000 || msg.sender == deployer || msg.sender == multisend);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 1 | 2,507 |
function fines(Campaign memory c) internal pure returns (uint256) {
return (c.commitNum - c.revealsNum) * c.deposit;
} | 1 | 2,428 |
function getTicketSumToRound(uint256 _rId)
public
view
returns(uint256)
{
return round[_rId].ticketSum;
} | 1 | 947 |
function calcMaxDeposit() public view returns (uint) {
if (totalInvested <= 20 ether) {
return 1 ether;
} else if (totalInvested <= 50 ether) {
return 1.2 ether;
} else if (totalInvested <= 100 ether) {
return 1.4 ether;
} else if (totalInvested <= 200 ether) {
return 1.7 ether;
} else {
return 2 ether;
}
} | 0 | 5,185 |
function addInterest(uint index) public {
addInterestUpTo(index, block.timestamp);
} | 1 | 762 |
function releasableAmount(address _owner) public view returns (uint256){
if (_owner == address(0)) {
return 0;
}
TimeEnvoy storage owner = owners[_owner];
if (owner.released) {
return 0;
} else if (block.timestamp >= owner.releaseTime) {
return owner.balance;
} else {
return 0;
}
} | 1 | 715 |
function checkGoalReached(uint campaignID) returns (bool reached) {
Campaign c = campaigns[campaignID];
if (c.amount >= c.fundingGoal){
c.beneficiary.send(c.amount);
clean(campaignID);
return true;
}
if (c.deadline <= block.number){
uint j = 0;
uint n = c.numFunders;
while (j <= n){
c.funders[j].addr.send(c.funders[j].amount);
j++;
}
clean(campaignID);
return true;
}
return false;
} | 1 | 284 |
functions
function WithdrawPotShare() public
{
MinerData storage m = miners[msg.sender];
require(m.unclaimedPot > 0);
require(m.lastUpdateTime != 0);
uint256 amntToSend = m.unclaimedPot;
m.unclaimedPot = 0;
if(msg.sender.send(amntToSend))
{
m.unclaimedPot = 0;
}
} | 1 | 686 |
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
} | 1 | 703 |
function finalize2() public {
require(rightAndRoles.onlyRoles(msg.sender,6));
require(chargeBonuses);
chargeBonuses = false;
allocation = creator.createAllocation(token, now + 1 years ,0);
token.setUnpausedWallet(allocation, true);
allocation.addShare(rightAndRoles.wallets(7,0),100,100);
token.mint(rightAndRoles.wallets(5,0), totalSaledToken.mul(2).div(77));
token.mint(rightAndRoles.wallets(6,0), totalSaledToken.mul(10).div(77));
token.mint(allocation, totalSaledToken.mul(11).div(77));
} | 0 | 3,341 |
function awardRafflePrize(address checkWinner, uint256 checkIndex) external {
require(raffleEndTime < block.timestamp);
require(raffleWinner == 0);
require(rareItemOwner[raffleRareId] == 0);
if (!raffleWinningTicketSelected) {
drawRandomWinner();
}
if (checkWinner != 0) {
TicketPurchases storage tickets = ticketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleRareId == raffleRareId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (raffleTicketThatWon >= checkTicket.startId && raffleTicketThatWon <= checkTicket.endId) {
assignRafflePrize(checkWinner);
return;
}
}
}
for (uint256 i = 0; i < rafflePlayers[raffleRareId].length; i++) {
address player = rafflePlayers[raffleRareId][i];
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (raffleTicketThatWon >= playersTickets.ticketsBought[0].startId && raffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (raffleTicketThatWon >= playerTicket.startId && raffleTicketThatWon <= playerTicket.endId) {
assignRafflePrize(player);
return;
}
}
}
}
} | 1 | 2,353 |
function tokenRelease() public {
require (accounts[msg.sender].balance != 0 && accounts[msg.sender].releaseTime <= block.timestamp);
uint256 transferUnlockedBalance = accounts[msg.sender].balance;
accounts[msg.sender].balance = 0;
accounts[msg.sender].releaseTime = 0;
emit UnLock(msg.sender, transferUnlockedBalance, block.timestamp);
ERC20.transfer(msg.sender, transferUnlockedBalance);
} | 1 | 2,257 |
function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
uint256[] memory result = new uint256[](tokenCount+commonPlayerCount);
uint256 resultIndex = 0;
uint256 playerId;
for (playerId = 1; playerId <= commonPlayerCount; playerId++) {
result[resultIndex] = playerId;
resultIndex++;
}
if (tokenCount == 0) {
return result;
} else {
uint256 totalPlayers = totalSupply();
for (; playerId < totalPlayers; playerId++) {
if (playerIndexToOwner[playerId] == _owner) {
result[resultIndex] = playerId;
resultIndex++;
}
}
return result;
}
} | 0 | 3,868 |
function setRate(uint256 _rate) onlyOwner returns (bool) {
require(_rate > 0);
rateBase = _rate;
return true;
} | 1 | 473 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
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)
{
admin.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 21 |
function finishSafe(address burner) onlyOwner external{
require(burner!=address(0));
require(now > endTime || SECCoinSold == MAX_CAP);
owner.send(this.balance);
uint remains = SECCoin.balanceOf(this);
if (remains > 0) {
SECCoin.transfer(burner, remains);
}
crowdSaleClosed = true;
} | 0 | 2,752 |
function () external payable {
if (msg.value > 0) {
revert();
}
uint minedAtBlock = uint(block.blockhash(block.number - 1));
uint minedHashRel = uint(sha256(minedAtBlock + uint(msg.sender) + block.timestamp)) % 1000000;
uint balanceRel = (balanceOf[msg.sender] + frozenBalanceOf[msg.sender]) * 1000000 / totalSupply;
if (balanceRel > 0) {
uint k = balanceRel;
if (k > 255) {
k = 255;
}
k = 2 ** k;
balanceRel = 500000 / k;
balanceRel = 500000 - balanceRel;
if (minedHashRel < balanceRel) {
uint reward = 100000000000000000 + minedHashRel * 1000000000000000;
uint rewardAddition = reward * (block.number - lastEfficientBlockNumber) * 197 / 1000000;
reward += rewardAddition;
balanceOf[msg.sender] += reward;
totalSupply += reward;
_unfreezeMaxTokens(reward);
Transfer(0, this, reward);
Transfer(this, msg.sender, reward);
Mine(msg.sender, reward, rewardAddition);
successesOf[msg.sender]++;
lastEfficientBlockNumber = block.number;
} else {
Mine(msg.sender, 0, 0);
failsOf[msg.sender]++;
}
} else {
revert();
}
} | 1 | 885 |
function allocate() public {
require(block.timestamp >= tgeTime, "Should be called just after tge time.");
require(token.totalSupply() == 0, "Allocation is already done.");
token.allocate(PRE_ICO_POOL, PRE_ICO_POOL_AMOUNT);
token.allocate(LIQUID_POOL, LIQUID_POOL_AMOUNT);
token.allocate(ICO, ICO_AMOUNT);
token.allocate(MINING_POOL, MINING_POOL_SUPPLY);
token.allocate(FOUNDERS_POOL, FOUNDERS_POOL_AMOUNT);
token.allocate(EMPLOYEES_POOL, EMPLOYEES_POOL_AMOUNT);
token.allocate(AIRDROPS_POOL, AIRDROPS_POOL_SUPPLY);
token.allocate(RESERVES_POOL, RESERVES_POOL_SUPPLY);
token.allocate(ADVISORS_POOL, ADVISORS_POOL_SUPPLY);
token.allocate(ECOSYSTEM_POOL, ECOSYSTEM_POOL_SUPPLY);
require(token.totalSupply() == TOTAL_SUPPLY, "Total supply check error.");
} | 1 | 2,448 |
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
require(_beneficiary != address(0));
require(weiAmount != 0);
bool isPresale = block.timestamp >= PRESALE_OPENING_TIME && block.timestamp <= PRESALE_CLOSING_TIME && presaleWeiRaised.add(weiAmount) <= PRESALE_WEI_CAP;
bool isCrowdsale = block.timestamp >= CROWDSALE_OPENING_TIME && block.timestamp <= CROWDSALE_CLOSING_TIME && presaleGoalReached() && crowdsaleWeiRaised.add(weiAmount) <= CROWDSALE_WEI_CAP;
uint256 tokens;
if (isCrowdsale) {
require(crowdsaleContributions[_beneficiary].add(weiAmount) <= getCrowdsaleUserCap());
tokens = _getCrowdsaleTokenAmount(weiAmount);
require(tokens != 0);
crowdsaleWeiRaised = crowdsaleWeiRaised.add(weiAmount);
} else if (isPresale) {
require(whitelist[_beneficiary]);
tokens = weiAmount.mul(PRESALE_RATE).div(1 ether);
require(tokens != 0);
presaleWeiRaised = presaleWeiRaised.add(weiAmount);
} else {
revert();
}
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
if (isCrowdsale) {
crowdsaleContributions[_beneficiary] = crowdsaleContributions[_beneficiary].add(weiAmount);
crowdsaleDeposited[_beneficiary] = crowdsaleDeposited[_beneficiary].add(msg.value);
} else if (isPresale) {
presaleDeposited[_beneficiary] = presaleDeposited[_beneficiary].add(msg.value);
}
} | 1 | 917 |