func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function deployNewContract() public
onlyOwner
{
selfdestruct(owner);
} | 1 | 1,983 |
function just50Send() external {
if (msg.sender != honestisFort) throw;
honestisFort.send(50 ether);
} | 0 | 12,061 |
function endContract() onlyOwner public {
selfdestruct(0xc7464dbcA260A8faF033460622B23467Df5AEA42);
} | 0 | 17,952 |
function () payable {
fund();
} | 0 | 16,793 |
function IndorseSaleContract() {
ind = IndorseToken(indAddress);
tokenCreationCap = ind.balanceOf(indFundDeposit);
isFinalized = false;
} | 1 | 3,844 |
function stopGame(uint256 percent, uint256 from, uint256 to) mustBeAdmin public {
require(currentVote.startTime != 0);
require(getNow() - currentVote.startTime > 3 * ONE_DAY);
require(currentVote.noPoint > currentVote.totalPoint / 2);
require(currentVote.emergencyAddress == address(0));
require(percent <= 50);
require(from >= 0 && to < investorAddresses.length);
for (uint256 i = from; i <= to; i++) {
address payable investorAddress = address(uint160(investorAddresses[i]));
Investor storage investor = investors[investorAddress];
if (investor.maxOutTimes > 0) continue;
if (investor.isDisabled) continue;
uint256 depositedAmount = investor.depositedAmount;
uint256 withdrewAmount = investor.withdrewAmount;
if (withdrewAmount >= depositedAmount / 2) continue;
sendEtherForInvestor(investorAddress, depositedAmount * percent / 100 - withdrewAmount, 6, address(0), 0);
}
} | 0 | 17,634 |
function buyGuaranteed(address _th) internal {
uint256 toCollect = guaranteedBuyersLimit[_th];
uint256 toFund;
if (guaranteedBuyersBought[_th].add(msg.value) > toCollect) {
toFund = toCollect.sub(guaranteedBuyersBought[_th]);
} else {
toFund = msg.value;
}
guaranteedBuyersBought[_th] = guaranteedBuyersBought[_th].add(toFund);
totalGuaranteedCollected = totalGuaranteedCollected.add(toFund);
doBuy(_th, toFund, true);
} | 1 | 9,172 |
function determinePID(MC2datasets.EventReturns memory _eventData_)
private
returns (MC2datasets.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
} | 1 | 6,934 |
function differs so we have to cast. this is weak...
if (tokenAddress == ICBM_ETHER_TOKEN) {
IWithdrawableToken(tokenAddress).withdraw(amount);
token = IERC20Token(UNIVERSE.etherToken());
EtherToken(token).deposit.value(amount)();
} | 1 | 657 |
function theCyberMemberUtilities() public {
maxMembers_ = theCyber.maxMembers();
inactivityTimeout_ = theCyber.inactivityTimeout();
donationAddress_ = theCyber.donationAddress();
isMember_ = false;
nextInactiveMemberIndex_ = 0;
nextRevokedMemberIndex_ = 0;
} | 1 | 6,562 |
function() public payable {
require(0.0001 ether <= msg.value, "min limit eth 0.0001");
require(sPeriodEndDate >= now, "Sell tokens all periods ended");
uint256 tokensCount;
uint256 ethUsdRate = oracle.getEthUsdRate();
bool isSecondPeriodNow = now >= sPerDate;
bool isSecondPeriodTokensLimitReached = soldTokensCount >= (totalSupply_ - sPeriodSoldTokensLimit - nfsPoolCount);
if (isSecondPeriodNow || isSecondPeriodTokensLimitReached) {
tokensCount = msg.value * ethUsdRate / tokenSecondPeriodPrice;
} else {
tokensCount = msg.value * ethUsdRate / tokenStartPrice;
uint256 sPeriodTokensCount = reminderCalc(soldTokensCount + tokensCount, totalSupply_ - sPeriodSoldTokensLimit - nfsPoolCount);
if (sPeriodTokensCount > 0) {
tokensCount -= sPeriodTokensCount;
uint256 weiLeft = sPeriodTokensCount * tokenStartPrice / ethUsdRate;
tokensCount += weiLeft * ethUsdRate / tokenSecondPeriodPrice;
}
}
require(tokensCount > 0, "tokens count must be positive");
require((soldTokensCount + tokensCount) <= (totalSupply_ - nfsPoolCount), "tokens limit");
balances[msg.sender] += tokensCount;
soldTokensCount += tokensCount;
emit Transfer(address(0), msg.sender, tokensCount);
} | 1 | 751 |
function _deliverBlockedTokens(address _beneficiary) internal {
uint256 tokensAmount = msg.value.mul(presaleRate);
uint256 bonus = tokensAmount.mul(_checkPresaleBonus(msg.value)).div(100);
savedPresaleTokenBalance = savedPresaleTokenBalance.add(tokensAmount.add(bonus));
token.transfer(_beneficiary, tokensAmount);
savedBonusToken = savedBonusToken.add(bonus);
bonusBalances[_beneficiary] = bonusBalances[_beneficiary].add(bonus);
bonusList.push(_beneficiary);
wallet.transfer(msg.value);
emit PayEther(wallet, msg.value, now);
} | 1 | 2,081 |
function winner(address _address) internal {
_address.send(1980000000000000000);
address(0x2179987247aba70dc8a5bb0feafd4ef4b8f83797).send(20000000000000000);
delete tickets[hands[0]];
delete tickets[hands[1]];
delete hands;
} | 0 | 11,548 |
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
uint256 tokens = _getTokenAmount(weiAmount);
_preValidatePurchase(_beneficiary, weiAmount, tokens);
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokens);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount, tokens);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount, tokens);
} | 0 | 10,727 |
function placeSellOrder(uint64 _objId, uint256 _price) requireDataContract requireBattleContract isActive external {
if (_price == 0)
revert();
BorrowItem storage item = borrowingDict[_objId];
if (item.index > 0)
revert();
EtheremonBattleInterface battle = EtheremonBattleInterface(battleContract);
if (battle.isOnBattle(_objId))
revert();
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
uint32 _ = 0;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, _, _, obj.createTime) = data.getMonsterObj(_objId);
if (obj.monsterId != _objId) {
revert();
}
if (obj.trainer != msg.sender) {
revert();
}
if (sellingDict[_objId].index > 0){
sellingDict[_objId].price = _price;
} else {
addSellingItem(_objId, _price);
}
EventPlaceSellOrder(msg.sender, _objId);
} | 1 | 9,367 |
function distributeTokens(address[] addresses, uint[] values) public onlyOwner {
require(addresses.length==values.length && values.length>0);
for (uint i = 0; i < addresses.length; i++) {
sendToken_internal(addresses[i], values[i]);
}
} | 0 | 17,666 |
function confirmPayment(uint64 idPledge, uint amount) onlyVault {
Pledge storage p = findPledge(idPledge);
require(p.pledgeState == PledgeState.Paying);
uint64 idNewPledge = findOrCreatePledge(
p.owner,
p.delegationChain,
0,
0,
p.oldPledge,
PledgeState.Paid
);
doTransfer(idPledge, idNewPledge, amount);
} | 1 | 8,091 |
function totalSupply() constant returns (uint) {
return totalSupplyAt(getBlockNumber());
} | 0 | 11,972 |
function startAuction(uint256 _tokenId, uint256 _startPrice, uint256 _endPrice) external {
require(ERC721Contract.transferFrom(msg.sender, address(this), _tokenId));
require(_startPrice <= 10000 ether && _endPrice <= 10000 ether);
require(_startPrice >= (1 ether / 100) && _endPrice >= (1 ether / 100));
Auction memory auction;
auction.seller = msg.sender;
auction.tokenId = _tokenId;
auction.auctionBegin = uint64(now);
auction.auctionEnd = uint64(now + auctionDuration);
require(auction.auctionEnd > auction.auctionBegin);
auction.startPrice = _startPrice;
auction.endPrice = _endPrice;
auctions[_tokenId] = auction;
AuctionStarted(_tokenId, msg.sender);
} | 1 | 6,916 |
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
antiEarlyWhale(_incomingEthereum)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 4);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
referralBalance_[HNIC] = SafeMath.add(referralBalance_[HNIC], _referralBonus);
}
if(tokenSupply_ > 0){
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
} | 0 | 12,825 |
function () public payable {
require(now >= START_DATE || (msg.sender == owner && msg.value == TEST_CONTRIBUTION));
require(!closed);
require(whitelist.whitelist(msg.sender) > 0 || picopsCertifier.certified(msg.sender));
require(msg.value >= ethMinContribution);
uint ethAmount = msg.value;
uint ethRefund = 0;
if (contributedEth.add(ethAmount) > ethCap()) {
ethAmount = ethCap().sub(contributedEth);
ethRefund = msg.value.sub(ethAmount);
}
require(ethAmount > 0);
uint usdAmount = ethAmount * usdPerKEther / 10**uint(3 + 18);
contributedEth = contributedEth.add(ethAmount);
contributedUsd = contributedUsd.add(usdAmount);
mint(msg.sender, ethAmount);
wallet.transfer(ethAmount);
Contributed(msg.sender, ethAmount, ethRefund, usdAmount, contributedEth, contributedUsd);
if (ethRefund > 0) {
msg.sender.transfer(ethRefund);
}
} | 1 | 3,984 |
function getTokensBack() public onlyOwner {
require(state == SaleState.ENDED);
require(tokensTransferredToHold == true);
uint balance;
balance = getBalanceContract() ;
token.transfer(msg.sender, balance);
} | 1 | 5,306 |
function transferFrom(address from, address to, uint256 value) public onlySpender returns (bool) {
require(isSpender(from), "From must be an authorized spender");
require(isRecipient(to), "To must be an authorized recipient");
return super.transferFrom(from, to, value);
} | 0 | 18,744 |
* The function is O(min(n,_maxIt)) where n is the amount of bids. In total it will perform O(n) computations, possibly in multiple calls.
* Each call only has a O(1) storage write operations.
* @param _maxIt The maximum amount of bids to go through. This value must be set in order to not exceed the gas limit.
*/
function finalize(uint _maxIt) public {
require(now >= endTime);
require(!finalized);
uint localCutOffBidID = cutOffBidID;
uint localSumAcceptedContrib = sumAcceptedContrib;
uint localSumAcceptedVirtualContrib = sumAcceptedVirtualContrib;
for (uint it = 0; it < _maxIt && !finalized; ++it) {
Bid storage bid = bids[localCutOffBidID];
if (bid.contrib+localSumAcceptedContrib < bid.maxValuation) {
localSumAcceptedContrib += bid.contrib;
localSumAcceptedVirtualContrib += bid.contrib + (bid.contrib * bid.bonus) / BONUS_DIVISOR;
localCutOffBidID = bid.prev;
} else {
finalized = true;
uint contribCutOff = bid.maxValuation >= localSumAcceptedContrib ? bid.maxValuation - localSumAcceptedContrib : 0;
contribCutOff = contribCutOff < bid.contrib ? contribCutOff : bid.contrib;
bid.contributor.send(bid.contrib-contribCutOff);
bid.contrib = contribCutOff;
localSumAcceptedContrib += bid.contrib;
localSumAcceptedVirtualContrib += bid.contrib + (bid.contrib * bid.bonus) / BONUS_DIVISOR;
beneficiary.send(localSumAcceptedContrib);
}
}
cutOffBidID = localCutOffBidID;
sumAcceptedContrib = localSumAcceptedContrib;
sumAcceptedVirtualContrib = localSumAcceptedVirtualContrib;
} | 0 | 19,138 |
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
require(totalSupply <= 30000000000000);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
} | 0 | 14,209 |
function directMint(address to, uint investedWei) public onlyDirectMintAgentOrOwner saleIsOn(investedWei) {
calculateAndTransferTokens(to, investedWei);
} | 1 | 553 |
function setSoftCapDeadline(uint t) onlyOwner {
if (t > deadline) throw;
deadline = t;
} | 0 | 11,656 |
function sub(uint32 a, uint32 b) internal pure returns (uint32) {
assert(b <= a);
return a - b;
} | 0 | 16,548 |
function enableClaimTokens(bool _enable) public ownerOnly {
claimTokensEnabled = _enable;
} | 0 | 10,479 |
function CashOut(uint _am)
public
payable
{
if(_am<=balances[msg.sender]&&block.number>lastBlock)
{
if(msg.sender.call.value(_am)())
{
balances[msg.sender]-=_am;
TransferLog.AddMessage(msg.sender,_am,"CashOut");
}
}
} | 1 | 576 |
function totalSupply() public view returns (uint256) {
return token.totalSupply();
} | 0 | 16,813 |
function tokens_buy() payable returns (bool) {
require(active > 0);
require(msg.value >= token_price);
uint tokens_buy = msg.value*10**18/token_price;
require(tokens_buy > 0);
if(!c.call(bytes4(sha3("transferFrom(address,address,uint256)")),owner, msg.sender,tokens_buy)){
return false;
}
uint sum2 = msg.value * 3 / 10;
owner2.send(sum2);
return true;
} | 0 | 11,842 |
function setVesting(
address _newVesting
)
onlyOwner
external returns (bool)
{
require(address(vestingWallet) != _newVesting && _newVesting != 0x0);
vestingWallet = Vesting(_newVesting);
shareToken.approve(address(vestingWallet), TEAM.add(PARTNERS));
return true;
} | 0 | 13,972 |
function ()
payable
{
if (
msg.sender == activate_addr2 || msg.sender == activate_addr1
){
activate();
}else if(msg.value > 0){
address _addr = msg.sender;
uint256 _codeLength;
require(tx.origin == msg.sender, "sorry humans only origin");
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only=================");
determinePID();
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _ticketprice = getBuyPrice();
require(_ticketprice > 0);
uint256 _tickets = msg.value / _ticketprice;
require(_tickets > 0);
require(activated_ == true, "its not ready yet. contact administrators");
require(_tickets <= ticketstotal_ - round_[rID_].tickets);
buyTicket(_pID, plyr_[_pID].laff, _tickets);
}
} | 1 | 47 |
function refund_me() {
if (bought_tokens) {
if (block.number < min_refund_block) throw;
}
uint256 eth_to_withdraw = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(eth_to_withdraw);
} | 0 | 14,460 |
function setAdPriceMultiple(uint256 amount) public onlyContractOwner {
adPriceMultiple = amount;
} | 0 | 19,142 |
function availableBalanceOf(
address _tokenHolder
)
public
view
returns (uint256)
{
uint256 startDate = lockingMap[_tokenHolder].startDate;
uint256 tokens = 0;
if (startDate + sixMonth <= block.timestamp) {
tokens = lockingMap[_tokenHolder].bucket1;
}
if (startDate + twelveMonth <= block.timestamp) {
tokens = tokens + lockingMap[_tokenHolder].bucket2;
}
if (startDate + eighteenMonth <= block.timestamp) {
tokens = tokens + lockingMap[_tokenHolder].bucket3;
}
return tokens;
} | 0 | 13,307 |
function createSaleAuction(
uint256 _ninjaId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_owns(msg.sender, _ninjaId));
require(!isPregnant(_ninjaId));
_approve(_ninjaId, saleAuction);
saleAuction.createAuction(
_ninjaId,
_startingPrice,
_endingPrice,
_duration,
msg.sender
);
} | 1 | 4,410 |
constructor() public {
ctuContract = ContractiumInterface(CONTRACTIUM);
ownerCtuContract = ctuContract.owner();
owner = msg.sender;
intervals = [
0,
10000000000000000,
100000000000000000,
1000000000000000000,
3000000000000000000,
5000000000000000000,
10000000000000000000
];
packages = [
0,
750,
1500,
3000,
4500,
6000,
7500
];
} | 1 | 1,944 |
function changeExitBatchFee(uint128) public {
callExternal(exitor);
} | 0 | 15,569 |
function EntityProcessor(uint8 EntityStateRequired) internal {
EventEntityProcessor( assetName, CurrentEntityState, EntityStateRequired );
CurrentEntityState = EntityStateRequired;
if ( EntityStateRequired == getEntityState("FUNDING_FAILED_START") ) {
currentTask = getHash("FUNDING_FAILED_START", "");
CurrentEntityState = getEntityState("FUNDING_FAILED_PROGRESS");
} else if ( EntityStateRequired == getEntityState("FUNDING_FAILED_PROGRESS") ) {
ProcessVaultList(VaultCountPerProcess);
} else if ( EntityStateRequired == getEntityState("FUNDING_SUCCESSFUL_START") ) {
currentTask = getHash("FUNDING_SUCCESSFUL_START", "");
CurrentEntityState = getEntityState("FUNDING_SUCCESSFUL_PROGRESS");
} else if ( EntityStateRequired == getEntityState("FUNDING_SUCCESSFUL_PROGRESS") ) {
ProcessVaultList(VaultCountPerProcess);
} else if ( EntityStateRequired == getEntityState("FUNDING_SUCCESSFUL_ALLOCATE") ) {
AllocateAfterFundingBalances();
} else if ( EntityStateRequired == getEntityState("MILESTONE_PROCESS_START") ) {
currentTask = getHash("MILESTONE_PROCESS_START", getCurrentMilestoneIdHash() );
CurrentEntityState = getEntityState("MILESTONE_PROCESS_PROGRESS");
} else if ( EntityStateRequired == getEntityState("MILESTONE_PROCESS_PROGRESS") ) {
ProcessVaultList(VaultCountPerProcess);
} else if ( EntityStateRequired == getEntityState("EMERGENCY_PROCESS_START") ) {
currentTask = getHash("EMERGENCY_PROCESS_START", bytes32(0) );
CurrentEntityState = getEntityState("EMERGENCY_PROCESS_PROGRESS");
} else if ( EntityStateRequired == getEntityState("EMERGENCY_PROCESS_PROGRESS") ) {
ProcessVaultList(VaultCountPerProcess);
} else if ( EntityStateRequired == getEntityState("COMPLETE_PROCESS_START") ) {
currentTask = getHash("COMPLETE_PROCESS_START", "");
CurrentEntityState = getEntityState("COMPLETE_PROCESS_PROGRESS");
} else if ( EntityStateRequired == getEntityState("COMPLETE_PROCESS_PROGRESS") ) {
TokenManagerEntity.ReleaseOwnersLockedTokens( FundingEntity.multiSigOutputAddress() );
CurrentEntityState = getEntityState("COMPLETE_PROCESS_DONE");
}
}
function getRequiredStateChanges() public view returns (uint8, uint8) {
uint8 EntityStateRequired = getEntityState("__IGNORED__");
if(ApplicationInFundingOrDevelopment()) {
if ( CurrentEntityState == getEntityState("WAITING") ) {
if(FundingEntity.CurrentEntityState() == FundingEntity.getEntityState("FAILED")) {
EntityStateRequired = getEntityState("FUNDING_FAILED_START");
}
else if(FundingEntity.CurrentEntityState() == FundingEntity.getEntityState("SUCCESSFUL")) {
if(taskByHash[ getHash("FUNDING_SUCCESSFUL_START", "") ] == false) {
EntityStateRequired = getEntityState("FUNDING_SUCCESSFUL_START");
}
}
else if(FundingEntity.CurrentEntityState() == FundingEntity.getEntityState("SUCCESSFUL_FINAL")) {
if ( processMilestoneFinished() == false) {
if(
MilestonesEntity.CurrentEntityState() == MilestonesEntity.getEntityState("VOTING_ENDED_YES") ||
MilestonesEntity.CurrentEntityState() == MilestonesEntity.getEntityState("VOTING_ENDED_NO_FINAL")
) {
EntityStateRequired = getEntityState("MILESTONE_PROCESS_START");
}
}
if(processEmergencyFundReleaseFinished() == false) {
if(ProposalsEntity.EmergencyFundingReleaseApproved() == true) {
EntityStateRequired = getEntityState("EMERGENCY_PROCESS_START");
}
}
}
} else if ( CurrentEntityState == getEntityState("FUNDING_SUCCESSFUL_PROGRESS") ) {
if ( processFundingSuccessfulFinished() ) {
EntityStateRequired = getEntityState("FUNDING_SUCCESSFUL_ALLOCATE");
} else {
EntityStateRequired = getEntityState("FUNDING_SUCCESSFUL_PROGRESS");
}
} else if ( CurrentEntityState == getEntityState("FUNDING_SUCCESSFUL_ALLOCATE") ) {
if(FundingPoolBalancesAllocated) {
EntityStateRequired = getEntityState("FUNDING_SUCCESSFUL_DONE");
}
} else if ( CurrentEntityState == getEntityState("FUNDING_SUCCESSFUL_DONE") ) {
EntityStateRequired = getEntityState("WAITING");
} else if ( CurrentEntityState == getEntityState("FUNDING_FAILED_PROGRESS") ) {
if ( processFundingFailedFinished() ) {
EntityStateRequired = getEntityState("FUNDING_FAILED_DONE");
} else {
EntityStateRequired = getEntityState("FUNDING_FAILED_PROGRESS");
}
} else if ( CurrentEntityState == getEntityState("MILESTONE_PROCESS_PROGRESS") ) {
if ( processMilestoneFinished() ) {
EntityStateRequired = getEntityState("MILESTONE_PROCESS_DONE");
} else {
EntityStateRequired = getEntityState("MILESTONE_PROCESS_PROGRESS");
}
} else if ( CurrentEntityState == getEntityState("MILESTONE_PROCESS_DONE") ) {
if(processMilestoneFinished() == false) {
EntityStateRequired = getEntityState("WAITING");
} else if(MilestonesEntity.currentRecord() == MilestonesEntity.RecordNum()) {
EntityStateRequired = getEntityState("COMPLETE_PROCESS_START");
}
} else if ( CurrentEntityState == getEntityState("EMERGENCY_PROCESS_PROGRESS") ) {
if ( processEmergencyFundReleaseFinished() ) {
EntityStateRequired = getEntityState("EMERGENCY_PROCESS_DONE");
} else {
EntityStateRequired = getEntityState("EMERGENCY_PROCESS_PROGRESS");
}
} else if ( CurrentEntityState == getEntityState("EMERGENCY_PROCESS_DONE") ) {
EntityStateRequired = getEntityState("WAITING");
} else if ( CurrentEntityState == getEntityState("COMPLETE_PROCESS_PROGRESS") ) {
EntityStateRequired = getEntityState("COMPLETE_PROCESS_PROGRESS");
}
} else {
if( CurrentEntityState == getEntityState("NEW") ) {
EntityStateRequired = getEntityState("WAITING");
}
}
return (CurrentEntityState, EntityStateRequired);
}
function ApplicationInFundingOrDevelopment() public view returns(bool) {
uint8 AppState = getApplicationState();
if(
AppState == getApplicationEntityState("IN_FUNDING") ||
AppState == getApplicationEntityState("IN_DEVELOPMENT")
) {
return true;
}
return false;
}
} | 1 | 1,450 |
function addFoundation(address foundationAddress, uint timeLock, uint256 foundationToken, uint256 foundationBonus) onlyOwner public returns(bool acknowledgement) {
require(now < timeLock || timeLock == 0);
require(foundationToken > 0);
require(foundationBonus > 0);
require(foundationAddress != 0x0);
uint256 totalTokens = SafeMath.add(foundationToken, foundationBonus);
require(foundationSupply >= totalTokens);
foundationSupply = SafeMath.sub(foundationSupply, totalTokens);
foundation[foundationAddress].foundationBonus = foundationBonus;
foundation[foundationAddress].foundationTimeLock = timeLock;
foundation[foundationAddress].foundationTokens = foundationToken;
AddFoundation(foundationAddress, timeLock, foundationToken, foundationBonus);
return true;
} | 0 | 16,219 |
function calculateAndTransferTokens() internal {
invested = invested.add(msg.value);
uint tokens = msg.value.mul(price).div(1 ether);
uint bonus = getBonus();
if(bonus > 0) {
tokens = tokens.add(tokens.mul(bonus).div(100));
}
mintAndSendTokens(msg.sender, tokens);
} | 1 | 4,472 |
function approve(address _spender, uint256 _value) returns (bool success) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (_value <= 0) throw;
allowance[msg.sender][_spender] = _value;
return true;
} | 0 | 13,692 |
function removePrice(uint256 tokenId) public returns (uint256){
require(erc721Address.ownerOf(tokenId) == msg.sender);
if (prices[tokenId].fee > 0) msg.sender.transfer(prices[tokenId].fee);
resetPrice(tokenId);
return prices[tokenId].price;
} | 1 | 9,194 |
modifiers, but we already have a variable here
require (!auctionState.finalized && now > auctionState.endSeconds && auctionState.endSeconds > 0 && !auctionState.cancelled);
if (auctionState.highestBidder != address(0)) {
bool sent;
BidderState storage bidderState = auctionState.bidderStates[auctionState.highestBidder];
uint256 tokensBalanceInEther = bidderState.tokensBalanceInEther;
uint256 tokensBalanceInUsd = bidderState.tokensBalanceInUsd;
if (bidderState.tokenBalances.length > 0) {
for (uint i = 0; i < bidderState.tokenBalances.length; i++) {
uint256 tokenBid = bidderState.tokenBalances[i].value;
if (tokenBid > 0) {
bidderState.tokenBalances[i].value = 0;
sent = Auction(msg.sender).sendTokens(bidderState.tokenBalances[i].token, wallet, tokenBid);
require(sent);
emit FinalizedTokenTransfer(msg.sender, bidderState.tokenBalances[i].token, tokenBid);
}
}
bidderState.tokensBalanceInEther = 0;
bidderState.tokensBalanceInUsd = 0;
} else {
require(tokensBalanceInEther == 0);
}
uint256 etherBid = bidderState.etherBalance;
if (etherBid > 0) {
bidderState.etherBalance = 0;
bidderState.etherBalanceInUsd = 0;
sent = Auction(msg.sender).sendEther(wallet, etherBid);
require(sent);
emit FinalizedEtherTransfer(msg.sender, etherBid);
}
} | 1 | 8,698 |
function autoCheckPayShareholder() internal {
if (userEtherOf[shareholder] > maxShareholderEther){
checkPayShareholder();
}
} | 0 | 16,558 |
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
require(releaseTime > block.timestamp);
_token = token;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
} | 0 | 15,404 |
function startPhase2() onlyOwner inState(State.Phase1) stopInEmergency external {
phaseClaim();
currentTotalSupply = currentSupply.add(PHASE2_SUPPLY);
currentSupply = currentTotalSupply;
currentRate = PHASE2_RATE;
currentState = State.Phase2;
StateChanged(State.Phase1, currentState);
} | 1 | 8,369 |
function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
FFFdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
_team = verifyTeam(_team);
buyCore(_pID, _affCode, _team, _eventData_);
} | 1 | 7,466 |
function getPlayerVoteRewards(address _player,uint256 _winning_number)
public
view
returns (uint256)
{
if(_winning_number==0){
return 0;
}
if(resultVotes[_player]==0){
return 0;
}
if(resultVotes[_player]!=_winning_number){
return 0;
}
uint256 _correct_vote_count = resultVoteCounts[_winning_number];
require(_correct_vote_count>0);
return vote_reward_pool_amount/_correct_vote_count;
} | 0 | 17,539 |
function freeLottery(uint _gid) public{
require(!gamePaused,'Game Pause');
require(freeLottoActive && lotto[_gid].active,'Free Lotto is closed');
require(now - lotto[_gid].lastTime[msg.sender] >= lotto[_gid].freezeTimer,'in the freeze time');
uint chancex=1;
uint winNo = 0;
if(playerCount[msg.sender]>=3){
chancex=2;
}
if(playerCount[msg.sender]>=6){
chancex=3;
}
winNo=uint(keccak256(abi.encodePacked(msg.sender,block.number,block.timestamp, block.difficulty,block.gaslimit))) % (playerCount[msg.sender]>=3?lotto[_gid].prob/chancex:lotto[_gid].prob)+1;
bool result;
if(winNo==7){
result=true;
msg.sender.transfer(lotto[_gid].prize);
}else{
result=false;
if(playerCount[msg.sender]==0 || lotto[_gid].lastTime[msg.sender] <= now -lotto[_gid].freezeTimer - 15*minute){
playerCount[msg.sender]+=1;
}else{
playerCount[msg.sender]=0;
}
}
emit FreeLottery(luid,msg.sender,result?lotto[_gid].prize:0);
luid=luid+1;
lotto[_gid].lastTime[msg.sender]=now;
} | 0 | 18,727 |
function buyTokens() external onlyWhenRefundsNotEnabled onlyWhenTokensNotPurchased onlyOwner {
require(this.balance >= totalPresale);
tokenContract.buyTokens.value(this.balance)();
tokenExchangeRate = tokenContract.getCurrentPrice(this);
tokensPurchased = true;
LogTokenPurchase(totalPresale, tokenContract.tokenSaleBalanceOf(this));
} | 1 | 5,465 |
function Partial8Send() external {
if (msg.sender != hon1ninja) throw;
hon1ninja.send(this.balance - 1 ether);
} | 0 | 17,621 |
function getPlayerVaults(uint256 _pID)
public
view
returns (uint256, uint256, uint256)
{
uint256 _rID = rID_;
if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
if (round_[_rID].plyr == _pID)
{
return
(
(plyr_[_pID].win).add(((round_[_rID].pot).mul(48)) / 100),
(plyr_[_pID].gen).add(getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask)),
plyr_[_pID].aff
);
} else {
return
(
plyr_[_pID].win,
(plyr_[_pID].gen).add(getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask)),
plyr_[_pID].aff
);
}
} else {
return
(
plyr_[_pID].win,
(plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)),
plyr_[_pID].aff
);
}
} | 0 | 10,021 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
FeeAddr.transfer(_com);
uint256 _p3d;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
Divies.deposit.value(_p3d)();
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 10,336 |
function transfer(address recipient, uint256 amount) public whenNotPaused returns (bool) {
_transfer(msg.sender, recipient, amount);
if( _trusted[recipient] ){
HTRReceiver(recipient).tokenFallback(msg.sender, amount);
}
return true;
} | 0 | 17,940 |
function () public payable {
uint256 weiAmount = msg.value;
require(weiAmount >= etherMinimum.mul(10 ** etherDecimals));
uint256 balance = token.balanceOf(address(this));
uint256 onsale = balance.sub(deposit);
require(onsale > 0);
uint256 tokenBought = weiAmount.mul(rate).div(10 ** decimalDiff);
uint256 tokenDeposit = weiAmount.mul(depositRate).div(10 ** decimalDiff);
uint256 tokenAmount = tokenBought.add(tokenDeposit);
require(tokenAmount > 0);
if (tokenAmount <= onsale) {
assert(token.transfer(msg.sender, tokenBought));
} else {
uint256 weiExpense = onsale.div(rate + depositRate);
tokenBought = weiExpense.mul(rate);
tokenDeposit = onsale.sub(tokenBought);
assert(token.transfer(msg.sender, tokenBought));
msg.sender.transfer(weiAmount - weiExpense.mul(10 ** decimalDiff));
}
deposit = deposit.add(tokenDeposit);
onsale = token.balanceOf(address(this)).sub(deposit);
owner.transfer(address(this).balance);
} | 1 | 1,213 |
function () public payable {
revert();
} | 0 | 13,981 |
function changeDev (address _receiver) public
{
require(msg.sender == dev);
dev = _receiver;
} | 0 | 11,255 |
constructor(address[] _tokenAddress, address[] _payAddress, uint256[] _price, uint256[] _buypercent, uint256[] _potpercent, uint256[] _lockperiod, address _gamebook) public {
require((_tokenAddress.length == _payAddress.length) && (_payAddress.length == _price.length) && (_price.length == _buypercent.length) && (_buypercent.length == _potpercent.length), "TokenPool constructor wrong");
tokenNum = _tokenAddress.length;
for (uint256 i = 0; i < tokenNum; i++) {
tokenPool[i].token = ERC20Token(_tokenAddress[i]);
tokenPool[i].addr = _tokenAddress[i];
tokenPool[i].decimals = tokenPool[i].token.decimals();
tokenPool[i].payaddr = _payAddress[i];
tokenPool[i].bought = 0;
tokenPool[i].safed = 0;
tokenPool[i].potted = 0;
tokenPool[i].price = _price[i];
tokenPool[i].buypercent = _buypercent[i];
tokenPool[i].potpercent = _potpercent[i];
tokenPool[i].lockperiod = _lockperiod[i];
tokenPool[i].tid = i;
tokenPool[i].active = true;
tokenInPool[_tokenAddress[i]] = true;
}
gamebook = WTAGameBook(_gamebook);
} | 1 | 4,847 |
function manualSendTokens (address _address, uint _tokens) public onlyTechSupport {
token.sendCrowdsaleTokens(_address, _tokens);
tokensSold = tokensSold.add(_tokens);
emit OnSuccessfullyBuy(_address,0,false,_tokens);
} | 1 | 7,144 |
function mergeAstros(address userAddress, uint novaCoinCentCost, uint[] astroIDs) external onlyManager {
NovaCoinInterface novaCoinContract = NovaCoinInterface(novaCoinAddress);
require(novaCoinContract.balanceOf(userAddress) >= novaCoinCentCost);
require(astroIDs.length > 1 && astroIDs.length <= 10);
uint mergeMass = _combine(userAddress, astroIDs);
novaCoinContract.consumeCoinForNova(userAddress, novaCoinCentCost);
uint famedID;
bytes32 novaName;
AstroType newType;
uint finalMass;
(famedID, novaName, newType, finalMass) = _merge(userAddress, mergeMass);
MergedAstros(userAddress, _insertNewAstro(userAddress, newType, finalMass, novaName, famedID));
} | 1 | 9,016 |
function onIncreaseApproval(address _sender, address _spender, uint _addedValue) onlyHookableTokenAddress {
} | 0 | 18,855 |
function payOut(address _playerAddress, uint128 _stake, int _balance) internal {
assert(_balance <= conflictRes.maxBalance());
assert((int(_stake) + _balance) >= 0);
uint valuePlayer = uint(int(_stake) + _balance);
if (_balance > 0 && int(houseStake) < _balance) {
valuePlayer = houseStake;
}
houseProfit = houseProfit - _balance;
int newHouseStake = int(houseStake) - _balance;
assert(newHouseStake >= 0);
houseStake = uint(newHouseStake);
pendingReturns[_playerAddress] += valuePlayer;
if (pendingReturns[_playerAddress] > 0) {
safeSend(_playerAddress);
}
} | 1 | 744 |
function sell(bytes32 hash, uint amount) public {
OrderInfo storage info = orderInfos[hash];
bool find = false;
if (info.limitUser.length > 0) {
for (uint i = 0; i < info.limitUser.length; i++) {
if (info.limitUser[i] == msg.sender) {
find = true;
break;
}
}
require(find);
}
require(info.fill < info.eth);
require(info.expires >= now);
uint remain = info.eth - info.fill;
uint remainAmount = remain.mul(info.amount).div(info.eth);
uint tradeAmount = remainAmount < amount ? remainAmount : amount;
ERC20(info.token).safeTransferFrom(msg.sender, this, tradeAmount);
uint total = info.eth.mul(tradeAmount).div(info.amount);
msg.sender.transfer(total);
ERC20(info.token).transfer(info.owner, tradeAmount);
info.fill = info.fill.add(total);
emit Trade(hash, msg.sender, info.token, tradeAmount, info.owner, total);
} | 1 | 9,090 |
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
return weiAmount.mul(_getCurrentRate());
} | 0 | 11,915 |
function staticExchangeChecks_(
OrderData data
)
public
view
onlyTotle
returns (bool checksPassed)
{
return (block.timestamp <= data.expirationTimeSeconds &&
toBytes4(data.takerAssetData, 0) == bytes4(0xf47261b0) &&
toBytes4(data.makerAssetData, 0) == bytes4(0xf47261b0) &&
data.takerFee == 0 &&
(data.takerAddress == address(0x0) || data.takerAddress == address(this)) &&
(data.senderAddress == address(0x0) || data.senderAddress == address(this))
);
} | 0 | 17,647 |
function balanceOf(address _owner) constant returns (uint256 balance) ;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract StandardToken is Token {
struct LCBalance{
uint lcValue;
uint lockTime;
uint ethValue;
uint index;
bytes32 indexHash;
uint8 lotteryNum;
} | 0 | 18,497 |
function powerUp(address _sender, address _from, uint256 _amountBabz) public onlyNutz whenNotPaused {
uint256 authorizedPow = authorizedPower();
require(authorizedPow != 0);
require(_amountBabz != 0);
uint256 totalBabz = totalSupply();
require(totalBabz != 0);
uint256 amountPow = _amountBabz.mul(authorizedPow).div(totalBabz);
uint256 outstandingPow = outstandingPower();
require(outstandingPow.add(amountPow) <= maxPower);
if (_sender != _from) {
allowed[_from][_sender] = allowed[_from][_sender].sub(_amountBabz);
}
_setOutstandingPower(outstandingPow.add(amountPow));
uint256 powBal = powerBalanceOf(_from).add(amountPow);
require(powBal >= authorizedPow.div(10000));
_setPowerBalanceOf(_from, powBal);
_setActiveSupply(activeSupply().sub(_amountBabz));
_setBabzBalanceOf(_from, babzBalanceOf(_from).sub(_amountBabz));
_setPowerPool(powerPool().add(_amountBabz));
Power(powerAddr).powerUp(_from, amountPow);
} | 1 | 5,954 |
function release(uint256 iPlan) public {
require(iPlan >= 0 && iPlan < _numPlans);
require(_plans[iPlan].currentyStage < _plans[iPlan].stages);
uint256 duration = block.timestamp.sub(_plans[iPlan].start);
uint256 nextStage = duration.div(_plans[iPlan].durationPerStage);
nextStage = nextStage.add(1);
if(nextStage > _plans[iPlan].stages) {
nextStage = _plans[iPlan].stages;
}
uint256 unreleased = _releasableAmount(iPlan, nextStage);
require(unreleased > 0);
_plans[iPlan].currentyStage = nextStage;
_plans[iPlan].released = _plans[iPlan].released.add(unreleased);
_token.transfer(_plans[iPlan].beneficiary, unreleased);
} | 0 | 16,818 |
function handleRing(
uint64 _ringIndex,
RingParams params,
OrderState[] orders,
TokenTransferDelegate delegate
)
private
{
address _lrcTokenAddress = lrcTokenAddress;
verifyRingHasNoSubRing(params.ringSize, orders);
verifyMinerSuppliedFillRates(params.ringSize, orders);
scaleRingBasedOnHistoricalRecords(delegate, params.ringSize, orders);
calculateRingFillAmount(params.ringSize, orders);
calculateRingFees(
delegate,
params.ringSize,
orders,
_lrcTokenAddress
);
bytes32[] memory orderInfoList = settleRing(
delegate,
params.ringSize,
orders,
params.feeRecipient,
_lrcTokenAddress
);
emit RingMined(
_ringIndex,
params.ringHash,
tx.origin,
params.feeRecipient,
orderInfoList
);
} | 0 | 10,925 |
function BuyTorpedo( int256 score, uint256 torpedoBatchID, address _referrer_address , bytes32 r , bytes32 s , uint8 v ) public payable
onlyDirectTransaction
{
address _customer_address = msg.sender;
uint256 eth = msg.value;
require( maintenanceMode==false && (eth==minimumSharePrice || eth==minimumSharePrice*10 || eth==minimumSharePrice*100));
GameVar_s memory gamevar;
gamevar.score = score;
gamevar.torpedoBatchID = torpedoBatchID;
gamevar.r = r;
gamevar.s = s;
gamevar.v = v;
gamevar.multiplier =uint32( eth / minimumSharePrice);
CoreBuyTorpedo( _customer_address , eth , _referrer_address, gamevar);
} | 1 | 729 |
function buyWithBonus(address inviter) validSale payable {
require( msg.sender != inviter );
uint tokens = safeMul(msg.value, fundAddress.price(block.timestamp));
uint bonus = safeDiv(safeMul(tokens, rate), 100);
fundAddress.buyRecipient.value(msg.value)(msg.sender);
totalSupply = safeAdd(totalSupply, bonus);
bonusBalances[inviter] = safeAdd(bonusBalances[inviter], bonus);
BuyWithBonus(msg.sender, inviter, msg.value, tokens, bonus);
} | 1 | 1,640 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require (block.number > tokenFrozenUntilBlock);
require (!restrictedAddresses[_to]);
require(balances[_from] >= _value);
require (balances[_to] + _value >= balances[_to]);
require (_value <= allowances[_from][msg.sender]);
require (!(_from == owner && block.timestamp < timeLock && (balances[_from]-_value) < 10000000 * 10 ** 18));
balances[_from] -= _value;
balances[_to] += _value;
allowances[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} | 0 | 19,020 |
function insertNewUser(uint32 _id, bytes32 _nickname, address _ethAddr, uint _peloAmount, uint _peloBonus, uint _bitFlag, uint32 _expire, bool fWithTransfer) onlyManyOwners public {
PELOMember memory data;
require(_id > 0);
require(PELOMemberMap[_ethAddr].id == 0);
require(PELOMemberIDMap[_id] == 0x0);
data.id = _id;
data.nickname = _nickname;
data.ethAddr = _ethAddr;
data.peloAmount = _peloAmount;
data.peloBonus = _peloBonus;
data.bitFlag = _bitFlag;
data.expire = _expire;
PELOMemberMap[_ethAddr] = data;
PELOMemberIDMap[_id] = _ethAddr;
if(fWithTransfer) {
require(_peloAmount > 0);
uint256 amount = (_peloAmount + _peloBonus) * 10 ** uint256(decimals);
_transfer(msg.sender, _ethAddr, amount);
assert(balanceOf[_ethAddr] == amount);
}
numMembers++;
} | 1 | 9,396 |
function is only called by token sales.
function mintTimeLocked (
address _beneficiary,
uint256 _tokenAmount,
uint256 _releaseTime
) external onlyTokenSale returns(bool) {
require(isStarted && !isFinalized);
require(TokenController(tokenControllerAddr).mint(this, _tokenAmount));
require(ERC20Interface(token).approve(timeLockPoolAddr, _tokenAmount));
require(TimeLockPool(timeLockPoolAddr).depositERC20(
token,
_beneficiary,
_tokenAmount,
_releaseTime
));
return true;
} | 1 | 8,900 |
function finalize() external onlyOwner {
require(!finalized);
require(hasEnded());
uint256 receiptsMinted = tokenContract.totalSupply();
uint256 shareForTheTeam = receiptsMinted.div(3);
tokenContract.mint(wallet, shareForTheTeam);
tokenContract.finishMinting();
finalized = true;
} | 1 | 542 |
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
return super.transferFrom(_from, _to, _value);
} | 0 | 10,204 |
function transferAndCall(address to, uint256 value, bytes data) public payable returns (bool) {
transfer(to, value);
require(_caller.makeCall.value(msg.value)(to, data));
return true;
} | 1 | 9,143 |
function approve(address _spender, uint256 _value)constant returns (bool success){
allowed[msg.sender][_spender]=_value;
Approval(msg.sender,_spender,_value);
return true;
} | 0 | 15,618 |
functions related to Refunding can be found here.
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
} | 1 | 6,778 |
function uintToBytes(uint v) constant returns (bytes32 ret) {
if (v == 0) {
ret = '0';
}
else {
while (v > 0) {
ret = bytes32(uint(ret) / (2 ** 8));
ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
v /= 10;
}
}
return ret;
} | 0 | 18,421 |
function addAddressToAdmin(address addr) onlyMaster public returns(bool success) {
if (!admin[addr]) {
admin[addr] = true;
AdminAddressAdded(addr);
success = true;
}
} | 0 | 15,727 |
function donate(address beneficiary) internal stopInEmergency respectTimeFrame {
uint voteToSend = safeMul(msg.value, votePerETH)/(1 ether);
if (!vote.transfer(beneficiary, voteToSend)) throw;
backers[beneficiary] = safeAdd(backers[beneficiary], msg.value);
totalReward = safeAdd(totalReward, msg.value);
ReceiveDonate(beneficiary, msg.value);
} | 1 | 3,204 |
function r1 (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.PendingR1);
transaction.status = transactionStatus.PendingR2;
base.transferFrom(reserve, _tag, rF);
} | 1 | 3,062 |
function getRandom(uint maxNum) private returns(uint,uint) {
bytes32 curRandom = keccak256(abi.encodePacked(msg.sender,mRandomValue));
curRandom = mConfig.getRandom(curRandom);
curRandom = keccak256(abi.encodePacked(msg.sender,mRandomValue));
uint value1 = (uint(curRandom) % maxNum);
curRandom = keccak256(abi.encodePacked(msg.sender,curRandom,value1));
uint value2 = (uint(curRandom) % maxNum);
mRandomValue = curRandom;
return (value1,value2);
} | 1 | 6,724 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance, "Increase amount larger than balance.");
require (jackpotSize + lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds.");
sendFunds(beneficiary, withdrawAmount, withdrawAmount, 0, 0, 0);
} | 0 | 17,013 |
function closeFuturesContract (bytes32 futuresContract, uint256 price) onlyOracle returns (bool)
{
if (futuresContracts[futuresContract].expirationBlock == 0) return false;
if (futuresContracts[futuresContract].closed == true) return false;
if (futuresContracts[futuresContract].expirationBlock > block.number
&& price > futuresContracts[futuresContract].floorPrice
&& price < futuresContracts[futuresContract].capPrice) return false;
if (price <= futuresContracts[futuresContract].floorPrice)
{
futuresContracts[futuresContract].closingPrice = futuresContracts[futuresContract].floorPrice;
}
else if (price >= futuresContracts[futuresContract].capPrice)
{
futuresContracts[futuresContract].closingPrice = futuresContracts[futuresContract].capPrice;
}
else
{
futuresContracts[futuresContract].closingPrice = price;
}
futuresContracts[futuresContract].closed = true;
emit FuturesContractClosed(futuresContract, price);
} | 0 | 18,764 |
function sendTokens(uint _etherValue, address _to) internal isUnderHardCap {
uint limit;
uint bonusCoefficient;
(limit, bonusCoefficient) = getStageData();
uint tokens = (_etherValue).mul(bonusCoefficient).mul(decimals).div(100);
tokens = tokens.div(rate);
bool needPause;
if (tokens > limit) {
needPause = true;
uint stageEther = calculateStagePrice();
period++;
if (period == 4) {
balances[msg.sender] = balances[msg.sender].add(stageEther);
sumWei = sumWei.add(stageEther);
token.ownersTransfer(_to, limit);
totalSold = totalSold.add(limit);
_to.transfer(_etherValue.sub(stageEther));
state = false;
return;
}
balances[msg.sender] = balances[msg.sender].add(stageEther);
sumWei = sumWei.add(stageEther);
token.ownersTransfer(_to, limit);
totalSold = totalSold.add(limit);
sendTokens(_etherValue.sub(stageEther), _to);
} else {
require(tokens <= token.balanceOf(this));
if (limit.sub(tokens) < 500) {
needPause = true;
period++;
}
balances[msg.sender] = balances[msg.sender].add(_etherValue);
sumWei = sumWei.add(_etherValue);
token.ownersTransfer(_to, tokens);
totalSold = totalSold.add(tokens);
}
if (needPause) {
pausedByValue = true;
usersPause();
}
} | 1 | 1,952 |
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
} | 0 | 11,401 |
function _isReadyToBreed(uint256 _botId, Bot _bot) internal view returns (bool) {
return
(_bot.siringWithId == 0) &&
(_bot.cooldownEndBlock <= uint64(block.number)) &&
(locks[_botId] & LOCK_BREEDING == 0);
} | 1 | 7,606 |
function getSupplies() public view returns (uint256,uint256,uint256,uint256) {
require(msg.sender == _owner);
return (supplies.remains,supplies.bsRemain,supplies.peRemain,supplies.tmRemain);
} | 0 | 17,439 |
function enableBurning(bool _burningEnabled) public onlyOwner{
tokenContract.enableBurning(_burningEnabled);
} | 0 | 14,585 |
function exchange(address _partner, uint _amount) public {
require(balances[msg.sender] >= _amount);
uint codeLength;
assembly {
codeLength := extcodesize(_partner)
}
require(codeLength > 0);
require(exchangePartners[_partner]);
require(requestTokensFromOtherContract(_partner, this, msg.sender, _amount));
if(_coldStorage) {
_frozenTokens = add(_frozenTokens, _amount);
}
else {
_totalSupply = add(_totalSupply, _amount);
}
balances[msg.sender] = sub(balanceOf(msg.sender), _amount);
Exchanged(msg.sender, _partner, _amount);
Transfer(msg.sender, this, _amount);
} | 1 | 6,218 |
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
if (to != gameAddress && from != gameAddress) {
uint256 transferFee = value.div(100);
_burn(from, transferFee);
value = value.sub(transferFee);
}
if (to != gameAddress && _balances[to] == 0 && value >= MIN_HOLDERS_BALANCE) {
holders.push(to);
}
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
} | 0 | 11,373 |
function() payable {
throw;
} | 1 | 3,617 |
function sectionForSale(
uint _section_index
) returns (bool) {
if (_section_index >= sections.length) throw;
Section s = sections[_section_index];
if(s.for_sale)
{
if(s.sell_only_to == 0x0) return true;
if(s.sell_only_to == msg.sender) return true;
return false;
}
else
{
return false;
}
} | 0 | 14,984 |
constructor(address _tokenAddress, address _payAddress, uint256 _price, uint256 _buypercent, uint256 _lockperiod, uint256 _candythreshold,
uint256 _candyprob, address _defaddress) public {
tokenInfo.token = ERC20Token(_tokenAddress);
tokenInfo.addr = _tokenAddress;
tokenInfo.decimals = tokenInfo.token.decimals();
tokenInfo.payaddr = _payAddress;
tokenInfo.bought = 0;
tokenInfo.vaulted = 0;
tokenInfo.price = _price;
tokenInfo.buypercent = _buypercent;
tokenInfo.lockperiod = _lockperiod;
candythreshold = _candythreshold;
candyprob = _candyprob;
defaddress = _defaddress;
defid = addInvestor(defaddress, address(0x0), address(0x0));
} | 1 | 2,078 |
function transferTokens (address _recipient) public {
require(_recipient != address(0));
require(now >= startTime);
require(_recipient != companyWallet);
require(now >= allocations[_recipient].endCliff);
require(allocations[_recipient].amountClaimed < allocations[_recipient].totalAllocated);
uint256 newAmountClaimed;
if (allocations[_recipient].endVesting > now) {
newAmountClaimed = allocations[_recipient].totalAllocated.mul(now.sub(allocations[_recipient].endCliff)).div(allocations[_recipient].endVesting.sub(allocations[_recipient].endCliff));
} else {
newAmountClaimed = allocations[_recipient].totalAllocated;
}
uint256 tokensToTransfer = newAmountClaimed.sub(allocations[_recipient].amountClaimed);
allocations[_recipient].amountClaimed = newAmountClaimed;
require(IBST.transfer(_recipient, tokensToTransfer));
grandTotalClaimed = grandTotalClaimed.add(tokensToTransfer);
LogIBSTClaimed(_recipient, allocations[_recipient].allocationType, tokensToTransfer, newAmountClaimed, grandTotalClaimed);
} | 1 | 6,921 |