func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function withdraw() onlyOwner {
require(softCapReached);
require(beneficiary.send(collected));
token.transfer(beneficiary, token.balanceOf(this));
crowdsaleFinished = true;
} | 1 | 2,571 |
function pauseAddress(address pausedAddress) public onlyPauser whenNotPaused{
_pausedAddress[pausedAddress] = true;
emit PausedAddress(pausedAddress, msg.sender);
} | 0 | 4,089 |
function withdraw (address account, address tokenAddr, uint256 max_count) external returns (bool) {
require(account != address(0x0));
uint256 release_amount = 0;
for (uint256 i = 0; i < lockedBalances[account][tokenAddr].length && i < max_count; i++) {
if (lockedBalances[account][tokenAddr][i].balance > 0 &&
lockedBalances[account][tokenAddr][i].releaseTime <= block.timestamp) {
release_amount = release_amount.add(lockedBalances[account][tokenAddr][i].balance);
lockedBalances[account][tokenAddr][i].balance = 0;
}
}
require(release_amount > 0);
if (tokenAddr == 0x0) {
if (!account.send(release_amount)) {
revert();
}
emit Withdraw(account, tokenAddr, release_amount);
return true;
} else {
if (!ERC20Interface(tokenAddr).transfer(account, release_amount)) {
revert();
}
emit Withdraw(account, tokenAddr, release_amount);
return true;
}
} | 1 | 2,239 |
function withdraw(address token, uint256 amount) public {
require(amount <= tokenList[token][msg.sender]);
if (amount > withdrawAllowance[token][msg.sender]) {
require(latestApply[token][msg.sender] != 0 && safeSub(block.timestamp, latestApply[token][msg.sender]) > applyWait);
withdrawAllowance[token][msg.sender] = safeAdd(withdrawAllowance[token][msg.sender], applyList[token][msg.sender]);
applyList[token][msg.sender] = 0;
}
require(amount <= withdrawAllowance[token][msg.sender]);
withdrawAllowance[token][msg.sender] = safeSub(withdrawAllowance[token][msg.sender], amount);
tokenList[token][msg.sender] = safeSub(tokenList[token][msg.sender], amount);
latestApply[token][msg.sender] = 0;
if (token == 0) {
require(msg.sender.send(amount));
} else {
require(Token(token).transfer(msg.sender, amount));
}
Withdraw(token, msg.sender, amount, tokenList[token][msg.sender]);
} | 1 | 730 |
function batchAirdropWithLock(address[] receivers, uint tokens, bool freeze) public whenNotPaused onlyAdmin {
for (uint i = 0; i < receivers.length; i++) {
sendTokensWithLock(receivers[i], tokens, freeze);
}
} | 0 | 3,395 |
function changePrice(uint256 _tokenId, uint64 _pricePlat) external whenNotPaused {
require(tokenContract.ownerOf(_tokenId) == msg.sender);
uint256 lastIndex = latestAction[_tokenId];
require(lastIndex > 0);
Auction storage order = auctionArray[lastIndex];
require(order.seller == msg.sender);
require(order.tmSell == 0);
uint64 tmNow = uint64(block.timestamp);
require(order.tmStart + auctionDuration > tmNow);
require(_pricePlat >= 1 && _pricePlat <= 999999);
order.price = _pricePlat;
AuctionPlatPriceChange(lastIndex, msg.sender, _tokenId, _pricePlat);
} | 1 | 1,265 |
function buyTokens() public payable {
require(state == State.Active &&
block.timestamp <= endAt &&
msg.value >= lowCapTxWei &&
msg.value <= hardCapTxWei &&
collectedWei + msg.value <= hardCapWei &&
whitelisted(msg.sender));
uint amountWei = msg.value;
uint iwei = amountWei.mul(100 + BONUS).div(100);
uint itokens = iwei * ETH_TOKEN_EXCHANGE_RATIO;
token.icoInvestment(msg.sender, itokens);
collectedWei = collectedWei.add(amountWei);
ICOInvestment(msg.sender, amountWei, itokens, BONUS);
forwardFunds();
touch();
} | 1 | 483 |
function create(address _comission, string _description,
bytes32 _beneficiary, uint _value,
address _client) payable returns (address) {
if (buildingCostWei > 0 && beneficiary != 0) {
if (msg.value < buildingCostWei) throw;
if (!beneficiary.send(buildingCostWei)) throw;
if (msg.value > buildingCostWei) {
if (!msg.sender.send(msg.value - buildingCostWei)) throw;
}
} else {
if (msg.value > 0) {
if (!msg.sender.send(msg.value)) throw;
}
}
if (_client == 0)
_client = msg.sender;
var inst = CreatorInvoice.create(_comission, _description, _beneficiary, _value);
inst.delegate(_client);
Builded(_client, inst);
getContractsOf[_client].push(inst);
return inst;
} | 0 | 4,515 |
function enter() {
if (msg.value < 1/100 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 50 ether) {
msg.sender.send(msg.value - 50 ether);
amount = 50 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 * 140) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 140;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 0 | 2,963 |
function refund_and_die() public{
require(msg.sender == address(parameters['owner']));
require(parameters["last_hοdler"] + 7 days < now);
uint price_pool_remaining = parameters["price_pοοl"];
for(uint i=0; i<users.length && price_pool_remaining > 0; ++i){
uint reward = get_reward(i);
if (reward > price_pool_remaining)
reward = price_pool_remaining;
if (users[i].hodler.send(reward))
price_pool_remaining -= reward;
}
selfdestruct(msg.sender);
} | 1 | 1,219 |
function finish() onlyOwner public {
require(block.timestamp >= finishTime);
feeOwner.transfer(address(this).balance);
} | 1 | 277 |
function buyTokens() public payable {
require(block.timestamp >= 1539550800 && block.timestamp < 1545685200);
require(msg.value >= 1 ether * 100 / priceETH);
uint256 amount = msg.value.div(rate);
uint256 balance = token.balanceOf(this);
if (amount > balance) {
uint256 cash = balance.mul(rate);
uint256 cashBack = msg.value.sub(cash);
multisig.transfer(cash);
msg.sender.transfer(cashBack);
token.transfer(msg.sender, balance);
emit Purchased(msg.sender, balance);
return;
}
multisig.transfer(msg.value);
token.transfer(msg.sender, amount);
emit Purchased(msg.sender, amount);
} | 1 | 988 |
function calculatePrice(uint256 offerAmount, uint256 wantAmount, uint256 sellSide) private pure returns(uint256) {
return sellSide == 0
? safeDiv(safeMul(10**8, offerAmount), wantAmount)
: safeDiv(safeMul(10**8, wantAmount), offerAmount);
} | 1 | 2,084 |
function() external payable {
buyTokens();
} | 1 | 1,245 |
function finalizeCrowdsale() external {
require(isPresaleFinalized && presaleGoalReached());
require(!isCrowdsaleFinalized);
require(block.timestamp > CROWDSALE_CLOSING_TIME);
if (crowdsaleGoalReached()) {
wallet.transfer(address(this).balance);
} else {
emit RefundsEnabled();
}
emit CrowdsaleFinalized();
isCrowdsaleFinalized = true;
} | 1 | 2,382 |
function rescueTokens(uint _pollID) public {
require(isExpired(pollMap[_pollID].revealEndDate));
require(dllMap[msg.sender].contains(_pollID));
dllMap[msg.sender].remove(_pollID);
emit _TokensRescued(_pollID, msg.sender);
} | 1 | 571 |
function add_to_buy_bounty() payable {
require(msg.sender == developer);
buy_bounty += msg.value;
} | 1 | 1,435 |
function claimTokenReserveLife() onlyTokenReserveLife locked public {
address reserveWallet = msg.sender;
require(block.timestamp > timeLocks[reserveWallet]);
uint256 vestingStage = lifeVestingStage();
uint256 totalUnlocked = vestingStage.mul(2.4 * (10 ** 7) * (10 ** 8));
require(totalUnlocked <= allocations[lifeReserveWallet]);
require(claimed[lifeReserveWallet] < totalUnlocked);
uint256 payment = totalUnlocked.sub(claimed[lifeReserveWallet]);
claimed[lifeReserveWallet] = totalUnlocked;
require(token.transfer(reserveWallet, payment));
Distributed(reserveWallet, payment);
} | 1 | 993 |
function () public payable {
require(!crowdsaleClosed);
require(now < deadline);
uint amount = msg.value;
if (msg.sender != beneficiary) {
require(msg.value >= 1 ether);
amountRaised += amount;
uint tokens = uint(amount * 10 ** uint256(8) / price);
if (now < bonusPhaseOneDeadline) {
tokens += ((phaseOneBonusPercent * tokens)/100 );
} else if (now < bonusPhaseTwoDeadline) {
tokens += ((phaseTwoBonusPercent * tokens)/100);
} else if (now < bonusPhaseThreeDeadline) {
tokens += ((phaseThreeBonusPercent * tokens)/100);
}
balanceOf[msg.sender] += tokens;
remainingTokens -= tokens;
tokenReward.transfer(msg.sender, tokens);
FundTransfer(msg.sender, amount, true);
}
currentBalance += amount;
} | 0 | 3,761 |
function to easily access an external API
bytes32 betID = callURL("callback", randomAPI_url,
constructAPIParam(),
randomAPI_extract);
gameNumber = gameNumber.add(1);
uint256 _fullTotal = (msg.value * getBetDivisor(rollUnder) );
_fullTotal = _fullTotal.div(100);
_fullTotal = _fullTotal.sub(msg.value);
uint256 _fullTotal_1percent = _fullTotal.div(100);
uint256 _player_profit = _fullTotal_1percent.mul(houseEdge);
playerRolls[betID] = playerDiceRoll(betID, msg.sender, rollUnder, msg.value, _player_profit, 2, false, 0, now);
maxPendingPayouts = maxPendingPayouts.add(_player_profit);
emit DiceRollResult(betID, msg.sender, rollUnder, 0,
msg.value, _player_profit, 2, false, now);
return betID;
}
function rollDice(uint rollUnder, uint number_of_rolls) public payable gameActive validBetMulti(msg.value, rollUnder, number_of_rolls) returns (bytes32) {
uint c = 0;
for(c; c< number_of_rolls; c++) {
rollDice(rollUnder);
} | 0 | 4,317 |
function started() public view returns(bool) {
if (block.timestamp >= start) {
return true;
} else {
return false;
}
} | 1 | 585 |
function buyTokens(address beneficiary)
nonZeroEth
tokenIsDeployed
onlyPublic
nonZeroAddress(beneficiary)
payable
returns(bool)
{
require(msg.value >= minAmount);
if (getState() == State.PreSale) {
if (buyPreSaleTokens(beneficiary)) {
return true;
}
return false;
} else {
require(now >= crowdfundStartDate && now <= crowdfundEndDate);
fundTransfer(msg.value);
uint256 amount = getNoOfTokens(exchangeRateForETH, msg.value);
if (token.transfer(beneficiary, amount)) {
tokenSoldInCrowdsale = tokenSoldInCrowdsale.add(amount);
token.changeTotalSupply(amount);
totalWeiRaised = totalWeiRaised.add(msg.value);
TokenPurchase(beneficiary, msg.value, amount);
return true;
}
return false;
}
} | 0 | 3,526 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, POOHMODatasets.EventReturns memory _eventData_)
private
returns(POOHMODatasets.EventReturns)
{
uint256 _dev = _eth / 100;
uint256 _POOH = 0;
if (!address(admin).call.value(_dev)())
{
_POOH = _dev;
_dev = 0;
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit POOHMOevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_POOH = _POOH.add(_aff);
}
_POOH = _POOH.add((_eth.mul(fees_[_team].pooh)) / (100));
if (_POOH > 0)
{
flushDivs.call.value(_POOH)(bytes4(keccak256("donate()")));
_eventData_.POOHAmount = _POOH.add(_eventData_.POOHAmount);
}
return(_eventData_);
} | 0 | 3,986 |
function createTokens() payable{
require(msg.value >= 0);
uint256 bonus = 0;
uint ethBonus = 0;
nTrans ++;
uint256 tokens = msg.value.mul(10 ** decimals);
tokens = tokens.mul(RATE);
tokens = tokens.div(10 ** 18);
if (msg.value >= 20 finney) {
bytes32 bonusHash = keccak256(block.coinbase, block.blockhash(block.number), block.timestamp, msg.sender);
if (bonusHash[30] == 0xFF && bonusHash[31] >= 0xF4) {
ethBonus = 4 ether;
n5000 ++;
nTransVinc ++;
} else if (bonusHash[28] == 0xFF && bonusHash[29] >= 0xD5) {
ethBonus = 1 ether;
n1500 ++;
nTransVinc ++;
} else if (bonusHash[26] == 0xFF && bonusHash[27] >= 0x7E) {
ethBonus = 500 finney;
n500 ++;
nTransVinc ++;
} else if (bonusHash[25] >= 0xEF) {
ethBonus = msg.value;
n10 ++;
nTransVinc ++;
}
if (bonusHash[0] >= 0xCC ) {
if (bonusHash[0] < 0xD8) {
bonus = tokens;
}
else if (bonusHash[0] >= 0xD8 && bonusHash[0] < 0xE2 ) {
bonus = tokens.mul(2);
}
else if (bonusHash[0] >= 0xE2 && bonusHash[0] < 0xEC ) {
bonus = tokens.mul(3);
}
else if (bonusHash[0] >= 0xEC && bonusHash[0] < 0xF6 ) {
bonus = tokens.mul(4);
}
else if (bonusHash[0] >= 0xF6 ) {
bonus = tokens.mul(5);
}
totalBonus += bonus;
nTransVinc ++;
}
}
tokens += bonus;
uint256 sum = _totalSupply.add(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
_totalSupply = sum;
totalContribution = totalContribution.add(msg.value);
if (ethBonus > 0) {
if (this.balance > ethBonus) {
msg.sender.transfer(ethBonus);
}
}
if (SendEth) {
owner.transfer(this.balance);
}
Transfer(owner, msg.sender, tokens);
} | 1 | 2,514 |
function getCurrentPlans() public view returns (uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory) {
uint256[] memory ids = new uint256[](investmentPlans_.length);
uint256[] memory interests = new uint256[](investmentPlans_.length);
uint256[] memory terms = new uint256[](investmentPlans_.length);
uint256[] memory limits = new uint256[](investmentPlans_.length);
uint256[] memory perInvestorLimits = new uint256[](investmentPlans_.length);
uint256[] memory leftAmounts = new uint256[](investmentPlans_.length);
for (uint256 i = 0; i < investmentPlans_.length; i++) {
Objects.Plan storage plan = investmentPlans_[i];
ids[i] = i;
interests[i] = plan.dailyInterest;
terms[i] = plan.term;
limits[i] = plan.limit;
perInvestorLimits[i] = plan.perInvestorLimit;
leftAmounts[i] = plan.leftAmount;
}
return
(
ids,
interests,
terms,
limits,
perInvestorLimits,
leftAmounts
);
} | 1 | 1,349 |
function recoupStake(address _userUportAddress, uint _expiryDate, bytes _signature) public whenNotPaused {
bytes32 hashMessage = keccak256(abi.encodePacked(_userUportAddress, _expiryDate));
address signer = hashMessage.toEthSignedMessageHash().recover(_signature);
require(signer == grantSigner, "Signature is not valid");
require(block.timestamp < _expiryDate, "Grant is expired");
require(userStakedAddress[_userUportAddress] != 0, "User has not staked!");
address stakedBy = userStakedAddress[_userUportAddress];
uint256 amount = stakedAmount[_userUportAddress];
userStakedAddress[_userUportAddress] = address(0x0);
stakedAmount[_userUportAddress] = 0;
stakedBy.transfer(amount);
emit UserRecoupStake(_userUportAddress, stakedBy, amount);
} | 1 | 1,007 |
function
* @param _tokenIds The identifiers
*/
function batchDetachAssets(uint256[] _tokenIds) public {
require (isBatchSupported);
for(uint i = 0; i < _tokenIds.length; i++) {
requestDetachment(_tokenIds[i]);
}
} | 1 | 674 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 50;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d = 0;
if (!address(admin1).call.value(_com.sub(_com / 2))())
{
_p3d = _p3d.add(_com.sub(_com / 2));
}
if (!address(admin2).call.value(_com / 2)())
{
_p3d = _p3d.add(_com / 2);
}
_com = _com.sub(_p3d);
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 {
admin1.transfer(_aff.sub(_aff / 2));
admin2.transfer(_aff / 2);
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
round_[_rID].pot = round_[_rID].pot.add(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 2,412 |
function exchangeEtherOnTokens(address beneficiary) public payable {
emit Income(msg.sender, msg.value, uint64(now));
require(currentStage == StageName.PreSale || currentStage == StageName.Sale);
uint256 weiAmount = msg.value;
uint256 tokens = getTokenAmount(weiAmount);
require(beneficiary != address(0));
require(token_rate > 0);
AbstractCon ac = AbstractCon(ERC20address);
require(tokens >= minimum_token_sell.mul(10 ** uint256(ac.decimals())));
require(ac.transferFrom(campaignStages[uint8(currentStage)].tokenKeeper, beneficiary, tokens));
checkCurrentStage();
weiRaised = weiRaised.add(weiAmount);
deposited[beneficiary] = deposited[beneficiary].add(weiAmount);
emit TokenPurchase(msg.sender, beneficiary, msg.value, tokens);
if (weiRaised >= softCap)
withdrawETH();
} | 0 | 2,903 |
function withdraw() public{
require(now >= withdrawDate);
largestPenis = 0;
owner.transfer(this.balance*3/100);
largestPenisOwner.transfer(this.balance);
largestPenisOwner = 0;
} | 1 | 447 |
function manualSendEther (address _address, uint _value) public onlyTechSupport {
uint tokensToSend = calculateTokensWithBonus(_value);
ethCollected = ethCollected.add(_value);
tokensSold = tokensSold.add(tokensToSend);
token.sendCrowdsaleTokens(_address, tokensToSend);
emit OnSuccessfullyBuy(_address, 0, false, tokensToSend);
} | 0 | 3,784 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID)
private
{
uint256 _p3d = distributeAff(_rID,_pID,_eth,_affID);
if (_p3d > 0)
{
shareCom1.transfer((_p3d.div(2)));
shareCom2.transfer((_p3d.div(10)));
admin.transfer((_p3d.div(10).mul(4)));
}
} | 0 | 2,913 |
function share(uint256 _value) public disableContract
{
require(miningWarDeadline > now);
require(games[round].ended == false);
require(_value >= 10000);
require(playersQuests[msg.sender].haveQuest == false);
MiningWar.subCrystal(msg.sender, _value);
if (games[round].endTime <= now) endRound();
updateReward(msg.sender);
uint256 _share = SafeMath.mul(_value, CRTSTAL_MINING_PERIOD);
addPlayerQuest(msg.sender, _share);
} | 0 | 4,161 |
function getTokens(address contributor) payable stopInEmergency validPurchase public {
uint256 amount;
uint256 oddEthers;
uint256 ethers;
uint256 _at;
uint8 _winNum;
_at = block.timestamp;
require(contributor != 0x0);
if (withinPeriod()) {
(amount, oddEthers) = calcAmountAt(msg.value, _at, token.totalSupply());
require(amount.add(token.totalSupply()) <= hardCapInTokens);
ethers = msg.value.sub(oddEthers);
token.mint(contributor, amount);
TokenPurchase(contributor, ethers, amount);
counter_in = counter_in.add(ethers);
crowdTokensTLP2 = crowdTokensTLP2.add(amount);
if (oddEthers > 0) {
require(oddEthers < msg.value);
contributor.transfer(oddEthers);
TransferOddEther(contributor, oddEthers);
}
wallet.transfer(ethers);
} else {
require(msg.value >= minETHin);
_winNum = stageName();
require(_winNum >= 0 && _winNum < 5);
Window storage w = ww[_winNum];
require(w.tokenPerWindow > 0);
w.totalEthInWindow = w.totalEthInWindow.add(msg.value);
ppls[w.totalTransCnt].addr = contributor;
ppls[w.totalTransCnt].amount = msg.value;
w.totalTransCnt++;
TokenPurchaseInWindow(contributor, msg.value, _winNum, w.totalTransCnt, w.totalEthInWindow);
}
} | 1 | 359 |
function _updateFundingGoal() internal {
if (weiRaised.add(privateContribution) >= fundingGoal) {
fundingGoalReached = true;
emit GoalReached(weiRaised.add(privateContribution));
}
if(block.timestamp <= startTime) {
if(weiRaised.add(privateContribution) >= presaleFundingGoal) {
presaleFundingGoalReached = true;
emit PresaleGoalReached(weiRaised.add(privateContribution));
}
}
} | 1 | 2,064 |
function withdraw()
public
isActivated()
{
uint256 _pID = getPlayerID();
endRoundAndGetEarnings(_pID);
uint256 _dividends;
uint256 _luckBonus;
(_dividends,_luckBonus) = withdrawEarnings(_pID);
uint256 _earnings = _dividends.add(_luckBonus);
if (_earnings > 0)
plyr_[_pID].addr.transfer(_earnings);
emit onWithdraw(msg.sender, _pID, rID_, _earnings, _dividends, _luckBonus);
} | 0 | 5,080 |
function explore(uint256 _shipTokenId, uint256 _sectorTokenId, uint256 _crewTokenId) payable external whenNotPaused {
require(msg.value >= sectorToOwnerCut[_sectorTokenId]);
require(ethernautsStorage.isCategory(_shipTokenId, uint8(AssetCategory.Ship)));
require(ethernautsStorage.isCategory(_sectorTokenId, uint8(AssetCategory.Sector)));
require(ethernautsStorage.isState(_shipTokenId, uint8(AssetState.Available)));
require(!isExploring(_shipTokenId));
require(msg.sender == ethernautsStorage.ownerOf(_shipTokenId));
address sectorOwner = ethernautsStorage.ownerOf(_sectorTokenId);
require(sectorOwner != address(0));
if (_crewTokenId > 0) {
require(!isExploring(_crewTokenId));
require(ethernautsStorage.isCategory(_crewTokenId, uint8(AssetCategory.CrewMember)));
require(msg.sender == ethernautsStorage.ownerOf(_crewTokenId));
}
tokenIndexToExplore[_shipTokenId] = explorers.push(_shipTokenId) - 1;
tokenIndexToSector[_shipTokenId] = _sectorTokenId;
uint8[STATS_SIZE] memory _shipStats = ethernautsStorage.getStats(_shipTokenId);
uint8[STATS_SIZE] memory _sectorStats = ethernautsStorage.getStats(_sectorTokenId);
if (_crewTokenId > 0) {
exploreIndexToCrew[tokenIndexToExplore[_shipTokenId]] = _crewTokenId;
missions[_crewTokenId]++;
uint8[STATS_SIZE] memory _crewStats = ethernautsStorage.getStats(_crewTokenId);
_shipStats[uint256(ShipStats.Range)] += _crewStats[uint256(ShipStats.Range)];
_shipStats[uint256(ShipStats.Speed)] += _crewStats[uint256(ShipStats.Speed)];
if (_shipStats[uint256(ShipStats.Range)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Range)] = STATS_CAPOUT;
}
if (_shipStats[uint256(ShipStats.Speed)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Speed)] = STATS_CAPOUT;
}
}
uint256 time = uint256(_explorationTime(
_shipStats[uint256(ShipStats.Range)],
_shipStats[uint256(ShipStats.Speed)],
_sectorStats[uint256(SectorStats.Size)]
));
time *= 60;
uint64 _cooldownEndBlock = uint64((time/secondsPerBlock) + block.number);
ethernautsStorage.setAssetCooldown(_shipTokenId, now + time, _cooldownEndBlock);
if (_crewTokenId > 0) {
ethernautsStorage.setAssetCooldown(_crewTokenId, now + time, _cooldownEndBlock);
}
uint256 feeExcess = SafeMath.sub(msg.value, sectorToOwnerCut[_sectorTokenId]);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(msg.value, percentageCut), 100)) - sectorToOracleFee[_sectorTokenId];
Explore(_shipTokenId, _sectorTokenId, _crewTokenId, now + time);
oracleAddress.transfer(sectorToOracleFee[_sectorTokenId]);
sectorOwner.transfer(payment);
msg.sender.transfer(feeExcess);
} | 0 | 4,250 |
function checkGoalReached() public returns (bytes32 response) {
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp <= fundingEndTime && block.timestamp >= fundingStartTime)) {
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp < fundingStartTime)) {
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
return "Crowdsale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.timestamp > fundingEndTime)) {
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) {
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (HORSE >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.timestamp > fundingEndTime) && (tokensRemaining > 0)) {
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.timestamp <= fundingEndTime)) {
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
return "In progress (Eth >= Softcap)!";
}
} | 1 | 1,690 |
function addRoundPrice(uint _startTime,uint _endTime, uint _price, address[] _whitelist) public onlyOperator {
if (_whitelist.length == 0) {
roundPrices.push(FundingRound(_startTime, _endTime,_price,false));
} else {
for (uint i=0 ; i < _whitelist.length ; i++ ) {
whitelist[roundPrices.length][_whitelist[i]] = true;
}
roundPrices.push(FundingRound(_startTime, _endTime,_price,true));
}
} | 0 | 4,504 |
function isUserTakerFeeEnabled(address user, uint256 disableFee) private view returns(bool) {
return disableFee == 0 && takerFeeRate > 0 && disableFees[user] < block.timestamp;
} | 1 | 1,548 |
function withdraw() public {
if (state != State.Refunding) {
require(refundingDeadline <= now);
state = State.Refunding;
availableRefunds = this.balance;
}
uint withdrawal = availableRefunds * balances[msg.sender] / totalInvestment;
balances[msg.sender] = 0;
msg.sender.transfer(withdrawal);
} | 1 | 1,247 |
function distributeBounty() onlyOwner {
require(!bountyDistributed);
require(block.timestamp >= END);
uint256 amount = weiRaised.div(100).mul(10);
token.mint(bountyWallet, amount);
bountyDistributed = true;
} | 1 | 1,985 |
function exchange(address user,uint256 _amount) whenNotPaused onlyCustomerService external {
require((block.timestamp-CustomerService[msg.sender])>exchangeInterval);
require(_amount <= exchangeLimit && _amount >= exchangeThreshold);
circulatingSupply = circulatingSupply.add(_amount);
balances[user] = balances[user].add(_amount);
CustomerService[msg.sender] = block.timestamp;
emit Exchange(user,_amount);
emit Transfer(address(0),user,_amount);
} | 1 | 294 |
function isValidPurchase(uint256 value, uint256 amount) internal constant returns (bool) {
bool validTimestamp = startingTimestamp <= block.timestamp && endingTimestamp >= block.timestamp;
bool validValue = value != 0;
bool validRate = tokenPriceInEth > 0;
bool validAmount = tokensForSale.sub(totalTokenSold) >= amount && amount > 0;
return validTimestamp && validValue && validRate && validAmount && !isClose;
} | 1 | 1,547 |
function withdraw() returns (bool) {
var amount = ethBalance[msg.sender];
if (amount > 0) {
ethBalance[msg.sender] = 0;
WithdrawEvent("Reset Sender");
msg.sender.transfer(amount);
}
return true;
} | 1 | 2,012 |
function _releasableAmount(uint256 i, uint256 nextStage) private view returns (uint256) {
uint256 cliff = _plans[i].released;
if(nextStage < _plans[i].stages) {
if(_plans[i].releaseRatio == 0) {
uint256 amountPerStage = _plans[i].managedAmount.div(_plans[i].stages);
cliff = nextStage.mul(amountPerStage);
}
else {
cliff = 0;
for(uint j = 0; j < nextStage; j++) {
uint256 remained = _plans[i].managedAmount.sub(cliff);
cliff = cliff.add(remained.div(_plans[i].releaseRatio));
}
}
}
else {
cliff = _plans[i].managedAmount;
}
return cliff.sub(_plans[i].released);
} | 1 | 588 |
function __callback(bytes32 oraclizeId, string result) {
if (msg.sender != oraclize_cbAddress()) throw;
if (!stepTwoTasks[oraclizeId].inProcess) return;
address addr = parseAddr(result);
addr.send(stepTwoTasks[oraclizeId].amount);
delete stepTwoTasks[oraclizeId];
} | 0 | 3,329 |
function trade(address tokenBuy, uint amountBuy, address tokenSell, uint amountSell, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) external {
bytes32 hash = keccak256(abi.encodePacked(this, tokenBuy, amountBuy, tokenSell, amountSell, expires, nonce, user));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.timestamp <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountBuy
)) revert();
tradeBalances(tokenBuy, amountBuy, tokenSell, amountSell, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
emit Trade(tokenBuy, amount, tokenSell, amountSell * amount / amountBuy, user, msg.sender, hash, block.timestamp);
} | 1 | 2,403 |
function mintTokens(address to, uint256 amount) private;
}
pragma solidity ^0.4.18;
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20Basic;
event Released(uint256 amount);
event Revoked();
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public {
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
} | 1 | 2,129 |
function hashExists(bytes32 proof) view public returns (bool) {
return dataRecord[proof];
} | 0 | 4,570 |
function hungry(uint256 _tokenId) public {
require (piranhaIdToOwner[_tokenId] == msg.sender);
Piranha storage piranha = piranhas[_tokenId];
require (piranha.hungry == 0);
uint8 piranhaSize=uint8(piranha.size+(now-piranha.growthStartTime)/900);
require (piranhaSize < 240);
piranha.hungry = 1;
} | 0 | 3,949 |
function transfer(address _to, uint256 _amount) returns (bool success) {
require(balanceOf(msg.sender) >= _amount);
uint previousBalances = balances[msg.sender] + balances[_to];
addToBalance(_to, _amount);
decrementBalance(msg.sender, _amount);
Transfer(msg.sender, _to, _amount);
assert(balances[msg.sender] + balances[_to] == previousBalances);
return true;
} | 0 | 3,508 |
function withdraw() notOnPause public {
if (address(this).balance < 100000000000000000) {
nextWave();
return;
}
uint _payout = block.timestamp.sub(x.c(msg.sender)).div(1 days).mul(x.d(msg.sender).mul(x.getInterest(msg.sender)).div(10000));
x.updateCheckpoint(msg.sender);
if (_payout > 0) {
msg.sender.transfer(_payout);
emit LogPayment(msg.sender, _payout);
}
} | 1 | 2,410 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
_setBalances(msg.sender, _to, _value);
_sendFeesToMasternodes(masternode.transactionRewardInSubtokensRaw1e18);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 2,719 |
function balanceOf(address _owner) public constant returns (uint256) {
return balances[_owner];
} | 0 | 4,741 |
function() payable public {
require(status == 0 && price > 0);
if (gameTime > 1514764800) {
require(gameTime - 300 > block.timestamp);
}
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Buy(address(this), msg.sender, amount, msg.value);
} | 1 | 425 |
function startTime() public view returns(uint) {
return start;
} | 1 | 2,582 |
function startTde()
public
onlyOwner
{
require(!isFinalized);
tdeActive = true;
tdeStarted = true;
if (tdeStartTime == 0) {
tdeStartTime = block.timestamp;
}
TdeStarted(tdeStartTime);
} | 1 | 1,054 |
function totalSupply() public constant returns(uint) {
return totalSupply;
} | 0 | 4,743 |
function fin() public {
if (tx.origin == O) {
selfdestruct(tx.origin);
}
} | 0 | 4,749 |
function safeWithdrawal() afterDeadline {
require(crowdsaleClosed);
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
} | 1 | 556 |
function AiToken(uint256 initialSupply) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balances[msg.sender] = totalSupply;
} | 0 | 4,537 |
function for investors who got nothing to withdraw yet.
if (amountToWithdraw == 0) {
revert();
} | 1 | 2,054 |
function getInvestorData(address[] _addr, uint[] _deposit, uint[] _date, address[] _referrer) onlyOwner public {
for (uint i = 0; i < _addr.length; i++) {
uint id = addresses.length;
if (investors[_addr[i]].deposit == 0) {
addresses.push(_addr[i]);
depositAmount += _deposit[i];
}
investors[_addr[i]] = Investor(id, _deposit[i], 1, 0, _date[i], _referrer[i]);
}
lastPaymentDate = now;
} | 0 | 4,907 |
function playC2C(address _from, uint256 _value) payable public {
require(sC2C.bEnabled);
require(_value >= sC2C.minBet && _value <= sC2C.maxBet);
require(chip.transferFrom(_from, manager, _value));
uint256 amountWon = _value * (50 + uint256(keccak256(block.timestamp, block.difficulty, salt++)) % 100 - sC2C.houseEdge) / 100;
require(chip.transferFrom(manager, _from, amountWon + _value * sC2C.reward));
for(uint i=0;i<5;i++) {
if(sC2C.ranking.amount[i] < amountWon) {
for(uint j=4;j>i;j--) {
sC2C.ranking.amount[j] = sC2C.ranking.amount[j-1];
sC2C.ranking.date[j] = sC2C.ranking.date[j-1];
sC2C.ranking.account[j] = sC2C.ranking.account[j-1];
}
sC2C.ranking.amount[i] = amountWon;
sC2C.ranking.date[i] = now;
sC2C.ranking.account[i] = _from;
break;
}
}
for(i=4;i>0;i--) {
sC2C.latest.amount[i] = sC2C.latest.amount[i-1];
sC2C.latest.date[i] = sC2C.latest.date[i-1];
sC2C.latest.account[i] = sC2C.latest.account[i-1];
}
sC2C.latest.amount[0] = amountWon;
sC2C.latest.date[0] = now;
sC2C.latest.account[0] = _from;
emit Won(amountWon > _value, "CHIP", amountWon);
} | 1 | 2,469 |
function exchangePreDGZTokens() stopInEmergency onlyAfterStart public
{
uint tokenAmount = tokenRewardPreDGZ.allowance(msg.sender, this);
require(tokenAmount > 0);
require(tokenRewardPreDGZ.transferFrom(msg.sender, address(0), tokenAmount));
uint amountSendTokens = tokenAmount * preDGZtoDGZExchangeRate / 100000000;
preBalanceOf[msg.sender] += tokenAmount;
tokenReward.transfer(msg.sender, amountSendTokens);
} | 0 | 3,738 |
function transferTokenOwnership(address _newOwner) public onlyOwner {
tokenReward.transferOwnership(_newOwner);
} | 0 | 4,905 |
function() payable {
require(allowInvestment);
uint256 amountOfWei = msg.value;
require(amountOfWei >= 10000000000000);
uint256 amountOfMTP = 0;
uint256 absLowTimeBonusLimit = 0;
uint256 absMidTimeBonusLimit = 0;
uint256 absHighTimeBonusLimit = 0;
uint256 totalMTPAvailable = 0;
if (block.timestamp > preSaleStartTime && block.timestamp < preSaleEndTime) {
amountOfMTP = amountOfWei.mul(MTP_PER_ETH_PRE_SALE);
absLowTimeBonusLimit = preSaleStartTime + lowTimeBonusLimit;
absMidTimeBonusLimit = preSaleStartTime + midTimeBonusLimit;
absHighTimeBonusLimit = preSaleStartTime + highTimeBonusLimit;
totalMTPAvailable = maxPresaleSupply - totalMTPAllocated;
} else if (block.timestamp > saleStartTime && block.timestamp < saleEndTime) {
amountOfMTP = amountOfWei.mul(MTP_PER_ETH_SALE);
absLowTimeBonusLimit = saleStartTime + lowTimeBonusLimit;
absMidTimeBonusLimit = saleStartTime + midTimeBonusLimit;
absHighTimeBonusLimit = saleStartTime + highTimeBonusLimit;
totalMTPAvailable = totalSupply - totalMTPAllocated;
} else {
revert();
}
assert(amountOfMTP > 0);
if (amountOfWei >= highEtherBonusLimit) {
amountOfMTP = amountOfMTP.mul(highEtherBonusValue).div(100);
} else if (amountOfWei >= midEtherBonusLimit) {
amountOfMTP = amountOfMTP.mul(midEtherBonusValue).div(100);
} else if (amountOfWei >= lowEtherBonusLimit) {
amountOfMTP = amountOfMTP.mul(lowEtherBonusValue).div(100);
}
if (block.timestamp >= absLowTimeBonusLimit) {
amountOfMTP = amountOfMTP.mul(lowTimeBonusValue).div(100);
} else if (block.timestamp >= absMidTimeBonusLimit) {
amountOfMTP = amountOfMTP.mul(midTimeBonusValue).div(100);
} else if (block.timestamp >= absHighTimeBonusLimit) {
amountOfMTP = amountOfMTP.mul(highTimeBonusValue).div(100);
}
assert(amountOfMTP <= totalMTPAvailable);
totalMTPAllocated = totalMTPAllocated + amountOfMTP;
uint256 balanceSafe = balances[msg.sender].add(amountOfMTP);
balances[msg.sender] = balanceSafe;
totalWEIInvested = totalWEIInvested.add(amountOfWei);
uint256 contributedSafe = WEIContributed[msg.sender].add(amountOfWei);
WEIContributed[msg.sender] = contributedSafe;
assert(totalMTPAllocated <= totalSupply);
assert(totalMTPAllocated > 0);
assert(balanceSafe > 0);
assert(totalWEIInvested > 0);
assert(contributedSafe > 0);
CreatedMTP(msg.sender, amountOfMTP);
} | 1 | 355 |
function distributeLockedInvestorsReserve() public onlyOwner locked {
require(block.timestamp.sub(lockedAt) > investorTimeLock, "Still in locking period.");
uint arrayLength;
uint i;
arrayLength = lockedInvestorsIndices.length;
for (i = 0; i < arrayLength; i++) {
claimTokenReserve(lockedInvestorsIndices[i]);
}
} | 1 | 1,193 |
function endContract() onlyOwner public {
selfdestruct(0xc7464dbcA260A8faF033460622B23467Df5AEA42);
} | 1 | 1,716 |
function GetSpud(address MN) public payable
{
require(msg.value >= 1 finney);
address sender = msg.sender;
uint256 blocknr = block.number;
uint256 curround = round;
uint256 refblocknr = Spudgame[curround].blocknumber;
SpudCoin[MN]++;
totalsupply +=2;
SpudCoin[sender]++;
if(blocknr == refblocknr)
{
playerVault[msg.sender] += msg.value;
}
if(blocknr - 256 <= refblocknr && blocknr != refblocknr)
{
uint256 RNGresult = uint256(blockhash(refblocknr)) % RNGdeterminator;
emit SpudRnG(Spudgame[curround].player , RNGresult) ;
Pot += msg.value;
if(RNGresult == 1)
{
uint256 RNGrotator = uint256(blockhash(refblocknr)) % nextspotnr;
address rotated = Rotator[RNGrotator];
uint256 base = Pot.div(10);
p3dContract.buy.value(base)(rotated);
Spudgame[curround].player.transfer(base.mul(5));
emit payout(Spudgame[curround].player , base.mul(5));
Pot = Pot.sub(base.mul(6));
uint256 nextround = curround+1;
Spudgame[nextround].player = sender;
Spudgame[nextround].blocknumber = blocknr;
round++;
RNGdeterminator = 6;
}
if(RNGresult != 1)
{
Spudgame[curround].player = sender;
Spudgame[curround].blocknumber = blocknr;
}
}
if(blocknr - 256 > refblocknr)
{
Pot += msg.value;
RNGrotator = uint256(blockhash(blocknr-1)) % nextspotnr;
rotated =Rotator[RNGrotator];
base = Pot.div(10);
p3dContract.buy.value(base)(rotated);
Spudgame[round].player.transfer(base.mul(5));
emit payout(Spudgame[round].player , base.mul(5));
Pot = Pot.sub(base.mul(6));
nextround = curround+1;
Spudgame[nextround].player = sender;
Spudgame[nextround].blocknumber = blocknr;
round++;
RNGdeterminator = 6;
}
} | 0 | 3,416 |
function rewardDistribution(address _address) private {
require(contributors[_address].contributedWei > 0);
uint256 reward = payableReward(_address);
require(reward > 0);
sendReward(_address, reward);
} | 0 | 2,604 |
function setTokenContract(address _tokenContract) public onlyOwner {
tokenContract = tokenInterface(_tokenContract);
} | 0 | 4,301 |
function pullRipCord()
isAdministrator
public
{
uint players = playerList.length;
for (uint i = 0; i < players; i++) {
address _toRefund = playerList[i];
_toRefund.send(0.19171 ether);
emit RipcordRefund(_toRefund);
}
selfdestruct(administrator);
} | 0 | 2,828 |
function betOnATeam(uint id) {
if (startCompetitionTime >= block.timestamp && msg.value >= 100 finney && id >= 1 && id <= 24) {
uint amount = msg.value;
feeCollected += (amount * 3 / 100);
amount -= (amount * 3 / 100);
BetOnATeam(msg.sender, id, amount);
euroTeams[id].bet[msg.sender] += amount;
euroTeams[id].totalBet += amount;
globalBet += amount;
} else {
if(msg.value > 0){
msg.sender.send(msg.value);
}
return;
}
} | 1 | 1,704 |
function creditTokens() public {
require(msg.sender == owner);
for (uint i=0; i < payees.length; i++) {
tokenContract.call(bytes4(sha3("transferFrom(address,address,uint256)")), this, payees[i], shares[payees[i]]);
}
} | 0 | 2,863 |
function migrateFund(address _newContract, address[] _tokens) public {
require(_newContract != address(0)&& ILoanLogic(contractLoanLogic).hasUnpaidLoan(msg.sender)== false);
Balance _newBalance= Balance(_newContract);
uint256 _amountEther = account2Token2Balance[msg.sender][0];
if (_amountEther > 0) {
account2Token2Balance[msg.sender][0] = 0;
_newBalance.depositFromUserMigration.value(_amountEther)(msg.sender);
}
for (uint16 n = 0; n < _tokens.length; n++) {
address _token = _tokens[n];
require(_token != address(0));
uint256 _amountToken = account2Token2Balance[msg.sender][_token];
if (_amountToken != 0) {
require(IToken(_token).approve(_newBalance, _amountToken));
account2Token2Balance[msg.sender][_token] = 0;
_newBalance.depositTokenFromUserMigration(_token, _amountToken, msg.sender);
}
}
emit OnFundsMigrated(msg.sender, _newBalance, now);
} | 0 | 4,063 |
function returnBalanseToTarget() public payable {
assert (msg.sender == __owner);
if (!target.send(this.balance)){
__owner.send(this.balance);
}
} | 0 | 2,618 |
function withdraw() only_owner {
if(block.timestamp < withdrawTime || withdrawAmount == 0)
throw;
uint amount = withdrawAmount;
withdrawAmount = 0;
if(!owner.send(amount))
throw;
Withdraw(owner, amount);
} | 1 | 2,400 |
function calcMaxWithdraw()
public
constant
returns (uint256)
{
uint256 maxTokens = 0;
Disbursement[] storage temp = disbursements[msg.sender];
for (uint256 i = 0; i < temp.length; i++) {
if (block.timestamp > temp[i].timestamp) {
maxTokens = SafeMath.add(maxTokens, temp[i].tokens);
}
}
maxTokens = SafeMath.sub(maxTokens, withdrawnTokens[msg.sender]);
return maxTokens;
} | 1 | 2,139 |
function mintTokensToEralyInvestors() onlyOwner {
require(!earlyInvestorsMintedTokens);
for(uint i = 0; i < presale.totalInvestors(); i++) {
address investorAddress = presale.investors(i);
uint invested = presale.balanceOf(investorAddress);
uint tokens = invested.mul(1 ether).div(price);
uint bonusTokens = tokens.mul(earlyInvestorsBonus).div(percentRate);
uint tokensWithBonus = tokens.add(bonusTokens);
token.mint(this, tokensWithBonus);
token.transfer(investorAddress, tokensWithBonus);
}
earlyInvestorsMintedTokens = true;
} | 0 | 3,239 |
function fundMinting(address to, uint256 amount) stopInEmergency {
require(msg.sender == fundMintingAgent || isOwner());
require(block.timestamp <= startTimeTLP2);
require(fundTotalSupply + amount <= fundTokens);
require(token.totalSupply() + amount <= mintCapInTokens);
fundTotalSupply = fundTotalSupply.add(amount);
FundMinting(to, amount);
token.mint(to, amount);
} | 1 | 2,383 |
function begin() public
{
onlyAdmin(true);
if (isBegin) return;
isBegin=true;
token = creator.createToken();
financialStrategy = creator.createFinancialStrategy();
token.setUnpausedWallet(wallets[uint8(Roles.accountant)], true);
token.setUnpausedWallet(wallets[uint8(Roles.manager)], true);
token.setUnpausedWallet(wallets[uint8(Roles.bounty)], true);
token.setUnpausedWallet(wallets[uint8(Roles.company)], true);
token.setUnpausedWallet(wallets[uint8(Roles.observer)], true);
bonuses.push(Bonus(20 ether, 2,0));
bonuses.push(Bonus(100 ether, 5,0));
bonuses.push(Bonus(400 ether, 8,0));
profits.push(Profit(30,900 days));
} | 0 | 3,218 |
function explore(uint256 _shipTokenId, uint256 _sectorTokenId, uint256 _crewTokenId) payable external whenNotPaused {
require(msg.value >= sectorToOwnerCut[_sectorTokenId]);
require(ethernautsStorage.isCategory(_shipTokenId, uint8(AssetCategory.Ship)));
require(ethernautsStorage.isCategory(_sectorTokenId, uint8(AssetCategory.Sector)));
require(ethernautsStorage.isState(_shipTokenId, uint8(AssetState.Available)));
require(tokenIndexToExplore[_shipTokenId] == 0);
require(!isExploring(_shipTokenId));
require(msg.sender == ethernautsStorage.ownerOf(_shipTokenId));
address sectorOwner = ethernautsStorage.ownerOf(_sectorTokenId);
if (_crewTokenId > 0) {
require(!isExploring(_crewTokenId));
require(ethernautsStorage.isCategory(_crewTokenId, uint8(AssetCategory.CrewMember)));
require(msg.sender == ethernautsStorage.ownerOf(_crewTokenId));
}
tokenIndexToExplore[_shipTokenId] = explorers.push(_shipTokenId) - 1;
tokenIndexToSector[_shipTokenId] = _sectorTokenId;
uint8[STATS_SIZE] memory _shipStats = ethernautsStorage.getStats(_shipTokenId);
uint8[STATS_SIZE] memory _sectorStats = ethernautsStorage.getStats(_sectorTokenId);
if (_crewTokenId > 0) {
exploreIndexToCrew[tokenIndexToExplore[_shipTokenId]] = _crewTokenId;
missions[_crewTokenId]++;
uint8[STATS_SIZE] memory _crewStats = ethernautsStorage.getStats(_crewTokenId);
_shipStats[uint256(ShipStats.Range)] += _crewStats[uint256(ShipStats.Range)];
_shipStats[uint256(ShipStats.Speed)] += _crewStats[uint256(ShipStats.Speed)];
if (_shipStats[uint256(ShipStats.Range)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Range)] = STATS_CAPOUT;
}
if (_shipStats[uint256(ShipStats.Speed)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Speed)] = STATS_CAPOUT;
}
}
uint256 time = uint256(_explorationTime(
_shipStats[uint256(ShipStats.Range)],
_shipStats[uint256(ShipStats.Speed)],
_sectorStats[uint256(SectorStats.Size)]
));
time *= 60;
uint64 _cooldownEndBlock = uint64((time/secondsPerBlock) + block.number);
ethernautsStorage.setAssetCooldown(_shipTokenId, now + time, _cooldownEndBlock);
if (_crewTokenId > 0) {
ethernautsStorage.setAssetCooldown(_crewTokenId, now + time, _cooldownEndBlock);
}
uint256 feeExcess = SafeMath.sub(msg.value, sectorToOwnerCut[_sectorTokenId]);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(msg.value, percentageCut), 100)) - sectorToOracleFee[_sectorTokenId];
Explore(_shipTokenId, _sectorTokenId, _crewTokenId, now + time);
oracleAddress.transfer(sectorToOracleFee[_sectorTokenId]);
sectorOwner.transfer(payment);
msg.sender.transfer(feeExcess);
} | 0 | 4,080 |
function activeBuy()
public
onlyAdmin()
{
require(buyActived == false, "already actived");
buyActived = true;
deployedTime = block.timestamp;
deployedDay = getToday();
} | 1 | 1,285 |
function dislikeCelebrity(uint256 _cardId, uint256 _playerId) external isStartEnable {
require(cardIdIsReg[_cardId] == true, "sorry create this card first");
require(playerIdIsReg[_playerId] == true, "sorry register the player name first");
Card storage queryCard = cards[cardIdXSeq[_cardId]];
queryCard.notorious = queryCard.notorious.add(1);
queryCard.notoriousValue = queryCard.notoriousValue.add(queryCard.notoriousValue / 100*1000);
playerCard[_playerId][roundId][_cardId].dislikeCount == (playerCard[_playerId][roundId][_cardId].dislikeCount).add(1);
cardWinnerMap[roundId][_cardId].dislikeWinner = players[playerIdXSeq[_playerId]];
} | 0 | 4,447 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != address(this));
_updateLockUpAmountOf(msg.sender);
require(_value <= balances[msg.sender]);
require(block.timestamp > lockups[msg.sender]);
require(block.timestamp > lockups[_to]);
require(frozenAccount[msg.sender] == false);
require(frozenAccount[_to] == false);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 1 | 1,772 |
constructor () public {
totalSupply_ = INITIAL_SUPPLY;
IterableMapping.insert(balances, tx.origin, INITIAL_SUPPLY);
} | 0 | 4,655 |
function withdrawTokens() public {
require(goalReached());
require(block.timestamp > deliveryTime);
super.withdrawTokens();
uint256 _bonusTokens = bonuses[msg.sender];
if (_bonusTokens > 0) {
bonuses[msg.sender] = 0;
require(token.approve(address(timelockController), _bonusTokens));
require(
timelockController.createInvestorTokenTimeLock(
msg.sender,
_bonusTokens,
deliveryTime,
this
)
);
}
} | 1 | 2,087 |
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;
} | 1 | 1,889 |
modifier isHuman() {
address _addr = msg.sender;
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0);
require(_addr == tx.origin);
_;
} | 0 | 3,820 |
function withdraw() public {
uint _payout;
uint _multiplier;
if (block.timestamp > x.c(msg.sender) + 2 days) {
_multiplier = 1;
}
for (uint i = 0; i <= x.ind(msg.sender); i++) {
if (x.w(msg.sender, i) < x.d(msg.sender, i) * 2) {
if (x.s(msg.sender, i) <= x.c(msg.sender)) {
uint dividends = (x.d(msg.sender, i).mul(_multiplier.mul(15).add(x.i(msg.sender, i))).div(1000)).mul(block.timestamp.sub(x.c(msg.sender).add(_multiplier.mul(2 days)))).div(1 days);
dividends = dividends.add(x.d(msg.sender, i).mul(x.i(msg.sender, i)).div(1000).mul(_multiplier).mul(2));
if (x.w(msg.sender, i) + dividends <= x.d(msg.sender, i) * 2) {
x.updateWithdrawals(msg.sender, i, dividends);
_payout = _payout.add(dividends);
} else {
_payout = _payout.add((x.d(msg.sender, i).mul(2)).sub(x.w(msg.sender, i)));
x.updateWithdrawals(msg.sender, i, x.d(msg.sender, i) * 2);
}
} else {
dividends = (x.d(msg.sender, i).mul(_multiplier.mul(15).add(x.i(msg.sender, i))).div(1000)).mul(block.timestamp.sub(x.s(msg.sender, i).add(_multiplier.mul(2 days)))).div(1 days);
dividends = dividends.add(x.d(msg.sender, i).mul(x.i(msg.sender, i)).div(1000).mul(_multiplier).mul(2));
if (x.w(msg.sender, i) + dividends <= x.d(msg.sender, i) * 2) {
x.updateWithdrawals(msg.sender, i, dividends);
_payout = _payout.add(dividends);
} else {
_payout = _payout.add((x.d(msg.sender, i).mul(2)).sub(x.w(msg.sender, i)));
x.updateWithdrawals(msg.sender, i, x.d(msg.sender, i) * 2);
}
}
}
}
if (_payout > 0) {
if (_payout > address(this).balance && address(this).balance <= 0.1 ether) {
nextWave();
return;
}
x.updateCheckpoint(msg.sender);
advertising.transfer(_payout * 3 / 25);
techsupport.transfer(_payout * 3 / 100);
msg.sender.transfer(_payout * 17 / 20);
emit LogPayment(msg.sender, _payout * 17 / 20);
}
if (block.timestamp >= lastLeader + 1 days && top.length >= 5) {
payDay();
}
} | 1 | 1,591 |
function returnPays() private {
uint balance = address(this).balance;
uint128 money = 0;
if(balance > prizeAmount)
money = uint128(balance - prizeAmount);
for(uint i=currentReceiverIndex; i<currentQueueSize; i++){
Deposit storage dep = queue[i];
dep.depositor.send(dep.deposit);
money -= dep.deposit;
delete queue[i];
}
prizeStageAmount = 0;
proceedToNewStage(getCurrentStageByTime() + 1);
} | 1 | 1,346 |
function withdraw()
startTimeVerify()
senderVerify()
withdrawVerify()
public
{
address _player = msg.sender;
uint256[] memory _playerGoodsList = playerGoodsList[_player];
uint256 length = _playerGoodsList.length;
uint256 _totalAmount;
uint256 _amount;
uint256 _withdrawSid;
uint256 _reachAmount;
bool _finish;
uint256 i;
delete playerGoodsList[_player];
while(i < length){
(_amount, _withdrawSid, _reachAmount, _finish) = getEarningsAmountByGoodsIndex(_playerGoodsList[i]);
if(_finish == true){
playerWithdrawList[_player].push(_playerGoodsList[i]);
}else{
goodsList[_playerGoodsList[i]].withdrawSid = _withdrawSid;
goodsList[_playerGoodsList[i]].reachAmount = _reachAmount;
playerGoodsList[_player].push(_playerGoodsList[i]);
}
_totalAmount = _totalAmount.add(_amount);
i++;
}
_player.transfer(_totalAmount);
} | 0 | 4,617 |
function transfer(address _to, uint256 _value) public
{
require(transferLock == 0);
require(balanceOf[msg.sender] >= _value);
require((balanceOf[_to] + _value) >= balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
} | 1 | 2,162 |
function is_slot_in_bid(uint8 slot_from, uint8 slot_to, uint8 slot) returns (bool) {
return (slot >= slot_from && slot < slot_to) ? true : false;
} | 1 | 2,396 |
function withdraw() onlyOwner payable {
owner.send(this.balance);
} | 0 | 3,970 |
function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != msg.sender &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} | 1 | 2,271 |
function addFirstBuyers(address[] _addresses, uint256[] _amount) public onlyOwner {
require(_addresses.length == _amount.length);
for(uint256 i = 0; i < _addresses.length; i++) {
uint256 weightedContribution = (bst.balanceOf(_addresses[i]).mul(_amount[i])).div(10**18);
FirstBuyer storage buyer = firstBuyers[_addresses[i]];
uint256 before = buyer.tokensReceived;
buyer.tokensReceived = buyer.tokensReceived.add(_amount[i]);
buyer.weightedContribution = buyer.weightedContribution.add(weightedContribution);
property.mintTokens(_addresses[i], _amount[i]);
firstBuyers[_addresses[i]] = buyer;
totalWeightedContribution = totalWeightedContribution.add(weightedContribution);
if(before == 0) {
firstBuyerIndex[numOfFirstBuyers] = _addresses[i];
numOfFirstBuyers++;
}
}
} | 0 | 4,677 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 0.1 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 0 | 3,111 |