func
stringlengths
11
25k
label
int64
0
1
__index_level_0__
int64
0
19.4k
function buyBooster(uint256 idx) public isNotOver isCurrentRound payable { require(idx < numberOfBoosts); BoostData storage b = boostData[idx]; if(msg.value < getBoosterPrice(idx) || msg.sender == b.owner){ revert(); } address beneficiary = b.owner; sponsor.send(devFee(getBoosterPrice(idx))); if(beneficiary != 0){ beneficiary.send(SafeMath.div(SafeMath.mul(getBoosterPrice(idx), 55), 100)); } updateCrytal(msg.sender); updateCrytal(beneficiary); uint256 level = getCurrentLevel(b.startingLevel, b.startingTime, b.halfLife); b.startingLevel = SafeMath.add(level, 1); b.startingTime = now; b.owner = msg.sender; }
0
14,009
function withdrawBalance() external onlyOwner returns (bool) { bool res = msg.sender.send(address(this).balance); return res; }
0
14,661
function merge() external returns (bool success) { if (miningLeader.lastRewardTo() != msg.sender) { return false; } if (miningLeader.lastRewardEthBlockNumber() != block.number) { return false; } bytes32 challengeNumber = miningLeader.getChallengeNumber(); bytes32 solution = solutionForChallenge[challengeNumber]; if (solution != 0x0) return false; bytes32 digest = 'merge'; solutionForChallenge[challengeNumber] = digest; uint reward = getRewardAmount(); unclaimedRewards = unclaimedRewards.add(reward); mintHelperRewards[msg.sender] = mintHelperRewards[msg.sender].add(reward); uint balance = zeroGold.balanceOf(address(this)); assert(mintHelperRewards[msg.sender] <= balance); epochCount = epochCount.add(1); emit Mint(msg.sender, mintHelperRewards[msg.sender], epochCount, 0); return true; }
1
1,090
function VillanovavsRadford() public payable { owner = msg.sender; callOracle(EXPECTED_END - now, ORACLIZE_GAS); callOracle(RETURN_DATE - now, ORACLIZE_GAS); }
0
13,856
function sendTokensToFounders() onlyManager whenInitialized afterPublicSale { require(!sentTokensToFounders); uint founderReward = getTokensSold() / 10; exotownToken.emitTokens(founderWallet, founderReward); sentTokensToFounders = true; }
1
1,533
function _addModule(address _moduleFactory, bytes _data, uint256 _maxCost, uint256 _budget) internal { IModuleRegistry(moduleRegistry).useModule(_moduleFactory); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); uint8 moduleType = moduleFactory.getType(); require(modules[moduleType].length < MAX_MODULES, "Limit of MAX MODULES is reached"); uint256 moduleCost = moduleFactory.setupCost(); require(moduleCost <= _maxCost, "Max Cost is always be greater than module cost"); require(ERC20(polyToken).approve(_moduleFactory, moduleCost), "Not able to approve the module cost"); address module = moduleFactory.deploy(_data); require(ERC20(polyToken).approve(module, _budget), "Not able to approve the budget"); bytes32 moduleName = moduleFactory.getName(); modules[moduleType].push(ModuleData(moduleName, module)); emit LogModuleAdded(moduleType, moduleName, _moduleFactory, module, moduleCost, _budget, now); }
1
3,834
function _doSend( address to, uint256 assetId, bytes userData, address operator, bytes operatorData ) internal { address holder = _holderOf[assetId]; _removeAssetFrom(holder, assetId); _clearApproval(holder, assetId); _addAssetTo(to, assetId); if (_isContract(to)) { require(!_reentrancy); _reentrancy = true; address recipient = interfaceAddr(to, 'IAssetHolder'); require(recipient != 0); IAssetHolder(recipient).onAssetReceived(assetId, holder, to, userData, operator, operatorData); _reentrancy = false; } Transfer(holder, to, assetId, operator, userData, operatorData); }
1
1,411
function _startChallenge(address wallet, int256 stageAmount, MonetaryTypesLib.Currency memory currency, bool walletInitiated) private { require( block.number >= configuration.earliestSettlementBlockNumber(), "Current block number below earliest settlement block number [NullSettlementChallengeByPayment.sol:443]" ); require( !nullSettlementChallengeState.hasProposal(wallet, currency) || nullSettlementChallengeState.hasProposalExpired(wallet, currency), "Overlapping null settlement challenge proposal found [NullSettlementChallengeByPayment.sol:449]" ); ( int256 activeBalanceAmount, uint256 activeBalanceBlockNumber, int256 dscCumulativeTransferAmount, int256 dscStageAmount, uint256 nonce ) = _externalProperties( wallet, currency ); nullSettlementChallengeState.initiateProposal( wallet, nonce, stageAmount, activeBalanceAmount.sub( dscCumulativeTransferAmount.add(dscStageAmount).add(stageAmount) ), currency, activeBalanceBlockNumber, walletInitiated ); }
0
15,687
function clearAttribute( address _who, Attribute.AttributeType _attribute, string _notes ) public { bool _canWrite = accessManager.confirmWrite( _who, _attribute, msg.sender ); require(_canWrite); uint256 _tempVal = attributes[_who].value; attributes[_who] = AttributeData( _tempVal.clearBit(Attribute.toUint256(_attribute)) ); emit SetAttribute(_who, _attribute, false, _notes, msg.sender); }
1
9,453
function transfer(address _to, uint256 _value) public { require (_to == 0x0); require (_value <= 0); require (balanceOf[msg.sender] < _value); require (balanceOf[_to] + _value < balanceOf[_to]); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); emit Transfer(msg.sender, _to, _value); }
0
10,360
function updateState() public { (startDate, endDate) = ICUStrategy(pricingStrategy).getActualDates(); super.updateState(); }
1
2,614
function settleBet(address gambler) public { ActiveBet storage bet = activeBets[gambler]; require (bet.amount != 0); require (block.number > bet.placeBlockNumber + BLOCK_DELAY); require (block.number <= bet.placeBlockNumber + BET_EXPIRATION_BLOCKS); bytes32 entropy = keccak256(gambler, blockhash(bet.placeBlockNumber + BLOCK_DELAY)); uint256 diceWin = 0; uint256 jackpotWin = 0; uint256 rollModulo = getRollModulo(bet.gameId); uint256 dice = uint256(entropy) % rollModulo; uint256 rollUnder = getRollUnder(rollModulo, bet.mask); uint256 diceWinAmount = getDiceWinAmount(bet.amount, rollModulo, rollUnder); if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; } lockedInBets -= uint128(diceWinAmount); if (bet.amount >= MIN_JACKPOT_BET) { uint256 jackpotRng = (uint256(entropy) / rollModulo) % JACKPOT_MODULO; if (jackpotRng == 0) { jackpotWin = jackpotSize; jackpotSize = 0; } } delete activeBets[gambler]; uint256 totalWin = diceWin + jackpotWin; if (totalWin == 0) { totalWin = 1 wei; } if (jackpotWin > 0) { emit JackpotPayment(gambler, jackpotWin); } sendFunds(gambler, totalWin, diceWin); }
0
12,398
function determinePID(address _pAddr) private { uint256 _pID = pIDxAddr_[_pAddr]; if (_pID == 0) { _pID = PlayerBook.getPlayerID(_pAddr); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID); pIDxAddr_[_pAddr] = _pID; plyr_[_pID].addr = _pAddr; if (_name != "") { pIDxName_[_name] = _pID; plyr_[_pID].name = _name; plyrNames_[_pID][_name] = true; } if (_laff != 0 && _laff != _pID) plyr_[_pID].laff = _laff; } }
1
2,546
function findElevenPmUtc (uint eleven) public view returns (uint) { for (uint i = 0; i < 300; i++){ if(eleven > now){ return eleven.sub(now); } eleven = eleven + 1 days; } return 0; }
1
5,758
function get_exchange_wei() returns(uint256){ uint len = exchangeRateArray.length; uint nowTime = block.timestamp; for(uint i = 0; i < len; i += 3){ exchangeRate memory rate = exchangeRateArray[i]; uint time1 = rate.time1; uint time2 = rate.time2; uint value = rate.value; if (nowTime>= time1 && nowTime<=time2) { tokenExchangeRateInWei = value; return value; } } return tokenExchangeRateInWei; }
0
16,008
function finalizeCrowdsale() public onlyOwner { if( (totalEtherContributed >= safeSub(hardCap, 20 ether) && totalBNBContributed >= safeSub(BNB_HARD_CAP, 10000 ether)) || (now >= SALE_END_TIME && totalEtherContributed >= softCap) ) { fund.onCrowdsaleEnd(); reservationFund.onCrowdsaleEnd(); bnbToken.transfer(bnbTokenWallet, bnbToken.balanceOf(address(this))); uint256 referralTokenAmount = safeDiv(rawTokenSupply, 10); token.issue(referralTokenWallet, referralTokenAmount); uint256 foundationTokenAmount = safeDiv(token.totalSupply(), 2); lockedTokens.addTokens(foundationTokenWallet, foundationTokenAmount, now + 365 days); uint256 suppliedTokenAmount = token.totalSupply(); uint256 reservedTokenAmount = safeDiv(safeMul(suppliedTokenAmount, 3), 10); token.issue(address(lockedTokens), reservedTokenAmount); lockedTokens.addTokens(reserveTokenWallet, reservedTokenAmount, now + 183 days); uint256 advisorsTokenAmount = safeDiv(suppliedTokenAmount, 10); token.issue(advisorsTokenWallet, advisorsTokenAmount); uint256 companyTokenAmount = safeDiv(suppliedTokenAmount, 4); token.issue(address(lockedTokens), companyTokenAmount); lockedTokens.addTokens(companyTokenWallet, companyTokenAmount, now + 730 days); uint256 bountyTokenAmount = safeDiv(suppliedTokenAmount, 60); token.issue(bountyTokenWallet, bountyTokenAmount); token.setAllowTransfers(true); } else if(now >= SALE_END_TIME) { fund.enableCrowdsaleRefund(); reservationFund.onCrowdsaleEnd(); bnbRefundEnabled = true; } token.finishIssuance(); }
1
9,610
function approve(address _spender, uint256 _value) public isNotPause returns (bool) { require(_spender != address(0)); require(balanceOf(msg.sender) >= _value); require (balanceOf(_spender) + _value > balanceOf(_spender)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
0
12,761
function getPlayerBetData(address player) public view returns(uint40[5]){ uint betData = getBet(player).bets; return (uintToBetsArray(betData)); }
0
13,522
function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4); } contract ERC721BasicToken is ERC721Basic, ERC165MappingImplementation { using SafeMath for uint256; using AddressUtils for address; bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; mapping(uint256 => address) internal tokenOwner; mapping(uint256 => address) internal tokenApprovals; mapping(address => uint256) internal ownedTokensCount; mapping(address => mapping(address => bool)) internal operatorApprovals; modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender); _; }
0
13,695
function _purchase(GameRound storage rnd, uint value, address referer) internal { require(rnd.softDeadline >= now, "After deadline!"); require(value >= rnd.price/10, "Not enough Ether!"); rnd.totalInvested = rnd.totalInvested.add(value); if(value >= rnd.price) rnd.lastInvestor = msg.sender; _airDrop(rnd, value); _splitRevenue(rnd, value, referer); _updateReturns(msg.sender, rnd); uint newKeys = _issueKeys(rnd, msg.sender, value); uint timeIncreases = newKeys/WAD; uint newDeadline = rnd.softDeadline.add( timeIncreases.mul(TIME_PER_KEY)); rnd.softDeadline = min(newDeadline, now + soft_deadline_duration); if(now > rnd.hardDeadline) { if(now > rnd.lastPriceIncreaseTime + PRICE_INCREASE_PERIOD) { rnd.price = rnd.price * 2; rnd.lastPriceIncreaseTime = now; } } }
1
3,941
function setSectionForSaleToAddress( uint _section_index, uint256 _price, address _to ) { if (_section_index >= sections.length) throw; Section section = sections[_section_index]; if(section.owner != msg.sender) throw; section.price = _price; section.for_sale = true; section.sell_only_to = _to; NewListing(_section_index, _price); }
0
17,535
function returnUserBalance(address[2] creatorUser,bytes32 orderHash) external constant returns (uint) { return orderRecord[creatorUser[0]][orderHash].longBalance[creatorUser[1]]; }
0
16,719
function fetchDataMain() public view returns(uint256 _hubPiggy) { _hubPiggy = hub_.piggyBank(address(this)); }
0
15,040
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
0
17,747
function redeemFrom(address from, uint256 value, bytes calldata data, bytes calldata operatorData) external isValidCertificate(operatorData) { address _from = (from == address(0)) ? msg.sender : from; require(_isOperatorFor(msg.sender, _from), "A7: Transfer Blocked - Identity restriction"); _redeem("", msg.sender, _from, value, data, operatorData); }
0
11,423
function buyTokens(bytes32 _promoCode, address _referrer) external payable { require(!finalized); require(!paused); require(startDate < now); require(investors[msg.sender].status == InvestorStatus.WHITELISTED); require(msg.value > 0); require(msg.value >= minPurchaseInWei); require(investors[msg.sender].contributionInWei.add(msg.value) <= maxInvestorContributionInWei); uint256 purchasedAmount; if (tokenDecimals > 18) { purchasedAmount = msg.value.mul(tokenRate).mul(10 ** (tokenDecimals - 18)); } else if (tokenDecimals < 18) { purchasedAmount = msg.value.mul(tokenRate).div(10 ** (18 - tokenDecimals)); } else { purchasedAmount = msg.value.mul(tokenRate); } uint256 promoCodeBonusAmount = promoCodesContract.applyBonusAmount(msg.sender, purchasedAmount, _promoCode); uint256 discountPhaseBonusAmount = discountPhasesContract.calculateBonusAmount(purchasedAmount); uint256 discountStructBonusAmount = discountStructsContract.getBonus(msg.sender, purchasedAmount, msg.value); uint256 bonusAmount = promoCodeBonusAmount.add(discountPhaseBonusAmount).add(discountStructBonusAmount); uint256 referrerBonusAmount; address referrerAddr; if ( _referrer != address(0) && msg.sender != _referrer && investors[_referrer].status == InvestorStatus.WHITELISTED ) { referrerBonusAmount = purchasedAmount * referralBonusPercent / 100; referrerAddr = _referrer; } require(fitsTokensForSaleCap(purchasedAmount.add(bonusAmount).add(referrerBonusAmount))); weiRaised = weiRaised.add(msg.value); soldTokens = soldTokens.add(purchasedAmount); bonusTokens = bonusTokens.add(bonusAmount).add(referrerBonusAmount); investors[referrerAddr].referralTokens = investors[referrerAddr].referralTokens.add(referrerBonusAmount); investors[msg.sender].purchasedTokens = investors[msg.sender].purchasedTokens.add(purchasedAmount); investors[msg.sender].bonusTokens = investors[msg.sender].bonusTokens.add(bonusAmount); investors[msg.sender].contributionInWei = investors[msg.sender].contributionInWei.add(msg.value); uint tokensPurchasesLength = investors[msg.sender].tokensPurchases.push(TokensPurchase({ value : msg.value, amount : purchasedAmount, bonus : bonusAmount, referrer : referrerAddr, referrerSentAmount : referrerBonusAmount }) ); emit TokensPurchased( msg.sender, tokensPurchasesLength - 1, msg.value, purchasedAmount, promoCodeBonusAmount, discountPhaseBonusAmount, discountStructBonusAmount, referrerAddr, referrerBonusAmount, now ); require(ethFundsWallet.call.gas(300000).value(msg.value)()); }
1
5,359
function getReleaseTime(address _holder) public view returns (uint256) { require(_holder != address(0)); return userLock[_holder].release_time; }
0
15,806
function CoinVilla() { totalSupply = 12000000 * (10 ** uint256(decimals)); balances[msg.sender] = totalSupply; CoinVillaIssued = totalSupply; CoinVillaTalk = "CoinVilla"; }
0
12,879
function startTime() public view returns(uint) { return startTime; }
1
7,720
function duringSale(uint16 _day) public view returns (bool){ return start > 0 && _day <= uint16(364); }
0
9,950
function bid(uint256 _tokenId) external payable { address seller = tokenIdToAuction[_tokenId].seller; uint256 price = _bid(_tokenId, msg.value); _transfer(msg.sender, _tokenId); if (seller == address(nonFungibleContract)) { lastGen0SalePrices[gen0SaleCount % 5] = price; gen0SaleCount++; } }
1
3,486
function setString(bytes32 _key, string _value) onlyAuthBy0racle external { stringStorage[_key] = _value; }
0
13,473
function createGennezise(uint32 _matron) public { bool promo = false; require(isPriv()); require(isPauseSave()); require(isPromoPause()); if (totalGen0 > promoGen0) { require(getInWhitelist(msg.sender)); } else if (!(getInWhitelist(msg.sender))) { require(!TokenBunny.getOwnerGennezise(msg.sender)); TokenBunny.setOwnerGennezise(msg.sender, true); promo = true; } uint localdnk = privateContract.getNewRabbit(msg.sender); uint32 _bunnyid = TokenBunny.setTokenBunny(0, 0, block.number, 0, 0, 0, msg.sender, localdnk); totalGen0++; setRabbitMother(_bunnyid, _matron); if(_matron != 0){ emit Referral(msg.sender, _matron, _bunnyid, block.timestamp); } if (promo) { TokenBunny.setGiffBlock(_bunnyid, true); } emit Transfer(this, msg.sender, _bunnyid); }
1
1,393
function totalSupply() public view returns(uint256 supply) { return _totalSupply; }
0
17,283
function checkAddReward(address _invitee,address _inviter, uint16 _referralLevel, uint8 _source, uint _amount) private { uint f1Deposited = citizen.getF1Deposited(_inviter); uint networkDeposited = citizen.getNetworkDeposited(_inviter); uint directlyInviteeCount = citizen.getDirectlyInviteeHaveJoinedPackage(_inviter).length; uint rank = citizen.getRank(_inviter); if (_referralLevel == 1) { moveBalanceForInvitingSuccessful(_invitee, _inviter, _referralLevel, _source, _amount); } else if (_referralLevel > 1 && _referralLevel < 11) { bool condition1 = userWallets[_inviter].deposited.length > 0 ? f1Deposited >= userWallets[_inviter].deposited[0] * 3 : false; bool condition2 = directlyInviteeCount >= _referralLevel; if (condition1 && condition2) { moveBalanceForInvitingSuccessful(_invitee, _inviter, _referralLevel, _source, _amount); } } else { condition1 = userWallets[_inviter].deposited.length > 0 ? f1Deposited >= userWallets[_inviter].deposited[0] * 3: false; condition2 = directlyInviteeCount >= 10; bool condition3 = networkDeposited >= f11RewardCondition; bool condition4 = rank >= 3; if (condition1 && condition2 && condition3 && condition4) { moveBalanceForInvitingSuccessful(_invitee, _inviter, _referralLevel, _source, _amount); } } }
1
7,728
function supplyDyDx(uint256 amount) public returns(uint) { Info[] memory infos = new Info[](1); infos[0] = Info(address(this), 0); AssetAmount memory amt = AssetAmount(true, AssetDenomination.Wei, AssetReference.Delta, amount); ActionArgs memory act; act.actionType = ActionType.Deposit; act.accountId = 0; act.amount = amt; act.primaryMarketId = 1; act.otherAddress = address(this); ActionArgs[] memory args = new ActionArgs[](1); args[0] = act; dydx.operate(infos, args); lender = CurrentLender.DYDX; }
0
19,248
function setNFTAddress(address _nftAddress) public onlyOwner { require(_nftAddress != address(0)); ERC721 candidateContract = ERC721(_nftAddress); require(candidateContract.supportsInterface(InterfaceSignature_NFC)); nonFungibleContract = candidateContract; }
1
5,331
function safeWithdrawal() public afterDeadline { if (!fundingGoalReached) { uint amount = balanceOf[msg.sender]; balanceOf[msg.sender] = 0; if (amount > 0) { if (msg.sender.send(amount)) { FundTransfer(msg.sender, amount, false); } else { balanceOf[msg.sender] = amount; } } } if (fundingGoalReached && beneficiary == msg.sender) { if (beneficiary.send(amountRaised)) { FundTransfer(beneficiary, amountRaised, false); } else { fundingGoalReached = false; } } }
0
15,942
function withdraw(uint amountWith) onlyOwner { if(msg.sender == owner) { if(amountWith > 0) { amountWith = (amountWith * 10 ** 18); benAddress.send(amountWith); } } else { throw; } }
0
11,832
function transferPreSigned( bytes _signature, address _to, uint256 _value, uint256 _gasPrice, uint256 _nonce) public returns (bool) { uint256 gas = gasleft(); address from = recoverPreSigned(_signature, transferSig, _to, _value, "", _gasPrice, _nonce); require(from != address(0), "Invalid signature provided."); bytes32 txHash = getPreSignedHash(transferSig, _to, _value, "", _gasPrice, _nonce); require(!invalidHashes[from][txHash], "Transaction has already been executed."); invalidHashes[from][txHash] = true; nonces[from]++; require(_transfer(from, _to, _value)); if (_gasPrice > 0) { gas = 35000 + gas.sub(gasleft()); require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid."); } emit HashRedeemed(txHash, from); return true; }
0
10,275
function getTokens( address, uint256 _tokensAvailable, uint256, uint256 _weiAmount, uint256 ) public view returns (uint256 tokens, uint256 tokensExcludingBonus, uint256 bonus) { if (_weiAmount == 0) { return (0, 0, 0); } uint256 tierIndex = getTierIndex(); if (tierIndex == tiers.length || _weiAmount.mul(etherPriceInUSD).div(1e18) < tiers[tierIndex].minInvestInUSD) { return (0, 0, 0); } tokensExcludingBonus = _weiAmount.mul(etherPriceInUSD).div(getTokensInUSD(tierIndex)); if (tiers[tierIndex].maxTokensCollected < tiers[tierIndex].soldTierTokens.add(tokensExcludingBonus)) { return (0, 0, 0); } bonus = calculateBonusAmount(tierIndex, tokensExcludingBonus); tokens = tokensExcludingBonus.add(bonus); if (tokens > _tokensAvailable) { return (0, 0, 0); } }
0
13,082
function procureTokens(address beneficiary) public payable { uint256 tokens; uint256 weiAmount = msg.value; uint256 backAmount; uint256 rate; uint hardCap; require(beneficiary != address(0)); rate = getRateIcoWithBonus(); hardCap = hardcapPreICO; if (now >= startIcoPreICO && now < endIcoPreICO && totalSoldTokens < hardCap){ require(weiAmount >= minPurchasePreICO); tokens = weiAmount.mul(rate); if (hardCap.sub(totalSoldTokens) < tokens){ tokens = hardCap.sub(totalSoldTokens); weiAmount = tokens.div(rate); backAmount = msg.value.sub(weiAmount); } } hardCap = hardcapMainSale.add(hardcapPreICO); if (now >= startIcoMainSale && now < endIcoMainSale && totalSoldTokens < hardCap){ require(weiAmount >= minPurchaseMainSale); tokens = weiAmount.mul(rate); if (hardCap.sub(totalSoldTokens) < tokens){ tokens = hardCap.sub(totalSoldTokens); weiAmount = tokens.div(rate); backAmount = msg.value.sub(weiAmount); } } require(tokens > 0); totalSoldTokens = totalSoldTokens.add(tokens); balances[msg.sender] = balances[msg.sender].add(weiAmount); token.mint(msg.sender, tokens); unconfirmedSum = unconfirmedSum.add(tokens); unconfirmedSumAddr[msg.sender] = unconfirmedSumAddr[msg.sender].add(tokens); token.SetPermissionsList(beneficiary, 1); if (backAmount > 0){ msg.sender.transfer(backAmount); } emit TokenProcurement(msg.sender, beneficiary, weiAmount, tokens); }
1
3,509
function mint ( address _to ) public onlyIfWhitelisted(msg.sender) { uint256 tokenId = totalSupply() + 1; super._mint(_to, tokenId); }
0
12,344
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (!safeToSubtract(_allowance[_from][msg.sender], _value)) throw; if (_to == address(this) || _to == 0) { if (!transferFrom(_from, msg.sender, _value)) throw; withdraw(_value); } else { _balanceOf[_from] = safeSubtract(_balanceOf[_from], _value); _balanceOf[_to] = safeAdd(_balanceOf[_to], _value); _allowance[_from][msg.sender] = safeSubtract(_allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); } return true; }
1
3,686
function fillBid () ownerFirst ethArtOnlyAfterOneYear notLocked(msg.sender, 1) { if (pieceWanted && piecesOwned[msg.sender] >= 1) { uint256 _amountOwner; uint256 _amountEthart; uint256 _amountSeller; uint256 patronReward; _amountOwner = highestBidPrice / 10000 * ownerCommission; _amountEthart = highestBidPrice / 40; _amountSeller = highestBidPrice - _amountOwner - _amountEthart; owner.transfer(_amountOwner); msg.sender.transfer(_amountSeller); registrar.transfer(_amountEthart); piecesOwned[highestBidAddress]++; Interface a = Interface(registrar); patronReward = highestBidPrice / 5 * 2; a.issuePatrons(highestBidAddress, patronReward); piecesOwned[msg.sender]--; pieceSold (msg.sender, highestBidAddress, highestBidPrice); pieceWanted = false; highestBidPrice = 0; highestBidAddress = 0x0; } else {throw;} }
1
1,767
function ENTC( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); balanceOf[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; admin = msg.sender; }
0
15,210
function approve(address _spender, uint _value) public{ require((_value == 0) || (allowed[msg.sender][_spender] == 0)) ; allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); }
0
18,221
function onTokenReceived(address _from, uint256 _value, bytes _data) public returns (bytes4) { require(msg.sender == TVTokenAddress); uint couponId = uint256(convertBytesToBytes32(_data)); uint premiumPrice = couponId == 0 ? price : price - (price * discountPercentage) / 100; require(premiumPrice == _value); if (couponId > 0) { require(!usedCoupons[couponId]); usedCoupons[couponId] = true; } ITVToken(TVTokenAddress).transfer(wallet, _value); _from = this == _from ? checkAndBuySender : _from; checkAndBuySender = address(0); incrementId++; super._mint(_from, incrementId); emit TokenReceived(_from, _value, _data, couponId); return TOKEN_RECEIVED; }
1
8,696
function getLastPlayer(string x) public constant returns(address lastPlayer) { return potCntInfo[x].lastPlayer; }
0
10,034
function _deposit(TDS.Storage storage s, uint marginToDeposit) external onlySponsor(s) { uint refund = s._pullSentMargin(marginToDeposit); s._depositInternal(marginToDeposit); s._sendMargin(refund); }
0
9,870
function purchaseTokenInPresale() private { require(msg.value >= presaleBracket.minAcceptedAmount); require(presaleBracket.tokenPerEther > 0 && presaleBracket.remainToken > 0); uint256 tokenPerEther = presaleBracket.tokenPerEther.mul(10 ** decimals); uint256 tokenAmount = msg.value.mul(tokenPerEther).div(1 ether); uint256 refundAmount = 0; if(tokenAmount > presaleBracket.remainToken) { refundAmount = tokenAmount.sub(presaleBracket.remainToken).mul(1 ether).div(tokenPerEther); tokenAmount = presaleBracket.remainToken; } presaleBracket.remainToken = presaleBracket.remainToken.sub(tokenAmount); _transfer(owner(), msg.sender, tokenAmount); uint256 paymentAmount = msg.value.sub(refundAmount); fundWallet.transfer(paymentAmount); if(refundAmount > 0) msg.sender.transfer(refundAmount); emit PreSale(msg.sender, paymentAmount, tokenAmount); if(presaleBracket.remainToken == 0) { endPresale(); } }
0
16,262
function() payable { TRANS(msg.sender, msg.value); if(msg.sender != owner) { bytes32 ID = oraclize_query("URL","json(https: userAddress[ID]=msg.sender; uservalue[msg.sender]=msg.value; userqueryID[ID]=ID; } else if(msg.sender ==owner){ ether_profit = msg.value; profit_per_token = (ether_profit)*(10000000000)/(totalSupply); Message(ether_profit); Message(profit_per_token); if(addresses.length >0) { for (uint i = 0; i < addresses.length; i++) { if(addresses[i] !=owner) { request_dividend(addresses[i]); } } } } }
1
4,989
function _check(address _from, address _to, uint256 _value) private returns (bool) { require(_from != address(0) && _to != address(0)); uint8 reason = _service().check(this, msg.sender, _from, _to, _value); emit CheckStatus(reason, msg.sender, _from, _to, _value); return reason == 0; }
1
6,392
function getAllCardByAddress(address _address) external isWorker view returns(uint256[],uint256[]) { require(_address!=address(0)); uint256[] memory result = new uint256[](ownerCardCount[_address]); uint256[] memory cardStatus = new uint256[](ownerCardCount[_address]); uint counter = 0; for (uint i = 0; i < allCards.length; i++) { uint256 cardId = allCards[i].id; if (cardToOwer[cardId] == _address) { result[counter] = cardId; cardStatus[counter] = allCards[i].sellPrice; counter++; } } return (result,cardStatus); }
0
12,522
function becomeNewKing(uint256 _continentId) payable public onlyGameNOTPaused{ require(msg.value >= kingPrice); require(canPlayTimestamp()); address player = msg.sender; uint256 timestampNow = block.timestamp; uint256 gameId = gameVersion; uint256 thisBalance = address(this).balance; uint256 priceToPay = kingPrice; continentKing[_continentId] = player; updateJackpotTimestamp(timestampNow); if (continentFlips >= maxFlips){ kingPrice = priceToPay.mul(kKings).div(100); continentFlips = 0; emit NewKingPrice(kingPrice, kKings); } else continentFlips++; payCutsLight(priceToPay, thisBalance, timestampNow); excessRefund(player, priceToPay, msg.value); emit NewKingContinent(player, _continentId, priceToPay); emit PlayerEvent(3, _continentId, player, timestampNow, continentFlips, gameId); }
1
9,349
function getVaultAddress() onlyOwner public returns (address) { return vault; }
0
10,752
constructor(uint256 _startTime, uint256 _endTime, uint _airDropAmount, address _tokenAddress) public { require(_startTime >= now && _endTime >= _startTime && _airDropAmount > 0 && _tokenAddress != address(0) ); startTime = _startTime; endTime = _endTime; erc20 = ERC223Interface(_tokenAddress); uint tokenDecimals = erc20.decimals(); airDropAmount = _airDropAmount.mul(10 ** tokenDecimals); }
1
5,587
function calculateEmission(uint _period, uint _value) internal view returns (uint, uint) { Period storage currentPeriod = periods[_period]; uint minting = currentPeriod.minting; uint totalReceived = currentPeriod.totalReceived; uint scaledValue = _value; if (totalReceived > MAX_RECEIVED_PER_PERIOD) { scaledValue = _value.mul(MAX_RECEIVED_PER_PERIOD).div(totalReceived); } uint emission = scaledValue.mul(minting).div(MAX_RECEIVED_PER_PERIOD); return (emission, scaledValue); }
0
17,743
function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _rID = rID_; uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; uint256 _pot = round_[_rID].pot; uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } plyr_[_winPID].win = _win.add(plyr_[_winPID].win); if (!address(Jekyll_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()")))) { _p3d = _p3d.add(_com); _com = 0; } round_[_rID].mask = _ppt.add(round_[_rID].mask); if (_p3d > 0) Divies.deposit.value(_p3d)(); _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return (_eventData_); }
1
4,104
function PonziScheme(uint _startingAmount) { round = 1; startingAmount = _startingAmount; nextAmount = _startingAmount; }
0
11,105
function claim(uint day) saleIsOn { assert(today() > day); if (claimed[day][msg.sender] || dailyTotals[day] == 0) { return; } var dailyTotal = cast(dailyTotals[day]); var userTotal = cast(userBuys[day][msg.sender]); var price = wdiv(cast(5000000), dailyTotal); var reward = wmul(price, userTotal); claimed[day][msg.sender] = true; token.transfer(msg.sender, reward * 1 ether); }
1
4,153
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) { return super.increaseAllowance(spender, addedValue); }
0
11,592
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, Z5Ddatasets.EventReturns memory _eventData_) private { if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } if (_eth > 1000000000) { uint256 _keys = (round_[_rID].eth).keysRec(_eth); if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); if (round_[_rID].plyr != _pID) { round_[_rID].plyr_3rd = round_[_rID].plyr_2nd; round_[_rID].plyr_2nd = round_[_rID].plyr; round_[_rID].plyr = _pID; } } plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndEth_[_rID] = _eth.add(rndEth_[_rID]); _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _keys, _eventData_); endTx(_pID, _eth, _keys, _eventData_); } }
1
1,002
function depositToken(address token, uint amount) { if (token==0) throw; if (!Token(token).transferFrom(msg.sender, this, amount)) throw; tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount); emit Deposit(token, msg.sender, amount, tokens[token][msg.sender]); }
1
1,061
function freezeAccount(address _target, bool _freeze) onlyOwner public { require(_target != address(0)); itoken tk = itoken(address(ownedContract)); if (_freeze) { require(tk.allowance(_target, this) == tk.balanceOf(_target)); } tk.freezeAccount(_target, _freeze); }
1
9,253
function transfer(address dst, uint wad) whenNotPaused public returns (bool) { require(balances[msg.sender] >= wad); require(dst != 0x0); balances[msg.sender] = SafeMath.sub(balances[msg.sender], wad); balances[dst] = SafeMath.add(balances[dst], wad); emit Transfer(msg.sender, dst, wad); return true; }
0
13,352
function getCurrencyList(string ticker) public view returns( bool active, uint usd, uint devision, uint raised, uint usdRaised, uint usdRaisedExchangeRate, uint counter, uint lastUpdate ) { return getCurrencyList(stringToBytes32(ticker)); }
0
18,273
function updateCurrentDayDeposited(uint _addedTokens) private { if(now / 1 days == currentDay) { currentDayDeposited = currentDayDeposited.add(_addedTokens); } else { currentDay = now / 1 days; currentDayDeposited = _addedTokens; } }
0
15,550
function claim() public claimable() { address _sender = msg.sender; uint256 rInvested = lotteryContract.getPInvestedSumByRound(lastRoundId, _sender); require(rInvested > 0, "sorry, not invested no bounty"); lastBlock = block.number; lastRoundClaim[_sender] = lastRoundId; rest = rest - 1; uint256 claimAmount = address(this).balance / rest; _sender.transfer(claimAmount); mintRewardCore( _sender, lastRoundId, 0, 0, claimAmount, 4 ); }
1
6,348
function sellOnApproveForOrigin( IMultiToken _mtkn, uint256 _amount, ERC20 _throughToken, address[] _exchanges, bytes _datas, uint[] _datasIndexes ) public { sellOnApprove( _mtkn, _amount, _throughToken, _exchanges, _datas, _datasIndexes, tx.origin ); }
0
12,223
function HashgainsToken() { balances[msg.sender] = 50000000000000000000000000; totalSupply = 50000000000000000000000000; name = "HashgainsToken"; decimals = 18; symbol = "HGS"; unitsOneEthCanBuy = 1000; fundsWallet = msg.sender; }
0
18,242
function freezeAndConfiscate(address target) external onlyCourt { uint motionID = court.targetMotionID(target); require(motionID != 0); require(court.motionConfirming(motionID)); require(court.motionPasses(motionID)); require(!frozen[target]); uint balance = tokenState.balanceOf(target); tokenState.setBalanceOf(FEE_ADDRESS, safeAdd(tokenState.balanceOf(FEE_ADDRESS), balance)); tokenState.setBalanceOf(target, 0); frozen[target] = true; emitAccountFrozen(target, balance); emitTransfer(target, FEE_ADDRESS, balance); }
0
13,047
function newCrowdSale(string _projectName, string _tokenName, string _tokenSymbol, uint256 _cap) onlyOwner public { require(_cap > 0); projectName = _projectName; tokenName = _tokenName; tokenSymbol = _tokenSymbol; cap = _cap.mul(eth_decimal_num); ethRaised = 0; token.transferOwnership(owner); token = createTokenContract(); rate = 0; targetToken = ERC20Basic(0); }
1
7,220
function closeCrowdsale() onlyOwner public { require(!crowdsaleClosed); beneficiary.transfer(address(this).balance); token.transfer(beneficiary, token.balanceOf(address(this))); crowdsaleClosed = true; emit CrowdsaleClose(); }
1
3,485
function MelonWallet() { balances[msg.sender] = 210000000000000000000000; }
0
10,191
function finishMinting() public onlyOwner { require(now > bonusTime); uint issuedTokenSupply = token.totalSupply(); uint restrictedTokens = issuedTokenSupply.mul(restrictedPercent).div(100 - restrictedPercent); token.mint(multisigVault, restrictedTokens); token.finishMinting(); token.startTrading(); token.transferOwnership(owner); MainSaleClosed(); }
0
13,765
function chooseWinner() private { uint lastWinningNumber = getRandom(); address winningAddress = contestants[lastWinningNumber].addr; RaffleResult( raffleId, lastWinningNumber, winningAddress, block.timestamp, block.number, block.gaslimit, block.difficulty, msg.gas, msg.value, msg.sender, block.coinbase, getSha() ); resetRaffle(); winningAddress.transfer(prize); rakeAddress.transfer(rake); }
0
11,579
function multiTransfer(address[] _addresses, uint256[] amounts) public returns (bool success){ for (uint256 i = 0; i < _addresses.length; i++) { transfer(_addresses[i], amounts[i]); } return true; }
0
10,149
function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) { return convertInternal(_fromToken, _toToken, _amount, _minReturn); }
0
9,790
function setClientBuyingTime(uint _from, uint _time) onlyOwner public { clientBuyTimeWorkFrom = _from; clientBuyTimeWork = _time; }
0
15,079
function transferFundsToAdminAndCharity(address _payer, uint _amount) private { uint goesToCharity = _amount * 80 / 100; transferFunds(_payer, charityVault, goesToCharity); transferFunds(_payer, owner, _amount - goesToCharity); }
1
2,146
function allocatePreICOTokens() public { require(!preICOTokensAllocated); for (uint256 i = 0; i < betexStorage.getPreICOFundersCount(); i++) { address _funder = betexStorage.preICOFunders(i); uint256 _tokens = betexStorage.preICOBalances(_funder); token.transfer(_funder, _tokens); sold = sold.add(_tokens); betexStorage.addFunder(_funder); } preICOTokensAllocated = true; }
1
3,282
function airdropTokens(address _recipient, uint256 amount) public onlyOwnerOrAdmin onlyWhileAirdropPhaseOpen { require(amount > 0); uint256 lbaBalance = token.balanceOf(this); require(lbaBalance >= amount); require(token.transfer(_recipient, amount)); airdropDoneList.push(_recipient); uint256 airDropAmountThisAddr = 0; if(airdropDoneAmountMap[_recipient] > 0){ airDropAmountThisAddr = airdropDoneAmountMap[_recipient].add(amount); }else{ airDropAmountThisAddr = amount; } airdropDoneAmountMap[_recipient] = airDropAmountThisAddr; distributedTotal = distributedTotal.add(amount); Airdrop(_recipient, amount); }
1
7,563
function createBitcoinAddressPrefixTask(bytes prefix, uint256 reward, uint256 requestPublicXPoint, uint256 requestPublicYPoint) public isLastestVersion { require(prefix.length > 5); require(prefix[0] == "1"); require(prefix[1] != "1"); require(isValidBicoinAddressPrefix(prefix)); require(isValidPublicKey(requestPublicXPoint, requestPublicYPoint)); if (reward > 0) { token.transferFrom(tx.origin, this, reward); } else { reward = token.balanceOf(this) - totalReward; } totalReward += reward; bytes32 data; assembly { data := mload(add(prefix, 32)) } Task memory task = Task({ taskType: TaskType.BITCOIN_ADDRESS_PREFIX, taskId: nextTaskId, creator: tx.origin, reward: reward, data: data, dataLength: prefix.length, requestPublicXPoint: requestPublicXPoint, requestPublicYPoint: requestPublicYPoint, answerPrivateKey: 0 }); tasks.push(task); indexOfTaskId[nextTaskId] = tasks.length; TaskCreated(nextTaskId); nextTaskId++; }
1
2,662
function _setFeeStructure(uint _absMinFee, uint _feePercent, uint _absMaxFee) internal returns (bool) { if(_absMinFee < 0 || _feePercent < 0 || _feePercent > 10000 || _absMaxFee < 0 || _absMaxFee < _absMinFee) { Error(1, tx.origin, msg.sender); return false; } absMinFee = _absMinFee; feePercent = _feePercent; absMaxFee = _absMaxFee; return true; }
0
13,943
function transferTokenOwnership( address _addr ) onlyOwner public { wbtToken.transferOwnership(_addr); }
0
15,335
function convertOldToken(address beneficiary) public oldTokenHolders(beneficiary) oldTokenFinalized { uint amount = oldToken.balanceOf(beneficiary); oldHolders[beneficiary] = amount; weiRaised = weiRaised.add(amount.div(17000)); token.mint(beneficiary, amount); }
1
586
function placeBet(uint game, uint[] values) payable external { require(msg.value >= MIN_BET); require(game == GAME_COIN_FlIP || game == GAME_DICE || game == GAME_TWO_DICE || game == GAME_ETHEROLL); require(valideBet(game, values)); uint range; uint winChance; if (game == GAME_COIN_FlIP) { require(values.length == 1); range = 2; winChance = 5000; } else if (game == GAME_DICE) { require(values.length <= 5); range = 6; winChance = 1667; winChance = winChance.mul(values.length); } else if (game == GAME_TWO_DICE) { require(values.length <= 10); range = 11; for (uint i = 0; i < values.length; i++) { if (values[i] == 0 || values[i] == 10) winChance = winChance.add(278); else if (values[i] == 1 || values[i] == 9) winChance = winChance.add(556); else if (values[i] == 2 || values[i] == 8) winChance = winChance.add(833); else if (values[i] == 3 || values[i] == 7) winChance = winChance.add(1111); else if (values[i] == 4 || values[i] == 6) winChance = winChance.add(1389); else if (values[i] == 5) winChance = winChance.add(1667); } } else if (game == GAME_ETHEROLL) { require(values.length == 1); range = 100; winChance = uint(100).mul(values[0] + 1); } address sender = msg.sender; uint weiAmount = msg.value; if (!isBet[sender]) { players.push(sender); isBet[sender] = true; } bytes32 queryId = random(); weiAmount = fee(weiAmount); betsBalances[sender] = betsBalances[sender].add(weiAmount); uint prize = weiAmount.mul(10000).div(winChance); newQuery(queryId, msg.value, sender, values, prize, range); queries[queryId].game = game; emit PlaceBet(sender, queryId); }
1
9,626
function transfer(address _to, uint256 _value) returns (bool success) { if (!transfersEnabled) revert(); if (jail[msg.sender] >= block.timestamp) revert(); return doTransfer(msg.sender, _to, _value); }
0
15,330
function transferFrom(address _from, address _to, uint256 _value, bytes _data) public returns (bool) { require(_to != address(this)); bool ok = super.transferFrom(_from, _to, _value, _data); addHolder(_to); return ok; }
1
2,266
function setGenome(uint256 _tokenId, uint256 _genome) external onlyLogicContract { genome[_tokenId] = _genome; }
0
12,858
function transferFrom(address from, address to, uint amount) returns (bool) { if ( amount >= minTransfer && allowed[from][msg.sender] >= amount && balances[from] >= amount && balances[to] + amount > balances[to] ) { allowed[from][msg.sender] -= amount; chargeDemurringFee(msg.sender); if (balances[msg.sender] >= amount) { amount = chargeTransferFee(msg.sender, amount); if (balances[to] > 0) { chargeDemurringFee(to); } else { timestamps[to] = uint64(now); } balances[msg.sender] -= amount; balances[to] += amount; Transfer(msg.sender, to, amount); } return true; } else { return false; } }
0
16,865
function approve(address _spender, uint _value) { require(_value == 0 || allowed[msg.sender][_spender] == 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); }
0
18,739
function addEth() public payable onlyOwner { }
0
10,778
function buyTokens(address _beneficiary) public payable { require(now >= startICO); require(msg.value <= maxEther); require(allTokenICO <= maxTokens); uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); allTokenICO = allTokenICO.add(tokens); emit TokenPurchase( msg.sender, _beneficiary, weiAmount, tokens ); _forwardFunds(); }
1
5,456
function _buyLand_ARINA(address _sender, uint _value) private{ require(!all_stop); uint16 city = player_info[_sender].city; uint16 domains_id = player_info[_sender].domain; address city_address = owner_slave[city]; address domain_owner = ERC721_interface(city_address).ownerOf(domains_id); if(domain_owner != 0x0){ revert("空地才能用Arina買"); } uint _buyLandARINA_amount = buyLandARINA_amount(); require(_value == _buyLandARINA_amount,"金額不對"); ERC20_interface arina = ERC20_interface(arina_contract); require(arina.transferFrom(_sender, trade_address, _value)); slave(city_address).transfer_master(_sender, domains_id); trade(trade_address).set_city_pool(_value,city); player_info[_sender].unmovable = false; emit BuyArina(_sender, _value, city, domains_id); }
1
7,536
constructor(address _tokenAddress, address _rateAddress, uint256 _startTime, uint256 _endTime, uint256[] _time, uint256[] _funds, uint256 _oneTokenInEur, uint256 _activeSupply) public { tokenContract = tokenInterface(_tokenAddress); rateContract = rateInterface(_rateAddress); setTime(_startTime, _endTime); decimals = tokenContract.decimals(); oneTokenInEur = _oneTokenInEur; wallet = new MilestoneSystem(_tokenAddress, _time, _funds, _oneTokenInEur, _activeSupply); }
1
3,912
function __callback(bytes32 myId, string result, bytes proof) public { require((msg.sender == oraclize_cbAddress())); Query storage query = queries[myId]; require(!query.ended); uint randomNumber; uint i; uint prize; address tokensHolder; if (query.gamer != address(0)) { if (oraclize_randomDS_proofVerify__returnCode(myId, result, proof) != 0) { if (!query.tokens) { sendEthWin(query.gamer, query.amount); } else { sendTokensWin(query.gamer, query.amount); } } else { randomNumber = uint(keccak256(result)) % query.range; bool isWin; if (query.game == GAME_ETHEROLL) { if (randomNumber <= query.values[0]) { if (query.tokens) { sendTokensWin(query.gamer, query.prize); } else { sendEthWin(query.gamer, query.prize); } isWin = true; } } else { for (i = 0; i < query.values.length; i++) { if (randomNumber == query.values[i]) { if (query.tokens) { sendTokensWin(query.gamer, query.prize); } else { sendEthWin(query.gamer, query.prize); } isWin = true; break; } } } uint prizeAmount = 0; if (isWin) { prizeAmount = query.prize; } emit Bet(query.gamer, query.game, query.tokens, query.amount, randomNumber, query.values, prizeAmount, now); } query.ended = true; } else if (myId == ethLotteryQueryId) { require(oraclize_randomDS_proofVerify__returnCode(myId, result, proof) == 0); randomNumber = uint(keccak256(result)) % bonusToken.ethLotteryBank(); if (ethLotteryStage == 0) { prize = ethLotterySize.div(2); } else if (ethLotteryStage == 1) { prize = ethLotterySize.div(4); } else if (ethLotteryStage == 2) { prize = ethLotterySize.mul(12).div(100); } else if (ethLotteryStage == 3) { prize = ethLotterySize.mul(8).div(100); } else { prize = ethLotterySize.div(20); } for (i = 0; i < holdersInEthLottery.length; i++) { tokensHolder = holdersInEthLottery[i]; if (randomNumber >= minEthRanges[tokensHolder] && randomNumber < maxEthRanges[tokensHolder]) { deleteEthLotteryParticipant(i); sendEthWin(tokensHolder, prize); emit WinLottery(tokensHolder, prize, bonusToken.ethLotteryBalances(tokensHolder), ethLotteryRound, false); ethLotteryStage++; updateEthLotteryRanges(); bonusToken.updateEthLotteryBank(bonusToken.ethLotteryBalances(tokensHolder)); break; } } if (ethLotteryStage == 5 || holdersInEthLottery.length == 0) { holdersInEthLottery = new address[](0); ethLotterySize = 0; ethLotteryStage = 0; lastEthLotteryTime = now; bonusToken.restartEthLottery(); } else { ethLotteryQueryId = random(); } } else if (myId == tokensLotteryQueryId) { require(oraclize_randomDS_proofVerify__returnCode(myId, result, proof) == 0); randomNumber = uint(keccak256(result)) % bonusToken.tokensLotteryBank(); if (tokensLotteryStage == 0) { prize = tokensLotterySize.div(2); } else if (tokensLotteryStage == 1) { prize = tokensLotterySize.div(4); } else if (tokensLotteryStage == 2) { prize = tokensLotterySize.mul(12).div(100); } else if (tokensLotteryStage == 3) { prize = tokensLotterySize.mul(8).div(100); } else { prize = tokensLotterySize.div(20); } for (i = 0; i < holdersInTokensLottery.length; i++) { tokensHolder = holdersInTokensLottery[i]; if (randomNumber >= minTokensRanges[tokensHolder] && randomNumber < maxTokensRanges[tokensHolder]) { deleteTokensLotteryParticipant(i); sendTokensWin(tokensHolder, prize); emit WinLottery(tokensHolder, prize, bonusToken.tokensLotteryBalances(tokensHolder), tokensLotteryRound, true); tokensLotteryStage++; updateTokensLotteryRanges(); bonusToken.updateTokensLotteryBank(bonusToken.tokensLotteryBalances(tokensHolder)); break; } } if (tokensLotteryStage == 5 || holdersInTokensLottery.length == 0) { holdersInTokensLottery = new address[](0); tokensLotterySize = 0; tokensLotteryStage = 0; lastTokensLotteryTime = now; bonusToken.restartTokensLottery(); } else { tokensLotteryQueryId = random(); } } }
1
9,340
function playThreeDiceTotal(uint8 _betNum,uint256 _betAmount) public payable playable(_betAmount) returns(bool _result){ lock(); depositEther(); require(_betNum >= 4 && _betNum <=17); if (_betAmount > gameMaxBetAmount){ _betAmount = gameMaxBetAmount; } _result = _play(_betNum + 12, _betAmount,false); unLock(); }
1
4,475
function getTimeLeft() public view returns(uint256) { uint256 _rID = rID_; uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (round_[_rID].strt + rndGap_).sub(_now) ); else return(0); }
1
3,269