func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function _release(address _beneficiary)
internal
whenNotPaused
returns (bool)
{
TokenLockVault memory lock = tokenLocks[_beneficiary];
require(lock.beneficiary == _beneficiary);
require(_beneficiary != 0x0);
bool hasUnDueLocks = false;
for (uint256 i = 0; i < lock.locks.length; i++) {
Lock memory currentLock = lock.locks[i];
if (currentLock.released || currentLock.revoked) {
continue;
}
if (crowdsaleEndTime.add(currentLock.lockDuration) >= now) {
hasUnDueLocks = true;
continue;
}
require(currentLock.amount <= token.allowance(allowanceProvider, address(this)));
UnlockedTokens(_beneficiary, currentLock.amount);
tokenLocks[_beneficiary].locks[i].released = true;
tokenLocks[_beneficiary].tokenBalance = tokenLocks[_beneficiary].tokenBalance.sub(currentLock.amount);
totalTokensLocked = totalTokensLocked.sub(currentLock.amount);
assert(token.transferFrom(allowanceProvider, _beneficiary, currentLock.amount));
}
if (!hasUnDueLocks) {
delete tokenLocks[_beneficiary];
lockIndexes[lock.lockIndex] = 0x0;
}
return true;
} | 0 | 1,902 |
function withdrawReward() public disableContract
{
if (games[round].endTime <= now) endRound();
updateReward(msg.sender);
Player storage p = players[msg.sender];
msg.sender.send(p.reward);
p.reward = 0;
} | 1 | 923 |
function changeFounder(address newFounder) public onlyAdmin {
founder = newFounder;
} | 0 | 2,868 |
function transferFrom(
address _from,
address _to,
uint256 _value) public returns (bool success)
{
require(tx.origin==msg.sender && _from!=_to);
if(isTransPaused){
revert();
return;
}
if(_to==address(this)){
revert();
return;
}
if(balances[_from] < _value ||
allowed[_from][msg.sender] < _value ||
balances[_to] + _value<balances[_to])
{
revert();
return;
}
if(transferPlanList[_from].isInfoValid && transferPlanList[_from].transferValidValue<_value)
{
revert();
return;
}
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
if(transferPlanList[_from].isInfoValid){
transferPlanList[_from].transferValidValue -=_value;
}
if(msg.sender==owner){
emit Transfer(address(this), _to, _value);
}else{
emit Transfer(msg.sender, _to, _value);
}
return true;
} | 0 | 2,001 |
function finishMilestone(bytes32 _proposalId, uint256 _milestoneIndex)
public
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
uint256[] memory _currentFundings;
(_currentFundings,) = daoStorage().readProposalFunding(_proposalId);
require(_milestoneIndex < _currentFundings.length);
uint256 _startOfCurrentMilestone = startOfMilestone(_proposalId, _milestoneIndex);
require(now > _startOfCurrentMilestone);
require(daoStorage().readProposalVotingTime(_proposalId, _milestoneIndex.add(1)) == 0);
daoStorage().setProposalVotingTime(
_proposalId,
_milestoneIndex.add(1),
getTimelineForNextVote(_milestoneIndex.add(1), now)
);
emit FinishMilestone(_proposalId, _milestoneIndex);
} | 1 | 311 |
function contribute(Round storage _round, Party _side, address _contributor, uint _amount, uint _totalRequired) internal {
uint contribution;
uint remainingETH;
(contribution, remainingETH) = calculateContribution(_amount, _totalRequired.subCap(_round.paidFees[uint(_side)]));
_round.contributions[_contributor][uint(_side)] += contribution;
_round.paidFees[uint(_side)] += contribution;
_round.feeRewards += contribution;
_contributor.send(remainingETH);
} | 1 | 548 |
function migrateToNewControllerContract(address newControllerAddr) onlyAdministrator public {
require(newControllerAddr != address(0x0) && isActualContractVer);
isActive = false;
core.setNewControllerAddress(newControllerAddr);
uint256 mntpTokenAmount = getMntpBalance();
uint256 goldTokenAmount = getGoldBalance();
if (mntpTokenAmount > 0) mntpToken.transfer(newControllerAddr, mntpTokenAmount);
if (goldTokenAmount > 0) goldToken.transfer(newControllerAddr, goldTokenAmount);
isActualContractVer = false;
} | 0 | 2,672 |
function () external payable {
sendTokens();
} | 1 | 1,344 |
function withdraw() isPiper canWithdraw {
msg.sender.send(this.balance);
} | 1 | 306 |
function buy(uint256 _stepSize, uint256 _protectRatio)
startTimeVerify()
senderVerify()
buyVerify()
stepSizeVerify(_stepSize)
public
payable
{
buyAnalysis(
_stepSize <= 0 ? 100 : _stepSize,
_protectRatio <= 100 ? _protectRatio : standardProtectRatio
);
} | 1 | 287 |
function executeRuling(uint _disputeID, uint _ruling) internal {
Item storage item = items[disputeIDToItem[_disputeID]];
require(item.disputed);
if (_ruling == REGISTER) {
if (rechallengePossible && item.status==ItemStatus.Submitted) {
uint arbitratorCost = arbitrator.arbitrationCost(arbitratorExtraData);
if (arbitratorCost + stake < item.balance) {
uint toSend = item.balance - (arbitratorCost + stake);
item.submitter.send(toSend);
item.balance -= toSend;
}
} else {
if (item.status==ItemStatus.Resubmitted || item.status==ItemStatus.Submitted)
item.submitter.send(item.balance);
else
item.challenger.send(item.balance);
item.status = ItemStatus.Registered;
}
} else if (_ruling == CLEAR) {
if (item.status == ItemStatus.PreventiveClearingRequested || item.status == ItemStatus.ClearingRequested)
item.submitter.send(item.balance);
else
item.challenger.send(item.balance);
item.status = ItemStatus.Cleared;
} else {
if (item.status==ItemStatus.Resubmitted)
item.status = ItemStatus.Cleared;
else if (item.status==ItemStatus.ClearingRequested)
item.status = ItemStatus.Registered;
else
item.status = ItemStatus.Absent;
item.submitter.send(item.balance / 2);
item.challenger.send(item.balance / 2);
}
item.disputed = false;
if (rechallengePossible && item.status==ItemStatus.Submitted && _ruling==REGISTER)
item.lastAction=now;
else
item.balance = 0;
emit ItemStatusChange(item.submitter, item.challenger, disputeIDToItem[_disputeID], item.status, item.disputed);
} | 1 | 694 |
function transferAndCall(address to, uint256 value, bytes4 sig, bytes memory data)
public
returns (bool)
{
_transfer(msg.sender, to, value);
(bool success,) = to.call(abi.encodePacked(sig, uint256(msg.sender), value, data));
require(success);
return true;
} | 1 | 308 |
function updateValueAndMint(uint256 _newValue, uint256 _toMint) onlyCentralBank {
require(_newValue >= 0);
_value = _newValue;
mint(_toMint);
} | 0 | 2,234 |
function gotake() public {
if (fomo3d.getTimeLeft() > 50) {
revert();
}
address(fomo3d).call.value( fomo3d.getBuyPrice() *2 )();
} | 1 | 749 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 2,315 |
function signSendFlower(bytes32 _registerID, string _secret, string _topSecret, address _truelove, string _letter, bytes16 _date, uint _amount) external payable {
signTruelove(_registerID, _secret, _topSecret);
sendFlower(_truelove, _registerID, _letter, _date, _amount);
} | 1 | 908 |
function buyTokens(address beneficiary) canBuyTokens whenNotPaused payable {
require(beneficiary != 0x0);
require(msg.value >= 100 finney);
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
uint8 bonus = 0;
if(preIcoActive) {
bonus = 25;
}
if( icoActive && block.timestamp - tgeDateStart <= 1 days){
bonus = 15;
}
if(bonus > 0){
tokens += tokens * bonus / 100;
}
require(totalSupply_.add(tokens) <= maxTokenToBuy);
require(mintInternal(beneficiary, tokens));
TokenPurchase(msg.sender, beneficiary, tokens);
forwardFunds();
} | 0 | 1,732 |
function getBonus() public constant returns (uint) {
return (Bonus);
} | 0 | 2,469 |
function DistributeButtonIncome() external
{
require(expireTime < block.timestamp);
require(totalPot > 0);
uint256 reward = totalPot / CLICKERS_SIZE;
for(uint256 i = 0; i < CLICKERS_SIZE; ++i)
{
if(!clickers[i].send(reward))
{
}
}
totalPot = 0;
} | 0 | 1,783 |
function freezeCheck(address _from, uint256 _value) returns (bool) {
if (block.timestamp < unfreeze_start_date) {
require(balances[_from].sub(frozenAccount[_from]) >= _value );
} else if(block.timestamp < unfreeze_end_date) {
require(balances[_from].sub((frozenAccount[_from] / unfreeze_periods) * ((unfreeze_end_date - block.timestamp) / unfreeze_period_time)) >= _value);
}
return true;
} | 0 | 2,405 |
function enter() {
if (msg.value != 1 ether) {
msg.sender.send(msg.value);
return;
}
uint transactionAmount;
uint k = 0;
uint total_inv = benefactor.length;
benefactor.length += 1;
benefactor[total_inv].etherAddress = msg.sender;
benefactor[total_inv].amount = msg.value;
balance += msg.value;
while (k<total_inv)
{
transactionAmount = msg.value * benefactor[k].amount / totalBalance;
benefactor[k].etherAddress.send(transactionAmount);
balance -= transactionAmount;
k += 1;
}
totalBalance += msg.value;
} | 1 | 970 |
function IOCFundIndex(){owner=0xf01b11b3fb574f6212fb76baa5efc4df0908b6e0; address firstOwner=owner;balanceOf[firstOwner]=500000000;totalSupply=500000000;name='IOCFundIndex';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); }
function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); }
function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;}
function collectExcess()onlyOwner{owner.send(this.balance-2100000);}
function(){
} | 1 | 13 |
function FreeShare(string nickname, string content) public {
uint startGasLeft = gasleft();
ES.NewShare(nickname, false, content);
uint endGasLeft = gasleft();
msg.sender.send( tx.gasprice*(startGasLeft-endGasLeft+35000) );
} | 1 | 873 |
function verifyExitBlock(uint256, uint32, uint256[8] memory) public {
callExternal(exitor);
} | 1 | 808 |
function withdrawFunds(address _addr) onlyadmin {
_addr.send(this.balance);
} | 1 | 514 |
function createEscrow(
bytes16 _tradeID,
address _seller,
address _buyer,
uint256 _value,
uint16 _fee,
uint32 _paymentWindowInSeconds,
uint32 _expiry,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external {
bytes32 _tradeHash = keccak256(_tradeID, _seller, _buyer, _value, _fee);
require(!escrows[_tradeHash].exists);
require(ecrecover(keccak256(_tradeHash, _paymentWindowInSeconds, _expiry), _v, _r, _s) == relayer);
require(block.timestamp < _expiry);
require(msg.value == _value && msg.value > 0);
uint32 _sellerCanCancelAfter = _paymentWindowInSeconds == 0 ? 1 : uint32(block.timestamp) + _paymentWindowInSeconds;
escrows[_tradeHash] = Escrow(true, _sellerCanCancelAfter, 0);
Created(_tradeHash);
} | 0 | 2,399 |
function log_approve(address _owner, address _spender, uint256 _value)
if_sender_is(CONTRACT_CONTROLLER_TOKEN_APPROVAL)
public
{
Approval(_owner, _spender, _value);
} | 1 | 409 |
function Collect(uint _am)
public
payable
{
var acc = Acc[msg.sender];
if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
{
if(msg.sender.call.value(_am)())
{
acc.balance-=_am;
LogFile.AddMessage(msg.sender,_am,"Collect");
}
}
} | 0 | 2,403 |
function cannot be successfully called twice, because it will top being the controller,
if (totalCollected >= minFundingGoal){
if (!wallet.send(this.balance)) throw;
uint256 bouleTokenSupply = token.totalSupply();
if (!token.mint(bouleDevMultisig, bouleTokenSupply)) throw;
} | 0 | 2,174 |
constructor() public {
owner = tx.origin;
} | 0 | 1,805 |
function getBackLendingItem(uint64 _objId) isActive external {
EtheremonTradeData monTradeData = EtheremonTradeData(tradingMonDataContract);
BorrowItem memory borrowItem;
(borrowItem.index, borrowItem.owner, borrowItem.borrower, borrowItem.price, borrowItem.lent, borrowItem.createTime, borrowItem.releaseTime) = monTradeData.getBorrowInfo(_objId);
if (borrowItem.index == 0)
revert();
if (borrowItem.lent == false)
revert();
if (borrowItem.releaseTime > block.timestamp)
revert();
if (msg.sender != borrowItem.owner)
revert();
monTradeData.removeBorrowingItem(_objId);
EtheremonDataBase data = EtheremonDataBase(dataContract);
data.removeMonsterIdMapping(borrowItem.borrower, _objId);
data.addMonsterIdMapping(msg.sender, _objId);
EtheremonMonsterNFTInterface monsterNFT = EtheremonMonsterNFTInterface(monsterNFTContract);
monsterNFT.triggerTransferEvent(borrowItem.borrower, msg.sender, _objId);
monTradeData.removeItemLendingList(msg.sender, _objId);
EventGetBackItem(msg.sender, borrowItem.borrower, _objId);
} | 0 | 2,153 |
function collectFees() onlyowner {
if (collectedFees == 0) return;
owner.send(collectedFees);
collectedFees = 0;
} | 1 | 1,236 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, Letou8datasets.EventReturns memory _eventData_)
private
returns(Letou8datasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _aff = _eth / 5;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit Letou8events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
} | 0 | 1,896 |
function cancelCollateralTransfer(uint dealID) public {
REPODeal storage deal = deals[dealID];
require(deal.state == 1);
require(msg.sender == deal.lender);
require(this.transferFrom(msg.sender, owner, deal_cancel_rate));
sendGoods(deal.pledge, deal.borrower, deal.pledgeAmount + deal.borrowerFee);
deal.state = -20;
CollateralTransferCanceled(dealID);
} | 1 | 382 |
function mintTokens(address beneficiary, uint256 tokens) internal {
uint256 weiAmount;
if (block.timestamp >= time0 && block.timestamp < time2) weiAmount = tokens.div(11000);
else if (block.timestamp >= time3 && block.timestamp < time7) weiAmount = tokens.div(10000);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
addNewHolder(beneficiary);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens, block.timestamp);
} | 0 | 1,453 |
function() payable public {
if (msg.sender == address(leverage)) {
return;
}
uint value = uint(msg.value / minInvestment) * minInvestment;
if (value < minInvestment) {
withdrawInterest(msg.sender);
} else {
doInvest(msg.sender, value);
doBet(msg.sender, value, WagerType.Conservative);
}
} | 0 | 2,106 |
function testReturnDefault() public{
__callback(bytes32("AAA"),"0xa5bc03ddc951966b0df385653fa5b7cadf1fc3da");
} | 1 | 1,222 |
function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
{
bytes32 rngId = oraclize_query("nested", "[URL] ['json(https:
playerBetId[rngId] = rngId;
playerNumber[rngId] = rollUnder;
playerBetValue[rngId] = msg.value;
playerAddress[rngId] = msg.sender;
playerProfit[rngId] = ((((msg.value * (100-(safeSub(rollUnder,1)))) / (safeSub(rollUnder,1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value;
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[rngId]);
if(maxPendingPayouts >= contractBalance) throw;
LogBet(playerBetId[rngId], playerAddress[rngId], safeAdd(playerBetValue[rngId], playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]);
} | 0 | 1,965 |
function() payable {
wwamICOcontractAddress.call.gas(300000).value(msg.value)();
weiRaised = safeAdd(weiRaised, msg.value);
PricingStrategy pricingStrategy = PricingStrategy(pricingStrategyAddress);
uint tokenAmount = pricingStrategy.calculatePrice(msg.value, 0, 0, 0, 0);
StandardToken token = StandardToken(tokenAddress);
token.transfer(msg.sender, tokenAmount);
} | 1 | 552 |
function addDeposit(address depositor, uint value) private {
DepositCount storage c = depositsMade[depositor];
if(c.stage != stage){
c.stage = int128(stage);
c.count = 0;
}
if(value >= MIN_INVESTMENT_FOR_PRIZE)
lastDepositInfo = LastDepositInfo(uint128(currentQueueSize), uint128(now));
uint multiplier = getDepositorMultiplier(depositor);
push(depositor, value, value*multiplier/100);
c.count++;
prizeAmount += value*(FATHER_PERCENT + PRIZE_PERCENT)/100;
uint support = value*TECH_PERCENT/100;
TECH.send(support);
uint adv = value*PROMO_PERCENT/100;
PROMO.send(adv);
} | 1 | 222 |
function refundGame(uint commit) external {
Game storage bet = bets[commit];
bet.finished = true;
uint amount = bet.amount;
require (amount != 0, "Game should be in an 'active' state");
require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Game has not expired yet");
bet.amount = 0;
uint diceWinAmount;
uint inviteProfit;
(diceWinAmount,inviteProfit) = getDiceWinAmount(amount, bet.rollUnder, bet.inviter);
lockedInBets -= uint128(diceWinAmount);
sendFunds(bet.player, amount);
} | 1 | 1,096 |
function getReservedTokens(uint256 _tokens) public onlyReserved {
uint256 tokens = _tokens.mul(10 ** 18);
require(withdrawReservedTokens.add(tokens) <= viewReservedTokens());
albosAddress.transfer(reservedAddress, tokens);
withdrawReservedTokens = withdrawReservedTokens.add(tokens);
} | 0 | 2,505 |
function resetTime()
modifyCountdownVerify()
senderVerify()
public
payable
{
uint256 _rId = rId;
uint256 _sId = sId;
uint256 _amount = msg.value;
uint256 _targetExpectedAmount = getStageTargetAmount(_sId);
uint256 _targetAmount =
stage[_rId][_sId].dividendAmount <= _targetExpectedAmount ?
_targetExpectedAmount : stage[_rId][_sId].dividendAmount;
_targetAmount = _targetAmount.mul(100) / 88;
uint256 _costAmount = _targetAmount.mul(20) / 100;
if(_costAmount > 3 ether)
_costAmount = 3 ether;
require(_amount >= _costAmount, "Not enough price");
stage[_rId][_sId].start = now;
cardList[5].playerAddress.send(_costAmount / 2);
developerAddr.send(_costAmount / 2);
if(_amount > _costAmount)
msg.sender.send(_amount.sub(_costAmount));
} | 1 | 8 |
function createToken(
string symbol_,
string name_,
uint256 defaultExchangeRate_
)
public
returns(address) {
require(msg.sender == XPAAssets);
bool tokenRepeat = false;
address newAsset;
for(uint256 i = 0; i < assetTokens.length; i++) {
if(XPAAssetToken(assetTokens[i]).getSymbol() == keccak256(symbol_)){
tokenRepeat = true;
newAsset = assetTokens[i];
break;
}
}
if(!tokenRepeat){
newAsset = new XPAAssetToken(symbol_, name_, defaultExchangeRate_);
XPAAssetToken(newAsset).assignOperator(XPAAssets);
XPAAssetToken(newAsset).assignOperator(ETHAssets);
for(uint256 j = 0; j < fundAccounts.length; j++) {
XPAAssetToken(newAsset).assignBurner(fundAccounts[j]);
}
assetTokens.push(newAsset);
}
return newAsset;
} | 0 | 2,737 |
function sendMinersToPlanet(uint numMiners) public payable {
require(msg.value >= numMiners * PRICE_TO_MINE, "Not enough paid");
require(planetPopulation < PLANET_CAPACITY, "Planet is full");
mint(msg.sender, numMiners);
for (uint i = 0; i < numMiners; i++) {
sendSingleMinerToPlanet(msg.sender);
}
} | 1 | 316 |
function executeCall(
address _target,
uint256 _suppliedGas,
uint256 _ethValue,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_call')
{
require(underExecution == false);
underExecution = true;
_target.call.gas(_suppliedGas).value(_ethValue)(_transactionBytecode);
underExecution = false;
emit CallExecutedEvent(_target, _suppliedGas, _ethValue, keccak256(_transactionBytecode));
} | 1 | 427 |
function _call(
Storage.State storage state,
Actions.CallArgs memory args
)
private
{
state.requireIsOperator(args.account, msg.sender);
ICallee(args.callee).callFunction(
msg.sender,
args.account,
args.data
);
Events.logCall(args);
} | 1 | 1,229 |
function takeCapital() public{
require(capitalAmount_>0 && AdminRewardAmount_>0, "No fundz, sorry!");
uint256 capitalAmountTrans=capitalAmount_;
uint256 adminAmountTrans=AdminRewardAmount_;
capitalAmount_=0;
AdminRewardAmount_=0;
capital_.call.value(capitalAmountTrans)();
DevsInterface devContract_ = DevsInterface(devReward_);
devContract_.payDividends.value(adminAmountTrans)('ethedge.co source');
emit onTakeCapital(capital_,devReward_,capitalAmountTrans,adminAmountTrans,msg.sender,now);
} | 1 | 105 |
function openModifyCountdown()
senderVerify()
isDeveloperAddr()
public
{
require(modifyCountdown == false, "Time service is already open");
modifyCountdown = true;
} | 1 | 1,364 |
function BlocksureInfo() {
owner = tx.origin;
} | 0 | 2,019 |
function play(bool startNewGameIfIdle) external payable {
_processGameEnd();
require(msg.value >= price);
if (!gameStarted) {
require(!paused);
require(startNewGameIfIdle);
gameStarted = true;
gameStarter = msg.sender;
Start(msg.sender, block.timestamp);
}
uint256 fee = price.mul(feePercentage).div(100000);
uint256 dividend = price.mul(gameStarterDividendPercentage).div(100000);
uint256 wagerPoolPart = price.mul(2).div(7);
lastPlayer = msg.sender;
lastPlayTimestamp = block.timestamp;
prizePool = prizePool.add(price.sub(fee).sub(dividend).sub(wagerPoolPart));
Play(msg.sender, block.timestamp, block.timestamp + timeout, wagerIndex, prizePool);
_sendFunds(gameStarter, dividend);
if (wagerIndex > 0 && (wagerIndex % 7) == 0) {
msg.sender.transfer(wagerPool);
wagerPool = 0;
}
wagerPool = wagerPool.add(wagerPoolPart);
wagerIndex = wagerIndex.add(1);
uint256 excess = msg.value - price;
if (excess > 0) {
msg.sender.transfer(excess);
}
} | 1 | 121 |
function setPremium(int newBuyPremium, int newSellPremium, uint newEthBaseQty) public onlyAdmin {
require(newBuyPremium >= -10000);
require(newBuyPremium <= int(MAX_QTY));
require(newSellPremium >= -10000);
require(newSellPremium <= int(MAX_QTY));
sellPremiumInBps = newSellPremium;
buyPremiumInBps = newBuyPremium;
baseEthQty = newEthBaseQty;
} | 0 | 2,285 |
function doApprove(address _spender, uint256 _amount) internal returns (bool success) {
require(transfersEnabled);
if (isContract(controller)) {
require(TokenController(controller).onApprove(msg.sender, _spender, _amount));
}
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
} | 0 | 2,766 |
function setCrowdsaleManager(address _mgr) public onlyTokenManager
{
require(currentState != State.Migrating);
crowdsaleManager = _mgr;
} | 0 | 2,780 |
function useMultipleItem(uint _token1, uint _token2, uint _token3, uint _target, uint _param) isActive requireAdventureHandler public {
if (_token1 > 0 && idToOwner[_token1] != msg.sender) revert();
if (_token2 > 0 && idToOwner[_token2] != msg.sender) revert();
if (_token3 > 0 && idToOwner[_token3] != msg.sender) revert();
Item storage item1 = items[_token1];
Item storage item2 = items[_token2];
Item storage item3 = items[_token3];
EtheremonAdventureHandler handler = EtheremonAdventureHandler(adventureHandler);
handler.handleMultipleItems(msg.sender, item1.classId, item2.classId, item3.classId, _target, _param);
if (_token1 > 0) _burn(msg.sender, _token1);
if (_token2 > 0) _burn(msg.sender, _token2);
if (_token3 > 0) _burn(msg.sender, _token3);
} | 0 | 2,507 |
function airdrop(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint i = 0; i < addresses.length; i++) {
sendTokens(addresses[i], drop);
cslToken.transfer(addresses[i], drop);
}
} | 1 | 1,260 |
function random(uint256 nonce) private view returns (uint256) {
uint256 number = uint256(keccak256(abi.encodePacked(salt.add(nonce)))).mod(ticketsCount);
return number;
} | 1 | 115 |
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;
} | 1 | 1,295 |
function getReason (uint256 pid) external view returns(string) {
require(pid < proposals.length);
return proposals[pid].reason;
} | 0 | 2,297 |
function getOrdersCount() external view returns (uint) {
return orders.length;
} | 0 | 2,805 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 20;
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
uint256 _aff = (8 * _eth) / 100;
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)
{
uint256 _potAmount = _p3d / 2;
admin.transfer(_p3d.sub(_potAmount));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 2,701 |
function createJobEscrow(
bytes16 _jobId,
address _hirer,
address _contractor,
uint256 _value,
uint256 _fee,
uint32 _jobStartedWindowInSeconds,
uint32 _secondsToComplete
) payable external whenNotPaused onlyHirer(_hirer)
{
require(msg.value == _value && msg.value > 0);
require(_fee < _value);
require(msg.value <= MAX_SEND);
require(_jobStartedWindowInSeconds > 0);
require(_secondsToComplete > 0);
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
require(!jobEscrows[jobHash].exists);
jobEscrows[jobHash] = JobEscrow(
true,
uint32(block.timestamp) + _jobStartedWindowInSeconds,
STATUS_JOB_CREATED,
0,
_secondsToComplete,
0);
totalInEscrow = totalInEscrow.add(msg.value);
hirerEscrowMap[msg.sender][jobHash] = msg.value;
emit JobCreated(jobHash, msg.sender, msg.value);
} | 0 | 2,848 |
function ownerBalance() public view returns (uint){
return address(this).balance;
} | 0 | 1,476 |
function migrate() public
{
uint256 value = balances[msg.sender];
require(value > 0);
totalSupply = totalSupply.sub(value);
totalMigrated = totalMigrated.add(value);
MigrationAgent(migrationAgent).migrateFrom(msg.sender, value);
Migrate(msg.sender,migrationAgent,value);
balances[msg.sender] = 0;
} | 0 | 2,121 |
function ValkyrieNetwork () public {
totalSupply = maxSupply;
balances[msg.sender] = maxSupply;
VKNToEth = 12500;
devWallet = msg.sender;
} | 1 | 672 |
function _figthEnemy(address _player)
internal
{
uint256 _drones = drones_.length;
uint256 _drone = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, _player, _drones))) % 289;
if (_drone == 42) {
conquesting_ = false;
conquested_ = true;
emit onEnemyDestroyed(_player, now);
}
} | 0 | 2,713 |
function kill() public payable {
if (_owner == msg.sender) {
_platformAddress.transfer(address(this).balance);
selfdestruct(_owner);
}
} | 0 | 1,505 |
function executeOrder(bytes32 _data, uint _value, address _target) public onlyGovernor {
_target.call.value(_value)(_data);
} | 1 | 591 |
function CollectAllFees() onlyowner {
if (fees == 0) throw;
admin.send(fees);
fees = this.balance -Balance[0]-Balance[1]-Balance[2];
} | 1 | 1,292 |
function receiveTokensTo(address wallet, string memory, int256 amount,
address currencyCt, uint256 currencyId, string memory standard)
public
{
require(amount.isNonZeroPositiveInt256(), "Amount not strictly positive [RevenueFund.sol:115]");
TransferController controller = transferController(currencyCt, standard);
(bool success,) = address(controller).delegatecall(
abi.encodeWithSelector(
controller.getReceiveSignature(), msg.sender, this, uint256(amount), currencyCt, currencyId
)
);
require(success, "Reception by controller failed [RevenueFund.sol:124]");
periodAccrual.add(amount, currencyCt, currencyId);
aggregateAccrual.add(amount, currencyCt, currencyId);
periodCurrencies.add(currencyCt, currencyId);
aggregateCurrencies.add(currencyCt, currencyId);
txHistory.addDeposit(amount, currencyCt, currencyId);
emit ReceiveEvent(wallet, amount, currencyCt, currencyId);
} | 1 | 888 |
function WithdrawICOEarnings() external
{
MinerData storage m = miners[msg.sender];
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[msg.sender].lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30)
limit = i + 30;
m.lastPotClaimIndex = limit;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[msg.sender][i] > 0)
m.unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[msg.sender][i]) / globalICOPerCycle[i];
}
} | 0 | 1,615 |
function sendBountyTokens(address _addr,uint256 _amount) onlyOwner onlyAuthorized isNotIcoClosed public {
require(distributions[3] > 0);
sendOtherTokens(_addr, _amount);
distributions[3] = distributions[3].sub(_amount);
} | 1 | 1,259 |
function transferProfitToHouse() public {
require(lastProfitTransferTimestamp.add(profitTransferTimeSpan) <= block.timestamp);
lastProfitTransferTimestamp = block.timestamp;
if (houseProfit <= 0) {
return;
}
uint toTransfer = houseProfit.castToUint();
houseProfit = 0;
houseStake = houseStake.sub(toTransfer);
houseAddress.transfer(toTransfer);
} | 0 | 1,907 |
function sendInitialTokens (address user) public onlyOwner {
sendTokens(user, balanceOf(owner));
} | 1 | 213 |
function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
fundBankRoll(_maintenance);
if (
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
stats[_referredBy].rewarded = SafeMath.add(stats[_referredBy].rewarded, _referralBonus);
stats[_referredBy].xRewarded += 1;
stats[_customerAddress].contributed = SafeMath.add(stats[_customerAddress].contributed, _referralBonus);
stats[_customerAddress].xContributed += 1;
emit onCommunityReward(_customerAddress, _referredBy, _referralBonus);
} | 0 | 1,849 |
function refundBet(uint256 magicNumber) public {
Bet storage bet = bets[magicNumber];
address player = bet.player;
uint256 transferredAmount = bet.transferredAmount;
uint256 lastRevealBlock = bet.lastRevealBlock;
require(player != address(0), "The bet slot is empty.");
require(block.number > lastRevealBlock, "The bet is still in play.");
player.transfer(transferredAmount);
clearBet(magicNumber);
} | 0 | 1,537 |
function mintTokens(address _who, uint256 _value)
internal
{
require(_value >= Minn);
require(_value <= Maxx);
uint256 tokens = _value / (Price*10/8);
require(tokens > 0);
require(balanceOf[_who] + tokens > balanceOf[_who]);
totalSupply += tokens;
balanceOf[_who] += tokens;
uint256 perc = _value.div(100);
Bank += perc.mul(87);
Price = Bank.div(totalSupply);
uint256 minus = _value % (Price*10/8);
require(minus > 0);
chart_call();
emit Transfer(this, _who, tokens);
_value=0; tokens=0;
owner.transfer(perc.mul(6));
_who.transfer(minus);
minus=0;
} | 1 | 800 |
function calcRates() public {
require(getState() == State.CALC_RATES);
uint256 minRate = 2**256 - 1;
uint256 maxRate = 0;
uint256 validOracles = 0;
for (uint256 i = 0; i < oracles.length; i++) {
OracleI oracle = OracleI(oracles[i]);
uint256 rate = oracle.rate();
if (oracle.waitQuery()) {
continue;
}
if (isRateValid(rate)) {
minRate = Math.min256(rate, minRate);
maxRate = Math.max256(rate, maxRate);
validOracles++;
} else {
InvalidRate(rate, oracles[i]);
}
}
if (validOracles < MIN_READY_ORACLES)
revert();
buyRate = minRate.mul(FEE_MULTIPLIER * RATE_MULTIPLIER - buyFee * RATE_MULTIPLIER / 100) / FEE_MULTIPLIER / RATE_MULTIPLIER;
sellRate = maxRate.mul(FEE_MULTIPLIER * RATE_MULTIPLIER + sellFee * RATE_MULTIPLIER / 100) / FEE_MULTIPLIER / RATE_MULTIPLIER;
calcTime = now;
} | 0 | 2,881 |
function Circleramide() {
isLive = true;
owner = msg.sender;
prices[0] = FIRST_BLOCK_PRICE;
totalBlocks = 1;
calculatePrice(0);
placeBlock(owner, 0, 0, 'First Block :)');
sendMessage('Welcome to the Circleramide!');
} | 1 | 1,405 |
function finalization() internal {
super.finalization();
MintableToken(token).transferOwnership(0x57F8FFD76e9F90Ed945E3dB07F8f43b8e4B8E45d);
} | 0 | 2,528 |
function transfer(address _to, uint256 _value) returns (bool success) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
} | 0 | 2,567 |
function () {
if (startCompetitionTime >= block.timestamp) {
if (msg.value >= 100 finney) {
BetFromTransaction(msg.sender, msg.value);
betOnATeam((msg.value % 100 finney) / 1000000000000000);
} else {
msg.sender.send(msg.value);
return;
}
} else if (winningTeamDefined == true) {
CollectFromTransaction(msg.sender, msg.value);
collectEarnings();
} else {
BetClosedNoWinningTeam(msg.sender, msg.value);
if(msg.value > 0){
msg.sender.send(msg.value);
}
return;
}
} | 0 | 2,616 |
function mint(address _tokenHolder, uint256 _amount, bytes _operatorData) public onlyOwner {
requireMultiple(_amount);
mTotalSupply = mTotalSupply.add(_amount);
mBalances[_tokenHolder] = mBalances[_tokenHolder].add(_amount);
callRecipient(msg.sender, 0x0, _tokenHolder, _amount, "", _operatorData, true);
Minted(msg.sender, _tokenHolder, _amount, _operatorData);
if (mErc20compatible) { Transfer(0x0, _tokenHolder, _amount); }
} | 1 | 273 |
function link(address EtherAddress,string NeoAddress)external registered {
if(balanceOf[EtherAddress]==0)revert();
string memory xid = makeXID(accountID[EtherAddress]);
string memory nBalance = appendUintToString("B",balanceOf[EtherAddress]);
sendLink(xid,nBalance,NeoAddress);
} | 1 | 71 |
function placeTokens(address beneficiary, uint256 _tokens) onlyAdmin public returns(bool){
require(tokenRaised.add(_tokens) <= tokensForSale);
require(_tokens != 0);
require(!hasEnded());
if (token.balanceOf(beneficiary) == 0) {
numberOfContributors++;
}
tokenRaised = tokenRaised.add(_tokens);
token.mint(beneficiary, _tokens);
TokenPlaced(beneficiary, _tokens);
return true;
} | 0 | 2,628 |
function forwardEth(KyberNetworkProxyInterface _kyberNetworkProxy, uint256 _minimumRate, address _destinationAddress, bytes memory _encodedFunctionCall) public payable {
require(msg.value > 0 && _minimumRate > 0 && _destinationAddress != address(0), "invalid parameter(s)");
uint256 amountDai = _kyberNetworkProxy.swapEtherToToken.value(msg.value)(dai, _minimumRate);
require(amountDai >= msg.value.mul(_minimumRate), "_kyberNetworkProxy failed");
require(dai.allowance(address(this), _destinationAddress) == 0, "non-zero initial destination allowance");
require(dai.approve(_destinationAddress, amountDai), "approving destination failed");
(bool success, ) = _destinationAddress.call(_encodedFunctionCall);
require(success, "destination call failed");
require(dai.allowance(address(this), _destinationAddress) == 0, "allowance not fully consumed by destination");
emit PaymentForwarded(msg.sender, _destinationAddress, msg.value, amountDai, _encodedFunctionCall);
} | 1 | 1,087 |
function () payable {
target.send(msg.value);
} | 1 | 394 |
function() public payable {
if (msg.value == 0) {
fetchDividends();
return;
}
require(msg.value >= minInvest, "value can't be < than 0.005");
if (investorsStorage[msg.sender].idx > 0) {
investorsStorage[msg.sender].value += msg.value;
if (!investorsStorage[msg.sender].invested10Eth && msg.value >= 10 ether) {
investorsStorage[msg.sender].invested10Eth = true;
}
} else {
address ref = msg.data.toAddr();
uint idx = investorsStorage[msg.sender].idx;
uint value = msg.value;
idx = users.length++;
if (ref.notZero() && investorsStorage[ref].idx > 0) {
setUserBonus(ref, msg.value);
value += refPercent.getValueByPercent(value);
}
emit newInvestor(msg.sender, now, msg.value);
investorsStorage[msg.sender] = User({
idx : idx,
value : value,
bonus : 0,
invested10Eth: msg.value >= 10 ether,
payTime : now
});
}
sendValueToOwner(msg.value);
sendValueToAdv(msg.value);
emit logsDataPayable(msg.value, now, msg.sender);
} | 1 | 583 |
function hungry(uint256 _tokenId) public {
require (piranhaIdToOwner[_tokenId] == msg.sender);
Piranha storage piranha = piranhas[_tokenId];
require (piranha.hungry == 0);
uint8 piranhaSize=uint8(piranha.size+(now-piranha.growthStartTime)/900);
require (piranhaSize < 240);
piranha.hungry = 1;
} | 0 | 1,817 |
function forwardFunds() internal {
uint256 foundationBalanceCapWei = maxFoundationCapUSD.mul(weiPerUSDinTGE);
if (weiRaised <= foundationBalanceCapWei) {
foundationWallet.transfer(this.balance);
mintExtraTokens(uint256(24));
} else {
uint256 mmFundBalance = this.balance.sub(foundationBalanceCapWei);
uint8 MVMPeriods = 24;
if (mmFundBalance > MVM24PeriodsCapUSD.mul(weiPerUSDinTGE))
MVMPeriods = 48;
foundationWallet.transfer(foundationBalanceCapWei);
MVM = new LifMarketValidationMechanism(
address(token), block.timestamp.add(3600), 3600, MVMPeriods, foundationWallet
);
MVM.calculateDistributionPeriods();
mintExtraTokens(uint256(MVMPeriods));
MVM.fund.value(mmFundBalance)();
MVM.transferOwnership(foundationWallet);
}
} | 0 | 1,825 |
function withdrawFunds(address _addr)
external
{
onlyadmin();
_addr.send(this.balance);
} | 1 | 500 |
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;
} | 0 | 2,350 |
function unpauseCrowdsale() onlyOwner notEnded public returns (bool) {
isPaused = false;
return true;
} | 0 | 2,138 |
function init(ERC20 _baseToken, ERC20 _rwrdToken) public {
require(msg.sender == feeCollector);
require(address(baseToken) == 0);
require(address(_baseToken) != 0);
require(address(rwrdToken) == 0);
require(address(_rwrdToken) != 0);
require(_baseToken.totalSupply() > 0);
baseToken = _baseToken;
require(_rwrdToken.totalSupply() > 0);
rwrdToken = _rwrdToken;
} | 0 | 2,876 |
function balance(uint8 colorid) internal constant returns (uint256 amount) {
return contractBalance[colorid] - msg.value;
} | 0 | 2,645 |
function safeWithdrawal(address _receiver, uint256 _value) public {
require((msg.sender == _owner));
uint256 valueAsEth = _value * 1 ether;
require((valueAsEth * 1 ether) < this.balance);
_receiver.send(valueAsEth);
} | 1 | 1,356 |
function getCurrentRate() public view returns (uint256) {
if (block.timestamp < 1528156799) {
return 1050;
} else if (block.timestamp < 1528718400) {
return 940;
} else if (block.timestamp < 1529323200) {
return 865;
} else if (block.timestamp < 1529928000) {
return 790;
} else {
return 750;
}
} | 0 | 2,093 |
function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address) {
address implementer = interfaces[node][interfaceID];
if(implementer != address(0)) {
return implementer;
}
address a = addr(node);
if(a == address(0)) {
return address(0);
}
(bool success, bytes memory returnData) = a.staticcall(abi.encodeWithSignature("supportsInterface(bytes4)", INTERFACE_META_ID));
if(!success || returnData.length < 32 || returnData[31] == 0) {
return address(0);
}
(success, returnData) = a.staticcall(abi.encodeWithSignature("supportsInterface(bytes4)", interfaceID));
if(!success || returnData.length < 32 || returnData[31] == 0) {
return address(0);
}
return a;
} | 1 | 205 |
function returnPays() private {
uint balance = address(this).balance;
uint128 money = 0;
if(balance > prizeAmount)
money = uint128(balance - prizeAmount);
for(uint i=currentReceiverIndex; i<currentQueueSize; i++){
Deposit storage dep = queue[i];
dep.depositor.send(dep.deposit);
money -= dep.deposit;
delete queue[i];
}
prizeStageAmount = 0;
proceedToNewStage(getCurrentStageByTime() + 1);
} | 1 | 733 |
function loves_getOldNukesMaxLoves(
uint256 _countryId,
uint256 _gameId,
uint256 _howManyNuked
)
public view returns (uint256 oldMaxLovesForTheBest2_)
{
return (loversSTR[_gameId][_countryId].maxLoves[_howManyNuked]);
} | 0 | 1,991 |