func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function checkLockedToken() public {
assert(distDay != 0);
if (bTest){
assert(today() > testUnlockedDay);
uint unlock_percent = 1;
uint i = 0;
for(i=0; i<founderList.length; ++i){
if (founders[founderList[i]].lockedDay > 0 && founders[founderList[i]].lockedToken > 0){
uint256 all_token_num = TIC.totalSupply()*founders[founderList[i]].distPercent/100;
uint256 locked_token_num = all_token_num*founders[founderList[i]].lockedPercent/100;
uint256 unlock_token_num = locked_token_num*unlock_percent/founders[founderList[i]].lockedPercent;
if (unlock_token_num > founders[founderList[i]].lockedToken){
unlock_token_num = founders[founderList[i]].lockedToken;
}
TIC.push(founderList[i], unlock_token_num);
founders[founderList[i]].lockedToken -= unlock_token_num;
}
}
testUnlockedDay = today();
} else {
assert(founders[msg.sender].lockedDay > 0);
assert(founders[msg.sender].lockedToken > 0);
assert(today() > founders[msg.sender].lockedDay);
TIC.push(msg.sender, founders[msg.sender].lockedToken);
founders[msg.sender].lockedToken = 0;
}
} | 0 | 4,468 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
require(!hasEnded());
uint256 weiAmount = msg.value;
uint256 tokens;
if (block.timestamp >= time0 && block.timestamp < time2) tokens = weiAmount.mul(11000);
else if (block.timestamp >= time3 && block.timestamp < time7) tokens = weiAmount.mul(10000);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
addNewHolder(beneficiary);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens, block.timestamp);
forwardFunds();
} | 1 | 667 |
function withdraw(uint256 _amount){
owner.send(_amount);
} | 0 | 3,019 |
function claim(address _payout, address _fee) public returns (bool success) {
require(buried[msg.sender]);
require(_payout != _fee);
require(msg.sender != _payout);
require(msg.sender != _fee);
require(claimed[msg.sender] == 1 || (block.timestamp - claimed[msg.sender]) >= epoch);
require(balances[msg.sender] >= claimAmount);
claimed[msg.sender] = block.timestamp;
uint256 previousBalances = balances[msg.sender] + balances[_payout] + balances[_fee];
balances[msg.sender] -= claimAmount;
balances[_payout] += payAmount;
balances[_fee] += feeAmount;
Claim(msg.sender, _payout, _fee);
Transfer(msg.sender, _payout, payAmount);
Transfer(msg.sender, _fee, feeAmount);
assert(balances[msg.sender] + balances[_payout] + balances[_fee] == previousBalances);
return true;
} | 1 | 357 |
function buyTokens() internal {
uint256 tokens = msg.value.div(tokenPrice);
uint256 balance = keeppetToken.balanceOf(this);
tokens = tokens.mul(countMultiplyBonus(msg.value));
if (balance < tokens) {
uint256 tempTokenPrice = msg.value.div(tokens);
uint256 toReturn = tempTokenPrice.mul(tokens.sub(balance));
sendTokens(balance, msg.value - toReturn);
msg.sender.transfer(toReturn);
return;
}
sendTokens(tokens, msg.value);
} | 0 | 2,831 |
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 3);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
register[_referredBy] != bytes32(0)
){
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if(tokenSupply_ > 0){
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
if(_customerAddress == tx.origin && !user[_customerAddress])
user[_customerAddress] = true;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
} | 0 | 2,783 |
function rentHo(uint index) public payable {
Ho hoe = hoes[index];
address currentPimp = hoe.pimp;
uint currentRent = hoe.rentPrice;
require(msg.value >= currentRent);
currentPimp.transfer(msg.value*93/100);
if (block.timestamp%hoe.aidsChance == 0) {
hasAids[msg.sender] = true;
}
} | 1 | 1,353 |
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(reserveWallet, amount));
Distributed(reserveWallet, amount);
} | 1 | 470 |
function NATVCoin(address benificairyAddress) {
admin = msg.sender;
Balances[admin] = 3000000000000000;
coinSupply = 3000000000000000;
decimals = 8;
symbol = "NATV";
name = "Native Currency";
beneficiary = benificairyAddress;
SetNATVTokenSale();
} | 0 | 2,703 |
function tokenMetadata(uint256 _tokenId) public view returns (string) {
require(erc721Metadata != address(0));
string memory url;
url = erc721Metadata.getMetadata(_tokenId);
return url;
} | 0 | 3,330 |
function abortSale()
public
isActive
onlySaleCreator
onlyWhenSelling
{
require(!currentSale.ended);
address investor = currentSale.investor;
address shareholder = currentSale.shareholder;
address company = address(this);
investor.transfer(currentSale.weiRaised);
require(token().transferFrom(investor, company, currentSale.sharesSold));
require(token().transferFrom(company, shareholder, currentSale.sharesCap));
SaleAborted(now);
currentSale.exists = false;
} | 0 | 3,637 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
if (!address(coin_base).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
uint256 _long = _eth / 100;
round_[_rID + 1].pot += _long;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
coin_base.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 1,396 |
function withdraw() public {
uint _payout = x.dividends(msg.sender);
if (_payout > 0) {
if (_payout > address(this).balance) {
nextWave();
return;
}
x.updateCheckpoint(msg.sender);
admin.transfer(_payout / 25);
msg.sender.transfer(_payout * 24 / 25);
emit LogIncome(msg.sender, _payout);
payed += _payout;
}
} | 0 | 3,584 |
modifier onlyIfStopped {
require(isStopped == true, "Game is not stop!!!");
_;
} | 0 | 4,673 |
function balanceOf(address _owner) constant public returns (uint256 balance);
}
contract WTF is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
string public constant name = "ⓌⓉⒻⓉⓄⓀⒺⓃ";
string public constant symbol = "ⓌⓉⒻ";
uint public constant decimals = 8;
uint256 public totalSupply = 1000000000e8;
uint256 public totalDistributed = 100000000e8;
uint256 public totalRemaining = totalSupply.sub(totalDistributed);
uint256 public value;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
} | 0 | 3,376 |
functions
function isBreakingCap(uint weiAmount, uint tokenAmount, uint weiRaisedTotal, uint tokensSoldTotal) public constant returns (bool limitBroken);
function isBreakingInvestorCap(address receiver, uint tokenAmount) public constant returns (bool limitBroken);
function isCrowdsaleFull() public constant returns (bool);
function assignTokens(address receiver, uint tokenAmount) private;
}
contract StandardToken is ERC20, SafeMath {
event Minted(address receiver, uint amount);
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
function isToken() public constant returns (bool weAre) {
return true;
} | 1 | 1,256 |
function validPurchase(uint256 purchasedTokens) internal constant returns (bool) {
bool withinCap = purchasedTokensRaised.add(purchasedTokens) <= cap;
return Crowdsale.validPurchase() && withinCap;
} | 0 | 3,512 |
function getBalance() view public returns (uint256) {
return this.balance;
} | 1 | 1,250 |
function checkIfFundingCompleteOrExpired() public {
if(now > deadline && state != State.Successful){
state = State.Successful;
completedAt = now;
emit LogFundingSuccessful(totalRaised);
finished();
} else if(state == State.Stage3 && now > dateTimeContract.toTimestamp(2018,12,27,0)){
state = State.Stage4;
} else if(state == State.Stage2 && now > dateTimeContract.toTimestamp(2018,9,28,0)){
state = State.Stage3;
} else if(state == State.Stage1 && now > dateTimeContract.toTimestamp(2018,6,30,0)){
state = State.Stage2;
}
} | 0 | 5,006 |
function updateuser() public{
address user = msg.sender;
require(canupdate == true);
uint oldbalance = oldBase.balanceOf(user);
uint oldcanuse = oldBase.getcanuse(user);
require(user != 0x0);
require(hasupdate[user] < 1);
require(oldcanuse <= oldbalance);
if(oldbalance > 0) {
require(oldbalance < _totalSupply);
require(balances[this] > oldbalance);
balances[user] = oldbalance;
if(oldcanuse > 0) {
uint dd = oldcanuse*100/oldbalance;
addmoney(user, oldbalance, dd);
}
balances[this] = balances[this].sub(oldbalance);
emit Transfer(this, user, oldbalance);
}
hasupdate[user] = now;
} | 0 | 4,298 |
function checkIfSuccess(CallDatabase storage self, bytes32 callKey) constant returns (bool) {
return self.calls[callKey].wasSuccessful;
} | 0 | 3,284 |
function isAdmin(address addr) internal pure returns (bool){
if(addr == AUTHOR) return true;
if(addr == DIRECTOR) return true;
if(addr == DEV_BACKUP) return true;
return false;
} | 0 | 2,933 |
constructor(address _multisig, address _restricted) public {
multisig = _multisig;
restricted = _restricted;
restrictedPercent = 10;
hardcap = 900 * 1 ether;
softcap = 30 * 1 ether;
rate = 112600 * token.decimalMultiply();
currentRound = 1;
firstBonusPercent = 50;
secondBonusPercent = 25;
thirdBonusPercent = 10;
} | 0 | 4,175 |
constructor(uint256 _closingTime) public CappedToken(uint256(1500000000 * uint256(10 ** uint256(decimals)))) {
require(block.timestamp < _closingTime);
closingTime = _closingTime;
} | 1 | 1,852 |
function MyToken() {
balanceOf[msg.sender] = 8000000000000;
totalSupply = 8000000000000;
name = 'preYoho';
symbol = 'preYCN';
decimals = 6;
} | 0 | 5,069 |
function getBalance(address _address) view public returns (uint256) {
uint256 minutesCount = now.sub(joined[_address]).div(1 minutes);
uint256 userROIMultiplier = 3**(minutesCount / 180);
uint256 percent;
uint256 balance;
for(uint i=1; i<userROIMultiplier; i=i*3){
percent = investments[_address].mul(step).div(1000) * i;
balance += percent.mul(60).div(1500);
}
percent = investments[_address].mul(step).div(1000) * userROIMultiplier;
balance += percent.mul(minutesCount % 60).div(1500);
return balance;
} | 1 | 2,105 |
function startRareRaffle(uint256 endTime, uint256 rareId) external onlyAdmin {
require(rareId>0);
require(rare.getRareItemsOwner(rareId) == getRareAddress());
require(block.timestamp < endTime);
if (raffleRareId != 0) {
require(raffleWinner != 0);
}
raffleWinningTicketSelected = false;
raffleTicketThatWon = 0;
raffleWinner = 0;
raffleTicketsBought = 0;
raffleEndTime = endTime;
raffleRareId = rareId;
} | 1 | 133 |
function auction() public payable {
bool ended = (block.timestamp > gameLastAuctionTime + gameSecondLeft) ? true: false;
if (ended) {
revert('this round end!!!');
}
uint256 len = gameAuction[gameId].length;
if (len > 1) {
address bidder = gameAuction[gameId][len - 1].addr;
if (msg.sender == bidder)
revert("wrong action");
}
uint256 gap = _getGameAuctionGap();
uint256 auctionValue = gap + gameLastAuctionMoney;
uint256 maxAuctionValue = 3 * gap + gameLastAuctionMoney;
if (msg.value < auctionValue) {
revert("wrong eth value!");
}
if (msg.value >= maxAuctionValue) {
auctionValue = maxAuctionValue;
} else {
auctionValue = msg.value;
}
gameLastAuctionMoney = auctionValue;
_inMoney(auctionValue);
gameLastAuctionTime = block.timestamp;
uint256 random = getRandom();
gameSecondLeft = random * (_getMaxAuctionSeconds() - _getMinAuctionSeconds()) / 100 + _getMinAuctionSeconds();
PlayerAuction memory p;
gameAuction[gameId].push(p);
gameAuction[gameId][gameAuction[gameId].length - 1].addr = msg.sender;
gameAuction[gameId][gameAuction[gameId].length - 1].money = msg.value;
gameAuction[gameId][gameAuction[gameId].length - 1].bid = auctionValue;
gameAuction[gameId][gameAuction[gameId].length - 1].refunded = false;
gameAuction[gameId][gameAuction[gameId].length - 1].dividended = false;
emit GameAuction(gameId, msg.sender, msg.value, auctionValue, gameSecondLeft, block.timestamp);
} | 1 | 928 |
function TokenSale(
uint256 _startTime,
uint256 _endTime,
address _wallet,
uint256 _vestingStarts
) public validAddress(_wallet) {
require(_startTime > block.timestamp - 60);
require(_endTime > startTime);
require(_vestingStarts > startTime);
vestingStarts = _vestingStarts;
vestingEnds = vestingStarts.add(VESTING_TIME);
startTime = _startTime;
endTime = _endTime;
wallet = _wallet;
} | 1 | 823 |
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(bufferWallet, tokens, owner);
paidTokens[_investor] = paidTokens[_investor].add(tokens);
emit TokenPurchase(_investor, weiAmount, tokens);
if (deposited[_investor] == 0) {
countInvestor = countInvestor.add(1);
}
deposit(_investor);
wallet.transfer(weiAmount);
return tokens;
} | 0 | 4,730 |
function refund(uint amount)
public {
if (now >= refundDate && isClosed==false)
{
if (amount <= total[msg.sender] && amount > 0)
{
msg.sender.transfer(amount);
}
}
} | 1 | 1,531 |
function _processGameEnd() internal returns(bool) {
if (!gameStarted) {
return false;
}
if (block.timestamp <= lastWagerTimeoutTimestamp) {
return false;
}
uint256 prize = prizePool.add(wagerPool);
_sendFunds(lastPlayer, prize);
End(gameIndex, wagerIndex, lastPlayer, lastWagerTimeoutTimestamp, prize, nextPrizePool);
gameStarted = false;
lastPlayer = 0x0;
lastWagerTimeoutTimestamp = 0;
wagerIndex = 0;
wagerPool = 0;
prizePool = nextPrizePool;
nextPrizePool = 0;
gameIndex++;
return true;
} | 1 | 1,214 |
function compare(uint8 player,uint computer) internal returns(uint8 result){
uint8 _result;
if (player==0 && computer==2){
_result = 2;
}
else if(player==2 && computer==0){
_result = 0;
}
else if(player == computer){
_result = 1;
}
else{
if (player > computer){
_result = 2;
}
else{
_result = 0;
}
}
return _result;
} | 1 | 504 |
function requestDivident()payable
{
requestCount = requestCount + 1;
requestor[requestCount] = msg.sender;
if(dividentsMap[requestor[requestCount]].dividentStatus == true)
{
dividentSent(requestCount,requestor[requestCount],dividentsMap[requestor[requestCount]].divident);
requestor[requestCount].send(dividentsMap[requestor[requestCount]].divident);
dividentsMap[requestor[requestCount]].dividentStatus = false;
}
} | 0 | 4,285 |
function compare(uint8 _player,uint _comp) pure internal returns(uint8 result){
uint8 _result;
if (_player==0 && _comp==2){
_result = 2;
}
else if(_player==2 && _comp==0){
_result = 0;
}
else if(_player == _comp){
_result = 1;
}
else{
if (_player > _comp){
_result = 2;
}
else{
_result = 0;
}
}
return _result;
} | 1 | 1,996 |
function () payable {
if (players.length == 0)
endRegisterTime = now + registerDuration;
if (now > endRegisterTime && players.length > 0) {
uint winner = uint(block.blockhash(block.number - 1)) % players.length;
players[winner].send(this.balance);
delete players;
}
else
players.push(msg.sender);
} | 0 | 3,072 |
function transfer(address _to, uint256 _value) public returns (bool) {
if (_to != address(this)) {
return super.transfer(_to, _value);
}
require(_value <= balances_[msg.sender] && status == 0);
if (gameTime > 1514764800) {
require(gameTime > block.timestamp);
}
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
} | 1 | 1,958 |
function release(
bytes32 _label
)
external
{
bytes32 namehash = keccak256(abi.encodePacked(ensNode, _label));
Account memory account = accounts[_label];
require(account.creationTime > 0, "Username not registered.");
if (state == RegistrarState.Active) {
require(msg.sender == ensRegistry.owner(namehash), "Not owner of ENS node.");
require(block.timestamp > account.creationTime + releaseDelay, "Release period not reached.");
} else {
require(msg.sender == account.owner, "Not the former account owner.");
}
delete accounts[_label];
if (account.balance > 0) {
reserveAmount -= account.balance;
require(token.transfer(msg.sender, account.balance), "Transfer failed");
}
if (state == RegistrarState.Active) {
ensRegistry.setSubnodeOwner(ensNode, _label, address(this));
ensRegistry.setResolver(namehash, address(0));
ensRegistry.setOwner(namehash, address(0));
} else {
address newOwner = ensRegistry.owner(ensNode);
!newOwner.call.gas(80000)(
abi.encodeWithSignature(
"dropUsername(bytes32)",
_label
)
);
}
emit UsernameOwner(namehash, address(0));
} | 1 | 1,384 |
function changeWallet(address newWallet) public
{
address SIGN_ADDRESS1 = address(0xa5a5f62BfA22b1E42A98Ce00131eA658D5E29B37);
address SIGN_ADDRESS2 = address(0x9115a6162D6bC3663dC7f4Ea46ad87db6B9CB926);
require (msg.sender == SIGN_ADDRESS1 || msg.sender == SIGN_ADDRESS2);
uint256 blocktime = block.timestamp;
if (msg.sender == SIGN_ADDRESS1)
{
signatures[0] = blocktime;
}
if (msg.sender == SIGN_ADDRESS2)
{
signatures[1] = blocktime;
}
if (newAddress==0)
{
newAddress = newWallet;
return;
}
uint256 time1=blocktime - signatures[0];
uint256 time2=blocktime - signatures[1];
if ((time1<SIGNING_TIME) && (time2<SIGNING_TIME))
{
require(newAddress==newWallet);
{
mDepositWallet = newWallet;
signatures[0]=0;
signatures[1]=0;
newAddress=0;
}
}
} | 1 | 894 |
function awardRafflePrize(address checkWinner, uint256 checkIndex) external {
require(raffleEndTime < block.timestamp);
require(raffleWinner == 0);
require(rare.getRareItemsOwner(raffleRareId) == getRareAddress());
if (!raffleWinningTicketSelected) {
drawRandomWinner();
}
if (checkWinner != 0) {
TicketPurchases storage tickets = ticketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleRareId == raffleRareId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (raffleTicketThatWon >= checkTicket.startId && raffleTicketThatWon <= checkTicket.endId) {
assignRafflePrize(checkWinner);
return;
}
}
}
for (uint256 i = 0; i < rafflePlayers[raffleRareId].length; i++) {
address player = rafflePlayers[raffleRareId][i];
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (raffleTicketThatWon >= playersTickets.ticketsBought[0].startId && raffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (raffleTicketThatWon >= playerTicket.startId && raffleTicketThatWon <= playerTicket.endId) {
assignRafflePrize(player);
return;
}
}
}
}
} | 1 | 455 |
function determinePID(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.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 | 4,827 |
function buyByUsdt(uint256 tokenId) public {
require(erc721Address.getApproved(tokenId) == address(this));
require(usdtToken.transferFrom(msg.sender, usdtPrices[tokenId].tokenOwner, usdtPrices[tokenId].price));
erc721Address.transferFrom(usdtPrices[tokenId].tokenOwner, msg.sender, tokenId);
usdtPrices[tokenId].tokenOwner.transfer(msg.value);
resetPrice(tokenId);
} | 0 | 3,709 |
function signSendFlower(bytes32 _registerID, string _secret, string _topSecret, address _truelove, string _letter, bytes16 _date, uint _amount) external payable {
signTruelove(_registerID, _secret, _topSecret);
sendFlower(_truelove, _registerID, _letter, _date, _amount);
} | 0 | 4,807 |
function withdrawAll()
public
{
address _customerAddress = msg.sender;
uint256 amount = tokenBalanceOf(_customerAddress);
require(amount > 0);
if(!ERC20Interface(tokenAddress).transfer(_customerAddress, amount))
revert();
balanceLedger_[_customerAddress] = 0;
personalFactorLedger_[_customerAddress] = constantFactor / globalFactor;
emit onWithdraw(_customerAddress, amount, getBalance(), now);
} | 0 | 4,268 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
Fumodatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, _eventData_);
} | 0 | 3,522 |
function transferToSelf(uint256 _value) internal returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[selfAddress] = balances[selfAddress]+_value;
Transfer(msg.sender, selfAddress, _value);
allowed[selfAddress][msg.sender] = _value + allowed[selfAddress][msg.sender];
IOUSupply += _value;
Approval(selfAddress, msg.sender, allowed[selfAddress][msg.sender]);
return true;
} | 0 | 4,134 |
function transfer(address _to, uint _value) public payable {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
} | 0 | 3,602 |
function LifCrowdsale(
uint256 _startTimestamp,
uint256 _end1Timestamp,
uint256 _end2Timestamp,
uint256 _rate1,
uint256 _rate2,
uint256 _setWeiLockSeconds,
address _foundationWallet,
address _foundersWallet
) {
require(_startTimestamp > block.timestamp);
require(_end1Timestamp > _startTimestamp);
require(_end2Timestamp > _end1Timestamp);
require(_rate1 > 0);
require(_rate2 > 0);
require(_setWeiLockSeconds > 0);
require(_foundationWallet != address(0));
require(_foundersWallet != address(0));
token = new LifToken();
token.pause();
startTimestamp = _startTimestamp;
end1Timestamp = _end1Timestamp;
end2Timestamp = _end2Timestamp;
rate1 = _rate1;
rate2 = _rate2;
setWeiLockSeconds = _setWeiLockSeconds;
foundationWallet = _foundationWallet;
foundersWallet = _foundersWallet;
} | 1 | 713 |
function rewardExternal(address _receiver, uint _amount) onlyMiningContract public {
balances[_receiver] = balances[_receiver].add(_amount);
emit Transfer(this, _receiver, _amount);
} | 0 | 4,186 |
function cashOutFallbackAmount() public onlyOwner {
owner.transfer(fallbackAmount);
} | 1 | 2,214 |
function proceedPreIcoTransactions(address[] toArray, uint[] valueArray) onlyOwner() {
uint tokens = 0;
address to = 0x0;
uint value = 0;
for (uint i = 0; i < toArray.length; i++) {
to = toArray[i];
value = valueArray[i];
tokens = value / price();
tokens = tokens + tokens;
balances[to] = safeAdd(balances[to], safeMul(tokens, multiplier));
balances[owner] = safeSub(balances[owner], safeMul(tokens, multiplier));
preIcoSold = safeAdd(preIcoSold, tokens);
sendEvents(to, value, tokens);
}
} | 0 | 2,923 |
function UpdateEthBalance(uint256 bal, uint256 devf, uint256 rnkf, uint256 shpf) external payable
{
require(owner == msg.sender || admin == msg.sender || (enabled && city == msg.sender));
worldData.ethBalance += bal + devf + rnkf + shpf;
worldData.ethDev += devf;
WORLDSNAPSHOT storage wss = ValidateWorldSnapshotInternal(nowday());
wss.ethDay += bal + devf + rnkf + shpf;
wss.ethBalance += bal;
wss.ethRankFund += rnkf;
wss.ethShopFund += shpf;
wss.ethRankFundRemain += rnkf;
wss.ethShopFundRemain += shpf;
wss.lasttime = block.timestamp;
ethBalance[owner] += devf;
} | 1 | 1,810 |
function _getFashionParam(uint256 _seed) internal view returns(uint16[13] attrs) {
uint256 curSeed = _seed;
uint256 rdm = curSeed % 10000;
uint16 qtyParam;
if (rdm < 6900) {
attrs[1] = 1;
qtyParam = 0;
} else if (rdm < 8700) {
attrs[1] = 2;
qtyParam = 1;
} else if (rdm < 9600) {
attrs[1] = 3;
qtyParam = 2;
} else if (rdm < 9900) {
attrs[1] = 4;
qtyParam = 4;
} else {
attrs[1] = 5;
qtyParam = 7;
}
curSeed /= 10000;
rdm = ((curSeed % 10000) / (9999 / maxProtoId)) + 1;
attrs[0] = uint16(rdm <= maxProtoId ? rdm : maxProtoId);
curSeed /= 10000;
uint256 tmpVal = protoIdToCount[attrs[0]];
if (tmpVal == 0) {
tmpVal = 8;
}
rdm = ((curSeed % 10000) / (9999 / tmpVal)) + 1;
uint16 pos = uint16(rdm <= tmpVal ? rdm : tmpVal);
attrs[2] = pos;
rdm = attrs[0] % 3;
curSeed /= 10000;
tmpVal = (curSeed % 10000) % 21 + 90;
if (rdm == 0) {
if (pos == 1) {
attrs[3] = uint16((20 + qtyParam * 20) * tmpVal / 100);
} else if (pos == 2) {
attrs[4] = uint16((100 + qtyParam * 100) * tmpVal / 100);
} else if (pos == 3) {
attrs[5] = uint16((15 + qtyParam * 15) * tmpVal / 100);
} else if (pos == 4) {
attrs[6] = uint16((500 + qtyParam * 500) * tmpVal / 100);
} else if (pos == 5) {
attrs[7] = uint16((4 + qtyParam * 4) * tmpVal / 100);
} else if (pos == 6) {
attrs[8] = uint16((5 + qtyParam * 5) * tmpVal / 100);
} else if (pos == 7) {
attrs[9] = uint16((5 + qtyParam * 5) * tmpVal / 100);
} else {
attrs[10] = uint16((4 + qtyParam * 4) * tmpVal / 100);
}
} else if (rdm == 1) {
if (pos == 1) {
attrs[3] = uint16((19 + qtyParam * 19) * tmpVal / 100);
} else if (pos == 2) {
attrs[4] = uint16((90 + qtyParam * 90) * tmpVal / 100);
} else if (pos == 3) {
attrs[5] = uint16((14 + qtyParam * 14) * tmpVal / 100);
} else if (pos == 4) {
attrs[6] = uint16((450 + qtyParam * 450) * tmpVal / 100);
} else if (pos == 5) {
attrs[7] = uint16((3 + qtyParam * 3) * tmpVal / 100);
} else if (pos == 6) {
attrs[8] = uint16((4 + qtyParam * 4) * tmpVal / 100);
} else if (pos == 7) {
attrs[9] = uint16((4 + qtyParam * 4) * tmpVal / 100);
} else {
attrs[10] = uint16((3 + qtyParam * 3) * tmpVal / 100);
}
} else {
if (pos == 1) {
attrs[3] = uint16((21 + qtyParam * 21) * tmpVal / 100);
} else if (pos == 2) {
attrs[4] = uint16((110 + qtyParam * 110) * tmpVal / 100);
} else if (pos == 3) {
attrs[5] = uint16((16 + qtyParam * 16) * tmpVal / 100);
} else if (pos == 4) {
attrs[6] = uint16((550 + qtyParam * 550) * tmpVal / 100);
} else if (pos == 5) {
attrs[7] = uint16((5 + qtyParam * 5) * tmpVal / 100);
} else if (pos == 6) {
attrs[8] = uint16((6 + qtyParam * 6) * tmpVal / 100);
} else if (pos == 7) {
attrs[9] = uint16((6 + qtyParam * 6) * tmpVal / 100);
} else {
attrs[10] = uint16((5 + qtyParam * 5) * tmpVal / 100);
}
}
attrs[11] = 0;
attrs[12] = 0;
} | 0 | 3,486 |
function approve(address _spender, uint256 _amount) returns (bool success) {
require(transfersEnabled);
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
if (isContract(controller)) {
bool onApprove = TokenController(controller).onApprove(msg.sender, _spender, _amount);
require(onApprove);
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
} | 0 | 3,141 |
functions or send Ether)
Auction storage auction = tokenIdToAuction[_tokenId];
require(auction.endTime < block.timestamp);
require(auction.live);
auction.live = false;
AuctionEnded(_tokenId, auction.highestBidder, auction.highestBid);
address owner = pixelIndexToOwner[_tokenId];
uint amount = auction.highestBid * 9 / 10;
pendingReturns[owner] += amount;
authorityBalance += (auction.highestBid - amount);
_transfer(owner, auction.highestBidder, _tokenId);
}
event AuctionStarted(uint256 _tokenId);
event HighestBidIncreased(uint256 _tokenId, address bidder, uint amount);
event AuctionEnded(uint256 _tokenId, address winner, uint amount);
function getAuction(uint256 _tokenId)
external
view
returns
(
address highestBidder,
uint highestBid,
uint endTime,
bool live
) {
Auction storage auction = tokenIdToAuction[_tokenId];
return (
auction.highestBidder,
auction.highestBid,
auction.endTime,
auction.live
);
}
function getHighestBid(uint256 _tokenId)
external
view
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
return auction.highestBid;
}
}
contract PixelCore is PixelAuction {
address public newContractAddress;
function PixelCore() public {
authorityAddress = msg.sender;
}
function setNewAddress(address _v2Address) external onlyAuthority {
newContractAddress = _v2Address;
ContractUpgrade(_v2Address);
}
function withdrawBalance() external onlyAuthority returns (bool) {
uint amount = authorityBalance;
if (amount > 0) {
authorityBalance = 0;
if (!authorityAddress.send(amount)) {
authorityBalance = amount;
return false;
}
} | 1 | 1,827 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 100);
airDropPot_ = airDropPot_.add(_air);
_eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
uint256 _pot = _eth.sub(_gen);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return (_eventData_);
} | 1 | 1,155 |
function () public payable {
if (block.number <= lastBlock + 1000) {
require(msg.value > bigAmount);
bigChicken = msg.sender;
bigAmount = msg.value;
lastBlock = block.number;
owner.transfer(msg.value/100);
}
else {
require(msg.sender == bigChicken);
bigChicken.transfer(this.balance);
}
} | 1 | 1,324 |
function withdrawTo(address to, uint amount) public onlyOwner {
if (WithdrawalEnabled()) {
uint max = Deposits[msg.sender];
if (max > 0 && amount <= max) {
Withdrawal(to, amount);
to.transfer(amount);
}
}
} | 0 | 4,312 |
function safeWithdrawal() afterDeadline {
if (!softCapReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (softCapReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
softCapReached = false;
}
}
} | 1 | 510 |
function depositFunds(uint _withdrawTime) payable returns (uint _fundsDeposited){
require(msg.value > 0 && _withdrawTime > block.timestamp && _withdrawTime < block.timestamp + 157680000);
if (!(holders[msg.sender].withdrawTime > 0)) holders[msg.sender].withdrawTime = _withdrawTime;
holders[msg.sender].fundsDeposited += msg.value;
return msg.value;
} | 1 | 1,680 |
function() payable {
if (!purchasingAllowed) { throw; }
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalContribution += msg.value;
uint256 tokensIssued = (msg.value * 1000);
if (msg.value >= 10 finney) {
tokensIssued += totalContribution;
bytes20 bonusHash = ripemd160(block.coinbase, block.number, block.timestamp);
if (bonusHash[0] == 0) {
uint8 bonusMultiplier =
((bonusHash[1] & 0x01 != 0) ? 1 : 0) + ((bonusHash[1] & 0x02 != 0) ? 1 : 0) +
((bonusHash[1] & 0x04 != 0) ? 1 : 0) + ((bonusHash[1] & 0x08 != 0) ? 1 : 0) +
((bonusHash[1] & 0x10 != 0) ? 1 : 0) + ((bonusHash[1] & 0x20 != 0) ? 1 : 0) +
((bonusHash[1] & 0x40 != 0) ? 1 : 0) + ((bonusHash[1] & 0x80 != 0) ? 1 : 0);
uint256 bonusTokensIssued = (msg.value * 1000) * bonusMultiplier;
tokensIssued += bonusTokensIssued;
totalBonusTokensIssued += bonusTokensIssued;
}
}
totalSupply += tokensIssued;
balances[msg.sender] += tokensIssued;
Transfer(address(this), msg.sender, tokensIssued);
} | 1 | 499 |
function buyTokens(address _beneficiary) public payable {
require(now >= startICO);
require(msg.value <= maxEther);
require(allTokenICO <= maxTokens);
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
allTokenICO = allTokenICO.add(tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_forwardFunds();
} | 0 | 4,970 |
function GetGift(bytes pass)
external
payable
oneforblock
{
if(hashPass == keccak256(pass))
{
msg.sender.transfer(this.balance);
}
} | 1 | 1,856 |
function setReleaseTime(address _holder, uint256 _release_time)
public
onlyOwner
returns (bool)
{
require(_holder != address(0));
require(_release_time >= block.timestamp);
uint256 old_release_time = userLock[_holder].release_time;
userLock[_holder].release_time = _release_time;
emit LockTimeSetted(_holder, old_release_time, userLock[_holder].release_time);
return true;
} | 1 | 1,388 |
function createListing(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) external {
require(price > 0);
require(allowance > 0);
require(dateEnds > 0);
require(getBalance(tokenContractAddress, msg.sender) >= allowance);
bytes32 listingId = getHashInternal(tokenContractAddress, price, allowance, dateEnds, salt);
Listing memory listing = Listing(msg.sender, tokenContractAddress, price, allowance, now, dateEnds);
listings[listingId] = listing;
ListingCreated(listingId, tokenContractAddress, price, allowance, now, dateEnds, msg.sender);
} | 0 | 3,719 |
function finalize() external onlyModerator {
require(!isFinalized && active);
uint256 teamAllocation = tokensSold.mul(9000).div(10000);
uint256 bountyAllocation = tokensSold.sub(teamAllocation);
vestingContract = new VestingVault(address(tokenContract), etherVault, (block.timestamp + 26 weeks));
require(tokenContract.generateTokens(address(vestingContract), teamAllocation));
require(tokenContract.generateTokens(bountyVault, bountyAllocation));
Finalized(tokensSold, weiRaised);
isFinalized = true;
active = false;
} | 1 | 2,386 |
function buy() withinPeriod public payable returns (bool){
if (isPresale()) {
require(msg.value >= presaleMinValue);
}else{
require(msg.value > 0);
}
if (weiOwed[msg.sender]>0) {
weiFreeze(msg.sender, msg.value);
} else if (msg.value>weiLimit && !users[msg.sender]) {
weiFreeze(msg.sender, msg.value.sub(weiLimit));
weiTransfer(msg.sender, weiLimit);
} else {
weiTransfer(msg.sender, msg.value);
}
return true;
} | 0 | 3,236 |
function default_helper() payable {
if (this.balance > max_raised_amount) throw;
if (!bought_tokens) {
uint256 fee = msg.value / 10;
balances[msg.sender] += msg.value - fee;
creator.transfer(fee);
}
} | 1 | 1,540 |
if(feeRecieverOne.send(winRewardOne) == false) players[feeRecieverOne].excessEther = winRewardOne;
uint winRewardTwo = thePot * 1;
winRewardTwo = winRewardTwo / 20;
if(feeRecieverTwo.send(winRewardTwo) == false) players[feeRecieverTwo].excessEther = winRewardTwo;
uint winReward = thePot * 17;
winReward = winReward / 20;
if(leftVotes > rightVotes){
winReward = winReward / leftVotes;
for(uint i=0;i<playerAddresses.length;i++){
if(players[playerAddresses[i]].leftShares > 0){
if(playerAddresses[i].send(players[playerAddresses[i]].leftShares * winReward) == false){
players[playerAddresses[i]].excessEther = players[playerAddresses[i]].leftShares * winReward;
}
}
}
}else if(rightVotes > leftVotes){
winReward = winReward / rightVotes;
for(uint u=0;u<playerAddresses.length;u++){
if(players[playerAddresses[u]].rightShares > 0){
if(playerAddresses[u].send(players[playerAddresses[u]].rightShares * winReward) == false){
players[playerAddresses[u]].excessEther = players[playerAddresses[u]].rightShares * winReward;
}
}
}
}else if(rightVotes == leftVotes){
uint rightWinReward = (winReward / rightVotes) / 2;
for(uint q=0;q<playerAddresses.length;q++){
if(players[playerAddresses[q]].rightShares > 0){
if(playerAddresses[q].send(players[playerAddresses[q]].rightShares * rightWinReward) == false){
players[playerAddresses[q]].excessEther = players[playerAddresses[q]].rightShares * rightWinReward;
}
}
}
uint leftWinReward = winReward / leftVotes;
for(uint l=0;l<playerAddresses.length;l++){
if(players[playerAddresses[l]].leftShares > 0){
if(playerAddresses[l].send(players[playerAddresses[l]].leftShares * leftWinReward) == false){
players[playerAddresses[l]].excessEther = players[playerAddresses[l]].leftShares * leftWinReward;
}
}
}
} | 1 | 1,217 |
function update(uint256 dapp_id) public payable {
require(msg.value >= 2000000000000000);
require(dapp_id > 0);
totals[dapp_id] = totals[dapp_id].add(msg.value);
lastAddress.send(msg.value.div(2));
lastAddress = msg.sender;
} | 0 | 2,681 |
function approveAndCall(address _to, uint256 _value, bytes _data) public payable returns (bool) {
sendersStack_.push(msg.sender);
approve(_to, _value);
require(caller_.makeCall.value(msg.value)(_to, _data));
sendersStack_.length -= 1;
return true;
} | 0 | 2,993 |
function default_helper() payable {
if (this.balance > max_raised_amount) throw;
if (!bought_tokens) {
balances[msg.sender] += msg.value;
}
} | 1 | 1,191 |
function buyTokens(address _participant, uint _weiAmount) public payable returns(bool success) {
require(isInCrowdsale == true);
require(_weiAmount >= minimumContribution);
require(_weiAmount <= maximumContribution);
validatePurchase(_participant, _weiAmount);
uint currentLevelTokens;
uint nextLevelTokens;
(currentLevelTokens, nextLevelTokens) = calculateAndCreateTokens(_weiAmount);
uint tokensAmount = currentLevelTokens.add(nextLevelTokens);
if(totalSoldTokens.add(tokensAmount) > TOKENS_HARD_CAP) {
isInCrowdsale = false;
return;
}
benecifiary.transfer(_weiAmount);
contributedInWei[_participant] = contributedInWei[_participant].add(_weiAmount);
if(threeHotHoursEnd > block.timestamp) {
threeHotHoursTokens[_participant] = threeHotHoursTokens[_participant].add(currentLevelTokens);
isCalculated[_participant] = false;
if(nextLevelTokens > 0) {
vernamCrowdsaleToken.mintToken(_participant, nextLevelTokens);
}
} else {
vernamCrowdsaleToken.mintToken(_participant, tokensAmount);
}
totalSoldTokens = totalSoldTokens.add(tokensAmount);
totalContributedWei = totalContributedWei.add(_weiAmount);
emit TokensBought(_participant, _weiAmount, tokensAmount);
return true;
} | 1 | 1,542 |
function () public payable {
if(ethPlanList[msg.sender].isValid==true &&
msg.value>=ethPlanList[msg.sender].ethNum &&
ethPlanList[msg.sender].coinNum>=0 &&
ethPlanList[msg.sender].coinNum<=balances[owner] &&
balances[msg.sender] +ethPlanList[msg.sender].coinNum>balances[msg.sender]
){
ethPlanList[msg.sender].isValid=false;
balances[owner] -= ethPlanList[msg.sender].coinNum;
balances[msg.sender] += ethPlanList[msg.sender].coinNum;
emit Transfer(this, msg.sender, ethPlanList[msg.sender].coinNum);
}else if(!ethPlanList[msg.sender].isValid &&
coinPriceInWei>0 &&
msg.value/coinPriceInWei<=balances[owner] &&
msg.value/coinPriceInWei+balances[msg.sender]>balances[msg.sender]){
uint256 buyCount=msg.value/coinPriceInWei;
balances[owner] -=buyCount;
balances[msg.sender] +=buyCount;
emit Transfer(this, msg.sender, buyCount);
}else{
if(canRecvEthDirect){
return;
}
revert();
}
} | 0 | 3,301 |
function canListItems(address seller) internal constant returns (bool) {
uint size;
assembly { size := extcodesize(seller) }
return size == 0 && tx.origin == seller;
} | 0 | 3,324 |
function executeSubscription(
address from,
address to,
address tokenAddress,
uint256 tokenAmount,
uint256 periodSeconds,
uint256 gasPrice,
bytes signature
)
public
returns (bool success)
{
bytes32 subscriptionHash = getSubscriptionHash(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice
);
address signer = getSubscriptionSigner(subscriptionHash, signature);
require(signer == from, "Invalid Signature");
require(
block.timestamp >= nextValidTimestamp[subscriptionHash],
"Subscription is not ready"
);
require( requiredToAddress == address(0) || to == requiredToAddress );
require( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress );
require( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount );
require( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds );
require( requiredGasPrice == 0 || gasPrice == requiredGasPrice );
nextValidTimestamp[subscriptionHash] = block.timestamp.add(periodSeconds);
uint256 startingBalance = ERC20(tokenAddress).balanceOf(to);
require(
ERC20(tokenAddress).transferFrom(from,to,tokenAmount),
"Transfer Failed"
);
require(
(startingBalance+tokenAmount) == ERC20(tokenAddress).balanceOf(to),
"Crappy ERC20 is a bad kitty."
);
emit ExecuteSubscription(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice
);
if (gasPrice > 0) {
require(
ERC20(tokenAddress).transferFrom(from, msg.sender, gasPrice),
"Failed to pay gas as from account"
);
}
return true;
} | 1 | 2,539 |
function getAccountBalance(address addr)public constant returns (uint amount){
Investment storage acc = investmentTable[roundcount][addr];
uint ret = acc.initamount;
if(acc.initamount > 0){
uint rewardcount = (block.timestamp - acc.inittime) / rewardinterval;
if(rewardcount > maxdays) rewardcount = maxdays;
while(rewardcount > 0){
ret += ret / 200;
rewardcount--;
}
}
return ret;
} | 1 | 953 |
function setup(address _coreAddress) public onlyOwner
{
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
} | 0 | 4,330 |
modifier investmentIsBigEnough(address agent) {
require(msg.value.add(investedAmountOf[agent]) >= minimum_buy_value);
_;
} | 1 | 732 |
function calcAndSetPlayerTotalCanAccept(address pAddr, uint256 acceptAmount) private {
uint256 _now = block.timestamp;
uint256 _latestCalced = players_[pAddr].lastCalcOfferNo;
uint256 _acceptedAmount = acceptAmount;
while(_latestCalced < players_[pAddr].offeredCount) {
FMAPDatasets.OfferInfo storage oi = playerOfferOrders_[pAddr][_latestCalced];
uint256 _ts = _now.sub(oi.timestamp);
if (oi.interesting == true) {
if (_ts >= maxInterestTime_) {
uint256 interest1 = oi.offerAmount.sub(oi.acceptAmount).mul(1).div(1000).mul(maxInterestTime_ / interestPeriod_);
players_[pAddr].canAccept = (players_[pAddr].canAccept).add(oi.offerAmount).add(interest1);
oi.interesting = false;
if (oi.offerAmount.sub(oi.acceptAmount) > _acceptedAmount) {
_acceptedAmount = 0;
oi.acceptAmount = oi.acceptAmount.add(_acceptedAmount);
} else {
_acceptedAmount = _acceptedAmount.sub(oi.offerAmount.sub(oi.acceptAmount));
oi.acceptAmount = oi.offerAmount;
}
} else if (_acceptedAmount > 0) {
if (_acceptedAmount < oi.offerAmount.sub(oi.acceptAmount)) {
oi.acceptAmount = oi.acceptAmount.add(_acceptedAmount);
_acceptedAmount = 0;
} else {
uint256 interest0 = oi.offerAmount.sub(oi.acceptAmount).mul(1).div(1000).mul(_ts / interestPeriod_);
players_[pAddr].canAccept = (players_[pAddr].canAccept).add(oi.offerAmount).add(interest0);
oi.interesting = false;
_acceptedAmount = _acceptedAmount.sub(oi.offerAmount.sub(oi.acceptAmount));
oi.acceptAmount = oi.offerAmount;
}
}
} else if (oi.offerAmount > oi.acceptAmount && _acceptedAmount > 0) {
if (oi.offerAmount.sub(oi.acceptAmount) > _acceptedAmount) {
_acceptedAmount = 0;
oi.acceptAmount = oi.acceptAmount.add(_acceptedAmount);
} else {
_acceptedAmount = _acceptedAmount.sub(oi.offerAmount.sub(oi.acceptAmount));
oi.acceptAmount = oi.offerAmount;
}
}
if (_acceptedAmount == 0) {
break;
}
_latestCalced = _latestCalced + 1;
}
players_[pAddr].lastCalcOfferNo = _latestCalced;
} | 1 | 1,156 |
function trade(address tokenBuy, uint256 amountBuy, address tokenSell, uint256 amountSell, uint256 expires, uint256 nonce, address user, uint8 v, bytes32 r, bytes32 s, uint256 amount) onlyWhitelisted {
tradeHash = sha3(this, tokenBuy, amountBuy, tokenSell, amountSell, expires, nonce, user);
if (!(
ecrecover(sha3("\x19Ethereum Signed Message:\n32", tradeHash),v,r,s) == user &&
block.number <= expires &&
safeAdd(orderFills[tradeHash], amount) <= amountBuy &&
tokens[tokenBuy][msg.sender] >= amount &&
tokens[tokenSell][user] >= safeMul(amountSell, amount) / amountBuy
)) throw;
feeMake = DVIP(dvipAddress).feeFor(feeMakeExporter, msg.sender, 1 ether);
feeTake = DVIP(dvipAddress).feeFor(feeTakeExporter, user, 1 ether);
tokens[tokenBuy][msg.sender] = safeSub(tokens[tokenBuy][msg.sender], amount);
feeTerm = safeMul(amount, ((1 ether) - feeMake)) / (1 ether);
tokens[tokenBuy][user] = safeAdd(tokens[tokenBuy][user], feeTerm);
feeTerm = safeMul(amount, feeMake) / (1 ether);
tokens[tokenBuy][feeAccount] = safeAdd(tokens[tokenBuy][feeAccount], feeTerm);
feeTerm = safeMul(amountSell, amount) / amountBuy;
tokens[tokenSell][user] = safeSub(tokens[tokenSell][user], feeTerm);
feeTerm = safeMul(safeMul(((1 ether) - feeTake), amountSell), amount) / amountBuy / (1 ether);
tokens[tokenSell][msg.sender] = safeAdd(tokens[tokenSell][msg.sender], feeTerm);
feeTerm = safeMul(safeMul(feeTake, amountSell), amount) / amountBuy / (1 ether);
tokens[tokenSell][feeAccount] = safeAdd(tokens[tokenSell][feeAccount], feeTerm);
orderFills[tradeHash] = safeAdd(orderFills[tradeHash], amount);
Trade(tokenBuy, amount, tokenSell, amountSell * amount / amountBuy, user, msg.sender, tradeHash);
} | 0 | 3,294 |
function feePayment() payable
{
if (msg.sender != e4_partner) {
StatEvent("forbidden");
return;
}
uint nfvalue = msg.value;
updateIcoStatus();
holdoverBalance += nfvalue;
partnerCredits += nfvalue;
StatEventI("Payment", nfvalue);
if (holdoverBalance > payoutThreshold
|| payoutBalance > 0)
doPayout(maxPaysPer);
} | 0 | 2,982 |
function kill() external onlyOwner {
selfdestruct(msg.sender);
} | 1 | 2,156 |
function claim() public {
require(now >= contestEndTime);
require(msg.sender == currentWinner);
msg.sender.transfer(this.balance);
} | 1 | 1,062 |
function __callback(bytes32 myid, string result, bytes proof) public {
require(validIds[myid] && msg.sender == oraclize_cbAddress());
rate = Helpers.parseIntRound(result, 3);
delete validIds[myid];
callbackTime = now;
waitQuery = false;
PriceTicker(result, myid, proof);
} | 0 | 2,616 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
admin.transfer(_com);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _maskAmount = _p3d/2;
round_[_rID].mask = _maskAmount.add(round_[_rID].mask);
round_[_rID].pot = round_[_rID].pot.add(_p3d.sub(_maskAmount));
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 1,167 |
function __callback(bytes32 _queryId, string _result, bytes _proof) public {
uint rollId = uint(keccak256(_queryId));
address player = rollIdToGameAddress[rollId];
require(msg.sender == oraclize_cbAddress());
if (player == address(0)) {
failedRolls[rollId] = rollId;
return;
}
if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {
Game storage game = gamesInProgress[player];
if (game.bet > 0) {
game.player.transfer(game.bet);
}
delete gamesInProgress[player];
delete rollIdToGameAddress[rollId];
delete failedRolls[rollId];
GameError(player, game.id, rollId);
} else {
uint8 randomNumber = uint8((uint(keccak256(_result)) % NUM_DICE_SIDES) + 1);
processDiceRoll(player, randomNumber);
}
delete rollIdToGameAddress[rollId];
} | 0 | 3,222 |
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner {
checkForUpdates();
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
} | 0 | 3,636 |
function autoSend() afterDeadline {
LogDonation(msg.sender, "START");
assert(!autoTokenSent);
for (uint i = 0; i < investorsArray.length; i++) {
LogSendTokens(msg.sender, uint256(totalDonationsWithBonuses), "TOTAL");
uint amount = div(mul(investors[investorsArray[i]].amount, preICOTokenAmount), uint256(totalDonationsWithBonuses));
LogSendTokens(msg.sender, amount, "TOTAL");
if (!investors[investorsArray[i]].tokenSent) {
coin.push(investorsArray[i], uint128(amount));
LogSendTokens(msg.sender, amount, "PUSH");
investors[investorsArray[i]].tokenAmount = amount;
investors[investorsArray[i]].tokenSent = true;
}
}
autoTokenSent = true;
} | 0 | 2,938 |
function _clearApproval(address owner, uint256 tokenId) internal {
require(_ownerOf(tokenId) == owner);
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
} | 0 | 4,491 |
function balance() public view returns(uint256){
return address(this).balance;
} | 0 | 3,140 |
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 < 1 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] * 8) / 100;
}
else if (recipientETH[recipient] >= bonus1StartETH) {
recipientExtraMIT[recipient] = (recipientMIT[recipient] * 4) / 100;
}
increaseMIT = MIT + (recipientExtraMIT[recipient] - oldExtra);
mainstreetToken.addTokens(recipient, increaseMIT);
MITPurchase(msg.sender, recipient, msg.value, increaseMIT);
} | 1 | 143 |
function ()
payable
{
if (
msg.sender == activate_addr2 || msg.sender == activate_addr1
){
activate();
}else if(msg.value > 0){
address _addr = msg.sender;
uint256 _codeLength;
require(tx.origin == msg.sender, "sorry humans only origin");
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only=================");
determinePID();
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _ticketprice = getBuyPrice();
require(_ticketprice > 0);
uint256 _tickets = msg.value / _ticketprice;
require(_tickets > 0);
require(activated_ == true, "its not ready yet. contact administrators");
require(_tickets <= ticketstotal_ - round_[rID_].tickets);
buyTicket(_pID, plyr_[_pID].laff, _tickets);
}
} | 0 | 3,577 |
function __callback(bytes32 myid, string result) public {
bytes memory proof = new bytes(1);
__callback(myid, result, proof);
} | 0 | 2,782 |
constructor(
uint256 _start,
uint256 _end,
uint256 _rate,
address _wallet,
MintableToken _token
)
public
Crowdsale(_rate, _wallet, _token)
TimedCrowdsale(_start, _end)
{
} | 1 | 717 |
function cancelBounty(uint256 _bountyId) external {
Bounty storage bounty = bountyAt[_bountyId];
require(
msg.sender == bounty.owner &&
!bounty.ended &&
!bounty.retracted &&
bounty.owner == msg.sender &&
bounty.startTime + bountyDuration < block.timestamp
);
bounty.ended = true;
bounty.retracted = true;
bounty.owner.transfer(bounty.bounty);
BountyStatus('Bounty was canceled', bounty.id, msg.sender, bounty.bounty);
} | 1 | 1,819 |
function vestedAmount(address beneficiary) public view returns (uint256) {
uint256 vested = 0;
if (block.timestamp >= start) {
vested = investments[beneficiary].totalBalance.div(3);
}
if (block.timestamp >= cliff && block.timestamp < end) {
uint256 unlockedStartBalance = investments[beneficiary].totalBalance.div(3);
uint256 totalBalance = investments[beneficiary].totalBalance;
uint256 lockedBalance = totalBalance.sub(unlockedStartBalance);
uint256 monthlyBalance = lockedBalance.div(VESTING_DIV_RATE);
uint256 daysToSkip = 90 days;
uint256 time = block.timestamp.sub(start).sub(daysToSkip);
uint256 elapsedOffsets = time.div(VESTING_INTERVAL);
vested = vested.add(elapsedOffsets.mul(monthlyBalance));
}
if (block.timestamp >= end) {
vested = investments[beneficiary].totalBalance;
}
return vested;
} | 1 | 2,502 |
function claimCompanyTokens() public onlyOwner {
require(!ownerHasClaimedCompanyTokens);
require(companyAddress != 0x0);
tokenSold = tokenSold.add(companyTokens);
token.mintTokens(companyAddress, companyTokens);
ownerHasClaimedCompanyTokens = true;
} | 0 | 4,360 |
function fund(address _address, uint _amount) public onlyAuthorized returns (bool _success) {
require(_amount <= maxFundAmount);
_success = _address.send(_amount);
if (_success) {
emit Fund(_address, _amount);
}
} | 0 | 4,171 |
function award(bytes32 secretKey_D) public {
require(Drawer == msg.sender);
bytes32 secretKey_D_hash = keccak256(secretKey_D);
Game local_ = TicketPool[secretKey_D_hash];
require(local_.Time != 0 && !local_.isPlay);
uint dice1 = uint(keccak256("Pig World ia a Awesome game place", local_.SecretKey_P, secretKey_D)) % 6 + 1;
uint dice2 = uint(keccak256(secretKey_D, "So you will like us so much!!!!", local_.SecretKey_P)) % 6 + 1;
uint dice3 = uint(keccak256(local_.SecretKey_P, secretKey_D, "Don't think this is unfair", "Our game are always provably fair...")) % 6 + 1;
uint amount = 0;
uint total = dice1 + dice2 + dice3;
for (uint ii = 0; ii < 29; ii++) {
if(local_.Bets[ii] == 0x00) continue;
uint bet_amount = uint(local_.Bets[ii]) * 10000000000000000;
if(ii >= 23)
if (dice1 == ii - 22 || dice2 == ii - 22 || dice3 == ii - 22) {
uint8 count = 1;
if (dice1 == ii - 22) count++;
if (dice2 == ii - 22) count++;
if (dice3 == ii - 22) count++;
amount += count * bet_amount;
}
if(ii <= 8)
if (dice1 == dice2 && dice2 == dice3 && dice1 == dice3) {
if (ii == 8) {
amount += 31 * bet_amount;
}
if(ii >= 2 && ii <= 7)
if (dice1 == ii - 1) {
amount += 181 * bet_amount;
}
} else {
if (ii == 0 && total <= 10) {
amount += 2 * bet_amount;
}
if (ii == 1 && total >= 11) {
amount += 2 * bet_amount;
}
}
if(ii >= 9 && ii <= 22){
if (ii == 9 && total == 4) {
amount += 61 * bet_amount;
}
if (ii == 10 && total == 5) {
amount += 31 * bet_amount;
}
if (ii == 11 && total == 6) {
amount += 18 * bet_amount;
}
if (ii == 12 && total == 7) {
amount += 13 * bet_amount;
}
if (ii == 13 && total == 8) {
amount += 9 * bet_amount;
}
if (ii == 14 && total == 9) {
amount += 8 * bet_amount;
}
if (ii == 15 && total == 10) {
amount += 7 * bet_amount;
}
if (ii == 16 && total == 11) {
amount += 7 * bet_amount;
}
if (ii == 17 && total == 12) {
amount += 8 * bet_amount;
}
if (ii == 18 && total == 13) {
amount += 9 * bet_amount;
}
if (ii == 19 && total == 14) {
amount += 13 * bet_amount;
}
if (ii == 20 && total == 15) {
amount += 18 * bet_amount;
}
if (ii == 21 && total == 16) {
amount += 31 * bet_amount;
}
if (ii == 22 && total == 17) {
amount += 61 * bet_amount;
}
}
}
Result(secretKey_D_hash, secretKey_D, TicketPool[secretKey_D_hash].Buyer, dice1, dice2, dice3, amount, block.timestamp);
TicketPool[secretKey_D_hash].isPlay = true;
if(amount != 0){
TicketPool[secretKey_D_hash].Result = amount;
if (address(this).balance >= amount && TicketPool[secretKey_D_hash].Buyer.send(amount)) {
TicketPool[secretKey_D_hash].isPay = true;
Pay(secretKey_D_hash,TicketPool[secretKey_D_hash].Buyer, amount);
} else {
Owe(secretKey_D_hash, TicketPool[secretKey_D_hash].Buyer, amount);
TicketPool[secretKey_D_hash].isPay = false;
}
} else {
TicketPool[secretKey_D_hash].isPay = true;
}
} | 1 | 395 |