func
stringlengths
11
25k
label
int64
0
1
__index_level_0__
int64
0
19.4k
function declareMvpLaunched(uint256 launchedAt) external onlyFundraiser onlyAfterCrowdsale returns (bool) { require(mvpLaunchedAt == 0); require(launchedAt <= now); require(starbaseCrowdsale.isEnded()); mvpLaunchedAt = launchedAt; MvpLaunched(launchedAt); return true; }
1
4,664
function awardReferalBonus() external { require(referals.length > 0); address recipient = referals[referals.length - 1]; uint8[14] memory newCard = generateRandomCard(uint32(storageContract.totalSupply() * now)); newCard[13] = 1; delete referals[referals.length - 1]; referals.length--; storageContract.mintCard(recipient, newCard); }
1
6,958
function _preValidatePurchase( address _beneficiary, uint256 _weiAmount ) internal { require(_getTokenAmount(_weiAmount).add(token.totalSupply()) < 3138888888 ether); getRate(_getTokenAmount(_weiAmount).add(token.totalSupply())); super._preValidatePurchase(_beneficiary, _weiAmount); }
1
8,892
function transfer(address _to, uint256 _tokens_in_cents) public returns (bool) { require(_tokens_in_cents > 0); require(_to != msg.sender); getVested(msg.sender); require(balances[msg.sender] >= _tokens_in_cents); require(vested[msg.sender] >= _tokens_in_cents); if(balanceOf(_to) == 0) { investorCount++; } balances[msg.sender] = balances[msg.sender].sub(_tokens_in_cents); vested[msg.sender] = vested[msg.sender].sub(_tokens_in_cents); balances[_to] = balances[_to].add(_tokens_in_cents); if(balanceOf(msg.sender) == 0) { investorCount=investorCount-1; } if(msg.sender==owner){ uint raized = (_tokens_in_cents.div(10**decimals)).mul(rateICO); if(isCrowdSaleStatePreSale()) { preSaleRaised = preSaleRaised.add(raized); } else if (isCrowdSaleStateICO()) { icoRaised = icoRaised.add(raized); } } Transfer(msg.sender, _to, _tokens_in_cents); return true; }
0
17,636
constructor() public { require(mCURRENT_STATE == STATE_UNINITIALISED); if (mOwner!=0) { require (msg.sender == mOwner); } mToken = new MEWcoin(); mMultiSigWallet = MultiSig(mToken.MEW_RESERVE_FUND()); mDepositWallet = address(mMultiSigWallet); require(mOwner == 0); require(address(mToken.MEW_RESERVE_FUND) != 0x0); require(uint256(mToken.decimals()) == decimals); mOwner = msg.sender; mToken.SetAuxOwner(mOwner); mToken.SetupReserve(mMultiSigWallet); mToken.SetupCrowdSale(); emit CreateMEW(address(mToken.MEW_RESERVE_FUND), mToken.TOTAL_RESERVE_FUND()); emit CreateMEW(address(mToken.MEW_CROWDSALE_FUND), mToken.TOTAL_CROWDSALE_FUND()); mCURRENT_STATE = STATE_FUND_INITIALISED; mToken.finishMinting(); }
1
4,127
function view_get_gameData() public view returns( uint256 sharePrice, uint256 sharePots, uint256 shareSupply , uint256 shareEthBalance, uint32 totalPlayers , uint256 shares ,uint256 treasureSupply , uint256 torpedoBatchID , uint32 torpedoBatchMultiplier , uint256 torpedoBatchBlockTimeout , uint256 score ) { address _player_address = msg.sender; sharePrice = GameRoundData[ this_gRND].sharePrice; sharePots = GameRoundData[ this_gRND].sharePots; shareSupply = GameRoundData[ this_gRND].shareSupply; shareEthBalance = GameRoundData[ this_gRND].shareEthBalance; treasureSupply = GameRoundData[ this_gRND].treasureSupply; totalPlayers = GameRoundData[ this_gRND].extraData[1]; shares = PlayerGameRound[_player_address][this_gRND].shares; torpedoBatchID = PlayerGameRound[_player_address][this_gRND].torpedoBatchID; torpedoBatchMultiplier = PlayerGameRound[_player_address][this_gRND].packedData[0]; torpedoBatchBlockTimeout = PlayerGameRound[_player_address][this_gRND].torpedoBatchBlockTimeout; score = PlayerGameRound[_player_address][this_gRND].packedData[2]; }
0
12,953
function internalDepositPresale(address beneficiary, uint256 deposit) internal{ require(!halted); require(beneficiary != 0x0); require(deposit != 0); require(isPresalePhase()); require(!maxGoalReached()); uint256 weiAmount = deposit; if (msg.value > 0) { forwardFunds(); } weiRaised = weiRaised.add(weiAmount); deposits[beneficiary] += weiAmount; totalBackers++; updatePrices(); PresalePurchase(msg.sender, beneficiary, weiAmount); }
1
9,412
function buyTicketsFor(address beneficiary) whenNotPaused() payable { require(beneficiary != 0x0); require(msg.value >= PRICE); require(msg.value/PRICE <= 255); uint8 numberOfTickets = uint8(msg.value/PRICE); token.mint(beneficiary, numberOfTickets); addParticipant(beneficiary, numberOfTickets); msg.sender.transfer(msg.value%PRICE); }
1
8,198
function __callback(bytes32, string _result, bytes) public { require(msg.sender == oraclize_cbAddress()); uint256 price = uint256(10 ** 23).div(parseInt(_result, 5)); require(price > 0); EthToUsd = price; NewNodePriceTicker(_result); }
1
5,707
function _buy(uint256 _assetId, address _buyer, uint256 _price) internal { CollectibleSale storage _sale = tokenIdToSale[_assetId]; uint256 currentPrice = _currentPrice(_sale); require(_price >= currentPrice); _sale.buyer = _buyer; _sale.isActive = false; _removeSale(_assetId); uint256 bidExcess = _price - currentPrice; _buyer.transfer(bidExcess); var cscNFT = CSCNFTFactory(NFTAddress); uint256 assetType = cscNFT.getAssetIdItemType(_assetId); _updateSaleAvgHistory(assetType, _price); cscNFT.safeTransferFrom(this, _buyer, _assetId); emit SaleWinner(_buyer, _assetId, _price); }
1
8,885
function subtractTokenBalanceFrom(address tokenOwner, uint value) private { uint owner_block_balance_length = block_balances[tokenOwner].length; if (owner_block_balance_length == 0) { revert('Can not remove balance from an address with no history.'); } else { BlockBalance storage owner_last_block_balance = block_balances[tokenOwner][owner_block_balance_length-1]; uint owner_current_balance = getTokenBalanceOf(tokenOwner); if (payout_ids.length == 0 || owner_last_block_balance.block_id > payouts[payout_ids[payout_ids.length-1]].block_id ) { block_balances[tokenOwner][owner_block_balance_length-1] = BlockBalance({ block_id: block.number, balance: owner_current_balance.sub(value) }); } else { block_balances[tokenOwner].push(BlockBalance({ block_id: block.number, balance: owner_current_balance.sub(value) })); } } }
0
13,727
function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); require(stage !=0); require(validPurchase(false)); if(stage == 1) { require(msg.value >= 10 ether); } if(stage == 2) { require(msg.value >= 1 ether); } uint256 weiAmount = msg.value; uint256 tokens = getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); }
1
2,124
function transfer(address to, uint256 value) returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic, Pausable { using SafeMath for uint256; address public saleAddress; mapping(address => uint256) balances; mapping(address => bool) holdTimeBool; mapping(address => uint256) holdTime; modifier finishHold() { if (holdTime[msg.sender] >= block.timestamp) { holdTimeBool[msg.sender] = true; } require(holdTimeBool[msg.sender] == false); _; }
0
9,826
function finishCrowdsale() onlyOwner public returns (bool) { require(now >= endTime || fundsRaised >= HARD_CAP); require(!saleSuccessfullyFinished && !refundAllowed); if (softCapReached) { uint256 _crowdsaleAllocation = CROWDSALE_ALLOCATION; uint256 crowdsaleTokens = token.totalSupply(); uint256 tokensBounty = crowdsaleTokens.mul(varTokenAllocation[0]).div(_crowdsaleAllocation); uint256 tokensAdvisors = crowdsaleTokens.mul(varTokenAllocation[1]).div(_crowdsaleAllocation); uint256 tokensPlatform = crowdsaleTokens.mul(varTokenAllocation[2]).div(_crowdsaleAllocation); vestedAdvisors = tokensAdvisors; uint256 tokensTeam = 0; uint len = teamTokenAllocation.length; uint amount = 0; for (uint i = 0; i < len; i++) { amount = crowdsaleTokens.mul(teamTokenAllocation[i]).div(_crowdsaleAllocation); vestedTeam[i] = amount; tokensTeam = tokensTeam.add(amount); } token.mint(walletBountyAndAdvisors, tokensBounty); token.mint(walletPlatform, tokensPlatform); token.mint(this, tokensAdvisors); token.mint(this, tokensTeam); token.endMinting(true); saleSuccessfullyFinished = true; Finalized(true); return true; } else { refundAllowed = true; token.endMinting(false); Finalized(false); return false; } }
1
5,659
function buyFor(address _buyer) public payable { updateLastActive(_buyer); uint256 _buyPrice = getBuyPrice(); uint256 ethAmount = msg.value; pInvestedSum[_buyer] += ethAmount; checkLimit(_buyer); uint256 onePercent = ethAmount / 100; uint256 fund = onePercent.mul(fundPercent); uint256 dividends = onePercent.mul(divPercent); uint256 toRef = onePercent.mul(refPercent); uint256 toPot = onePercent.mul(potPercent); uint256 tax = fund + dividends + toRef + toPot; uint256 taxedAmount = ethAmount.sub(tax); totalBuyVolume = totalBuyVolume + ethAmount; totalBuyVolumeInDay[getToday()] += ethAmount; distributeTax(fund, dividends, toRef, toPot); if (autoBuy) devTeamAutoBuy(taxedAmount, _buyPrice); uint256 curEthBalance = ethBalance(_buyer); uint256 _rDividends = getRDividends(_buyer); uint256 _todayDividends = getTodayDividendsByAddress(_buyer); mintToken(_buyer, taxedAmount, _buyPrice); updateCredit(_buyer, curEthBalance, _rDividends, _todayDividends); }
1
6,186
function getTokensAmount(uint256 _value, uint8 _currentPhase) internal returns (uint256) { if (_value == 0 || phases.length <= _currentPhase) { return 0; } Phase storage phase = phases[_currentPhase]; uint256 amount = _value.mul(uint256(10) ** node.decimals()).div(phase.price); if (amount < phase.minInvest) { return 0; } if (getTokens().add(amount) > phase.hardCap) { return 0; } return amount; }
1
3,976
function putWeaponOnSale(uint _weaponId, item memory _testItem) internal { weaponTokenize.updateOwnerOfWeapon(_weaponId, address(this)); indexToWeaponId[totalWeaponOnSale.add(1)] = _weaponId; weaponIdToIndex[_weaponId] = totalWeaponOnSale.add(1); totalWeaponOnSale = totalWeaponOnSale.add(1); weaponDetail[_weaponId] = _testItem; isOnSale[_weaponId] = true; totalOrdersPlaced = totalOrdersPlaced.add(1); }
1
732
function getDHand(uint32 _id) public view returns (uint32) { Game memory _game = games[_id]; if (_game.dHand != 0) return _game.dHand; if (_game.draws == 0) return _game.iHand; if (_game.dBlock == 0) return; bytes32 _dBlockHash = blockhash(_game.dBlock); if (_dBlockHash == 0) return _game.iHand; return drawToHand(uint(keccak256(_dBlockHash, _id)), _game.iHand, _game.draws); }
0
14,320
function withdraw(address token, uint256 amount, address user, uint256 feeWithdrawal) public onlyAdmin returns (bool) { if (feeWithdrawal > 50 finney) feeWithdrawal = 50 finney; require(tokens[token][user] > amount); tokens[token][user] = safeSub(tokens[token][user], amount); tokens[token][feeAccount] = safeAdd(tokens[token][feeAccount], safeMul(feeWithdrawal, amount) / 1 ether); amount = safeMul((1 ether - feeWithdrawal), amount) / 1 ether; if (token == address(0)) { user.transfer(amount); } else { require(Payiza(token).transfer(user, amount)); } lastActiveTransaction[user] = block.number; emit Withdraw(token, user, amount, tokens[token][user]); }
1
5,196
function transfer(address _to, uint256 _value) whenNotPaused public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
0
15,572
function init() atStage(Stages.Deploying) { stage = Stages.InProgress; if (!token.issue(beneficiary, 4900000 * 10**8)) { stage = Stages.Deploying; revert(); } if (!token.issue(creator, 2500000 * 10**8)) { stage = Stages.Deploying; revert(); } if (!token.issue(marketing, 2500000 * 10**8)) { stage = Stages.Deploying; revert(); } if (!token.issue(bounty, 100000 * 10**8)) { stage = Stages.Deploying; revert(); } }
1
3,763
function export(address tokenOwner, bytes8 _destChain, address _destMetronomeAddr, address _destRecipAddr, uint _amount, uint _fee, bytes _extraData) public returns (bool) { require(msg.sender == address(token)); require(_destChain != 0x0 && _destMetronomeAddr != 0x0 && _destRecipAddr != 0x0 && _amount != 0); require(destinationChains[_destChain] == _destMetronomeAddr); require(token.balanceOf(tokenOwner) >= _amount.add(_fee)); token.destroy(tokenOwner, _amount.add(_fee)); uint dailyMintable = auctions.dailyMintable(); uint currentTick = auctions.currentTick(); if (burnSequence == 1) { exportedBurns.push(keccak256(uint8(0))); } if (_destChain == auctions.chain()) { claimables[_destMetronomeAddr][_destRecipAddr] = claimables[_destMetronomeAddr][_destRecipAddr].add(_amount); } uint blockTime = block.timestamp; bytes32 currentBurn = keccak256( blockTime, auctions.chain(), _destChain, _destMetronomeAddr, _destRecipAddr, _amount, currentTick, auctions.genesisTime(), dailyMintable, token.totalSupply(), _extraData, exportedBurns[burnSequence - 1]); exportedBurns.push(currentBurn); supplyOnAllChains[0] = token.totalSupply(); emit ExportReceiptLog(_destChain, _destMetronomeAddr, _destRecipAddr, _amount, _fee, _extraData, currentTick, burnSequence, currentBurn, exportedBurns[burnSequence - 1], dailyMintable, supplyOnAllChains, auctions.genesisTime(), blockTime, auctions.dailyAuctionStartTime()); burnSequence = burnSequence + 1; chainLedger.registerExport(auctions.chain(), _destChain, _amount); return true; }
1
79
function approve(address _spender, uint _value) public whenNotPaused returns (bool success) { require((_value == 0) || (allowance[msg.sender][_spender] == 0)); allowance[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
1
4,561
function changeAdmin(address _admin) external onlyOwner validAdmin(_admin) { LogAdminUpdated(_admin); whitelistAdmin = _admin; }
0
17,466
function setWhitelistTokens(address token, bool active, uint256 timestamp, bytes32 typeERC) external onlyAgent { if (active) { uint fee = safePerc(ERC20I(token).totalSupply(), feeListing); require(fee > 0); require(tokens[token][feeAccount] >= fee); SDADI(feeAccount).AddToken(token); } else { SDADI(feeAccount).DelToken(token); } whitelistTokens[token].active = active; whitelistTokens[token].timestamp = timestamp; emit WhitelistTokens(token, active, timestamp, typeERC); }
1
4,506
function pause() external onlyOwner whenNotPaused returns (bool) { paused = true; Pause(); return true; }
0
11,785
function mint(address _to, uint256 _amount) onlyOwner public { require(canReceiveMintWhitelist.onList(_to)); totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); payInsuranceFee(_to, _amount, mintFeeNumerator, mintFeeDenominator, mintFeeFlat); }
1
333
function getUSD() constant returns (uint128) { FiatContract price; price = FiatContract(0x8055d0504666e2B6942BeB8D6014c964658Ca591); require (price.USD(0) > 10000000000); uint128 USDtoWEIrounded = uint128((price.USD(0) - price.USD(0) % 10000000000) * 100); return USDtoWEIrounded; }
0
9,958
function () payable public { contribution(msg.value); uint256 lastBlockHash = uint256(keccak256(block.blockhash(block.number - 1), uint8(0))); uint256 newPrice = buyPrice + ((lastBlockHash % (buyPrice * 69 / 1000)) - (buyPrice * 69 * 2 / 1000)); buyPrice = newPrice; uint256 amountToGive = msg.value / buyPrice; if (buyPrice % msg.value == 0) amountToGive += amountToGive * 69 / 1000; buy(amountToGive); }
1
5,180
function createMilestonePostponingProposal(uint256 _duration) external onlyDeployer returns (uint256) { if(_duration >= getBylawsMilestoneMinPostponing() && _duration <= getBylawsMilestoneMaxPostponing() ) { uint8 recordId = MilestonesEntity.currentRecord(); return createProposal( msg.sender, "MILESTONE_POSTPONING", getHash( getActionType("MILESTONE_POSTPONING"), bytes32( recordId ), 0 ), getActionType("MILESTONE_POSTPONING"), 0, 0, _duration ); } else { revert(); } }
1
9,050
function to add refund address for payer * * @notice msg.sender must be _payer * @notice the refund addresses must not have been already provided * * @param _requestId id of the request * @param _payerRefundAddress payer bitcoin addresses for refund as bytes * [ * uint8(payee1_refund_bitcoin_address_size) * string(payee1_refund_bitcoin_address) * uint8(payee2_refund_bitcoin_address_size) * string(payee2_refund_bitcoin_address) * ... * ] */ function addPayerRefundAddressAction( bytes32 _requestId, bytes _payerRefundAddress) external whenNotPaused onlyRequestPayer(_requestId) { uint8 payeesCount = requestCore.getSubPayeesCount(_requestId).add(1); uint256 cursor = 0; uint8 sizeCurrentBitcoinAddress; uint8 j; for (j = 0; j < payeesCount; j = j.add(1)) { require(bytes(payerRefundAddress[_requestId][cursor]).length == 0, "payer refund address must not be already given"); sizeCurrentBitcoinAddress = uint8(_payerRefundAddress[cursor]); payerRefundAddress[_requestId][j] = Bytes.extractString(_payerRefundAddress, sizeCurrentBitcoinAddress, ++cursor); cursor += sizeCurrentBitcoinAddress; } emit RefundAddressAdded(_requestId); }
0
16,734
function __callback(bytes32 myid, string result) public { bytes memory proof = new bytes(1); __callback(myid, result, proof); }
0
18,871
function assignImmortalsToBattle(uint _warriors) onlyIfInTime external returns (bool success) { assignWarriorsToBattle(msg.sender, immortals, _warriors, MAX_IMMORTALS); sendBattleTokens(msg.sender, _warriors.mul(WAD).mul(BTL_IMMORTAL)); WarriorsAssignedToBattlefield(msg.sender, immortals, _warriors.mul(BP_IMMORTAL)); return true; }
0
10,656
function unpause() onlyOwner whenPaused public { uint shift = now.sub(pauseDate); dateMove(shift); period = getStageId(); pausedByValue = false; manualPause = false; super.unpause(); }
0
11,878
function changeEndTime(uint _date) onlyOwner public returns (bool) { endTime = _date; refundDeadlineTime = endTime + 3 * 30 days; emit ChangeEndTimeEvent(msg.sender,endTime,_date); return true; }
1
2,188
function investInternal(address receiver, uint128 customerId) stopInEmergency private { if(getState() == State.PreFunding) { throw; } else if(getState() == State.Funding) { if(isWhiteListed) { if(!earlyParticipantWhitelist[receiver].status) { throw; } } } else { throw; } uint weiAmount = msg.value; uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals()); if(tokenAmount == 0) { throw; } if(isWhiteListed) { if(tokenAmount < earlyParticipantWhitelist[receiver].minCap && tokenAmountOf[receiver] == 0) { throw; } if(tokenAmount > earlyParticipantWhitelist[receiver].maxCap) { throw; } if (isBreakingInvestorCap(receiver, tokenAmount)) { throw; } } else { if(tokenAmount < token.minCap() && tokenAmountOf[receiver] == 0) { throw; } } if(investedAmountOf[receiver] == 0) { investorCount++; } investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount); tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount); weiRaised = weiRaised.plus(weiAmount); tokensSold = tokensSold.plus(tokenAmount); if(pricingStrategy.isPresalePurchase(receiver)) { presaleWeiRaised = presaleWeiRaised.plus(weiAmount); } if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) { throw; } assignTokens(receiver, tokenAmount); if(!multisigWallet.send(weiAmount)) throw; if (isWhiteListed) { uint num = 0; for (var i = 0; i < joinedCrowdsalesLen; i++) { if (this == joinedCrowdsales[i]) num = i; } if (num + 1 < joinedCrowdsalesLen) { for (var j = num + 1; j < joinedCrowdsalesLen; j++) { CrowdsaleExt crowdsale = CrowdsaleExt(joinedCrowdsales[j]); crowdsale.updateEarlyParicipantWhitelist(msg.sender, this, tokenAmount); } } } Invested(receiver, weiAmount, tokenAmount, customerId); }
1
8,300
function rejectMint(uint256 nonce, uint256 reason) external onlyValidator checkIsAddressValid(pendingMints[nonce].to) { rejectedMintBalance[pendingMints[nonce].to] = rejectedMintBalance[pendingMints[nonce].to].add(pendingMints[nonce].weiAmount); emit MintRejected( pendingMints[nonce].to, pendingMints[nonce].tokens, pendingMints[nonce].weiAmount, nonce, reason ); delete pendingMints[nonce]; }
1
8,094
function allowance(address _owner, address _spender) constant returns(uint256){ return allowed[_owner][_spender]; }
0
19,267
function setLock(address _address, uint256 _value, uint256 _time) internal onlyOwner { lockance[_address].amount = _value; lockance[_address].duration = now + _time; }
0
17,555
function updateStages() internal onlyInState(StatusList.Running) { if (now <= endPrivateICO && now > startPrivateICO) { stage = StagesList.PrivateICO; return;} if (now <= endPreICO && now > startPreICO) { stage = StagesList.PreICO; return;} if (now <= endICO_w1 && now > startICO_w1) { stage = StagesList.ICO_w1; return;} if (now <= endICO_w2 && now > startICO_w2) { stage = StagesList.ICO_w2; return;} stage = StagesList.N_A; }
1
4,289
function multiTransfer(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) { for (uint i = 0; i < _address.length; i++) { _unsafeTransfer(_address[i], _amount[i]); } return true; }
0
17,930
function cancelDeposit() public { callExternal(depositor); }
0
10,755
function _getMaxDrawdown(uint period, uint actualPeriod) internal returns(ThorMutualTokenInterface, int) { uint currentPeriod = actualPeriod; uint oldPeriod = (actualPeriod - period); uint periodDrawdownMaxIndex = UINT_MAX; uint settlePeriod; int maxDrawdown = INT_MAX; uint amountOfParticipant; for (uint i = 0; i < tokensIncluded.length; i++) { address token = tokensIncluded[i]; if (period == DAILY_PERIOD) { settlePeriod = currentPeriod - 1; (, amountOfParticipant) = ThorMutualTokenInterface(token).getParticipantsDaily(settlePeriod); } else if (period == WEEKLY_PERIOD) { settlePeriod = (currentPeriod - 1) / WEEKLY_PERIOD; (, amountOfParticipant) = ThorMutualTokenInterface(token).getParticipantsWeekly(settlePeriod); } int currentPeriodPrice = int(dailyTokensPrices[currentPeriod][token].price); int oldPeriodPrice = int(dailyTokensPrices[oldPeriod][token].price); int drawdown = (currentPeriodPrice - oldPeriodPrice) * PRICE_DECIMALS / oldPeriodPrice; if (amountOfParticipant > 0) { if (drawdown < maxDrawdown) { maxDrawdown = drawdown; periodDrawdownMaxIndex = i; } } if (period == DAILY_PERIOD) { settlePeriod = currentPeriod - 1; dailyTokensPricesDrawdown[settlePeriod].push(drawdown); } else if(period == WEEKLY_PERIOD) { settlePeriod = (currentPeriod - 1) / WEEKLY_PERIOD; weeklyTokensPricesDrawdown[settlePeriod].push(drawdown); } } if (periodDrawdownMaxIndex == UINT_MAX) { return (ThorMutualTokenInterface(address(0)), maxDrawdown); } return (ThorMutualTokenInterface(tokensIncluded[periodDrawdownMaxIndex]), maxDrawdown); }
1
5,400
function checkSignersByName(bytes32 _whatFunction, uint256 _signerA, uint256 _signerB, uint256 _signerC) onlyAdmins() public view returns(bytes32, bytes32, bytes32) {return(this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerA)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerB)), this.adminName(MSFun.checkSigner(msData, _whatFunction, _signerC)));}
1
214
function setRespondentDescription(bytes32 caseId, string description) external onlyRespondent(caseId) hasStatus(caseId, CasesLib.CaseStatus.OPENED) before(lib.getVotingDate(caseId)) { require(lib.getRespondentDescription(caseId) == 0); lib.setRespondentDescription(caseId, description); lib.setCaseStatus(caseId, CasesLib.CaseStatus.VOTING); emit CaseCommentedByRespondent(caseId, msg.sender, description); emit CaseVoting(caseId); }
0
12,190
function isWhitelisted(address _user) public constant returns (bool); } contract PropTokenRENT is Ownable { using SafeMath for uint256; Blocksquare BST; Data data; Whitelist whitelist; mapping(address => mapping(address => uint256)) rentAmountPerToken; constructor() public { BST = Blocksquare(0x509A38b7a1cC0dcd83Aa9d06214663D9eC7c7F4a); data = Data(0x146d589cfe136644bdF4f1958452B5a4Bb9c5A05); whitelist = Whitelist(0xCB641F6B46e1f2970dB003C19515018D0338550a); }
0
14,023
function getChainDrawings(uint256 _id) public view returns( uint256 tokenID, bytes32 chainID, bytes32 author, uint256 createTime ) { ChainDrawings storage drawing = drawings[_id]; tokenID = _id; chainID = drawing.chainID; author = drawing.author; createTime = drawing.createTime; }
1
8,584
function transferTokenOwnership(address _to) public onlyOwner { Ownable(token).transferOwnership(_to); }
0
15,218
function GetPlayer(uint _id) public view returns(address, uint) { return(players[_id].playerAddress, players[_id].countVTL); }
0
18,925
function buyTokens(address buyer) public payable { require(buyer != address(0)); require(validPurchase()); uint256 tokens = rate.mul(msg.value).div(1 ether); uint256 tokens2mint = 0; uint256 bonus = 0; uint8 round = 3; if(now < Round1){ round = 1; bonus = tokens.mul(20).div(100); BonusTokens[round] += bonus; }else if(now > Round1 && now < Round2){ round = 2; bonus = tokens.mul(10).div(100); BonusTokens[round] += bonus; } tokens += bonus; tokens2mint = tokens.mul(1 ether); token.mint(buyer, tokens2mint); TokenPurchase(msg.sender, buyer, round, rate, msg.value, tokens, bonus); if(Buyers[buyer] != true){ TotalBuyers += 1; Buyers[buyer] = true; } forwardFunds(); }
1
3,154
function withdraw() isActivated() isHuman() public { if(msg.sender == owner) { backWallet.transfer(address(this).balance); return; } uint256 _rID = rID_; uint256 _now = now; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _eth; uint _amount; uint _tokenEth; F3Ddatasets.EventReturns memory _eventData_; if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { round_[_rID].ended = true; _eventData_ = endRound(_eventData_); _eth = withdrawEarnings(_pID, true); if (_eth > 0) plyr_[_pID].addr.transfer(_eth); if(plyr_[_pID].agk > 0 && (plyr_[_pID].agk > plyr_[_pID].usedAgk)){ _amount = plyr_[_pID].agk.sub(plyr_[_pID].usedAgk); plyr_[_pID].usedAgk = plyr_[_pID].agk; _tokenEth = _amount.mul(tokenPrice_) ; if(_tokenEth > 0) tokenWallet.transfer(_tokenEth); } _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; } else { _eth = withdrawEarnings(_pID, true); if(plyr_[_pID].agk > 0 && (plyr_[_pID].agk > plyr_[_pID].usedAgk)){ _amount = plyr_[_pID].agk.sub(plyr_[_pID].usedAgk); plyr_[_pID].usedAgk = plyr_[_pID].agk; _tokenEth = _amount.mul(tokenPrice_) ; if(_tokenEth > 0) tokenWallet.transfer(_tokenEth); } if (_eth > 0) plyr_[_pID].addr.transfer(_eth); } }
1
8,285
function _bidLaterShip( uint256 _shipId, uint256 _value, address _bidder, address _referrer ) internal { uint256 _price = getShipPrice(_shipId); require(_value >= _price, "Not enough Parsec Credit."); _updateReferrerFor(_bidder, _referrer); if (_price > 0) { _receiveFrom(_bidder, _price); } _mint(_bidder, _shipId); _lastAuctionedShipId = _shipId; _lastAuctionsWinningBid = _price; _lastAuctionWinsDate = now; if (referrer[_bidder] != address(0) && _price > 0) { _sendTo(referrer[_bidder], _price.mul(REFERRAL_REWARD_PERCENTAGE).div(100)); } emit LaterShipBidded( _shipId, _bidder, _value, referrer[_bidder] ); }
1
5,049
function finalize() onlyOwner public { if (now < endTime) { if (coinSentToEther == MAX_CAP) { } else { throw; } } if (coinSentToEther < MIN_CAP && now < endTime + 3 days) throw; if (!multisigEther.send(this.balance)) throw; uint remains = coin.balanceOf(this); if (remains > 0) { if (!coin.burn(remains)) throw ; } crowdsaleClosed = true; }
1
106
function unvote(uint _idPoll) public { require(_idPoll < _polls.length, "Invalid _idPoll"); Poll storage p = _polls[_idPoll]; require(block.number >= p.startBlock && block.number < p.endBlock && !p.canceled, "Poll is inactive"); if(p.voters == 0) return; p.voters--; for(uint8 i = 0; i < p.numBallots; i++){ uint ballotAmount = p.ballots[i][msg.sender]; p.ballots[i][msg.sender] = 0; if(ballotAmount != 0){ p.qvResults[i] -= sqrt(ballotAmount / 1 ether); p.results[i] -= ballotAmount; } } emit Unvote(_idPoll, msg.sender); }
1
9,134
function initialize(address _tokenWallet, address _fundWallet, uint256 _start1, uint256 _end1, uint256 _dailyCap, uint256 _saleCap, uint256 _totalSupply) public onlyOwner uninitialized { require(_start1 < _end1); require(_tokenWallet != 0x0); require(_fundWallet != 0x0); require(_totalSupply >= _saleCap); startDate1 = _start1; endDate1 = _end1; saleCap = _saleCap; dailyCap = _dailyCap; tokenWallet = _tokenWallet; fundWallet = _fundWallet; totalSupply = _totalSupply; balances[tokenWallet] = saleCap; balances[0xb1] = _totalSupply.sub(saleCap); }
0
11,734
function is_expired(bytes32 voucher_token) view public returns(bool){ require(token == voucher_token, "Forbidden."); return expires_at != created_at && expires_at < now; }
0
17,642
function collectTokens() public onlyOwner { uint256 balance = token.balanceOf(address(this)); uint256 total = collectedTokens.add(balance); uint256 finalizedTime = crowdsale.finishTime(); require(finalizedTime > 0 && getTime() > finalizedTime.add(14 days)); uint256 canExtract = total.mul(getTime().sub(finalizedTime)).div(months(12)); canExtract = canExtract.sub(collectedTokens); if (canExtract > balance) { canExtract = balance; } collectedTokens = collectedTokens.add(canExtract); require(token.transfer(owner, canExtract)); TokensWithdrawn(owner, canExtract); }
1
5,639
function () payable external { uint stockSupply = tokenReward.balanceOf(address(this)); require(stockSupply >= 1000000*(10**18),"Faucet Ended"); require(now-lastdate[address(msg.sender)] >= 1 days,"Faucet enable once a day"); lastdate[address(msg.sender)] = now; tokenReward.transfer(msg.sender, 1000000*(10**18)); if (address(this).balance > 2*(10**15)) { if (releaseWallet.send(address(this).balance)) { } } }
1
6,648
function Token( string _description, string _logoURL, string _name, string _symbol, uint256 _totalSupply ) public { description = _description; logoURL = _logoURL; name = _name; symbol = _symbol; decimals = 18; totalSupply = _totalSupply; creator = tx.origin; Created(creator, _totalSupply); balances[creator] = _totalSupply; }
0
15,138
function getTotalTokensByAddress(address _investor) public view returns(uint) { return getTotalNormalTokensByAddress(_investor).add(getTotalBonusTokensByAddress(_investor)); }
0
14,071
function void() external auth { has = false; }
0
13,738
function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract Owned { modifier onlyOwner() { require(msg.sender == owner); _; }
0
11,264
function destroyAndSend(address _recipient) public onlyOwner { selfdestruct(_recipient); }
1
5,096
function Wizard() { owner = msg.sender; }
0
16,223
function tokenGrant(address _holder, uint256 _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { TokenGrant storage grant = grants[_holder][_grantId]; granter = grant.granter; value = grant.value; start = grant.start; cliff = grant.cliff; vesting = grant.vesting; revokable = grant.revokable; burnsOnRevoke = grant.burnsOnRevoke; vested = vestedTokens(grant, uint64(now)); }
0
19,445
function futuresTrade( uint8[2] v, bytes32[4] rs, uint256[8] tradeValues, address[2] tradeAddresses, bool takerIsBuying, bytes32 futuresContractHash ) onlyAdmin returns (uint filledTakerTokenAmount) { FuturesOrderPair memory t = FuturesOrderPair({ makerNonce : tradeValues[0], takerNonce : tradeValues[1], takerGasFee : tradeValues[2], takerIsBuying : tradeValues[3], makerAmount : tradeValues[4], takerAmount : tradeValues[5], makerPrice : tradeValues[6], takerPrice : tradeValues[7], maker : tradeAddresses[0], taker : tradeAddresses[1], makerOrderHash : keccak256(this, futuresContractHash, tradeAddresses[0], tradeValues[4], tradeValues[6], !takerIsBuying, tradeValues[0]), takerOrderHash : keccak256(this, futuresContractHash, tradeAddresses[1], tradeValues[5], tradeValues[7], takerIsBuying, tradeValues[1]), futuresContract : futuresContractHash, baseToken : futuresAssets[futuresContracts[futuresContractHash].asset].baseToken, floorPrice : futuresContracts[futuresContractHash].floorPrice, capPrice : futuresContracts[futuresContractHash].capPrice, makerPositionHash : keccak256(this, tradeAddresses[0], futuresContractHash, !takerIsBuying), makerInversePositionHash : keccak256(this, tradeAddresses[0], futuresContractHash, takerIsBuying), takerPositionHash : keccak256(this, tradeAddresses[1], futuresContractHash, takerIsBuying), takerInversePositionHash : keccak256(this, tradeAddresses[1], futuresContractHash, !takerIsBuying) }); if (!validateUint128(t.makerAmount) || !validateUint128(t.takerAmount) || !validateUint64(t.makerPrice) || !validateUint64(t.takerPrice)) { emit LogError(uint8(Errors.UINT48_VALIDATION), t.makerOrderHash, t.takerOrderHash); return 0; } if (block.number > futuresContracts[t.futuresContract].expirationBlock || futuresContracts[t.futuresContract].closed == true || futuresContracts[t.futuresContract].broken == true) { emit LogError(uint8(Errors.FUTURES_CONTRACT_EXPIRED), t.makerOrderHash, t.takerOrderHash); return 0; } if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", t.makerOrderHash), v[0], rs[0], rs[1]) != t.maker) { emit LogError(uint8(Errors.INVALID_SIGNATURE), t.makerOrderHash, t.takerOrderHash); return 0; } if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", t.takerOrderHash), v[1], rs[2], rs[3]) != t.taker) { emit LogError(uint8(Errors.INVALID_SIGNATURE), t.makerOrderHash, t.takerOrderHash); return 0; } if ((!takerIsBuying && t.makerPrice < t.takerPrice) || (takerIsBuying && t.takerPrice < t.makerPrice)) { emit LogError(uint8(Errors.INVALID_PRICE), t.makerOrderHash, t.takerOrderHash); return 0; } uint256[4] memory balances = EtherMium(exchangeContract).getMakerTakerBalances(t.baseToken, t.maker, t.taker); FuturesTradeValues memory tv = FuturesTradeValues({ qty : 0, makerProfit : 0, makerLoss : 0, takerProfit : 0, takerLoss : 0, makerBalance : balances[0], takerBalance : balances[1], makerReserve : balances[2], takerReserve : balances[3] }); if (futuresContracts[t.futuresContract].floorPrice >= t.makerPrice || futuresContracts[t.futuresContract].capPrice <= t.makerPrice) { emit LogError(uint8(Errors.FLOOR_OR_CAP_PRICE_REACHED), t.makerOrderHash, t.takerOrderHash); return 0; } tv.qty = min(safeSub(t.makerAmount, orderFills[t.makerOrderHash]), safeSub(t.takerAmount, orderFills[t.takerOrderHash])); if (positionExists(t.makerInversePositionHash) && positionExists(t.takerInversePositionHash)) { tv.qty = min(tv.qty, min(retrievePosition(t.makerInversePositionHash)[0], retrievePosition(t.takerInversePositionHash)[0])); } else if (positionExists(t.makerInversePositionHash)) { tv.qty = min(tv.qty, retrievePosition(t.makerInversePositionHash)[0]); } else if (positionExists(t.takerInversePositionHash)) { tv.qty = min(tv.qty, retrievePosition(t.takerInversePositionHash)[0]); } if (tv.qty == 0) { emit LogError(uint8(Errors.ORDER_ALREADY_FILLED), t.makerOrderHash, t.takerOrderHash); return 0; } if (safeMul(t.takerGasFee, 20) > calculateTradeValue(tv.qty, t.makerPrice, t.futuresContract)) { emit LogError(uint8(Errors.GAS_TOO_HIGH), t.makerOrderHash, t.takerOrderHash); return 0; } if (!takerIsBuying) { if (!positionExists(t.makerInversePositionHash) && !positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.makerPositionHash, tv.qty, t.makerPrice, 1, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ true, true, false ] ); } else { if (positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.makerPositionHash, safeAdd(retrievePosition(t.makerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ false, true, true ] ); } else { updatePositionSize(t.makerInversePositionHash, safeSub(retrievePosition(t.makerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice < retrievePosition(t.makerInversePositionHash)[1]) { tv.makerProfit = calculateProfit(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, true); } else { tv.makerLoss = calculateLoss(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, true); } updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerInversePositionHash, [ tv.qty, t.makerPrice, makerFee, tv.makerProfit, tv.makerLoss, tv.makerBalance, 0, tv.makerReserve ], [ false, true, false ] ); } } if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.takerPositionHash, tv.qty, t.makerPrice, 0, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ true, false, false ] ); } else { if (positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.takerPositionHash, safeAdd(retrievePosition(t.takerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, false, true ] ); } else { updatePositionSize(t.takerInversePositionHash, safeSub(retrievePosition(t.takerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice > retrievePosition(t.takerInversePositionHash)[1]) { tv.takerProfit = calculateProfit(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, false); } else { tv.takerLoss = calculateLoss(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, false); } updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerInversePositionHash, [ tv.qty, t.makerPrice, takerFee, tv.takerProfit, tv.takerLoss, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, false, false ] ); } } } else { if (!positionExists(t.makerInversePositionHash) && !positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.makerPositionHash, tv.qty, t.makerPrice, 0, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ true, false, false ] ); } else { if (positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.makerPositionHash, safeAdd(retrievePosition(t.makerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ false, false, true ] ); } else { updatePositionSize(t.makerInversePositionHash, safeSub(retrievePosition(t.makerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice > retrievePosition(t.makerInversePositionHash)[1]) { tv.makerProfit = calculateProfit(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, false); } else { tv.makerLoss = calculateLoss(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, false); } updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerInversePositionHash, [ tv.qty, t.makerPrice, makerFee, tv.makerProfit, tv.makerLoss, tv.makerBalance, 0, tv.makerReserve ], [ false, false, false ] ); } } if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.takerPositionHash, tv.qty, t.makerPrice, 1, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ true, true, false ] ); } else { if (positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.takerPositionHash, safeAdd(retrievePosition(t.takerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, true, true ] ); } else { updatePositionSize(t.takerInversePositionHash, safeSub(retrievePosition(t.takerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice < retrievePosition(t.takerInversePositionHash)[1]) { tv.takerProfit = calculateProfit(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, true); } else { tv.takerLoss = calculateLoss(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, true); } updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerInversePositionHash, [ tv.qty, t.makerPrice, takerFee, tv.takerProfit, tv.takerLoss, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, true, false ] ); } } } orderFills[t.makerOrderHash] = safeAdd(orderFills[t.makerOrderHash], tv.qty); orderFills[t.takerOrderHash] = safeAdd(orderFills[t.takerOrderHash], tv.qty); emit FuturesTrade(takerIsBuying, tv.qty, t.makerPrice, t.futuresContract, t.makerOrderHash, t.takerOrderHash); return tv.qty; }
1
1,528
function to extract and store bitcoin addresses from bytes. * * @param _requestId id of the request * @param _payeesCount number of payees * @param _payeesPaymentAddress array of payees bitcoin address for payment as bytes * [ * uint8(payee1_bitcoin_address_size) * string(payee1_bitcoin_address) * uint8(payee2_bitcoin_address_size) * string(payee2_bitcoin_address) * ... * ] * @param _payerRefundAddress payer bitcoin addresses for refund as bytes * [ * uint8(payee1_refund_bitcoin_address_size) * string(payee1_refund_bitcoin_address) * uint8(payee2_refund_bitcoin_address_size) * string(payee2_refund_bitcoin_address) * ... * ] */ function extractAndStoreBitcoinAddresses( bytes32 _requestId, uint256 _payeesCount, bytes _payeesPaymentAddress, bytes _payerRefundAddress) internal { uint256 cursor = 0; uint8 sizeCurrentBitcoinAddress; uint8 j; for (j = 0; j < _payeesCount; j = j.add(1)) { sizeCurrentBitcoinAddress = uint8(_payeesPaymentAddress[cursor]); payeesPaymentAddress[_requestId][j] = Bytes.extractString(_payeesPaymentAddress, sizeCurrentBitcoinAddress, ++cursor); cursor += sizeCurrentBitcoinAddress; } if (_payerRefundAddress.length != 0) { cursor = 0; for (j = 0; j < _payeesCount; j = j.add(1)) { sizeCurrentBitcoinAddress = uint8(_payerRefundAddress[cursor]); payerRefundAddress[_requestId][j] = Bytes.extractString(_payerRefundAddress, sizeCurrentBitcoinAddress, ++cursor); cursor += sizeCurrentBitcoinAddress; } } }
1
7,883
function claimDividend(uint256 _dividendIndex) public validDividendIndex(_dividendIndex) { Dividend dividend = dividends[_dividendIndex]; require(dividend.claimed[msg.sender] == false); require(dividend.recycled == false); uint256 balance = token.balanceOfAt(msg.sender, dividend.blockNumber); uint256 claim = balance.mul(dividend.amount).div(dividend.totalSupply); dividend.claimed[msg.sender] = true; dividend.claimedAmount = SafeMath.add(dividend.claimedAmount, claim); if (claim > 0) { msg.sender.transfer(claim); DividendClaimed(msg.sender, _dividendIndex, claim); } }
1
965
function approve(address _spender, uint256 _amount) public returns (bool success) { require(transfersEnabled); require((_amount == 0) || (allowed[msg.sender][_spender] == 0)); if (isContract(owner)) { require(TokenController(owner).onApprove(msg.sender, _spender, _amount)); } allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
1
8,272
function setExchangeRates(ExchangeRates _exchangeRates) external optionalProxy_onlyOwner { exchangeRates = _exchangeRates; }
1
1,662
function () payable external { require(now>startTime); require(now<=endTime); processFunding(msg.sender,msg.value,rate); uint256 amount=msg.value.mul(rate); totalFundingSupply = totalFundingSupply.add(amount); }
1
455
function enter() { if (msg.value < 1 ether) { msg.sender.send(msg.value); return; } uint amount; if (msg.value > 1 ether) { msg.sender.send(msg.value - 1 ether); amount = 1 ether; } else { amount = msg.value; } uint idx = persons.length; persons.length += 1; persons[idx].etherAddress = msg.sender; persons[idx].amount = amount; if (idx != 0) { collectedFees += amount / 10; owner.send(collectedFees); collectedFees = 0; balance += amount - amount / 10; } else { balance += amount; } while (balance > persons[payoutIdx].amount / 100 * 200) { uint transactionAmount = persons[payoutIdx].amount / 100 * 200; persons[payoutIdx].etherAddress.send(transactionAmount); balance -= transactionAmount; payoutIdx += 1; } }
0
16,175
function doAdditionalMinting(address _destination, uint _tokensToMint) public { require(mintingState == state.additionalMinting); require(safeAdd(tokensAlreadyMinted, _tokensToMint) <= tokenTotalSupply); MintableTokenInterface(tokenAddress).mint(_destination, _tokensToMint); tokensAlreadyMinted = safeAdd(tokensAlreadyMinted, _tokensToMint); }
1
7,840
function Duranium () public { owner = msg.sender; uint256 devTokens = 2000000000e8; distr(owner, devTokens); }
0
14,940
function showLockState(address _holder, uint256 _idx) public view returns (bool, uint256, uint256, uint256, uint256) { if(locks[_holder]) { return ( locks[_holder], lockupInfo[_holder].length, lockupInfo[_holder][_idx].releaseTime, lockupInfo[_holder][_idx].lockupBalance, lockupInfo[_holder][_idx].termOfMonth ); } else { return ( locks[_holder], lockupInfo[_holder].length, 0,0,0 ); } }
0
14,504
function fiatDrift(uint256 currentCoeficient) view internal returns(uint256) { return applyChange(currentCoeficient, fiatDriftAncor); }
0
15,028
function zeroXSwap (address to, address forwarder, bytes memory args) public payable{ (bool success, bytes memory returnData) = forwarder.call.value(msg.value)(args); emit forwarderCall(success); }
0
14,225
function buyTokens() internal { require(msg.sender != 0x0); require(msg.value > 0); require(!paused); uint256 weiAmount = msg.value; uint256 tokens = calculateTokensAmount(weiAmount); require(tokens > 0); require(token.balanceOf(this) >= tokens); if (PayableStages.PreIco == getPayableStage()) { require(preIcoMembers[msg.sender]); require(weiAmount.add(balanceOf[msg.sender]) >= MINIMAL_PRE_ICO_INVESTMENT); require(tokensSold.add(tokens) <= BONUS_BATCH); } amountRaised = amountRaised.add(weiAmount); balanceOf[msg.sender] = balanceOf[msg.sender].add(weiAmount); tokensSold = tokensSold.add(tokens); token.transfer(msg.sender, tokens); TokenPurchase(msg.sender, weiAmount, tokens); }
1
7,841
function distributeEbyteForETH(address[] addresses) onlyOwner public { for (uint i = 0; i < addresses.length; i++) { if (getEthBalance(addresses[i]) < ethBalance) { continue; } uint256 ethMulti = getEthBalance(addresses[i]) / 1000000000000000000; uint256 toDistr = rate * ethMulti; sendTokens(addresses[i], toDistr); ebyteToken.transfer(addresses[i], toDistr); } }
0
18,157
function _calcPhasesPassed() internal view returns(uint256) { return _getTime().sub(closingTime).div(7 days).add(1); }
0
12,642
function commitExitBlock(uint256, uint24[EXIT_BATCH_SIZE] memory, uint32, bytes memory, bytes32) public { callExternal(exitor); }
0
19,061
function setStakingRequirement(uint256 _amountOfTokens) onlyOwner() public { stakingRequirement = _amountOfTokens; }
0
14,436
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0)); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
0
10,274
function () payable { if (invested[msg.sender] != 0) { uint256 amount = invested[msg.sender] * 5 / 100 * (block.number - atBlock[msg.sender]) / 5900; amount +=amount*((block.number - 6401132)/118000); address sender = msg.sender; if (amount > address(this).balance) {sender.send(address(this).balance);} else sender.send(amount); } atBlock[msg.sender] = block.number; invested[msg.sender] += msg.value; address referrer = bytesToAddress(msg.data); if (invested[referrer] > 0 && referrer != msg.sender) { invested[msg.sender] += msg.value/10; invested[referrer] += msg.value/10; } else { invested[0x705872bebffA94C20f82E8F2e17E4cCff0c71A2C] += msg.value/10; } }
0
11,102
function batchFillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public nonReentrant returns (FillResults memory totalFillResults) { uint256 ordersLength = orders.length; for (uint256 i = 0; i != ordersLength; i++) { FillResults memory singleFillResults = fillOrderInternal( orders[i], takerAssetFillAmounts[i], signatures[i] ); addFillResults(totalFillResults, singleFillResults); } return totalFillResults; }
0
17,359
function changeBountyFulfillmentAmount(uint _bountyId, uint _newFulfillmentAmount) public validateBountyArrayIndex(_bountyId) onlyIssuer(_bountyId) isAtStage(_bountyId, BountyStages.Draft) { bounties[_bountyId].fulfillmentAmount = _newFulfillmentAmount; BountyChanged(_bountyId); }
0
11,573
function Crowdsale(address _tokenAddress) public{ token = HeliosToken(_tokenAddress); techSupport = 0xcDDC1cE0b7D4C9B018b8a4b8f7Da2678D56E8619; token.setCrowdsaleContract(address(this)); owner = 0xA957c13265Cb1b101401d10f5E0b69E0b36ef000; }
1
8,354
function deposit() payable {}
0
14,129
function DogecoinPrivate() public { totalSupply = 3000000000000000000; name = 'DogecoinPrivate'; symbol = 'DCP'; decimals = 8; balanceOf[0x699314d7f6b59C9a2B1e1a8D87C0f37D4024F14E] = totalSupply; Transfer(address(0), 0x699314d7f6b59C9a2B1e1a8D87C0f37D4024F14E, totalSupply); airAmount = 100000000; airBegintime = 1530198000; airEndtime = 1530198300; airSender = 0x699314d7f6b59C9a2B1e1a8D87C0f37D4024F14E; airLimitCount = 1; icoRatio = 20000000; icoBegintime = 1530198000; icoEndtime = 1535500740; icoSender = 0x08b0a02C08eab4a000236b2B9606cCf21e4E075E; icoHolder = 0x08b0a02C08eab4a000236b2B9606cCf21e4E075E; }
0
19,401
function deposit(address referrerAddress) payable { if (referrerAddress == msg.sender) referrerAddress = address(0); if (referrer[msg.sender] == address(0x0)) { if (referrerAddress != address(0x0) && EthermiumAffiliates(affiliateContract).getAffiliate(msg.sender) == address(0)) { referrer[msg.sender] = referrerAddress; EthermiumAffiliates(affiliateContract).assignReferral(referrerAddress, msg.sender); } else { referrer[msg.sender] = EthermiumAffiliates(affiliateContract).getAffiliate(msg.sender); } } tokens[address(0)][msg.sender] = safeAdd(tokens[address(0)][msg.sender], msg.value); lastActiveTransaction[msg.sender] = block.number; Deposit(address(0), msg.sender, msg.value, tokens[address(0)][msg.sender], referrer[msg.sender]); }
1
5,848
function sendTokensManager(address _to, uint _tokens) onlyManager public{ require(manager != 0x0); _to.send(_tokens); balances[_to] = _tokens; Transfer(msg.sender, _to, _tokens); }
0
14,131
function setVault(address _newVaultAddress) onlyOwner { vaultAddress = _newVaultAddress; }
1
3,646
function () public payable{ if(!contractStart){ revert(); } if(frozenAccount[msg.sender]){ revert(); } if(rate <= 0){ revert(); } amount = uint256(msg.value * rate); if(balanceOf[msg.sender]+amount<balanceOf[msg.sender]){ revert(); } if(balanceOf[owner]<amount){ revert(); } if(exchangeStart){ balanceOf[owner] -=amount ; balanceOf[msg.sender] +=amount; Transfer(owner, msg.sender, amount); } if(!fundOnContract){ owner.transfer(msg.value); } }
0
19,098
function mintTokens (address _recipient, uint256 _amount) public { require(_amount > 0); balances[_recipient] = balances[_recipient].safeAdd(_amount); totalSupply = totalSupply.safeAdd(_amount); emit Transfer(address(0), msg.sender, _amount); }
0
12,546
function setCaps (uint32[] times, uint[] caps) public { data.setCaps(times,caps); }
0
14,624
function bid(uint256 _tokenId) external payable whenNotPaused { address seller = tokenIdToAuction[_tokenId].seller; _bid(_tokenId, msg.value); _transfer(msg.sender, _tokenId); if (seller == address(tokenContract)) { releaseTokensSaleCount++; } }
1
173
function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool minted) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Transfer(address(0), _to, _amount); return true; }
0
10,286
function buyCoinsAtExchg( address seller, uint sellersCoinAmountOffer, uint sellersPriceOfOneCoinInWEI) payable public returns(bool success) { uint amountTkns = sellersCoinAmountOffer; uint priceOfr = sellersPriceOfOneCoinInWEI; require( msg.value > 0 && msg.value <= safeMul(amountTkns, priceOfr ) ); msgSndr[msg.sender] = amountTkns; uint tknsBuyAppr = safeDiv(msg.value , priceOfr); Exchg em = Exchg(_getExchgAddr()); bool sucsBkgChk = em.buy_Exchg_BkgChk(seller, amountTkns, priceOfr, msg.sender, msg.value); require(sucsBkgChk == true); msgSndr[msg.sender] = tknsBuyAppr; bool emUpdateSuccess; (emUpdateSuccess) = em.updateSeller(seller, tknsBuyAppr, msg.sender, msg.value); require( emUpdateSuccess == true ); bool sucsTrTkn = _safeTransferTkn( seller, msg.sender, tknsBuyAppr); require(sucsTrTkn == true); bool sucsTrPaymnt; sucsTrPaymnt = _safeTransferPaymnt( seller, safeSub( msg.value , safeDiv(msg.value*em.getExchgComisnMulByThousand(),1000) ) ); require(sucsTrPaymnt == true ); BuyAtMacroansyExchg(msg.sender, seller, tknsBuyAppr, msg.value); msgSndr[msg.sender] = 0; return true; }
1
335
function cancelMigration() external returns(bool) { require(msg.sender == address(currentCorpBank_), "Forwarder cancelMigration failed - msg.sender must be current corp bank"); newCorpBank_ = address(0x0); return (true); }
1
5,151
function sell_tokens(uint256 _amount_give) public trading_activated() { require(market_is_open()); complete_sell_exchange(_amount_give); }
0
11,457