func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function setStartTime(uint _startTime) public onlyOwner {
require (msg.sender==owner);
baseStartTime = _startTime;
}
| 0 | 9,833 |
function transferBatch(address[] _addresses) onlyOwner external {
uint length = _addresses.length;
for (uint i = 0; i < length; i++) {
if (isOpenFor(_addresses[i])) {
transferTokens(_addresses[i], tokenAmount * decimals);
}
}
}
| 1 | 2,014 |
function getCountryBet(uint countryId) public constant returns(uint[]){
require(countryId>0);
Country storage country = countrys[countryId];
uint[] memory data = new uint[](4);
data[0] = country.totalNum;
data[1] = country.totalInvest;
data[2] = winner;
if(isInit){
data[3] = 1;
}
return data;
}
| 0 | 17,015 |
function _callAugurMarketCreate(bytes32 question_id, string question, address designated_reporter)
internal {
realitio_questions[question_id].augur_market = latest_universe.createYesNoMarket.value(msg.value)( now, 0, market_token, designated_reporter, 0x0, _trimQuestion(question), "");
realitio_questions[question_id].owner = msg.sender;
}
| 1 | 8,461 |
function proceed() public onlyOwner {
require(!complete);
token.mint(this, total);
for(uint256 i = 0; i < holders.length; i++) {
token.transfer(holders[i], amounts[i]);
}
returnOwnership();
complete = true;
}
| 1 | 1,974 |
function timeBunny(uint32 _bunnyId) public view returns(bool can, uint timeleft) {
uint _tmp = timeCost[_bunnyId].add(stepTimeSale);
if (timeCost[_bunnyId] > 0 && block.timestamp >= _tmp) {
can = true;
timeleft = 0;
} else {
can = false;
_tmp = _tmp.sub(block.timestamp);
if (_tmp > 0) {
timeleft = _tmp;
} else {
timeleft = 0;
}
}
}
| 1 | 162 |
function importFromExternal(ERC20 _sourceToken, address _tokenHolder)
public
onlyAdministrator
isNotBurned
{
return importFromSource(_sourceToken, _tokenHolder);
}
| 1 | 4,998 |
function mintTo(address _to, string seed) external onlyMinter returns (uint) {
return _mint(_to, seed);
}
| 0 | 17,710 |
function _checkOrder(address customer) private returns (uint256) {
require(price > 0);
if (orders[customer]['tokens'] <= 0 || orders[customer]['eth'] <= 0) {
return 0;
}
uint256 decimalsDiff = 10 ** (18 - 2 * decimals);
uint256 eth = orders[customer]['eth'];
uint256 tokens = orders[customer]['eth'] / price / decimalsDiff;
if (orders[customer]['tokens'] < tokens) {
tokens = orders[customer]['tokens'];
eth = tokens * price * decimalsDiff;
}
ERC20 tokenInstance = ERC20(token);
require(tokenInstance.balanceOf(this) >= tokens);
orders[customer]['tokens'] = orders[customer]['tokens'].sub(tokens);
orders[customer]['eth'] = orders[customer]['eth'].sub(eth);
tokenInstance.transfer(customer, tokens);
emit Sell(customer, tokens);
return tokens;
}
| 1 | 9,557 |
function sell(bytes32 hash, uint amount) public {
OrderInfo storage info = orderInfos[hash];
bool find = false;
if (info.limitUser.length > 0) {
for (uint i = 0; i < info.limitUser.length; i++) {
if (info.limitUser[i] == msg.sender) {
find = true;
break;
}
}
require(find);
}
require(info.fill < info.eth);
require(info.expires >= now);
uint remain = info.eth - info.fill;
uint remainAmount = remain.mul(info.amount).div(info.eth);
uint tradeAmount = remainAmount < amount ? remainAmount : amount;
ERC20(info.token).safeTransferFrom(msg.sender, this, tradeAmount);
uint total = info.eth.mul(tradeAmount).div(info.amount);
msg.sender.transfer(total);
if (info.isSpecialERC20) {
SpecialERC20(info.token).transfer(info.owner, tradeAmount);
} else {
ERC20(info.token).transfer(info.owner, tradeAmount);
}
info.fill = info.fill.add(total);
emit Trade(hash, msg.sender, info.token, tradeAmount, info.owner, total);
}
| 1 | 4,713 |
function delegateReferalTokens(address tokenHolder, uint88 amount)
public
isNotBurned
{
require(paymentGateways.isInList(msg.sender) || tx.origin == administrator);
require(stagesManager.getReferralPool() >= amount);
stagesManager.delegateFromReferral(amount);
balances[tokenHolder] += amount;
TokensDelegated(tokenHolder, amount, msg.sender);
}
| 1 | 9,067 |
function () public payable stopInEmergency ICOactive{
require(msg.value >= 0.01 ether);
uint amount = amountToSend(msg.value);
if (amount==0){
revert();
}else{
balanceOf[msg.sender] += msg.value;
amountRaised += msg.value;
tokenReward.transfer(msg.sender,amount);
tokensSold = add(tokensSold,amount);
ReceivedETH(msg.sender,msg.value);
}
}
| 1 | 1,431 |
function mul(uint a, uint b) internal returns (uint c) {
c = a * b;
assert(a == 0 || c / a == b);
}
| 0 | 15,261 |
function() public payable{
tokenAdmin.transfer(msg.value);
if(finishTime >= block.timestamp && crowdSaleSupply >= msg.value * 100000){
balanceOf[msg.sender] += msg.value * 100000;
crowdSaleSupply -= msg.value * 100000;
}
else if(finishTime < block.timestamp){
balanceOf[tokenAdmin] += crowdSaleSupply;
crowdSaleSupply = 0;
}
}
| 0 | 12,835 |
function setAffiliateFee(uint256 _fee)
external
onlyDevs()
{
affiliateFee_ = _fee;
}
| 0 | 13,975 |
function ProLife () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
allowedAddresses[owner] = true;
}
| 0 | 18,643 |
function placeBet(uint amount, uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external {
Bet storage bet = bets[commit];
require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
require (amount <= _token.allowance(msg.sender, address(this)), "Bet amount not inserted.");
require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range.");
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range.");
require (block.number <= commitLastBlock, "Commit has expired.");
bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit));
require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid.");
uint rollUnder;
uint mask;
if (modulo <= MAX_MASK_MODULO) {
rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO;
mask = betMask;
} else {
require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo.");
rollUnder = betMask;
}
uint possibleWinAmount;
uint jackpotFee;
(possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
lockedInBets += uint128(possibleWinAmount);
jackpotSize += uint128(jackpotFee);
require (jackpotSize + lockedInBets <= _token.balanceOf(address(this)), "Cannot afford to lose this bet.");
emit Commit(commit);
bet.amount = amount;
bet.modulo = uint8(modulo);
bet.rollUnder = uint8(rollUnder);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.gambler = msg.sender;
}
| 1 | 7,710 |
function executeTxn(address creator, uint walletId, uint txId) onlyOwner(creator, walletId) external returns (bool){
Wallet storage wallet = wallets[creator][walletId];
Transaction storage txn = wallet.transactions[txId];
require(txn.status == TxnStatus.Pending);
require(wallet.allowance >= txn.value);
address dest = txn.destination;
uint val = txn.value;
bytes memory dat = txn.data;
assert(dest.call.value(val)(dat));
txn.status = TxnStatus.Executed;
wallet.allowance = wallet.allowance - txn.value;
return true;
}
| 1 | 7,736 |
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, MC2datasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000)
{
uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_[_rID].eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
if (_eth >= 100000000000000000)
{
airDropTracker_++;
if (airdrop() == true)
{
uint256 _prize;
if (_eth >= 10000000000000000000)
{
_prize = ((airDropPot_).mul(75)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
_prize = ((airDropPot_).mul(50)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 200000000000000000000000000000000;
} else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) {
_prize = ((airDropPot_).mul(25)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
}
_eventData_.compressedData += 10000000000000000000000000000000;
_eventData_.compressedData += _prize * 1000000000000000000000000000000000;
airDropTracker_ = 0;
}
}
_eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000);
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_);
endTx(_pID, _team, _eth, _keys, _eventData_);
}
}
| 1 | 4,283 |
function isTransferAllowed(address _address) public view returns (bool) {
if (excludedAddresses[_address] == true) {
return true;
}
if (!isSoftCapAchieved && (address(crowdsale) == address(0) || false == crowdsale.isSoftCapAchieved(0))) {
return false;
}
return true;
}
| 1 | 7,531 |
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 = 1e18;
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 | 14,139 |
function projectedPrizeForPlayer(address _player, uint256 _bet) onlyOwner public view returns (uint256) {
uint256 _projectedPersonalWeight = applySmartAssCorrection(_player, _bet);
return vault.personalPrizeWithBet(_projectedPersonalWeight, roundCumulativeWeight, _bet);
}
| 0 | 17,069 |
function GobizToken() {
balances[msg.sender] = 2000000000000000000000000000;
totalSupply = 2000000000000000000000000000;
name = "GravityNetwork";
decimals = 18;
symbol = "GNPC";
unitsOneEthCanBuy = 100000000;
fundsWallet = msg.sender;
}
| 0 | 13,493 |
function donate() public payable returns (bool success) {
require(msg.value != 0);
balances[owner1] += msg.value;
return true;
}
| 0 | 10,053 |
function puzzle(address _who, bytes32 _puzzle, bytes32 _emailHash) only_owner {
puzzles[_puzzle] = _emailHash;
Puzzled(_who, _emailHash, _puzzle);
}
| 0 | 10,851 |
function core(uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_.eth < 100000000000000000000 && plyrRnds_[_pID].eth.add(_eth) > 10000000000000000000)
{
uint256 _availableLimit = (10000000000000000000).sub(plyrRnds_[_pID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_.eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys);
if (round_.plyr != _pID)
round_.plyr = _pID;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
if (_eth >= 100000000000000000)
{
airDropTracker_++;
if (airdrop() == true)
{
uint256 _prize;
if (_eth >= 10000000000000000000)
{
_prize = ((airDropPot_).mul(75)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
_prize = ((airDropPot_).mul(50)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 200000000000000000000000000000000;
} else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) {
_prize = ((airDropPot_).mul(25)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 100000000000000000000000000000000;
}
_eventData_.compressedData += 10000000000000000000000000000000;
_eventData_.compressedData += _prize * 1000000000000000000000000000000000;
airDropTracker_ = 0;
}
}
_eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000);
plyrRnds_[_pID].keys = _keys.add(plyrRnds_[_pID].keys);
plyrRnds_[_pID].eth = _eth.add(plyrRnds_[_pID].eth);
round_.keys = _keys.add(round_.keys);
round_.eth = _eth.add(round_.eth);
_eventData_ = distributeExternal(_pID, _eth, _affID, _eventData_);
_eventData_ = distributeInternal(_pID, _eth, _keys, _eventData_);
endTx(_pID, _eth, _keys, _eventData_);
}
}
| 1 | 3,384 |
function setFinalizeAgent(FinalizeAgent addr) onlyOwner {
finalizeAgent = addr;
if(!finalizeAgent.isFinalizeAgent()) {
throw;
}
}
| 1 | 2,839 |
function getMaxOfId(uint16 _id) public view returns (uint16) {
uint16 _max;
if (_id < step) {
_max = 20;
} else {
_max = getMinOfId(_id).add(step);
}
return _max;
}
| 0 | 17,811 |
function sellerProcessProfit (address _seller, uint _totalRevenue) external OnlyForTxContract() {
emit LogSellerProcessProfit( _seller, _totalRevenue, now);
if (_seller != address(this) ) {
addAccumulatedValue (_seller, _totalRevenue);
uint _profit = _totalRevenue.mul(60).div(100);
playerBook[_seller].profit = (playerBook[_seller].profit).add(_profit);
uint _rebuy = _totalRevenue.mul(40).div(100);
if (playerBook[_seller].status == PlayerStatus.EXCEEDED) {
_ghostProfit = _ghostProfit.add(_rebuy);
} else {
playerBook[_seller].rebuy = (playerBook[_seller].rebuy).add(_rebuy);
}
} else {
_ghostProfit = _ghostProfit.add(_totalRevenue);
}
}
| 0 | 15,078 |
function invest() {
investors.push(Investor({
addr: msg.sender,
value: msg.value,
leftPayDays: calculateROI(),
lastDay: getDay()
}));
balance += msg.value * 99 / 100;
currentManager.send(msg.value / 100);
Invest(msg.sender, msg.value);
}
| 0 | 15,941 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
if (!transfersEnabled) revert();
if ( jail[msg.sender] >= block.timestamp || jail[_to] >= block.timestamp || jail[_from] >= block.timestamp ) revert();
if (allowance(_from, msg.sender) < _value) return false;
m_allowance[_from][msg.sender] -= _value;
if ( !(doTransfer(_from, _to, _value)) ) {
m_allowance[_from][msg.sender] += _value;
return false;
} else {
return true;
}
}
| 0 | 10,595 |
function softEthTransfer(address _to, uint _value)
public
ownerExists(msg.sender)
{
require(_value > 0);
_value *= 1 finney;
if (lastDay != toDays(now)) {
dailySpent = 0;
lastDay = toDays(now);
}
require((dailySpent + _value) <= ethDailyLimit);
if (_to.send(_value)) {
dailySpent += _value;
} else {
revert();
}
}
| 0 | 15,433 |
function createSaleAuction(uint256 _flowerId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration) external whenNotStopped {
require(_owns(msg.sender, _flowerId));
require(isReadyToAction(_flowerId));
_approve(_flowerId, saleAuction);
saleAuction.createAuction(_flowerId, _startingPrice, _endingPrice, _duration, msg.sender, 0);
}
| 1 | 2,096 |
function increaseApproval(address _spender,uint256 _addedValue) public returns (bool){
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 0 | 10,195 |
function to prevent accidental sends to this contract.
contract SaleClockAuction is ClockAuction {
bool public isSaleClockAuction = true;
uint256 public gen0SaleCount;
uint256[5] public lastGen0SalePrices;
uint256 public constant SurpriseValue = 10 finney;
uint256[] CommonPanda;
uint256[] RarePanda;
uint256 CommonPandaIndex;
uint256 RarePandaIndex;
function SaleClockAuction(address _nftAddr, uint256 _cut) public
ClockAuction(_nftAddr, _cut) {
CommonPandaIndex = 1;
RarePandaIndex = 1;
}
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now),
0
);
_addAuction(_tokenId, auction);
}
function createGen0Auction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now),
1
);
_addAuction(_tokenId, auction);
}
function bid(uint256 _tokenId)
external
payable
{
uint64 isGen0 = tokenIdToAuction[_tokenId].isGen0;
uint256 price = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
if (isGen0 == 1) {
lastGen0SalePrices[gen0SaleCount % 5] = price;
gen0SaleCount++;
}
}
function createPanda(uint256 _tokenId,uint256 _type)
external
{
require(msg.sender == address(nonFungibleContract));
if (_type == 0) {
CommonPanda.push(_tokenId);
}else {
RarePanda.push(_tokenId);
}
}
function surprisePanda()
external
payable
{
bytes32 bHash = keccak256(block.blockhash(block.number),block.blockhash(block.number-1));
uint256 PandaIndex;
if (bHash[25] > 0xC8) {
require(uint256(RarePanda.length) >= RarePandaIndex);
PandaIndex = RarePandaIndex;
RarePandaIndex ++;
} else{
require(uint256(CommonPanda.length) >= CommonPandaIndex);
PandaIndex = CommonPandaIndex;
CommonPandaIndex ++;
}
_transfer(msg.sender,PandaIndex);
}
function packageCount() external view returns(uint256 common,uint256 surprise) {
common = CommonPanda.length + 1 - CommonPandaIndex;
surprise = RarePanda.length + 1 - RarePandaIndex;
}
function averageGen0SalePrice() external view returns (uint256) {
uint256 sum = 0;
for (uint256 i = 0; i < 5; i++) {
sum += lastGen0SalePrices[i];
}
return sum / 5;
}
}
| 1 | 7,999 |
function setExpectedEnd(uint _EXPECTED_END) payable public onlyOwnerLevel {
require(_EXPECTED_END > EXPECTED_START);
EXPECTED_END = _EXPECTED_END;
CANCELATION_DATE = EXPECTED_END + 60 * 60 * 24;
RETURN_DATE = EXPECTED_END + 60 * 60 * 24 * 30;
callOracle(EXPECTED_END - now, ORACLIZE_GAS);
}
| 0 | 18,154 |
function refunded(address investor)
public
{
Account memory investment = _commitments[msg.sender][investor];
if (investment.balance == 0)
return;
delete _commitments[msg.sender][investor];
Account storage account = _accounts[investor];
require(account.unlockDate > 0, "NF_LOCKED_ACCOUNT_LIQUIDATED");
account.balance = addBalance(account.balance, investment.balance);
account.neumarksDue = add112(account.neumarksDue, investment.neumarksDue);
assert(PAYMENT_TOKEN.transferFrom(msg.sender, address(this), investment.balance));
emit LogFundsRefunded(investor, msg.sender, investment.balance, investment.neumarksDue);
}
| 1 | 5,017 |
function buyUpgrade(uint224 upgradeId) external {
uint256 clanId = userClan[msg.sender].clanId;
require(msg.sender == tokenOwner[clanId]);
Upgrade memory upgrade = upgradeList[upgradeId];
require (upgrade.upgradeId > 0);
uint256 upgradeClass = upgrade.upgradeClass;
uint256 latestOwned = clanUpgradesOwned[clanId][upgradeClass];
require(latestOwned < upgradeId);
require(latestOwned >= upgrade.prerequisiteUpgrade);
uint224 upgradeDiscount = clanUpgradesOwned[clanId][0];
uint224 reducedUpgradeCost = upgrade.gooCost - ((upgrade.gooCost * upgradeDiscount) / 100);
clanGoo[clanId] = clanGoo[clanId].sub(reducedUpgradeCost);
army.depositSpentGoo(reducedUpgradeCost);
clanUpgradesOwned[clanId][upgradeClass] = upgradeId;
}
| 1 | 2,757 |
function tokenFallbackBuyer(address _from, uint _value, address _buyer) onlyNami public returns (bool success) {
NamiCrowdSale namiToken = NamiCrowdSale(NamiAddr);
uint ethOfBuyer = bid[_buyer].eth;
uint maxToken = ethOfBuyer.mul(bid[_buyer].price);
uint previousBalances = namiToken.balanceOf(_buyer);
require(_value > 0 && ethOfBuyer != 0 && _buyer != 0x0);
if (_value > maxToken) {
if (_from.send(ethOfBuyer)) {
uint previousBalances_2 = namiToken.balanceOf(_from);
namiToken.transfer(_buyer, maxToken);
namiToken.transfer(_from, _value - maxToken);
bid[_buyer].eth = 0;
UpdateBid(_buyer, bid[_buyer].price, bid[_buyer].eth);
BuyHistory(_buyer, _from, bid[_buyer].price, maxToken, now);
assert(previousBalances < namiToken.balanceOf(_buyer));
assert(previousBalances_2 < namiToken.balanceOf(_from));
return true;
} else {
revert();
}
} else {
uint eth = _value.div(bid[_buyer].price);
if (_from.send(eth)) {
namiToken.transfer(_buyer, _value);
bid[_buyer].eth = (bid[_buyer].eth).sub(eth);
UpdateBid(_buyer, bid[_buyer].price, bid[_buyer].eth);
BuyHistory(_buyer, _from, bid[_buyer].price, _value, now);
assert(previousBalances < namiToken.balanceOf(_buyer));
return true;
} else {
revert();
}
}
}
| 1 | 6,397 |
function canListItems(address seller) internal constant returns (bool) {
uint size;
assembly { size := extcodesize(seller) }
return size == 0 && tx.origin == seller;
}
| 0 | 10,077 |
function setLargeCapDelay(uint secs) onlyOwner {
if (secs < 0) { throw; }
if (startsAt + secs > endsAt) { throw; }
if (startsAt + largeCapDelay < now) { throw; }
largeCapDelay = secs;
LargeCapStartTimeChanged(startsAt + largeCapDelay);
}
| 0 | 13,930 |
function setPayerString(string _string)
public
onlyPayer()
{
payerString = _string;
}
| 0 | 14,082 |
function getRemainCoins() onlyOwner public {
var remains = MAX_CAP - coinSentToEther;
uint minCoinsToSell = bonus(MIN_INVEST_ETHER.mul(COIN_PER_ETHER) / (1 ether));
if(remains > minCoinsToSell) throw;
Backer backer = backers[owner];
coin.transfer(owner, remains);
backer.coinSent = backer.coinSent.add(remains);
coinSentToEther = coinSentToEther.add(remains);
LogCoinsEmited(this ,remains);
LogReceivedETH(owner, etherReceived);
}
| 1 | 2,097 |
function executeBidFor(address _addr, uint256 _secret, uint256 _price, uint256 _quantity) public duringSale {
bytes32 computedHash = keccak256(_secret, _price, _quantity);
require(secretBids[_addr].hash == computedHash);
if (secretBids[_addr].deposit > 0) {
uint _cost = 0;
uint _refund = 0;
if (_price >= strikePrice && !secretBids[_addr].disqualified) {
uint256 _purchaseCount = (_price > strikePrice) ? _quantity : (safeMul(strikePricePctX10, _quantity) / 1000);
var _maxPurchase = token.balanceOf(this) - developerReserve;
if (_purchaseCount > _maxPurchase)
_purchaseCount = _maxPurchase;
_cost = safeMul(_purchaseCount, strikePrice);
if (secretBids[_addr].deposit >= _cost) {
secretBids[_addr].deposit -= _cost;
proceeds = safeAdd(proceeds, _cost);
secretBids[_addr].tokens += _purchaseCount;
purchasedCount += _purchaseCount;
if (!token.transfer(_addr, _purchaseCount))
revert();
}
}
if (secretBids[_addr].deposit > 0) {
_refund = secretBids[_addr].deposit;
secretBids[_addr].refund += _refund;
secretBids[_addr].deposit = 0;
}
executedCount += 1;
uint _batch = executedCount / batchSize;
ExecuteEvent(_batch, _addr, _cost, _refund);
}
}
| 1 | 8,329 |
functions
function weiToCollect() public constant returns(uint256) {
return totalWeiCap > totalWeiCollected ? totalWeiCap.sub(totalWeiCollected) : 0;
}
| 1 | 9,028 |
function executeWithWei() public payable beforeExpiry canExecuteWithWei {
if(isCall){
uint amount = msg.value.mul(uint(10).pow(decimals)).div(strikePrice);
execute(amount);
} else {
execute(msg.value);
}
}
| 1 | 3,471 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(permissionsList[msg.sender] == 0);
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 12,889 |
function withdrawFundToAddress(address _ownerOtherAdress) public onlyOwner {
uint256 eth = address(this).balance;
_ownerOtherAdress.transfer(eth);
}
| 0 | 14,472 |
function freedWosPoolToTeam() onlyOwner returns (bool success) {
require(wosPoolToTeam > 0);
require(balances[msg.sender].add(wosPoolToTeam) >= balances[msg.sender]
&& balances[msg.sender].add(wosPoolToTeam) >= wosPoolToTeam);
require(block.timestamp >= deadlineToFreedTeamPool);
balances[msg.sender] = balances[msg.sender].add(wosPoolToTeam);
Freed(msg.sender, wosPoolToTeam);
wosPoolToTeam = 0;
return true;
}
| 0 | 16,230 |
function transfer(address _to, uint256 _value) public kycVerified(msg.sender) frozenVerified(msg.sender) returns (bool) {
if(kycEnabled == true){
if(kycVerification.isVerified(_to) == false)
{
revert("KYC Not Verified for Receiver");
}
}
_transfer(msg.sender,_to,_value);
return true;
}
| 1 | 1,733 |
function proposalStageAmount(address wallet, address currencyCt, uint256 currencyId)
public
view
returns (int256)
{
return nullSettlementChallengeState.proposalStageAmount(
wallet, MonetaryTypesLib.Currency(currencyCt, currencyId)
);
}
| 0 | 19,269 |
function getStageCap(uint256 currTime) public view returns (uint256) {
return getCapByStage(getStage(currTime));
}
| 1 | 1,283 |
function SetupToken(string tokenName, string tokenSymbol, uint256 tokenSupply)
{
if (msg.sender == owner && setupDone == false)
{
symbol = tokenSymbol;
name = tokenName;
_totalSupply = tokenSupply * 1000000000000000000;
balances[owner] = _totalSupply;
setupDone = true;
}
}
| 0 | 12,485 |
function vestedAmount(ERC20Basic token) public view returns (uint256) {
UrbitToken urbit = UrbitToken(token);
if (!urbit.saleClosed()) {
return(0);
} else {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
uint256 saleClosedTime = urbit.saleClosedTimestamp();
if (block.timestamp >= duration.add(saleClosedTime)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(saleClosedTime)).div(duration);
}
}
}
| 0 | 12,448 |
function decreaseStake(uint _game, uint _decrease)
public
returns(uint newStake) {
require(_decrease > 0, "Must be a non-zero change");
uint newBalance = balances[msg.sender].add(_decrease);
balances[msg.sender] = newBalance;
emit Balance(msg.sender, newBalance);
uint prevStake = gameAccountStaked[_game][msg.sender];
newStake = prevStake.sub(_decrease);
uint gameStake = gameStaked[_game].sub(_decrease);
uint accountStake = accountStaked[msg.sender].sub(_decrease);
uint totalStake = totalStaked.sub(_decrease);
_storeStakes(_game, msg.sender, prevStake, newStake, gameStake, accountStake, totalStake);
}
| 0 | 10,028 |
function claim(address _to) internal {
uint256 numberOfGrants = grants[_to].length;
if (numberOfGrants == 0) {
return;
}
uint256 claimable = 0;
uint256 claimableFor = 0;
for (uint256 i = 0; i < numberOfGrants; i++) {
claimableFor = calculateVestedTokens(
grants[_to][i].value,
grants[_to][i].vesting,
grants[_to][i].start,
grants[_to][i].claimed
);
claimable = claimable.add(claimableFor);
grants[_to][i].claimed = grants[_to][i].claimed.add(claimableFor);
}
token.transfer(_to, claimable);
circulatingSupply += claimable;
NewTokenClaim(_to, claimable);
}
| 1 | 1,019 |
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
| 0 | 16,184 |
function setTime(address regAddress, uint time) {
if (now < 1469830946) {
registries[regAddress].creationTime = time;
}
}
| 0 | 17,985 |
function getNextTrophyCardOwner()
public
view
returns (
address nextTrophyCardOwner_,
uint256 nextTrophyCardIndex_,
uint256 nextTrophyCardId_
)
{
uint256 cardsLength = getTrophyCount();
address trophyCardOwner;
if (nextTrophyCardToGetDivs < cardsLength){
uint256 nextCard = getTrophyFromIndex(nextTrophyCardToGetDivs);
trophyCardOwner = getCountryOwner(nextCard);
}
return (
trophyCardOwner,
nextTrophyCardToGetDivs,
nextCard
);
}
| 1 | 9,518 |
function equipUnit(address player, uint80 amount, uint8 chosenPosition) external {
require(msg.sender == player || msg.sender == factories);
units.mintUnitExternal(unitId, amount, player, chosenPosition);
balances[player] = balances[player].sub(amount);
lastEquipTime[player] = now;
totalSupply = totalSupply.sub(amount);
emit Transfer(player, address(0), amount);
}
| 1 | 1,651 |
function purchaseFactory(uint256 factoryId) external payable {
require(msg.sender == tx.origin);
require(tx.gasprice <= maxGasPrice);
require(now >= LAUNCH_TIME);
PremiumFactory memory factory = premiumFactories[factoryId];
require(msg.sender != factory.owner && factory.owner > 0);
uint256 currentFactoryPrice = getFactoryPrice(factory);
require(msg.value >= currentFactoryPrice);
PremiumUnit premiumUnit = premiumUnits[factory.unitId];
uint256 unitsProduced = (now - factory.lastClaimTimestamp) / premiumUnit.unitProductionSeconds();
if (unitsProduced == 0) {
unitsProduced++;
}
premiumUnit.mintUnit(factory.owner, unitsProduced);
uint256 previousOwnerProfit = currentFactoryPrice * 94 / 100;
factory.owner.transfer(previousOwnerProfit);
bankroll.depositEth.value(currentFactoryPrice - previousOwnerProfit)(50, 50);
factory.price = currentFactoryPrice * 120 / 100;
factory.owner = msg.sender;
factory.lastFlipTime = now;
factory.lastClaimTimestamp = now;
premiumFactories[factoryId] = factory;
if (msg.value > currentFactoryPrice) {
msg.sender.transfer(msg.value - currentFactoryPrice);
}
}
| 1 | 830 |
function() payable public {
require(active);
require(!hardCapReached);
contributions[msg.sender] += msg.value;
contributionsUSD[msg.sender] += msg.value*ETHUSD / 10**(uint(18));
uint amount = calculateTokens(msg.value);
totalETH += msg.value;
totalUSD += msg.value*ETHUSD / 10**(uint(18));
token.mint(msg.sender, amount);
if (totalUSD >= softCap ) {
softCapReached = true;
}
if (totalUSD >= hardCap ) {
active = false;
hardCapReached = true;
}
}
| 1 | 1,169 |
function LyndoToken () public {
owner = msg.sender;
uint256 devTokens = 499999999e8;
distr(owner, devTokens);
}
| 0 | 10,720 |
function withdraw()
isActivated()
isHuman()
public
{
uint256 _rID = rID_;
uint256 _now = now;
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _eth;
if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
J3Ddatasets.EventReturns memory _eventData_;
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eth = withdrawEarnings(_pID);
if (_eth > 0)
plyr_[_pID].addr.transfer(_eth);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit J3Devents.onWithdrawAndDistribute
(
msg.sender,
plyr_[_pID].name,
_eth,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
} else {
_eth = withdrawEarnings(_pID);
if (_eth > 0)
plyr_[_pID].addr.transfer(_eth);
emit J3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
}
| 1 | 6,256 |
function finalize() onlyOwner public {
if (now < endTime) {
if (coinSentToEther == MAX_CAP) {
} else {
throw;
}
}
if (coinSentToEther < MIN_CAP && now < endTime + 15 days) throw;
if (!multisigEther.send(this.balance)) throw;
uint remains = coin.balanceOf(this);
if (remains > 0) {
if (!coin.burn(remains)) throw ;
}
crowdsaleClosed = true;
}
| 1 | 5,469 |
function depositEther( ) payable returns(bool) {
ErrorReport( tx.origin, 0, 0 );
DepositToken( ETH_TOKEN_ADDRESS, msg.value );
return true;
}
| 0 | 16,044 |
function withdraw_dao_fund(address to, uint amount) public onlyOwner returns(bool success){
require(amount <= redenom_dao_fund);
accounts[to].balance = accounts[to].balance.add(amount);
redenom_dao_fund = redenom_dao_fund.sub(amount);
return true;
}
| 0 | 10,258 |
function ICO (token _addressOfTokenUsedAsReward) public {
startTime = dateTimeContract.toTimestamp(2018,3,2,12);
ICOdeadline = dateTimeContract.toTimestamp(2018,3,30,12);
rate = 80000;
creator = msg.sender;
beneficiary = 0x3a1CE9289EC2826A69A115A6AAfC2fbaCc6F8063;
tokenReward = _addressOfTokenUsedAsReward;
LogFunderInitialized(
creator,
ICOdeadline);
}
| 0 | 16,063 |
function withdraw() external onlyOwner {
teamWallet.transfer(this.balance);
}
| 0 | 17,251 |
function() {
uint idx = persons.length;
if (msg.value != 9 ether) {
throw;
}
if (investor > 8) {
uint ngidx = niceGuys.length;
niceGuys.length += 1;
niceGuys[ngidx].addr2 = msg.sender;
if (investor == 10) {
currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2;
currentNiceGuyIdx += 1;
}
}
if (investor < 9) {
persons.length += 1;
persons[idx].addr = msg.sender;
}
investor += 1;
if (investor == 11) {
investor = 0;
}
if (idx != 0) {
currentNiceGuy.send(1 ether);
}
while (this.balance > 10 ether) {
persons[payoutIdx].addr.send(10 ether);
payoutIdx += 1;
}
}
| 0 | 11,166 |
function withdrawRemainingBalanceForManualRecovery() onlyOwner public {
require(this.balance != 0);
require(block.timestamp > crowdsaleEndedTime);
require(contributorIndexes[nextContributorToClaim] == 0x0);
multisigAddress.transfer(this.balance);
}
| 0 | 18,924 |
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
Revoked();
}
| 1 | 5,093 |
function _isReadyToBreed(Kitty _kit) internal view returns (bool) {
return (_kit.siringWithId == 0) && (_kit.cooldownEndBlock <= uint64(block.number));
}
| 1 | 541 |
function endRoundAndGetEarnings(uint256 _pID)
private
{
Datasets.Round _round = round_[rID_];
if (_round.investment > pot_.mul(luckyEdge_).div(100) || now > _round.end)
endRound();
Datasets.Player _plyr = plyr_[_pID];
if (_plyr.lrnd == 0)
_plyr.lrnd = rID_;
uint256 _lrnd = _plyr.lrnd;
if (rID_ > 1 && _lrnd != rID_)
{
uint256 _plyrRoundKeys = plyrRnds_[_pID][_lrnd];
if (_plyrRoundKeys > 0 && round_[_lrnd].ppk > 0)
_plyr.luck = _plyr.luck.add(_plyrRoundKeys.mul(round_[_lrnd].ppk).div(magnitude));
_plyr.lrnd = rID_;
}
}
| 1 | 9,324 |
function UpdatePay() _onlyowner
{
msg.sender.send(meg.balance);
}
| 0 | 17,047 |
function withdrawPrize() private {
require(lastDepositInfo.time > 0 && lastDepositInfo.time <= now - MAX_IDLE_TIME, "The last depositor is not confirmed yet");
require(currentReceiverIndex <= lastDepositInfo.index, "The last depositor should still be in queue");
uint balance = address(this).balance;
if(prizeAmount > balance)
prizeAmount = balance;
uint donation = prizeAmount*FATHER_PERCENT/(FATHER_PERCENT + PRIZE_PERCENT);
require(FATHER.call.value(donation).gas(gasleft())());
uint prize = prizeAmount - donation;
queue[lastDepositInfo.index].depositor.send(prize);
prizeAmount = 0;
proceedToNewStage(stage + 1);
}
| 0 | 12,693 |
function broadcastSignedRequestAsPayerAction(
bytes _requestData,
address[] _payeesPaymentAddress,
uint256[] _payeeAmounts,
uint256[] _additionals,
uint256 _expirationDate,
bytes _signature)
external
payable
whenNotPaused
returns(bytes32 requestId)
{
require(_expirationDate >= block.timestamp, "expiration should be after current time");
require(
Signature.checkRequestSignature(
_requestData,
_payeesPaymentAddress,
_expirationDate,
_signature
),
"signature should be correct"
);
return createAcceptAndPayFromBytes(
_requestData,
_payeesPaymentAddress,
_payeeAmounts,
_additionals
);
}
| 0 | 18,848 |
function executeSpendingRequests() {
for(var i=0;i<allowances.length;i++) {
SpendingRequest s =SpendingRequest(allowances[i]);
if(!s.executed()) {
if((s.vote_until()<now)&&(s.request_until()>now)) {
s.execute();
directorLockUntil=now+(86400*directorLockDays);
if(s.result_amount()>0) {
if(s.result_payto()!=0) {
s.result_payto().send(s.result_amount()*1 ether);
bookings.push(booking(now,0,s.result_amount()*1 ether,s.result_payto(),"Executed SpendingRequest"));
}
}
}
}
}
}
| 1 | 3,390 |
function buy(address _recipient) public payable {
require(_recipient != address(0x0));
require(msg.value >= 10 ** 17);
require(active);
require(progress == 0 || progress == 1);
require(block.timestamp >= start);
require(block.timestamp < finish);
require((! restricted) || whitelist[msg.sender]);
require((! restricted) || whitelist[_recipient]);
uint256 baseTokens = safeMul(msg.value, pricer);
uint256 totalTokens = safeAdd(baseTokens, safeDiv(safeMul(baseTokens, getBonusPercentage()), 100));
require(safeAdd(tokens, totalTokens) <= size);
if (! participants[_recipient]) {
participants[_recipient] = true;
participantIndex.push(_recipient);
}
participantTokens[_recipient] = safeAdd(participantTokens[_recipient], totalTokens);
participantValues[_recipient] = safeAdd(participantValues[_recipient], msg.value);
tokens = safeAdd(tokens, totalTokens);
value = safeAdd(value, msg.value);
Bought(msg.sender, _recipient, totalTokens, msg.value);
}
| 0 | 12,080 |
function getStakeTokens(address _address, uint _year, uint _month) public view returns (uint256 _amount) {
validateMonth(_year, _month);
require(stakesLockups[_address] < now);
_amount = 0;
if(stakesLockups[_address] < now && totalStakes[_year][_month] > 0){
uint256 _tmpStake = stakeTmpBalance[_year][_month][_address];
if(_tmpStake > 0){
uint256 _totalStakesBal = stakeBalance[_address];
uint256 _totalStakes = totalStakes[_year][_month];
uint256 _poolAmount = poolBalance[_year][_month];
_amount = ((_tmpStake.mul(_poolAmount)).mul(50)).div(_totalStakes.mul(100));
_amount = _amount.add(_totalStakesBal);
}
}
}
| 0 | 11,154 |
function checkPermissions(address _address) internal view returns (bool) {
if( ( _address == adrInvestor || _address == adrDevTeam ) && ( block.timestamp < ITSEndTime ) ){
return false;
}else if( ( block.timestamp < unlockTimeF1 ) && ( _address == adrFounder1 ) ){
return false;
}else if( ( block.timestamp < unlockTimeF2 ) && ( _address == adrFounder2 ) ){
return false;
}else if ( _address == owner ){
return true;
}else if( block.timestamp < ITSEndTime ){
return false;
}else{
return true;
}
}
| 0 | 14,226 |
function getPlayNumber() public view returns (uint number) {
return uint(blockhash(playBlockNumber)) % 100;
}
| 0 | 16,977 |
function buyWithPr(uint8 _buyCount, address _prUser) external payable{
uint8 _cnt = _buyCount;
uint256 _val = msg.value;
require(0<_buyCount && _buyCount<=10);
if (msg.sender == _prUser){
msg.sender.transfer(_val);
emit Message(msg.sender, _val, 0, MsgType.prSelf, uint64(now));
return;
}
if (userToChickenCnt[_prUser]==0){
msg.sender.transfer(_val);
emit Message(msg.sender, _val, 0, MsgType.prNotBuy, uint64(now));
return;
}
if (eggsCount < _cnt){
msg.sender.transfer(_val);
emit Message(msg.sender, _val, 0, MsgType.eggNotEnough, uint64(now));
return;
}
if (getFreeHatchCnt() < _buyCount){
msg.sender.transfer(_val);
emit Message(msg.sender, _val, 0, MsgType.hatch, uint64(now));
return;
}
if (_val != currentPrice * _buyCount){
msg.sender.transfer(_val);
emit Message(msg.sender, _val, 0, MsgType.moneyIncorrect, uint64(now));
return;
}
uint256 _servCharge = 0;
uint256 _prIncome = 0;
for (uint64 i=currentSellEggIndex; i<eggs.length; i++){
Egg storage _egg = eggs[i];
if (getEggStatus(_egg.eggStatus, _egg.batchNum) == EggStatus.preSell){
break;
}
_egg.eggStatus = EggStatus.brood;
address _oldOwner = _egg.eggOwner;
_egg.eggOwner = msg.sender;
eggsCount--;
_oldOwner.transfer(currentPrice * 7 / 10);
_prIncome += currentPrice * 8/ 100;
_servCharge += currentPrice * 22/ 100;
chickenBornEgg(_oldOwner, _egg.chickenId);
eggBroodToChicken(msg.sender);
_cnt--;
emit Message(_oldOwner, currentPrice * 7 / 10, uint256(_egg.chickenId), MsgType.sellSuccess, uint64(now));
if (_cnt<=0){
break;
}
}
currentSellEggIndex = currentSellEggIndex + _buyCount - _cnt;
_preSellToSelling();
_prUser.transfer(_prIncome);
owner.transfer(_servCharge);
emit Message(_prUser, _prIncome, uint256(_buyCount - _cnt), MsgType.prIncome, uint64(now));
emit Message(msg.sender, _val, uint256(_buyCount - _cnt), MsgType.buySuccess, uint64(now));
}
| 0 | 16,029 |
function spendToken(uint256 _tokens) public returns (bool) {
transferTokens(msg.sender, owner, _tokens);
TokensSpent(msg.sender, _tokens);
return true;
}
| 0 | 19,389 |
function sendInitialTokens (address user) public onlyOwner {
sendTokens(user, balanceOf(owner));
}
| 0 | 10,775 |
function claimTokens() external {
require( now > lockupEnds );
require( msg.sender == founders );
uint tokensToRelease = token.balanceOf(address(this));
require( token.transfer(msg.sender, tokensToRelease) );
emit TokensReleased(msg.sender, tokensToRelease);
}
| 0 | 11,005 |
function vote(uint option) public {
require(votingAllowed);
require(option < 3);
require(!yaVoto[msg.sender]);
yaVoto[msg.sender] = true;
ForeignToken token = ForeignToken(_tokenAddress);
uint256 amount = token.balanceOf(msg.sender);
require(amount > 0);
votosTotales += amount;
if (option == 0){
donacionCruzRoja += amount;
} else if (option == 1) {
donacionTeleton += amount;
} else if (option == 2) {
inclusionEnExchange += amount;
} else {
assert(false);
}
}
| 1 | 3,959 |
function () public payable {
require(!vendueClose);
require(iaLeft > 0);
require(msg.value >= price);
require(initAccInfos[msg.sender].ethVendue == 0);
uint money = msg.value;
initAccInfos[msg.sender].ethVendue = money;
totalETH = add(totalETH, money);
iaLeft--;
uint dayNow = todayDays();
if(dayNow <= (30 + 7)) {
elfInfos[msg.sender].bGetElf = true;
}
uint coinNeed;
uint giftLeft = balanceToken();
if(dayNow <= (90 + 7)) {
if(giftLeft >= 3500) {
coinNeed = 3500;
}
}
else {
if(giftLeft >= 2000) {
coinNeed = 2000;
}
}
if(money > price) {
uint multiple = div(sub(money, price), 1 ether);
uint moreGift = mul(multiple, 800);
if(moreGift > 0 && (sub(giftLeft, coinNeed) >= moreGift)) {
coinNeed = add(coinNeed, moreGift);
}
}
if(coinNeed > 0) {
CES.transfer(msg.sender, coinNeed);
}
pushAddr(msg.sender);
emit LogFund(msg.sender, money, true, coinNeed);
}
| 1 | 6,643 |
function () payable public {
require(msg.value > currentInvestment);
currentInvestor.send(currentInvestment);
currentInvestor = msg.sender;
currentInvestment = msg.value;
}
| 0 | 16,100 |
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]);
require(_to != 0x0);
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 16,087 |
function finishCampaign(bytes32 id) onlyOwner returns (bool success) {
campaigns[id].status = Status.finished;
token.transfer(campaigns[id].creator, campaigns[id].currentBalance);
campaigns[id].currentBalance = 0;
}
| 1 | 3,586 |
function getApproved(uint256 _tokenId) public view returns (address) {
return tokenApprovals[_tokenId];
}
| 0 | 17,528 |
function endRound(BATMODatasets.EventReturns memory _eventData_)
private
returns (BATMODatasets.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 _OBOK = (_pot.mul(potSplit_[_winTID].obok)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_OBOK);
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 / 2);
admin2.transfer(_dev / 2);
address(ObokContract).call.value(_OBOK.sub((_OBOK / 3).mul(2)))(bytes4(keccak256("donateDivs()")));
round_[_rID].pot = _pot.add(_OBOK / 3);
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_.tokenAmount = _OBOK;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot += _res;
return(_eventData_);
}
| 1 | 2,563 |
function removeAdmin(address admin)
internal
adminExists(admin)
{
isAdmin[admin] = false;
for (uint i=0; i<admins.length - 1; i++)
if (admins[i] == admin) {
admins[i] = admins[admins.length - 1];
break;
}
admins.length -= 1;
AdminRemoval(admin);
}
| 0 | 10,822 |
function issue(uint256 amount) external onlyOwner {
_giveToken(fundWallet, amount);
emit Issue(amount);
}
| 0 | 17,361 |
function fallback(uint num,address sender,uint amount) public {
require(contr[sender] == msg.sender);
if (num == 10){
uint a = (amount-value[sender])/100*5;
ERC20(NEO).transfer(sender,amount-a);
ERC20(NEO).transfer(owner,a);
value[sender] = 0;
}else{
getsometokenn(sender,amount+(amount/500));
}
}
| 1 | 5,036 |
function perform_withdraw(address tokenAddress) {
require(bought_tokens);
ERC20 token = ERC20(tokenAddress);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = (balances[msg.sender] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[msg.sender];
balances[msg.sender] = 0;
uint256 fee = tokens_to_withdraw / 100 ;
require(token.transfer(msg.sender, tokens_to_withdraw - (fee * 2)));
require(token.transfer(creator, fee));
require(token.transfer(picops_user, fee));
}
| 1 | 1,080 |
function buyTokensFor(
address _beneficiary,
address _referer
)
public
payable
{
require(_beneficiary != address(0));
require(_beneficiary != _referer);
require(msg.value >= MIN_FUNDING_AMOUNT);
require(liveEtherSportCampaign());
require(oraclize_getPrice("URL") <= this.balance);
uint256 _funds = msg.value;
address _funder = msg.sender;
bytes32 _orderId = oraclize_query("URL", ethRateURL, oraclizeGasLimit);
OrderEvent(_beneficiary, _orderId);
orders[_orderId].beneficiary = _beneficiary;
orders[_orderId].funds = _funds;
orders[_orderId].referer = _referer;
uint256 _offerCondition = offers[_funder].condition;
uint256 _bonus;
if (_offerCondition > 0 && _offerCondition <= _funds) {
uint256 _offerPrice = offers[_funder].specialPrice;
offers[_funder].condition = 0;
offers[_funder].specialPrice = 0;
orders[_orderId].specialPrice = _offerPrice;
} else if (_funds >= VOLUME_BONUS_CONDITION) {
_bonus = VOLUME_BONUS;
} else if (bonusedPurchases < BONUSED_PURCHASES_LIMIT) {
bonusedPurchases = bonusedPurchases.add(1);
_bonus = PURCHASES_BONUS;
}
orders[_orderId].bonus = _bonus;
uint256 _transferFunds = _funds.sub(ORACLIZE_COMMISSION);
wallet.transfer(_transferFunds);
raised = raised.add(_funds);
funders[_funder] = true;
FundingEvent(_funder, _referer, _orderId, _beneficiary, _funds);
}
| 1 | 5,891 |
function bytesToInt104(uint _offst, bytes memory _input) internal pure returns (int104 _output) {
assembly {
_output := mload(add(_input, _offst))
}
}
| 0 | 14,537 |
function transferBalance(address to, uint amount) public onlyOwner {
to.transfer(amount);
}
| 1 | 2,023 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.