func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
modifier onlyOwner() {
require(isSenderOwner(tx.origin));
_;
} | 0 | 4,618 |
function requestRandom() public payable restricted {
uint price = proxy.getRandomPrice(RANDOM_GAS);
require(msg.value >= price);
uint change = msg.value - price;
proxy.requestRandom.value(price)(this.random_callback, RANDOM_GAS);
if (change > 0) {
msg.sender.transfer(change);
}
} | 0 | 3,228 |
function() payable{
ethInWei = ethInWei + msg.value;
uint256 amount = msg.value * MRNToEth;
if (balances[devWallet] < amount) {return;}
balances[devWallet] = balances[devWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(devWallet, msg.sender, amount);
devWallet.send(msg.value);
} | 0 | 2,853 |
function close() public onlyAuthorized beforeEnd {
tokenSaleClosed = true;
owner.transfer(address(this).balance);
} | 0 | 2,912 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, RP1datasets.EventReturns memory _eventData_)
private
returns(RP1datasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _rp1;
community_addr.transfer(_com);
uint256 _long = _eth / 100;
marketing_addr.transfer(_long);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit RP1events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_rp1 = _aff;
}
return(_eventData_);
} | 1 | 1,865 |
function usageFee(bytes32 , uint256 ) public view returns(uint fee) {
return 0;
} | 1 | 1,857 |
function _sendTokens(
address _tokenReceiver,
address _referrer,
uint256 _couponCampaignId,
uint256 tokensAmount
) private {
signkeysToken.transfer(_tokenReceiver, tokensAmount);
signkeysBonusProgram.sendBonus(
_referrer,
_tokenReceiver,
tokensAmount,
(tokensAmount.mul(tokenPriceCents).div(10 ** uint256(signkeysToken.decimals()))),
_couponCampaignId);
} | 0 | 2,645 |
function isGoldenMin(
uint256 _slideEndTime
)
public
view
returns(bool)
{
uint256 _restTime1 = _slideEndTime.sub(block.timestamp);
if (_restTime1 > 6 hours) return false;
uint256 _min = (block.timestamp / 60) % 60;
return _min == 8;
} | 1 | 2,243 |
function executeRuling(uint _transactionID, uint _ruling) internal {
Transaction storage transaction = transactions[_transactionID];
require(_ruling <= AMOUNT_OF_CHOICES, "Invalid ruling.");
if (_ruling == SENDER_WINS) {
transaction.sender.send(transaction.senderFee + transaction.amount);
} else if (_ruling == RECEIVER_WINS) {
transaction.receiver.send(transaction.receiverFee + transaction.amount);
} else {
uint split_amount = (transaction.senderFee + transaction.amount) / 2;
transaction.sender.send(split_amount);
transaction.receiver.send(split_amount);
}
transaction.amount = 0;
transaction.senderFee = 0;
transaction.receiverFee = 0;
transaction.status = Status.Resolved;
} | 1 | 2,336 |
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);
} | 1 | 950 |
function initialClaesOffering() public payable{
uint256 amount = uint256(msg.value/getPrice());
if (balances[address(this)] < amount) revert();
balances[address(this)] = balances[address(this)] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(address(this), msg.sender, amount);
} | 0 | 3,068 |
function SimpleTGE (
address _fundsWallet,
uint256 _publicTGEStartBlockTimeStamp,
uint256 _publicTGEEndBlockTimeStamp,
uint256 _individualCapInWei,
uint256 _totalCapInWei
) public
{
require(_publicTGEStartBlockTimeStamp >= block.timestamp);
require(_publicTGEEndBlockTimeStamp > _publicTGEStartBlockTimeStamp);
require(_fundsWallet != address(0));
require(_individualCapInWei > 0);
require(_individualCapInWei <= _totalCapInWei);
require(_totalCapInWei > 0);
fundsWallet = _fundsWallet;
publicTGEStartBlockTimeStamp = _publicTGEStartBlockTimeStamp;
publicTGEEndBlockTimeStamp = _publicTGEEndBlockTimeStamp;
individualCapInWei = _individualCapInWei;
totalCapInWei = _totalCapInWei;
} | 1 | 1,120 |
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;
} | 1 | 2,597 |
function getCurrGameInfo() public view returns (uint256 _gameId,
uint256 _reward,
uint256 _dividends,
uint256 _lastAuction,
uint256 _gap,
uint256 _lastAuctionTime,
uint256 _secondsLeft,
uint256 _myMoney,
uint256 _myDividends,
uint256 _myRefund,
bool _ended) {
_gameId = gameId;
_reward = reward;
_dividends = dividends;
_lastAuction = gameLastAuctionMoney;
_gap = _getGameAuctionGap();
_lastAuctionTime = gameLastAuctionTime;
_secondsLeft = gameSecondLeft;
_ended = (block.timestamp > _lastAuctionTime + _secondsLeft) ? true: false;
uint256 _moneyForCal = 0;
if (gameAuction[gameId].length > 1) {
uint256 totalMoney = 0;
for (uint256 i = 0; i < gameAuction[gameId].length; i++) {
if (gameAuction[gameId][i].addr == msg.sender && gameAuction[gameId][i].dividended == true) {
}
if (gameAuction[gameId][i].addr == msg.sender && gameAuction[gameId][i].refunded == false) {
if ((i == gameAuction[gameId].length - 2) || (i == gameAuction[gameId].length - 1)) {
_myRefund = _myRefund.add(gameAuction[gameId][i].money).sub(gameAuction[gameId][i].bid);
} else {
_myRefund = _myRefund.add(gameAuction[gameId][i].money).sub(gameAuction[gameId][i].bid.mul(15).div(100));
}
_myMoney = _myMoney + gameAuction[gameId][i].money;
_moneyForCal = _moneyForCal.add((gameAuction[gameId][i].money.div(10**15)).mul(gameAuction[gameId][i].money.div(10**15)).mul(gameAuction[gameId].length + 1 - i));
}
if (gameAuction[gameId][i].refunded == false) {
totalMoney = totalMoney.add((gameAuction[gameId][i].money.div(10**15)).mul(gameAuction[gameId][i].money.div(10**15)).mul(gameAuction[gameId].length + 1 - i));
}
}
if (totalMoney != 0)
_myDividends = _moneyForCal.mul(_dividends).div(totalMoney);
}
} | 1 | 2,204 |
function claim_bounty(){
if (bought_tokens) return;
if (block.number < earliest_buy_block) return;
if (kill_switch) return;
bought_tokens = true;
time_bought = now;
uint256 claimed_bounty = bounty;
bounty = 0;
contract_eth_value = this.balance - claimed_bounty;
if(!sale.call.value(contract_eth_value)()) throw;
msg.sender.transfer(claimed_bounty);
} | 1 | 419 |
function sowed(address farmer) constant public returns (uint256 balance) {
var list = fields[farmer];
for (uint i = empties[farmer]; i < list.length; i++) {
var elapsed = block.timestamp - list[i].sowed;
if (elapsed >= growth) {
continue;
}
balance += list[i].potatoes + list[i].potatoes * elapsed / growth;
}
return balance;
} | 1 | 922 |
function internalContribution(address _contributor, uint256 _wei) internal {
require(getState() == State.InCrowdsale);
uint256 tokensAvailable = allocator.tokensAvailable();
uint256 collectedWei = contributionForwarder.weiCollected();
uint256 tokens;
uint256 tokensExcludingBonus;
uint256 bonus;
(tokens, tokensExcludingBonus, bonus) = pricingStrategy.getTokens(
_contributor, tokensAvailable, tokensSold, _wei, collectedWei);
require(tokens > 0 && tokens <= tokensAvailable);
tokensSold = tokensSold.add(tokens);
allocator.allocate(_contributor, tokens);
if (msg.value > 0) {
contributionForwarder.forward.value(msg.value)();
}
emit Contribution(_contributor, _wei, tokensExcludingBonus, bonus);
} | 1 | 1,254 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID)
private
{
uint256 _com = _eth / 100;
address(WALLET_ETH_COM1).transfer(_com);
address(WALLET_ETH_COM2).transfer(_com);
uint256 _aff = _eth / 10;
if (_affID != _pID && _affID != 0) {
plyr_[_affID].aff = (_aff.mul(8)/10).add(plyr_[_affID].aff);
uint256 _affID2 = plyr_[_affID].laff;
if (_affID2 != _pID && _affID2 != 0) {
plyr_[_affID2].aff = (_aff.mul(2)/10).add(plyr_[_affID2].aff);
}
} else {
plyr_[1].aff = _aff.add(plyr_[_affID].aff);
}
} | 1 | 477 |
function miningResolve(uint256 _orderIndex, uint256 _seed)
external
onlyService
{
require(_orderIndex > 0 && _orderIndex < ordersArray.length);
MiningOrder storage order = ordersArray[_orderIndex];
require(order.tmResolve == 0);
address miner = order.miner;
require(miner != address(0));
uint64 chestCnt = order.chestCnt;
require(chestCnt >= 1 && chestCnt <= 10);
uint256 rdm = _seed;
uint16[13] memory attrs;
for (uint64 i = 0; i < chestCnt; ++i) {
rdm = _randBySeed(rdm);
attrs = _getFashionParam(rdm);
tokenContract.createFashion(miner, attrs, 2);
}
order.tmResolve = uint64(block.timestamp);
emit MiningResolved(_orderIndex, miner, chestCnt);
} | 1 | 2,035 |
function ReleaseICO() external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(nextPotDistributionTime <= block.timestamp);
require(honeyPotAmount > 0);
require(globalICOPerCycle[cycleCount] > 0);
nextPotDistributionTime = block.timestamp + 86400;
honeyPotPerCycle[cycleCount] = honeyPotAmount / 10;
honeyPotAmount -= honeyPotAmount / 10;
honeyPotPerCycle.push(0);
globalICOPerCycle.push(0);
cycleCount = cycleCount + 1;
MinerData storage jakpotWinner = miners[msg.sender];
jakpotWinner.unclaimedPot += jackPot;
jackPot = 0;
} | 1 | 1,202 |
function() public payable {
require(!stopped);
require(getCurrentStatus() == Status.Selling || getCurrentStatus() == Status.ProlongedSelling);
require(msg.value >= minInvestment);
address receiver = msg.sender;
var senderAllowed = false;
if (allowedSenders.length > 0) {
for (uint i = 0; i < allowedSenders.length; i++)
if (allowedSenders[i] == receiver){
senderAllowed = true;
break;
}
}
else
senderAllowed = true;
assert(senderAllowed);
uint weiAmount = msg.value;
uint tokenAmount = safeDiv(safeMul(weiAmount, tokenValueMultiplier), tokenPrice);
assert(tokenAmount > 0);
uint changeWei = 0;
var currentContractTokens = token.balanceOf(address(this));
if (currentContractTokens < tokenAmount) {
var changeTokenAmount = safeSub(tokenAmount, currentContractTokens);
changeWei = safeDiv(safeMul(changeTokenAmount, tokenPrice), tokenValueMultiplier);
tokenAmount = currentContractTokens;
weiAmount = safeSub(weiAmount, changeWei);
}
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver], weiAmount);
tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver], tokenAmount);
weiRaisedAmount = safeAdd(weiRaisedAmount, weiAmount);
tokensSoldAmount = safeAdd(tokensSoldAmount, tokenAmount);
ethMultisigWallet.transfer(weiAmount);
var transferSuccess = token.transfer(receiver, tokenAmount);
assert(transferSuccess);
if (changeWei > 0) {
receiver.transfer(changeWei);
}
Invested(receiver, weiAmount, tokenAmount);
} | 0 | 2,626 |
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 1 ether / 2;
uint256 bonusCond3 = 1 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 25 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 50 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 15 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 35 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 0e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
} | 0 | 5,017 |
function computeBonusTokens(address _beneficiary, uint256 _weiAmount) internal constant returns (uint256)
{
if (isReferred(_beneficiary) || isWhiteListed[_beneficiary]) {
uint256 bonusTokens = _weiAmount.mul(rate).mul(WHITELIST_BONUS_RATE).div(100);
if (block.timestamp > whiteListEndTime) {
bonusTokens = bonusTokens.div(2);
}
return bonusTokens;
}
else
{
return 0;
}
} | 1 | 1,970 |
function burn(address payTo) public {
bool result = mv.verifyTx(
proofs[msg.sender].a,
proofs[msg.sender].a_p,
proofs[msg.sender].b,
proofs[msg.sender].b_p,
proofs[msg.sender].c,
proofs[msg.sender].c_p,
proofs[msg.sender].h,
proofs[msg.sender].k,
msg.sender);
require(result);
bytes8 C = mv.getInputBits(0, msg.sender);
uint256 value = uint256(C);
ops.transfer(payTo, value);
bytes8 Nc = mv.getInputBits(64, msg.sender);
ns[nCount++] = Nc;
bytes8 root = merkle(0,0);
currentRootIndex = roots.push(root)-1;
} | 0 | 3,110 |
function increaseJackpot(uint increaseAmount) external onlyOwner {
require (increaseAmount <= ABEToken.balanceOf(this), "Increase amount larger than balance.");
require (jackpotSize + lockedInBets + increaseAmount <= ABEToken.balanceOf(this), "Not enough funds.");
jackpotSize += uint128(increaseAmount);
} | 0 | 4,018 |
function burn(uint256 _value) internal returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
} | 1 | 2,151 |
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
} | 0 | 3,687 |
function transfer(address _to, uint256 _value) returns (bool success) {
require (block.number >= tokenFrozenUntilBlock) ;
require (!rAddresses[_to]) ;
require (balances[msg.sender] >= _value);
require (balances[_to] + _value >= balances[_to]) ;
require (!(msg.sender == owner && block.timestamp < timeLock && (balances[msg.sender]-_value) < 10000000 * 10 ** 18));
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} | 1 | 1,997 |
function batchSendTokens(address[] addresses, uint256[] _values)
public onlyOwnerAndContract
returns (bool) {
require(addresses.length == _values.length);
require(addresses.length <= 20);
uint i = 0;
uint len = addresses.length;
for (;i < len; i++) {
sendToken(addresses[i], _values[i]);
}
return true;
} | 0 | 4,033 |
function sendOwnershipAndCall(address _receiver, uint256 _amount, bytes _data) public onlyPoolOwner() {
_sendOwnership(msg.sender, _receiver, _amount);
if (_isContract(_receiver)) {
OwnersReceiver(_receiver).onOwnershipTransfer(msg.sender, _amount, _data);
}
} | 0 | 3,054 |
function Game()
{
oraclize_setProof(proofType_Ledger);
} | 1 | 1,248 |
function _checkCap (address addr) internal returns (uint) {
_checkWhitelistContract(addr);
var c = whitelist[addr];
if (!c.authorized) return 0;
if (nextCapTime>0 && block.timestamp>nextCapTime) {
contributionCaps = nextContributionCaps;
nextCapTime = 0;
}
if (c.cap<contributionCaps.length) return contributionCaps[c.cap];
return c.cap;
} | 1 | 2,192 |
function() public payable whenNotPaused {
require(state == LendingState.AwaitingReturn || state == LendingState.AcceptingContributions || state == LendingState.ExchangingToFiat);
if(state == LendingState.AwaitingReturn) {
returnBorrowedEth();
} else if (state == LendingState.ExchangingToFiat) {
sendBackSurplusEth();
} else {
require(ethicHubStorage.getBool(keccak256("user", "investor", msg.sender)));
contributeWithAddress(msg.sender);
}
} | 0 | 2,712 |
function fillOrder(
address[5] orderAddresses,
uint[6] orderValues,
uint fillTakerTokenAmount,
bool shouldThrowOnInsufficientBalanceOrAllowance,
uint8 v,
bytes32 r,
bytes32 s)
public
onlyWhitelisted
returns (uint filledTakerTokenAmount)
{
Order memory order = Order({
maker: orderAddresses[0],
taker: orderAddresses[1],
makerToken: orderAddresses[2],
takerToken: orderAddresses[3],
feeRecipient: orderAddresses[4],
makerTokenAmount: orderValues[0],
takerTokenAmount: orderValues[1],
makerFee: orderValues[2],
takerFee: orderValues[3],
expirationTimestampInSec: orderValues[4],
orderHash: getOrderHash(orderAddresses, orderValues)
});
require(order.taker == address(0) || order.taker == msg.sender);
require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && fillTakerTokenAmount > 0);
require(isValidSignature(
order.maker,
order.orderHash,
v,
r,
s
));
if (block.timestamp >= order.expirationTimestampInSec) {
LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash);
return 0;
}
uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash));
filledTakerTokenAmount = min256(fillTakerTokenAmount, remainingTakerTokenAmount);
if (filledTakerTokenAmount == 0) {
LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash);
return 0;
}
if (isRoundingError(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount)) {
LogError(uint8(Errors.ROUNDING_ERROR_TOO_LARGE), order.orderHash);
return 0;
}
if (!shouldThrowOnInsufficientBalanceOrAllowance && !isTransferable(order, filledTakerTokenAmount)) {
LogError(uint8(Errors.INSUFFICIENT_BALANCE_OR_ALLOWANCE), order.orderHash);
return 0;
}
uint filledMakerTokenAmount = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount);
uint paidMakerFee;
uint paidTakerFee;
filled[order.orderHash] = safeAdd(filled[order.orderHash], filledTakerTokenAmount);
require(transferViaTokenTransferProxy(
order.makerToken,
order.maker,
msg.sender,
filledMakerTokenAmount
));
require(transferViaTokenTransferProxy(
order.takerToken,
msg.sender,
order.maker,
filledTakerTokenAmount
));
if (order.feeRecipient != address(0)) {
if (order.makerFee > 0) {
paidMakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.makerFee);
require(transferViaTokenTransferProxy(
ZRX_TOKEN_CONTRACT,
order.maker,
order.feeRecipient,
paidMakerFee
));
}
if (order.takerFee > 0) {
paidTakerFee = getPartialAmount(filledTakerTokenAmount, order.takerTokenAmount, order.takerFee);
require(transferViaTokenTransferProxy(
ZRX_TOKEN_CONTRACT,
msg.sender,
order.feeRecipient,
paidTakerFee
));
}
}
LogFill(
order.maker,
msg.sender,
order.feeRecipient,
order.makerToken,
order.takerToken,
filledMakerTokenAmount,
filledTakerTokenAmount,
paidMakerFee,
paidTakerFee,
keccak256(order.makerToken, order.takerToken),
order.orderHash
);
return filledTakerTokenAmount;
} | 1 | 992 |
function loves_getOldNukesMaxLoves(
uint256 _countryId,
uint256 _gameId,
uint256 _howManyNuked
)
public view returns (uint256 oldMaxLovesForTheBest2_)
{
return (loversSTR[_gameId][_countryId].maxLoves[_howManyNuked]);
} | 1 | 2,190 |
function enact_withdrawal_greater_equal(address participant, uint256 withdrawValue, uint256 tokens)
private
{
assert(this.balance >= withdrawValue);
balances[fundWallet] = safeAdd(balances[fundWallet], tokens);
participant.transfer(withdrawValue);
Withdraw(participant, tokens, withdrawValue);
} | 0 | 3,762 |
function withdrawFunds(address _beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance);
require (lockedInBets + withdrawAmount <= address(this).balance);
sendFunds(_beneficiary, withdrawAmount);
} | 0 | 3,597 |
function claimHodlRewardFor(address _beneficiary) public returns (bool) {
require(block.timestamp.sub(hodlerTimeStart)<= 450 days );
require(hodlerStakes[_beneficiary].stake > 0);
updateAndGetHodlTotalValue();
uint256 _stake = calculateStake(_beneficiary);
if (_stake > 0) {
if (istransferringTokens == false) {
claimedTokens = claimedTokens.add(_stake);
istransferringTokens = true;
require(tokenContract.transfer(_beneficiary, _stake));
istransferringTokens = false ;
emit LogHodlClaimed(_beneficiary, _stake);
return true;
}
}
return false;
} | 1 | 1,318 |
function deposit(bytes32 _listingHash, uint _amount) external {
Listing storage listing = listings[_listingHash];
require(listing.owner == msg.sender);
listing.unstakedDeposit += _amount;
require(token.transferFrom(msg.sender, this, _amount));
_Deposit(_listingHash, _amount, listing.unstakedDeposit, msg.sender);
} | 1 | 1,863 |
function subWithdrawFor(address _from, address _to) internal returns (bool) {
Sub storage sub = subs[_from][_to];
if (sub.startTime > 0 && sub.startTime < block.timestamp && sub.payPerWeek > 0) {
uint weekElapsed = (now.sub(sub.lastWithdrawTime)).div(7 days);
uint amount = weekElapsed.mul(sub.payPerWeek);
if (weekElapsed > 0 && _balanceOf[_from] >= amount) {
subs[_from][_to].lastWithdrawTime = block.timestamp;
_balanceOf[_from] = _balanceOf[_from].sub(amount);
_balanceOf[_to] = _balanceOf[_to].add(amount);
emit Transfer(_from, _to, amount);
return true;
}
}
return false;
} | 1 | 2,343 |
function rescueTokens(uint _pollID) external {
require(isExpired(pollMap[_pollID].revealEndDate));
require(dllMap[msg.sender].contains(_pollID));
dllMap[msg.sender].remove(_pollID);
_TokensRescued(_pollID, msg.sender);
} | 1 | 2,449 |
function updateCnyBtcRate(uint256 rate)
external
onlyFundraiser
returns (bool)
{
cnyBtcRate = rate;
CnyBtcRateUpdated(cnyBtcRate);
return true;
} | 1 | 2,136 |
function buyRaffleTicket(uint256 amount) external {
require(raffleEndTime >= block.timestamp);
require(amount > 0);
uint256 ticketsCost = SafeMath.mul(RAFFLE_TICKET_BASE_GOO_PRICE, amount);
require(balanceOf(msg.sender) >= ticketsCost);
updatePlayersGooFromPurchase(msg.sender, ticketsCost);
TicketPurchases storage purchases = ticketsBoughtByPlayer[msg.sender];
if (purchases.raffleRareId != raffleRareId) {
purchases.numPurchases = 0;
purchases.raffleRareId = raffleRareId;
rafflePlayers[raffleRareId].push(msg.sender);
}
if (purchases.numPurchases == purchases.ticketsBought.length) {
purchases.ticketsBought.length += 1;
}
purchases.ticketsBought[purchases.numPurchases++] = TicketPurchase(raffleTicketsBought, raffleTicketsBought + (amount - 1));
raffleTicketsBought += amount;
} | 1 | 1,065 |
function WizardsvsCeltics() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 5,162 |
function determineWinner(uint gas) payable public onlyOwnerLevel canDetermineWinner {
ORACLIZE_GAS = gas;
callOracle(0, ORACLIZE_GAS);
} | 0 | 4,227 |
function payPlayers() private {
require(calculationsDone);
if (now <= PAYMENTS_END_TIME) {
Player storage player = players[msg.sender];
if (player.winnings > 0 && player.payed == 0) {
uint256 winCommission = player.winnings.mul(WINNINGS_COMMISSION).div(PERCENTS_DIVIDER);
uint256 notWonTickets = player.ticketsCount.sub(player.wonTicketsCount);
uint256 notWonAmount = notWonTickets.mul(participantsTicketPrize);
player.payed = player.winnings.add(notWonAmount);
msg.sender.send(player.winnings.sub(winCommission).add(notWonAmount).add(msg.value));
COMMISSION_ADDRESS.send(winCommission);
}
if (player.winnings == 0 && player.payed == 0) {
uint256 returnAmount = player.ticketsCount.mul(participantsTicketPrize);
player.payed = returnAmount;
msg.sender.send(returnAmount.add(msg.value));
}
} else {
uint256 contractBalance = address(this).balance;
if (contractBalance > 0) {
COMMISSION_ADDRESS.send(contractBalance);
}
}
} | 0 | 2,621 |
function settleBet(uint[] combinationParameter, uint reveal) external {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
require (bet.amount != 0);
require (block.number <= bet.placeBlockNumber.add(BetExpirationBlocks));
bytes32 _entropy = keccak256(
abi.encodePacked(
uint(
keccak256(
abi.encodePacked(
uint(
keccak256(
abi.encodePacked(
reveal,
blockhash(combinationParameter[uint8(SettleParam.LuckySeed)])
)
)
),
blockhash(block.number)
)
)
),
blockhash(block.timestamp)
)
);
uint totalAmount = 0;
uint totalTokenAmount = 0;
uint totalJackpotWin = 0;
(totalAmount,totalTokenAmount,totalJackpotWin) = runRotateTime(combinationParameter,_entropy,keccak256(abi.encodePacked(uint(_entropy), blockhash(combinationParameter[uint8(SettleParam.LuckySeed)]))));
if (totalJackpotWin > 0 && combinationParameter[uint8(SettleParam.CurrencyType)] == 0) {
emit JackpotBouns(bet.gambler,totalJackpotWin);
totalAmount = totalAmount.add(totalJackpotWin);
jackpotSize = uint128(jackpotSize.sub(totalJackpotWin));
}else if (totalJackpotWin > 0 && combinationParameter[uint8(SettleParam.CurrencyType)] == 1) {
emit TokenJackpotBouns(bet.gambler,totalJackpotWin);
totalAmount = totalAmount.add(totalJackpotWin);
tokenJackpotSize = uint128(tokenJackpotSize.sub(totalJackpotWin));
}
emit BetRelatedData(bet.gambler,bet.amount,totalAmount,_entropy,keccak256(abi.encodePacked(uint(_entropy), blockhash(combinationParameter[uint8(SettleParam.LuckySeed)]))),uint8(combinationParameter[uint8(SettleParam.Uplimit)]),uint8(combinationParameter[uint8(SettleParam.RotateTime)]));
if (combinationParameter[uint8(SettleParam.CurrencyType)] == 0) {
if (totalAmount != 0){
sendFunds(bet.gambler, totalAmount , totalAmount);
}
if (totalTokenAmount != 0){
if(ERC20(ERC20ContractAddres).balanceOf(address(this)) > 0){
ERC20(ERC20ContractAddres).transfer(bet.gambler, totalTokenAmount);
emit TokenPayment(bet.gambler, totalTokenAmount);
}
}
}else if(combinationParameter[uint8(SettleParam.CurrencyType)] == 1){
if (totalAmount != 0){
if(ERC20(ERC20ContractAddres).balanceOf(address(this)) > 0){
ERC20(ERC20ContractAddres).transfer(bet.gambler, totalAmount);
emit TokenPayment(bet.gambler, totalAmount);
}
}
}
if (combinationParameter[uint8(SettleParam.CurrencyType)] == 0) {
lockedInBets = lockedInBets.sub(combinationParameter[uint8(SettleParam.PossibleWinAmount)]);
} else if (combinationParameter[uint8(SettleParam.CurrencyType)] == 1){
lockedTokenInBets = lockedTokenInBets.sub(combinationParameter[uint8(SettleParam.PossibleWinAmount)]);
}
bet.amount = 0;
if (uint16(combinationParameter[uint8(SettleParam.CurrencyType)]) == 0) {
jackpotSize = jackpotSize.add(uint(combinationParameter[uint8(SettleParam.jackpotFee)]));
}else if (uint16(combinationParameter[uint8(SettleParam.CurrencyType)]) == 1) {
tokenJackpotSize = tokenJackpotSize.add(uint(combinationParameter[uint8(SettleParam.jackpotFee)]));
}
} | 1 | 77 |
function _continueTokenPurchase(address _beneficiary, uint256 _weiAmount) internal{
uint256 _tokens = _getTokenAmount(_weiAmount);
fundsRaised = fundsRaised.add(_weiAmount);
_processPurchase(_beneficiary, _tokens);
emit TokenPurchase(this, _beneficiary, _weiAmount, _tokens);
} | 0 | 2,898 |
function distributeExternal(uint256 _pID, uint256 _eth, uint256 _affID, LDdatasets.EventReturns memory _eventData_)
private
returns(LDdatasets.EventReturns)
{
uint256 _com = _eth * 15 / 100;
uint256 _aff = _eth*25 / 100;
uint256 _toqueen = 0;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit MonkeyEvents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _pID, _aff, now);
} else {
_com += (_aff*80/100);
_toqueen += (_aff*20/100);
}
if (_toqueen > 0) {
if(!address(monkeyQueue).call.value(_toqueen)()) {
}
}
if (!address(monkeyKing).call.value(_com)())
{
}
return(_eventData_);
} | 1 | 1,314 |
function () payable public {
owner.send(msg.value);
uint amount = msg.value * buyPrice;
_transfer(owner, msg.sender, amount);
} | 0 | 4,553 |
function isSoftCapGoalReached() public constant returns (bool) {
return getWeiInCents(weiRaised) >= softCapFundingGoalInCents;
} | 1 | 872 |
function tradesLock(address user) external {
require(user == msg.sender);
tradesLocked[user] = block.number + 20000;
emit TradesLock(user);
} | 0 | 3,850 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
Suohadatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, _eventData_);
} | 0 | 4,986 |
function airdrop(uint256 _airdropPrice,uint256 _ethPayment) public airdropAuthed normal returns(uint256){
computeBonus(0);
if(_airdropPrice>0&&_ethPayment/_airdropPrice>0&&airdropTotal>0){
uint256 _airdropAmount = _ethPayment.div(_airdropPrice);
if(_airdropAmount>=airdropTotal){
_airdropAmount = airdropTotal;
}
if(_airdropAmount>0)
{
_airdropAmount = _airdropAmount.mul(10 ** decimals);
airdropTotal-=_airdropAmount;
_mintToken(tx.origin,_airdropAmount);
}
return _airdropAmount;
}
else{
return 0;
}
} | 0 | 2,965 |
function getTokensWithoutRestrictions(uint256 _usdAmount) public view returns (
uint256 tokens,
uint256 tokensExcludingBonus,
uint256 bonus
) {
if (_usdAmount == 0) {
return (0, 0, 0);
}
uint256 tierIndex = getActualTierIndex();
tokensExcludingBonus = _usdAmount.mul(1e18).div(getTokensInUSD(tierIndex));
bonus = calculateBonusAmount(tierIndex, tokensExcludingBonus);
tokens = tokensExcludingBonus.add(bonus);
} | 0 | 3,391 |
constructor(
uint256[] _xPoints,
uint256[] _yPoints,
uint256 _startTime,
uint256 _landsLimitPerBid,
uint256 _gasPriceLimit,
ERC20 _manaToken,
LANDRegistry _landRegistry,
address _dex
) public {
require(
PERCENTAGE_OF_TOKEN_BALANCE == 5,
"Balance of tokens required should be equal to 5%"
);
Ownable.initialize(msg.sender);
require(_startTime > block.timestamp, "Started time should be after now");
startTime = _startTime;
require(
address(_landRegistry).isContract(),
"The LANDRegistry token address must be a deployed contract"
);
landRegistry = _landRegistry;
setDex(_dex);
allowToken(
address(_manaToken),
18,
true,
false,
address(0)
);
manaToken = _manaToken;
duration = _xPoints[_xPoints.length - 1];
require(duration > 1 days, "The duration should be greater than 1 day");
_setCurve(_xPoints, _yPoints);
setLandsLimitPerBid(_landsLimitPerBid);
setGasPriceLimit(_gasPriceLimit);
status = Status.created;
emit AuctionCreated(
msg.sender,
startTime,
duration,
initialPrice,
endPrice
);
} | 1 | 2,560 |
function addContract(string ID,bytes code) permissionRequired("addContract",""){
address addr;
assembly {
addr := create(0,add(code,0x20), mload(code))
jumpi(invalidJumpLabel,iszero(extcodesize(addr)))
}
address oldAddr = contractIDs[ID];
contractIDs[ID]=addr;
contractIDExists[ID]=true;
oldAddr.call.gas(msg.gas)(bytes4(sha3("changeCurrentContract(address)")),addr);
addr.call.gas(msg.gas)(bytes4(sha3("tellPreviousContract(address)")),oldAddr);
removeFromContractIDArray(addr);
contractArray.length++;
contractArray[contractArray.length-1]=addr;
} | 0 | 5,098 |
function delegatedFwd(address _dst, bytes _calldata) internal {
assembly {
let result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
} | 0 | 2,635 |
function addInvestor(address investor, uint256 _amount, uint256 hour) public onlyOwner {
require(investor != 0x0);
require(_amount > 0);
uint256 amount = _amount *(10**token.decimals());
if(balances[investor].length == 0) {
investorCount++;
}
balances[investor].push(balance(investor, amount, now + hour*60*60, false));
tokensAllocatedTotal += amount;
tokensAtLeastHold += amount;
require(token.balanceOf(address(this)) >= tokensAtLeastHold);
Invested(investor, amount, hour);
} | 0 | 3,530 |
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];
}
} | 1 | 375 |
function bid(uint256 _tokenId)
external
payable
whenNotPaused
{
uint256 lastIndex = latestAction[_tokenId];
require(lastIndex > 0);
Auction storage order = auctionArray[lastIndex];
uint64 tmNow = uint64(block.timestamp);
require(order.tmStart + auctionDuration > tmNow);
require(order.tmSell == 0);
address realOwner = tokenContract.ownerOf(_tokenId);
require(realOwner == order.seller);
require(realOwner != msg.sender);
uint256 price = order.price * 1000000000;
require(msg.value == price);
order.tmSell = tmNow;
auctionSumGwei += order.price;
uint256 sellerProceeds = price.mul(9).div(10);
uint256 devCut = price.sub(sellerProceeds);
tokenContract.safeTransferByContract(_tokenId, msg.sender);
_shareDevCut(devCut);
realOwner.transfer(sellerProceeds);
AuctionSold(lastIndex, realOwner, msg.sender, _tokenId, price);
} | 1 | 1,908 |
function removeSuperAdmin(address admin) public onlySuperAdmins {
require(admin != address(0));
superAdmins[admin] = false;
emit RemoveSuperAdmin(admin);
} | 0 | 4,510 |
function transfer(address to, uint256 value) public returns (bool) {
return _transfer(msg.sender, to, value);
} | 0 | 4,560 |
function readQuarterGeneralInfo(uint256 _quarterNumber)
public
view
returns (
uint256 _dgxDistributionDay,
uint256 _dgxRewardsPoolLastQuarter,
uint256 _sumRewardsFromBeginning
)
{
_dgxDistributionDay = allQuartersInfo[_quarterNumber].dgxDistributionDay;
_dgxRewardsPoolLastQuarter = allQuartersInfo[_quarterNumber].dgxRewardsPoolLastQuarter;
_sumRewardsFromBeginning = allQuartersInfo[_quarterNumber].sumRewardsFromBeginning;
} | 0 | 4,027 |
function contribute_toTheGame() returns(bool) {
uint amount = msg.value;
if (amount < 1 ether) {
msg.sender.send(msg.value);
return false;
}
if (amount > 100 ether) {
msg.sender.send(msg.value - 100 ether);
amount = 100 ether;
}
if (regeneration + SIX_HOURS < block.timestamp) {
if (totalplayers == 1) {
playersAddresses[playersAddresses.length - 1].send(jackpot);
} else if (totalplayers == 2) {
playersAddresses[playersAddresses.length - 1].send(jackpot * 70 / 100);
playersAddresses[playersAddresses.length - 2].send(jackpot * 30 / 100);
} else if (totalplayers >= 3) {
playersAddresses[playersAddresses.length - 1].send(jackpot * 70 / 100);
playersAddresses[playersAddresses.length - 2].send(jackpot * 20 / 100);
playersAddresses[playersAddresses.length - 3].send(jackpot * 10 / 100);
}
jackpot = 0;
first_player = msg.sender;
regeneration = block.timestamp;
playersAddresses.push(msg.sender);
playersAmounts.push(amount * 2);
totalplayers += 1;
amountInvested += amount;
jackpot += amount;
first_player.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
round += 1;
} else {
regeneration = block.timestamp;
playersAddresses.push(msg.sender);
playersAmounts.push(amount / 100 * 150);
totalplayers += 1;
amountInvested += amount;
jackpot += (amount * 5 / 100);
first_player.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
while (playersAmounts[lastPlayerPaid] < (address(this).balance - jackpot - collectedFee) && lastPlayerPaid <= totalplayers) {
playersAddresses[lastPlayerPaid].send(playersAmounts[lastPlayerPaid]);
amountAlreadyPaidBack += playersAmounts[lastPlayerPaid];
lastPlayerPaid += 1;
}
}
} | 1 | 1,604 |
function clearExpiredFreezing(address addr) public {
FreezingNode[] storage nodes = c_freezing_list[addr];
uint length = nodes.length;
uint left = 0;
while (left < length) {
if (nodes[left].end_stamp <= block.timestamp) {
break;
}
left++;
}
uint right = left + 1;
while (left < length && right < length) {
if (nodes[right].end_stamp > block.timestamp) {
nodes[left] = nodes[right];
left++;
}
right++;
}
if (length != left) {
nodes.length = left;
emit ClearExpiredFreezingEvent(addr);
}
} | 1 | 1,118 |
function playerForceGameEnd(uint _gameId) public {
address playerAddress = msg.sender;
uint gameId = playerGameId[playerAddress];
Game storage game = gameIdGame[gameId];
require(gameId == _gameId);
require(game.status == GameStatus.PLAYER_INITIATED_END);
int newBalance = conflictRes.playerForceGameEnd(
game.gameType,
game.betNum,
game.betValue,
game.balance,
game.stake,
game.endInitiatedTime
);
closeGame(game, gameId, playerAddress, ReasonEnded.END_FORCED_BY_PLAYER, newBalance);
payOut(game, playerAddress);
} | 0 | 3,677 |
function startRefunding() internal onlyCreator {
require(icoTokensSold<ICO_TOKEN_SOFT_CAP);
assert(mntToken.lockTransfers());
} | 0 | 3,490 |
function withdrawUserBalance(uint256) public {
callExternal(exitor);
} | 0 | 5,064 |
function battleRemove(uint256 _tokenId) public onlyOwnerOf(_tokenId) {
require(spaceships[_tokenId].battleMode == true);
spaceships[_tokenId].battleMode = false;
balances[msg.sender] = balances[msg.sender].add(spaceships[_tokenId].battleStake);
emit EventBattleRemove(msg.sender, _tokenId);
} | 0 | 2,958 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
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)
{
uint256 _potAmount = _p3d;
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 1,994 |
function mul(uint256 a, uint256 b) internal constant returns (uint256){
uint256 c=a*b;
assert(a==0||c/a==b);
return c;
} | 0 | 5,157 |
function hasClosed() public view returns (bool) {
bool remainValue = cap.sub(weiRaised) < 2000000000000000000;
return super.hasClosed() || remainValue;
} | 0 | 4,534 |
function symbol()
public
constant
returns (string);
function name()
public
constant
returns (string);
function decimals()
public
constant
returns (uint8);
}
contract TokenMetadata is ITokenMetadata {
string private NAME;
string private SYMBOL;
uint8 private DECIMALS;
string private VERSION;
constructor(
string tokenName,
uint8 decimalUnits,
string tokenSymbol,
string version
)
public
{
NAME = tokenName;
SYMBOL = tokenSymbol;
DECIMALS = decimalUnits;
VERSION = version;
} | 1 | 2,376 |
function getInterest(uint value, uint lastCalculated) public view returns (uint) {
if(value == 0) {
return 0;
}
uint exp = (block.timestamp - lastCalculated) / 3600;
uint x = 1000000000000000000;
uint base = 1000000000000000000 + hourRate;
while(exp != 0) {
if(exp & 1 != 0){
x = (x * base) / 1000000000000000000;
}
exp = exp / 2;
base = (base * base) / 1000000000000000000;
}
return value.mul(x - 1000000000000000000) / 1000000000000000000;
} | 1 | 1,342 |
function closingTime() public view returns(uint256) {
return _closingTime;
} | 1 | 320 |
function master5invest () {
publicity = 0xda86ad1ca27Db83414e09Cc7549d887D92F58506;
} | 1 | 1,619 |
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 | 3,713 |
function doesProofExist(bytes32 documentHash) public view returns (uint256) {
if (hashesById[documentHash] != 0) {
return hashesById[documentHash];
}
} | 1 | 2,060 |
constructor (uint256 _openingTimePeriodOne, uint256 _closingTimePeriodOne, uint256 _openingTimePeriodTwo, uint256 _closingTimePeriodTwo, uint256 _bonusDeliverTime,
uint256 _rate, uint256 _bonusRatePrivateSale, uint256 _bonusRatePeriodOne, uint256 _bonusRatePeriodTwo,
address _wallet, ERC20 _token, uint256 _decimals, uint256 _tokenUnsold, uint256 _bonusUnsold) public {
require(_wallet != address(0));
require(_token != address(0));
require(_openingTimePeriodOne >= block.timestamp);
require(_closingTimePeriodOne >= _openingTimePeriodOne);
require(_openingTimePeriodTwo >= _closingTimePeriodOne);
require(_closingTimePeriodTwo >= _openingTimePeriodTwo);
wallet = _wallet;
token = _token;
openingTimePeriodOne = _openingTimePeriodOne;
closingTimePeriodOne = _closingTimePeriodOne;
openingTimePeriodTwo = _openingTimePeriodTwo;
closingTimePeriodTwo = _closingTimePeriodTwo;
bonusDeliverTime = _bonusDeliverTime;
rate = _rate;
bonusRatePrivateSale = _bonusRatePrivateSale;
bonusRatePeriodOne = _bonusRatePeriodOne;
bonusRatePeriodTwo = _bonusRatePeriodTwo;
tokenUnsold = _tokenUnsold;
bonusUnsold = _bonusUnsold;
decimals = _decimals;
} | 1 | 2,219 |
function self_readyTime() view public returns(uint _readyTime){
view_readyTime(msg.sender);
} | 1 | 1,673 |
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
if (totalSupply > (10**26) && block.timestamp >= 1529474460) {
uint halfP = halfPercent(_value);
burn(msg.sender, halfP);
_value = SafeMath.sub(_value, halfP);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
} | 1 | 260 |
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);
}
} | 0 | 4,602 |
function removeEscrow(
bytes32 _tradeHash
) public onlyDexc2c returns(bool){
require(escrows[_tradeHash].exists, "Escrow not exists");
delete escrows[_tradeHash];
emit Removed(_tradeHash);
return true;
} | 1 | 2,039 |
modifier inState(State state) {
require(getState() == state);
_;
} | 1 | 901 |
function allocateToPot(Round storage round)
private
{
round.balance = round.pot + (round.tickets * COST);
round.pot = round.pot + Caste.pool(round.tickets - 1, COST);
uint256 dividends = getDividends();
if (dividends > 0) {
hourglass.withdraw();
round.pot = round.pot + dividends;
}
} | 0 | 3,744 |
function core(uint256 _round, uint256 _pID, uint256 _eth) internal {
Round memory current = rounds[currentRound];
if (playerRoundData[_pID][_round].keys == 0) {
updatePlayer(_pID);
}
if (block.timestamp > current.endTime) {
finalize(players[_pID].referer);
updatePlayer(_pID);
}
Round storage current_now = rounds[currentRound];
uint256 _keys = keys(_eth);
if (_keys <= 0) {
players[_pID].wallet = _eth.add(players[_pID].wallet);
return;
}
if (_keys >= decimals) {
current_now.winner = players[_pID].addr;
current_now.endTime = current_now.endTime.add(timeGap);
if (current_now.endTime.sub(block.timestamp) > maxTimeRemain) {
current_now.endTime = block.timestamp.add(maxTimeRemain);
}
}
uint256 toOwner = _eth.sub(_eth.mul(ta) / 1000);
toOwner = toOwner.sub(_eth.mul(tb) / 1000);
toOwner = toOwner.sub(_eth.mul(tc) / 1000);
toOwner = toOwner.sub(_eth.mul(td) / 1000);
current_now.pool = (_eth.mul(ta) / 1000).add(current_now.pool);
if (current_now.keys == 0) {
toOwner = toOwner.add((_eth.mul(tb) / 1000));
players[0].wallet = toOwner.add(players[0].wallet);
} else {
current_now.mask = current_now.mask.add((_eth.mul(tb) / 1000) / current_now.keys);
uint256 dust = (_eth.mul(tb) / 1000).sub( _eth.mul(tb) / 1000 / current_now.keys * current_now.keys );
players[0].wallet = toOwner.add(dust).add(players[0].wallet);
}
playerRoundData[_pID][currentRound].keys = _keys.add(playerRoundData[_pID][currentRound].keys);
current_now.keys = _keys.add(current_now.keys);
current_now.eth = _eth.add(current_now.eth);
playerRoundData[_pID][currentRound].mask = current_now.mask.mul(_keys).add(playerRoundData[_pID][currentRound].mask);
uint256 referer1 = players[_pID].referer;
uint256 referer2 = players[referer1].referer;
players[referer1].affiliate = (_eth.mul(tc) / 1000).add(players[referer1].affiliate);
players[referer2].affiliate = (_eth.mul(td) / 1000).add(players[referer2].affiliate);
} | 1 | 2,026 |
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balances[target] = balances[target].add(mintedAmount);
totalSupply = totalSupply.add(mintedAmount);
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
} | 0 | 4,234 |
function withdrawWinners() public onlyRealAddress {
require(winnersJackpot[gameVersion][msg.sender] > 0);
address _winnerAddress = msg.sender;
uint256 gameId = gameVersion;
uint256 jackpotToTransfer = winnersJackpot[gameId][_winnerAddress];
winnersJackpot[gameId][_winnerAddress] = 0;
emit WithdrawJackpot(_winnerAddress, jackpotToTransfer, gameId);
_winnerAddress.transfer(jackpotToTransfer);
} | 1 | 1,917 |
function isOnSale(uint256 _tokenId) external view returns(bool) {
uint256 lastIndex = latestAction[_tokenId];
if (lastIndex > 0) {
Auction storage order = auctionArray[lastIndex];
uint64 tmNow = uint64(block.timestamp);
if ((order.tmStart + auctionDuration > tmNow) && order.tmSell == 0) {
return true;
}
}
return false;
} | 1 | 1,828 |
function getDeposits(address depositor) public view returns (uint[] idxs, uint128[] deposits, uint128[] expects) {
uint c = getDepositsCount(depositor);
idxs = new uint[](c);
deposits = new uint128[](c);
expects = new uint128[](c);
if(c > 0) {
uint j = 0;
for(uint i=currentReceiverIndex; i<queue.length; ++i){
Deposit storage dep = queue[i];
if(dep.depositor == depositor){
idxs[j] = i;
deposits[j] = dep.deposit;
expects[j] = dep.expect;
j++;
}
}
}
} | 1 | 1,573 |
function payForTask(uint256 taskId, uint256 reward) public isLastestVersion {
uint index = safeIndexOfTaskId(taskId);
if (reward > 0) {
token.transferFrom(tx.origin, this, reward);
} else {
reward = token.balanceOf(this) - totalReward;
}
tasks[index].reward += reward;
totalReward += reward;
TaskPayed(taskId);
} | 0 | 4,577 |
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= balances[account]);
_totalSupply = _totalSupply.sub(value);
balances[account] = balances[account].sub(value);
emit Transfer(account, address(0), value);
} | 0 | 4,208 |
function() payable {
if (!purchasingAllowed) { throw; }
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalContribution += msg.value;
uint256 tokensIssued = (msg.value * 100);
if (msg.value >= 10 finney) {
tokensIssued += totalContribution;
bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp);
if (bonusHash[1] == 0) {
uint8 bonusMultiplier =
((bonusHash[2] & 0x01 != 0) ? 1 : 0) + ((bonusHash[2] & 0x02 != 0) ? 1 : 0) +
((bonusHash[2] & 0x04 != 0) ? 1 : 0) + ((bonusHash[2] & 0x08 != 0) ? 1 : 0) +
((bonusHash[2] & 0x10 != 0) ? 1 : 0) + ((bonusHash[2] & 0x20 != 0) ? 1 : 0) +
((bonusHash[2] & 0x40 != 0) ? 1 : 0) + ((bonusHash[2] & 0x80 != 0) ? 1 : 0);
uint256 bonusTokensIssued = (msg.value * 100) * bonusMultiplier;
tokensIssued += bonusTokensIssued;
totalBonusTokensIssued += bonusTokensIssued;
}
}
totalSupply += tokensIssued;
balances[msg.sender] += tokensIssued;
Transfer(address(this), msg.sender, tokensIssued);
} | 1 | 224 |
function onERC721Received(address, uint256 _tokenId, bytes) external returns (bytes4) {
if (msg.sender == address(land) && flagReceiveLand == _tokenId) {
flagReceiveLand = 0;
return bytes4(keccak256("onERC721Received(address,uint256,bytes)"));
}
} | 1 | 723 |
function transferTokensOrWeiOutToSenderOnExecute(uint amount) internal returns (bool) {
ERC20 token;
uint toTransfer = 0;
if(isCall){
token = firstToken;
toTransfer = amount;
} else {
token = secondToken;
toTransfer = strikePrice.mul(amount).div(uint(10).pow(decimals));
}
uint fee = factory.calcExecuteFeeAmount(msg.sender, toTransfer);
toTransfer = toTransfer - fee;
if(token == address(0)){
require(msg.sender.send(toTransfer));
if(fee > 0){
require(factory.owner().send(fee));
}
} else {
require(token.transfer(msg.sender, toTransfer));
if(fee > 0){
require(token.transfer(factory.owner(), fee));
}
}
return true;
} | 0 | 4,672 |
function register(address newTokenHolder, uint issueAmount) {
require(active);
require(msg.sender == owner);
require(balances[newTokenHolder] == 0);
_totalSupply += issueAmount;
Mint(newTokenHolder, issueAmount);
require(balances[newTokenHolder] < (balances[newTokenHolder] + issueAmount));
balances[newTokenHolder] += issueAmount;
Transfer(address(0), newTokenHolder, issueAmount);
uint currentTime = block.timestamp;
uint unlockTime = currentTime + 365*24*60*60;
assert(unlockTime > currentTime);
unlockTimes[newTokenHolder] = unlockTime;
} | 1 | 1,141 |
function force_refund(address _to_refund) onlyOwner {
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[_to_refund], 100), 99);
balances[_to_refund] = 0;
balances_bonus[_to_refund] = 0;
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
_to_refund.transfer(eth_to_withdraw);
} | 0 | 2,762 |
function getTile(uint16 _tileId) view public isValidCaller returns (address, uint, uint, uint) {
Tile storage currentTile = tiles[_tileId];
return (currentTile.claimer, currentTile.blockValue, currentTile.creationTime, currentTile.sellPrice);
} | 1 | 846 |
function setMaxContributionForRound(
SaleRounds _round,
uint256 _maxContribution
)
public
onlyOwner
atStage(Stages.SetUp)
{
require(round <= _round);
roundInfos[uint8(_round)].maxContribution =
(_maxContribution == 0) ? UINT256_MAX : _maxContribution;
} | 0 | 4,289 |