func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
|---|---|---|
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
}
| 0
| 14,629
|
function transfer(address beneficiary, uint256 amount) onlyOwner public {
doPurchase(beneficiary, amount, 0);
Purchase(beneficiary, address(1), 0, amount, 0);
onPurchase(beneficiary, address(1), 0, amount, 0);
}
| 1
| 1,521
|
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
token.safeTransfer(beneficiary, amount);
}
| 0
| 10,279
|
function addInterest(uint index) public returns (bool) {
Loan storage loan = loans[index];
require(loan.status == Status.lent);
internalAddInterest(loan, block.timestamp);
}
| 0
| 15,811
|
function-max-lines */
{
require(!deactivated);
require(_amountST > 0);
require(valueToken.allowance(tx.origin, address(this)) >= _amountST);
require(utilityTokens[_uuid].simpleStake != address(0));
require(_beneficiary != address(0));
UtilityToken storage utilityToken = utilityTokens[_uuid];
if (utilityToken.stakingAccount != address(0)) require(msg.sender == utilityToken.stakingAccount);
require(valueToken.transferFrom(tx.origin, address(this), _amountST));
amountUT = (_amountST.mul(utilityToken.conversionRate))
.div(10**uint256(utilityToken.conversionRateDecimals));
unlockHeight = block.number + blocksToWaitLong();
nonces[tx.origin]++;
nonce = nonces[tx.origin];
stakingIntentHash = hashStakingIntent(
_uuid,
tx.origin,
nonce,
_beneficiary,
_amountST,
amountUT,
unlockHeight
);
stakes[stakingIntentHash] = Stake({
uuid: _uuid,
staker: tx.origin,
beneficiary: _beneficiary,
nonce: nonce,
amountST: _amountST,
amountUT: amountUT,
unlockHeight: unlockHeight
});
StakingIntentDeclared(_uuid, tx.origin, nonce, _beneficiary,
_amountST, amountUT, unlockHeight, stakingIntentHash, utilityToken.chainIdUtility);
return (amountUT, nonce, unlockHeight, stakingIntentHash);
}
| 1
| 5,030
|
function sell(uint256 amountTokens) payDividends(msg.sender) checkDSG(amountTokens) public
{
uint256 ethereum = amountTokens.mul(tokenPrice).div(10 ** uint(decimals));
account[msg.sender].ethereumBalance = account[msg.sender].ethereumBalance.add(ethereum);
_burn(msg.sender, amountTokens);
emit Sell(msg.sender, amountTokens, ethereum, totalSupply, now);
}
| 0
| 15,796
|
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return (nonFungibleContract.ownerOf(_tokenId) == _claimant);
}
| 0
| 18,619
|
function()
public
isValidPayload
isExists
atStage(Stages.Started)
payable
{
uint amount = msg.value;
uint maxAmount = totalAmount.div(priceFactor);
if (amount > maxAmount){
uint refund = amount.sub(maxAmount);
assert(msg.sender.send(refund));
amount = maxAmount;
}
if(maxGasPrice != 0){
assert(tx.gasprice < maxGasPrice + 1);
}
totalReceived = totalReceived.add(amount);
uint token = amount.mul(priceFactor);
totalAmount = totalAmount.sub(token);
yeedToken.transferFrom(tokenOwner, msg.sender, token);
FundTransfer(msg.sender, token);
ContributeAddress crowdData = _contributeInfo[msg.sender];
crowdData.exists = true;
crowdData.account = msg.sender;
crowdData.data = msg.data;
crowdData.amount = amount;
crowdData.balance = token;
_contruibuteData[msg.data] = crowdData;
_contributeInfo[msg.sender] = crowdData;
wallet.transfer(amount);
if (amount == maxAmount)
finalizeContruibute();
}
| 1
| 9,361
|
function buyEth(uint _ndx) public {
require(_humanSender(msg.sender));
address _offeror = ethOfferors[_ndx];
uint _purchasePrice = ethEtherOffered[_offeror] * ethPricePerToken[_offeror] / ScaleFactor;
require(phxCoin.transferFrom(msg.sender, _offeror, _purchasePrice));
msg.sender.transfer(ethEtherOffered[_offeror]);
_cancelEthOffer(_offeror);
}
| 1
| 2,527
|
function setContractMiniGame(address _addr) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) { revert(); }
miniGames[_addr] = true;
}
| 1
| 7,115
|
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
Letou8datasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == address(0) || _affCode == msg.sender)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
}
| 1
| 3,591
|
function drawing() internal {
require(block.number > futureblock, "Awaiting for a future block");
if (block.number >= futureblock + 230) {
futureblock = block.number + 20;
return;
}
uint256 gas = gasleft();
for (uint256 i = 0; i < silver[0]; i++) {
address winner = players[uint((blockhash(futureblock - 1 - i))) % players.length];
winner.send(silver[1]);
WT.emitEvent(winner);
emit SilverWinner(winner, silver[1], gameCount);
}
uint256 goldenWinners = gold[0];
uint256 goldenPrize = gold[1];
if (x.count() < gold[0]) {
goldenWinners = x.count();
goldenPrize = gold[0] * gold[1] / x.count();
}
if (goldenWinners != 0) {
address[] memory addresses = x.draw(goldenWinners);
for (uint256 k = 0; k < addresses.length; k++) {
addresses[k].send(goldenPrize);
RS.sendBonus(addresses[k]);
WT.emitEvent(addresses[k]);
emit GoldenWinner(addresses[k], goldenPrize, gameCount);
}
}
uint256 laps = 10;
uint256 winnerIdx;
uint256 indexes = players.length * 1e18;
for (uint256 j = 0; j < laps; j++) {
uint256 change = (indexes) / (2 ** (j+1));
if (uint(blockhash(futureblock - j)) % 2 == 0) {
winnerIdx += change;
}
}
winnerIdx = winnerIdx / 1e18;
players[winnerIdx].send(brilliant[1]);
WT.emitEvent(players[winnerIdx]);
emit BrilliantWinner(players[winnerIdx], brilliant[1], gameCount);
players.length = 0;
futureblock = 0;
x = new Storage();
gameCount++;
uint256 txCost = tx.gasprice * (gas - gasleft());
msg.sender.send(txCost);
emit txCostRefunded(msg.sender, txCost);
uint256 fee = address(this).balance - msg.value;
owner.send(fee);
emit FeePayed(owner, fee);
}
| 1
| 6,987
|
constructor params
ZTHTKNADDR = ZethrAddress;
ZTHBANKROLL = BankrollAddress;
owner = msg.sender;
bankroll = ZTHBANKROLL;
ZTHTKN = ZTHInterface(ZTHTKNADDR);
ZTHTKN.approve(ZTHBANKROLL, 2**256 - 1);
ZTHTKN.approve(owner, 2**256 - 1);
validTokenBet[5e18] = true;
validTokenBet[10e18] = true;
validTokenBet[25e18] = true;
validTokenBet[50e18] = true;
gameActive = true;
}
function() public payable { }
struct TKN { address sender; uint value; }
function tokenFallback(address _from, uint _value, bytes ) public returns (bool){
if (_from == bankroll) {
contractBalance = contractBalance.add(_value);
return true;
}
| 1
| 3,905
|
function TokenTranchePricing(uint[] init_tranches) public {
require(init_tranches.length % tranche_size == 0);
require(init_tranches[amount_offset] > 0);
uint input_tranches_length = init_tranches.length.div(tranche_size);
Tranche memory last_tranche;
for (uint i = 0; i < input_tranches_length; i++) {
uint tranche_offset = i.mul(tranche_size);
uint amount = init_tranches[tranche_offset.add(amount_offset)];
uint start = init_tranches[tranche_offset.add(start_offset)];
uint end = init_tranches[tranche_offset.add(end_offset)];
uint price = init_tranches[tranche_offset.add(price_offset)];
require(block.timestamp < start && start < end);
require(i == 0 || (end >= last_tranche.end && amount > last_tranche.amount) ||
(end > last_tranche.end && amount >= last_tranche.amount));
last_tranche = Tranche(amount, start, end, price);
tranches.push(last_tranche);
}
}
| 0
| 13,432
|
function setPendingTaxParameters(address _taxWallet, uint _taxFeeBps) public onlyOperator {
require(_taxWallet != address(0));
require(_taxFeeBps > 0);
taxData.wallet = _taxWallet;
taxData.feeBps = _taxFeeBps;
setNewData(TAX_DATA_INDEX);
}
| 0
| 15,959
|
function() external payable {
require(msg.value >= 0.001 ether);
require(address(thorMutualContract) != address(0));
address(thorMutualContract).transfer(msg.value);
uint actualPeriod = 0;
uint actualPeriodWeek = 0;
actualPeriod = thorMutualContract.getCurrentPeriod();
actualPeriodWeek = actualPeriod / WEEKLY_PERIOD;
if (participantAmount[msg.sender] == 0) {
participants.push(msg.sender);
}
if (participantAmountOfDailyPeriod[actualPeriod][msg.sender] == 0) {
participantsDaily[actualPeriod].push(msg.sender);
}
if (participantAmountOfWeeklyPeriod[actualPeriodWeek][msg.sender] == 0) {
participantsWeekly[actualPeriodWeek].push(msg.sender);
}
participantAmountOfDailyPeriod[actualPeriod][msg.sender] += msg.value;
participantAmount[msg.sender] += msg.value;
participantAmountOfWeeklyPeriod[actualPeriodWeek][msg.sender] += msg.value;
amountOfDailyPeriod[actualPeriod] += msg.value;
amountOfWeeklyPeriod[actualPeriodWeek] += msg.value;
participantsHistoryTime[msg.sender].push(block.timestamp);
participantsHistoryPeriod[msg.sender].push(actualPeriod);
participantsHistoryAmount[msg.sender].push(msg.value);
emit ThorDepositToken(msg.sender, msg.value);
}
| 1
| 1,675
|
function isOnSaleAny3(uint256 _tokenId1, uint256 _tokenId2, uint256 _tokenId3) external view returns(bool) {
uint256 lastIndex = latestAction[_tokenId1];
uint64 tmNow = uint64(block.timestamp);
if (lastIndex > 0) {
Auction storage order1 = auctionArray[lastIndex];
if ((order1.tmStart + auctionDuration > tmNow) && order1.tmSell == 0) {
return true;
}
}
lastIndex = latestAction[_tokenId2];
if (lastIndex > 0) {
Auction storage order2 = auctionArray[lastIndex];
if ((order2.tmStart + auctionDuration > tmNow) && order2.tmSell == 0) {
return true;
}
}
lastIndex = latestAction[_tokenId3];
if (lastIndex > 0) {
Auction storage order3 = auctionArray[lastIndex];
if ((order3.tmStart + auctionDuration > tmNow) && order3.tmSell == 0) {
return true;
}
}
return false;
}
| 0
| 14,021
|
function participate() external {
require(now >= participateFromTimestamp, "too early to participate");
require(_participateIsAllowed(now), "participate on the 1st day of every month");
uint256 allowedToTransfer = mthToken.allowance(msg.sender, address(this));
require(allowedToTransfer > 0, "positive allowance needed");
mthToken.safeTransferFrom(msg.sender, address(this), allowedToTransfer);
stakedBy[msg.sender] = stakedBy[msg.sender].add(allowedToTransfer);
totalStacked = totalStacked.add(allowedToTransfer);
emit ParticipationStarted(msg.sender, allowedToTransfer);
}
| 1
| 9,571
|
function rentHo(uint index) public payable {
Ho hoe = hoes[index];
address currentPimp = hoe.pimp;
uint currentRent = hoe.rentPrice;
require(msg.value >= currentRent);
currentPimp.transfer(msg.value*93/100);
if (block.timestamp%hoe.aidsChance == 0) {
hasAids[msg.sender] = true;
}
}
| 0
| 10,137
|
function getAddress() returns (address _addr);
}
library Buffer {
struct buffer {
bytes buf;
uint capacity;
}
| 0
| 18,976
|
function cancelAuction(uint256 _tokenId)
external
{
require(_tokenId > 1);
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
address seller = auction.seller;
require(msg.sender == seller);
_cancelAuction(_tokenId, seller);
}
| 1
| 2,056
|
function finalize() {
if (msg.sender != buyer && msg.sender != arbiter) throw;
seller.send(this.balance);
}
| 0
| 18,695
|
function IMDEXdeposit() public payable {
tokens[address(0)][msg.sender] = safeAdd(tokens[address(0)][msg.sender], msg.value);
lastActiveTransaction[msg.sender] = block.number;
emit Deposit(address(0), msg.sender, msg.value, tokens[address(0)][msg.sender]);
}
| 0
| 18,503
|
function transferFrom(address _from, address _to, uint256 _amount, bytes _data)
public transfersAllowed
returns (bool success)
{
if (isContract(controller)) {
if (!TokenController(controller).onTransfer(_from, _to, _amount))
revert();
}
require(super.transferFrom(_from, _to, _amount));
if (isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(_from, _amount, _data);
}
emit ERC223Transfer(_from, _to, _amount, _data);
return true;
}
| 1
| 2,304
|
function getNextAuditRequest() public {
if (assignedAudits.listExists()) {
bool exists;
uint256 potentialExpiredRequestId;
(exists, potentialExpiredRequestId) = assignedAudits.getAdjacent(HEAD, NEXT);
uint256 allowanceBlockNumber = auditData.getAuditAssignBlockNumber(potentialExpiredRequestId) + auditData.auditTimeoutInBlocks();
if (allowanceBlockNumber < block.number) {
updateAssignedAudits(potentialExpiredRequestId);
auditData.setAuditState(potentialExpiredRequestId, QuantstampAuditData.AuditState.Expired);
emit LogAuditAssignmentUpdate_Expired(potentialExpiredRequestId, allowanceBlockNumber);
}
}
AuditAvailabilityState isRequestAvailable = anyRequestAvailable();
if (isRequestAvailable == AuditAvailabilityState.Empty) {
emit LogAuditQueueIsEmpty();
return;
}
if (isRequestAvailable == AuditAvailabilityState.Exceeded) {
emit LogAuditAssignmentError_ExceededMaxAssignedRequests(msg.sender);
return;
}
uint256 minPrice = auditData.getMinAuditPrice(msg.sender);
require(minPrice >= minAuditPriceLowerCap);
if (isRequestAvailable == AuditAvailabilityState.Understaked) {
emit LogAuditAssignmentError_Understaked(msg.sender, totalStakedFor(msg.sender));
return;
}
uint256 requestId = dequeueAuditRequest(minPrice);
if (requestId == 0) {
emit LogAuditNodePriceHigherThanRequests(msg.sender, minPrice);
return;
}
auditData.setAuditState(requestId, QuantstampAuditData.AuditState.Assigned);
auditData.setAuditAuditor(requestId, msg.sender);
auditData.setAuditAssignBlockNumber(requestId, block.number);
assignedRequestCount[msg.sender]++;
assignedAudits.push(requestId, PREV);
tokenEscrow.lockFunds(msg.sender, block.number.add(auditData.auditTimeoutInBlocks()).add(police.policeTimeoutInBlocks()));
mostRecentAssignedRequestIdsPerAuditor[msg.sender] = requestId;
emit LogAuditAssigned(requestId,
auditData.getAuditAuditor(requestId),
auditData.getAuditRequestor(requestId),
auditData.getAuditContractUri(requestId),
auditData.getAuditPrice(requestId),
auditData.getAuditRequestBlockNumber(requestId));
}
| 1
| 8,794
|
function allocateLocked(address _who, uint _value)
only_admin
when_allocatable_locked(_value)
public
{
tokens.mintLocked(_who, _value);
lockedAllocatable -= _value;
Allocated(_who, _value, false);
}
| 1
| 4,553
|
function getAccountsLength()
external
view
onlyOwner
returns (uint256)
{
return accounts.length;
}
| 0
| 10,392
|
function closeBallot() public returns (uint) {
require(!closed);
require(now > votingEnd);
if(phiWon.mul(100000).div(totalVoters) >= threshold) {
validResult = 1;
votingReward = bettingContract.getLosersOnePercent(2);
majorityReward = (neWon * 50 finney).add(votingReward).div(phiWon);
} else if (neWon.mul(100000).div(totalVoters) >= threshold) {
validResult = 2;
votingReward = bettingContract.getLosersOnePercent(3);
majorityReward = (phiWon * 50 finney).add(votingReward).div(neWon);
} else {
if (neWon.mul(100000).div(totalVoters) > 50000) majorityReward = (phiWon * 50 finney).div(neWon);
else if (phiWon.mul(100000).div(totalVoters) > 50000) majorityReward = (neWon * 50 finney).div(phiWon);
else {
tie = true;
majorityReward = 0;
}
validResult = 0;
}
closed = true;
return validResult;
}
| 1
| 9,717
|
function transfer(address _to, uint256 _value) public returns(bool){
_transfer(msg.sender, _to, _value);
}
| 0
| 11,729
|
function safeMult(uint x, uint y) pure internal returns(uint) {
uint z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
| 0
| 16,657
|
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation];
uint index = ownerIndex[_owner];
if (index == 0) {
return false;
}
uint ownerIndexBit = 2**index;
return !(pending.ownersDone & ownerIndexBit == 0);
}
| 0
| 18,921
|
function distributeFund(address _to, uint256 _amount) public {
require(msg.sender == admin);
require(_amount <= _STAYKFund);
_STAYKFund = _STAYKFund.sub(_amount);
lastPay[_to] = block.number;
_STAYKTokenBalances[_to] = _STAYKTokenBalances[_to].add(_amount);
emit Transfer(address(this), _to, _amount);
}
| 0
| 15,904
|
function ()
onlyActive()
onlyHumans()
public payable {
require(msg.value >= minBetsVolume && msg.value <= maxBetsVolume);
randomQueryId += 1;
totalInvested += msg.value;
jackPot_now += msg.value.mul(jackPot_percent_now).div(1000);
jackPot_next += msg.value.mul(jackPot_percent_next).div(1000);
jackPot_lf += msg.value.mul(jackPot_little_first).div(1000);
jackPot_ls += msg.value.mul(jackPot_little_second).div(1000);
uint adminGetValue = msg.value.mul(forAdminGift).div(1000);
adminGet.transfer(adminGetValue);
uint promoGetValue = msg.value.mul(forAdminGift).div(1000);
promoGet.transfer(promoGetValue);
if (mkt != 0x0 && mktRate != 0){
uint mktGetValue = msg.value.mul(mktRate).div(1000);
mkt.transfer(mktGetValue);
}
string memory queryString1 = "[URL] ['json(https:
string memory queryString2 = uint2str(randomQueryId);
string memory queryString3 = "${[identity] \"}\"}']";
string memory queryString1_2 = queryString1.toSlice().concat(queryString2.toSlice());
string memory queryString1_2_3 = queryString1_2.toSlice().concat(queryString3.toSlice());
bytes32 queryId = oraclize_query("nested", queryString1_2_3, gasLimitForOraclize);
playerBetId[queryId] = queryId;
playerBetValue[queryId] = msg.value;
playerAddress[queryId] = msg.sender;
emit LogOraclizeQuery("Oraclize query was sent, standing by for the answer..");
emit betsLog(playerTempAddress[queryId], now, playerTempBetValue[queryId], queryId);
}
| 1
| 5,346
|
function withdrawFeesAndRewards(address _beneficiary, bytes32 _tokenID, uint _request, uint _round) public {
Token storage token = tokens[_tokenID];
Request storage request = token.requests[_request];
Round storage round = request.rounds[_round];
require(request.resolved);
uint reward;
if (!request.disputed || request.ruling == Party.None) {
uint rewardRequester = round.paidFees[uint(Party.Requester)] > 0
? (round.contributions[_beneficiary][uint(Party.Requester)] * round.feeRewards) / (round.paidFees[uint(Party.Challenger)] + round.paidFees[uint(Party.Requester)])
: 0;
uint rewardChallenger = round.paidFees[uint(Party.Challenger)] > 0
? (round.contributions[_beneficiary][uint(Party.Challenger)] * round.feeRewards) / (round.paidFees[uint(Party.Challenger)] + round.paidFees[uint(Party.Requester)])
: 0;
reward = rewardRequester + rewardChallenger;
round.contributions[_beneficiary][uint(Party.Requester)] = 0;
round.contributions[_beneficiary][uint(Party.Challenger)] = 0;
} else {
reward = round.paidFees[uint(request.ruling)] > 0
? (round.contributions[_beneficiary][uint(request.ruling)] * round.feeRewards) / round.paidFees[uint(request.ruling)]
: 0;
round.contributions[_beneficiary][uint(request.ruling)] = 0;
}
emit RewardWithdrawal(_tokenID, _beneficiary, _request, _round, reward);
_beneficiary.send(reward);
}
| 0
| 12,513
|
function weeksFromEndPlusMonth() public view returns (uint256) {
require(now > (endTime + 30 days));
return percent(now - endTime + 30 days, 604800, 0);
}
| 0
| 17,992
|
function sig
* is registered to the contract at;
* https:
*/
function withdraw(bool)
public
{
address _customerAddress = msg.sender;
withdrawInternal(_customerAddress);
uint256 withdrawableDividends = dividendsStored_[_customerAddress];
withdrawAmount(withdrawableDividends);
}
| 1
| 5,361
|
function isCrowdsaleOpen() public view returns (bool) {
return address(crowdsale) != address(0) && !crowdsale.hasEnded() && crowdsale.hasStarted();
}
| 1
| 7,708
|
function Pardi() public {
symbol = "RDI";
name = "Pardi";
decimals = 8;
_totalSupply = 50000000000000000;
balances[0xA3D9064C16Bd7ce12D47F5054eE14C81aa12128c] = _totalSupply;
Transfer(address(0), 0xA3D9064C16Bd7ce12D47F5054eE14C81aa12128c, _totalSupply);
}
| 0
| 14,584
|
function claim(address verifier, uint verifiedAttributes, uint expires, uint8 v, bytes32 r, bytes32 s)
public
onlyValidAuthority(verifier)
onlyAuthoritativeAuthority(verifier, msg.sender)
{
if (verificationFee > 0) {
if(!chargeVerificationFee(msg.sender, verifier)) {
revert();
}
}
bytes32 hash = sha256(this, msg.sender, verifiedAttributes, expires);
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHash = keccak256(prefix, hash);
if (!((ecrecover(prefixedHash, v, r, s) == verifier) && block.number <= expires)) {
revert();
}
KYC memory kyc = KYC({
verified: true,
verifiedBy: verifier,
verifiedAt: block.number,
verifiedAttributes: verifiedAttributes
});
records[msg.sender] = kyc;
emit IdentityApproval(verifier, msg.sender, verifiedAttributes);
}
| 1
| 1,896
|
function JuventusvsRealMadrid() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0
| 14,895
|
function ImportBalance(address _owner) internal {
uint256 oldBalance;
oldBalance = CheckOldBalance(_owner);
if(balances[_owner] == 0 && (oldBalance > 0) && transfered[_owner] == false){
balances[_owner] = oldBalance;
transfered[_owner] = true;
}
}
| 1
| 8,323
|
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;
}
| 0
| 14,744
|
function addToCart(uint _orderID, string _notes) returns (uint)
{
OrderedSandwich memory newOrder;
newOrder.sandID = _orderID;
newOrder.notes = _notes;
newOrder.price = shopSandwich[_orderID].price;
return cart[msg.sender].push(newOrder);
}
| 0
| 10,538
|
function getMinContributionInWei() public view returns(uint256){
return (minContribution.mul(1e18)).div(ETH_USD);
}
| 0
| 11,844
|
function Walki() {
initialSupply = 1000000;
name ="Inteligentcoin";
decimals = 2;
symbol = "x";
balanceOf[msg.sender] = initialSupply;
totalSupply = initialSupply;
}
| 0
| 13,124
|
function summon() external payable whenNotPaused {
if (accountsLastClearTime[msg.sender] == uint256(0)) {
accountsLastClearTime[msg.sender] = now;
} else {
if (accountsLastClearTime[msg.sender] < levelClearTime && now > levelClearTime) {
accoutToSummonNum[msg.sender] = 0;
accoutToPayLevel[msg.sender] = 0;
accountsLastClearTime[msg.sender] = now;
}
}
uint256 payLevel = accoutToPayLevel[msg.sender];
uint256 price = payMultiple[payLevel] * baseSummonPrice;
require(msg.value >= price);
uint128 randomAppearance = mixFormula.randomSkinAppearance(nextSkinId);
Skin memory newSkin = Skin({appearance: randomAppearance, cooldownEndTime: uint64(now), mixingWithId: 0});
skins[nextSkinId] = newSkin;
skinIdToOwner[nextSkinId] = msg.sender;
isOnSale[nextSkinId] = false;
CreateNewSkin(nextSkinId, msg.sender);
nextSkinId++;
numSkinOfAccounts[msg.sender] += 1;
accoutToSummonNum[msg.sender] += 1;
if (payLevel < 5) {
if (accoutToSummonNum[msg.sender] >= levelSplits[payLevel]) {
accoutToPayLevel[msg.sender] = payLevel + 1;
}
}
}
| 1
| 3,774
|
function transferKittyBulk(address _to, uint256[] calldata _kittyIds) external onlyOwner {
for(uint256 i = 0; i < _kittyIds.length; i++) {
kittyCore.transfer(_to, _kittyIds[i]);
}
}
| 0
| 19,378
|
function addSideService(address _service, uint _block) public returns (uint _code) {
if (sideServices[_service]) {
return SERVICE_CONTROLLER_SERVICE_EXIST;
}
_code = _multisig(keccak256(_service), _block);
if (OK != _code) {
return _code;
}
sideServices[_service] = true;
return OK;
}
| 1
| 3,316
|
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(msg.value != 0);
require(now > dateStart);
require(now <= dateEnd);
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.div(10 ** 12).mul(rate);
require(token.mint(beneficiary, tokens));
tokenRaised = tokenRaised.add(tokens);
require(tokenRaised <= hardCap);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
weiRaised = weiRaised.add(weiAmount);
forwardFunds();
}
| 1
| 9,320
|
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(this);
require(amount > 0);
token.safeTransfer(beneficiary, amount);
}
| 0
| 14,725
|
function isRenter(address _advertiser, uint16 _blockId)
private
view
returns (bool)
{
return (_advertiser == meh.rentals().renterOf(_blockId));
}
| 1
| 5,291
|
function depositToken(address token, uint amount) public {
if (amount==0) revert();
require(whiteListERC20[token]);
if (!Token(token).transferFrom(msg.sender, this, amount)) revert();
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
emit Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
| 1
| 9,444
|
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
uint _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
tryCreateAccount(_to);
Transfer(_from, _to, _value);
return true;
}
| 0
| 12,157
|
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
if (totalSupply > (10**26) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(msg.sender, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
| 0
| 15,311
|
function getParametersHash(uint256 _precReq, address _voteOnBehalf) public pure returns(bytes32) {
return keccak256(abi.encodePacked(_precReq, _voteOnBehalf));
}
| 0
| 13,187
|
function availableVolume(address tokenBuy, uint amountBuy, address tokenSell, uint amountSell, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) public view returns(uint) {
bytes32 hash = keccak256(abi.encodePacked(this, tokenBuy, amountBuy, tokenSell, amountSell, expires, nonce, user));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.timestamp <= expires
)) return 0;
uint available1 = safeSub(amountBuy, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenSell][user], amountBuy) / amountSell;
if (available1<available2) return available1;
return available2;
}
| 0
| 12,059
|
function signatureDropMultipleAmount(address[] _recipients, uint256[] _amounts) external
onlyAdmin
validBalanceMultiple(_recipients, _amounts)
{
for (uint256 i = 0 ; i < _recipients.length ; i++) {
address recipient = _recipients[i];
uint256 amount = _amounts[i];
if (!signaturedrops[recipient]) {
assert(token.transfer(recipient, amount));
signaturedrops[recipient] = true;
numDrops = numDrops.add(1);
dropAmount = dropAmount.add(amount);
TokenDrop(recipient, amount, "SIGNATURE");
}
}
}
| 1
| 4,221
|
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Distr(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
| 0
| 17,490
|
function getTokenAddress() constant returns(address){
return tokenAddress;
}
| 0
| 11,682
|
function withdraw()
isActivated()
isHuman()
public
{
uint256 _now = now;
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _eth;
uint256 _aff = 0;
if(shareAddr_[plyr_[_pID].addr] != 0) {
uint _days = (now - shareAddr_[plyr_[_pID].addr]) / (24*3600) + 1;
_aff = _days * plyrRnds_[round_.index][_pID].eth / 20;
}
if (_now > round_.end && round_.ended == false && round_.plyr != 0)
{
LDdatasets.EventReturns memory _eventData_;
round_.ended = true;
_eventData_ = endRound(_eventData_);
_eth = withdrawEarnings(_pID);
_eth = _aff.add(_eth);
if (_eth > 0)
plyr_[_pID].addr.transfer(_eth);
withdrawAddr_[plyr_[_pID].addr] = 1;
shareAddr_[plyr_[_pID].addr] = 0;
round_.pot = round_.pot - _aff;
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit LDEvents.onWithdrawAndDistribute
(
msg.sender,
plyr_[_pID].name,
_eth,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.genAmount
);
} else {
_eth = withdrawEarnings(_pID);
_eth = _aff.add(_eth);
if (_eth > 0)
plyr_[_pID].addr.transfer(_eth);
withdrawAddr_[plyr_[_pID].addr] = 1;
shareAddr_[plyr_[_pID].addr] = 0;
round_.pot = round_.pot - _aff;
emit LDEvents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
}
| 1
| 4,424
|
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
if (isDiscount()) {
return _getTokensWithDiscount(_weiAmount);
}
return _weiAmount.mul(rate);
}
| 0
| 18,546
|
function isTransferable() constant returns (bool transferable) {
if ( !icoThresholdReached() ) return false;
if ( atNow() < DATE_ICO_END + COOLDOWN_PERIOD ) return false;
return true;
}
| 0
| 17,395
|
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) revert();
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
emit Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
| 1
| 1,615
|
function() payable {
tokenFree = sharesTokenAddress.balanceOf(this);
if (now < presaleStart_6_December) {
msg.sender.transfer(msg.value);
}
else if (now > presaleStop_13_December) {
msg.sender.transfer(msg.value);
if(!tokensWithdrawn){
sharesTokenAddress.transfer(safeContract, sharesTokenAddress.balanceOf(this));
tokenFree = sharesTokenAddress.balanceOf(this);
tokensWithdrawn = true;
presaleClosed = true;
}
}
else if (presaleClosed) {
msg.sender.transfer(msg.value);
}
else {
uint256 tokenToBuy = msg.value / realPrice * coeff;
if(tokenToBuy <= 0) msg.sender.transfer(msg.value);
require(tokenToBuy > 0);
uint256 actualETHTransfer = tokenToBuy * realPrice / coeff;
if (tokenFree >= tokenToBuy) {
owner.transfer(actualETHTransfer);
if (msg.value > actualETHTransfer){
msg.sender.transfer(msg.value - actualETHTransfer);
}
sharesTokenAddress.transfer(msg.sender, tokenToBuy);
tokenSold += tokenToBuy;
tokenFree -= tokenToBuy;
if(tokenFree==0) presaleClosed = true;
} else {
uint256 sendETH = tokenFree * realPrice / coeff;
owner.transfer(sendETH);
sharesTokenAddress.transfer(msg.sender, tokenFree);
msg.sender.transfer(msg.value - sendETH);
tokenSold += tokenFree;
tokenFree = sharesTokenAddress.balanceOf(this);
presaleClosed = true;
}
}
TokenFree(tokenFree);
PresaleClosed(presaleClosed);
}
| 1
| 6,235
|
function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
{
contractBalance = 2500000000000000000;
bytes32 rngId = oraclize_query("nested", "[URL] ['json(https:
totalBets += 1;
playerBetId[rngId] = rngId;
playerNumber[rngId] = rollUnder;
playerBetValue[rngId] = msg.value;
playerAddress[rngId] = msg.sender;
playerProfit[rngId] = ((((msg.value * (100-(safeSub(rollUnder,1)))) / (safeSub(rollUnder,1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value;
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[rngId]);
if(maxPendingPayouts >= contractBalance) throw;
LogBet(playerBetId[rngId], playerAddress[rngId], safeAdd(playerBetValue[rngId], playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]);
}
| 1
| 7,816
|
function swap( address _a, uint256 _amount ) public returns( bool )
{
require( swapActivity && tokenActivity[_a] && ( _amount >= tokenMinAmount[_a] ) );
uint256 ath = tokenRateAth[_a].mul( _amount ).div( tokenRateToken[_a] );
tokenSwapped[_a] = tokenSwapped[_a].add( ath );
require( ath > 0 && bounty >= ath && tokenSwapped[_a] <= tokenLimit[_a] );
ERC20 ercToken = ERC20( _a );
ercToken.transferFrom( msg.sender, address(this), _amount );
for( uint256 i = 0; i <= owners.length - 1; i++ )
ercToken.transfer( owners[i], _amount.div( owners.length ) );
token.delivery( msg.sender, ath );
bounty = bounty.sub( ath );
Delivery( msg.sender, ath );
Swap( msg.sender, _a, ath );
}
| 1
| 3,973
|
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 0
| 11,758
|
function getMintedCounts() external view returns (uint16[CHECKLIST_ITEM_COUNT]) {
uint16[CHECKLIST_ITEM_COUNT] memory mintedCounts;
for (uint8 i = 0; i < CHECKLIST_ITEM_COUNT; i++) {
mintedCounts[i] = strikersBaseContract.mintedCountForChecklistId(i);
}
return mintedCounts;
}
| 1
| 5,567
|
function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_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);
buyCore(_pID, _affCode, _team, _eventData_);
}
| 1
| 6,266
|
function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
require((_nbytes > 0) && (_nbytes <= 32));
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(unonce, 0x20)
mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
mstore(sessionKeyHash, 0x20)
mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
}
bytes[3] memory args = [unonce, nbytes, sessionKeyHash];
bytes32 queryId = oraclize_query(_delay, "random", args, _customGasLimit);
oraclize_randomDS_setCommitment(queryId, keccak256(bytes8(_delay), args[1], sha256(args[0]), args[2]));
return queryId;
}
| 1
| 1,598
|
function price() public view returns (uint256 _price) {
return tokenPerEth;
}
| 0
| 18,253
|
function rekt(uint8 typeToKill) internal {
updateglobal();
uint256 attacked = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, tx.origin))) % nextFormation;
uint256 _rpstype = formation[attacked].rpstype;
address killed = formation[attacked].owner;
address payable sender = msg.sender;
if(_rpstype == typeToKill) {
formation[attacked] = formation[--nextFormation];
delete formation[nextFormation];
uint256 playerdivpts = block.number.sub(buyblock[killed]).add(1000);
uint256 robbed = (address(this).balance).mul(playerdivpts).div(totaldivpts).div(2);
totaldivpts = totaldivpts.sub(playerdivpts);
_totalhouses--;
_playerhouses[killed]--;
sender.transfer(robbed);
emit win(attacked, playerdivpts, robbed);
}
emit battle(sender, typeToKill, killed);
}
| 0
| 9,999
|
function issuePRETDETokens(address beneficiary)
onlyCofounders
PRETDEContributorsAwaitingTokens
HasPendingPRETDETokens(beneficiary)
returns (bool)
{
uint256 tokenCount = PRETDEContributorTokensPendingRelease[beneficiary];
tokensDistributed = tokensDistributed.add(tokenCount);
DNNToken.DNNSupplyAllocations allocationType = DNNToken.DNNSupplyAllocations.PRETDESupplyAllocation;
if (!dnnToken.issueTokens(beneficiary, tokenCount, allocationType)) {
revert();
}
PRETDEContributorsTokensPendingCount -= 1;
PRETDEContributorTokensPendingRelease[beneficiary] = 0;
return true;
}
| 1
| 1,803
|
function safeTransfer(
address token,
address to,
uint256 value)
private
returns (bool success)
{
success = token.call(0xa9059cbb, to, value);
return checkReturnValue(success);
}
| 0
| 17,550
|
function sponsorOpinion(uint256 _tokenId,uint8 comment,bool _likesOpinion) public payable {
require(comment!=0);
require((_likesOpinion && comment<100) || (!_likesOpinion && comment>100));
address sponsorAdr = msg.sender;
require(_addressNotNull(sponsorAdr));
uint256 sellingPrice = opinionIndexToPrice[_tokenId];
address currentOwner=opinionIndexToOwner[_tokenId];
address newOwner = msg.sender;
require(_addressNotNull(newOwner));
require(_addressNotNull(currentOwner));
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 90), 100));
uint256 ownerTake=uint256(SafeMath.div(SafeMath.mul(sellingPrice, 10), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
if (sellingPrice < firstStepLimit) {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 200), 90);
} else if (sellingPrice < secondStepLimit) {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 120), 90);
} else {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 115), 90);
}
Opinion storage opinion = opinions[_tokenId];
require(opinion.claimed);
require(sponsorAdr!=opinion.sponsor);
require(sponsorAdr!=opinion.antisponsor);
require(sponsorAdr!=currentOwner);
opinion.comment=comment;
if(_likesOpinion){
if(_addressNotNull(opinion.sponsor)){
opinion.sponsor.transfer(payment);
currentOwner.transfer(ownerTake);
}
else{
currentOwner.transfer(sellingPrice);
}
opinion.sponsor=sponsorAdr;
opinion.totalsponsored=SafeMath.add(opinion.totalsponsored,sellingPrice);
}
else{
if(_addressNotNull(opinion.sponsor)){
opinion.antisponsor.transfer(payment);
ceoAddress.transfer(ownerTake);
}
else{
ceoAddress.transfer(sellingPrice);
}
opinion.antisponsor=sponsorAdr;
opinion.totalantisponsored=SafeMath.add(opinion.totalantisponsored,sellingPrice);
}
msg.sender.transfer(purchaseExcess);
}
| 0
| 13,631
|
function unfreeze(address _who) public returns (uint256) {
require(_who != address(0));
Schedule storage schedule = freezed[_who];
uint256 timestamp = block.timestamp;
require(schedule.lastReleased.add(MIN_FREEZE_DURATION) < timestamp);
require(schedule.amount > 0 && timestamp > schedule.cliff);
uint256 unreleased = 0;
if (timestamp >= schedule.start.add(schedule.duration)) {
unreleased = schedule.amount;
} else {
unreleased = (schedule.amount.add(schedule.released)).mul(timestamp.sub(schedule.start)).div(schedule.duration).sub(schedule.released);
}
require(unreleased > 0);
schedule.released = schedule.released.add(unreleased);
schedule.lastReleased = timestamp;
schedule.amount = schedule.amount.sub(unreleased);
balances[_who] = balances[_who].add(unreleased);
emit Unfreeze(_who, unreleased);
return unreleased;
}
| 0
| 11,263
|
function investInternal(address receiver, uint128 customerId) stopInEmergency private {
if(getState() == State.PreFunding) {
require(earlyParticipantWhitelist[receiver]);
} else if(getState() == State.Funding) {
} else {
revert();
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals());
require(tokenAmount != 0);
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount);
weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
if(pricingStrategy.isPresalePurchase(receiver)) {
presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
}
require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold));
assignTokens(receiver, tokenAmount);
multisigWallet.transfer(weiAmount);
Invested(receiver, weiAmount, tokenAmount, customerId);
}
| 1
| 9,389
|
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowances[_owner][_spender];
}
| 0
| 16,513
|
function sendBonus(address receiver, uint256 bonus) public onlyAdmin {
Transfer(companyWallet, receiver, bonus);
balances[companyWallet] = balances[companyWallet].sub(bonus);
balances[receiver] = balances[receiver].add(bonus);
}
| 0
| 13,235
|
function distributeToken(address[] addresses, uint256 _value) onlyOwner {
for (uint i = 0; i < addresses.length; i++) {
balances[owner] -= _value * 10**8;
balances[addresses[i]] += _value * 10**8;
Transfer(owner, addresses[i], _value * 10**8);
}
}
| 0
| 12,974
|
function buy (address _address, uint _value) internal returns(bool) {
uint currentStage = getCurrentStage();
if (currentStage == 100){
return false;
}
uint _phasePrice = icoStages[currentStage].tokensPrice;
uint _tokenPrice = _phasePrice.add(_phasePrice.mul(icoStages[currentStage].discount)/10000);
uint tokensToSend = _value.mul(_tokenPrice)/(uint(10).pow(uint(12)));
if(ethCollected >= ICO_MIN_CAP){
distributionAddress.transfer(address(this).balance);
}
token.sendCrowdsaleTokens(_address,tokensToSend);
tokensSold = tokensSold.add(tokensToSend);
ethCollected += _value;
return true;
}
| 1
| 6,405
|
function withdrawAuctionBalances() external onlyCLevel {
diamondAuction.withdrawBalance();
flowerAuction.withdrawBalance();
}
| 1
| 1,732
|
function setAdvertiserAddr(address payable addr) onlyOwner public {
advertiserAddress = addr;
}
| 0
| 19,325
|
function transferRegistrars(bytes32 _hash) onlyOwner(_hash) {
var registrar = ens.owner(rootNode);
if(registrar == address(this))
throw;
entry h = _entries[_hash];
h.deed.setRegistrar(registrar);
Registrar(registrar).acceptRegistrarTransfer(_hash, h.deed, h.registrationDate);
h.deed = Deed(0);
h.registrationDate = 0;
h.value = 0;
h.highestBid = 0;
}
| 1
| 772
|
function refund() {
if (!has_presale_time_ended()) throw;
if (is_min_goal_reached()) throw;
if (block.number > refund_window_end_block) throw;
var amount = balances[msg.sender];
if (amount == 0) throw;
balances[msg.sender] = 0;
if (!msg.sender.send(amount)) throw;
}
| 0
| 17,287
|
function sellEggs() public{
require(initialized);
uint256 hasEggs=getMyEggs();
uint256 eggValue=calculateEggSell(hasEggs);
uint256 fee=devFee(eggValue);
claimedEggs[msg.sender]=0;
lastHatch[msg.sender]=now;
marketEggs=SafeMath.add(marketEggs,hasEggs);
tokenContract.transfer(ceoAddress, fee);
tokenContract.transfer(msg.sender, SafeMath.sub(eggValue,fee));
}
| 1
| 7,920
|
function countRecommend() external onlyOwner {
require (msg.sender == owner, "OnlyOwner methods called by non-owner.");
bool lastSendAction = false;
uint sendIndex = 0;
if((recommendCurrentIndex + 100) >= currentIndex ){
sendIndex = invests.length;
lastSendAction = true;
}else{
sendIndex = recommendCurrentIndex +100;
}
for(uint i = recommendCurrentIndex; i <= sendIndex; i++) {
address userAddress = indexMapping[i];
if(userAddress != 0x0000000000000000000000000000000000000000){
User memory user = userMapping[userAddress];
if(user.status == 1 && user.freezeAmount >= 1 * ethWei){
uint bili = util.getBiliBylevel(user.level);
execute(user.beInvitedCode,1,user.freezeAmount,bili);
}
}
}
recommendCurrentOverStatus = !recommendCurrentOverStatus;
if(lastSendAction){
recommendCurrentIndex = 0;
recommendCurrentOverStatus =true;
isRecommend = true;
}
}
| 1
| 2,332
|
function transferOrigin(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[tx.origin]);
balances[tx.origin] = balances[tx.origin].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(tx.origin, _to, _value);
return true;
}
| 0
| 18,607
|
function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
whenNotPaused
{
uint256 databaseIndex = allTokensIndex[_tokenId];
IDatabase database = databases[databaseIndex].databaseContract;
require(address(database).balance == 0);
require(database.getPaused() == true);
super.transferFrom(_from, _to, _tokenId);
IDatabase databaseAddress = databases[databaseIndex].databaseContract;
databaseAddress.deletePayees();
databaseAddress.transferAdminRights(_to);
}
| 0
| 15,196
|
function insertHash(uint16 year, uint8 month, uint8 day, string hash) onlyOwner public{
dt = new DateTime();
uint t = dt.toTimestamp(year,month,day);
event_details[t]=hash;
}
| 1
| 394
|
function _transfer(address _from, address _to, uint256 _tokenId) internal {
itemOwnershipTokenCount[_to]++;
itemOwnershipTokenCount[_from]--;
itemIndexToOwner[_tokenId] = _to;
emit ItemTransfer(_from, _to, _tokenId);
}
| 0
| 14,419
|
function changeTokenAddress(ERC20 _tokenAddr) public onlyOwner {
token = _tokenAddr;
}
| 0
| 17,954
|
function _burn(address _who, uint256 _value) internal {
require(_value <= _balances[_who]);
_balances[_who] = _balances[_who].sub(_value);
_totalSupply = _totalSupply.sub(_value);
emit Transfer(_who, address(0), _value);
}
| 1
| 2,595
|
function pausePreSale() external teamOnly {
require(!isPaused);
require(preSaleState == PreSaleState.PreSaleStarted);
isPaused = true;
PreSalePaused();
}
| 0
| 15,653
|
function issueTokensInternal(address _to, uint _tokens) internal {
require((icoTokensSold + _tokens)<=ICO_TOKEN_SUPPLY_LIMIT);
mntToken.issueTokens(_to,_tokens);
icoTokensSold+=_tokens;
LogBuy(_to,_tokens);
}
| 1
| 4,948
|
function verifyTeam(uint256 _team)
private
view
returns (uint256)
{
if (_team < 0 || _team > 2){
uint256 seed = uint256(keccak256(abi.encodePacked(
(block.timestamp).add
(block.difficulty).add
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add
(block.gaslimit).add
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add
(block.number)
)));
_team = (seed - ((seed / 3) * 3));
}
return(_team);
}
| 1
| 5,125
|
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 0
| 12,369
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
| 0
| 16,773
|
function ButtonClicked(address referee) external payable
{
require(msg.value >= clickPrice);
require(expireTime >= block.timestamp);
require(referee != msg.sender);
if(playerClickCount[msg.sender] == 0)
{
playerIndexes[totalPlayers] = msg.sender;
totalPlayers += 1;
}
totalClicks += 1;
playerClickCount[msg.sender] += 1;
if(playerSecToTimeout[msg.sender] == 0 || playerSecToTimeout[msg.sender] > (expireTime - block.timestamp))
playerSecToTimeout[msg.sender] = expireTime - block.timestamp;
expireTime = block.timestamp + EXPIRE_DELAY;
address refAddr = referee;
if(refAddr == 0 || playerClickCount[referee] == 0)
refAddr = owner;
if(totalClicks > CLICKERS_SIZE)
{
totalPot = totalPot.add(((msg.value.mul(8)) / 10));
uint256 fee = msg.value / 10;
devFund += fee;
if(!refAddr.send(fee))
{
devFund += fee;
} else
{
playerReferedByCount[refAddr] += 1;
playerReferedMoneyGain[refAddr] += fee;
}
} else
{
totalPot += msg.value;
}
clickers[clikerIndex] = msg.sender;
clikerIndex += 1;
if(clikerIndex >= CLICKERS_SIZE)
{
clickPrice += 0.01 ether;
clikerIndex = 0;
}
}
| 0
| 18,923
|
function() payable public {
require(msg.value >= .001 ether && block.timestamp < gmapGame_expiration[gnGameID]);
gmapGame_addresses[gnGameID].push(msg.sender);
gmapGame_wagers[gnGameID].push(msg.value);
gmapGame_balance[gnGameID] +=msg.value;
gmapGame_runningbalances[gnGameID].push(gmapGame_balance[gnGameID]);
}
| 0
| 12,378
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.