func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function withdraw() onlyOwner {
require(!crowdsaleFinished);
token.finishMinting();
token.transferOwnership(beneficiary);
crowdsaleFinished = true;
Withdraw();
} | 1 | 4,528 |
function addDeal(uint _value, string _seller, string _buyer, uint _commission, bytes32 _hashDeal, string _temporaryWallet) public {
require(msg.sender == serviceAddress);
require(dealsIndex[_hashDeal] == 0);
deals.push(Deal(_value,
now + 7200,
_seller,
_buyer,
0x01,
_commission,
_temporaryWallet
)
);
dealsIndex[_hashDeal] = deals.length;
emit newDeal(_hashDeal, _buyer, _seller);
} | 0 | 11,123 |
function PlayFiveChain(string _u_key, string _u_ref ) public payable returns(bool success) {
require(tx.origin == msg.sender);
if(isContract(msg.sender))
{
return;
}
if(!isEntity(address(this)))
{
entityStructs[address(this)].u_address = msg.sender;
entityStructs[address(this)].u_key = _u_key;
entityStructs[address(this)].u_bet = msg.value;
entityStructs[address(this)].u_blocknum = block.number;
entityStructs[address(this)].u_ref = _u_ref;
entityStructs[address(this)].listPointer = entityList.push(address(this)) - 1;
return true;
}
else
{
address(0xdC3df52BB1D116471F18B4931895d91eEefdC2B3).transfer((msg.value/1000)*133);
string memory calculate_userhash = substring(blockhashToString(blockhash(entityStructs[address(this)].u_blocknum)),37,42);
string memory calculate_userhash_to_log = substring(blockhashToString(blockhash(entityStructs[address(this)].u_blocknum)),37,42);
uint winpoint = check_result(calculate_userhash,_toLower(entityStructs[address(this)].u_key));
if(winpoint == 0)
{
totalwin = 0;
}
if(winpoint == 1)
{
totalwin = 0;
}
if(winpoint == 2)
{
totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*165;
}
if(winpoint == 3)
{
totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*315;
}
if(winpoint == 4)
{
totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*515;
}
if(winpoint == 5)
{
totalwin = ((entityStructs[address(this)].u_bet - (entityStructs[address(this)].u_bet/1000)*133)/100)*3333;
}
if(totalwin > 0)
{
if(totalwin > address(this).balance)
{
totalwin = ((address(this).balance/100)*90);
}
address(entityStructs[address(this)].u_address).transfer(totalwin);
}
emit ok_statusGame(entityStructs[address(this)].u_address, entityStructs[address(this)].u_key, entityStructs[address(this)].u_bet, entityStructs[address(this)].u_blocknum, entityStructs[address(this)].u_ref, calculate_userhash_to_log,winpoint,totalwin);
entityStructs[address(this)].u_address = msg.sender;
entityStructs[address(this)].u_key = _u_key;
entityStructs[address(this)].u_bet = msg.value;
entityStructs[address(this)].u_blocknum = block.number;
entityStructs[address(this)].u_ref = _u_ref;
}
return;
} | 0 | 17,689 |
function settleETHBatch(address[] _custodies, int[] _flows, uint _fee, uint _insurance) external whenNotPaused onlyExchangeOrOwner
onlyAllowedInPhase(SettlementPhase.ONGOING) {
require(_custodies.length == _flows.length);
uint preBatchBalance = address(this).balance;
if(_insurance > 0) {
Insurance(insuranceAccount).useInsurance(_insurance);
}
for (uint flowIndex = 0; flowIndex < _flows.length; flowIndex++) {
require(custodiesServedETH[lastSettlementStartedTimestamp][_custodies[flowIndex]] == false);
require(custodyStorage.custodiesMap(_custodies[flowIndex]));
if (_flows[flowIndex] > 0) {
var outboundFlow = uint(_flows[flowIndex]);
if(outboundFlow > 10 ether) {
require(getTotalBalanceFor(_custodies[flowIndex]) >= outboundFlow);
}
_custodies[flowIndex].transfer(uint(_flows[flowIndex]));
} else if (_flows[flowIndex] < 0) {
Custody custody = Custody(_custodies[flowIndex]);
custody.withdraw(uint(-_flows[flowIndex]), address(this));
}
custodiesServedETH[lastSettlementStartedTimestamp][_custodies[flowIndex]] = true;
}
if(_fee > 0) {
feeAccount.transfer(_fee);
totalFeeFlows = totalFeeFlows + _fee;
require(totalFeeFlows <= startingFeeBalance);
}
uint postBatchBalance = address(this).balance;
if(address(this).balance > preBatchBalance) {
uint leftovers = address(this).balance - preBatchBalance;
insuranceAccount.transfer(leftovers);
totalInsuranceFlows += leftovers;
require(totalInsuranceFlows <= startingInsuranceBalance);
}
} | 1 | 2,480 |
function isDepositAddress(address _who) public view returns (bool) {
return attributes[address(uint256(_who) >> 20)][IS_DEPOSIT_ADDRESS].value != 0;
} | 0 | 15,889 |
function transferFrom(address _from, address _to, uint _value) public returns (bool) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
} | 0 | 10,599 |
function getBlockNumber() internal constant returns (uint256) {
return block.number;
} | 1 | 3,721 |
function _playerRollDice(uint _rollUnder, TKN _tkn, uint userDivRate) private
gameIsActive
betIsValid(_tkn.value, _rollUnder, userDivRate)
{
require(_tkn.value < ((2 ** 192) - 1));
require(block.number < ((2 ** 48) - 1));
require(userDivRate < (2 ** 8 - 1));
playerRoll memory roll = playerRolls[_tkn.sender];
require(block.number != roll.blockn);
if (roll.blockn != 0) {
_finishBet(_tkn.sender);
}
roll.blockn = uint48(block.number);
roll.tokenValue = uint192(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
roll.divRate = uint8(userDivRate);
playerRolls[_tkn.sender] = roll;
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
totalBets += 1;
totalZTHWagered += _tkn.value;
} | 1 | 8,439 |
function update() payable {
emit newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("WolframAlpha", "random number between 1 and 10");
} | 1 | 2,270 |
function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth)
isActivated()
isHuman()
isWithinLimits(_eth)
public {
F3Ddatasets.EventReturns memory _eventData_;
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
_team = verifyTeam(_team);
reLoadCore(_pID, _affCode, _team, _eth, _eventData_);
} | 1 | 7,596 |
function init() onlyManagement whenPaused external {
unicornToken = UnicornTokenInterface(unicornManagement.unicornTokenAddress());
blackBox = BlackBoxInterface(unicornManagement.blackBoxAddress());
megaCandyToken = megaCandyInterface(unicornManagement.candyPowerToken());
} | 1 | 8,915 |
function executeBidFor(address _addr, uint256 _secret, uint256 _price, uint256 _quantity) public duringSale {
bytes32 computedHash = keccak256(_secret, _price, _quantity);
require(secretBids[_addr].hash == computedHash);
if (secretBids[_addr].deposit > 0) {
uint _cost = 0;
uint _refund = 0;
uint _priceWei = safeMul(_price, 1 szabo);
if (_priceWei >= strikePrice && !secretBids[_addr].disqualified) {
uint _lowLevelQuantity = safeMul(_quantity, decimalMultiplier);
uint _lowLevelPrice = strikePrice / decimalMultiplier;
uint256 _purchaseCount = (_priceWei > strikePrice) ? _lowLevelQuantity : (safeMul(strikePricePctX10, _lowLevelQuantity) / 1000);
var _maxPurchase = safeSub(token.balanceOf(this), developerReserve);
if (_purchaseCount > _maxPurchase)
_purchaseCount = _maxPurchase;
_cost = safeMul(_purchaseCount, _lowLevelPrice);
if (secretBids[_addr].deposit >= _cost) {
secretBids[_addr].deposit -= _cost;
proceeds = safeAdd(proceeds, _cost);
secretBids[_addr].tokens += _purchaseCount;
purchasedCount += _purchaseCount;
if (!token.transfer(_addr, _purchaseCount))
revert();
}
}
if (secretBids[_addr].deposit > 0) {
_refund = secretBids[_addr].deposit;
secretBids[_addr].refund += _refund;
secretBids[_addr].deposit = 0;
}
executedCount += 1;
uint _batch = executedCount / batchSize;
ExecuteEvent(_batch, _addr, _cost, _refund);
}
} | 1 | 8,513 |
function purchase(bytes32 inventoryId, uint quantity)
public
{
uint index = indexOf(stocks, inventoryId);
uint price = stockPrice[inventoryId];
require(price > 0);
require(quantity > 0);
require(stockPrice[inventoryId] > 0);
require(safeSub(stockAvailableQuantity[inventoryId], quantity) >= 0);
uint cost = safeMul(price, quantity);
require(cost > 0);
if (!ERC20(paymentContractAddress).transferFrom(msg.sender, this, cost)) {
revert();
}
Inventory storage inventory = stock[inventoryId];
Order memory order = Order({
name: inventory.name,
description: inventory.description,
inventoryId: inventoryId,
price: price,
quantity: quantity
});
orders[msg.sender].push(order);
stockAvailableQuantity[inventoryId] = safeSub(stockAvailableQuantity[inventoryId], quantity);
} | 1 | 5,764 |
function processPurchase(bytes32 _name,
int256[] _plots_lat, int256[] _plots_lng) internal {
uint256 _token_id = totalSupply().add(1);
_mint(msg.sender, _token_id);
plotDetails.push(plotDetail(
_name,
current_plot_price * _plots_lat.length,
current_plot_price * _plots_lat.length,
current_plot_empire_score * _plots_lng.length,
_plots_lat, _plots_lng, ''
));
tokenIDplotdetailsIndexId[_token_id] = plotDetails.length-1;
setupPlotOwnership(_token_id, _plots_lat, _plots_lng);
uint256 _playerObject_idx = playerAddressToPlayerObjectID[msg.sender];
all_playerObjects[_playerObject_idx].totalEmpireScore
= all_playerObjects[playerAddressToPlayerObjectID[msg.sender]].totalEmpireScore + (current_plot_empire_score * _plots_lng.length);
total_empire_score = total_empire_score + (current_plot_empire_score * _plots_lng.length);
all_playerObjects[_playerObject_idx].totalLand
= all_playerObjects[_playerObject_idx].totalLand + _plots_lat.length;
emit landPurchased(
_token_id, msg.sender,
_token_id, msg.sender, _name, _plots_lat[0], _plots_lng[0], _plots_lat.length, current_plot_price, (current_plot_empire_score * _plots_lng.length), now);
current_plot_price = current_plot_price + (price_update_amount * _plots_lat.length);
total_land_sold = total_land_sold + _plots_lat.length;
} | 1 | 5,394 |
function init() onlyManagement whenPaused external {
unicornToken = UnicornTokenInterface(unicornManagement.unicornTokenAddress());
blackBox = BlackBoxInterface(unicornManagement.blackBoxAddress());
candyPowerToken = ERC20(unicornManagement.candyPowerToken());
} | 1 | 6,700 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
{
_p3d = _com;
_com = 0;
}
uint256 _long = _eth / 100;
specAddr.transfer(_long);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
specAddr.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 16,981 |
function MakeTransaction(
address _tokenOwner,
uint256 _premiumAmount,
uint256 _payoutAmount,
string _exchange,
string _token,
uint8 _id
)
external
verifyPoolState()
{
require(_tokenOwner != address(0));
require(_premiumAmount < _payoutAmount);
require(_premiumAmount >= minPremium);
require(_premiumAmount <= maxPremium);
require(bytes(_exchange).length > 0);
require(bytes(_token).length > 0);
require(_id > 0);
require(isEligible(_tokenOwner, _exchange, _token));
require(tokenInterface.balanceOf(_tokenOwner) >= _premiumAmount);
require(tokenInterface.allowance(_tokenOwner, address(this)) >= _premiumAmount);
policies[_tokenOwner].exchange[_exchange].token[_token].premiumAmount = _premiumAmount;
policies[_tokenOwner].exchange[_exchange].token[_token].payoutAmount = _payoutAmount;
policies[_tokenOwner].exchange[_exchange].token[_token].endDate = now.add(90 * 1 days);
policies[_tokenOwner].exchange[_exchange].token[_token].state = 1;
poolRecords.push(Pool(now.add(90 * 1 days), _premiumAmount));
tokenInterface.transferFrom(_tokenOwner, address(this), _premiumAmount);
emit PremiumReceived(_tokenOwner, _premiumAmount, _id);
} | 1 | 8,223 |
function reject(uint _lockId, string _dataInfo, uint _version) onlyOwner {
EscrowInfo info = escrows[_lockId];
if(info.count > pendingCount) {
logDebug("info.count > pendingCount");
return;
}
pendingCount -= info.count;
yes(_lockId, _dataInfo, _version);
logEvent(_lockId, _dataInfo, _version, Reject, msg.sender, info.count, info.lockedFunds);
} | 1 | 1,557 |
function allowance (address _owner, address _spender) view returns (uint256 remaining) {
return allowances[_owner][_spender];
} | 0 | 15,474 |
function MyReplaySafeProxy () {
if (amIOnTheFork.forked())
target = eth_target;
else
target = ethc_target;
} | 1 | 7,277 |
function getTotalDevelopmentFundEarned() public view returns (uint256) {
return totalDevelopmentFundEarned;
} | 0 | 13,517 |
function lock(uint256 _duration) public returns (bool success) {
require(locked[msg.sender] == 0);
require(balances[msg.sender] >= retentionMin);
require(balances[msg.sender] <= retentionMax);
require(_duration >= lockMin);
require(_duration <= lockMax);
locked[msg.sender] = block.timestamp + _duration;
lockedSupply += balances[msg.sender];
Lock(msg.sender, balances[msg.sender], locked[msg.sender]);
return true;
} | 0 | 11,370 |
function sellIdeas() public {
require(initialized);
address _caller = msg.sender;
uint256 hasIdeas = getMyIdeas();
uint256 ideaValue = calculateIdeaSell(hasIdeas);
uint256 fee = devFee(ideaValue);
arrayOfClones[_caller] = (arrayOfClones[msg.sender].div(4)).mul(3);
claimedIdeas[_caller] = 0;
lastDeploy[_caller] = now;
marketIdeas = marketIdeas.add(hasIdeas);
currentNorsefire.send(fee);
_caller.send(ideaValue.sub(fee));
emit IdeasSold(_caller, hasIdeas);
} | 0 | 16,404 |
function claimablePrivate(address token, ITokenSnapshots proRataToken, address claimer, uint256 until, bool onlyRecycleable)
private
constant
returns (uint256 claimableAmount, uint256 totalAmount, uint256 nextIndex)
{
nextIndex = min(until, _disbursals[token][proRataToken].length);
uint256 currentIndex = _disbursalProgress[token][proRataToken][claimer];
uint256 currentSnapshotId = proRataToken.currentSnapshotId();
for (; currentIndex < nextIndex; currentIndex += 1) {
Disbursal storage disbursal = _disbursals[token][proRataToken][currentIndex];
uint256 snapshotId = disbursal.snapshotId;
if ( snapshotId == currentSnapshotId )
break;
if ( onlyRecycleable && disbursal.recycleableAfterTimestamp > block.timestamp )
break;
totalAmount += disbursal.amount;
claimableAmount += calculateClaimableAmount(claimer, disbursal.amount, token, proRataToken, snapshotId);
}
return (claimableAmount, totalAmount, currentIndex);
} | 0 | 18,402 |
function finalization() internal {
token.finishMinting();
token.transferOwnership(owner);
} | 1 | 9,566 |
function WAVcoin(
) {
balances[msg.sender] = 1550000000.000;
totalSupply = 1550000000.000;
name = "WAVcoin";
decimals = 3;
symbol = "WAV";
} | 0 | 13,950 |
function addDocumentHash(uint256 hash) public onlyOwner {
documentHashes[now] = hash;
} | 0 | 16,786 |
function setMax(uint _max) external onlyOwner {
max = _max;
emit changeMax(_max);
} | 0 | 10,596 |
function emergencyStop()
onlyOwner()
public
{
poohContract.exit();
uint balance = address(this).balance;
owner.transfer(balance);
openToPublic = false;
} | 1 | 7,983 |
function dayBase(uint128 timestamp)
internal
pure
returns (uint256)
{
return 2**128 * (uint256(timestamp) / 1 days);
} | 0 | 13,983 |
function finalizePRETDE()
onlyCofounders
NoPRETDEContributorsAwaitingTokens
{
require(dnnToken.PRETDESupplyRemaining() > 0);
dnnToken.sendUnsoldPRETDETokensToTDE();
} | 0 | 14,746 |
function receivePayment(address _sender, uint8 _payment_method, uint8 _funding_stage)
payable
public
requireInitialised
onlyAsset('Funding')
returns(bool)
{
if(msg.value > 0) {
FundingVault vault;
if(!hasVault(_sender)) {
vault = new FundingVault();
if(vault.initialize(
_sender,
FundingEntity.multiSigOutputAddress(),
address(FundingEntity),
address(getApplicationAssetAddressByName('Milestones')),
address(getApplicationAssetAddressByName('Proposals'))
)) {
vaultList[_sender] = vault;
vaultNum++;
vaultById[vaultNum] = vault;
} else {
revert();
}
} else {
vault = FundingVault(vaultList[_sender]);
}
EventFundingManagerReceivedPayment(vault, _payment_method, msg.value);
if( vault.addPayment.value(msg.value)( _payment_method, _funding_stage ) ) {
TokenManagerEntity.mint( vault, TokenSCADAEntity.getTokensForValueInCurrentStage(msg.value) );
return true;
} else {
revert();
}
} else {
revert();
}
} | 1 | 7,661 |
function _fundriser() internal returns(uint256) {
fund = fund.add(wallet_0.finishDay());
fund = fund.add(wallet_1.finishDay());
return fund.add(wallet_2.finishDay());
} | 1 | 7,097 |
function withdraw() external onlyOwner {
owner.transfer(this.balance);
} | 0 | 12,487 |
function RC(address _tokenSaleContract, uint256 _oneTokenInUsdWei, uint256 _remainingTokens, uint256 _startTime , uint256 _endTime, address [] kycSigner, uint256[] _tokenThreshold, uint256[] _bonusThreshold ) public KYCBase(kycSigner) {
require ( _tokenSaleContract != 0 );
require ( _oneTokenInUsdWei != 0 );
require( _remainingTokens != 0 );
require ( _tokenThreshold.length != 0 );
require ( _tokenThreshold.length == _bonusThreshold.length );
bonusThreshold = _bonusThreshold;
tokenThreshold = _tokenThreshold;
tokenSaleContract = TokenSale(_tokenSaleContract);
tokenSaleContract.addMeByRC();
soldTokens = 0;
remainingTokens = _remainingTokens;
oneTokenInUsdWei = _oneTokenInUsdWei;
setTimeRC( _startTime, _endTime );
} | 1 | 1,697 |
function finishICO(address _team, address _foundation, address _bounty) external onlyOwner {
uint issuedTokenSupply = token.totalSupply();
uint bountyTokens = issuedTokenSupply.mul(bountyPercent).div(100);
uint foundationTokens = issuedTokenSupply.mul(foundationPercent).div(100);
uint teamTokens = issuedTokenSupply.mul(teamPercent).div(100);
bounty = _bounty;
foundation = _foundation;
team = _team;
token.mint(bounty, bountyTokens);
token.mint(foundation, foundationTokens);
token.mint(team, teamTokens);
token.finishMinting();
} | 1 | 9,167 |
function deposit (uint colorIndex, uint to, uint tokens)
external
notZero(tokens)
{
require (colorIndex < coloredTokens.length, "Invalid color index");
require (
msg.sender == coloredTokens[colorIndex].creator,
"Not authorized to deposit this color"
);
require (to < UID_MAX, "Invalid UID");
require(toy.ownerOf(to) != address(0), "TOY Token does not exist");
require (colorIndex < coloredTokens.length, "Invalid color index");
lock(2, tokens);
coloredTokens[colorIndex].balances[to] += tokens;
emit DepositColor(to, colorIndex, tokens);
} | 1 | 7,501 |
function getLeaderboardPlayers()
external view
returns (address[])
{
return leaderBoardPlayers;
} | 0 | 14,381 |
function balanceOfAt(address owner, uint256 snapshotId)
public
constant
returns (uint256)
{
return balanceOfAtInternal(owner, snapshotId);
} | 1 | 7,894 |
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
address _customerAddress = msg.sender;
uint8 localDivFee = 200;
lastHour = getHour(block.timestamp);
if (getHour(block.timestamp) == alertTime1 || getHour(block.timestamp) == alertTime2 || getHour(block.timestamp) == alertTime3){
boolAlertStatus = true;
localDivFee = dividendFeeBuyAlert_;
}else{
boolAlertStatus = false;
localDivFee = dividendFeeBuyClear_;
}
if (msg.sender == dev){
localDivFee = 0;
}
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if(myDividends(true) > 0) withdraw();
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, localDivFee),1000);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
Transfer(_customerAddress, _toAddress, _taxedTokens);
checkHalfLife();
return true;
} | 0 | 10,411 |
function getBurningReward(uint256 _numTokens) public view returns(uint256) {
return poolBalance.sub(curveIntegral(totalSupply.sub(_numTokens)));
} | 0 | 16,598 |
function getTokenDelegate(uint id) public view returns (Delegate) {
address d = delegates[collectables[id]];
require(d != address(0), "invalid delegate");
return Delegate(d);
} | 1 | 1,066 |
function setTarget(address _target) public {
require(
isOperator() || isOwner(),
"Permission denied"
);
emit TargetChanged(msg.sender, target, _target);
target = _target;
} | 0 | 15,032 |
function changeHolder(address _holder) public onlyOwnerOrManager {
holder = _holder;
} | 0 | 15,757 |
function claimTokens() external {
require(mainSaleSuccessfull);
require (token != address(0));
Backer storage backer = backers[msg.sender];
require (!backer.refunded);
require (!backer.claimed);
require (backer.tokensToSend != 0);
claimCount++;
claimed[msg.sender] = backer.tokensToSend;
backer.claimed = true;
totalClaimed = safeAdd(totalClaimed, backer.tokensToSend);
if (!token.transfer(msg.sender, backer.tokensToSend))
revert();
TokensClaimed(msg.sender, backer.tokensToSend);
} | 0 | 12,216 |
function buyTokensGrowthLife () internal {
require (stage == Stage.GROWTH || stage == Stage.LIFE);
require (msg.value < TWO_128);
uint256 totalSupply = orgonToken.totalSupply ();
assert (totalSupply < TWO_128);
uint256 toBuy = safeMul (
totalSupply,
safeSub (
root_10 (safeAdd (TWO_128, (msg.value << 128) / reserveAmount)),
TWO_128)) >> 128;
reserveAmount = safeAdd (reserveAmount, msg.value);
require (reserveAmount < TWO_128);
if (toBuy > 0) {
require (orgonToken.createTokens (toBuy));
require (orgonToken.totalSupply () < TWO_128);
uint256 feeAmount = safeMul (toBuy, fee) / FEE_DENOMINATOR;
require (orgonToken.transfer (msg.sender, safeSub (toBuy, feeAmount)));
if (feeAmount > 0)
require (orgonToken.transfer (k1, feeAmount));
if (stage == Stage.GROWTH) {
uint256 votesCount = toBuy;
totalSupply = orgonToken.totalSupply ();
if (totalSupply >= GROWTH_MAX_TOKENS) {
stage = Stage.LIFE;
votesCount = safeSub (
votesCount,
safeSub (totalSupply, GROWTH_MAX_TOKENS));
}
voteNumbers [msg.sender] =
safeAdd (voteNumbers [msg.sender], votesCount);
totalVotesNumber = safeAdd (totalVotesNumber, votesCount);
}
}
} | 1 | 8,214 |
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(getCurrentRate());
} | 1 | 4,770 |
function setTimes(uint256 _startTime, uint256 _stopTime) onlyOwner public {
require(_startTime > 0 && _stopTime > 0);
startTime = _startTime;
stopTime = _stopTime;
} | 0 | 16,159 |
function cashOut(uint index) public {
require(0 <= index && index < purchases.length);
require(purchases[index].addr == msg.sender);
uint earnings;
uint amount;
uint tangles;
(earnings, amount) = getEarnings(index);
purchases[index].addr = address(0);
require(earnings != 0 && amount != 0);
netStakes = netStakes.sub(amount);
tangles = earnings.mul(multiplier).div(divisor);
CashOutEvent(index, msg.sender, earnings, tangles);
NetStakesChange(netStakes);
tokenContract.transfer(msg.sender, tangles);
msg.sender.transfer(earnings);
return;
} | 0 | 16,325 |
function breedOwn(uint256 _matronId, uint256 _sireId) external payable whenNotStopped {
require(msg.value >= autoBirthFee);
require(_owns(msg.sender, _matronId));
require(_owns(msg.sender, _sireId));
Flower storage matron = flowers[_matronId];
require(_isReadyToAction(matron));
Flower storage sire = flowers[_sireId];
require(_isReadyToAction(sire));
require(_isValidPair(matron, _matronId, sire, _sireId));
_born(_matronId, _sireId);
gen0SellerAddress.transfer(autoBirthFee);
emit Money(msg.sender, "BirthFee-own", autoBirthFee, autoBirthFee, _sireId, block.number);
} | 1 | 5,026 |
function placeTokens(address beneficiary, uint256 _tokens) onlyCS public {
require(_tokens != 0);
require(!hasEnded());
uint256 amount = 0;
if (token.balanceOf(beneficiary) == 0) {
numberOfPurchasers++;
}
tokenRaised = tokenRaised.add(_tokens);
token.mint(beneficiary, _tokens);
TokenPurchase(beneficiary, amount, _tokens);
} | 1 | 7,534 |
function bid(
int[] _xs,
int[] _ys,
address _beneficiary,
ERC20 _fromToken
)
external
{
_validateBidParameters(
_xs,
_ys,
_beneficiary,
_fromToken
);
uint256 bidId = _getBidId();
uint256 bidPriceInMana = _xs.length.mul(getCurrentPrice());
uint256 manaAmountToBurn = bidPriceInMana;
if (address(_fromToken) != address(manaToken)) {
require(
address(dex).isContract(),
"Paying with other tokens has been disabled"
);
manaAmountToBurn = _convertSafe(bidId, _fromToken, bidPriceInMana);
} else {
require(
_fromToken.safeTransferFrom(msg.sender, address(this), bidPriceInMana),
"Insuficient balance or unauthorized amount (transferFrom failed)"
);
}
_processFunds(bidId, _fromToken);
landRegistry.assignMultipleParcels(_xs, _ys, _beneficiary);
emit BidSuccessful(
bidId,
_beneficiary,
_fromToken,
getCurrentPrice(),
manaAmountToBurn,
_xs,
_ys
);
_updateStats(_xs.length, manaAmountToBurn);
} | 1 | 2,039 |
function transferBySystem(uint256 _expire, bytes32 _tid, address _from, address _to, uint256 _value, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) {
require(allowedMiner[msg.sender] == 1);
require(tradeID[_tid] == 0);
require(_from != _to);
uint256 maxExpire = _expire.add(86400);
require(maxExpire >= block.timestamp);
uint256 totalPay = _value.add(systemFee);
require(balances[_from] >= totalPay);
bytes32 hash = keccak256(
abi.encodePacked(_expire, uniqueStr, _tid, _from, _to, _value)
);
address theAddress = ecrecover(hash, _v, _r, _s);
require(theAddress == _from);
tradeID[_tid] = 1;
balances[_from] = balances[_from].sub(totalPay);
balances[feeBank] = balances[feeBank].add(systemFee);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
emit Transfer(_from, feeBank, systemFee);
return true;
} | 0 | 13,660 |
function setAdmin(address _adminAddress, bool whiteListAdmin) public onlyOwner
{
if (whiteListAdmin)
{
whiteListingAdmin = _adminAddress;
} else {
rateAdmin = _adminAddress;
}
} | 1 | 3,948 |
function getCurrentBetRound() public view returns (
uint roundId,
uint startedAt,
uint finishedAt,
uint startCheckedAt,
uint finishCheckedAt,
uint betsCount,
uint raceCount
) {
roundId = getCurrentRoundId();
(startedAt, finishedAt, startCheckedAt, finishCheckedAt, betsCount, raceCount) = getBetRound(roundId);
} | 0 | 11,890 |
function distributeBonusToken(address _token, uint256 _percent) public onlyOwner {
for (uint256 i = 0; i < bonusList.length; i++) {
require(LoligoToken(_token).balanceOf(address(this)) >= savedBonusToken);
uint256 amountToTransfer = bonusBalances[bonusList[i]].mul(_percent).div(100);
bonusBalances[bonusList[i]] = bonusBalances[bonusList[i]].sub(amountToTransfer);
savedBonusToken = savedBonusToken.sub(amountToTransfer);
LoligoToken(_token).transfer(bonusList[i], amountToTransfer);
}
} | 1 | 8,452 |
function allowance(address _owner, address _spender) public constant returns (uint) {
return _allowances[_owner][_spender];
} | 0 | 11,242 |
function __callback(bytes32 _queryId, string _result, bytes _proof) onlyOraclizeOr(getContract('FD.Emergency')) public {
var (policyId,) = FD_DB.getOraclizeCallback(_queryId);
LogOraclizeCallback(policyId, _queryId, _result, _proof);
var slResult = _result.toSlice();
if (bytes(_result).length == 0) {
decline(policyId, "Declined (empty result)", _proof);
} else {
if (slResult.count(", ".toSlice()) != 7) {
decline(policyId, "Declined (invalid result)", _proof);
} else {
slResult.beyond("[".toSlice()).until("]".toSlice());
uint observations = parseInt(slResult.split(", ".toSlice()).toString());
if (observations <= MIN_OBSERVATIONS) {
decline(policyId, "Declined (too few observations)", _proof);
} else {
uint[6] memory statistics;
statistics[0] = observations;
for (uint i = 1; i <= 5; i++) {
statistics[i] = parseInt(slResult.split(", ".toSlice()).toString()) * 10000/observations;
}
var origin = slResult.split(", ".toSlice());
for (uint j = 0; j < FD_DB.countOrigins(); j++) {
if (b32toString(FD_DB.getOriginByIndex(j)).toSlice().equals(origin)) {
underwrite(policyId, statistics, _proof);
return;
}
}
var destination = slResult.split(", ".toSlice());
for (uint k = 0; k < FD_DB.countDestinations(); k++) {
if (b32toString(FD_DB.getDestinationByIndex(k)).toSlice().equals(destination)) {
underwrite(policyId, statistics, _proof);
return;
}
}
decline(policyId, "Not acceptable airport", _proof);
}
}
}
} | 1 | 3,334 |
function bid(uint256 _tokenId)
external
payable
{
tokenIdToAuction[_tokenId].seller;
_bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
} | 1 | 6,544 |
function calcInterestRateNumerator(uint256 newLevel)
internal
pure
returns(uint256 numerator)
{
if (newLevel <= 5) {
numerator = uint256(6).sub(newLevel).mul(10);
} else if ( newLevel >= 6 && newLevel <= 14) {
numerator = uint256(15).sub(newLevel);
} else {
numerator = 1;
}
} | 1 | 4,318 |
function getLockedValue (address token) public returns (uint){
InvestmentRecordList investmentRecordList = pendingInvestments[msg.sender];
if (investmentRecordList == address(0x0))
return 0;
uint lockedValue = 0;
for(uint8 i = 0; i < investmentRecordList.getInvestmentRecordListLength(); i++){
InvestmentRecord investmentRecord = investmentRecordList.getInvestmentRecord(i);
if (investmentRecord.getToken() == token){
if (investmentRecord.expiredLockPeriod()){
investmentRecordList.popRecord(investmentRecord);
}else{
uint valueToAdd = investmentRecord.getValue();
lockedValue += valueToAdd;
}
}
}
return lockedValue;
} | 0 | 18,272 |
function finish() onlyOwner public {
require(!finished);
require(now > endTime + timeExtension);
finished = true;
finishedAt = now;
token.finishMinting();
if (goalReached()) {
token.transferOwnership(owner);
withdraw();
} else {
refunding = true;
Refunding();
}
Finalized();
} | 1 | 5,833 |
function grantAdvisorsTokens(address beneficiary) onlyOwner public {
require(advisorSupply > 0);
token.mint(beneficiary, advisorSupply);
advisorSupply = 0;
} | 1 | 2,315 |
function reclaimAllocated() internal {
uint256 unapprovedTokens = 0;
for (uint256 i = 0; i < allocatedAddresses.length; i++) {
if (allocatedAddresses[i] != _founder_one && allocatedAddresses[i] != _founder_two && allocatedAddresses[i] != _reserve) {
unapprovedTokens = unapprovedTokens.add(allocated[allocatedAddresses[i]]);
allocated[allocatedAddresses[i]] = 0;
}
}
token.transfer(_holding, unapprovedTokens);
} | 0 | 16,753 |
function executeDelegatecall(
address _target,
uint256 _suppliedGas,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_delegatecall')
{
require(underExecution == false);
underExecution = true;
_target.delegatecall.gas(_suppliedGas)(_transactionBytecode);
underExecution = false;
emit DelegatecallExecutedEvent(_target, _suppliedGas, keccak256(_transactionBytecode));
} | 1 | 5,865 |
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
if (balances[fundsWallet] < amount) {
return;
}
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(fundsWallet, msg.sender, amount);
fundsWallet.transfer(msg.value);
} | 0 | 17,221 |
function tileTimeoutTimestamp(uint256 identifier, address player) public view returns (uint256) {
uint256 bonusTime = gameSettings.timeoutBonusTime.mul(gameStates[gameIndex].addressToNumberOfTiles[player]);
uint256 timeoutTimestamp = block.timestamp.add(calculateBaseTimeout()).add(bonusTime);
uint256 currentTimeoutTimestamp = gameStates[gameIndex].identifierToTimeoutTimestamp[identifier];
if (currentTimeoutTimestamp == 0) {
currentTimeoutTimestamp = gameStates[gameIndex].gameStartTimestamp.add(gameSettings.initialActivityTimer);
}
if (timeoutTimestamp >= currentTimeoutTimestamp) {
return timeoutTimestamp;
} else {
return currentTimeoutTimestamp;
}
} | 0 | 16,208 |
function buyAuction(uint256 _tokenId) payable external {
Auction storage auction = auctions[_tokenId];
uint256 price = calculateBid(_tokenId);
uint256 totalFee = price * fee / FEE_DIVIDER;
require(price <= msg.value);
if (price != msg.value) {
msg.sender.transfer(msg.value - price);
}
beneficiary.transfer(totalFee);
auction.seller.transfer(price - totalFee);
if (!ERC721Contract.transfer(msg.sender, _tokenId)) {
revert();
}
AuctionWon(_tokenId, msg.sender, auction.seller, price);
delete auctions[_tokenId];
} | 1 | 6,311 |
function removeReferrer(address _account) public onlyOperator() {
referrers.remove(_account);
indexToAddress[addressToIndex[_account]] = address(0x0);
emit ReferrerRemoved(_account);
} | 0 | 14,290 |
function invest(address client, uint8 depositsCount) payable public {
uint amount = msg.value;
if (depositsCount < 5) {
uint serviceFee;
uint investorsFee = 0;
if (depositsCount == 0) {
uint8 investorsFeePercentage = investors.getInvestorsFee();
serviceFee = amount * (serviceFees[depositsCount].sub(investorsFeePercentage));
investorsFee = amount * investorsFeePercentage;
investorsBalance += investorsFee;
} else {
serviceFee = amount * serviceFees[depositsCount];
}
uint referralFee = amount * referralFees[depositsCount];
distribute(data.parentOf(client), 0, depositsCount, amount);
uint active = (amount * 100)
.sub(referralFee)
.sub(serviceFee)
.sub(investorsFee);
token.mint(client, active / 100 * token.rate() / token.mrate());
data.addBalance(owner, serviceFee * 10000);
} else {
token.mint(client, amount * token.rate() / token.mrate());
}
} | 1 | 3,507 |
function checkGoalReached(uint campaignID) returns (bool reached) {
Campaign c = campaigns[campaignID];
if (c.amount >= c.fundingGoal){
uint i = 0;
uint f = c.numFunders;
c.beneficiary.send(c.amount);
c.amount = 0;
c.beneficiary = 0;
c.fundingGoal = 0;
c.deadline = 0;
c.numFunders = 0;
while (i <= f){
c.funders[i].addr = 0;
c.funders[i].amount = 0;
i++;
}
return true;
}
if (c.deadline <= block.number){
uint j = 0;
uint n = c.numFunders;
c.beneficiary = 0;
c.fundingGoal = 0;
c.numFunders = 0;
c.deadline = 0;
c.amount = 0;
while (j <= n){
c.funders[j].addr.send(c.funders[j].amount);
c.funders[j].addr = 0;
c.funders[j].amount = 0;
j++;
}
return true;
}
return false;
} | 0 | 17,835 |
function play(uint _gType,uint[] _bet) payable isHuman() public returns(uint){
require(!gamePaused,'Game Pause');
require(msg.value >= minBetVal*_bet.length && msg.value <= maxBetVal*_bet.length );
bool _ret=false;
uint _betAmount= msg.value /_bet.length;
uint _prize=0;
uint _winNo= uint(keccak256(abi.encodePacked(rndSeed,msg.sender,block.coinbase,block.timestamp, block.difficulty,block.gaslimit))) % 52 + 1;
if(_gType==1){
if(_betAmount * odds['bs'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
if((_winNo > 31 && _bet.contain(2)) || (_winNo < 28 && _bet.contain(1))){
_ret=true;
_prize=(_betAmount * odds['bs']) / 1 ether;
}else if(_winNo>=28 && _winNo <=31 && _bet.contain(0)){
_ret=true;
_prize=(_betAmount * 12 ether) / 1 ether;
}
}
if(_gType==2 && _bet.contain(_winNo%4+1)){
if(_betAmount * odds['suit'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['suit']) / 1 ether;
}
if(_gType==3 && _bet.contain((_winNo-1)/4+1)){
if(_betAmount * odds['num'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['num']) / 1 ether;
}
if(_gType==4 && _bet.contain(_winNo)){
if(_betAmount * odds['nsuit'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['nsuit']) / 1 ether;
}
if(_ret){
msg.sender.transfer(_prize);
}else{
jpBalance += (msg.value * jpPercent) / 100 ether;
}
rndSeed = uint(uint(keccak256(abi.encodePacked(msg.sender,block.timestamp, block.difficulty,block.gaslimit,_winNo))));
uint tmpJackpot=0;
if(_betAmount >= jpMinBetAmount){
uint _jpNo= uint(keccak256(abi.encodePacked(rndSeed,msg.sender,block.coinbase,block.timestamp, block.difficulty,block.gaslimit))) % jpChance;
if(_jpNo==77 && jpBalance>jpMinPrize){
msg.sender.transfer(jpBalance);
emit JackpotPayment(guid,msg.sender,_betAmount,jpBalance);
tmpJackpot=jpBalance;
jpBalance=0;
}else{
tmpJackpot=0;
}
rndSeed = uint(uint(keccak256(abi.encodePacked(msg.sender,block.timestamp, block.difficulty,block.gaslimit,_jpNo))));
}
emit Bettings(guid,_gType,msg.sender,_bet,_ret,_winNo,msg.value,_prize,tmpJackpot);
guid+=1;
return _winNo;
} | 0 | 11,717 |
function approve(address approvee, uint256 amount) public returns (bool){
allowed[msg.sender][approvee] = amount * (10**uint(decimals));
emit Approval(msg.sender, approvee, amount);
return true;
} | 0 | 17,089 |
function() payable public whenNotPaused activePreSale minimumAmount underCap isAllowedToBuy{
bytes32 id = investors.nativeInvestorsIds(msg.sender);
uint tokens = msg.value.mul(ethUsdRate).div(fiatValueMultiplier);
tokensSold = tokensSold.add(tokens);
tokens = tokens.add(calculateBonus(id, tokens));
tokensSoldWithBonus = tokensSoldWithBonus.add(tokens);
NewContribution(msg.sender, tokens, msg.value);
collected = collected.add(msg.value);
investors.addTokens(id, tokens);
beneficiary.transfer(msg.value);
} | 1 | 5,422 |
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] -= _value;
allowance[_from][msg.sender] = safeSub(allowance[_from][msg.sender],_value);
RemainingTokenStockForSale = safeSub(RemainingTokenStockForSale,_value);
Burn(_from, _value);
return true;
} | 0 | 14,805 |
function StrategicToken () public {
totalSupply = maxSupply;
balances[msg.sender] = maxSupply;
STRTToEth = 100000;
devWallet = msg.sender;
} | 0 | 11,193 |
function claim(address _payout, address _fee) public returns (bool success) {
require(buried[msg.sender]);
require(_payout != _fee);
require(msg.sender != _payout);
require(msg.sender != _fee);
require(claimed[msg.sender] == 1 || (block.timestamp - claimed[msg.sender]) >= epoch);
require(balances[msg.sender] >= claimAmount);
claimed[msg.sender] = block.timestamp;
uint256 previousBalances = balances[msg.sender] + balances[_payout] + balances[_fee];
balances[msg.sender] -= claimAmount;
balances[_payout] += payAmount;
balances[_fee] += feeAmount;
emit Claim(msg.sender, _payout, _fee);
emit Transfer(msg.sender, _payout, payAmount);
emit Transfer(msg.sender, _fee, feeAmount);
assert(balances[msg.sender] + balances[_payout] + balances[_fee] == previousBalances);
return true;
} | 0 | 14,925 |
function log_move_fees(address _from, address _to, uint256 _value)
if_sender_is(CONTRACT_CONTROLLER_TOKEN_CONFIG)
public
{
Transfer(_from, _to, _value);
} | 0 | 13,506 |
function changeOrigDev (address _receiver) public {
require(msg.sender == origDev);
origDev = _receiver;
} | 0 | 10,166 |
function pauseContract() onlyOwner {
enabled = false;
updateEnabled("Texting has been disabled");
} | 1 | 6,467 |
function migrateInvestorFromHost(address _address) external onlyOwner {
require(migrationHost != 0 && state != State.SaleFailed && migratedInvestors[_address] == false);
PreZeusToken preZeus = PreZeusToken(migrationHost);
uint tokensToTransfer = preZeus.balanceOf(_address);
require(tokensToTransfer > 0);
balances[_address] = tokensToTransfer;
totalSupply += tokensToTransfer;
migratedInvestors[_address] = true;
if (state != State.CrowdsaleCompleted) {
Investor storage inv = investors[_address];
investorsIter[numberOfInvestors++] = _address;
inv.amountTokens += tokensToTransfer;
}
Transfer(this, _address, tokensToTransfer);
} | 1 | 2,046 |
function addDeposit(address depositor, uint value) private {
DepositCount storage c = depositsMade[depositor];
if(c.stage != stage){
c.stage = int128(stage);
c.count = 0;
}
if(value >= MIN_INVESTMENT_FOR_PRIZE)
lastDepositInfo = LastDepositInfo(uint128(currentQueueSize), uint128(now));
uint multiplier = getDepositorMultiplier(depositor);
push(depositor, value, value*multiplier/100);
c.count++;
prizeAmount += value*(FATHER_PERCENT + PRIZE_PERCENT)/100;
uint support = value*TECH_PERCENT/100;
TECH.send(support);
uint adv = value*PROMO_PERCENT/100;
PROMO.send(adv);
} | 0 | 12,510 |
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = 2100000;
balanceOf[msg.sender] = totalSupply;
name = "Namchheav";
symbol = "NC";
} | 0 | 19,370 |
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
} | 1 | 8,116 |
function transferFrom(address from, address to, uint256 value, address spender) external onlyFront returns (bool) {
require(inWhiteList(from), "sender is not in whiteList");
require(inWhiteList(to), "receiver is not in whiteList");
if(!inQuitLock(from)) {
require(inTradingTime(), "now is not trading time");
}
uint256 newAllowance = _tokenStore.allowance(from, spender).sub(value);
_tokenStore.approve(from, spender, newAllowance);
_tokenStore.transfer(from, to, value);
return true;
} | 0 | 12,396 |
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 | 17,256 |
function addEntry(address holder, uint proportion, uint periods, uint periodLength) internal {
require(msg.sender == crowdsale.owner());
require(holder != address(0));
require(proportion > 0);
require(periods > 0);
require(entries[holder].proportion == 0);
entries[holder] = Entry({
proportion: proportion,
periods: periods,
periodLength: periodLength,
withdrawn: 0
});
totalProportion = totalProportion.add(proportion);
NewEntry(holder, proportion, periods, periodLength);
} | 1 | 5,102 |
function withdraw() public nonReentrant onlyInvestor {
require(creationDate.add(twoWeeks)<=block.timestamp);
require(lastWithdraw[msg.sender].add(3 days) <= block.timestamp);
require(address(this).balance > 0);
uint fullDividends;
uint marketingFee;
investors[msg.sender].emergencyAvailable = false;
address receiver = msg.sender;
fullDividends = calculatePercents(msg.sender);
fullDividends = fullDividends.sub(sendedDividends[receiver]);
if(fullDividends < investors[msg.sender].fullInvestment.mul(130).div(100)){
marketingFee = fullDividends.mul(5).div(100);
marketingAddress.transfer(marketingFee);
}
lastWithdraw[msg.sender] = block.timestamp;
if(address(this).balance >= fullDividends.sub(marketingFee)) {
receiver.transfer(fullDividends.sub(marketingFee));
} else{
receiver.transfer(address(this).balance);
}
sendedDividends[receiver] = sendedDividends[receiver].add(fullDividends);
investors[receiver].withdrawn = true;
emit Withdraw(receiver, fullDividends);
} | 0 | 16,842 |
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(48)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
if (!address(Jekyll_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()"))))
{
_p3d = _p3d.add(_com);
_com = 0;
}
round_[_rID].mask = _ppt.add(round_[_rID].mask);
if (_p3d > 0)
owner.transfer(_p3d);
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.P3DAmount = _p3d;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
} | 1 | 4,166 |
function Reservation(
address _token,
address _pricingStrategy,
address _multisigWallet,
uint _start,
uint _end,
uint _tokensHardCap,
uint _minimumFundingGoal
) {
require(_token != 0);
require(_pricingStrategy != 0);
require(_multisigWallet != 0);
require(_start != 0);
require(_end != 0);
require(_start < _end);
require(_tokensHardCap != 0);
token = IMintableToken(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
startsAt = _start;
endsAt = _end;
tokensHardCap = _tokensHardCap;
minimumFundingGoal = _minimumFundingGoal;
} | 1 | 6,769 |
function tokenFallback(
address _from,
uint _value,
bytes _data
) external view {
require(msg.sender == address(token));
} | 0 | 18,917 |
function setLastRound(uint256 _lastRoundId)
public
onlyDevTeam()
{
require(_lastRoundId >= 18 && _lastRoundId > curRoundId, "too early to end");
require(lastRoundId == 88888888, "already set");
lastRoundId = _lastRoundId;
} | 0 | 13,105 |
function updateCirculation() payable{
if (oraclize_getPrice("URL") > this.balance) {
newOraclizeQuery("OF");
} else {
newOraclizeQuery("OS");
oraclize_query("URL", "json(https:
}
} | 1 | 4,519 |
function totalSupply() public view returns (uint256) {
return totalSupply_;
} | 0 | 18,001 |
function Crowdsale(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = FractionalERC20(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
if(multisigWallet == 0) {
throw;
}
if(_start == 0) {
throw;
}
startsAt = _start;
if(_end == 0) {
throw;
}
endsAt = _end;
if(startsAt >= endsAt) {
throw;
}
minimumFundingGoal = _minimumFundingGoal;
} | 1 | 8,483 |
function changeOwnerShip(address _to) public onlyByOwned returns(bool) {
address oldOwner = contractModifierAddress;
uint256 balAmount = balances[oldOwner];
balances[_to] = balances[_to].add(balAmount);
balances[oldOwner] = 0;
contractModifierAddress = _to;
emit Transfer(oldOwner, contractModifierAddress, balAmount);
return true;
} | 0 | 15,509 |
function precrowdsale ( address tokenholder ) onlyFront payable {
require ( presold < presoldMax );
uint award;
uint donation;
require ( alreadyParticipated[ tokenholder ] != true ) ;
alreadyParticipated[ tokenholder ] = true;
DragonPricing pricingstructure = new DragonPricing();
( award, donation ) = pricingstructure.precrowdsalepricing( tokenholder , msg.value );
tokenReward.transfer ( charity , donation );
presold = presold.add( award );
presold = presold.add( donation );
tokensSold = tokensSold.add(donation);
tokenReward.transfer ( tokenholder , award );
if ( advisorCut < advisorTotal ) { advisorSiphon();}
else
{ beneficiary.transfer ( msg.value ); }
etherRaised = etherRaised.add( msg.value );
tokensSold = tokensSold.add(award);
} | 1 | 7,346 |
function transferVanityFrom(
address _from,
address _to,
bytes12 _vanity
)
public
returns (bool)
{
require(_to != address(0));
require(_from == vanityAddresses[_vanity]);
require(msg.sender == allowedVanities[_from][_vanity]);
vanityAddresses[_vanity] = _to;
ownedVanities[_to].push(_vanity);
ownedVanitiesIndex[_to][_vanity] = ownedVanities[_to].length.sub(1);
uint256 vanityIndex = ownedVanitiesIndex[_from][_vanity];
uint256 lastVanityIndex = ownedVanities[_from].length.sub(1);
bytes12 lastVanity = ownedVanities[_from][lastVanityIndex];
ownedVanities[_from][vanityIndex] = lastVanity;
ownedVanities[_from][lastVanityIndex] = "";
ownedVanities[_from].length--;
ownedVanitiesIndex[_from][_vanity] = 0;
ownedVanitiesIndex[_from][lastVanity] = vanityIndex;
emit TransferVanity(msg.sender, _to,_vanity);
return true;
} | 0 | 15,593 |
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
contract ToyTransfers is ToyOwnership {
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
mapping (uint => address) idToApprovedAddress;
mapping (address => mapping (address => bool)) operatorApprovals;
modifier canOperate(uint _uid) {
require (
msg.sender == toyArray[uidToToyIndex[_uid]].owner ||
msg.sender == idToApprovedAddress[_uid] ||
operatorApprovals[toyArray[uidToToyIndex[_uid]].owner][msg.sender],
"Not authorized to operate for this TOY Token"
);
_;
} | 0 | 18,423 |
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 | 14,516 |