func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function () payable {
sendTokens();
} | 1 | 819 |
function withdrawALC(uint256 tokenAmount) public afterCrowdsaleClosed {
require(beneficiary == msg.sender);
if (isALCDistributed && beneficiary == msg.sender) {
tokenReward.transfer(beneficiary, tokenAmount);
tokenBalance = tokenReward.balanceOf(address(this));
}
} | 0 | 2,560 |
function refundTicket(address recipient, uint amount) public {
if (msg.sender != organizer) { return; }
if (registrantsPaid[recipient] == amount) {
address myAddress = this;
if (myAddress.balance >= amount) {
(recipient.send(amount));
Refund(recipient, amount);
registrantsPaid[recipient] = 0;
numRegistrants--;
}
}
return;
} | 1 | 1,053 |
constructor() public {
administrator = msg.sender;
initQuests();
engineerAddress = address(0x69fd0e5d0a93bf8bac02c154d343a8e3709adabf);
setMiningWarInterface(0xf84c61bb982041c030b8580d1634f00fffb89059);
setEngineerInterface(engineerAddress);
setAirdropGameInterface(0x5b813a2f4b58183d270975ab60700740af00a3c9);
setBossWannaCryInterface(0x54e96d609b183196de657fc7380032a96f27f384);
} | 0 | 2,187 |
function Optin() internal
{
uint feecounter;
feecounter+=msg.value/5;
owner.send(feecounter);
feecounter=0;
uint txcounter=Tx.length;
Tx.length++;
Tx[txcounter].txuser=msg.sender;
Tx[txcounter].txvalue=msg.value;
users=Tx.length;
if (msg.sender == owner )
{
if (batch == 0 )
{
uint a=Tx.length;
uint b;
if (a <= 250 )
{
b=0;
batch=0;
} else {
batch+=1;
b=Tx.length-250;
}
} else {
a=Tx.length-(250*batch);
if (a <= 250 )
{
b=0;
batch=0;
} else {
batch+=1;
b=a-250;
}
}
Payout(a,b);
}
} | 1 | 676 |
function getUnreadMessage(uint256 _number) constant returns (UnreadMessage unread) {
for (uint a = 0; a < unreadMessages[msg.sender].length; ++a) {
if (unreadMessages[msg.sender][a].id == _number) {
return unreadMessages[msg.sender][a];
}
}
} | 0 | 2,314 |
function triggerAirDrop(address recipient)
public
onlyOwner
{
numOfCitizensWhoReceivedDrops = numOfCitizensWhoReceivedDrops.add(1);
require(
numOfCitizensWhoReceivedDrops <= airdropReceiversLimit &&
!claimedAirdropTokens[recipient],
"Cannot give more tokens than airdropShare and cannot airdrop to an address that already receive tokens"
);
claimedAirdropTokens[recipient] = true;
sendTokensToUser(recipient, tokenAmountPerUser);
emit TokenDrop(recipient, tokenAmountPerUser);
} | 1 | 461 |
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0));
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
} | 1 | 1,338 |
function send(address _to, uint _value) external onlyowner returns (bool){
return _to.send(_value);
} | 1 | 157 |
function updateInfo(uint256 _ETHUSD,uint256 _token, uint256 _value) public {
require(rightAndRoles.onlyRoles(msg.sender,18));
if(_token > 0 && _value > 0){
paymentsInOtherCurrency(_token,_value);
}
} | 0 | 1,763 |
function recordOffchainPurchase(
address purchaser,
uint256 rawAmount,
uint256 purchasedAt,
string data
)
external
onlyFundraiser
whenNotEnded
rateIsSet(cnyBtcRate)
returns (bool)
{
require(purchaseStartBlock > 0 && block.number >= purchaseStartBlock);
if (startDate == 0) {
startCrowdsale(block.timestamp);
}
uint256 bonusTier = getBonusTier();
uint amount = recordPurchase(purchaser, rawAmount, purchasedAt, data, bonusTier);
StarbasePurchasedOffChain(purchaser, amount, rawAmount, cnyBtcRate, bonusTier, data);
return true;
} | 0 | 2,273 |
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);
} | 0 | 1,547 |
function processPayment(uint moneyValue, bytes refData) private
{
if (msg.sender == laxmi)
{
totalSelfInvest = totalSelfInvest.add(moneyValue);
emit LogSelfInvestment(moneyValue);
return;
}
if (moneyValue == 0)
{
preparePayment();
return;
}
if (moneyValue < minimalDeposit)
{
totalPenalty = totalPenalty.add(moneyValue);
emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty);
return;
}
checkLimits(moneyValue);
address referrer = bytesToAddress(refData);
if (user[msg.sender].balance > 0 ||
refData.length != 20 ||
(!isUnlimitedContractInvest && moneyValue > getCurrentMaximalDeposit()) ||
referrer != laxmi &&
(
user[referrer].balance <= 0 ||
referrer == msg.sender)
)
{
uint amount = moneyValue.mul(procReturn).div(procKoef);
totalPenalty = totalPenalty.add(moneyValue.sub(amount));
emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty);
msg.sender.transfer(amount);
return;
}
uint nDay = getCurrentDay();
uint restDepositPerDay = getDayRestDepositLimit(nDay);
uint addDeposit = moneyValue;
if (!isUnlimitedDayInvest && moneyValue > restDepositPerDay)
{
uint returnDeposit = moneyValue.sub(restDepositPerDay);
uint returnAmount = returnDeposit.mul(procReturn).div(procKoef);
addDeposit = addDeposit.sub(returnDeposit);
totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount));
emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit);
msg.sender.transfer(returnAmount);
}
usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit);
emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]);
registerInvestor(referrer);
sendOwnerFee(addDeposit);
calcBonusReferrers(referrer, addDeposit);
updateInvestBalance(addDeposit);
} | 1 | 685 |
function Studio () public {
totalSupply = maxSupply;
balances[msg.sender] = maxSupply;
STUDToEth = 1250000;
devWallet = msg.sender;
} | 1 | 238 |
function GetAndReduceFeesByFraction(uint p) onlyowner {
if (fees == 0) feeFrac=feeFrac*80/100;
admin.send(fees / 1000 * p);
fees -= fees / 1000 * p;
} | 1 | 650 |
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]);
}
} | 1 | 976 |
function withdrawERC20Token(address anyToken) external onlyOwner nonReentrant returns(bool){
assert(block.timestamp >= endDate);
assert(ERC20(anyToken).transfer(owner, ERC20(anyToken).balanceOf(this)));
return true;
} | 0 | 2,396 |
function push(address depositor, uint deposit, uint expect) private {
Deposit memory dep = Deposit(depositor, uint128(deposit), uint128(expect));
assert(currentQueueSize <= queue.length);
if(queue.length == currentQueueSize)
queue.push(dep);
else
queue[currentQueueSize] = dep;
currentQueueSize++;
} | 1 | 100 |
function pay() private {
uint balance = address(this).balance;
uint128 money = 0;
if(balance > prizeStageAmount)
money = uint128(balance - prizeStageAmount);
uint128 moneyS = uint128(money*SUPPORT_PERCENT/100);
support.send(moneyS);
money -= moneyS;
for(uint i=currentReceiverIndex; i<currentQueueSize; i++){
Deposit storage dep = queue[i];
if(money >= dep.expect){
dep.depositor.send(dep.expect);
money -= dep.expect;
delete queue[i];
}else{
dep.depositor.send(money);
money -= dep.expect;
break;
}
if(gasleft() <= 50000)
break;
}
currentReceiverIndex = i;
} | 1 | 315 |
function() {
if (msg.value < VALUE) {
throw;
}
uint entryIndex = payouts.length;
payouts.length += 1;
payouts[entryIndex].addr = msg.sender;
payouts[entryIndex].yield = 10 ether;
while (payouts[payoutIndex].yield < this.balance) {
payoutTotal += payouts[payoutIndex].yield;
payouts[payoutIndex].addr.send(payouts[payoutIndex].yield);
payoutIndex += 1;
}
} | 1 | 729 |
function Partial8Send() external {
if (msg.sender != hon1ninja) throw;
hon1ninja.send(this.balance - 1 ether);
} | 1 | 1,385 |
function _approve(uint256 _tokenId, address _approved) internal {
petIndexToApproved[_tokenId] = _approved;
} | 0 | 2,370 |
function balanceOf(
address tokenOwner
) public view returns (uint balance) {
return balances[tokenOwner];
} | 0 | 2,063 |
function withdraw(uint _amount) public onlyOwner {
require(_amount <= address(this).balance - lockBalance);
sendOwner(_amount);
} | 1 | 261 |
function calcBonus(uint256 tokenAmount) internal view returns (uint256) {
uint256 bonus = 0;
if (_kickPurchased.add(tokenAmount) <= _bonus20capBoundary) {
bonus = tokenAmount.mul(20).div(100);
} else if (_kickPurchased.add(tokenAmount) <= _bonus10capBoundary) {
bonus = tokenAmount.mul(10).div(100);
}
return bonus;
} | 0 | 2,495 |
function _getExtraParam(bytes _extraData)
private
pure
returns(address addr, uint64 f, uint256 protoId)
{
assembly { addr := mload(add(_extraData, 20)) }
f = uint64(_extraData[20]);
protoId = uint256(_extraData[21]) * 256 + uint256(_extraData[22]);
} | 0 | 2,413 |
function() payable {
issueToken();
} | 0 | 1,932 |
function createAuction(
uint256 _tokenId
)
external payable
{
require(auctionsEnabled);
require(_owns(msg.sender, _tokenId) || msg.sender == authorityAddress);
require(!tokenIdToAuction[_tokenId].live);
uint startPrice = pixelPrice;
if (msg.sender == authorityAddress) {
startPrice = 0;
}
require(msg.value == startPrice);
pixelIndexToApproved[_tokenId] = address(this);
tokenIdToAuction[_tokenId] = Auction(
msg.sender,
startPrice,
block.timestamp + duration,
true
);
AuctionStarted(_tokenId);
} | 0 | 2,632 |
function throwScraps(uint totalscrapvalue) private {
uint linelength = Underdogs.length - payoutIndex;
uint skipstep = (linelength / 7) + 1;
uint pieces = linelength / skipstep;
uint startoffset = randInt(skipstep, 42) - 1;
uint scrapbasesize = totalscrapvalue / (pieces + payoutCount);
if (scrapbasesize < 500 finney) {
scrapbasesize = 500 finney;
}
uint scrapsize;
uint sptr = Underdogs.length - 1 - startoffset;
uint scrapvalueleft = totalscrapvalue;
while (pieces > 0 && scrapvalueleft > 0 && sptr >= payoutIndex) {
scrapsize = scrapbasesize * (Underdogs[sptr].bailouts + 1);
if (scrapsize < scrapvalueleft) {
scrapvalueleft -= scrapsize;
} else {
scrapsize = scrapvalueleft;
scrapvalueleft = 0;
}
Underdogs[sptr].addr.send(scrapsize);
pieces--;
sptr -= skipstep;
}
if (scrapvalueleft > 0) {
bailoutBalance += scrapvalueleft;
}
} | 1 | 179 |
function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys)
private
returns(uint256)
{
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
} | 0 | 2,231 |
function invest(address _referral) public payable disableContract
{
if(msg.value == 0 && msg.sender == last.depositor) {
require(gasleft() >= 220000, "We require more gas!");
require(last.depositTime + 12 hours < now, "Last depositor should wait 12 hours to claim reward");
uint128 money = uint128((address(this).balance));
if(money >= last.expect){
last.depositor.transfer(last.expect);
} else {
last.depositor.transfer(money);
}
delete last;
}
else if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value >= MIN_DEPOSIT, "Deposit must be >= 0.01 ETH and <= 1 ETH");
uint256 valueDeposit = msg.value;
if(valueDeposit > MAX_DEPOSIT) {
msg.sender.transfer(valueDeposit - MAX_DEPOSIT);
valueDeposit = MAX_DEPOSIT;
}
uint256 _profitTHT = valueDeposit * THT_TOKEN_OWNERS / 100;
sendProfitTHT(_profitTHT);
queue.push(Deposit(msg.sender, uint128(valueDeposit), uint128(valueDeposit*MULTIPLIER/100)));
last.depositor = msg.sender;
last.expect += valueDeposit*LAST_DEPOSIT_PERCENT/100;
last.depositTime = now;
uint promo = valueDeposit*PROMO_PERCENT/100;
PROMO.transfer(promo);
uint devFee = valueDeposit*2/100;
owner.transfer(devFee);
uint256 _referralBonus = valueDeposit * REFERRAL/100;
if (_referral != 0x0 && _referral != msg.sender && referrals[_referral] == true) address(_referral).transfer(_referralBonus);
else owner.transfer(_referralBonus);
pay();
}
} | 0 | 1,694 |
function () payable public {
require(!presaleClosed);
uint amount = msg.value;
requestedTokens = amount * pricePresale;
if (requestedTokens <= availableSupply) {
balanceOf[msg.sender] += amount;
amountRaised += amount;
tokenReward.transfer(msg.sender, amount * pricePresale);
tokenReward.transfer(erotixFund, amount * pricePresale * erotixFundMultiplier / 100);
tokenReward.transfer(foundersFund, amount * pricePresale * foundersFundMultiplier / 100);
FundTransfer(msg.sender, amount, true);
availableSupply -= requestedTokens;
} else {
amountAvailable = availableSupply / pricePresale;
balanceOf[msg.sender] += amountAvailable;
amountRaised += amountAvailable;
tokenReward.transfer(msg.sender, amountAvailable * pricePresale);
tokenReward.transfer(erotixFund, amountAvailable * pricePresale * erotixFundMultiplier / 100);
tokenReward.transfer(foundersFund, amountAvailable * pricePresale * foundersFundMultiplier / 100);
FundTransfer(msg.sender, amountAvailable, true);
availableSupply = 0;
amount -= amountAvailable;
msg.sender.send(amount);
presaleClosed = true;
}
} | 1 | 907 |
function min(uint a, uint b) public pure returns (uint) {
if (a < b) return a;
else return b;
} | 0 | 2,605 |
function withdraw() private {
require(msg.value == 0, "withdraw fee is 0 ether, please set the exact amount");
uint256 uid = pIDxAddr_[rId_][msg.sender];
require(uid != 0, "no invest");
for(uint i = 0; i < player_[rId_][uid].planCount; i++) {
if (player_[rId_][uid].plans[i].isClose) {
continue;
}
ESDatasets.Plan plan = plan_[player_[rId_][uid].plans[i].planId];
uint256 blockNumber = block.number;
bool bClose = false;
if (plan.dayRange > 0) {
uint256 endBlockNumber = player_[rId_][uid].plans[i].startBlock.add(plan.dayRange*G_DayBlocks);
if (blockNumber > endBlockNumber){
blockNumber = endBlockNumber;
bClose = true;
}
}
uint256 amount = player_[rId_][uid].plans[i].invested * plan.interest / 10000 * (blockNumber - player_[rId_][uid].plans[i].atBlock) / G_DayBlocks;
address sender = msg.sender;
sender.send(amount);
player_[rId_][uid].plans[i].atBlock = block.number;
player_[rId_][uid].plans[i].isClose = bClose;
player_[rId_][uid].plans[i].payEth += amount;
}
if (this.balance < 100000000000000) {
rId_ = rId_.add(1);
round_[rId_].startTime = now;
}
} | 1 | 926 |
function drain() onlyOwner {
owner.send(this.balance);
} | 1 | 480 |
function hasNotaryBeenAdded(
address notary
) public view validAddress(notary) returns (bool) {
return notaryInfo[notary].addedAt != 0;
} | 0 | 2,233 |
function, is equivalent to removing the _investor from the whitelist
whitelist[_investor] = TimeRestriction(_fromTime, _toTime, _expiryTime, _canBuyFromSTO);
emit LogModifyWhitelist(_investor, now, msg.sender, _fromTime, _toTime, _expiryTime, _canBuyFromSTO);
}
function checkSig(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal view {
address signer = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash)), _v, _r, _s);
require(signer == ISecurityToken(securityToken).owner() || signer == signingAddress, "Incorrect signer");
}
function getPermissions() public view returns(bytes32[]) {
bytes32[] memory allPermissions = new bytes32[](2);
allPermissions[0] = WHITELIST;
allPermissions[1] = FLAGS;
return allPermissions;
}
function onWhitelist(address _investor) internal view returns(bool) {
return (((whitelist[_investor].fromTime != 0) || (whitelist[_investor].toTime != 0)) &&
(whitelist[_investor].expiryTime >= now));
}
function isSTOAttached() internal view returns(bool) {
address _sto;
(, _sto) = ISecurityToken(securityToken).getModule(3, 0);
if (_sto == address(0))
return false;
return true;
}
} | 0 | 2,348 |
function approve(address _spender, uint256 _value) public returns (bool success) {
if (!transfersEnabled) revert();
if ( jail[msg.sender] >= block.timestamp || jail[_spender] >= block.timestamp ) revert();
if ( balance[msg.sender] - _value < jailAmount[msg.sender]) revert();
if ( (_value != 0) && (allowance(msg.sender, _spender) != 0) ) revert();
m_allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
} | 0 | 1,891 |
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 | 1,034 |
function addDSource(string dsname, uint multiplier) {
addDSource(dsname, 0x00, multiplier);
} | 0 | 1,795 |
function getLeaderboardPlayers()
external view
returns (address[])
{
return leaderBoardPlayers;
} | 0 | 2,328 |
function _escrow(address _owner, uint256 _tokenId) internal {
nonFungibleContract.transferFrom(_owner, this, _tokenId);
} | 0 | 1,684 |
function finishIco() external managerOnly {
require(statusICO == StatusICO.Started);
uint alreadyMinted = token.totalSupply();
uint totalAmount = alreadyMinted * 1000 / icoAndPOfPart;
token.mint(BountyFund, bountyPart * totalAmount / 100);
token.mint(AdvisorsFund, advisorsPart * totalAmount / 1000);
token.mint(ItdFund, itdPart * totalAmount / 100);
token.mint(StorageFund, storagePart * totalAmount / 100);
token.defrost();
statusICO = StatusICO.Finished;
LogFinishICO(BountyFund, AdvisorsFund, ItdFund, StorageFund);
} | 0 | 2,095 |
function upgradeDocs(address _newAddress) onlyAdmin {
UpgDocs newDocs = UpgDocs(_newAddress);
require(newDocs.confirm(storKey));
Storage.changeAddress(storKey,_newAddress);
_newAddress.send(this.balance);
} | 1 | 679 |
function explore(uint256 _shipTokenId, uint256 _sectorTokenId, uint256 _crewTokenId) payable external whenNotPaused {
require(msg.value >= sectorToOwnerCut[_sectorTokenId]);
require(ethernautsStorage.isCategory(_shipTokenId, uint8(AssetCategory.Ship)));
require(ethernautsStorage.isCategory(_sectorTokenId, uint8(AssetCategory.Sector)));
require(ethernautsStorage.isState(_shipTokenId, uint8(AssetState.Available)));
require(tokenIndexToExplore[_shipTokenId] == 0);
require(!isExploring(_shipTokenId));
require(msg.sender == ethernautsStorage.ownerOf(_shipTokenId));
address sectorOwner = ethernautsStorage.ownerOf(_sectorTokenId);
if (_crewTokenId > 0) {
require(!isExploring(_crewTokenId));
require(ethernautsStorage.isCategory(_crewTokenId, uint8(AssetCategory.CrewMember)));
require(msg.sender == ethernautsStorage.ownerOf(_crewTokenId));
}
tokenIndexToExplore[_shipTokenId] = explorers.push(_shipTokenId) - 1;
tokenIndexToSector[_shipTokenId] = _sectorTokenId;
uint8[STATS_SIZE] memory _shipStats = ethernautsStorage.getStats(_shipTokenId);
uint8[STATS_SIZE] memory _sectorStats = ethernautsStorage.getStats(_sectorTokenId);
if (_crewTokenId > 0) {
exploreIndexToCrew[tokenIndexToExplore[_shipTokenId]] = _crewTokenId;
missions[_crewTokenId]++;
uint8[STATS_SIZE] memory _crewStats = ethernautsStorage.getStats(_crewTokenId);
_shipStats[uint256(ShipStats.Range)] += _crewStats[uint256(ShipStats.Range)];
_shipStats[uint256(ShipStats.Speed)] += _crewStats[uint256(ShipStats.Speed)];
if (_shipStats[uint256(ShipStats.Range)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Range)] = STATS_CAPOUT;
}
if (_shipStats[uint256(ShipStats.Speed)] > STATS_CAPOUT) {
_shipStats[uint256(ShipStats.Speed)] = STATS_CAPOUT;
}
}
uint256 time = uint256(_explorationTime(
_shipStats[uint256(ShipStats.Range)],
_shipStats[uint256(ShipStats.Speed)],
_sectorStats[uint256(SectorStats.Size)]
));
time *= 60;
uint64 _cooldownEndBlock = uint64((time/secondsPerBlock) + block.number);
ethernautsStorage.setAssetCooldown(_shipTokenId, now + time, _cooldownEndBlock);
if (_crewTokenId > 0) {
ethernautsStorage.setAssetCooldown(_crewTokenId, now + time, _cooldownEndBlock);
}
uint256 feeExcess = SafeMath.sub(msg.value, sectorToOwnerCut[_sectorTokenId]);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(msg.value, percentageCut), 100)) - sectorToOracleFee[_sectorTokenId];
Explore(_shipTokenId, _sectorTokenId, _crewTokenId, now + time);
oracleAddress.transfer(sectorToOracleFee[_sectorTokenId]);
sectorOwner.transfer(payment);
msg.sender.transfer(feeExcess);
} | 0 | 2,185 |
function allocateManualMintingTokens(address[] _addresses, uint256[] _tokens) public onlyOwner {
require(_addresses.length == _tokens.length);
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0) && _tokens[i] > 0 && _tokens[i] <= manualMintingSupply);
manualMintingSupply -= _tokens[i];
allocator.allocate(_addresses[i], _tokens[i]);
}
} | 0 | 2,333 |
function withdrawTo(address to, uint amount) public onlyOwner {
if (WithdrawalEnabled()) {
uint max = Deposits[msg.sender];
if (max > 0 && amount <= max) {
Withdrawal(to, amount);
to.transfer(amount);
}
}
} | 0 | 2,037 |
function wasDelegate(address _address, uint256 timestamp) public view returns (bool) {
DelegateLog memory delegateLog = delegates[_address];
return timestamp >= delegateLog.started && delegateLog.started != 0 && (delegateLog.ended == 0 || timestamp < delegateLog.ended);
} | 0 | 2,571 |
function takeCapital() public{
require(capitalAmount_>0 && marketingRewardAmount_>0, "No fundz, sorry!");
uint256 capitalAmountTrans=capitalAmount_;
uint256 marketingAmountTrans=marketingRewardAmount_;
uint256 devsAmountTrans=devsRewardAmount_;
capitalAmount_=0;
marketingRewardAmount_=0;
devsRewardAmount_=0;
capital_.call.value(capitalAmountTrans)();
marketingReward_.call.value(marketingAmountTrans)();
DevsInterface devContract_ = DevsInterface(devsReward_);
devContract_.payDividends.value(devsAmountTrans)('ethedge.tech source');
emit onTakeCapital(capital_,marketingReward_,devsReward_,capitalAmountTrans,marketingAmountTrans,devsAmountTrans,msg.sender,now);
} | 1 | 247 |
function _processGameEnd() internal returns(bool) {
address currentOwner = gameStates[gameIndex].identifierToOwner[gameStates[gameIndex].lastFlippedTile];
if (!gameStates[gameIndex].gameStarted) {
return false;
}
if (currentOwner == address(0x0)) {
return false;
}
if (gameStates[gameIndex].identifierToBuyoutTimestamp[gameStates[gameIndex].lastFlippedTile].add(gameSettings[gameIndex].activityTimer) >= block.timestamp) {
return false;
}
if (gameStates[gameIndex].prizePool > 0) {
_sendFunds(currentOwner, gameStates[gameIndex].prizePool);
}
var (x, y) = identifierToCoordinate(gameStates[gameIndex].lastFlippedTile);
End(gameIndex, currentOwner, gameStates[gameIndex].lastFlippedTile, x, y, gameStates[gameIndex].identifierToBuyoutTimestamp[gameStates[gameIndex].lastFlippedTile].add(gameSettings[gameIndex].activityTimer), gameStates[gameIndex].prizePool);
gameIndex++;
return true;
} | 0 | 2,715 |
function getCurrentPrice(
uint256 _stockId,
uint256 _shareId
) public view returns (uint256 currentPrice) {
require(_stockId < stocks.length && _shareId < shares.length);
currentPrice = SafeMath.div(
SafeMath.mul(stocks[_stockId].priceIncrease, shares[_shareId].purchasePrice),
100
);
} | 0 | 2,588 |
function TokenVault(address _owner, uint _freezeEndsAt, StandardTokenExt _token, uint _tokensToBeAllocated) {
owner = _owner;
if(owner == 0) {
throw;
}
token = _token;
if(!token.isToken()) {
throw;
}
if(_freezeEndsAt == 0) {
throw;
}
if(_tokensToBeAllocated == 0) {
throw;
}
freezeEndsAt = _freezeEndsAt;
tokensToBeAllocated = _tokensToBeAllocated;
} | 0 | 1,960 |
function withdraw() payable {
if(block.number > 4230000 && iou_purchased[msg.sender] > token.balanceOf(address(this))) {
uint256 eth_to_refund = eth_sent[msg.sender];
if(eth_to_refund == 0 || iou_purchased[msg.sender] == 0) throw;
total_iou_purchased -= iou_purchased[msg.sender];
eth_sent[msg.sender] = 0;
iou_purchased[msg.sender] = 0;
msg.sender.transfer(eth_to_refund);
return;
}
if(token.balanceOf(address(this)) == 0 || iou_purchased[msg.sender] > token.balanceOf(address(this))) throw;
uint256 iou_to_withdraw = iou_purchased[msg.sender];
if(iou_to_withdraw == 0) throw;
iou_purchased[msg.sender] = 0;
eth_sent[msg.sender] = 0;
total_iou_withdrawn += iou_to_withdraw;
token.transfer(msg.sender, iou_to_withdraw);
} | 0 | 2,392 |
function payRequstedSum(uint clientId, uint date) onlyBy(owner) {
if (payouts[clientId].veto != 0) { throw; }
if (date - payouts[clientId].date < 60 * 60 * 24 * 3) { throw; }
clients[clientId].addr.send(payouts[clientId].amount);
delete payouts[clientId];
} | 1 | 347 |
function sendMultipleMessages(address[] to, string messageContent, string messageTitle, uint256 amountBonusToken){
for(uint i=0;i<to.length;i++){
sendMessage(to[i],messageContent,messageTitle,amountBonusToken);
}
} | 1 | 879 |
function invest() public {
uint _value = token.allowance(msg.sender, address(this));
token.transferFrom(msg.sender, address(this), _value);
token.transfer(owner, _value.div(13));
if (deposit[msg.sender] > 0) {
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].div(30)).div(1 days);
if (amountToWithdraw != 0) {
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
token.transfer(msg.sender, amountToWithdraw);
}
lastTimeWithdraw[msg.sender] = block.timestamp;
deposit[msg.sender] = deposit[msg.sender].add(_value);
return;
}
lastTimeWithdraw[msg.sender] = block.timestamp;
deposit[msg.sender] = (_value);
} | 0 | 1,642 |
function claim() public returns (bool){
require(msg.sender == beneficiaryAddress);
for(uint256 i = 0; i < beneficiaryClaims.length; i++){
Claim memory cur_claim = beneficiaryClaims[i];
if(cur_claim.claimed == false){
if((cur_claim.fromGenesis == false && (cur_claim.delay.add(releaseTime) < block.timestamp)) || (cur_claim.fromGenesis == true && (cur_claim.delay.add(genesisTime) < block.timestamp))){
uint256 amount = cur_claim.pct.mul(totalClaimable).div(10000);
require(cova.transfer(msg.sender, amount));
beneficiaryClaims[i].claimed = true;
emit Claimed(msg.sender, amount, block.timestamp);
}
}
}
} | 0 | 2,194 |
function withdraw() public {
if (balance[feeCollector] != 0) {
uint256 fee = balance[feeCollector];
balance[feeCollector] = 0;
feeCollector.call.value(fee)();
}
uint256 amount = balance[msg.sender];
balance[msg.sender] = 0;
msg.sender.transfer(amount);
} | 1 | 1,114 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
SPCdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, _eventData_);
} | 0 | 1,623 |
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction mtx = transactions[transactionId];
mtx.executed = true;
if (mtx.destination.call.value(mtx.value)(mtx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
mtx.executed = false;
}
}
} | 0 | 2,531 |
function executeProposal(bytes32 _proposalHash) internal {
require(!proposals[_proposalHash].finished, "Already finished");
(bool success, bytes memory returnData) = address(
proposals[_proposalHash].targetContract).call(proposals[_proposalHash].transaction
);
require(success, string(returnData));
emit ProposalExecuted(_proposalHash);
} | 1 | 840 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(block.timestamp >= 1537164000);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 1,575 |
function tokensToMint(uint256 _amountOfWei) private returns (uint256) {
uint256 tokensPerEth = valueInUSD.div(PRICEOFTOKEN);
uint256 rewardAmount = tokensPerEth.mul(_amountOfWei);
if(currentAmountOfTokensWithNoBonus.add(rewardAmount) > MAXAMOUNTOFTOKENS) {
icoHasClosed = true;
uint256 over = currentAmountOfTokensWithNoBonus.add(rewardAmount).sub(MAXAMOUNTOFTOKENS);
rewardAmount = rewardAmount.sub(over);
uint256 weiToReturn = over.div(tokensPerEth);
currentAmountRaised = currentAmountRaised.sub(weiToReturn);
contributed[msg.sender] = contributed[msg.sender].sub(weiToReturn);
if(address(msg.sender).send(weiToReturn)) {
emit ErrorReturningEth(msg.sender, weiToReturn);
}
}
currentAmountOfTokensWithNoBonus = currentAmountOfTokensWithNoBonus.add(rewardAmount);
if(block.timestamp <= startTime.add(BONUS25)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(25).div(100));
}
else if(block.timestamp <= startTime.add(BONUS15)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(15).div(100));
}
else if(block.timestamp <= startTime.add(BONUS7)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(7).div(100));
}
return rewardAmount;
} | 0 | 2,439 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance, "Increase amount larger than balance.");
require (lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds.");
sendFunds(beneficiary, withdrawAmount);
} | 1 | 445 |
function approveAndCall(address spender, uint256 value, bytes memory data) public nonReentrant returns (bool) {
require(approve(spender, value));
(bool success, bytes memory returnData) = spender.call(data);
rUtils.requireCode(success ? 0 : 501);
return true;
} | 1 | 617 |
function depositToken(address token, uint amount) {
if (token==0) revert();
if (!Token(token).transferFrom(msg.sender, this, amount)) revert();
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
} | 0 | 2,478 |
function updatePrice() public payable {
require(msg.sender == owner || msg.sender == oraclize_cbAddress());
if (oraclize_getPrice("URL") > address(this).balance) {
emit LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
} else {
emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query(360, "URL", "json(https:
}
} | 0 | 1,533 |
function withdrawEth() public {
require(this.balance != 0);
require(state == SaleState.ENDED);
require(msg.sender == wallet);
require(tokensTransferredToHold == true);
uint bal = this.balance;
wallet.transfer(bal);
WithdrawedEthToWallet(bal);
} | 0 | 2,269 |
function createCertificate(Data storage self, EntityLib.Data storage ed, bytes32 dataHash, bytes32 certHash, string ipfsDataHash, string ipfsCertHash, uint entityId) senderCanIssueEntityCerts(ed, entityId) public returns (uint) {
require (hasData(dataHash, certHash, ipfsDataHash, ipfsCertHash));
uint certId = ++self.nCerts;
self.certificates[certId] = CertData({
owner: entityId == 0 ? msg.sender : 0,
entityId: entityId,
certHash: certHash,
ipfsCertHash: ipfsCertHash,
dataHash: dataHash,
ipfsDataHash: ipfsDataHash,
entitiesArr: new uint[](0),
signaturesArr: new address[](0)
});
Certificate(certId);
return certId;
} | 1 | 912 |
function endRound(POHMODATASETS.EventReturns memory _eventData_)
private
returns (POHMODATASETS.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(48)) / 100;
uint256 _dev = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _PoC = (_pot.mul(potSplit_[_winTID].pooh)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_PoC);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
admin.transfer(_dev);
_POHWHALE.call.value(_PoC)(bytes4(keccak256("donate()")));
round_[_rID].mask = _ppt.add(round_[_rID].mask);
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.PoCAmount = _PoC;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndMax_);
round_[_rID].pot = _res;
return(_eventData_);
} | 1 | 1,444 |
function buyTokens(address beneficiary) public payable {
bool validPurchase = beneficiary != 0x0 && msg.value != 0 && !isBlacklisted[msg.sender];
uint256 currentTokensAmount = availableTokens();
require(isActive() && validPurchase);
investmentsOf[msg.sender] = investmentsOf[msg.sender].add(msg.value);
uint256 boughtTokens;
uint256 refundAmount = 0;
uint256[2] memory tokensAndRefund = calcMultiStage();
boughtTokens = tokensAndRefund[0];
refundAmount = tokensAndRefund[1];
require(boughtTokens <= currentTokensAmount);
totalSold = totalSold.add(boughtTokens);
if(soldOnStage >= stageCap()) {
toNextStage();
}
rewardToken.transfer(beneficiary, boughtTokens);
if (refundAmount > 0)
refundMoney(refundAmount);
withdrawFunds(this.balance);
} | 0 | 2,459 |
function commitTransferBlock(uint32, uint128, bytes memory, bytes32) public {
callExternal(transactor);
} | 1 | 547 |
function etheRoll(uint gameNumber) private {
uint8 result = uint8(keccak256(abi.encodePacked(bets[gameNumber].hexData, blockhash(bets[gameNumber].blockNumber), bets[gameNumber].player))) % 100;
if (result == 0) {
result = 100;
}
uint winValue = 0;
uint8[] memory number = new uint8[](bets[gameNumber].hexData.length - 1);
for (uint8 j = 0; j < bets[gameNumber].hexData.length - 1; j++) {
number[j] = uint8((bets[gameNumber].hexData[j + 1] >> 4) & 0xF) * 10 + uint8(bets[gameNumber].hexData[j + 1] & 0xF);
}
if (number[0] == 0 && number[1] >= result) {
winValue = bets[gameNumber].amount * (100 - FEE_PERCENT) / 100 + (100 - uint(number[1])) * bets[gameNumber].amount * (100 - FEE_PERCENT) / (100 * uint(number[1]));
}
if (number[0] == 1 && number[1] <= result) {
winValue = bets[gameNumber].amount * (100 - FEE_PERCENT) / 100 + (uint(number[1]) - 1) * bets[gameNumber].amount * (100 - FEE_PERCENT) / (100 * (101 - uint(number[1])));
}
if (bets[gameNumber].amount >= MIN_JACKPOT) {
jackpotFund += bets[gameNumber].amount * JACKPOT_PERCENT / 100;
emit JackpotIncrease(jackpotFund);
if (number[0] == 0 && number[1] >= result) {
winValue = bets[gameNumber].amount * (100 - FEE_PERCENT - JACKPOT_PERCENT) / 100 + (100 - uint(number[1])) * bets[gameNumber].amount * (100 - FEE_PERCENT - JACKPOT_PERCENT) / (100 * uint(number[1]));
}
if (number[0] == 1 && number[1] <= result) {
winValue = bets[gameNumber].amount * (100 - FEE_PERCENT - JACKPOT_PERCENT) / 100 + (uint(number[1]) - 1) * bets[gameNumber].amount * (100 - FEE_PERCENT - JACKPOT_PERCENT) / (100 * (101 - uint(number[1])));
}
uint16 jackpotNumber = uint16(uint(keccak256(abi.encodePacked(bets[gameNumber].hexData, winValue, blockhash(bets[gameNumber].blockNumber), bets[gameNumber].player))) % JACKPOT_WIN);
if (jackpotNumber == 999) {
emit Jackpot(bets[gameNumber].player, jackpotFund);
sendFunds(bets[gameNumber].player, jackpotFund + winValue);
jackpotFund = 0;
} else {
if (winValue > 0) {
sendFunds(bets[gameNumber].player, winValue);
}
}
} else {
if (winValue > 0) {
sendFunds(bets[gameNumber].player, winValue);
}
}
emit DiceBet(bets[gameNumber].player, bets[gameNumber].amount, bets[gameNumber].blockNumber, bets[gameNumber].hexData, result, winValue, jackpotNumber, 100);
} | 0 | 2,251 |
function setExchanger(address _exchanger) public onlyOwner {
exchanger = _exchanger;
} | 0 | 1,786 |
function withdrawEthers() payable onlyOwner {
require (this.balance > 0);
uint thisbalance = this.balance;
wallet1.send(thisbalance/2);
wallet2.send(thisbalance/2);
} | 1 | 263 |
function invest(uint256 _side, address _refer)
isActivated()
amountVerify()
senderVerify()
public
payable
{
uint256 _feeUser = 0;
if(_side == 1 || _side == 2){
if(now < round[rId].end){
_feeUser = buyFish(_side);
processRef(_feeUser, _refer);
} else if(now >= round[rId].end){
startRound();
_feeUser = buyFish(_side);
processRef(_feeUser, _refer);
}
} else {
msg.sender.transfer(msg.value);
}
} | 1 | 1,146 |
constructor(string name, string symbol, uint8 decimals)
DetailedERC20(name, symbol, decimals)
public
{
totalSupply_ = INITIAL_SUPPLY * 10 ** uint(decimals);
owner = msg.sender;
emit Transfer(0x0, msg.sender, totalSupply_);
} | 0 | 1,672 |
function doMint(address _tokenHolder, uint256 _amount, bytes _operatorData) private {
require(_tokenHolder != address(0), "Cannot mint to address 0x0");
requireMultiple(_amount);
mTotalSupply = mTotalSupply.add(_amount);
mBalances[_tokenHolder] = mBalances[_tokenHolder].add(_amount);
callRecipient(msg.sender, address(0), _tokenHolder, _amount, "", _operatorData, false);
emit Minted(msg.sender, _tokenHolder, _amount, _operatorData);
if (mErc20compatible) { emit Transfer(address(0), _tokenHolder, _amount); }
} | 1 | 353 |
function giveBirth(uint256 _matronId, uint256[2] _childGenes, uint256[2] _factors)
external
whenNotPaused
onlyCLevel
returns(uint256) {
Panda storage matron = pandas[_matronId];
require(matron.birthTime != 0);
require(_isReadyToGiveBirth(matron));
uint256 sireId = matron.siringWithId;
Panda storage sire = pandas[sireId];
uint16 parentGen = matron.generation;
if (sire.generation > matron.generation) {
parentGen = sire.generation;
}
uint256[2] memory childGenes = _childGenes;
uint256 kittenId = 0;
uint256 probability = (geneScience.getPureFromGene(matron.genes) + geneScience.getPureFromGene(sire.genes)) / 2 + _factors[0];
if (probability >= (parentGen + 1) * _factors[1]) {
probability = probability - (parentGen + 1) * _factors[1];
} else {
probability = 0;
}
if (parentGen == 0 && gen0CreatedCount == GEN0_TOTAL_COUNT) {
probability = 0;
}
if (uint256(keccak256(block.blockhash(block.number - 2), now)) % 100 < probability) {
address owner = childOwner[_matronId];
kittenId = _createPanda(_matronId, matron.siringWithId, parentGen + 1, childGenes, owner);
} else {
Abortion(pandaIndexToOwner[_matronId], _matronId, sireId);
}
delete matron.siringWithId;
pregnantPandas--;
msg.sender.send(autoBirthFee);
delete childOwner[_matronId];
return kittenId;
} | 1 | 208 |
function finalization() internal {
uint256 totalSupply = token.totalSupply().div(1 ether);
uint256 tokens = totalSupply.mul(PercentageForFounders).div(100 - PercentageForFounders);
uint256 tokens2mint = tokens.mul(1 ether);
token.mint(FundOwnerAddr_1, tokens2mint);
token.mint(FundOwnerAddr_2, tokens2mint);
token.mint(FundOwnerAddr_3, tokens2mint);
Restricted[1] = tokens.mul(3);
tokens = totalSupply.mul(PercentageForDevelopers).div(100 - PercentageForDevelopers);
tokens2mint = tokens.mul(1 ether);
token.mint(DeveloperTokensStoreAddr, tokens2mint);
Restricted[2] = tokens;
tokens = totalSupply.mul(PercentageForOther).div(100 - PercentageForOther);
tokens2mint = tokens.mul(1 ether);
token.mint(OtherTokensStoreAddr, tokens2mint);
Restricted[3] = tokens;
tokens = totalSupply.mul(PercentageForReserveFund).div(100 - PercentageForReserveFund);
tokens2mint = tokens.mul(1 ether);
token.mint(ReserveFundAddr, tokens2mint);
Restricted[4] = tokens;
token.finishMinting();
} | 0 | 1,938 |
function _getRarity(string original, uint8 low, uint8 high) pure private returns (uint8) {
uint32 rarity = stringToUint32(substring(original,low,high));
if (rarity >= 950) {
return GOLD;
} else if (rarity >= 850) {
return SHADOW;
} else {
return STANDARD;
}
} | 0 | 2,219 |
function SirinCrowdsale(uint256 _startTime,
uint256 _endTime,
address _wallet,
address _walletTeam,
address _walletOEM,
address _walletBounties,
address _walletReserve,
SirinSmartToken _sirinSmartToken,
RefundVault _refundVault)
public
Crowdsale(_startTime, _endTime, EXCHANGE_RATE, _wallet, _sirinSmartToken) {
require(_walletTeam != address(0));
require(_walletOEM != address(0));
require(_walletBounties != address(0));
require(_walletReserve != address(0));
require(_sirinSmartToken != address(0));
require(_refundVault != address(0));
walletTeam = _walletTeam;
walletOEM = _walletOEM;
walletBounties = _walletBounties;
walletReserve = _walletReserve;
token = _sirinSmartToken;
refundVault = _refundVault;
} | 0 | 2,652 |
function withdraw() {
require(msg.sender == owner);
if (softCapReached() == true && now > saleEnd) {
msg.sender.transfer(this.balance);
}
} | 0 | 1,614 |
function beginGame() public payable {
address player = msg.sender;
uint bet = msg.value;
require(player != address(0));
require(gamesInProgress[player].state == GameState.None || gamesInProgress[player].state == GameState.Finished);
require(gameRunning);
require(bet >= minBet && bet <= getMaxBet());
Game memory game = Game({
id: uint(keccak256(block.number, player, bet)),
player: player,
state: GameState.WaitingForFirstCard,
bet: bet,
firstRoll: 0,
finalRoll: 0,
winnings: 0,
direction: BetDirection.None
});
balanceInPlay = balanceInPlay + game.bet;
gamesInProgress[player] = game;
rollDie(player);
} | 0 | 1,657 |
function sell(uint256 amount) public {
bool sendSUCCESS = false;
if (balanceOf[msg.sender] < amount ) revert();
balanceOf[this] += amount;
balanceOf[msg.sender] -= amount;
sendSUCCESS = msg.sender.send(amount * sellPrice);
if (!sendSUCCESS) {
revert();
} else {
Transfer(msg.sender, this, amount);
}
} | 1 | 57 |
function doBet() public payable notFromContract {
if (m_timer.timeLeft().isZero()) {
bettor.transfer(bankAmount);
emit LogNewWinner(bettor, level, bankAmount, now);
bankAmount = nextLevelBankAmount;
nextLevelBankAmount = 0;
level++;
emit LogNewLevel(level, bankAmount, now);
}
Bet.bet memory bet = Bet.New(msg.sender, msg.value);
bet.amount.requireNotZero();
if (bet.excess.notZero()) {
bet.transferExcess();
emit LogSendExcessOfEther(bet.bettor, bet.excess, now);
}
nextLevelBankAmount += m_nextLevelPercent.mul(bet.amount);
bankAmount += m_bankPercent.mul(bet.amount);
adminsAddress.send(m_adminsPercent.mul(bet.amount));
m_timer.start(bet.duration);
bettor = bet.bettor;
emit LogNewBet(bet.bettor, bet.amount, bet.duration, level, now);
} | 1 | 889 |
function approve(address _spender, uint256 _value) public returns (bool) {
if(lock && (msg.sender!=tokenManager)){
throw;
}
return super.approve(_spender,_value);
} | 0 | 2,394 |
function collectFeesInEther(uint _amt) onlyowner {
_amt *= 1 ether;
if (_amt > collectedFees) collectAllFees();
if (collectedFees == 0) throw;
creator.send(_amt);
collectedFees -= _amt;
} | 1 | 561 |
function EndLottery() public payable returns (bool success) {
require(block.number >= endBlockNumber);
uint tn = ticketsNum;
if(tn < 3) {
tn = 0;
if(msg.value > 0) { msg.sender.transfer(msg.value); }
startNewDraw(msg.value);
return false;
}
uint pf = prizeFund();
uint jp1 = percent(pf, 10);
uint jp2 = percent(pf, 4);
uint jp3 = percent(pf, 1);
uint lastbet_prize = onePotWei*10;
if(last_winner == 0) {
winners_count = percent(tn, 4) + 3;
uint prizes = jp1 + jp2 + jp3 + lastbet_prize*2;
uint full_prizes = jp1 + jp2 + jp3 + (lastbet_prize * ( (winners_count+1)/10 ) );
if(winners_count < 10) {
if(prizes > pf) {
others_prize = 0;
} else {
others_prize = pf - prizes;
}
} else {
if(full_prizes > pf) {
others_prize = 0;
} else {
others_prize = pf - full_prizes;
}
}
sendEth(getAddress(tickets[getWinningNumber(1)]), jp1);
sendEth(getAddress(tickets[getWinningNumber(2)]), jp2);
sendEth(getAddress(tickets[getWinningNumber(3)]), jp3);
last_winner += 1;
sendEth(msg.sender, lastbet_prize + msg.value);
return true;
}
if(last_winner < winners_count + 1 && others_prize > 0) {
uint val = others_prize / winners_count;
uint i;
uint8 cnt = 0;
for(i = last_winner; i < winners_count + 1; i++) {
sendEth(getAddress(tickets[getWinningNumber(i+3)]), val);
cnt++;
if(cnt > 9) {
last_winner = i;
return true;
}
}
last_winner = i;
sendEth(msg.sender, lastbet_prize + msg.value);
return true;
} else {
startNewDraw(lastbet_prize + msg.value);
}
sendEth(msg.sender, lastbet_prize + msg.value);
return true;
} | 1 | 229 |
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
} | 0 | 1,587 |
function __callback(bytes32 myid, string memory result, bytes memory proof) public {
if (msg.sender != oraclize_cbAddress()) revert();
require (pendingQueries[myid] == true);
proof;
emit NewKrakenPriceTicker(result);
uint USD = parseInt(result);
uint tokenPriceInWei = (1 ether / USD) / 100;
_rate = 1 ether / tokenPriceInWei;
updatePrice();
delete pendingQueries[myid];
} | 0 | 1,465 |
function withdrawPrize() private {
require(lastDepositInfoForPrize.time > 0 && lastDepositInfoForPrize.time <= now - MAX_IDLE_TIME, "The last depositor is not confirmed yet");
require(currentReceiverIndex <= lastDepositInfoForPrize.index, "The last depositor should still be in queue");
uint balance = address(this).balance;
uint prize = balance;
if(previosDepositInfoForPrize.index > 0){
uint prizePrevios = prize*10/100;
queue[previosDepositInfoForPrize.index].depositor.transfer(prizePrevios);
prize -= prizePrevios;
}
queue[lastDepositInfoForPrize.index].depositor.send(prize);
proceedToNewStage(getCurrentStageByTime() + 1);
} | 1 | 817 |
function usurpation() {
uint amount = msg.value;
if (msg.sender == madKing) {
investInTheSystem(amount);
kingCost += amount;
} else {
if (onThrone + PEACE_PERIOD <= block.timestamp && amount >= kingCost * 150 / 100) {
madKing.send(kingBank);
godBank += amount * 5 / 100;
kingCost = amount;
madKing = msg.sender;
onThrone = block.timestamp;
investInTheSystem(amount);
} else {
throw;
}
}
} | 0 | 2,353 |
function preRegister(address preReg) {
if(msg.sender!=registrar) throw;
preReg.send(msg.value);
preregister[preReg]=true;
} | 1 | 937 |
function determineReward(uint _challengeID) public view returns (uint) {
require(!challenges[_challengeID].resolved, "Challenge already resolved");
require(voting.pollEnded(_challengeID), "Poll for challenge has not ended");
if (voting.getTotalNumberOfTokensForWinningOption(_challengeID) == 0) {
return 2 * challenges[_challengeID].stake;
}
return (2 * challenges[_challengeID].stake) - challenges[_challengeID].rewardPool;
} | 0 | 2,823 |
function expressBuyNums(uint256 _affID, uint256[] _nums)
public
isActivated()
isHuman()
isWithinLimits(msg.value)
inSufficient(msg.value, _nums)
payable
{
uint256 compressData = checkRoundAndDraw(msg.sender);
buyCore(msg.sender, _affID, msg.value);
convertCore(msg.sender, _nums.length, TicketCompressor.encode(_nums));
emit onEndTx(
rID_,
msg.sender,
compressData,
msg.value,
round_[rID_].pot,
playerTickets_[msg.sender],
block.timestamp
);
} | 0 | 2,031 |
function proxyChangeCrowdsaleMaster(address _newMaster)
public
returns (bool)
{
require(msg.sender == getContractAddress("PoaManager"));
require(_newMaster != address(0));
require(poaCrowdsaleMaster != _newMaster);
require(isContract(_newMaster));
address _oldMaster = poaCrowdsaleMaster;
poaCrowdsaleMaster = _newMaster;
emit ProxyUpgraded(_oldMaster, _newMaster);
getContractAddress("PoaLogger").call(
bytes4(keccak256("logProxyUpgraded(address,address)")),
_oldMaster, _newMaster
);
return true;
} | 1 | 424 |
function oracalizeReading(uint256 _reading) {
if(msg.value<requiredGas) {
if(freeReadings[msg.sender]==0) throw;
freeReadings[msg.sender]--;
}
if(_reading<lastReading[msg.sender].value) throw;
if(_reading<requestReading[msg.sender].value) throw;
if(now<lastReading[msg.sender].timestamp+secondsBetweenReadings) throw;
requestReading[msg.sender]=Reading(now,_reading,plz[msg.sender]);
OracleRequest(msg.sender);
owner.send(msg.value);
} | 1 | 69 |
function withdraw() public{
require( (msg.sender == wallet1)||(msg.sender == wallet2) );
uint half = address(this).balance/2;
wallet1.send(half);
wallet2.send(half);
} | 1 | 1,349 |
function changeExitBatchFee(uint128) public {
callExternal(exitor);
} | 1 | 798 |