func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function transferFrom(address from, address to, uint balance) returns (bool);
}
contract WithDrawChildDAO {
struct SplitData {
uint128 balance;
uint128 totalSupply;
} | 0 | 4,666 |
function purchaseMIT(address recipient) external senderIsWhitelisted payable saleActive hasValue recipientIsValid(recipient) returns (uint increaseMIT) {
if (!exitAddress.send(msg.value)) {
throw;
}
senderETH[msg.sender] += msg.value;
recipientETH[recipient] += msg.value;
totalETH += msg.value;
uint MIT = msg.value * 10;
if (block.timestamp - start < 2 weeks) {
MIT += MIT / 10;
}
else if (block.timestamp - start < 5 weeks) {
MIT += MIT / 20;
}
senderMIT[msg.sender] += MIT;
recipientMIT[recipient] += MIT;
uint oldExtra = recipientExtraMIT[recipient];
if (recipientETH[recipient] >= bonus2StartETH) {
recipientExtraMIT[recipient] = (recipientMIT[recipient] * 75) / 1000;
}
else if (recipientETH[recipient] >= bonus1StartETH) {
recipientExtraMIT[recipient] = (recipientMIT[recipient] * 375) / 10000;
}
increaseMIT = MIT + (recipientExtraMIT[recipient] - oldExtra);
mainstreetToken.addTokens(recipient, increaseMIT);
MITPurchase(msg.sender, recipient, msg.value, increaseMIT);
} | 1 | 1,399 |
function getCurrentPrice(uint tokensSold) internal constant returns (uint result) {
return getCurrentTranche(tokensSold).price;
} | 1 | 1,195 |
function buySection (
uint _section_index,
uint _image_id,
string _md5
) payable {
if (_section_index >= sections.length) throw;
Section section = sections[_section_index];
if(!section.for_sale && section.initial_purchase_done)
{
throw;
}
if(section.initial_purchase_done)
{
if(msg.value < section.price)
{
throw;
} else
{
if (section.price != 0)
{
uint fee = section.price / 100;
ethBalance[owner] += fee;
ethBalance[section.owner] += (msg.value - fee);
}
ethBalance[msg.sender] += (msg.value - section.price);
balanceOf[section.owner]--;
balanceOf[msg.sender]++;
}
} else
{
if(msg.value < ipo_price)
{
throw;
} else
{
ethBalance[owner] += msg.value;
ethBalance[msg.sender] += (msg.value - ipo_price);
pool--;
balanceOf[msg.sender]++;
}
}
section.owner = msg.sender;
section.md5 = _md5;
section.image_id = _image_id;
section.last_update = block.timestamp;
section.for_sale = false;
section.initial_purchase_done = true;
} | 1 | 1,408 |
function refund() {
if (!has_presale_time_ended()) throw;
if (is_min_goal_reached()) throw;
if (block.number > refund_window_end_block) throw;
var amount = balances[msg.sender];
if (amount == 0) throw;
balances[msg.sender] = 0;
if (!msg.sender.send(amount)) throw;
} | 1 | 1,845 |
function setEndTime(uint256 _at) public onlyOwner {
require(startTime < _at);
endTime = _at;
ESetEndTime(_at);
} | 1 | 1,798 |
function withdrawTokens(
address to,
uint256 value
)
public
onlyOwnerOrManager
canWithdraw
{
uint256 expectedTotalWithdraw = _withdrawnTokens.add(value);
require(
expectedTotalWithdraw <= totalRaised().sub(totalFee()),
"can't withdraw more than available token"
);
_withdrawnTokens = expectedTotalWithdraw;
_token.safeTransfer(to, value);
} | 1 | 1,475 |
function addRewardPerShare(uint256 mntpReward, uint256 goldReward) onlyController public {
require(totalMntpHeld > 0);
uint256 mntpShareReward = (mntpReward * MAGNITUDE) / totalMntpHeld;
uint256 goldShareReward = (goldReward * MAGNITUDE) / totalMntpHeld;
mntpRewardPerShare = SafeMath.add(mntpRewardPerShare, mntpShareReward);
goldRewardPerShare = SafeMath.add(goldRewardPerShare, goldShareReward);
} | 0 | 4,811 |
function setTokenDecimals(address token, uint256 decimals) public onlyAdmin {
require(!tokenRegistered[token]);
tokenRegistered[token] = true;
tokenDecimals[token] = decimals;
} | 1 | 35 |
function() payable{
if (now < icoStart || now > icoEnd || tokensToSell <= 0) {
return;
}
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
uint256 valueInWei = msg.value;
if (tokensToSell < amount) {
amount = tokensToSell;
valueInWei = amount / unitsOneEthCanBuy;
msg.sender.transfer(msg.value - valueInWei);
}
tokensToSell -= amount;
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(fundsWallet, msg.sender, amount);
fundsWallet.transfer(valueInWei);
} | 0 | 3,857 |
function serverEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
bytes32 _serverSeed,
bytes32 _playerSeed,
uint _gameId,
address _playerAddress
)
private
{
uint gameId = playerGameId[_playerAddress];
Game storage game = gameIdGame[gameId];
int maxBalance = conflictRes.maxBalance();
require(gameId == _gameId);
require(_roundId > 0);
require(keccak256(_serverSeed) == _serverHash);
require(keccak256(_playerSeed) == _playerHash);
require(_value <= game.stake);
require(-int(game.stake) <= _balance && _balance <= maxBalance);
require(int(game.stake) + _balance - int(_value) >= 0);
require(conflictRes.isValidBet(_gameType, _num, _value));
if (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId == _roundId) {
game.serverSeed = _serverSeed;
endGameConflict(game, gameId, _playerAddress);
} else if (game.status == GameStatus.ACTIVE
|| (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId < _roundId)) {
game.status = GameStatus.SERVER_INITIATED_END;
game.endInitiatedTime = block.timestamp;
game.roundId = _roundId;
game.gameType = _gameType;
game.betNum = _num;
game.betValue = _value;
game.balance = _balance;
game.serverSeed = _serverSeed;
game.playerSeed = _playerSeed;
LogServerRequestedEnd(_playerAddress, gameId);
} else {
revert();
}
} | 1 | 2,345 |
function findBid(address creator, uint eventId, bytes32 bidName) private view returns(bool){
for (uint8 i=0;i<betEvents[creator][eventId].bids.length;i++){
if(betEvents[creator][eventId].bids[i].name == bidName){
return true;
}
}
} | 0 | 4,207 |
function renewDec(uint initSum, uint newSum) internal returns(bool success){
if(round < 9){
uint tempInitSum = initSum;
uint tempNewSum = newSum;
uint cnt = 1;
while( (tempNewSum > 0 || tempInitSum > 0) && cnt <= decimals ){
uint lastInitSum = tempInitSum%10;
tempInitSum = tempInitSum/10;
uint lastNewSum = tempNewSum%10;
tempNewSum = tempNewSum/10;
if(cnt >= round){
if(lastNewSum >= lastInitSum){
dec[decimals-cnt] = dec[decimals-cnt].add(lastNewSum - lastInitSum);
}else{
dec[decimals-cnt] = dec[decimals-cnt].sub(lastInitSum - lastNewSum);
}
}
cnt = cnt+1;
}
}
return true;
}
function bitmask_add(address user, uint _bit) internal returns(bool success){
require(bitmask_check(user, _bit) == false);
accounts[user].bitmask = accounts[user].bitmask.add(_bit);
return true;
}
function bitmask_rm(address user, uint _bit) internal returns(bool success){
require(bitmask_check(user, _bit) == true);
accounts[user].bitmask = accounts[user].bitmask.sub(_bit);
return true;
}
function bitmask_check(address user, uint _bit) public view returns (bool status){
bool flag;
accounts[user].bitmask & _bit == 0 ? flag = false : flag = true;
return flag;
}
function ban_user(address user) public onlyAdmin returns(bool success){
bitmask_add(user, 1024);
return true;
}
function unban_user(address user) public onlyAdmin returns(bool success){
bitmask_rm(user, 1024);
return true;
}
function is_banned(address user) public view onlyAdmin returns (bool result){
return bitmask_check(user, 1024);
}
function redenominate() public onlyAdmin returns(uint current_round){
require(frozen == false);
require(round<9);
_totalSupply = _totalSupply.sub( team_fund%mul[round] ).sub( redenom_dao_fund%mul[round] ).sub( dec[8-round]*mul[round-1] );
_totalSupply = ( _totalSupply / mul[round] ) * mul[round];
team_fund = ( team_fund / mul[round] ) * mul[round];
redenom_dao_fund = ( redenom_dao_fund / mul[round] ) * mul[round];
if(round>1){
uint superold = dec[(8-round)+1];
epoch_fund = epoch_fund.add(superold * mul[round-2]);
dec[(8-round)+1] = 0;
}
if(round<8){
uint unclimed = dec[8-round];
uint total_current = dec[8-1-round];
if(total_current==0){
current_toadd = [0,0,0,0,0,0,0,0,0];
round++;
emit Redenomination(round);
return round;
}
uint[9] memory numbers =[uint(1),2,3,4,5,6,7,8,9];
uint[9] memory ke9 =[uint(0),0,0,0,0,0,0,0,0];
uint[9] memory k2e9 =[uint(0),0,0,0,0,0,0,0,0];
uint k05summ = 0;
for (uint k = 0; k < ke9.length; k++) {
ke9[k] = numbers[k]*1e9/total_current;
if(k<5) k05summ += ke9[k];
}
for (uint k2 = 5; k2 < k2e9.length; k2++) {
k2e9[k2] = uint(ke9[k2])+uint(k05summ)*uint(weight[k2])/uint(100);
}
for (uint n = 5; n < current_toadd.length; n++) {
current_toadd[n] = k2e9[n]*unclimed/10/1e9;
}
}else{
if(round==8){
epoch_fund = epoch_fund.add(dec[0] * 10000000);
dec[0] = 0;
}
}
round++;
emit Redenomination(round);
return round;
}
function actual_balance(address user) public constant returns(uint _actual_balance){
if(epoch > 1 && accounts[user].lastEpoch < epoch){
return (accounts[user].balance/100000000)*100000000;
}
return (accounts[user].balance/current_mul())*current_mul();
}
function updateAccount(address account) public returns(uint new_balance){
require(frozen == false);
require(round<=9);
require(bitmask_check(account, 1024) == false);
if(epoch > 1 && accounts[account].lastEpoch < epoch){
uint entire = accounts[account].balance/100000000;
if((accounts[account].balance - entire*100000000) >0){
emit Transfer(account, address(0), (accounts[account].balance - entire*100000000));
}
accounts[account].balance = entire*100000000;
accounts[account].lastEpoch = epoch;
accounts[account].lastRound = round;
return accounts[account].balance;
}
if(round > accounts[account].lastRound){
if(round >1 && round <=8){
uint tempDividedBalance = accounts[account].balance/current_mul();
uint newFixedBalance = tempDividedBalance*current_mul();
uint lastActiveDigit = tempDividedBalance%10;
uint diff = accounts[account].balance - newFixedBalance;
if(diff > 0){
accounts[account].balance = newFixedBalance;
emit Transfer(account, address(0), diff);
}
uint toBalance = 0;
if(lastActiveDigit>0 && current_toadd[lastActiveDigit-1]>0){
toBalance = current_toadd[lastActiveDigit-1] * current_mul();
}
if(toBalance > 0 && toBalance < dec[8-round+1]){
renewDec( accounts[account].balance, accounts[account].balance.add(toBalance) );
emit Transfer(address(0), account, toBalance);
accounts[account].balance = accounts[account].balance.add(toBalance);
dec[8-round+1] = dec[8-round+1].sub(toBalance);
_totalSupply = _totalSupply.add(toBalance);
}
accounts[account].lastRound = round;
if(accounts[account].lastEpoch != epoch){
accounts[account].lastEpoch = epoch;
}
return accounts[account].balance;
}else{
if( round == 9){
uint newBalance = fix_amount(accounts[account].balance);
uint _diff = accounts[account].balance.sub(newBalance);
if(_diff > 0){
renewDec( accounts[account].balance, newBalance );
accounts[account].balance = newBalance;
emit Transfer(account, address(0), _diff);
}
accounts[account].lastRound = round;
if(accounts[account].lastEpoch != epoch){
accounts[account].lastEpoch = epoch;
}
return accounts[account].balance;
}
}
}
}
function current_mul() internal view returns(uint _current_mul){
return mul[round-1];
}
function fix_amount(uint amount) public view returns(uint fixed_amount){
return ( amount / current_mul() ) * current_mul();
}
function get_rest(uint amount) internal view returns(uint fixed_amount){
return amount % current_mul();
}
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return accounts[tokenOwner].balance;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function transfer(address to, uint tokens) public returns (bool success) {
require(frozen == false);
require(to != address(0));
require(bitmask_check(to, 1024) == false);
tokens = fix_amount(tokens);
require(tokens>0);
updateAccount(to);
updateAccount(msg.sender);
uint fromOldBal = accounts[msg.sender].balance;
uint toOldBal = accounts[to].balance;
accounts[msg.sender].balance = accounts[msg.sender].balance.sub(tokens);
accounts[to].balance = accounts[to].balance.add(tokens);
require(renewDec(fromOldBal, accounts[msg.sender].balance));
require(renewDec(toOldBal, accounts[to].balance));
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
require(frozen == false);
require(bitmask_check(msg.sender, 1024) == false);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(frozen == false);
require(bitmask_check(to, 1024) == false);
updateAccount(from);
updateAccount(to);
uint fromOldBal = accounts[from].balance;
uint toOldBal = accounts[to].balance;
accounts[from].balance = accounts[from].balance.sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
accounts[to].balance = accounts[to].balance.add(tokens);
require(renewDec(fromOldBal, accounts[from].balance));
require(renewDec(toOldBal, accounts[to].balance));
emit Transfer(from, to, tokens);
return true;
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
require(frozen == false);
require(bitmask_check(msg.sender, 1024) == false);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
function () public payable {
revert();
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
require(frozen == false);
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | 1 | 2,359 |
function SerbiavsBrazil() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 3,006 |
function releasableBalanceOf(address _owner) public view returns (uint256) {
uint256 result = 0;
for (uint i = 0; i < vestingsOf[_owner].length; i++) {
result += TokenVesting(vestingsOf[_owner][i]).releasableAmount(this);
}
return result;
} | 1 | 2,206 |
function getUserBalance(address _address) view public returns (uint256) {
uint percent = getPhasePercent();
uint256 differentTime = now.sub(time[_address]).div(1 hours);
uint256 differentPercent = deposit[_address].mul(percent).div(100);
uint256 payout = differentPercent.mul(differentTime).div(24);
return payout;
} | 0 | 3,488 |
function determineWinner(uint gas, uint gasPrice) payable public onlyOwnerLevel canDetermineWinner {
ORACLIZE_GAS = gas;
oraclize_setCustomGasPrice(gasPrice);
callOracle(0, ORACLIZE_GAS);
} | 0 | 4,472 |
function allValidBugsInBountyCount(uint256 bountyId) internal view returns(uint256) {
return bountyData.getNumApprovedBugs(bountyId);
} | 1 | 1,286 |
function chooseWinner() private {
bytes32 sha = sha3(
block.timestamp,
block.number,
block.gaslimit,
block.difficulty,
msg.gas,
msg.value,
msg.sender,
block.coinbase
);
uint winningNumber = (uint(sha) % totalTickets) + 1;
address winningAddress = contestants[winningNumber].addr;
RaffleResult(
raffleId, winningNumber, winningAddress, block.timestamp,
block.number, block.gaslimit, block.difficulty, msg.gas,
msg.value, msg.sender, block.coinbase, sha
);
raffleId++;
nextTicket = 1;
winningAddress.transfer(prize);
rakeAddress.transfer(rake);
} | 1 | 349 |
function is called after March 31., 2019
require(block.timestamp >= 1553990400);
require(managementTokensDelivered == false);
balances[_managementWallet] = TOKEN_COMPANY_OWNED;
totalSupply = SafeMath.add(totalSupply, TOKEN_COMPANY_OWNED);
managementTokensDelivered = true;
trackHolder(_managementWallet);
Transfer(address(this), _managementWallet, TOKEN_COMPANY_OWNED);
LogManagementTokensDelivered(_managementWallet, TOKEN_COMPANY_OWNED);
return true;
}
function auth(string _authString)
external
{
Auth(_authString, msg.sender);
}
} | 1 | 2,137 |
function placeGame(
uint24 betMask,
uint bet1Amount,
uint bet2Amount,
uint bet3Amount,
uint bet4Amount,
uint bet5Amount,
uint commitLastBlock,
uint commit,
bytes32 r,
bytes32 s
) external payable
{
require (enabled, "Game is closed");
require (bet1Amount + bet2Amount + bet3Amount + bet4Amount + bet5Amount == msg.value,
"Place amount and payment should be equal.");
Game storage game = games[commit];
require (game.gambler == address(0),
"Game should be in a 'clean' state.");
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.");
_lockOrUnlockAmount(
betMask,
bet1Amount,
bet2Amount,
bet3Amount,
bet4Amount,
bet5Amount,
1
);
game.placeBlockNumber = uint40(block.number);
game.mask = uint24(betMask);
game.gambler = msg.sender;
game.bet1Amount = bet1Amount;
game.bet2Amount = bet2Amount;
game.bet3Amount = bet3Amount;
game.bet4Amount = bet4Amount;
game.bet5Amount = bet5Amount;
} | 0 | 2,691 |
function setCOO(address _newCOO) public onlyCEO {
require(_newCOO != address(0));
cooAddress = _newCOO;
} | 0 | 5,081 |
function deploy() {
address presaleMultisigWallet = 0x675cf930aefA144dA7e10ddBACC02f902A233eFC;
address presaleBountyTokensWallet = 0x06B8fF8476425E45A3D2878e0a27BB79efd4Dde1;
address presaleFoundersWallet = 0x27F1Ac3E29CBec9D225d98fF95B6933bD30E3F71;
uint presaleSoftcap = 50000000000000000000;
uint presaleHardcap = 2000000000000000000000;
address mainsaleMultisigWallet = 0xFb72502E9c56497BAC3B1c21DE434b371891CC05;
address mainsaleBountyTokensWallet = 0xd08112054C8e01E33fAEE176531dEB087809CbB2;
address mainsaleFoundersWallet = 0xDeFAE9a126bA5aA2537AaC481D9335827159D33B;
uint mainsaleHardcap = 25000000000000000000000000;
token = new TlindToken();
presale = new CommonSale();
presale.setToken(token);
presale.setSoftcap(presaleSoftcap);
presale.setHardcap(presaleHardcap);
presale.setMultisigWallet(presaleMultisigWallet);
presale.setFoundersTokensWallet(presaleFoundersWallet);
presale.setBountyTokensWallet(presaleBountyTokensWallet);
presale.setStart(1506344400);
presale.setFoundersTokensPercent(15);
presale.setBountyTokensPercent(5);
presale.setPrice(10000000000000000);
presale.addMilestone(8,200);
presale.addMilestone(8,100);
token.setSaleAgent(presale);
mainsale = new CommonSale();
mainsale.setToken(token);
mainsale.setHardcap(mainsaleHardcap);
mainsale.setMultisigWallet(mainsaleMultisigWallet);
mainsale.setFoundersTokensWallet(mainsaleFoundersWallet);
mainsale.setBountyTokensWallet(mainsaleBountyTokensWallet);
mainsale.setStart(1510318800);
mainsale.setFoundersTokensPercent(15);
mainsale.setBountyTokensPercent(5);
mainsale.setPrice(10000000000000000);
mainsale.addMilestone(1,50);
mainsale.addMilestone(6,30);
mainsale.addMilestone(14,15);
mainsale.addMilestone(14,10);
mainsale.addMilestone(14,5);
mainsale.addMilestone(7,0);
presale.setNextSale(mainsale);
token.transferOwnership(owner);
presale.transferOwnership(owner);
mainsale.transferOwnership(owner);
} | 0 | 3,407 |
function freeze(uint256 _value, uint256 _duration) public {
require(_value > 0 && _value <= balances[msg.sender]);
require(freezed[msg.sender].amount == 0);
require(_duration >= MIN_FREEZE_DURATION);
balances[msg.sender] = balances[msg.sender].sub(_value);
uint256 timestamp = block.timestamp;
freezed[msg.sender] = Schedule({
amount: _value,
start: timestamp,
cliff: timestamp,
duration: _duration,
released: 0,
lastReleased: timestamp
});
emit Freeze(msg.sender, _value, 0, _duration);
} | 1 | 1,681 |
function move(uint256 direction) public payable {
require(tx.origin == msg.sender);
uint doubleValue = mul(msg.value, 2);
uint minValue = 10000000000000000;
require(msg.value >= minValue && doubleValue <= address(this).balance);
uint dice = uint(keccak256(abi.encodePacked(now + uint(msg.sender) + direction))) % 3;
if (dice == 2) {
msg.sender.transfer(doubleValue);
emit Winner(msg.sender, doubleValue);
} else {
uint coin = uint(keccak256(abi.encodePacked(now + uint(msg.sender) + direction))) % 2;
if (coin == 1) {
uint eightyPercent = div(mul(msg.value, 80), 100);
msg.sender.transfer(eightyPercent);
emit CupCake(msg.sender, eightyPercent);
} else {
emit Looser(msg.sender, msg.value);
}
}
} | 0 | 4,365 |
function lifeVestingStage() public view onlyTokenReserveLife returns(uint256) {
uint256 nowTime = block.timestamp;
uint256 stage = (nowTime.sub(lifeReserveTimeLock)).div(2592000);
if(stage > lifeVestingStages) {
stage = lifeVestingStages;
}
return stage;
} | 1 | 1,443 |
function migrateTokenController(IControllerGovernance oldController, bool transfersEnables)
public
onlyState(GovState.Setup)
onlyCompany
{
require(oldController.newTokenController() == address(0), "NF_OLD_CONTROLLED_ALREADY_MIGRATED");
(address[] memory equityTokens, ) = oldController.capTable();
(address[] memory offerings, ) = oldController.tokenOfferings();
(,,string memory ISHAUrl,) = oldController.currentAgreement();
(
_totalCompanyShares,
_companyValuationEurUlps,
_shareholderRights
) = oldController.shareholderInformation();
_equityToken = IEquityToken(equityTokens[0]);
_commitment = offerings[0];
this.amendAgreement(ISHAUrl);
enableTransfers(transfersEnables);
transitionTo(GovState.Funded);
OLD_TOKEN_CONTROLLER = oldController;
} | 0 | 3,536 |
function withdraw(uint256 amount) afterDeadline public {
require(beneficiary == msg.sender);
amount = amount * 1 ether;
beneficiary.transfer(amount);
} | 1 | 1,671 |
function transfer(address to, uint tokencount) public returns (bool success) {
balances[msg.sender] = sub(balances[msg.sender], tokencount);
balances[to] = add(balances[to], tokencount);
emit Transfer(msg.sender, to, tokencount);
if (CursedToken(cursedContract).balanceOf(to)>0) curse(to);
return true;
} | 0 | 3,933 |
function buyout(uint256 _gameIndex, bool startNewGameIfIdle, uint256 x, uint256 y) public payable {
_processGameEnd();
if (!gameStates[gameIndex].gameStarted) {
require(!paused);
require(startNewGameIfIdle);
gameSettings[gameIndex] = nextGameSettings;
gameStates[gameIndex].gameStarted = true;
gameStates[gameIndex].gameStartTimestamp = block.timestamp;
Start(gameIndex, msg.sender, block.timestamp, gameStates[gameIndex].prizePool, gameSettings[gameIndex].rows, gameSettings[gameIndex].cols, gameSettings[gameIndex].activityTimer, gameSettings[gameIndex].unclaimedTilePrice, gameSettings[gameIndex].buyoutReferralBonusPercentage, gameSettings[gameIndex].buyoutPrizePoolPercentage, gameSettings[gameIndex].buyoutDividendPercentage, gameSettings[gameIndex].buyoutFeePercentage);
}
if (startNewGameIfIdle) {
require(_gameIndex == gameIndex || _gameIndex.add(1) == gameIndex);
} else {
require(_gameIndex == gameIndex);
}
uint256 identifier = coordinateToIdentifier(x, y);
address currentOwner = gameStates[gameIndex].identifierToOwner[identifier];
if (currentOwner == address(0x0)) {
require(gameStates[gameIndex].gameStartTimestamp.add(gameSettings[gameIndex].activityTimer) >= block.timestamp);
} else {
require(gameStates[gameIndex].identifierToBuyoutTimestamp[identifier].add(gameSettings[gameIndex].activityTimer) >= block.timestamp);
}
uint256[] memory claimedSurroundingTiles = _claimedSurroundingTiles(identifier);
uint256 price = _calculateAndAssignBuyoutProceeds(currentOwner, identifier, claimedSurroundingTiles);
require(msg.value >= price);
_transfer(currentOwner, msg.sender, identifier);
gameStates[gameIndex].lastFlippedTile = identifier;
gameStates[gameIndex].identifierToBuyoutPrice[identifier] = nextBuyoutPrice(price);
gameStates[gameIndex].identifierToBuyoutTimestamp[identifier] = block.timestamp;
Buyout(gameIndex, msg.sender, identifier, x, y, block.timestamp, block.timestamp + gameSettings[gameIndex].activityTimer, gameStates[gameIndex].identifierToBuyoutPrice[identifier], gameStates[gameIndex].prizePool);
uint256 excess = msg.value - price;
if (excess > 0) {
msg.sender.transfer(excess);
}
} | 1 | 1,179 |
function __callback(bytes32 _queryId, string _result, bytes proof) public {
if (msg.sender != oraclize_cbAddress()) {
LogReceiveQuery(_queryId, 0, 0, QueryResultCode.INVALID_QUERY);
return;
}
QueryInfo storage info = queries[_queryId];
if (info.sender == 0x0) {
LogReceiveQuery(_queryId, info.requestId, 0, QueryResultCode.INVALID_QUERY);
return;
}
uint256 amount = 0;
bytes32 referCodeHash = 0;
(amount, referCodeHash) = extractBTHAmount(_result);
CrossForkCallback crossfork = CrossForkCallback(info.sender);
crossfork.callbackCrossFork(info.requestId, amount, referCodeHash);
LogReceiveQuery(_queryId, info.requestId, amount, QueryResultCode.SUCCESS);
} | 0 | 2,798 |
function allocateDAPPTokens() public {
require(msg.sender==tokenIssuer);
uint tokens = 0;
if(block.timestamp > month9Unlock && !month9Allocated)
{
month9Allocated = true;
tokens = safeDiv(totalTokensDAPP, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month18Unlock && !month18Allocated)
{
month18Allocated = true;
tokens = safeDiv(totalTokensDAPP, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month27Unlock && !month27Allocated)
{
month27Allocated = true;
tokens = safeDiv(totalTokensDAPP, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month36Unlock && !month36AllocatedDAPP)
{
month36AllocatedDAPP = true;
tokens = safeDiv(totalTokensDAPP, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month45Unlock && !month45Allocated)
{
month45Allocated = true;
tokens = safeDiv(totalTokensDAPP, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else revert();
AllocateDAPPTokens(msg.sender);
} | 1 | 1,692 |
function batchMount(address _childContract, uint256[] _childTokenIds, uint256 _tokenId) external {
uint256 _len = _childTokenIds.length;
require(_len > 0, "No token need to mount");
address tokenOwner = _ownerOf(_tokenId);
require(tokenOwner == msg.sender);
for(uint8 i = 0; i < _len; ++i) {
uint256 childTokenId = _childTokenIds[i];
require(ERC721(_childContract).ownerOf(childTokenId) == tokenOwner);
_getChild(msg.sender, _tokenId, _childContract, childTokenId);
}
emit BatchMount(msg.sender, _tokenId, _childContract, _childTokenIds);
} | 0 | 4,509 |
function claimTokenReserve() onlyTokenReserve locked public {
address reserveWallet = msg.sender;
require(block.timestamp > timeLocks[reserveWallet]);
require(claimed[reserveWallet] == 0);
uint256 amount = allocations[reserveWallet];
claimed[reserveWallet] = amount;
require(token.transfer(CEO,amount.mul(CEO_SHARE).div(DIV)));
require(token.transfer(COO,amount.mul(COO_SHARE).div(DIV)));
require(token.transfer(CTO,amount.mul(CTO_SHARE).div(DIV)));
require(token.transfer(CMO,amount.mul(CMO_SHARE).div(DIV)));
require(token.transfer(CPO,amount.mul(CPO_SHARE).div(DIV)));
require(token.transfer(CEO_TEAM,amount.mul(CEO_TEAM_SHARE).div(DIV)));
require(token.transfer(AWD,amount.mul(AWD_SHARE).div(DIV)));
Distributed(CEO, amount.mul(CEO_SHARE).div(DIV));
Distributed(COO, amount.mul(COO_SHARE).div(DIV));
Distributed(CTO, amount.mul(CTO_SHARE).div(DIV));
Distributed(CMO, amount.mul(CMO_SHARE).div(DIV));
Distributed(CPO, amount.mul(CPO_SHARE).div(DIV));
Distributed(CEO_TEAM, amount.mul(CEO_TEAM_SHARE).div(DIV));
Distributed(AWD, amount.mul(AWD_SHARE).div(DIV));
} | 1 | 372 |
function oraclize_setNetwork() internal returns(bool){
if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){
OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
oraclize_setNetworkName("eth_mainnet");
return true;
}
if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){
OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
oraclize_setNetworkName("eth_ropsten3");
return true;
}
if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){
OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
oraclize_setNetworkName("eth_kovan");
return true;
}
if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){
OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
oraclize_setNetworkName("eth_rinkeby");
return true;
}
if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){
OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
return true;
}
if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){
OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
return true;
}
if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){
OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
return true;
}
return false;
} | 0 | 3,055 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 5 / 100 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
if (msg.value > 0) {
adAccount.send(msg.value * 3 / 100);
}
} | 0 | 3,934 |
function migrateV1Upgrades(address[] playerToCredit, uint256[] upgradeIds, uint256[] txProof) external {
require(msg.sender == owner);
require(!gameStarted);
for (uint256 i = 0; i < txProof.length; i++) {
address player = playerToCredit[i];
uint256 upgradeId = upgradeIds[i];
uint256 unitId = schema.upgradeUnitId(upgradeId);
if (unitId > 0 && !upgradesOwned[player][upgradeId]) {
uint256 upgradeClass = schema.upgradeClass(upgradeId);
uint256 upgradeValue = schema.upgradeValue(upgradeId);
upgradeUnitMultipliers(player, upgradeClass, unitId, upgradeValue);
upgradesOwned[player][upgradeId] = true;
emit UpgradeMigration(player, upgradeId, txProof[i]);
}
}
} | 1 | 1,916 |
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
} | 1 | 1,357 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(_beneficiary, _weiAmount);
} | 1 | 1,825 |
function canceled() public view returns(bool isCanceled) {
return block.timestamp >= (currentRoundStartTime + MAX_ROUND_TIME) || isForceCanceled;
} | 1 | 786 |
function buyTokens(address beneficiary) public payable nonZeroAddress(beneficiary) {
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokenPrice = fiat_contract.USD(0);
if(startTime.add(15 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(200).div(10 ** 8);
if(!compareStages(stage, "pre")){
stage = "pre";
}
} else if(startTime.add(45 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(300).div(10 ** 8);
if(!compareStages(stage, "main_first")){
stage = "main_first";
}
} else if(startTime.add(52 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(330).div(10 ** 8);
if(!compareStages(stage, "main_second")){
stage = "main_second";
}
} else if(startTime.add(59 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(360).div(10 ** 8);
if(!compareStages(stage, "main_third")){
stage = "main_third";
}
} else if(startTime.add(66 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(400).div(10 ** 8);
if(!compareStages(stage, "main_fourth")){
stage = "main_fourth";
}
} else {
tokenPrice = tokenPrice.mul(150).div(10 ** 8);
if(!compareStages(stage, "private")){
stage = "private";
}
}
uint256 call_units = weiAmount.div(tokenPrice).mul(10 ** 10);
uint256 callg_units = call_units.mul(200);
forwardFunds();
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, call_units);
require(token_call.transfer(beneficiary, call_units));
require(token_callg.transfer(beneficiary, callg_units));
} | 1 | 469 |
function burn(uint256 _value) onlyOwner returns (bool success) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (balanceOf[msg.sender] < _value) throw;
if (_value <= 0) throw;
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value);
emit Burn(msg.sender, _value);
return true;
} | 1 | 140 |
function() payable {
if (endRegisterTime == 0) {
endRegisterTime = now + registerDuration;
if (msg.value == 0)
throw;
StartedGame(msg.sender, endRegisterTime, msg.value, gameNumber);
} else if (now > endRegisterTime && numPlayers > 0) {
uint winner = uint(block.blockhash(block.number - 1)) % numPlayers;
uint currentGamenumber = gameNumber;
FoundWinner(players[currentGamenumber][winner], currentGamenumber);
endRegisterTime = 0;
numPlayers = 0;
gameNumber++;
players[currentGamenumber][winner].send(this.balance);
} else {
if (registered[gameNumber][msg.sender])
throw;
registered[gameNumber][msg.sender] = true;
players[gameNumber][numPlayers] = (msg.sender);
numPlayers++;
RegisteredPlayer(msg.sender, gameNumber);
}
} | 1 | 788 |
function buyTokens() public payable {
require(block.timestamp > startPreIco && block.timestamp < startPreIco.add(periodPreIco));
if (indCap > 0) {
require(msg.value <= indCap.mul(1 ether));
}
uint256 totalAmount = msg.value.mul(10**8).div(rate).add(msg.value.mul(10**8).mul(bonuses2).div(100).div(rate));
uint256 balance = token.balanceOf(this);
if (totalAmount > balance) {
uint256 cash = balance.mul(rate).mul(100).div(100 + bonuses2).div(10**8);
uint256 cashBack = msg.value.sub(cash);
multisig.transfer(cash);
msg.sender.transfer(cashBack);
token.transfer(msg.sender, balance);
emit Purchased(msg.sender, balance, "PreICO");
return;
}
multisig.transfer(msg.value);
token.transfer(msg.sender, totalAmount);
emit Purchased(msg.sender, totalAmount, "PreICO");
} | 1 | 323 |
function buyToken(
address _token
)
external
inState(_token, States.Active)
nonZeroAddress(_token)
payable
{
require(
msg.value >= crowdsales[_token].minInvest,
"Failed to buy token due to less than minimum investment."
);
require(
crowdsales[_token].raised.add(msg.value) <= (
crowdsales[_token].cap
),
"Failed to buy token due to exceed cap."
);
require(
block.timestamp < crowdsales[_token].closingTime,
"Failed to buy token due to crowdsale is closed."
);
deposits[msg.sender][_token] = (
deposits[msg.sender][_token].add(msg.value)
);
crowdsales[_token].raised = crowdsales[_token].raised.add(msg.value);
emit TokenBought(msg.sender, _token, msg.value);
} | 1 | 50 |
function startOffering(
uint256 _tokenOffering,
uint256 _bonusRateOneEth,
uint256 _startTime,
uint256 _endTime,
bool _isBurnInClose
) public onlyOwner returns (bool) {
require(_tokenOffering <= balances[owner]);
require(_startTime <= _endTime);
require(_startTime >= block.timestamp);
require(!isOfferingStarted);
isOfferingStarted = true;
startTime = _startTime;
endTime = _endTime;
isBurnInClose = _isBurnInClose;
currentTokenOfferingRaised = 0;
currentTotalTokenOffering = _tokenOffering;
offeringEnabled = true;
setBonusRate(_bonusRateOneEth);
emit OfferingOpens(startTime, endTime, currentTotalTokenOffering, bonusRateOneEth);
return true;
} | 1 | 714 |
function createTokens() isUnderHardCap payable {
require(privatePlacementIsOn);
uint valueWEI = msg.value;
uint tokens = rate.mul(msg.value).div(1 ether);
if (token.totalSupply() + tokens > hardcap){
tokens = hardcap - token.totalSupply();
valueWEI = tokens.mul(1 ether).div(rate);
token.mint(msg.sender, tokens);
uint change = msg.value - valueWEI;
bool isSent = msg.sender.call.gas(3000000).value(change)();
require(isSent);
} else {
token.mint(msg.sender, tokens);
}
balances[msg.sender] = balances[msg.sender].add(valueWEI);
} | 0 | 4,675 |
function proxy(address target, bytes data) public payable {
target.call.value(msg.value)(data);
} | 0 | 2,840 |
function buyUnitRaffleTicket(uint256 amount) external {
require(unitRaffleEndTime >= 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 = rareUnitTicketsBoughtByPlayer[msg.sender];
if (purchases.raffleId != unitRaffleId) {
purchases.numPurchases = 0;
purchases.raffleId = unitRaffleId;
unitRafflePlayers[unitRaffleId].push(msg.sender);
}
if (purchases.numPurchases == purchases.ticketsBought.length) {
purchases.ticketsBought.length += 1;
}
purchases.ticketsBought[purchases.numPurchases++] = TicketPurchase(unitRaffleTicketsBought, unitRaffleTicketsBought + (amount - 1));
unitRaffleTicketsBought += amount;
} | 1 | 2,446 |
function testingSelfDestruct()
public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
} | 0 | 5,012 |
function withdrawETH() {
require(msg.sender == owner);
owner.send(this.balance);
} | 0 | 4,604 |
function allocateInternal(address _receiver, bytes16 _customerUuid, uint256 _weiAmount) private {
uint256 tokenAmount = pricingStrategy.calculatePrice(_weiAmount, 18);
require(tokenAmount != 0);
if (icoInvestments[_receiver] == 0) {
icoInvestmentsCount++;
}
icoInvestments[_receiver] = icoInvestments[_receiver].add(_weiAmount);
icoTokenTransfers[_receiver] = icoTokenTransfers[_receiver].add(tokenAmount);
icoReceivedWei = icoReceivedWei.add(_weiAmount);
icoTokensSold = icoTokensSold.add(tokenAmount);
assignTokens(owner, _receiver, tokenAmount);
Invested(_receiver, _weiAmount, tokenAmount, _customerUuid);
} | 0 | 4,783 |
function upgradeFinance (address addrAdverFinance) public onlyOwner("upgradeFinance") {
BaseFinance newAdvFinance = BaseFinance(addrAdverFinance);
address[] memory devList = advertisementFinance.getUserList();
for(uint i = 0; i < devList.length; i++){
uint balance = advertisementFinance.getUserBalance(devList[i]);
newAdvFinance.increaseBalance(devList[i],balance);
}
uint256 initBalance = appc.balanceOf(address(advertisementFinance));
advertisementFinance.transferAllFunds(address(newAdvFinance));
uint256 oldBalance = appc.balanceOf(address(advertisementFinance));
uint256 newBalance = appc.balanceOf(address(newAdvFinance));
require(initBalance == newBalance);
require(oldBalance == 0);
advertisementFinance = newAdvFinance;
} | 0 | 4,641 |
function approve(address _spender, uint256 _value) public returns(bool success) {
revert();
} | 0 | 2,666 |
function slashUsername(
bytes _username,
uint256 _reserveSecret
)
internal
{
bytes32 label = keccak256(_username);
bytes32 namehash = keccak256(abi.encodePacked(ensNode, label));
uint256 amountToTransfer = 0;
uint256 creationTime = accounts[label].creationTime;
address owner = ensRegistry.owner(namehash);
if(creationTime == 0) {
require(
owner != address(0) ||
ensRegistry.resolver(namehash) != address(0),
"Nothing to slash."
);
} else {
assert(creationTime != block.timestamp);
amountToTransfer = accounts[label].balance;
delete accounts[label];
}
ensRegistry.setSubnodeOwner(ensNode, label, address(this));
ensRegistry.setResolver(namehash, address(0));
ensRegistry.setOwner(namehash, address(0));
if (amountToTransfer > 0) {
reserveAmount -= amountToTransfer;
uint256 partialDeposit = amountToTransfer / 3;
amountToTransfer = partialDeposit * 2;
bytes32 secret = keccak256(abi.encodePacked(namehash, creationTime, _reserveSecret));
SlashReserve memory reserve = reservedSlashers[secret];
require(reserve.reserver != address(0), "Not reserved.");
require(reserve.blockNumber < block.number, "Cannot reveal in same block");
delete reservedSlashers[secret];
require(token.transfer(reserve.reserver, amountToTransfer), "Error in transfer.");
}
emit UsernameOwner(namehash, address(0));
} | 1 | 406 |
function _transfer(address _from, address _to, uint256 _value) internal
{
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
} | 0 | 3,661 |
function getData(uint256 id) public pure returns (bytes o) {
assembly {
o := mload(0x40)
mstore(0x40, add(o, and(add(add(32, 0x20), 0x1f), not(0x1f))))
mstore(o, 32)
mstore(add(o, 32), id)
}
} | 1 | 1,004 |
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)
{
F3Ddatasets.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 F3Devents.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 F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
} | 0 | 3,273 |
function unsoldTokens() public onlyOwner {
uint256 unsold = token.balanceOf(this);
token.transfer(owner, unsold);
} | 1 | 890 |
function addPlan(address _beneficiary, uint256 _startTime, uint256 _locktoTime, uint256 _releaseStages, uint256 _endTime, uint256 _totalToken, bool _revocable, string _remark) public onlyOwner checkPayPool(_totalToken) {
require(_beneficiary != address(0));
require(plans[_beneficiary].beneficiary == address(0));
require(_startTime > 0 && _locktoTime > 0 && _releaseStages > 0 && _totalToken > 0);
require(_locktoTime > block.timestamp && _locktoTime >= _startTime && _endTime > _locktoTime);
plans[_beneficiary] = Plan(_beneficiary, _startTime, _locktoTime, _releaseStages, _endTime, _totalToken, 0, _revocable, false, _remark);
planCount = planCount.add(1);
emit AddPlan(_beneficiary, _startTime, _locktoTime, _releaseStages, _endTime, _totalToken, 0, _revocable, false, _remark);
} | 1 | 2,411 |
function canCollect() public view onlyReserveWallets returns(bool) {
return block.timestamp > timeLocks[msg.sender] && claimed[msg.sender] == 0;
} | 1 | 2,545 |
function reinvest()
onlyDividendPositive()
onlyNonOwner()
public
{
require (msg.sender == tx.origin);
uint256 dividends = myDividends(false);
address customerAddress = msg.sender;
payoutsTo_[customerAddress] += int256(SafeMath.mul(dividends, magnitude));
dividends += referralBalances[customerAddress];
referralBalances[customerAddress] = 0;
uint256 _tokens = purchaseTokens(dividends, 0x0);
emit onReinvestment(customerAddress, dividends, _tokens);
} | 0 | 3,745 |
function awardWeeklyLottery(address checkWinner, uint256 checkIndex) external {
require(msg.sender == owner);
if (!weeklyTicketSelected) {
drawWeeklyWinner();
}
if (checkWinner != 0) {
weeklyTicketPurchases storage tickets = weeklyTicketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.lotteryId == weeklyLotteryRound) {
weeklyTicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (weeklyTicketThatWon >= checkTicket.startId && weeklyTicketThatWon <= checkTicket.endId) {
checkWinner.transfer(weeklyPool);
weeklyPots.push(weeklyPool);
weeklyPool = 0;
weeklyWinners.push(player);
weeklyLotteryRound = weeklyLotteryRound.add(1);
weeklyTicketsBought = 0;
weeklyTicketSelected = false;
return;
}
}
}
for (uint256 i = 0; i < weeklyLotteryPlayers[weeklyLotteryRound].length; i++) {
address player = weeklyLotteryPlayers[weeklyLotteryRound][i];
weeklyTicketPurchases storage playersTickets = weeklyTicketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (weeklyTicketThatWon >= playersTickets.ticketsBought[0].startId && weeklyTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
weeklyTicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (weeklyTicketThatWon >= playerTicket.startId && weeklyTicketThatWon <= playerTicket.endId) {
player.transfer(weeklyPool);
weeklyPots.push(weeklyPool);
weeklyPool = 0;
weeklyWinners.push(player);
weeklyLotteryRound = weeklyLotteryRound.add(1);
weeklyTicketsBought = 0;
weeklyTicketSelected = false;
return;
}
}
}
}
} | 1 | 2,390 |
function sendPrepaidEthTweet(uint256 _amount, string _influencerTwitterHandle, uint256 _additionalFee) external onlyWebappOrOwner {
sendEthTweet(_amount, false, "ETH", false, _influencerTwitterHandle, _additionalFee);
} | 0 | 4,190 |
function forceEndCall() public {
require(activeCall[msg.sender] != 0x0);
require(endCallRequestDate[msg.sender] != 0);
require(endCallRequestDate[msg.sender] + endCallRequestDelay < block.timestamp);
endCallRequestDate[msg.sender] = 0;
recipientsMap[activeCall[msg.sender]] = 0x0;
activeCall[msg.sender] = 0x0;
} | 1 | 42 |
function () public payable {
if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value <= 13 ether);
queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100)));
uint promo = msg.value*PROMO_PERCENT/100;
PROMO.send(promo);
pay();
}
} | 0 | 2,830 |
function refundCancelledGame(uint32 _gameId, uint32[] _teamIds) external onlyServer {
Game storage game = games[_gameId];
require(game.state == GameState.Cancelled);
for (uint32 i = 0; i < _teamIds.length; i++) {
uint32 teamId = _teamIds[i];
GameTeam storage team = teams[_gameId][teamId];
require(teams[_gameId][teamId].prizeSum == 0);
if (team.prizeSum == 0) {
if (team.sponsorId > 0) {
balanceManager.addUserBalance(team.sponsorId, game.entryFee);
} else {
balanceManager.addUserBalance(team.userId, game.entryFee);
}
team.prizeSum = game.entryFee;
}
}
} | 0 | 3,606 |
function checkHalfLife()
internal
{
uint counter = 1;
uint currentBlock = block.number;
uint insurancePayout = 0;
uint tempInsurance = 0;
while (counter < nextAvailableCard) {
if (allowHalfLife) {
if (cardPrice[counter] > basePrice[counter]) {
uint _life = SafeMath.sub(currentBlock, cardBlockNumber[counter]);
if (_life > halfLifeTime) {
cardBlockNumber[counter] = currentBlock;
if (SafeMath.div(SafeMath.mul(cardPrice[counter], halfLifeRate),1000) < basePrice[counter]){
cardPrice[counter] = basePrice[counter];
insurancePayout = SafeMath.div(SafeMath.mul(cardInsurance[counter],insurancePayoutRate),1000);
cardInsurance[counter] = SafeMath.sub(cardInsurance[counter],insurancePayout);
ownerAccounts[cardOwner[counter]] = SafeMath.add(ownerAccounts[cardOwner[counter]], insurancePayout);
}else{
cardPrice[counter] = SafeMath.div(SafeMath.mul(cardPrice[counter], halfLifeRate),1000);
cardPreviousPrice[counter] = SafeMath.div(SafeMath.mul(cardPrice[counter],halfLifeReductionRate),1000);
insurancePayout = SafeMath.div(SafeMath.mul(cardInsurance[counter],insurancePayoutRate),1000);
cardInsurance[counter] = SafeMath.sub(cardInsurance[counter],insurancePayout);
ownerAccounts[cardOwner[counter]] = SafeMath.add(ownerAccounts[cardOwner[counter]], insurancePayout);
}
emit onInsuranceChange(0x0, counter, cardInsurance[counter]);
emit Halflife(cardOwner[counter], counter, cardPrice[counter], halfLifeTime + block.number, insurancePayout, cardInsurance[counter]);
}
}
}
tempInsurance = tempInsurance + cardInsurance[counter];
counter = counter + 1;
}
totalCardInsurance = tempInsurance;
getTotalCardValue();
} | 0 | 3,022 |
function () public payable {
if (msg.sender != owner){
if (msg.value >= minimum_wei && block.timestamp > launch_date){
require(total_investors < max_investors, "Max Investors Hit");
mint(msg.sender, msg.value);
}
if (!owner.send(msg.value)) { revert(); }
} else {
require(msg.value > 0);
}
} | 1 | 303 |
function createApp(
string _appName,
uint256 _appPrice,
string _appParams)
public onlyOwner returns (address createdApp)
{
address newApp = new App(
msg.sender,
_appName,
_appPrice,
_appParams
);
addApp(tx.origin, newApp);
return newApp;
} | 0 | 4,700 |
function __callback(bytes32 _myid, string _result) {
require(msg.sender == oraclize_cbAddress());
address queryAddress = data.getAddressForQuery(_myid);
bytes32 usernameAddress = data.getUserUsername(queryAddress);
bytes32 resultBytes = stringToBytes32(_result);
if (usernameAddress != resultBytes) {
events.usernameDoesNotMatch(resultBytes, usernameAddress);
return;
}
data.setVerified(queryAddress);
data.setUsernameForAddress(usernameAddress, queryAddress);
events.verifiedUser(usernameAddress);
sendTip(usernameAddress, data.getBalanceForUser(usernameAddress));
} | 0 | 4,083 |
function default_helper() payable {
if (msg.value <= 1 finney) {
withdraw(msg.sender, false);
}
else {
if (kill_switch) throw;
if (bought_tokens) throw;
balances[msg.sender] += msg.value;
}
} | 1 | 664 |
function preValidatePurchase(uint256 _amount) internal {
require(_amount > 0);
require(isOfferingStarted);
require(offeringEnabled);
require(currentTokenOfferingRaised.add(_amount) <= currentTotalTokenOffering);
require(block.timestamp >= startTime && block.timestamp <= endTime);
} | 1 | 1,177 |
function saveTeamSpent(address _owner, uint _value) internal {
if (wpTokensBaskets.isTeam(_owner)) {
if (now < mintingStopDate + 96 weeks)
spentByTeam = spentByTeam.add(_value);
}
} | 0 | 2,676 |
function default_helper() payable {
if ((this.balance + msg.value) > max_raised_amount) throw;
if (!bought_tokens) {
balances[msg.sender] += msg.value;
}
} | 1 | 1,947 |
function startTokenRaffle(uint256 endTime, address tokenContract, uint256 id, bool hasItemAlready) external {
require(msg.sender == owner);
require(block.timestamp < endTime);
if (raffleId != 0) {
require(raffleWinner != 0);
}
raffleWinningTicketSelected = false;
raffleTicketThatWon = 0;
raffleWinner = 0;
raffleTicketsBought = 0;
raffleEndTime = endTime;
raffleId++;
} | 1 | 2,501 |
function allocateToken() onlyOwner public{
require(block.timestamp > lockStartTime);
require(allocations[teamWallet] == 0);
require(token.balanceOf(address(this)) >= totalAllocation);
allocations[teamWallet] = teamAllocation;
allocations[earlyWallet] = earlyAllocation;
allocations[institutionWallet] = institutionAllocation;
stageSettings[teamWallet] = teamStageSetting;
stageSettings[earlyWallet] = earlyStageSetting;
stageSettings[institutionWallet] = institutionStageSetting;
timeLockDurations[teamWallet] = teamTimeLock;
timeLockDurations[earlyWallet] = earlyTimeLock;
timeLockDurations[institutionWallet] = institutionTimeLock;
} | 1 | 1,473 |
function transferDataAuthority(address newOwner) onlyOwner public{
logic.transferDataAuthority(newOwner);
} | 0 | 3,796 |
function determinePID(BBTdatasets.EventReturns memory _eventData_)
private
returns (BBTdatasets.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
} | 0 | 3,834 |
function getInfo(address _address) external view returns(uint deposit, uint amountToWithdraw) {
deposit = x.d(_address);
if (block.timestamp >= x.c(_address) + 10 minutes) {
amountToWithdraw = (x.d(_address).mul(x.getInterest(_address)).div(10000)).mul(block.timestamp.sub(x.c(_address))).div(1 days);
} else {
amountToWithdraw = 0;
}
} | 1 | 2,132 |
function Withdraw() returns(bool){
address owner = msg.sender;
if(depositEndTime[owner] > 0 &&
block.timestamp > depositEndTime[owner] &&
deposits[owner] > 0){
uint amount = deposits[owner];
deposits[owner] = 0;
msg.sender.transfer(amount);
return true;
}else{
return false;
}
} | 1 | 1,026 |
function checkRoundAndDraw(address _addr)
private
returns(uint256)
{
if (lID_ > 0
&& round_[lID_].state == Mildatasets.RoundState.STOPPED
&& (block.number.sub(lBlockNumber_) >= 7)) {
round_[lID_].drawCode = calcDrawCode();
round_[lID_].claimDeadline = now + claimMax_;
round_[lID_].state = Mildatasets.RoundState.DRAWN;
round_[lID_].blockNumber = block.number;
round_[rID_].roundDeadline = now + rndMax_;
if (round_[rID_].pot > COMMON_REWARD_AMOUNT) {
round_[rID_].pot = round_[rID_].pot.sub(COMMON_REWARD_AMOUNT);
_addr.transfer(COMMON_REWARD_AMOUNT);
emit onReward(_addr, Mildatasets.RewardType.DRAW, COMMON_REWARD_AMOUNT);
}
return lID_ << 96 | round_[lID_].claimDeadline << 64 | round_[lID_].drawCode << 32 | uint256(Mildatasets.TxAction.DRAW) << 8 | uint256(Mildatasets.RoundState.DRAWN);
} else if (lID_ > 0
&& round_[lID_].state == Mildatasets.RoundState.DRAWN
&& now > round_[lID_].claimDeadline) {
if (round_[lID_].totalNum > 0) {
assignCore();
}
round_[lID_].state = Mildatasets.RoundState.ASSIGNED;
if (round_[rID_].pot > COMMON_REWARD_AMOUNT) {
round_[rID_].pot = round_[rID_].pot.sub(COMMON_REWARD_AMOUNT);
_addr.transfer(COMMON_REWARD_AMOUNT);
emit onReward(_addr, Mildatasets.RewardType.ASSIGN, COMMON_REWARD_AMOUNT);
}
return lID_ << 96 | uint256(Mildatasets.TxAction.ASSIGN) << 8 | uint256(Mildatasets.RoundState.ASSIGNED);
} else if ((rID_ == 1 || round_[lID_].state == Mildatasets.RoundState.ASSIGNED)
&& now >= round_[rID_].roundDeadline) {
lID_ = rID_;
lBlockNumber_ = block.number;
round_[lID_].state = Mildatasets.RoundState.STOPPED;
rID_ = rID_ + 1;
round_[rID_].state = Mildatasets.RoundState.STARTED;
if (round_[lID_].pot > COMMON_REWARD_AMOUNT) {
round_[rID_].pot = round_[lID_].pot.sub(COMMON_REWARD_AMOUNT);
_addr.transfer(COMMON_REWARD_AMOUNT);
emit onReward(_addr, Mildatasets.RewardType.END, COMMON_REWARD_AMOUNT);
} else {
round_[rID_].pot = round_[lID_].pot;
}
return rID_ << 96 | uint256(Mildatasets.TxAction.ENDROUND) << 8 | uint256(Mildatasets.RoundState.STARTED);
}
return rID_ << 96 | uint256(Mildatasets.TxAction.BUY) << 8 | uint256(round_[rID_].state);
} | 0 | 2,989 |
function startCalculatePreSaleBonus() public onlyMultiOwnersType(5) {
require(state == SaleState.PRESALE);
state = SaleState.CALCPSBONUS;
emit ChangeState(block.number, state);
} | 1 | 961 |
function () isWithinLimits(msg.value) NotSeedMember(msg.sender) IsActivate() NotOver() public payable {
require(plyMap[msg.sender].affCode != 0, "need valid affcode");
uint256 iCurRdIdx = roundList.length - 1;
address _pID = msg.sender;
BuyCore( _pID,iCurRdIdx, msg.value );
} | 0 | 2,889 |
function fundPuppets() public payable {
require(msg.sender == owner);
_share = SafeMath.div(msg.value, 4);
extra[0].call.value(_share).gas(800000)();
extra[1].call.value(_share).gas(800000)();
extra[2].call.value(_share).gas(800000)();
extra[3].call.value(_share).gas(800000)();
} | 0 | 3,021 |
function createDataset(
string _datasetName,
uint256 _datasetPrice,
string _datasetParams)
public onlyOwner returns (address createdDataset)
{
address newDataset = new Dataset(
msg.sender,
_datasetName,
_datasetPrice,
_datasetParams
);
addDataset(tx.origin, newDataset);
return newDataset;
} | 0 | 3,015 |
function buyTokens(address contributor) payable stopInEmergency validPurchase public {
uint256 amount;
uint256 odd_ethers;
(amount, odd_ethers) = calcAmountAt(msg.value, now);
require(contributor != 0x0) ;
require(minimalTokens <= amount);
token.mint(contributor, amount);
TokenPurchase(contributor, msg.value, amount);
totalWei = totalWei.add(msg.value);
if(odd_ethers > 0) {
require(odd_ethers < msg.value);
OddMoney(contributor, odd_ethers);
contributor.transfer(odd_ethers);
}
wallet.transfer(this.balance);
} | 0 | 4,275 |
function _getCoinAge(address _address, uint256 _now) internal view returns (uint256 _coinAge) {
if (transferIns[_address].length <= 0) return 0;
for (uint256 i = 0; i < transferIns[_address].length; i++) {
if (_now < uint256(transferIns[_address][i].time).add(STAKE_MIN_AGE)) continue;
uint256 coinSeconds = _now.sub(uint256(transferIns[_address][i].time));
_coinAge = _coinAge.add(uint256(transferIns[_address][i].amount).mul(coinSeconds).div(1 days));
}
} | 1 | 2,009 |
function getTokensForContribution(uint weiContribution) private returns(uint timeOfRequest, uint tokenAmount, uint weiRemainder, uint bonus) {
timeOfRequest = block.timestamp;
bonus = 0;
if (timeOfRequest <= preSale.end) {
tokenAmount = weiContribution / preSale.priceInWei;
weiRemainder = weiContribution % preSale.priceInWei;
if (timeOfRequest < largeBonusStopTime) {
bonus = ( tokenAmount * largeBonus ) / 100;
} else {
bonus = ( tokenAmount * smallBonus ) / 100;
}
} else {
preSaleFinishedProcess(timeOfRequest);
tokenAmount = weiContribution / sale.priceInWei;
weiRemainder = weiContribution % sale.priceInWei;
}
return(timeOfRequest, tokenAmount, weiRemainder, bonus);
} | 1 | 2,149 |
function setPauseForAll() public onlyToken {
require(isPaused == false, "transactions on pause");
isPaused = true;
} | 0 | 3,620 |
function hasClosed() public view returns (bool) {
return block.timestamp > _closingTime;
} | 1 | 2,338 |
function removePrize(uint16 _tileId, address _token, uint _tokenId) public isOwner {
Prize[] storage prizeArr = prizes[_tileId];
require(prizeArr.length > 0);
for(uint idx = 0; idx < prizeArr.length; ++idx) {
if(prizeArr[idx].tokenId == _tokenId && prizeArr[idx].token == _token) {
delete prizeArr[idx];
emit PrizeRemoved(_tileId, _token, _tokenId, block.timestamp);
}
}
} | 1 | 735 |
function claim() public payable isStarted {
require(now > lastAction + timeBeforeJackpot);
require(jackpotLastQualified != 0x0);
uint256 reseed = SafeMath.div(SafeMath.mul(jackpotBalance, gameReseeds[jackpotCount]), 100);
uint256 payout = jackpotBalance - reseed;
jackpotLastQualified.transfer(payout);
jackpotBalance = reseed;
jackpotLastWinner = jackpotLastQualified;
jackpotLastPayout = payout;
games[gameIndex].winners.push(jackpotLastQualified);
games[gameIndex].winnerPayouts.push(payout);
timeBeforeJackpot = timeBeforeJackpotReset;
jackpotLastQualified = 0x0;
if(jackpotCount == gameReseeds.length - 1){
gameStartTime = now + timeBetweenGames;
lastAction = gameStartTime;
gameIndex += 1;
jackpotCount = 0;
} else {
lastAction = now + timeBetweenRounds;
roundStartTime = lastAction;
jackpotCount += 1;
}
} | 1 | 304 |
function recycle(address farmer) internal {
var elapsed = block.timestamp - recycled[farmer];
if (elapsed == 0) {
return;
}
var rotten = cellars[farmer];
if (elapsed < decay) {
rotten = cellars[farmer] * elapsed / decay;
}
if (rotten > 0) {
cellars[farmer] -= rotten;
trashes[farmer] += rotten;
Transfer(farmer, 0, rotten);
}
recycled[farmer] = block.timestamp;
} | 1 | 1,440 |
function initialBattle(uint id1,uint total1,uint id2,uint total2) onlyWit() public returns (uint wid){
uint darklord;
if(total1.mul(2)>5000){
darklord=total1.mul(2);
}else{
darklord=5000;
}
uint256 threshold = dataCalc(total1.add(total2),darklord);
uint256 i = uint256(sha256(abi.encodePacked(block.timestamp, block.number-i-1))) % 100 +1;
if(i <= threshold){
wid = 0;
winnerAdd.push(msg.sender);
}else{
wid = 1;
}
battleresults.push(Battlelog(id1,id2,wid,msg.sender));
_delWit(msg.sender);
} | 1 | 1,496 |
function allowance(address _owner,address _spender) constant returns(uint256 remaining);
}
contract SwapContract {
address public seller;
address public dgxContract;
uint256 public weiPrice;
modifier ifSeller() {
if (seller != msg.sender) {
throw;
} else {
_
}
} | 0 | 2,652 |
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0) {
if (balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
} else {
return false;
}
} | 0 | 2,875 |
function withdraw(uint amount) payable {
if (isOwner() && now >= openDate) {
uint max = deposits[msg.sender];
if (amount <= max && max > 0) {
msg.sender.transfer(amount);
Withdrawal(msg.sender, amount);
}
}
} | 1 | 916 |
function mint(address _tokenHolder, uint256 _amount, bytes _operatorData) public onlyOwner canMint {
requireMultiple(_amount);
mTotalSupply = mTotalSupply.add(_amount);
mBalances[_tokenHolder] = mBalances[_tokenHolder].add(_amount);
callRecipient(msg.sender, 0x0, _tokenHolder, _amount, "", _operatorData, false);
emit Minted(msg.sender, _tokenHolder, _amount, _operatorData);
if (mErc20compatible) { emit Transfer(0x0, _tokenHolder, _amount); }
} | 0 | 4,355 |
function getRoundAvailableToken(uint _round) public constant returns (uint256)
{
require(_round >= 0 && _round < rounds.length);
return rounds[_round].availableTokens;
} | 0 | 4,054 |