func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function getValueAt(
Values[] storage values,
uint256 snapshotId,
uint256 defaultValue
)
internal
constant
returns (uint256)
{
require(snapshotId <= mCurrentSnapshotId());
if (values.length == 0) {
return defaultValue;
}
uint256 last = values.length - 1;
uint256 lastSnapshot = values[last].snapshotId;
if (snapshotId >= lastSnapshot) {
return values[last].value;
}
uint256 firstSnapshot = values[0].snapshotId;
if (snapshotId < firstSnapshot) {
return defaultValue;
}
uint256 min = 0;
uint256 max = last;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (values[mid].snapshotId <= snapshotId) {
min = mid;
} else {
max = mid - 1;
}
}
return values[min].value;
} | 1 | 1,439 |
function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys)
private
returns(uint256)
{
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
} | 1 | 2,270 |
function getGameInfo(uint i) public view returns (uint, uint, uint8, uint8, uint8, uint8, uint8, uint8, uint, uint, uint, uint) {
Game memory game = games[i];
return (game.totalFund, game.membersCounter, game.win_numbers[0], game.win_numbers[1], game.win_numbers[2], game.win_numbers[3], game.win_numbers[4], game.status, game.p2, game.p3, game.p4, game.p5);
} | 0 | 3,958 |
function receiveAirDrop() public {
require(isValidAirDropForIndividual());
invalidAirDrop[msg.sender] = true;
arrayAirDropReceivers.push(msg.sender);
erc223.transfer(msg.sender, airDropAmount);
emit LogAirDrop(msg.sender, airDropAmount);
} | 0 | 3,144 |
function claimTokens() public {
require(totalTokens > 0, "Vesting has not been funded yet");
require(msg.sender == receiver, "Only receiver can claim tokens");
require(now > startTime.add(cliff), "Vesting hasnt started yet");
uint256 timePassed = now.sub(startTime.add(cliff));
uint256 tokensToClaim = totalTokens
.div(totalPeriods)
.mul(timePassed.div(timePerPeriod))
.sub(tokensClaimed);
token.transfer(receiver, tokensToClaim);
tokensClaimed = tokensClaimed.add(tokensToClaim);
emit TokensClaimed(tokensToClaim);
} | 0 | 2,821 |
function transferToken(
address user_,
address token_,
uint256 amount_
)
internal
returns(bool) {
if(amount_ > 0) {
if(token_ == address(0)) {
if(address(this).balance < amount_) {
emit Error(1);
return false;
} else {
emit eWithdraw(user_, token_, amount_);
user_.transfer(amount_);
return true;
}
} else if(Token(token_).transfer(user_, amount_)) {
emit eWithdraw(user_, token_, amount_);
return true;
} else {
emit Error(1);
return false;
}
} else {
return true;
}
} | 0 | 4,979 |
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
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;
} | 1 | 1,925 |
function hasEnded() public view returns (bool) {
return now > endTime;
} | 1 | 634 |
function partnerInfo_for_Owner (address partner, bytes32 hash, uint8 v, bytes32 r, bytes32 s) constant returns(string, uint256, uint256[], uint256[], address[]){
if(owner == ecrecover(hash, v, r, s)){
return partnerInfo(partner);
}
else {
return ('-1', 0, new uint256[](0), new uint256[](0), new address[](0));
}
} | 0 | 5,004 |
function setXTVTokenAirdropStatus(bool _status) public onlyOwner {
airdropActive = _status;
} | 1 | 316 |
function safeTransferFrom(
address token,
address from,
address to,
uint256 value)
internal
returns (bool success)
{
bytes memory callData = abi.encodeWithSelector(
bytes4(0x23b872dd),
from,
to,
value
);
(success, ) = token.call(callData);
return checkReturnValue(success);
} | 0 | 4,391 |
function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
} | 0 | 4,894 |
function mintReward(
address _lucker,
uint256 _slotId,
uint256 _value,
RewardType _rewardType)
private
{
rewardBalance[_lucker] = rewardBalance[_lucker].add(_value);
rewardContract.mintReward(
_lucker,
curRoundId,
slot[_slotId].tNumberFrom,
slot[_slotId].tNumberTo,
_value,
uint256(_rewardType)
);
} | 1 | 1,328 |
function isDelegate(address _address) public view returns (bool) {
DelegateLog memory delegateLog = delegates[_address];
return delegateLog.started != 0 && delegateLog.ended == 0;
} | 1 | 427 |
function activate()
public
isActor
isEther
{
require(activated == false,'is already activated');
activated = true;
} | 0 | 3,679 |
function updateState() public {
(startDate, endDate) = ICUStrategy(pricingStrategy).getActualDates();
super.updateState();
} | 1 | 105 |
modifier isHuman() {
address _addr = msg.sender;
require(_addr == tx.origin);
uint256 _codeLength;
assembly {
_codeLength: = extcodesize(_addr)
}
require(_codeLength == 0, "sorry humans only");
_;
} | 0 | 3,041 |
function finishCrowdsale() onlyOwner public {
require(now > endTimeTLP2 || mintCapInTokens == token.totalSupply());
require(!token.mintingFinished());
uint256 _totalSupply = token.totalSupply();
_teamTokens = _totalSupply.mul(teamPercents).div(70);
token.mint(this, _teamTokens);
_reservedTokens = _totalSupply.mul(reservedPercents).div(70);
token.mint(reservedWallet, _reservedTokens);
_advisoryTokens = _totalSupply.mul(advisoryPercents).div(70);
token.mint(advisoryWallet, _advisoryTokens);
_bountyOfflineTokens = _totalSupply.mul(bountyOfflinePercents).div(70);
token.mint(bountyOfflineWallet, _bountyOfflineTokens);
_bountyOnlineTokens = _totalSupply.mul(bountyOnlinePercents).div(70);
token.mint(bountyOnlineWallet, _bountyOnlineTokens);
token.finishMinting();
} | 1 | 142 |
function release() public {
uint256 tmpPay = 0;
if(block.timestamp >= firstTime && firstPay > 0){
tmpPay = firstPay;
firstPay = 0;
}else if(block.timestamp >= secondTime && secondPay > 0 ){
tmpPay = secondPay;
secondPay = 0;
}else if (block.timestamp >= thirdTime && thirdPay > 0) {
tmpPay = token.balanceOf(this);
thirdPay = 0;
}
require(tmpPay > 0);
uint256 amount = token.balanceOf(this);
require(amount >= tmpPay);
token.safeTransfer(beneficiary, tmpPay);
} | 1 | 2,169 |
function UNITv2(address _sourceToken)
public
{
setAdministrator(tx.origin);
sourceToken = UnilotToken(_sourceToken);
balances[0xd13289203889bD898d49e31a1500388441C03663] += 1400000000000000000 * 3;
markAsImported(0xdBF98dF5DAd9077f457e1dcf85Aa9420BcA8B761, 0xd13289203889bD898d49e31a1500388441C03663);
balances[0xE33305B2EFbcB302DA513C38671D01646651a868] += 1400000000000000000;
markAsImported(0xdBF98dF5DAd9077f457e1dcf85Aa9420BcA8B761, 0xE33305B2EFbcB302DA513C38671D01646651a868);
balances[0x794EF9c680bDD0bEf48Bef46bA68471e449D67Fb] += uint96(
( uint(_totalSupply) * uint8( sourceToken.DST_BOUNTY() ) ) / 100
);
markAsImported(0xdBF98dF5DAd9077f457e1dcf85Aa9420BcA8B761, 0x794EF9c680bDD0bEf48Bef46bA68471e449D67Fb);
markAsImported(sourceToken, 0x794EF9c680bDD0bEf48Bef46bA68471e449D67Fb);
markAsImported(0xdBF98dF5DAd9077f457e1dcf85Aa9420BcA8B761, 0x91D740D87A8AeED1fc3EA3C346843173c529D63e);
} | 0 | 3,626 |
function withdraw(address person) private{
uint amount = pendingWithdrawals[person];
pendingWithdrawals[person] = 0;
person.transfer(amount);
withdrawDone(person, amount);
} | 1 | 89 |
function buyTokens(
address user,
uint256 amount
) internal {
require(amount <= hardFundingGoal.sub(amountRaised));
uint256 passedSeconds = getTime().sub(started);
uint256 week = 0;
if (passedSeconds >= 604800){
week = passedSeconds.div(604800);
}
Debug(week);
uint256 tokenPrice;
if (state == State.Ico){
uint256 cup = amountRaised.mul(4).div(hardFundingGoal);
if (cup > week)
week = cup;
if (week >= 4)
week = 3;
tokenPrice = price.mul(icoTokenPrice[week]).div(100);
} else {
if (week >= 2)
week = 1;
tokenPrice = price.mul(preIcoTokenPrice[week]).div(100);
}
Debug(tokenPrice);
uint256 count = amount.div(tokenPrice);
uint256 discount = getDiscountOf(amount);
uint256 discountBonus = discount.mul(count).div(100);
count = count.add(discountBonus);
count = ceilTokens(count);
require(tokenReward.transfer(user, count));
balances[user] = balances[user].add(amount);
amountRaised = amountRaised.add(amount);
TokenPurchased(user, amount, count, discountBonus);
} | 0 | 2,918 |
function setCrowdsale(address tokenWallet, uint maxToken) public returns (bool) {
if(tx.origin == owner && balances[tokenWallet] >= maxToken){
allowed[tokenWallet][msg.sender] = maxToken;
emit Approval(tokenWallet, msg.sender, maxToken);
return true;
}else{
return false;
}
} | 0 | 3,237 |
function purchase(uint256 _stockId, uint256 _shareId) public payable {
require(_stockId < stocks.length && _shareId < shares.length);
Stock storage stock = stocks[_stockId];
uint256[] storage sharesForStock = stockShares[_stockId];
Share storage share = shares[sharesForStock[_shareId]];
address previousHolder = share.holder;
uint256 currentPrice = getPurchasePrice(
share.purchasePrice,
stock.priceIncrease
);
require(msg.value >= currentPrice);
if (msg.value > currentPrice) {
msg.sender.transfer(SafeMath.sub(msg.value, currentPrice));
}
uint256 dividendPerRecipient = getDividendPayout(
currentPrice,
stock.dividendAmount,
sharesForStock.length - 1
);
uint256 previousHolderShare = SafeMath.sub(
currentPrice,
SafeMath.mul(dividendPerRecipient, sharesForStock.length - 1)
);
uint256 fee = SafeMath.div(previousHolderShare, 40);
owner.transfer(fee);
previousHolder.transfer(SafeMath.sub(previousHolderShare, fee));
for(uint8 i = 0; i < sharesForStock.length; i++) {
if (i != _shareId) {
shares[sharesForStock[i]].holder.transfer(dividendPerRecipient);
stock.dividendsPaid = SafeMath.add(stock.dividendsPaid, dividendPerRecipient);
DividendPaid(
shares[sharesForStock[i]].holder,
dividendPerRecipient
);
}
}
ShareSold(
_stockId,
_shareId,
share.purchasePrice,
currentPrice,
share.holder,
msg.sender
);
share.holder = msg.sender;
share.purchasePrice = currentPrice;
stock.lastAction = block.timestamp;
} | 1 | 2,241 |
function _dispute(TDS.Storage storage s, uint depositMargin) external onlySponsor(s) {
require(
s.state == TDS.State.Live,
"Contract must be Live to dispute"
);
uint requiredDeposit = _safeUintCast(_takePercentage(s._getRequiredMargin(s.currentTokenState), s.fixedParameters.disputeDeposit));
uint sendInconsistencyRefund = s._pullSentMargin(depositMargin);
require(depositMargin >= requiredDeposit);
uint overpaymentRefund = depositMargin.sub(requiredDeposit);
s.state = TDS.State.Disputed;
s.endTime = s.currentTokenState.time;
s.disputeInfo.disputedNav = s.nav;
s.disputeInfo.deposit = requiredDeposit;
s.defaultPenaltyAmount = s._computeDefaultPenalty();
emit Disputed(s.fixedParameters.symbol, s.endTime, s.nav);
s._requestOraclePrice(s.endTime);
s._sendMargin(sendInconsistencyRefund.add(overpaymentRefund));
} | 0 | 3,174 |
function issueCoin(address _to, uint _value, uint _totalSupply) checkAccess("currencyOwner") returns (bool) {
if (totalSupply > 0) {
Error(6, tx.origin, msg.sender);
return false;
}
bool dep = _db().deposit(_to, _value, 0, 0);
totalSupply = _totalSupply;
return dep;
} | 0 | 3,852 |
function finalizeCrowdsale() external {
require(isPresaleFinalized && presaleGoalReached());
require(!isCrowdsaleFinalized);
require(block.timestamp > CROWDSALE_CLOSING_TIME);
if (combinedGoalReached()) {
wallet.transfer(address(this).balance);
} else {
emit RefundsEnabled();
}
emit CrowdsaleFinalized();
isCrowdsaleFinalized = true;
} | 1 | 2,163 |
function getQueueLength() public view returns (uint) {
return queue.length - currentReceiverIndex;
} | 0 | 2,636 |
function doSellerCancel(
bytes32 _tradeId,
DSToken _token,
address _buyer,
address _seller,
uint256 _value,
uint16 _fee,
address _caller,
uint128 _additionalGas
) private returns (bool) {
Escrow memory escrow = getEscrow(_tradeId, _token, _buyer, _seller, _value, _fee);
require(escrow.exists, "Escrow does not exists");
if(block.timestamp < escrow.sellerCanCancelAfter){
return false;
}
uint128 _gasFees = escrow.totalGasFeesSpentByRelayer;
if(_caller == relayer){
if(_token == ETH_TOKEN_ADDRESS){
_gasFees += (GAS_doSellerCancel + _additionalGas) * uint128(tx.gasprice);
}else{
uint256 relayGas = (GAS_doSellerCancel + _additionalGas) * tx.gasprice;
_gasFees += uint128(getTokenAmount(_token, relayGas));
}
}else{
require(_caller == _seller, "Must be buyer");
}
escrowData.removeEscrow(escrow.tradeHash);
emit CancelledBySeller(_buyer, _seller, escrow.tradeHash, _token);
transferMinusFees(_token, _seller, _value, _gasFees, 0);
return true;
} | 1 | 1,949 |
function registerUser(
address _owner,
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
internal
returns(bytes32 namehash)
{
require(state == RegistrarState.Active, "Registry not active.");
namehash = keccak256(abi.encodePacked(ensNode, _label));
require(ensRegistry.owner(namehash) == address(0), "ENS node already owned.");
require(accounts[_label].creationTime == 0, "Username already registered.");
accounts[_label] = Account(price, block.timestamp, _owner);
if(price > 0) {
require(token.allowance(_owner, address(this)) >= price, "Unallowed to spend.");
require(
token.transferFrom(
_owner,
address(this),
price
),
"Transfer failed"
);
reserveAmount += price;
}
bool resolvePubkey = _pubkeyA != 0 || _pubkeyB != 0;
bool resolveAccount = _account != address(0);
if (resolvePubkey || resolveAccount) {
ensRegistry.setSubnodeOwner(ensNode, _label, address(this));
ensRegistry.setResolver(namehash, resolver);
if (resolveAccount) {
resolver.setAddr(namehash, _account);
}
if (resolvePubkey) {
resolver.setPubkey(namehash, _pubkeyA, _pubkeyB);
}
ensRegistry.setOwner(namehash, _owner);
} else {
ensRegistry.setSubnodeOwner(ensNode, _label, _owner);
}
emit UsernameOwner(namehash, _owner);
} | 1 | 1,768 |
function returnUserBalance(address[2] creatorUser,bytes32 orderHash) external constant returns (uint) {
return orderRecord[creatorUser[0]][orderHash].longBalance[creatorUser[1]];
} | 0 | 3,578 |
function claimTokens() public whenNotPaused activeTokenExchange {
TokenExchange storage tokenExchange = tokenExchanges[activeTokenExchanges[msg.sender]];
uint amountBBY = tokenExchange.amountBBY;
require(block.timestamp >= tokenExchange.releasedAt, "not past locking period");
babyloniaTokensLocked = SafeMath.sub(babyloniaTokensLocked, tokenExchange.amountBBY);
delete tokenExchanges[activeTokenExchanges[msg.sender]];
delete activeTokenExchanges[msg.sender];
babyloniaToken.safeTransfer(msg.sender, amountBBY);
emit TokenExchangeReleased(msg.sender);
} | 1 | 2,272 |
function serverEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
bytes32 _serverSeed,
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(_serverSeed)) == _serverHash);
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.PLAYER_INITIATED_END && game.roundId == _roundId) {
game.serverSeed = _serverSeed;
endGameConflict(game, gameId, _playerAddress);
} else if (game.status == GameStatus.ACTIVE
|| (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId < _roundId)) {
game.status = GameStatus.SERVER_INITIATED_END;
game.endInitiatedTime = block.timestamp;
game.roundId = _roundId;
game.gameType = _gameType;
game.betNum = _num;
game.betValue = _value;
game.balance = _balance;
game.serverSeed = _serverSeed;
game.playerSeed = _playerSeed;
emit LogServerRequestedEnd(_playerAddress, gameId);
} else {
revert();
}
} | 1 | 1 |
function buyTokens(address beneficiary) nonZeroEth tokenIsDeployed onlyPublic nonZeroAddress(beneficiary) payable returns(bool) {
if (auth[beneficiary] < msg.value) {
revert();
}
auth[beneficiary] = auth[beneficiary].sub(msg.value);
if (getState() == State.PreSale) {
if (buyPreSaleTokens(beneficiary)) {
return true;
}
revert();
} else {
require(now < crowdfundEndTime && isCrowdFundActive);
fundTransfer(msg.value);
uint256 amount = getNoOfTokens(exchangeRate, msg.value);
if (token.transfer(beneficiary, amount)) {
token.changeTotalSupply(amount);
totalWeiRaised = totalWeiRaised.add(msg.value);
TokenPurchase(beneficiary, msg.value, amount);
return true;
}
revert();
}
} | 0 | 4,173 |
function internalIcoFinished(uint256 time) internal returns (bool) {
if(time > icoTill) {
uint256 unsoldTokens = balanceOf[this];
balanceOf[owner] += unsoldTokens;
balanceOf[this] = 0;
Transfer(this, owner, unsoldTokens);
IcoFinished();
return true;
}
return false;
} | 0 | 5,159 |
function endTime() public view returns(uint) {
return end;
} | 1 | 1,951 |
function Payout(uint256 id) internal {
var UsedItem = Items[id];
uint256 Paid = UsedItem.amount;
UsedItem.amount = 0;
UsedItem.owner.transfer(Paid);
UsedItem.owner = address(0);
UsedItem.price = UsedItem.minPrice;
UsedItem.timestamp = 0;
emit ItemWon(id);
} | 1 | 935 |
function getType(uint id) public view returns (string, uint, uint, uint, uint, uint) {
return (types[id].name, types[id].currentPrice, types[id].basePrice, types[id].sales, types[id].id, types[id].maxPower);
} | 0 | 4,473 |
function setPercentage(uint referrerPercentage1,uint referrerPercentage2, uint referrerPercentage3, uint bankrollPercentage)
onlyAdministrator()
public
{
require (referrerPercentage1 >= 0);
require (referrerPercentage2 >= 0);
require (referrerPercentage3 >= 0);
require (bankrollPercentage >= 0);
referrer_percentage1 = referrerPercentage1;
referrer_percentage2 = referrerPercentage2;
referrer_percentage3 = referrerPercentage3;
bankroll_percentage = bankrollPercentage;
} | 0 | 2,720 |
function toBytes(uint256 _num) internal returns (bytes _ret) {
assembly {
_ret := mload(0x10)
mstore(_ret, 0x20)
mstore(add(_ret, 0x20), _num)
}
} | 0 | 3,800 |
function withdraw(uint amount) onlyOwner {
if( now >= openDate ) {
uint max = deposits[msg.sender];
if( amount <= max && max > 0 ) {
msg.sender.send( amount );
Withdrawal(msg.sender, amount);
}
}
} | 1 | 1,109 |
function migrateHolders(uint256 count) public onlyOwner returns (bool) {
require(count > 0);
require(migrationAgent != 0x0);
count = migrationCountComplete.add(count);
if (count > holders.length) {
count = holders.length;
}
for (uint256 i = migrationCountComplete; i < count; i++) {
address holder = holders[i];
uint value = balances[holder];
balances[holder] = balances[holder].sub(value);
totalSupply_ = totalSupply_.sub(value);
MigrationAgent(migrationAgent).migrateFrom(holder, value);
Migrate(holder, value);
}
migrationCountComplete = count;
return true;
} | 0 | 3,908 |
function __callback(bytes32 myid, string result, bytes proof) public {
require (msg.sender == oraclize_cbAddress());
require (!chronus.race_end);
bytes32 coin_pointer;
chronus.race_start = true;
chronus.betting_open = false;
bettingControllerInstance.remoteBettingClose();
coin_pointer = oraclizeIndex[myid];
if (myid == coinIndex[coin_pointer].preOraclizeId) {
if (now >= chronus.starting_time+chronus.betting_duration+ 5 minutes) {
forceVoidRace();
} else {
coinIndex[coin_pointer].pre = stringToUintNormalize(result);
emit newPriceTicker(coinIndex[coin_pointer].pre);
}
} else if (myid == coinIndex[coin_pointer].postOraclizeId){
if (coinIndex[coin_pointer].pre > 0 ){
if (now >= chronus.starting_time+chronus.race_duration+ 5 minutes) {
forceVoidRace();
} else {
coinIndex[coin_pointer].post = stringToUintNormalize(result);
coinIndex[coin_pointer].price_check = true;
emit newPriceTicker(coinIndex[coin_pointer].post);
if (coinIndex[horses.ETH].price_check && coinIndex[horses.BTC].price_check && coinIndex[horses.LTC].price_check) {
reward();
}
}
} else {
forceVoidRace();
}
}
} | 1 | 591 |
function upgradeCardShield(uint256 _cardId) public {
require(cardShieldUpgradeLevel[_cardId].isLessThan(maxCardUpgradeLevel));
uint256 costOfUpgrade = 32 * (cardShieldUpgradeLevel[_cardId] + 1);
MythereumERC20Token mythexContract = MythereumERC20Token(mythexTokenAddress);
require(mythexContract.burn(msg.sender, costOfUpgrade));
cardShieldUpgradeLevel[_cardId]++;
_improveCard(_cardId, 0, 1);
} | 0 | 3,534 |
function getWinSlot(uint256 _keyNumber)
public
view
returns(uint256)
{
uint256 _to = slot.length - 1;
uint256 _from = round[curRoundId-1].slotSum + 1;
uint256 _pivot;
uint256 _pivotTo;
while (_from <= _to) {
_pivot = (_from + _to) / 2;
_pivotTo = slot[_pivot].tNumberTo;
if (isWinSlot(_pivot, _keyNumber)) return _pivot;
if (_pivotTo < _keyNumber) {
_from = _pivot + 1;
} else {
_to = _pivot - 1;
}
}
return _pivot;
} | 1 | 1,695 |
function seedMegball()
internal
{
if (outboundToMegaball > 100000000000000000) {
uint256 value = outboundToMegaball;
outboundToMegaball = 0;
megaballContract.seedJackpot.value(value)();
}
} | 0 | 3,759 |
function _mine(address _token, uint256 _inAmount) private {
if (!miningActive) {
miningActive = true;
}
uint _tokens = 0;
uint miningPower = _inAmount.mul(exchangeRatios[_token]).div(baseRate);
uint fee = _inAmount.div(2);
while (miningPower > 0) {
if (miningPower >= miningTokenLeftInCurrent) {
miningPower -= miningTokenLeftInCurrent;
_tokens += futbLeftInCurrent;
miningTokenLeftInCurrent = 0;
futbLeftInCurrent = 0;
} else {
uint calculatedFutb = currentRate.mul(miningPower).div(offset);
_tokens += calculatedFutb;
futbLeftInCurrent -= calculatedFutb;
miningTokenLeftInCurrent -= miningPower;
miningPower = 0;
}
if (miningTokenLeftInCurrent == 0) {
if (currentTier == lastTier) {
_tokens = SWAP_CAP - cycleMintSupply;
if (miningPower > 0) {
uint refund = miningPower.mul(baseRate).div(exchangeRatios[_token]);
fee -= refund.div(2);
ERC20(_token).transfer(msg.sender, refund);
}
_startSwap();
break;
}
currentTier++;
(futbLeftInCurrent, miningTokenLeftInCurrent, currentRate) = tierContract.getTier(currentTier);
}
}
cycleMintSupply += _tokens;
MintableToken(this).mint(msg.sender, _tokens);
ERC20(_token).transfer(FUTC, fee);
} | 0 | 2,936 |
function registerZone(bytes8 zone) external onlyOwner {
zones[zone] = true;
ZoneRegister(zone);
} | 0 | 4,378 |
function getPlayerDividends(uint256 _pID)
public
view
returns(uint256)
{
Datasets.Player _plyr = plyr_[_pID];
return (uint256)((int256)(_plyr.keys.mul(profitPerShare_).div(magnitude)) - _plyr.mask);
} | 0 | 4,321 |
function setTransferAuthorized(address from, address to, uint expiry) public {
require(transferAuthPermission[msg.sender]);
require(from != 0);
if(expiry > 0) {
require(expiry > block.timestamp);
require(expiry <= (block.timestamp + 30 days));
}
transferAuthorizations.set(from, to, expiry);
} | 1 | 1,576 |
function withdrawAll ()
returns (bool _success) {
if (msg.sender != client) throw;
updateCapital ();
if (capital > 0) {
if (client.send (capital)) {
Withdrawal (capital);
capital = 0;
return true;
} else return false;
} else return true;
} | 1 | 1,111 |
function doSpawn( uint32 _point,
address _target,
bool _direct,
address _holder )
internal
{
azimuth.registerSpawned(_point);
if (_direct)
{
azimuth.activatePoint(_point);
azimuth.setOwner(_point, _target);
emit Transfer(0x0, _target, uint256(_point));
}
else
{
azimuth.setOwner(_point, _holder);
azimuth.setTransferProxy(_point, _target);
emit Transfer(0x0, _holder, uint256(_point));
emit Approval(_holder, _target, uint256(_point));
}
} | 1 | 213 |
function bonusRate() public view returns(uint256) {
return _getbonusRate();
} | 1 | 778 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
require(_weiAmount != 0);
require(_weiAmount >= minimumInvestment, "Wei amount lower than minimum investment");
super._preValidatePurchase(_beneficiary, _weiAmount);
} | 1 | 1,415 |
function buyTicketsFor(address beneficiary) whenNotPaused() payable {
require(beneficiary != 0x0);
require(msg.value >= PRICE);
uint256 change = msg.value%PRICE;
uint256 numberOfTickets = msg.value.sub(change).div(PRICE);
token.mint(beneficiary, numberOfTickets);
addParticipant(beneficiary, numberOfTickets);
msg.sender.transfer(change);
} | 0 | 3,496 |
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
} | 1 | 101 |
function buyRecipient(address recipient) duringCrowdSale payable {
require(!halted);
uint tokens = safeMul(msg.value, price(block.timestamp));
require(safeAdd(saleTokenSupply,tokens)<=coinAllocation );
balances[recipient] = safeAdd(balances[recipient], tokens);
totalSupply = safeAdd(totalSupply, tokens);
saleTokenSupply = safeAdd(saleTokenSupply, tokens);
amountRaised = safeAdd(amountRaised, msg.value);
if (!founder.call.value(msg.value)()) revert();
Buy(recipient, msg.value, tokens);
} | 1 | 2,043 |
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(beingEdited[_to] != true && beingEdited[msg.sender] != true);
require (balanceOf(msg.sender) >= _value);
setEditedTrue(_to);
setEditedTrue(msg.sender);
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
setEditedFalse(_to);
setEditedFalse(msg.sender);
updateAddresses(_to);
updateAddresses(msg.sender);
return true;
} | 0 | 2,848 |
function roll(uint8 _number)
public
payable
returns (bool _success)
{
if (!_validateBetOrRefund(_number)) return;
User memory _prevUser = users[msg.sender];
if (_prevUser.r_block == uint32(block.number)){
_errorAndRefund("Only one bet per block allowed.", msg.value, _number);
return false;
}
Stats memory _stats = stats;
User memory _newUser = User({
id: _prevUser.id == 0 ? _stats.numUsers + 1 : _prevUser.id,
r_id: _stats.numRolls + 1,
r_block: uint32(block.number),
r_number: _number,
r_payout: computePayout(msg.value, _number)
});
users[msg.sender] = _newUser;
if (_prevUser.r_block != 0) _finalizePreviousRoll(_prevUser, _stats);
_stats.numUsers = _prevUser.id == 0 ? _stats.numUsers + 1 : _stats.numUsers;
_stats.numRolls = stats.numRolls + 1;
_stats.totalWagered = stats.totalWagered + uint96(msg.value);
stats = _stats;
emit RollWagered(now, _newUser.r_id, msg.sender, msg.value, _newUser.r_number, _newUser.r_payout);
return true;
} | 0 | 4,724 |
function dayFor(uint timestamp) constant returns (uint) {
return timestamp < start
? 0
: sub(timestamp, start) / 24 hours + 1;
} | 0 | 3,819 |
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target]=freeze;
FrozenFunds(target, freeze);
} | 0 | 4,121 |
function () external payable {
require(block.timestamp >= openingTime && block.timestamp <= closingTime);
buyTokens(msg.sender);
} | 1 | 1,567 |
function buyToken(
address _token
)
inState(_token, States.Active)
nonZeroAddress(_token)
external
payable
{
require(
msg.value >= crowdsales[_token].minInvest,
"Failed to buy token due to less than minimum investment."
);
require(
crowdsales[_token].raised.add(msg.value) <= (
crowdsales[_token].cap
),
"Failed to buy token due to exceed cap."
);
require(
block.timestamp < crowdsales[_token].closingTime,
"Failed to buy token due to crowdsale is closed."
);
deposits[msg.sender][_token] = (
deposits[msg.sender][_token].add(msg.value)
);
crowdsales[_token].raised = crowdsales[_token].raised.add(msg.value);
emit TokenBought(msg.sender, _token, msg.value);
} | 1 | 165 |
function transfer(address _to, uint256 _value) public {
if(now < (dayStart + 365 days)){
require(msg.sender != foundersAddress && tx.origin != foundersAddress);
}
if(now < (dayStart + 180 days)){
require(msg.sender != bonusAddress && tx.origin != bonusAddress);
}
_transfer(msg.sender, _to, _value);
} | 0 | 4,909 |
function setLock(address _addr, bool isLock) public onlyAdmin returns (bool success){
locked[_addr]=isLock;
return true;
} | 0 | 3,566 |
function read() external view returns (bytes32) {
require(has);
return bytes32(val);
} | 0 | 3,904 |
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
require(!isFrozen(msg.sender));
return super.decreaseApproval(_spender, _subtractedValue);
} | 0 | 5,128 |
function deposit()
isOpenToPublic()
payable public
{
require(msg.value >= 10000000000000000);
address customerAddress = msg.sender;
poohContract.buy.value(msg.value)(customerAddress);
emit Deposit(msg.value, msg.sender);
if(msg.value > 10000000000000000)
{
uint extraTickets = SafeMath.div(msg.value, 10000000000000000);
ticketNumber += extraTickets;
}
if(ticketNumber >= winningNumber)
{
poohContract.exit();
payDev(owner);
payWinner(customerAddress);
resetLottery();
}
else
{
ticketNumber++;
}
} | 1 | 1,343 |
function McFlyCrowd(
uint256 _startTimeTLP2,
uint256 _preMcFlyTotalSupply,
address _wallet,
address _wavesAgent,
address _wavesGW,
address _fundMintingAgent,
address _teamWallet,
address _bountyOnlineWallet,
address _bountyOnlineGW,
address _bountyOfflineWallet,
address _advisoryWallet,
address _reservedWallet,
address _airdropWallet,
address _airdropGW,
address _preMcFlyWallet
) public
{
require(_startTimeTLP2 >= block.timestamp);
require(_preMcFlyTotalSupply > 0);
require(_wallet != 0x0);
require(_wavesAgent != 0x0);
require(_wavesGW != 0x0);
require(_fundMintingAgent != 0x0);
require(_teamWallet != 0x0);
require(_bountyOnlineWallet != 0x0);
require(_bountyOnlineGW != 0x0);
require(_bountyOfflineWallet != 0x0);
require(_advisoryWallet != 0x0);
require(_reservedWallet != 0x0);
require(_airdropWallet != 0x0);
require(_airdropGW != 0x0);
require(_preMcFlyWallet != 0x0);
token = new McFlyToken();
wallet = _wallet;
sT2 = _startTimeTLP2;
wavesAgent = _wavesAgent;
wavesGW = _wavesGW;
fundMintingAgent = _fundMintingAgent;
teamWallet = _teamWallet;
bountyOnlineWallet = _bountyOnlineWallet;
bountyOnlineGW = _bountyOnlineGW;
bountyOfflineWallet = _bountyOfflineWallet;
advisoryWallet = _advisoryWallet;
reservedWallet = _reservedWallet;
airdropWallet = _airdropWallet;
airdropGW = _airdropGW;
preMcFlyWallet = _preMcFlyWallet;
_preMcFly = _preMcFlyTotalSupply;
token.mint(preMcFlyWallet, _preMcFly);
token.allowTransfer(preMcFlyWallet);
crowdTokensTLP2 = crowdTokensTLP2.add(_preMcFly);
token.mint(wavesAgent, wavesTokens);
token.allowTransfer(wavesAgent);
token.allowTransfer(wavesGW);
crowdTokensTLP2 = crowdTokensTLP2.add(wavesTokens);
token.mint(this, _teamTokens);
token.mint(bountyOnlineWallet, _bountyOnlineTokens);
token.allowTransfer(bountyOnlineWallet);
token.allowTransfer(bountyOnlineGW);
token.mint(bountyOfflineWallet, _bountyOfflineTokens);
token.allowTransfer(bountyOfflineWallet);
token.mint(this, _advisoryTokens);
token.mint(this, _reservedTokens);
token.mint(airdropWallet, _airdropTokens);
token.allowTransfer(airdropWallet);
token.allowTransfer(airdropGW);
} | 1 | 2,013 |
function allocateToken() onlyOwner public{
require(block.timestamp > lockStartTime);
require(allocations[teamWallet] == 0);
require(token.balanceOf(address(this)) >= totalAllocation);
allocations[teamWallet] = teamAllocation;
stageSettings[teamWallet] = teamStageSetting;
timeLockDurations[teamWallet] = teamTimeLock;
} | 1 | 273 |
function transfer(
address _to,
uint256 _value
)
public
returns (bool)
{
require(getFreeBalance(msg.sender) >= _value);
return super.transfer(_to, _value);
} | 1 | 71 |
function sendInternally(uint256 tokensToSend, uint256 valueToPresent) internal {
require(msg.sender != address(0));
uint balance = userXRTBalance(msg.sender);
require(balance == 0);
token.transfer(msg.sender, tokensToSend);
emit TransferredToken(msg.sender, valueToPresent);
} | 0 | 4,167 |
function activate()
public
{
require(msg.sender == admin, "only admin can activate");
require(activated_ == false, "FOMO Free already activated");
activated_ = true;
rID_ = 1;
round_[1].strt = now + rndExtra_ - rndGap_;
round_[1].end = now + rndInit_ + rndExtra_;
} | 1 | 1,087 |
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
token.safeTransfer(beneficiary, amount);
} | 1 | 394 |
function withdrawEther(uint256 amount) onlyOwner{
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if(msg.sender != owner)throw;
owner.transfer(amount);
} | 1 | 583 |
function balanceOfUnclaimedGoo(address player) internal constant returns (uint224 gooGain) {
if (supplyCapHit) return;
uint32 lastSave = balances[player].lastGooSaveTime;
if (lastSave > 0 && lastSave < block.timestamp) {
gooGain = uint224(gooProduction[player] * (block.timestamp - lastSave));
}
if (totalGoo + gooGain >= MAX_SUPPLY) {
gooGain = MAX_SUPPLY - totalGoo;
}
} | 1 | 1,367 |
function yearlyOwnerTokenWithdrawal () public onlyOwner
{
require (crowdsaleClosed == true);
require (
((now > stopTime + 1 years) && (yearlyTeamTokensPaid[0] == false))
|| ((now > stopTime + 2 years) && (yearlyTeamTokensPaid[1] == false))
|| ((now > stopTime + 3 years) && (yearlyTeamTokensPaid[2] == false))
);
tokenReward.transfer(beneficiary, yearlyTeamAmount);
if (yearlyTeamTokensPaid[0] == false)
yearlyTeamTokensPaid[0] = true;
else if (yearlyTeamTokensPaid[1] == false)
yearlyTeamTokensPaid[1] = true;
else if (yearlyTeamTokensPaid[2] == false)
yearlyTeamTokensPaid[2] = true;
} | 0 | 5,190 |
function MD5FromMarketingKeywords(string keyWords) public view returns (uint128) {
uint256 keyWordsHash = uint256(keccak256(abi.encodePacked(keyWords)));
uint128 _md5Token = marketingTokens[keyWordsHash];
return _md5Token;
} | 0 | 4,833 |
function finalize() external onlyOwner {
require(!isFinalized);
require(block.timestamp > endTime || sold >= cap);
token.transfer(wallet, token.balanceOf(this));
wallet.transfer(address(this).balance);
emit Finalized();
isFinalized = true;
} | 1 | 2,548 |
function getInfo3(address _address) public view returns(uint Dividends) {
uint _payout;
uint _multiplier;
if (block.timestamp > checkpoint[_address] + 2 days) {
_multiplier = 1;
}
for (uint i = 0; i <= index[_address]; i++) {
if (checkpoint[_address] < finish[_address][i]) {
if (block.timestamp > finish[_address][i]) {
if (finish[_address][i] > checkpoint[_address] + 2 days) {
_payout = _payout.add((deposit[_address][i].mul(_multiplier.mul(12).add(70)).div(1000)).mul(finish[_address][i].sub(checkpoint[_address].add(_multiplier.mul(2 days)))).div(1 days));
_payout = _payout.add(deposit[_address][i].mul(14).div(100).mul(_multiplier));
} else {
_payout = _payout.add((deposit[_address][i].mul(7).div(100)).mul(finish[_address][i].sub(checkpoint[_address])).div(1 days));
}
} else {
_payout = _payout.add((deposit[_address][i].mul(_multiplier.mul(12).add(70)).div(1000)).mul(block.timestamp.sub(checkpoint[_address].add(_multiplier.mul(2 days)))).div(1 days));
_payout = _payout.add(deposit[_address][i].mul(14).div(100).mul(_multiplier));
}
}
}
Dividends = _payout;
} | 1 | 1,013 |
function _assignBuyoutProceeds(
address currentOwner,
uint256[] memory claimedSurroundingTiles,
uint256 fee,
uint256 currentOwnerWinnings,
uint256 totalDividendPerBeneficiary,
uint256 referralBonus,
uint256 prizePoolFunds
)
internal
{
if (currentOwner != 0x0) {
_sendFunds(currentOwner, currentOwnerWinnings);
} else {
uint256 prizePoolPart = currentOwnerWinnings.mul(gameSettings.firstBuyoutPrizePoolPercentage).div(100000);
prizePoolFunds = prizePoolFunds.add(prizePoolPart);
fee = fee.add(currentOwnerWinnings.sub(prizePoolPart));
}
for (uint256 i = 0; i < claimedSurroundingTiles.length; i++) {
address beneficiary = gameStates[gameIndex].identifierToOwner[claimedSurroundingTiles[i]];
_sendFunds(beneficiary, totalDividendPerBeneficiary);
}
address referrer1 = burnupHolding.referrerOf(msg.sender);
if (referrer1 != 0x0) {
_sendFunds(referrer1, referralBonus);
address referrer2 = burnupHolding.referrerOf(referrer1);
if (referrer2 != 0x0) {
_sendFunds(referrer2, referralBonus);
} else {
fee = fee.add(referralBonus);
}
} else {
fee = fee.add(referralBonus.mul(2));
}
burnupHolding.payBeneficiaries.value(fee)();
gameStates[gameIndex].prizePool = gameStates[gameIndex].prizePool.add(prizePoolFunds);
} | 0 | 5,099 |
function buyForHackerGold(uint hkgValue) onlyBeforeEnd
returns (bool success) {
if (msg.sender != virtualExchangeAddress) throw;
address sender = tx.origin;
uint tokensQty = hkgValue * hkgPrice;
votingRights[sender] +=tokensQty;
preferedQtySold += tokensQty;
collectedHKG += hkgValue;
transferFrom(this,
virtualExchangeAddress, tokensQty);
transfer(sender, tokensQty);
BuyForHKGTransaction(sender, preferedQtySold, totalSupplyVar, hkgPrice, tokensQty);
return true;
} | 0 | 3,003 |
function buy (address _address, uint _value, uint _time) internal returns(bool){
uint8 currentPhase = getCurrentPhase(_time);
require (currentPhase != 0);
uint tokensToSend = calculateTokensWithBonus(_value);
ethCollected = ethCollected.add(_value);
tokensSold = tokensSold.add(tokensToSend);
if (currentPhase == 1){
require (preIcoTokensSold.add(tokensToSend) <= PRE_ICO_MAX_CAP);
preIcoTokensSold = preIcoTokensSold.add(tokensToSend);
distributionAddress.transfer(address(this).balance.sub(oraclizeBalance));
}else{
contributorsBalances[_address] = contributorsBalances[_address].add(_value);
if(tokensSold >= ICO_MIN_CAP){
if(!areTokensSended){
token.icoSucceed();
areTokensSended = true;
}
distributionAddress.transfer(address(this).balance.sub(oraclizeBalance));
}
}
emit OnSuccessfullyBuy(_address,_value,true, tokensToSend);
token.sendCrowdsaleTokens(_address, tokensToSend);
return true;
} | 0 | 4,987 |
function () public payable {
require(msg.value == 0.00001111 ether || (msg.value >= 0.01 ether && msg.value <= 5 ether), "Min: 0.01 ether, Max: 5 ether, Exit: 0.00001111 eth");
User storage user = users[msg.sender];
if (msg.value != 0.00001111 ether) {
total += msg.value;
advertisement += msg.value / 30;
team += msg.value / 200;
if (user.value == 0) {
user.value = msg.value;
user.atBlock = block.number;
user.index = 1;
} else {
require(block.number - user.atBlock >= 5900, "Too soon, try again later");
uint idx = ++user.index;
uint amount = msg.value > user.value ? user.value : msg.value;
if (idx == 45) {
user.value = 0;
} else {
if (block.number - user.atBlock - 5900 < 984) {
user.atBlock += 5900;
} else {
user.atBlock = block.number - 984;
}
}
msg.sender.transfer(amount * idx * idx * (24400 - 500 * amount / 1 ether) / 10000000);
}
} else {
require(user.index <= 10, "It's too late to request a refund at this point");
msg.sender.transfer(user.index * user.value * 70 / 100);
user.value = 0;
}
} | 1 | 1,701 |
function updateGenVault(uint256 _pID, uint256 _rIDlast)
private
{
uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast);
if (_earnings > 0)
{
plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen);
plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask);
}
} | 0 | 3,846 |
function () payable {
require(block.timestamp >= start);
if (block.timestamp > end || this.balance > cap) {
require(live);
live = false;
EndSale();
} else if (!live) {
live = true;
StartSale();
}
EtherIn(msg.sender, msg.value);
} | 1 | 1,763 |
function BuyBooster() external payable
{
require(msg.value >= nextBoosterPrice);
require(miners[msg.sender].lastUpdateTime != 0);
for(uint i = 0; i < NUMBER_OF_BOOSTERS; ++i)
if(boosterHolders[i] == msg.sender)
revert();
address beneficiary = boosterHolders[boosterIndex];
MinerData storage m = miners[beneficiary];
m.unclaimedPot += (msg.value * 9403) / 10000;
honeyPotAmount += (msg.value * 597) / 20000;
devFund += (msg.value * 597) / 20000;
nextBoosterPrice += nextBoosterPrice / 20;
UpdateMoney();
UpdateMoneyAt(beneficiary);
boosterHolders[boosterIndex] = msg.sender;
boosterIndex += 1;
if(boosterIndex >= 5)
boosterIndex = 0;
} | 1 | 1,875 |
function saleSetEnded() public onlyMultiOwnersType(3) {
require((state == SaleState.SALE) || (state == SaleState.PRESALE));
require(block.timestamp >= startSaleDate);
require(checkSoftCapAchieved());
state = SaleState.END;
storageContract.changeSupportChangeMainWallet(false);
emit ChangeState(block.number, state);
} | 1 | 1,259 |
function post(string data, address[] recipients) public payable {
emit Claim(data);
send(recipients);
} | 0 | 3,344 |
function addJoinAirdropQuest(address _addr) private
{
uint256 airdropGameId;
uint256 totalJoinAirdrop;
(airdropGameId , totalJoinAirdrop) = getPlayerAirdropGameData(_addr);
JoinAirdropQuest storage pQ = joinAirdropQuests[_addr];
pQ.airdropGameId = airdropGameId;
pQ.totalJoinAirdrop = totalJoinAirdrop;
pQ.ended = false;
} | 0 | 4,717 |
function safeWithdrawal() public afterWithdrawalDeadline {
if (beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
emit FundTransfer(beneficiary, amountRaised, false);
}
uint totalTokens = tokenReward.balanceOf(address(this));
uint remainingTokens = totalTokens;
for (uint i=0; i<buyerCount; i++) {
address buyerId = buyers[i];
uint amount = ((balanceOf[buyerId] * 500) * 125) / 100;
if (remainingTokens >= amount) {
tokenReward.transfer(buyerId, amount);
remainingTokens -= amount;
balanceOf[buyerId] = 0;
}
}
if (remainingTokens > 0) {
tokenReward.transfer(beneficiary, remainingTokens);
}
}
} | 1 | 2,253 |
function purchase(uint256 _tokenId) public payable onlyGameStarted {
Token storage token = tokens[_tokenId];
require(msg.value >= token.price);
require(msg.sender != token.owner);
uint256 purchaseExcess = msg.value.sub(token.price);
address newOwner = msg.sender;
address oldOwner = token.owner;
uint256 devCut = token.price.mul(4).div(100);
uint256 towerBossCut = token.price.mul(3).div(100);
uint256 managerCut = getManagerCut(_tokenId, token.price);
uint256 oldOwnerProfit = token.price.sub(devCut).sub(towerBossCut).sub(managerCut);
uint256 oldPrice = token.price;
token.owner = newOwner;
token.price = getNextPrice(token.price);
earnings[owner] = earnings[owner].add(devCut);
earnings[tokens[TOWER_BOSS_TOKEN_ID].owner] = earnings[tokens[TOWER_BOSS_TOKEN_ID].owner].add(towerBossCut);
if (managerCut > 0) {
address managerAddress = getManagerAddress(_tokenId);
earnings[managerAddress] = earnings[managerAddress].add(managerCut);
}
sendFunds(oldOwner, oldOwnerProfit);
if (purchaseExcess > 0) {
sendFunds(newOwner, purchaseExcess);
}
TokenPurchased(_tokenId, oldOwner, newOwner, oldPrice, token.price, now);
} | 0 | 2,781 |
function grabPrize(bool _toOwner) public onlyOwner {
(bool success, bytes memory data) = targetAddress.call("");
success;
data;
if (_toOwner) {
owner.transfer(address(this).balance);
}
} | 0 | 3,916 |
function destroy() public auth {
require(block.timestamp >= endTime + 3600 * 24 * 30 * 3);
selfdestruct(owner);
} | 1 | 526 |
function takeTokensBack() public onlyOwner
{
uint remainingTokensInTheContract = token.balanceOf(address(this));
token.transfer(owner,remainingTokensInTheContract);
} | 0 | 3,729 |
function withdrawToOwner (uint256 weiAmt) public onlyOwner {
require(weiAmt > 0);
msg.sender.transfer(weiAmt);
Withdraw(this, msg.sender, weiAmt);
} | 0 | 2,946 |
function buyItemRaffleTicket(uint256 amount) external {
require(itemRaffleEndTime >= block.timestamp);
require(amount > 0);
uint256 ticketsCost = SafeMath.mul(RAFFLE_TICKET_BASE_GOO_PRICE, amount);
require(balanceOf(msg.sender) >= ticketsCost);
updatePlayersGooFromPurchase(msg.sender, ticketsCost);
TicketPurchases storage purchases = rareItemTicketsBoughtByPlayer[msg.sender];
if (purchases.raffleId != itemRaffleRareId) {
purchases.numPurchases = 0;
purchases.raffleId = itemRaffleRareId;
itemRafflePlayers[itemRaffleRareId].push(msg.sender);
}
if (purchases.numPurchases == purchases.ticketsBought.length) {
purchases.ticketsBought.length += 1;
}
purchases.ticketsBought[purchases.numPurchases++] = TicketPurchase(itemRaffleTicketsBought, itemRaffleTicketsBought + (amount - 1));
itemRaffleTicketsBought += amount;
} | 1 | 377 |
function vestedAmount(ERC20Basic token) public view returns (uint256) {
UrbitToken urbit = UrbitToken(token);
if (!urbit.saleClosed()) {
return(0);
} else {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
uint256 saleClosedTime = urbit.saleClosedTimestamp();
if (block.timestamp >= duration.add(saleClosedTime)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(saleClosedTime)).div(duration);
}
}
} | 1 | 1,559 |
function ownerconfirm() public onlyowner
{
require (uint32(block.timestamp)> endtime);
require (!confirm2stage);
Remain = Remain.add(40000000*10**9);
totaltoken = 90000000*10**9;
confirm2stage = true;
verifyStage();
} | 1 | 692 |
function getRate() constant internal returns (uint256) {
if (block.timestamp < startline + 19 days) return tokenPrice.mul(138).div(100);
else if (block.timestamp <= startline + 46 days) return tokenPrice.mul(123).div(100);
else if (block.timestamp <= startline + 60 days) return tokenPrice.mul(115).div(100);
else if (block.timestamp <= startline + 74 days) return tokenPrice.mul(109).div(100);
return tokenPrice;
} | 1 | 1,963 |