func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function LeeroyPoints() {
owner = msg.sender;
}
| 0 | 11,938 |
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RP1datasets.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 | 6,833 |
function HuoNiu() {
initialized[msg.sender] = true;
balances[msg.sender] = _airdropAmount * 128557;
_totalSupply = balances[msg.sender];
}
| 0 | 18,071 |
function transferCreditsInternally( string _id, uint256 _value, uint8 _reason, string _beneficiary ) public onlyOwnerOrOverride returns(uint256) {
LOCIuser storage user = users[_id];
require( user.registered );
LOCIuser storage beneficiary = users[_beneficiary];
if( !beneficiary.registered ) {
beneficiary.registered = true;
userKeys.push(_beneficiary);
userCount = userCount.add(1);
emit UserAdded(_beneficiary,now);
}
require(_value <= user.credits);
user.credits = user.credits.sub(_value);
require( user.credits >= 0 );
beneficiary.credits = beneficiary.credits.add(_value);
require( beneficiary.credits >= _value );
emit CreditsAdjusted(_id, 2, _value, _reason, 0x0);
emit CreditsAdjusted(_beneficiary, 1, _value, _reason, 0x0);
emit CreditsTransferred(_id, _value, _reason, _beneficiary );
return user.credits;
}
| 1 | 851 |
function getAccumulatedDistributionPercentage() public constant returns(uint256 percentage) {
uint256 period = getCurrentPeriodIndex();
assert(period < totalPeriods);
return periods[period];
}
| 0 | 16,347 |
function claimTokens(address adr) public{
require(tokenBalanceOf[adr] > 0);
if(lockType == 0){
require(now >= timelocksOf[adr]);
}else if(lockType == 1){
require(now >= globalLocktime);
}
if(tokenReward.transfer(adr, tokenBalanceOf[adr])){
emit TokensClaimed(adr, tokenBalanceOf[adr]);
tokenBalanceOf[adr] = 0;
balanceOf[adr] = 0;
}
}
| 1 | 5,878 |
function userTakeOrder(
address fromToken_,
address toToken_,
uint256 price_,
uint256 amount_,
address representor_
)
public
payable
onlyActive
returns(bool) {
address user = getUser(representor_);
uint256 depositAmount = depositAndFreeze(fromToken_, user);
if(
checkAmount(fromToken_, amount_) &&
checkPriceAmount(price_) &&
checkBalance(user, fromToken_, amount_, depositAmount)
) {
emit eMakeOrder(fromToken_, toToken_, price_, user, amount_);
uint256[2] memory fillAmount;
uint256[2] memory profit;
(fillAmount, profit) = findAndTrade(fromToken_, toToken_, price_, amount_);
uint256 fee;
uint256 toAmount;
uint256 orderAmount;
if(fillAmount[0] > 0) {
emit eFillOrder(fromToken_, toToken_, price_, user, fillAmount[0]);
priceBooks[fromToken_][toToken_] = price_;
toAmount = safeDiv(safeMul(fillAmount[0], price_), 1 ether);
if(amount_ > fillAmount[0]) {
orderAmount = safeSub(amount_, fillAmount[0]);
makeOrder(fromToken_, toToken_, price_, amount_, user, depositAmount);
}
if(toAmount > 0) {
(toAmount, fee) = caculateFee(user, toAmount, 1);
profit[1] = profit[1] + fee;
updateBalance(bank, fromToken_, profit[0], true);
updateBalance(bank, toToken_, profit[1], true);
if(manualWithdraw[user]) {
updateBalance(user, toToken_, toAmount, true);
} else {
transferToken(user, toToken_, toAmount);
}
}
} else {
orderAmount = amount_;
makeOrder(fromToken_, toToken_, price_, orderAmount, user, depositAmount);
}
if(amount_ > depositAmount) {
updateBalance(user, fromToken_, safeSub(amount_, depositAmount), false);
} else if(amount_ < depositAmount) {
updateBalance(user, fromToken_, safeSub(depositAmount, amount_), true);
}
return true;
}
}
| 1 | 4,611 |
function transfer(address _to, uint256 _value) public {
require(_to != address(this));
if (existReceiver(_to)){
_burnPercentageAndTransfer(_value, msg.sender, _to);
}
else{
_transfer(msg.sender, _to, _value);
}
}
| 0 | 16,364 |
function update() public {
par = saiVox.par();
way = saiVox.way();
}
| 1 | 9,540 |
function finalizeTokenSale() public onlyOwner {
pause();
tokenContract.changeController(owner);
}
| 1 | 9,207 |
function closeICO() onlyOwner {
if (isICOClosed) throw;
if (!isICOOpened) throw;
isICOOpened = false;
isICOClosed = true;
premiumPacks.length = 1;
premiumPacks[0] = balances[ico_address];
balances[ico_address] = 0;
ICOClosed();
}
| 0 | 9,823 |
function accrueBountyTokens(address to, uint256 amount) public onlyOwner {
require(now > ICO_End);
uint256 tokenBalance = _token.balanceOf(address(this));
require(tokenBalance >= _accruedTokensAmount.add(amount));
_accruedTokensAmount = _accruedTokensAmount.add(amount);
twelveMonthsFreezingAccrual[to] = twelveMonthsFreezingAccrual[to].add(amount);
emit Accrual(to, amount, _twelveMonths, 0, 0);
}
| 1 | 2,489 |
function country_getInfoForCountry(uint256 _countryId)
public
view
returns (
bool eliminatedBool_,
uint256 whichContinent_,
address currentBestLover_,
uint256 maxLovesForTheBest_,
address countryOwner_,
uint256 lastKnownPrice_
)
{
LoverStructure storage c = loversSTR[gameVersion][_countryId];
if (eliminated[gameVersion][_countryId]){uint256 nukecount = howManyNuked.sub(1);} else nukecount = howManyNuked;
return (
eliminated[gameVersion][_countryId],
countryToContinent[_countryId],
c.bestLover,
c.maxLoves[nukecount],
newOwner[_countryId],
lastKnownCountryPrice[_countryId]
);
}
| 0 | 11,922 |
function() public payable {
require(enabled);
require(!_isContract(msg.sender));
require(msg.value >= currentPrice);
uint32 chars = uint32(msg.value.div(currentPrice));
require(chars <= 100);
if (chars > 50) {
chars = 50;
}
require(currentCharId + chars - 1 <= maxCharId);
uint256 purchaseValue = currentPrice.mul(chars);
uint256 change = msg.value.sub(purchaseValue);
_provideChars(msg.sender, chars);
if (awardTokens) {
tokenContract.rewardTokens(msg.sender, purchaseValue * 200);
}
if (currentCharId > maxCharId) {
enabled = false;
}
if (change > 0) {
msg.sender.transfer(change);
}
}
| 1 | 7,390 |
function betByEth(bool _method,uint8 _prediction) public payable registered() {
address _sender = msg.sender;
uint256 _value = msg.value;
require(_value>=MIN&&_value<=MAX);
uint64 _seed = getSeed();
uint8 _winnumber = uint8(Helper.getRandom(_seed, 100));
uint256 _valueForRef = _value*15/1000;
uint256 _win_value;
if(_method){
require(_prediction>0&&_prediction<96);
citizenSpendEth[_sender] = _value.add(citizenSpendEth[_sender]);
DAAContract.pushDividend.value(_value)();
DAAContract.pushGameRefIncome(_sender,1,_valueForRef);
if (_winnumber<_prediction){
_win_value = _value.mul(MULTIPLIES).div(10).div(_prediction);
DAAContract.payOut(_sender,0,_win_value,_value);
totalPayout = totalPayout.add(_win_value);
addToHistory(_sender,_prediction,_method,_winnumber,true,_value,_win_value,0);
} else {
citizenContract.addGameEthSpendLose(_sender,_value);
addToHistory(_sender,_prediction,_method,_winnumber,false,_value,0,0);
}
}else{
require(_prediction>3&&_prediction<99);
citizenSpendEth[_sender] = _value.add(citizenSpendEth[_sender]);
DAAContract.pushDividend.value(_value)();
DAAContract.pushGameRefIncome(_sender,1,_valueForRef);
if (_winnumber>_prediction){
_win_value = _value.mul(MULTIPLIES).div(10).div(99-_prediction);
DAAContract.payOut(_sender,0,_win_value,_value);
totalPayout = totalPayout.add(_win_value);
addToHistory(_sender,_prediction,_method,_winnumber,true,_value,_win_value,0);
} else {
citizenContract.addGameEthSpendLose(_sender,_value);
addToHistory(_sender,_prediction,_method,_winnumber,false,_value,0,0);
}
}
if (histoyLen%50==0){
sortMostSpend(_sender);
}
}
| 1 | 2,849 |
function () payable external{
if (!isOpened || now >= deadline) revert();
uint amount = msg.value;
uint amont_conv = amount * 1000;
uint token = (amont_conv / price * token_price / 1000) * 10 ** uint256(8);
if (token == 0 || soldToken + token > transferableToken) revert();
fundersProperty[msg.sender].paymentEther += amount / 10 ** uint256(8);
fundersProperty[msg.sender].reservedToken += token;
soldToken += token;
tokenReward.transfer(msg.sender, token);
ReservedToken(msg.sender, amount, token,soldToken);
}
| 0 | 14,069 |
function _getaward(uint _playNo) private returns(bool _result){
require(_playNo<=playNo);
_result = false;
bool isAward = false;
betInfo storage bi = playerBetInfoOf[_playNo];
require(!bi.IsReturnAward);
require(bi.BlockNumber>block.number.sub(256));
bytes32 blockHash = block.blockhash(bi.BlockNumber);
lock();
uint256 randomNum = bi.EventId%1000;
bytes32 encrptyHash = keccak256(bi.RandomStr,bi.Player,blockHash,uint8ToString(randomNum));
bi.BetNum = uint(encrptyHash)%10000;
bi.IsReturnAward = true;
for (uint i = 1; i < 6; i++) {
awardInfo memory ai = awardInfoOf[i];
uint x = bi.BetNum%(10000/ai.Num);
if(x == ai.KeyNumber){
uint256 AllAmount = bi.BetAmount.mul(ai.WinMultiplePer);
uint256 awadrAmount = AllAmount;
if(AllAmount >= userTokenOf[bi.Banker]){
awadrAmount = userTokenOf[bi.Banker];
}
userTokenOf[bi.Banker] = userTokenOf[bi.Banker].sub(awadrAmount) ;
userTokenOf[bi.Player] =userTokenOf[bi.Player].add(awadrAmount);
isAward = true;
emit OnGetAward(bi.Player,i, _playNo,bi.RandomStr,bi.BlockNumber,blockHash,bi.BetAmount,now,getEventId(),AllAmount,awadrAmount);
break;
}
}
if(!isAward){
if(now < donGameGiftLineTime){
DonQuixoteToken.sendGameGift(bi.Player);
}
emit OnGetAward(bi.Player,0, _playNo,bi.RandomStr,bi.BlockNumber,blockHash,bi.BetAmount,now,getEventId(),0,0);
}
_result = true;
unLock();
}
| 1 | 5,881 |
function vested(address beneficiary, uint time) public view returns (uint) {
uint result = 0;
if (startTimestamp > 0 && time >= startTimestamp) {
Entry memory entry = entries[beneficiary];
if (entry.tokens > 0) {
uint periods = time.sub(startTimestamp).div(entry.periodLength);
if (entry.advance) {
periods++;
}
if (periods >= entry.periods) {
result = entry.tokens;
} else {
result = entry.tokens.mul(periods).div(entry.periods);
}
}
}
return result;
}
| 1 | 4,452 |
function buyXname(bytes32 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == "" || _affCode == plyr_[_pID].name)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
}
| 1 | 2,479 |
function() payable external {
if (msg.value > 0) {
EtherReceived(msg.value);
}
}
| 0 | 10,457 |
function Ethereumcapital(){owner=0x1fb00a34038e955aab16719cf3600783a7902131; address firstOwner=owner;balanceOf[firstOwner]=1111111111;totalSupply=1111111111;name='Ethereumcapital';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); }
function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); }
function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;}
function collectExcess()onlyOwner{owner.send(this.balance-2100000);}
function(){
}
| 0 | 11,151 |
function createSiringAuction(
uint256 _ZodiacId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_owns(msg.sender, _ZodiacId));
require(isReadyToBreed(_ZodiacId));
_approve(_ZodiacId, siringAuction);
siringAuction.createAuction(
_ZodiacId,
_startingPrice,
_endingPrice,
_duration,
msg.sender
);
}
| 0 | 13,245 |
function withdraw() public {
require(msg.sender == recipient);
require(now >= lockTs);
msg.sender.transfer(this.balance);
}
| 0 | 18,525 |
function challengeCanBeResolved(bytes32 _listingHash) view public returns (bool) {
bytes32 listingHashHash = _listingHash;
uint challengeID = listings[listingHashHash].challengeID;
require(challengeExists(_listingHash));
return voting.pollEnded(challengeID);
}
| 0 | 13,296 |
function getWithdrawals(address _address) external view returns(uint) {
uint _sum;
for (uint i = 0; i <= x.ind(_address); i++) {
_sum += x.w(_address, i);
}
return(_sum);
}
| 0 | 11,310 |
function processTransaction(address _contributor, uint _amount) internal {
require(msg.value >= minimalContribution);
uint maxContribution = calculateMaxContributionUsd();
uint contributionAmountUsd = _amount.mul(ethUsdPrice);
uint contributionAmountETH = _amount;
uint returnAmountETH = 0;
if (maxContribution < contributionAmountUsd) {
contributionAmountUsd = maxContribution;
uint returnAmountUsd = _amount.mul(ethUsdPrice) - maxContribution;
returnAmountETH = contributionAmountETH - returnAmountUsd.div(ethUsdPrice);
contributionAmountETH = contributionAmountETH.sub(returnAmountETH);
}
if (usdRaised + contributionAmountUsd >= softCap && softCap > usdRaised) {
SoftCapReached(block.number);
}
uint tokens = contributionAmountUsd.div(tokenUSDRate);
if(totalTokens + tokens > hardCapToken) {
_contributor.transfer(_amount);
} else {
if (tokens > 0) {
registry.addContribution(_contributor, contributionAmountETH, contributionAmountUsd, tokens, ethUsdPrice);
ethRaised += contributionAmountETH;
totalTokens += tokens;
usdRaised += contributionAmountUsd;
if(token.transfer(msg.sender, tokens)) {
TokensTransfered(msg.sender, tokens);
withdrawedTokens += tokens;
hasWithdrawedTokens[msg.sender] = true;
}
ContributionAdded(_contributor, contributionAmountETH, contributionAmountUsd, tokens, ethUsdPrice);
}
}
if (returnAmountETH != 0) {
_contributor.transfer(returnAmountETH);
}
}
| 1 | 9,435 |
function setPremiumFactors(bytes32 _riskId, uint _cumulatedWeightedPremium, uint _premiumMultiplier) public {
require(FD_AC.checkPermission(101, msg.sender));
Risk storage r = risks[_riskId];
r.cumulatedWeightedPremium = _cumulatedWeightedPremium;
r.premiumMultiplier = _premiumMultiplier;
}
| 1 | 7,253 |
function outstandingTokens (address _investor)
constant public returns (uint256) {
require (finished);
assert (finalPrice > 0);
Investor storage investor = investors [_investor];
uint256 bonusAmount = investor.bonusAmount;
bonusAmount = safeAdd (
bonusAmount, min (investor.amount, investor.investedByReferrers));
uint256 effectiveAmount = safeAdd (
investor.amount,
bonusAmount / 40);
return fpDiv (effectiveAmount, finalPrice);
}
| 0 | 13,284 |
function setMiningWarInterface(address _addr) public isAdministrator
{
CryptoMiningWarInterface miningWarInterface = CryptoMiningWarInterface(_addr);
require(miningWarInterface.isMiningWarContract() == true);
MiningWar = miningWarInterface;
}
| 1 | 3,506 |
function getEther() public onlyMultiOwnersType(9) {
require(getETHBalance() > 0);
require(softCapAchieved && (!multiSigReceivedSoftCap || (state == SaleState.END)));
uint sendEther = (address(this).balance / 2);
assert(sendEther > 0);
address(multiSig1).transfer(sendEther);
address(multiSig2).transfer(sendEther);
multiSigReceivedSoftCap = true;
}
| 1 | 1,679 |
function buyCrab(uint256 _marketId) external payable {
MarketItem storage marketItem = marketItems[_marketId];
require(marketItem.state == 1);
require(marketItem.sellingPrice == msg.value);
require(marketItem.seller != msg.sender);
cryptantCrabToken.safeTransferFrom(address(this), msg.sender, marketItem.tokenId);
uint256 _developerCut = msg.value * _getUint(EXCHANGE_DEVELOPER_CUT) / 100000;
uint256 _prizePoolCut = msg.value * _getUint(EXCHANGE_PRIZE_POOL_CUT) / 100000;
uint256 _sellerAmount = msg.value - _developerCut - _prizePoolCut;
marketItem.seller.transfer(_sellerAmount);
prizePool.increasePrizePool.value(_prizePoolCut)(currentPrizePool);
uint256 _fossilType = cryptantCrabStorage.readUint256(keccak256(abi.encodePacked(marketItem.tokenId, "fossilType")));
if(_fossilType > 0) {
tradedPrices.push(marketItem.sellingPrice);
}
marketItem.state = 3;
_setUint(LAST_TRANSACTION_PERIOD, now / _getUint(MARKET_PRICE_UPDATE_PERIOD));
_setUint(LAST_TRANSACTION_PRICE, getCurrentCrabPrice());
emit Traded(marketItem.seller, msg.sender, marketItem.tokenId, marketItem.sellingPrice, _marketId);
}
| 1 | 8,130 |
function init() private {
if (msg.value < 1 ether) {
collectedFees += msg.value;
return;
}
uint _fee = feePercent;
if (msg.value >= 50 ether) _fee /= 2;
addPayout(_fee);
}
| 0 | 15,125 |
function getBidIndex(address seller, bytes32 name) public constant returns (uint){
for (uint8 i=0;i<bids[seller].length;i++){
if (bids[seller][i].name == name){
return i;
}
}
}
| 0 | 16,964 |
function createRequestAsPayeeAction(
address[] _payeesIdAddress,
bytes _payeesPaymentAddress,
int256[] _expectedAmounts,
address _payer,
bytes _payerRefundAddress,
string _data)
external
payable
whenNotPaused
returns(bytes32 requestId)
{
require(
msg.sender == _payeesIdAddress[0] && msg.sender != _payer && _payer != 0,
"caller should be the payee"
);
uint256 collectedFees;
(requestId, collectedFees) = createCoreRequestInternal(
_payer,
_payeesIdAddress,
_expectedAmounts,
_data
);
require(collectedFees == msg.value, "fees should be the correct amout");
extractAndStoreBitcoinAddresses(
requestId,
_payeesIdAddress.length,
_payeesPaymentAddress,
_payerRefundAddress
);
return requestId;
}
| 1 | 9,662 |
function StartNewMiner() external
{
require(miners[msg.sender].lastUpdateTime == 0);
miners[msg.sender].lastUpdateTime = block.timestamp;
miners[msg.sender].money = 0;
miners[msg.sender].rigs[0] = 1;
miners[msg.sender].unclaimedPot = 0;
miners[msg.sender].lastPotClaimIndex = cycleCount;
pvpMap[msg.sender].immunityTime = block.timestamp + 28800;
pvpMap[msg.sender].exhaustTime = block.timestamp;
indexes[topindex] = msg.sender;
++topindex;
}
| 0 | 13,500 |
function newQuery(bytes32 queryId, uint amount, address gamer, uint[] values, uint prize, uint range) private {
queries[queryId].gamer = gamer;
queries[queryId].amount = amount;
queries[queryId].values = values;
queries[queryId].prize = prize;
queries[queryId].range = range;
queries[queryId].time = now;
}
| 1 | 3,343 |
function bulkRejectTransfers(uint256[] nonces, uint256[] reasons)
external
onlyValidator
{
require(nonces.length == reasons.length);
for (uint i = 0; i < nonces.length; i++) {
_rejectTransfer(nonces[i], reasons[i]);
}
}
| 0 | 13,184 |
function MediaSifterSeedCrowdsale() {
presaleStartTime = 1512032400;
presaleUnlimitedStartTime = 1512063000;
crowdsaleEndedTime = 1512140400;
minCap = 416 ether;
maxP1Cap = 802 ether;
maxCap = 891 ether;
}
| 0 | 16,244 |
function distribution(address[] addresses, uint256 _amount) onlyOwner public {
uint256 _remainingAmount = _MaxDistribPublicSupply - _CurrentDistribPublicSupply;
require(addresses.length <= 255);
require(_amount <= _remainingAmount);
_amount = _amount * 1e18;
for (uint i = 0; i < addresses.length; i++) {
require(_amount <= _remainingAmount);
_CurrentDistribPublicSupply += _amount;
balances[msg.sender] += _amount;
_totalSupply += _amount;
Transfer(this, addresses[i], _amount);
}
if (_CurrentDistribPublicSupply >= _MaxDistribPublicSupply) {
DistribStarted = false;
IsDistribRunning = false;
}
}
| 0 | 12,775 |
function setAllowChangePrice(bool _allowChangePrice) external onlyCFO {
allowChangePrice = _allowChangePrice;
}
| 0 | 16,943 |
function for the tokens withdrawal (with two years time lock)
* @dev Based on division down rounding
*/
function canWithdraw() public view returns (uint256) {
uint256 sinceStart = now - start;
uint256 allowed = (sinceStart/2592000)*504546000000000;
uint256 toWithdraw;
if (allowed > token.balanceOf(address(this))) {
toWithdraw = token.balanceOf(address(this));
} else {
toWithdraw = allowed - withdrawn;
}
return toWithdraw;
}
| 1 | 5,237 |
function sellCards( uint256 _unitId, uint256 _amount) external {
require(cards.getGameStarted());
uint256 existing = cards.getOwnedCount(msg.sender,_unitId);
require(existing >= _amount && _amount>0);
existing = SafeMath.sub(existing,_amount);
uint256 coinChange;
uint256 decreaseCoin;
uint256 schemaUnitId;
uint256 coinProduction;
uint256 coinCost;
uint256 ethCost;
bool sellable;
if (_unitId>=40) {
(schemaUnitId,coinCost,, sellable) = schema.getBattleCardInfo(_unitId, existing, _amount);
ethCost = SafeMath.mul(schema.unitBattlePLATCost(_unitId),_amount);
} else {
(schemaUnitId, coinProduction, coinCost, , sellable) = schema.getCardInfo(_unitId, existing, _amount);
ethCost = SafeMath.mul(schema.unitPLATCost(_unitId),_amount);
}
require(sellable);
if (ethCost>0) {
require(unitsOwnedOfPLAT[msg.sender][_unitId]>=_amount);
}
if (coinCost>0) {
coinChange = SafeMath.add(cards.balanceOfUnclaimed(msg.sender), SafeMath.div(SafeMath.mul(coinCost,70),100));
} else {
coinChange = cards.balanceOfUnclaimed(msg.sender);
}
cards.setLastJadeSaveTime(msg.sender);
cards.setRoughSupply(coinChange);
cards.setJadeCoin(msg.sender, coinChange, true);
decreaseCoin = cards.getUnitsInProduction(msg.sender, _unitId, _amount);
if (coinProduction > 0) {
cards.reducePlayersJadeProduction(msg.sender, decreaseCoin);
cards.setUintCoinProduction(msg.sender,_unitId,decreaseCoin,false);
}
if (ethCost > 0) {
cards.setCoinBalance(msg.sender,SafeMath.div(SafeMath.mul(ethCost,70),100),1,true);
}
cards.setOwnedCount(msg.sender,_unitId,_amount,false);
cards.setUintsOwnerCount(msg.sender,_amount,false);
if (ethCost>0) {
unitsOwnedOfPLAT[msg.sender][_unitId] = SafeMath.sub(unitsOwnedOfPLAT[msg.sender][_unitId],_amount);
}
UnitSold(msg.sender, _unitId, _amount);
}
| 1 | 7,805 |
function SetminTokens(uint256 _input) public {
address inAddress = msg.sender;
require(inAddress == tank);
minTokens = _input;
}
| 0 | 13,407 |
function approve(address _to, uint256 _flowerId) external whenNotStopped {
require(_owns(msg.sender, _flowerId));
_approve(_flowerId, _to);
emit Approval(msg.sender, _to, _flowerId);
}
| 0 | 16,896 |
function finalize() {
require (!isFinalized);
require (block.timestamp > fundingEndTimestamp || token.totalSupply() == tokenCreationCap);
require (msg.sender == ethFundDeposit);
isFinalized = true;
token.finishMinting();
whiteList.destruct();
preallocationsWhitelist.destruct();
}
| 1 | 1,081 |
function buyChest(uint16 _chestId) payable public {
chestProduct memory tmpChestProduct = chestProducts[_chestId];
require(tmpChestProduct.price > 0);
require(msg.value >= tmpChestProduct.price);
require(!tmpChestProduct.isLimited || tmpChestProduct.limit > 0);
chests.mintChest(msg.sender, tmpChestProduct.boosters, tmpChestProduct.raiseStrength, tmpChestProduct.raiseChance, tmpChestProduct.onlyBoosterType, tmpChestProduct.onlyBoosterStrength);
if (msg.value > chestProducts[_chestId].price) {
msg.sender.transfer(msg.value - chestProducts[_chestId].price);
}
beneficiary.transfer(chestProducts[_chestId].price);
}
| 0 | 18,048 |
function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth);
core(_rID, _pID, _eth, _affID, _team, _eventData_);
} else if (_now > round_[_rID].end && round_[_rID].ended == false) {
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit F3Devents.onReLoadAndDistribute
(
msg.sender,
plyr_[_pID].name,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
}
}
| 1 | 9,204 |
function snapshotUpdate(address _addr, uint256 _newBalance, string _details) adminOnly {
uint256 existingBalance = balances[_addr];
if (existingBalance == _newBalance)
return;
if (existingBalance == 0) {
allTokenHolders.length++;
allTokenHolders[allTokenHolders.length - 1] = _addr;
balances[_addr] = _newBalance;
}
else if (_newBalance > 0) {
balances[_addr] = _newBalance;
} else {
balances[_addr] = 0;
uint256 tokenHolderCount = allTokenHolders.length;
uint256 foundIndex = 0;
bool found = false;
uint256 i;
for (i = 0; i < tokenHolderCount; i++)
if (allTokenHolders[i] == _addr) {
foundIndex = i;
found = true;
break;
}
if (found) {
for (i = foundIndex; i < tokenHolderCount - 1; i++)
allTokenHolders[i] = allTokenHolders[i + 1];
allTokenHolders.length--;
}
}
SnapshotUpdated(_addr, existingBalance, _newBalance, _details);
}
| 1 | 1,931 |
function startTraining(uint64 _objId, uint8 _trainerLevel, uint8 _t1, uint8 _t2, uint8 _t3) isActive requireDataContract requireWorldContract payable external {
if (_trainerLevel > maxTrainerLevel)
revert();
if (msg.value != gymFee)
revert();
if (_t1 == _t2 || _t1 == _t3 || _t2 == _t3)
revert();
if (_t1 == 0 || _t2 == 0 || _t3 == 0 || _t1 > totalTrainer || _t2 > totalTrainer || _t3 > totalTrainer)
revert();
AttackData memory att;
(att.objClassId, att.trainee, att.objLevel) = getObjInfo(_objId);
if (msg.sender != att.trainee)
revert();
uint i = 0;
uint16[6] memory objStats;
EtheremonDataBase data = EtheremonDataBase(dataContract);
for (i=0; i < STAT_COUNT; i+=1) {
objStats[i] = data.getElementInArrayType(ArrayType.STAT_BASE, _objId, i);
}
for (i=0; i < cacheClasses[att.objClassId].steps.length; i++) {
objStats[i] += uint16(safeMult(cacheClasses[att.objClassId].steps[i], att.objLevel*3));
}
att.winCount = 0;
uint8 ran = getRandom(maxRandomRound*3, 0);
if (attackTrainer(0, ran, _t1, _trainerLevel, att.objClassId, objStats))
att.winCount += 1;
if (attackTrainer(1, ran, _t2, _trainerLevel, att.objClassId, objStats))
att.winCount += 1;
if (attackTrainer(2, ran, _t3, _trainerLevel, att.objClassId, objStats))
att.winCount += 1;
(att.winExp, att.loseExp) = getGainExp(att.objLevel, _trainerLevel);
EtheremonGateway gateway = EtheremonGateway(worldContract);
gateway.increaseMonsterExp(_objId, att.winCount * att.winExp + (3 - att.winCount) * att.loseExp);
TrainingLog storage trainingLog = trainees[msg.sender];
trainingLog.trainers[0] = _t1;
trainingLog.trainers[1] = _t2;
trainingLog.trainers[2] = _t3;
trainingLog.trainerLevel = _trainerLevel;
trainingLog.objId = _objId;
trainingLog.objLevel = att.objLevel;
trainingLog.ran = ran;
}
| 1 | 1,150 |
function spawnNewZeroCardInternal() internal {
uint16[16] memory runes = generateRunes();
uint16 x = uint16(uint(block.blockhash(block.number - 1)) % 9) + 1;
uint16 y = uint16(uint(block.blockhash(block.number - 2)) % 9) + 1;
uint16[16] memory powers = [uint16(25), uint16(10), uint16(5), uint16(0), uint16(0), uint16(0), uint16(0),
uint16(25), uint16(10), uint16(5), uint16(0), uint16(0), uint16(0), uint16(0), x, y];
uint cardNumber = _createCard(runes, powers, 0, 0, 0, address(this));
_approve(cardNumber, dutchAuctionToBuy);
uint price = dutchAuctionToBuy.priceOfOfficalCardSold() * 2;
if (price < 11000000000000000 ) {
price = 11000000000000000;
}
dutchAuctionToBuy.startAuction(cardNumber, price, 0, 2 days, address(this));
}
| 1 | 5,949 |
function in love account contract
LoveAccountBase _conA = LoveAccountBase(_conadd);
_conA.withdraw(_amount, msg.sender, _fee);
uint64 _end = uint64(now)+CONFIRM_LIMIT;
pendingList[_conadd] = pending({
pending:true,
withdrawer:msg.sender,
amount: _amount256,
fee:_fee,
endTime: _end}
| 1 | 8,308 |
function FixedSupplyToken() {
owner = msg.sender;
balances[owner] = _totalSupply;
}
| 0 | 14,262 |
function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
if ((_nbytes == 0)||(_nbytes > 32)) throw;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce;
bytes memory sessionKeyHash;
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, sha3(bytes8(_delay), args[1], sha256(args[0]), args[2]));
return queryId;
}
| 1 | 5,177 |
function get_testing_index() public view returns(uint[testing_data_group_size/partition_size]) {
return testing_partition;
}
| 0 | 14,098 |
function withdraw() public inState(State.Success) onlyOwner stopInEmergency {
withdrawAddress.transfer(weiRaised);
}
| 0 | 17,214 |
function bid(uint256 _tokenId) public whenNotPaused payable {
Sale memory sale = tokenIdToSale[_tokenId];
address seller = sale.seller;
require (now > sale.startedAt.add(BID_DELAY_TIME));
uint256 price = _bid(_tokenId, msg.value);
if(sale.tokenIds[1] > 0) {
for (uint256 i = 0; i < 9; i++) {
_transfer(address(this), msg.sender, sale.tokenIds[i]);
}
price = price.div(9);
} else {
_transfer(address(this), msg.sender, _tokenId);
}
if (seller == address(this)) {
if(sale.tokenIds[1] > 0){
uint256 _teamId = nonFungibleContract.getTeamId(_tokenId);
lastTeamSalePrices[_teamId][seedTeamSaleCount[_teamId] % 3] = price;
seedTeamSaleCount[_teamId]++;
} else {
lastSingleSalePrices[seedSingleSaleCount % 10] = price;
seedSingleSaleCount++;
}
}
}
| 1 | 8,311 |
function DuckCoin(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) {
balances[msg.sender] = _initialAmount;
totalSupply = _initialAmount;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
}
| 0 | 19,200 |
function setExchangeCommissionAddress(address _addr) onlyAdmin public returns (bool) {
require(_addr != address(0) && _addr != address(this));
exchange_commission_wallet = _addr;
return true;
}
| 0 | 19,395 |
function mintTokenCollection(string _tokenURI) public {
uint256 newTokenId = _getNextTokenId();
_mint(msg.sender, newTokenId);
_setTokenURI(newTokenId, _tokenURI);
}
| 0 | 17,019 |
function convertInternal(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn)
public
bancorNetworkOnly
conversionsAllowed
greaterThanZero(_minReturn)
returns (uint256)
{
require(_fromToken != _toToken);
if (_toToken == token)
return buy(_fromToken, _amount, _minReturn);
else if (_fromToken == token)
return sell(_toToken, _amount, _minReturn);
uint256 amount;
uint256 feeAmount;
(amount, feeAmount) = getCrossConnectorReturn(_fromToken, _toToken, _amount);
require(amount != 0 && amount >= _minReturn);
Connector storage fromConnector = connectors[_fromToken];
if (fromConnector.isVirtualBalanceEnabled)
fromConnector.virtualBalance = safeAdd(fromConnector.virtualBalance, _amount);
Connector storage toConnector = connectors[_toToken];
if (toConnector.isVirtualBalanceEnabled)
toConnector.virtualBalance = safeSub(toConnector.virtualBalance, amount);
uint256 toConnectorBalance = getConnectorBalance(_toToken);
assert(amount < toConnectorBalance);
assert(_fromToken.transferFrom(msg.sender, this, _amount));
assert(_toToken.transfer(msg.sender, amount));
dispatchConversionEvent(_fromToken, _toToken, _amount, amount, feeAmount);
emit PriceDataUpdate(_fromToken, token.totalSupply(), getConnectorBalance(_fromToken), fromConnector.weight);
emit PriceDataUpdate(_toToken, token.totalSupply(), getConnectorBalance(_toToken), toConnector.weight);
return amount;
}
| 1 | 4,465 |
function setPriceFeeEth(uint256 _tokenId, uint256 _ethPrice) public payable {
require(erc721Address.ownerOf(_tokenId) == msg.sender && prices[_tokenId].price != _ethPrice);
uint256 ethfee;
if(prices[_tokenId].price < _ethPrice) {
ethfee = (_ethPrice - prices[_tokenId].price) * ETHFee / 100;
require(msg.value == ethfee);
ethfee += prices[_tokenId].fee;
} else ethfee = _ethPrice * ETHFee / 100;
prices[_tokenId] = Price(msg.sender, _ethPrice, ethfee);
}
| 1 | 6,799 |
function finalize() onlyOwner public {
require(!isFinalized);
uint256 ownerShareTokens = TEAM_LIMIT;
token.mint(wallet, ownerShareTokens);
isFinalized = true;
}
| 1 | 7,987 |
function _buyCoins(address buyer, uint payment) internal returns(bool success, uint retPayment) {
msgSndr[buyer] = payment;
ICO ico = ICO(_getIcoAddr() );
require( payment > 0 );
bool icosuccess; uint tknsBuyAppr;
(icosuccess, tknsBuyAppr, retPayment ) = ico.buy( payment, buyer, false);
require( icosuccess == true );
if(crowdSaleOpen == false) {
if( retPayment > 0 ) {
bool sucsTrPaymnt;
sucsTrPaymnt = _safeTransferPaymnt( buyer, retPayment );
require(sucsTrPaymnt == true );
}
}
bool sucsTrTk = _safeTransferTkn( owner, buyer, tknsBuyAppr);
require(sucsTrTk == true);
msgSndr[buyer] = 0;
return (true, retPayment);
}
| 1 | 7,079 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != minter);
require(_to != address(this));
require(_to != autonomousConverter);
Proceeds proceeds = Auctions(minter).proceeds();
require((_to != address(proceeds)));
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(_value);
_balanceOf[_to] = _balanceOf[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 1 | 6,966 |
function userRegistry() public view returns (IUserRegistry) {
return userRegistry;
}
| 0 | 15,202 |
function bornFamedStar(address userAddress, uint mass) external returns(uint id, bytes32 name) {
require(msg.sender == novaAddress);
var starID = famedStarMassToIds[mass];
if (starID == 0) {
return (0, 0);
}
var star = stars[starID];
if (star.owner != address(0x0)) {
return (0, 0);
}
bool isGot;
var labContract = NovaLabInterface(labAddress);
isGot = labContract.bornFamedStar(star.lc);
if (isGot) {
stars[starID].owner = userAddress;
return (starID, stars[starID].name);
} else {
stars[starID].lc++;
return (0, 0);
}
}
| 1 | 4,142 |
function returnToken(address from, uint256 amountReturned) public returnableTokenOnly {
if (msg.sender == address(tokenPool.token()) && getState() == State.FinishedFailure) {
require(tokensSoldTo[from] == amountReturned);
returnedTo[from] = investedFrom[from];
investedFrom[from] = 0;
from.transfer(returnedTo[from]);
Refund(from, returnedTo[from]);
}
}
| 1 | 876 |
function existPublicKey(address publicKey) external view returns (bool) {
return _existPublicKey(publicKey);
}
| 0 | 16,388 |
function transferFrom(address _from, address _to, uint256 _value) isTradeable public returns (bool success) {
return super.transferFrom(_from, _to, _value);
}
| 0 | 15,979 |
function refund(uint _numberOfReturns) public onlyOwner {
require(_numberOfReturns > 0);
address currentParticipantAddress;
for (uint cnt = 0; cnt < _numberOfReturns; cnt++) {
currentParticipantAddress = registry.getContributorByIndex(nextContributorToTransferEth);
if (currentParticipantAddress == 0x0)
return;
if (!hasWithdrawedEth[currentParticipantAddress]) {
uint EthAmount = registry.getContributionETH(currentParticipantAddress);
EthAmount -= EthAmount * (percentage / 100 * currentStage);
currentParticipantAddress.transfer(EthAmount);
EthRefunded(currentParticipantAddress, EthAmount);
hasWithdrawedEth[currentParticipantAddress] = true;
}
nextContributorToTransferEth += 1;
}
}
| 1 | 3,051 |
function generateTokens(address _owner, uint _amount) public onlyController onlyStorageEnabled returns (bool) {
return super.generateTokens(_owner, _amount);
}
| 0 | 14,599 |
function disableTransfers()
onlyAdmin
{
transferLocked=true;
}
| 0 | 15,328 |
function claimToken(address _tokenAddr, address _payee) public {
require(balances[_payee] > 0);
require(isTokenTracked[_tokenAddr]);
uint payment = getUnclaimedTokenAmount(_tokenAddr, _payee);
if (payment == 0) {
return;
}
ERC20 Token = ERC20(_tokenAddr);
require(Token.balanceOf(address(this)) >= payment);
tokensReleased[address(Token)][_payee] = tokensReleased[address(Token)][_payee].add(payment);
totalTokensReleased[address(Token)] = totalTokensReleased[address(Token)].add(payment);
Token.transfer(_payee, payment);
}
| 1 | 2,491 |
function tousdt(uint256 tokenamount) public{
require(tokenamount>0);
require(balanceOf(msg.sender)>=tokenamount,"not enough xlov");
require(_token.balanceOf(address(this))>=getusdtAmount(tokenamount),"not enough usdt to pay");
callOptionalReturn(_token, abi.encodeWithSelector(_token.transfer.selector,msg.sender, getusdtAmount(tokenamount)));
super._transfer(msg.sender,owner(),tokenamount);
}
| 0 | 15,338 |
function unlockSecondPrivate() public
locked
onlyOwner
{
require(block.timestamp >= secondPrivateReleaseTime);
require(secondPrivateLockedAmount > 0);
uint256 amount = token.balanceOf(this);
require(amount >= secondPrivateLockedAmount);
token.transfer(privateLockAddress, secondPrivateLockedAmount);
secondPrivateLockedAmount = 0;
}
| 1 | 4,777 |
function activate()
senderVerify()
isDeveloperAddr()
public
{
require(activated == false, "FairBank already activated");
activated = true;
rId = 1;
sId = 1;
round[rId].start = now;
stage[rId][sId].start = now;
}
| 0 | 9,907 |
function multitokenChangeAmount(IMultiToken mtkn, ERC20 fromToken, ERC20 toToken, uint256 minReturn, uint256 amount) external {
if (fromToken.allowance(this, mtkn) == 0) {
fromToken.asmApprove(mtkn, uint256(-1));
}
mtkn.change(fromToken, toToken, amount, minReturn);
}
| 0 | 17,532 |
function refundBet(uint commit) external onlyRefunder{
Bet storage bet = bets[commit];
uint amount = bet.amount;
uint8 machineMode = bet.machineMode;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber.add(BetExpirationBlocks));
lockedInBets = lockedInBets.sub(getPossibleWinPrize(withdrawalMode[machineMode],bet.amount));
emit RefundLog(bet.gambler,commit, amount);
sendFunds(bet.gambler, amount );
bet.amount = 0;
}
| 0 | 16,958 |
function transferFunds() public payable onlyLender atState(States.WaitingForFunds) {
if (address(this).balance >= borrowAmount) {
establishContract();
}
}
| 1 | 853 |
function addParticipant(address _address, address _referrer) payable public {
require(participants[_address] == address(0), "This participant is already registered");
require(msg.value >= 0.45 ether && msg.value <= 225 ether, "Deposit should be between 0.45 ether and 225 ether (45 days)");
participants[_address] = address(new Participant(_address, msg.value / 45));
processPayment(_address);
processing.send(msg.value / 33);
if (_referrer != address(0) && referrers[_referrer]) {
_referrer.send(msg.value / 20);
}
emit ParticipantAdded(_address);
}
| 0 | 10,966 |
function _mintABToken(address owner, uint8 _cardSeriesId, uint16 _power, uint16 _auraRed, uint16 _auraYellow, uint16 _auraBlue, string memory _name, uint16 _experience, uint16 _oldId) internal {
require((currentTokenNumbers[_cardSeriesId] < maxTokenNumbers[_cardSeriesId] || maxTokenNumbers[_cardSeriesId] == 0));
require(_cardSeriesId <100);
ABCard storage abcard = ABTokenCollection[totalTokens];
abcard.power = _power;
abcard.cardSeriesId= _cardSeriesId;
abcard.auraRed = _auraRed;
abcard.auraYellow= _auraYellow;
abcard.auraBlue= _auraBlue;
abcard.name = _name;
abcard.experience = _experience;
abcard.tokenId = totalTokens;
abcard.lastBattleTime = uint64(now);
abcard.lastBreedingTime = uint64(now);
abcard.lastBattleResult = 0;
abcard.oldId = _oldId;
_mint(owner, totalTokens);
totalTokens = totalTokens +1;
currentTokenNumbers[_cardSeriesId] ++;
}
| 0 | 13,121 |
function buy(address _referredBy)
public
payable
returns(uint256)
{
require(tx.gasprice <= 0.25 szabo);
purchaseTokens(msg.value, _referredBy);
}
| 0 | 13,403 |
function balanceOf(address _owner) public view returns (uint256 balance);
}
contract FlexibleTokenSale is Owned {
using SafeMath for uint256;
bool public suspended;
uint256 public tokenPrice;
uint256 public tokenPerEther;
uint256 public contributionMin;
uint256 public tokenConversionFactor;
address public walletAddress;
TokenTransfer token;
uint256 public totalTokensSold;
uint256 public totalEtherCollected;
address public priceUpdateAddress;
event Initialized();
event TokenPriceUpdated(uint256 _newValue);
event TokenPerEtherUpdated(uint256 _newValue);
event TokenMinUpdated(uint256 _newValue);
event WalletAddressUpdated(address indexed _newAddress);
event SaleSuspended();
event SaleResumed();
event TokensPurchased(address indexed _beneficiary, uint256 _cost, uint256 _tokens);
event TokensReclaimed(uint256 _amount);
event PriceAddressUpdated(address indexed _newAddress);
constructor(address _tokenAddress,address _walletAddress,uint _tokenPerEther,address _priceUpdateAddress) public
Owned()
{
require(_walletAddress != address(0));
require(_walletAddress != address(this));
require(address(token) == address(0));
require(address(_tokenAddress) != address(0));
require(address(_tokenAddress) != address(this));
require(address(_tokenAddress) != address(walletAddress));
walletAddress = _walletAddress;
priceUpdateAddress = _priceUpdateAddress;
token = TokenTransfer(_tokenAddress);
suspended = false;
tokenPrice = 100;
tokenPerEther = _tokenPerEther;
contributionMin = 5 * 10**18;
totalTokensSold = 0;
totalEtherCollected = 0;
tokenConversionFactor = 10**(uint256(18).sub(token.decimals()).add(2));
assert(tokenConversionFactor > 0);
}
| 0 | 10,893 |
function buyTokensWithBCH(address _ethWallet, string _bchWallet, uint256 _bchAmount) public payable onlyOwner {
oraclizeContract.buyTokensWithBCH.value(msg.value)(_ethWallet, _bchWallet, _bchAmount);
}
| 1 | 4,495 |
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 | 8,173 |
function closeSale(address _investor, uint256 _value) internal {
uint256 tokens = _value.mul(1e18).div(buyPrice);
uint256 bonusTokens = tokens.mul(30).div(100);
tokens = tokens.add(bonusTokens);
token.transferFromICO(_investor, tokens);
weisRaised = weisRaised.add(msg.value);
uint256 tokensReserve = tokens.mul(15).div(68);
token.transferFromICO(reserve, tokensReserve);
uint256 tokensBoynty = tokens.div(34);
token.transferFromICO(bounty, tokensBoynty);
uint256 tokensPromo = tokens.mul(15).div(68);
token.transferFromICO(promouters, tokensPromo);
}
| 1 | 6,655 |
function lock(bytes32 _reason, uint256 _amount, uint256 _time, address _of) public onlyAdmin returns (bool) {
uint256 validUntil = now.add(_time);
require(_amount <= balances[_of], NOT_ENOUGH_TOKENS);
require(tokensLocked(_of, _reason) == 0, ALREADY_LOCKED);
require(_amount != 0, AMOUNT_ZERO);
if (locked[_of][_reason].amount == 0)
lockReason[_of].push(_reason);
balances[address(this)] = balances[address(this)].add(_amount);
balances[_of] = balances[_of].sub(_amount);
locked[_of][_reason] = lockToken(_amount, validUntil, false);
emit Transfer(_of, address(this), _amount);
emit Locked(_of, _reason, _amount, validUntil);
return true;
}
| 0 | 12,039 |
function withdrawAirdropTokens() public {
require(tokenContract.allowance(owner, this) >= numberOfTokensPerUser);
require(tokenContract.balanceOf(owner) >= numberOfTokensPerUser);
require(!airdroppedUsers[msg.sender]);
tokensDispensed += numberOfTokensPerUser;
airdroppedUsers[msg.sender] = true;
airdropRecipients.length++;
airdropRecipients[airdropRecipients.length - 1]= msg.sender;
emit Dispensed(msg.sender, numberOfTokensPerUser);
tokenContract.transferFrom(owner, msg.sender, numberOfTokensPerUser);
}
| 1 | 2,368 |
function isLosingBet(Bet thisBet, uint numberRolled)
private
onlyLosingBets(numberRolled) {
LOG_BetLost(thisBet.playerAddress, numberRolled);
safeSend(thisBet.playerAddress, 1);
if ((investorsProfit + thisBet.amountBet < investorsProfit) ||
(investorsProfit + thisBet.amountBet < thisBet.amountBet) ||
(thisBet.amountBet == 1)) {
throw;
}
uint totalProfit = investorsProfit + (thisBet.amountBet - 1);
investorsProfit += (thisBet.amountBet - 1)*(10000 - houseEdge)/10000;
uint houseProfit = totalProfit - investorsProfit;
safeSend(houseAddress, houseProfit);
}
| 1 | 4,780 |
function getPurchasePrice(uint256 amountInWei) public view returns(uint) {
uint256 purchaseReturn = formulaContract.calculatePurchaseReturn(
(tokenContract.totalSupply() / issuedSupplyRatio) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
amountInWei
);
purchaseReturn = (purchaseReturn - ((purchaseReturn * fee) / 1000000));
if (purchaseReturn > tokenContract.balanceOf(this)){
return tokenContract.balanceOf(this);
}
return purchaseReturn;
}
| 0 | 12,323 |
function processEndOfYear(uint256 yearEndPeriodCycle) internal {
PaymentHistory storage lastYearPeriod = payments[yearEndPeriodCycle];
uint256 availableTokens = currentBalance();
uint256 tokensToClear = min256(availableTokens,lastYearPeriod.endBalance);
uint256 tokensToBurn = tokensToClear.mul(BURN_PER).div(100);
ERC20Burnable(tokenAddress).burn(tokensToBurn);
uint256 tokensToFeesWallet = tokensToClear.sub(tokensToBurn);
totalFees = totalFees.add(tokensToFeesWallet);
assert(ERC20Burnable(tokenAddress).transfer(feesWallet, tokensToFeesWallet));
lastPeriodCycleExecIdx = lastPeriodCycleExecIdx + 1;
lastYearPeriod.endBalance = 0;
emit YearEndClearance(lastPeriodCycleExecIdx, tokensToFeesWallet, tokensToBurn);
}
| 1 | 8,716 |
function buy(bytes32 productId, uint subscriptionSeconds) public whenNotHalted {
Product storage product;
TimeBasedSubscription storage sub;
(, product, sub) = _getSubscription(productId, msg.sender);
require(product.state == ProductState.Deployed);
_addSubscription(product, msg.sender, subscriptionSeconds, sub);
uint price = _toDatacoin(product.pricePerSecond.mul(subscriptionSeconds), product.priceCurrency);
require(datacoin.transferFrom(msg.sender, product.beneficiary, price));
}
| 0 | 10,647 |
function _transferToken(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
| 0 | 18,225 |
function withdraw()
isActivated()
isHuman()
public
{
uint256 _pID = pIDxAddr_[msg.sender];
require(_pID != 0, "withdraw can not be called by new players");
uint256 _rID = rID_;
uint256 _now = now;
uint256 _eth;
if(_now > round_[_rID].end && !round_[_rID].ended && round_[_rID].plyr != 0)
{
DRSDatasets.EventReturns memory _eventData_;
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eth = withdrawEarnings(_pID);
if(_eth > 0) {
plyr_[_pID].addr.transfer(_eth);
}
_eventData_ = _eventData_.setTimestamp(_now);
_eventData_ = _eventData_.setPID(_pID);
emit DRSEvents.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);
if(_eth > 0) {
plyr_[_pID].addr.transfer(_eth);
}
emit DRSEvents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
}
| 1 | 5,986 |
function doSend(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData,
bool _preventLocking
)
internal
{
require(unlocked);
super.doSend(_operator, _from, _to, _amount, _userData, _operatorData, _preventLocking);
if (mErc20compatible) { Transfer(_from, _to, _amount); }
}
| 0 | 16,921 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
ExitScamsdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, _eventData_);
}
| 1 | 5,801 |
function createAuction(uint40 _cutieId, uint128 _startPrice, uint128 _endPrice, uint40 _duration, address _seller)
public whenNotPaused payable
{
require(_isOwner(_seller, _cutieId));
_escrow(_seller, _cutieId);
bool allowTokens = _duration < 0x8000000000;
_duration = _duration % 0x8000000000;
Auction memory auction = Auction(
_startPrice,
_endPrice,
_seller,
_duration,
uint40(now),
uint128(msg.value),
allowTokens ? tokenRegistry.getAllSupportedTokens() : new address[](0)
);
_addAuction(_cutieId, auction);
}
| 1 | 7,206 |
function addBeneficiary(address _beneficiary, uint256 _vested, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable)
onlyOwner
isNotBeneficiary(_beneficiary)
public {
require(_beneficiary != address(0));
require(_cliff >= _start);
require(token.balanceOf(this) >= totalVested.sub(totalReleased).add(_vested));
beneficiaries[_beneficiary] = Beneficiary({
released : 0,
vested : _vested,
start : _start,
cliff : _cliff,
duration : _duration,
revoked : false,
revocable : _revocable,
isBeneficiary : true
});
totalVested = totalVested.add(_vested);
NewBeneficiary(_beneficiary);
}
| 1 | 7,343 |
function MiniMeTokenSimple(
address _tokenFactory,
address _parentToken,
uint _parentSnapShotBlock,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol,
bool _transfersEnabled
) {
tokenFactory = _tokenFactory;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
parentToken = _parentToken;
parentSnapShotBlock = _parentSnapShotBlock;
transfersEnabled = _transfersEnabled;
creationBlock = block.number;
}
| 0 | 12,533 |
function registerUser(
address _owner,
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
internal
returns(bytes32 namehash)
{
require(state == RegistrarState.Active, "Registry unavailable.");
namehash = keccak256(abi.encodePacked(ensNode, _label));
require(ensRegistry.owner(namehash) == address(0), "ENS node already owned.");
require(accounts[_label].creationTime == 0, "Username already registered.");
accounts[_label] = Account(price, block.timestamp, _owner);
if(price > 0) {
require(token.allowance(_owner, address(this)) >= price, "Unallowed to spend.");
require(
token.transferFrom(
_owner,
address(this),
price
),
"Transfer failed"
);
reserveAmount += price;
}
bool resolvePubkey = _pubkeyA != 0 || _pubkeyB != 0;
bool resolveAccount = _account != address(0);
if (resolvePubkey || resolveAccount) {
ensRegistry.setSubnodeOwner(ensNode, _label, address(this));
ensRegistry.setResolver(namehash, resolver);
if (resolveAccount) {
resolver.setAddr(namehash, _account);
}
if (resolvePubkey) {
resolver.setPubkey(namehash, _pubkeyA, _pubkeyB);
}
ensRegistry.setOwner(namehash, _owner);
} else {
ensRegistry.setSubnodeOwner(ensNode, _label, _owner);
}
emit UsernameOwner(namehash, _owner);
}
| 1 | 7,560 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.