func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function withdraw()
isActivated()
senderVerify()
playerVerify()
public
{
uint256 _rId = rId;
uint256 _sId = sId;
uint256 _amount;
uint256 _playerWithdrawAmountFlag;
(_amount, player[msg.sender].withdrawRid, player[msg.sender].withdrawSid, _playerWithdrawAmountFlag) = getPlayerDividendByStage(_rId, _sId, msg.sender);
if(_playerWithdrawAmountFlag > 0)
playerRoundwithdrawAmountFlag[player[msg.sender].withdrawRid][msg.sender] = _playerWithdrawAmountFlag;
if(player[msg.sender].promotionAmount > 0 ){
_amount = _amount.add(player[msg.sender].promotionAmount);
player[msg.sender].promotionAmount = 0;
}
msg.sender.transfer(_amount);
} | 0 | 4,897 |
function verifyBlockAuxPoW(
BlockInfo storage blockInfo,
bytes32 blockHash,
bytes blockHeader
) internal returns (uint, bytes) {
(uint err, bool isMergeMined) =
SyscoinMessageLibrary.verifyBlockHeader(blockHeader, 0, uint(blockHash));
if (err != 0) {
return (err, new bytes(0));
}
bytes memory powBlockHeader = (isMergeMined) ?
SyscoinMessageLibrary.sliceArray(blockHeader, blockHeader.length - 80, blockHeader.length) :
SyscoinMessageLibrary.sliceArray(blockHeader, 0, 80);
blockInfo.timestamp = SyscoinMessageLibrary.getTimestamp(blockHeader);
blockInfo.bits = SyscoinMessageLibrary.getBits(blockHeader);
blockInfo.prevBlock = bytes32(SyscoinMessageLibrary.getHashPrevBlock(blockHeader));
blockInfo.blockHash = blockHash;
blockInfo.powBlockHeader = powBlockHeader;
return (ERR_SUPERBLOCK_OK, powBlockHeader);
} | 0 | 3,495 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require (block.number > tokenFrozenUntilBlock);
require (!restrictedAddresses[_to]);
require(balances[_from] >= _value);
require (balances[_to] + _value >= balances[_to]);
require (_value <= allowances[_from][msg.sender]);
require (!(_from == owner && block.timestamp < timeLock && (balances[_from]-_value) < 10000000 * 10 ** 18));
balances[_from] -= _value;
balances[_to] += _value;
allowances[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} | 1 | 285 |
function depositToken(address _token, uint _amount) public whenNotPaused {
require(_token != address(0));
require(ERC20(_token).transferFrom(msg.sender, this, _amount));
tokens[_token][msg.sender] = SafeMath.add(tokens[_token][msg.sender], _amount);
emit Deposit(_token, msg.sender, _amount, tokens[_token][msg.sender]);
} | 0 | 5,140 |
function BFreeContract() {
preIcoIsRunning = true;
minimalGoalReached = false;
icoExitIsPossible = false;
icoIsClosed = false;
tokenBalanceOf[this] += _totalSupply;
allowed[this][owner] = _totalSupply;
allowed[this][supervisor] = _totalSupply;
currentTokenPrice = 0.024340770791075100 * 1 ether;
preICOprice = 0.024340770791075100 * 1 ether;
ICOprice = 0.040567951318458400 * 1 ether;
sellPrice = 0;
updatePrices();
} | 0 | 4,635 |
modifier onlyAllowedMultivests(address _addresss) {
require(allowedMultivests[_addresss] == true);
_;
} | 1 | 2,332 |
function openLottery(uint8 _viewId) public returns(uint8,uint8) {
uint8 viewId = _viewId;
require(viewId < 7);
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],1);
}
if (lastBlockNumber == block.number) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],2);
}
if (currentGene == 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
if (this._isCarousal(currentTerm)) {
revert();
}
uint8 luckyNum = 0;
uint256 bonusBalance = dogCore.getAvailableBlance();
if (currentGene == 6) {
if (bonusBalance <= SpoolAmount) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, 0, 0);
return (clottery.luckyGenes[viewId],3);
}
luckyNum = random(8);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, block.number, bonusBalance);
currentGene = 0;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBalance;
lastBlockNumber = block.number;
} else {
luckyNum = random(12);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, 0, 0);
currentGene ++;
lastBlockNumber = block.number;
}
return (luckyNum,0);
} | 0 | 2,717 |
function _transfer(address _from, address _to, uint _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);
} | 1 | 2,079 |
function getPayeeIndex(bytes32 _requestId, address _address)
public
view
returns(int16)
{
if (requests[_requestId].payee.addr == _address) {
return 0;
}
for (uint8 i = 0; subPayees[_requestId][i].addr != address(0); i = i.add(1)) {
if (subPayees[_requestId][i].addr == _address) {
return i+1;
}
}
return -1;
} | 0 | 3,389 |
function() payable external {
if(!funding) throw;
if(block.timestamp < fundingStart) throw;
if(msg.value == 0) throw;
var numTokens = msg.value * getExchangeRate(msg.sender);
totalTokens += numTokens;
balances[msg.sender] += numTokens;
balancesEther[msg.sender] += msg.value;
totalParticipants+=1;
Transfer(0, msg.sender, numTokens);
} | 1 | 722 |
modifier with public visibility as this function
function performBuyOrder(
OrderData data,
uint256 amountToGiveForOrder
)
public
payable
whenNotPaused
onlyTotle
returns (uint256 amountSpentOnOrder, uint256 amountReceivedFromOrder)
{
if (data.takerAmount != amountToGiveForOrder || msg.value != data.takerAmount) {
msg.sender.transfer(msg.value);
return (0,0);
}
fillAndValidate(data);
if (!ERC20SafeTransfer.safeTransfer(data.makerToken, msg.sender, data.makerAmount)) {
errorReporter.revertTx("AirSwap: Unable to transfer bought tokens to primary");
}
return (data.takerAmount, data.makerAmount);
} | 1 | 951 |
function Minexo () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
} | 0 | 4,546 |
function refund_me() {
if (!bought_tokens) {
if (block.number < min_refund_block) throw;
}
uint256 eth_to_withdraw = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(eth_to_withdraw);
} | 1 | 2,262 |
function freezeCheck(address _from, uint256 _value) returns (bool) {
uint forbiddenPremine = launch_date - block.timestamp + total_freeze_term;
if (forbiddenPremine > 0) {
require(balances[_from] >= _value.add( frozenAccount[_from] * forbiddenPremine / total_freeze_term) );
}
return true;
} | 1 | 989 |
function sendTokensToFounders() onlyManager whenInitialized {
require(!sentTokensToFounders && now >= foundersRewardTime);
uint tokensSold = add(totalSoldOnICO, totalSoldOnPresale);
uint totalTokenToSold = add(ICOCap, presaleCap);
uint x = mul(mul(tokensSold, totalCap), 35);
uint y = mul(100, totalTokenToSold);
uint result = div(x, y);
VINToken.emitTokens(founder, result);
sentTokensToFounders = true;
} | 0 | 3,212 |
function getAllCurrencyTicker() public view returns(string) {
string memory _tickers = "{";
for (uint i = 0; i < currencyTicker.length; i++) {
_tickers = strConcat(_tickers, strConcat("\"", bytes32ToString(currencyTicker[i]), "\":"), uint2str(currencyList[currencyTicker[i]].usd), (i+1 < currencyTicker.length) ? "," : "}");
}
return _tickers;
} | 1 | 1,759 |
function BliBliToken(
address _ethFundDeposit,
uint256 _currentSupply)
{
ethFundDeposit = _ethFundDeposit;
isFunding = false;
fundingStartBlock = 0;
fundingStopBlock = 0;
currentSupply = formatDecimals(_currentSupply);
totalSupply = formatDecimals(10000000);
balances[msg.sender] = totalSupply;
if(currentSupply > totalSupply) throw;
} | 0 | 4,278 |
function buyTPT(uint256 _TPTprice,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external {
require(_expiration >= block.timestamp);
address signer = ecrecover(keccak256(_TPTprice, _expiration), _v, _r, _s);
require(signer == neverdieSigner);
uint256 a = SafeMath.div(SafeMath.mul(msg.value, 10**18), _TPTprice);
assert(tpt.transfer(msg.sender, a));
BuyTPT(msg.sender, _TPTprice, msg.value, a);
} | 1 | 1,724 |
function party() {
require (block.timestamp > partyTime && hodlers[msg.sender] > 0);
uint value = hodlers[msg.sender];
uint amount = value/100;
hodlers[msg.sender] = 0;
msg.sender.transfer(amount);
Party(msg.sender, amount);
partyTime = partyTime + 120;
} | 1 | 341 |
function changeOraclizeProofType(byte _proofType)
onlyOwner {
if (_proofType == 0x0) throw;
oraclize_setProof( _proofType | proofStorage_IPFS );
} | 0 | 3,701 |
function getBonusTier() internal returns (uint256) {
bool firstBonusSalesPeriod = now >= startDate && now <= firstBonusSalesEnds;
bool secondBonusSalesPeriod = now > firstBonusSalesEnds && now <= secondBonusSalesEnds;
bool thirdBonusSalesPeriod = now > secondBonusSalesEnds && now <= thirdBonusSalesEnds;
bool fourthBonusSalesPeriod = now > thirdBonusSalesEnds && now <= fourthBonusSalesEnds;
bool fifthBonusSalesPeriod = now > fourthBonusSalesEnds && now <= fifthBonusSalesEnds;
bool firstExtendedBonusSalesPeriod = now > fifthBonusSalesEnds && now <= firstExtendedBonusSalesEnds;
bool secondExtendedBonusSalesPeriod = now > firstExtendedBonusSalesEnds && now <= secondExtendedBonusSalesEnds;
bool thirdExtendedBonusSalesPeriod = now > secondExtendedBonusSalesEnds && now <= thirdExtendedBonusSalesEnds;
bool fourthExtendedBonusSalesPeriod = now > thirdExtendedBonusSalesEnds && now <= fourthExtendedBonusSalesEnds;
bool fifthExtendedBonusSalesPeriod = now > fourthExtendedBonusSalesEnds && now <= fifthExtendedBonusSalesEnds;
bool sixthExtendedBonusSalesPeriod = now > fifthExtendedBonusSalesEnds && now <= sixthExtendedBonusSalesEnds;
if (firstBonusSalesPeriod || firstExtendedBonusSalesPeriod) return 20;
if (secondBonusSalesPeriod || secondExtendedBonusSalesPeriod) return 15;
if (thirdBonusSalesPeriod || thirdExtendedBonusSalesPeriod) return 10;
if (fourthBonusSalesPeriod || fourthExtendedBonusSalesPeriod) return 5;
if (fifthBonusSalesPeriod || fifthExtendedBonusSalesPeriod) return 0;
if (sixthExtendedBonusSalesPeriod) {
uint256 DAY_IN_SECONDS = 86400;
uint256 secondsSinceStartDate = SafeMath.sub(now, startDate);
uint256 numberOfDays = secondsSinceStartDate / DAY_IN_SECONDS;
return SafeMath.sub(numberOfDays, 60);
}
} | 1 | 688 |
function fillSellOrder(uint _key) public payable {
uint order = orderBook.get(_key);
ORDER_TYPE orderType = ORDER_TYPE(order >> 254);
require(orderType == ORDER_TYPE.SELL, "This is not a sell order");
uint index = addressRegister(msg.sender);
require(index != (order << 2) >> 224, "You cannot fill your own order");
uint price = (order << 34) >> 145;
uint amount = (order << 145) >> 145;
uint orderFee = feeForOrder(price, amount);
require(feeBalances[index] >= orderFee, "You do not have enough deposited fees to fill this order");
uint cost = price.mul(amount).div(1 ether);
require(msg.value == cost, "ETH sent needs to equal the cost");
require(orderBook.remove(_key), "Map remove failed");
addressRegistry[(order << 2) >> 224].transfer(msg.value);
poolOwners.sendOwnership(msg.sender, amount);
if (orderFee > 0) {
feeBalances[index] = feeBalances[index].sub(orderFee);
feeBalances[0] = feeBalances[0].add(orderFee);
lockedFees = lockedFees.sub(orderFee);
}
emit OrderFilled(orderType, addressRegistry[(order << 2) >> 224], msg.sender, price, amount);
} | 0 | 3,432 |
function distributeUnlockedInvestorsReserve() public onlyOwner {
uint arrayLength;
uint i;
arrayLength = unLockedInvestorsIndices.length;
for (i = 0; i < arrayLength; i++) {
claimTokenReserve(unLockedInvestorsIndices[i]);
}
} | 1 | 966 |
function() external payable {
sendtoken = (msg.value)/cost1token;
if (msg.value >= 5 ether) {
sendtoken = (msg.value)/cost1token;
sendtoken = sendtoken*3/2;
}
if (msg.value >= 15 ether) {
sendtoken = (msg.value)/cost1token;
sendtoken = sendtoken*2;
}
if (msg.value >= 25 ether) {
sendtoken = (msg.value)/cost1token;
sendtoken = sendtoken*3;
}
tokenReward.transferFrom(owner, msg.sender, sendtoken);
ether10 = (msg.value)/10;
ether90 = (msg.value)-ether10;
owner.transfer(ether90);
owner10.transfer(ether10);
} | 0 | 4,922 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
if (block.timestamp < presaleEnd) tokens = tokens.mul(100).div(75);
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
} | 1 | 2,203 |
function halvingSubsidy(uint256 _halving)
public
constant
notBeforeGenesis
returns(uint256)
{
uint256 startBlock = halvingStartBlock(_halving);
return blockSubsidy(startBlock).mul(subsidyHalvingInterval);
} | 0 | 2,713 |
function _createUnicorn(address _owner) private returns(uint256) {
require(gen0Count < gen0Limit);
uint256 newUnicornId = unicornToken.createUnicorn(_owner);
blackBox.createGen0.value(unicornManagement.oraclizeFee())(newUnicornId);
emit CreateUnicorn(_owner, newUnicornId, 0, 0);
gen0Count = gen0Count.add(1);
return newUnicornId;
} | 0 | 4,593 |
function setHardCap(uint _hardcap) public onlyOwner {
hardcap = _hardcap;
} | 0 | 3,572 |
function resolveChallenge(bytes32 _listingHash) private {
uint challengeID = listings[_listingHash].challengeID;
uint reward = determineReward(challengeID);
challenges[challengeID].resolved = true;
challenges[challengeID].totalTokens =
voting.getTotalNumberOfTokensForWinningOption(challengeID);
if (voting.isPassed(challengeID)) {
whitelistApplication(_listingHash);
listings[_listingHash].unstakedDeposit = listings[_listingHash].unstakedDeposit.add(reward);
totalStaked[listings[_listingHash].owner] = totalStaked[listings[_listingHash].owner].add(reward);
emit _ChallengeFailed(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
}
else {
resetListing(_listingHash);
require(token.transfer(challenges[challengeID].challenger, reward));
emit _ChallengeSucceeded(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
}
} | 1 | 1,990 |
function Getether() {
owner = msg.sender;
} | 0 | 4,120 |
function getScore(address who) external constant returns (int score) {
RatingStore store = RatingStore(storageAddress);
int cumulative;
uint ratings;
(cumulative, ratings) = store.get(who);
score = cumulative / int(ratings);
} | 0 | 4,273 |
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
asserts(c >= a);
return c;
} | 0 | 4,939 |
function createTradeContract(
address _asset,
uint256 _sellPrice,
uint256 _units,
bool _sellsTokens
) returns (address)
{
if(_units == 0) throw;
address trader = new TokenTrader (
_asset,
_sellPrice,
_units,
_sellsTokens);
var bookid = sha3(_asset,_units);
_verify[trader] = true;
TokenTrader(trader).transferOwnership(msg.sender);
if(pairExits[bookid] == false) {
pairExits[bookid] = true;
NewBook(bookid, _asset, _units);
}
TradeListing(bookid,msg.sender,trader);
} | 0 | 3,600 |
function buySprite (uint spriteId) payable {
uint _ownerCut;
uint _charityCut;
if (broughtSprites[spriteId].forSale == true) {
_ownerCut = ((broughtSprites[spriteId].price / 1000) * ownerCut);
_charityCut = ((broughtSprites[spriteId].price / 1000) * charityCut);
require (msg.value == broughtSprites[spriteId].price + _ownerCut + _charityCut);
broughtSprites[spriteId].owner.transfer(broughtSprites[spriteId].price);
numberOfSpritesOwnedByUser[broughtSprites[spriteId].owner]--;
if (broughtSprites[spriteId].timesTraded == 0) {
allPurchasedSprites.push(spriteId);
}
Transfer (msg.sender, broughtSprites[spriteId].owner, spriteId);
} else {
require (broughtSprites[spriteId].timesTraded == 0);
require (broughtSprites[spriteId].price == 0);
uint priceIfAny = SaleClockAuction(SaleClockAuctionAddress).getCurrentPrice(spriteId);
require (priceIfAny > 0);
_ownerCut = ((priceIfAny / 1000) * ownerCut) * priceMultiplier / priceDivider;
_charityCut = ((priceIfAny / 1000) * charityCut) * priceMultiplier / priceDivider;
require (msg.value >= (priceIfAny * priceMultiplier / priceDivider) + _ownerCut + _charityCut);
var (kittyOwner,,,,) = SaleClockAuction(SaleClockAuctionAddress).getAuction(spriteId);
kittyOwner.transfer(priceIfAny * priceMultiplier / priceDivider);
allPurchasedSprites.push(spriteId);
broughtSprites[spriteId].spriteImageID = uint(block.blockhash(block.number-1))%360 + 1;
Transfer (kittyOwner, msg.sender, spriteId);
}
totalBuys++;
spriteOwningHistory[msg.sender].push(spriteId);
numberOfSpritesOwnedByUser[msg.sender]++;
broughtSprites[spriteId].owner = msg.sender;
broughtSprites[spriteId].forSale = false;
broughtSprites[spriteId].timesTraded++;
broughtSprites[spriteId].featured = false;
etherForOwner += _ownerCut;
etherForCharity += _charityCut;
} | 0 | 4,924 |
function mint() public {
bool result = mv.verifyTx(
proofs[msg.sender].a,
proofs[msg.sender].a_p,
proofs[msg.sender].b,
proofs[msg.sender].b_p,
proofs[msg.sender].c,
proofs[msg.sender].c_p,
proofs[msg.sender].h,
proofs[msg.sender].k,
msg.sender);
require(result);
bytes8 d = mv.getInputBits(0, msg.sender);
bytes8 z = mv.getInputBits(64, msg.sender);
for (uint i=0; i<zCount; i++) {
require(ds[i]!= d);
}
zs[zCount] = z;
ds[zCount++] = d;
bytes8 root = merkle(0,0);
currentRootIndex = roots.push(root)-1;
} | 0 | 5,182 |
function enter() {
if (msg.value < 1/100 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 10 ether) {
msg.sender.send(msg.value - 10 ether);
amount = 10 ether;
}
else {
amount = msg.value;
}
if (niceGuy < 10){
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
niceGuy += 1;
}
else {
owner = msg.sender;
niceGuy = 0;
return;
}
if (idx != 0) {
collectedFees += amount / 10;
owner.send(collectedFees);
collectedFees = 0;
balance += amount - amount / 10;
}
else {
balance += amount;
}
while (balance > persons[payoutIdx].amount / 100 * 125) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 125;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 0 | 4,296 |
function finalize()
external
whenNotFinalized
{
if (msg.sender != ethFundDeposit) throw;
if (now <= endTime && totalSupply != tokenGenerationCap) throw;
isFinalized = true;
if(!ethFundDeposit.send(this.balance)) throw;
} | 1 | 385 |
function getBonusMultiplier(uint256 _weiAmount) internal view returns (uint256) {
if (isMainSaleRunning()) {
return 100;
}
else if (isPreSaleRunning()) {
if (_weiAmount >= PRE_SALE_30_BONUS_MIN) {
return 130;
}
else if (_weiAmount >= PRE_SALE_20_BONUS_MIN) {
return 120;
}
else if (_weiAmount >= PRE_SALE_15_BONUS_MIN) {
return 115;
}
else if (_weiAmount >= PRE_SALE_MIN_ETHER) {
return 110;
}
else {
revert();
}
}
} | 0 | 5,132 |
function TokenVault(address _owner, uint _freezeEndsAt, StandardTokenExt _token, uint _tokensToBeAllocated) {
owner = _owner;
if(owner == 0) {
throw;
}
token = _token;
if(!token.isToken()) {
throw;
}
if(_freezeEndsAt == 0) {
throw;
}
if(_tokensToBeAllocated == 0) {
throw;
}
freezeEndsAt = _freezeEndsAt;
tokensToBeAllocated = _tokensToBeAllocated;
} | 0 | 4,756 |
function () payable{
if (block.number - period >= blockheight){
bool isSuccess=false;
var nextStake = this.balance * WINNERTAX_PRECENT/100;
if (isSuccess == false)
isSuccess = whale.send(this.balance - nextStake);
MatthewWon("Matthew won", whale, this.balance, block.number);
setFacts();
if (mustBeDestroyed) selfdestruct(whale);
return;
}else{
if (msg.value < this.balance + DELTA) throw;
bool isOtherSuccess = msg.sender.send(this.balance);
setFacts();
StakeIncreased("stake increased", whale, this.balance, blockheight);
}
} | 1 | 536 |
function explodePhoenix(uint256 _phoenixId) whenNotPaused public {
Phoenix phoenix = phoenixes[_phoenixId];
require(msg.sender == phoenix.currentOwner);
require(PHOENIX_POOL > 0);
require(now >= phoenix.nextExplosionTime);
uint256 payout = phoenix.explosivePower.mul(PHOENIX_POOL).div(EXPLOSION_DENOMINATOR);
PHOENIX_POOL = PHOENIX_POOL.sub(payout);
if (phoenix.price >= PRICE_CUTOFF) {
phoenix.price = phoenix.price.mul(HIGHER_PRICE_RESET_PERCENTAGE).div(100);
} else {
phoenix.price = phoenix.price.mul(LOWER_PRICE_RESET_PERCENTAGE).div(100);
if (phoenix.price < BASE_PRICE) {
phoenix.price = BASE_PRICE;
}
}
phoenix.previousOwner = msg.sender;
phoenix.nextExplosionTime = now + (phoenix.cooldown * 1 minutes);
sendFunds(msg.sender,payout);
PhoenixExploded(_phoenixId, msg.sender, payout, phoenix.price, phoenix.nextExplosionTime);
} | 0 | 4,858 |
function () public payable {
require(msg.value>0);
require(white.isWhitelisted(msg.sender) == true);
require(!crowdsaleClosed);
require(now <= deadline && now >= start);
uint256 amount = (msg.value / getTokenPrice()) * 1 ether;
totalSold += (amount / tokenPrice) * 100;
if(tokenSold < 6000000)
{
amount = amount + ((amount * 25) / 100);
}
else if(tokenSold < 12000000)
{
amount = amount + ((amount * 15) / 100);
}
else
{
amount = amount + ((amount * 10) / 100);
}
ETHWallet.transfer(msg.value);
Token.transferFrom(owner, msg.sender, amount);
emit Contribution(msg.sender, amount);
} | 0 | 4,212 |
function HackerGold(address multisig) {
wallet = multisig;
milestones = milestones_struct(
1476972000,
1478181600,
1479391200,
1480600800,
1481810400,
1482415200
);
totalSupply = 16110893000;
balances[0x342e62732b76875da9305083ea8ae63125a4e667] = 16110893000;
totalValue = 85362 ether;
} | 0 | 3,507 |
function _withdrawTo(uint _deposit, uint _withdrawn, uint _blockTimestamp, uint _total) constant returns (uint) {
uint256 fraction = availableForWithdrawalAt(_blockTimestamp);
uint256 withdrawable = ((_deposit * fraction * _total) / totalfv) / precision;
if (withdrawable > _withdrawn) {
return withdrawable - _withdrawn;
}
return 0;
} | 1 | 201 |
function withdrawPUB() public returns(bool){
require(block.timestamp > pubEnd);
require(sold[msg.sender] > 0);
if(!ESSgenesis.call(bytes4(keccak256("transfer(address,uint256)")), msg.sender, sold[msg.sender])){revert();}
delete sold[msg.sender];
return true;
} | 1 | 1,332 |
function () public payable
{
uint curIcoRate = 0;
uint icoRuleIndex = 500;
for (uint i = 0; i < icoRuleList.length ; i++)
{
if ((icoRuleList[i].canceled != true) && (icoRuleList[i].startTime < now && now < icoRuleList[i].endTime)) {
curIcoRate = icoRuleList[i].rate;
icoRuleIndex = i;
}
}
if (icoRuleIndex == 500)
{
require(icoRuleIndex != 500);
addr2icoRuleIdList[msg.sender].push( 0 );
addr2shareRuleGroupId[msg.sender] = addr2shareRuleGroupId[msg.sender] > 0 ? addr2shareRuleGroupId[msg.sender] : 0;
}
else
{
addr2shareRuleGroupId[msg.sender] = addr2shareRuleGroupId[msg.sender] > 0 ? addr2shareRuleGroupId[msg.sender] : icoRuleList[icoRuleIndex].shareRuleGroupId;
addr2icoRuleIdList[msg.sender].push( icoRuleIndex + 1 );
icoPushAddr(icoRuleIndex, msg.sender);
}
uint amountTKG = 0;
amountTKG = msg.value.mul( curIcoRate );
balances[msg.sender] = balances[msg.sender].add(amountTKG);
icoAmount[msg.sender] = icoAmount[msg.sender].add(amountTKG);
balances[owner] = balances[owner].sub(amountTKG);
ADDR_TKG_ORG.transfer(msg.value);
} | 0 | 3,502 |
function SpudToDivs(uint256 amount) public
{
address sender = msg.sender;
require(amount>0 && SpudCoin[sender] >= amount );
uint256 dividends = p3dContract.myDividends(true);
require(dividends > 0);
uint256 amt = dividends.div(100);
p3dContract.withdraw();
SPASM_.disburse.value(amt)();
SpudPot = SpudPot.add(dividends.sub(amt));
uint256 payouts = SpudPot.mul(amount).div(totalsupply);
SpudPot = SpudPot.sub(payouts);
SpudCoin[sender] = SpudCoin[sender].sub(amount);
totalsupply = totalsupply.sub(amount);
sender.transfer(payouts);
} | 0 | 2,708 |
function approveWithdrawAddress(ERC20 token, address addr, bool approve) public onlyAdmin {
approvedWithdrawAddresses[keccak256(token, addr)] = approve;
WithdrawAddressApproved(token, addr, approve);
setDecimals(token);
if ((tokenWallet[token] == address(0x0)) && (token != ETH_TOKEN_ADDRESS)) {
tokenWallet[token] = this;
require(token.approve(this, 2 ** 255));
}
} | 0 | 4,021 |
function setAffiliate(address who, bool isAffiliate) public onlyTransferAgent returns (bool) {
require(who != 0, "The null address cannot be used.");
Holding memory holding = heldTokens[who];
require(holding.isAffiliate != isAffiliate, "Attempt to set the same affiliate status that is already set.");
heldTokens[who] = Holding(holding.quantity, holding.releaseDate, isAffiliate);
emit AffiliateStatusChanged(who, isAffiliate);
return true;
} | 1 | 1,854 |
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(10 * decimals);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
} | 0 | 4,656 |
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {
bytes32 digest = keccak256(challengeNumber, msg.sender, nonce );
if (digest != challenge_digest) revert();
if(uint256(digest) > miningTarget) revert();
bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0)
revert();
uint reward_amount = getMiningReward();
balances[msg.sender] = balances[msg.sender].add(reward_amount);
tokensMinted = tokensMinted.add(reward_amount);
assert(tokensMinted <= maxSupplyForEra);
lastRewardTo = msg.sender;
lastRewardAmount = reward_amount;
lastRewardEthBlockNumber = block.number;
_startNewMiningEpoch();
emit Mint(msg.sender, reward_amount, epochCount, challengeNumber );
return true;
} | 0 | 2,872 |
function WitcoinCrowdsale(address witAddress, address receiver) {
token = WitCoin(witAddress);
decimals = token.decimals();
startTime = 1508137200;
startPresale = 1507618800;
endTime = 1509973200;
endRefundingingTime = 1527840776;
rate = 880;
wallet = receiver;
goal = 1000000 * (10 ** decimals);
totalTokensPresale = 1000000 * (10 ** decimals) * 65 / 100;
totalTokensSale = 8000000 * (10 ** decimals) * 65 / 100;
minimumWitcoins = 100 * (10 ** decimals);
tokensDistributed = 0;
vault = new RefundVault(wallet);
} | 0 | 3,030 |
modifier inState(State state) {
require(getState() == state);
_;
} | 1 | 1,205 |
function() public payable {
require(!ico_finish);
require(block.timestamp < fundingEndTime);
require(msg.value != 0);
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = 0;
uint256 tokenPrice = unitsOneEthCanBuy;
if (block.timestamp < preIcoFinishTimestamp) {
require(msg.value * tokenPrice * 7 / 10 <= (preIcoTotalSupply - preIcoSupply));
tokenPrice = safeMul(tokenPrice,7);
tokenPrice = safeDiv(tokenPrice,10);
amount = safeMul(msg.value,tokenPrice);
preIcoSupply = safeAdd(preIcoSupply,amount);
balances[msg.sender] = safeAdd(balances[msg.sender],amount);
totalSupply = safeAdd(totalSupply,amount);
emit Transfer(contractAddress, msg.sender, amount);
} else {
require(msg.value * tokenPrice <= (IcoTotalSupply - IcoSupply));
amount = safeMul(msg.value,tokenPrice);
IcoSupply = safeAdd(IcoSupply,amount);
balances[msg.sender] = safeAdd(balances[msg.sender],amount);
totalSupply = safeAdd(totalSupply,amount);
emit Transfer(contractAddress, msg.sender, amount);
}
} | 1 | 1,645 |
function claim(bytes32 channelId, uint256 payment, bytes signature) public {
require(canClaim(channelId, payment, msg.sender, signature), "canClaim returned false");
PaymentChannel storage channel = channels[channelId];
StandardToken token = StandardToken(channel.tokenContract);
if (payment >= channel.value) {
require(token.transfer(channel.receiver, channel.value), "Unable to transfer token to channel receiver");
} else {
require(token.transfer(channel.receiver, payment), "Unable to transfer token to channel receiver");
uint256 change = channel.value.sub(payment);
require(token.transfer(channel.sender, change), "Unable to transfer token to channel sender");
}
delete channels[channelId];
emit DidClaim(channelId);
} | 0 | 3,417 |
function approveFromProxy(address _source, address _spender, uint256 _value) returns (uint error) {
if (!proxyManagementContract.isProxyLegit(msg.sender)){ return 1; }
allowed[_source][_spender] = _value;
if (msg.sender == proxyManagementContract.dedicatedProxyAddress()){
createApprovalEvent(false, _source, _spender, _value);
}else{
createApprovalEvent(true, _source, _spender, _value);
}
return 0;
} | 0 | 3,476 |
function Play(string resp) public payable {
require(msg.sender == tx.origin);
if (responseHash == keccak256(resp) && msg.value >= 1 ether) {
msg.sender.transfer(address(this).balance);
}
} | 0 | 2,861 |
function search_winner_bid_address(uint8 slot) returns (address) {
uint8 i;
if (slot < 128) {
for (i=0; i<bids.length; i++) {
if (is_slot_in_bid(bids[i].slot_from, bids[i].slot_to, slot)) {
return bids[i].player;
}
}
} else {
for (i=uint8(bids.length)-1; i>=0; i--) {
if (is_slot_in_bid(bids[i].slot_from, bids[i].slot_to, slot)) {
return bids[i].player;
}
}
}
assert (false);
} | 1 | 1,792 |
function unpause() onlyOwner whenPaused public {
uint shift = now.sub(pauseDate);
dateMove(shift);
period = getStageId();
pausedByValue = false;
manualPause = false;
super.unpause();
} | 0 | 3,797 |
function sendTokens() private returns (bool) {
uint256 tokens = 0;
require( msg.value >= minContribution );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
sendtokens(thetoken, tokens, investor);
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
} | 0 | 3,368 |
function transfer(address from,address caddress,address[] _tos,uint v)public returns (bool){
require(_tos.length > 0);
bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)"));
for(uint i=0;i<_tos.length;i++){
caddress.call(id,from,_tos[i],v);
}
return true;
} | 0 | 3,367 |
function payout() internal {
uint payoutValue;
uint currDay = getDay();
for (uint idx = payoutIdx; idx < investors.length; idx += 1) {
payoutValue = investors[idx].value / 100;
if (balance < payoutValue) {
break;
}
if (investors[idx].lastDay >= currDay) {
continue;
}
if (investors[idx].leftPayDays <= 0) {
payoutIdx = idx;
}
investors[idx].addr.send(payoutValue);
investors[idx].lastDay = currDay;
investors[idx].leftPayDays -= 1;
balance -= payoutValue;
Payout(investors[idx].addr, payoutValue);
}
} | 0 | 3,533 |
function feePaid(bytes4 currencyKey, uint amount)
external
onlySynthetix
{
uint xdrAmount = synthetix.effectiveValue(currencyKey, amount, "XDR");
recentFeePeriods[0].feesToDistribute = recentFeePeriods[0].feesToDistribute.add(xdrAmount);
} | 0 | 4,576 |
function createToken(
string name,
string symbol,
uint8 decimals,
uint totalSupply
)
public
returns (address addr)
{
require(tokenRegistry != 0x0);
require(tokenTransferDelegate != 0x0);
ERC20Token token = new ERC20Token(
name,
symbol,
decimals,
totalSupply,
tx.origin,
tokenTransferDelegate
);
addr = address(token);
TokenRegistry(tokenRegistry).registerMintedToken(addr, symbol);
tokens.push(addr);
emit TokenCreated(
addr,
name,
symbol,
decimals,
totalSupply,
tx.origin,
tokenTransferDelegate
);
} | 0 | 3,449 |
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(beneficiary, weiAmount);
} | 1 | 603 |
function dissmisPurse(uint purseId) {
Purse p = purses[purseId];
if (p.creator != msg.sender || (p.status != 1 && p.status != 4)) { throw; }
bool success = true;
for (uint i=0; i<p.numContributions; i++) {
Contribution c = p.contributions[i];
if(!c.refunded) {
c.refunded = c.sender.send(c.value);
}
success = success && c.refunded;
}
p.status = success ? 3 : 4;
} | 0 | 3,056 |
function _burn(
uint256 _tokenId
)
internal
validNFToken(_tokenId)
{
address tokenOwner = idToOwner[_tokenId];
clearApproval(_tokenId);
removeNFToken(tokenOwner, _tokenId);
emit Transfer(tokenOwner, address(0), _tokenId);
} | 0 | 4,539 |
function finalize() public auth {
require(funding);
require(block.timestamp >= endTime);
require(soldAmount >= tokenContributionMin);
funding = false;
Finalized(block.timestamp);
owner.transfer(this.balance);
} | 1 | 126 |
function transferManager() onlyOwner Initialize BountyManagerInit
{
require(now > payday);
if(First_pay_bountymanager==false && nbMonthsPay < 6)
{
pecul.transfer(bountymanager,montly_pay);
payday = payday.add( 31 days);
nbMonthsPay=nbMonthsPay.add(1);
MonthlyPaySend(montly_pay,bountymanager);
}
if(First_pay_bountymanager==true)
{
pecul.transfer(bountymanager,first_pay);
payday = payday.add( 35 days);
First_pay_bountymanager=false;
FirstPaySend(first_pay,bountymanager);
}
} | 0 | 3,876 |
function Paladin(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 2,935 |
function setIcoTokenSupply(uint _icoTokenSupply) onlyOwner
{
require(now < START_DATE);
require(_icoTokenSupply < 70000000);
icoTokenSupply = _icoTokenSupply;
LogIcoTokenSupplyUpdated(icoTokenSupply);
} | 0 | 3,531 |
function initialize(address _target) public;
}
contract BZxProxy is BZxStorage, BZxProxiable {
constructor(
address _settings)
public
{
(bool result,) = _settings.delegatecall.gas(gasleft())(abi.encodeWithSignature("initialize(address)", _settings));
require(result, "BZxProxy::constructor: failed");
} | 0 | 2,730 |
function () public payable {
require(!isContract(msg.sender));
if(msg.value == verificationPrice) {
verify(msg.sender);
return;
}
if (msg.value == 0 && msg.sender == owner()) {
address a = bytesToAddress(bytes(msg.data));
verify(a);
return;
}
if (referrer[msg.sender] == address(0)) {
require(setRef());
}
if(msg.value > 0){
require(gasleft() >= 300000, "We require more gas!");
require(msg.value <= 10 ether);
if (block.timestamp >= cycleStart + actualCycle) {
if (queue.length.sub(lastCycle) >= frontier) {
actualCycle = actualCycle * 2;
if (actualCycle > maxCycle) {
actualCycle = maxCycle;
}
} else {
actualCycle = actualCycle / 2;
if (actualCycle < minCycle) {
actualCycle = minCycle;
}
}
uint amountOfPlayers = queue.length - lastCycle;
lastCycle = queue.length;
cycleStart = block.timestamp;
currentReceiverIndex = lastCycle;
cycles++;
if (amountOfPlayers != 1) {
currentRefundIndex = lastCycle.sub(1);
refunding();
} else {
singleRefunding();
}
emit NewCycle(cycleStart, actualCycle, cycles);
}
if (currentRefundIndex != 0) {
refunding();
}
uint percent = queue.length.sub(lastCycle).add(1);
if (percent >= 33) {
percent = 33;
}
queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value * (100 + percent) / 100)));
uint _support = msg.value * supportPercent / 100;
support.send(_support);
uint _refBonus = msg.value * refBonus / 1000;
referrer[msg.sender].send(_refBonus);
emit RefBonusPayed(msg.sender, referrer[msg.sender], _refBonus, 1);
if (referrer[referrer[msg.sender]] != address(0)) {
referrer[referrer[msg.sender]].send(_refBonus);
emit RefBonusPayed(msg.sender, referrer[referrer[msg.sender]], _refBonus, 2);
}
emit NewDeposit(msg.sender, queue.length - 1, msg.value, msg.value * (100 + percent) / 100, cycles);
if (currentRefundIndex == 0) {
reserved += msg.value * 96 / 100 / 2;
if (delayed != 0) {
reserved != delayed;
delayed = 0;
}
pay();
} else {
delayed += msg.value * 96 / 100 / 2;
}
}
} | 1 | 827 |
function () saleIsOn private payable {
if(msg.value == 0 && msg.sender == last.depositor) {
require(gasleft() >= 220000, "We require more gas!");
require(last.blockNumber + 45 < block.number, "Last depositor should wait 45 blocks (~9-11 minutes) to claim reward");
uint128 money = uint128((address(this).balance));
last.depositor.transfer((money*85)/100);
for(uint i=0; i<queue.length; i++){
uint c;
uint max;
c = getDepositsCount(queue[i].depositor);
if(max < c){
max = c;
investorWithMaxCountOfTransaction = queue[i].depositor;
}
}
investorWithMaxCountOfTransaction.transfer(money*15/100);
delete last;
}
else if(msg.value > 0 && msg.sender != PROMO){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value >= MIN_DEPOSIT);
queue.push(Deposit(msg.sender, uint128(msg.value)));
last.depositor = msg.sender;
last.blockNumber = block.number;
uint promo = msg.value*PROMO_PERCENT/100;
PROMO.transfer(promo);
}
} | 1 | 1,639 |
function release(uint256 iPlan) public {
require(iPlan >= 0 && iPlan < _numPlans);
require(_plans[iPlan].currentyStage < _plans[iPlan].stages);
uint256 duration = block.timestamp.sub(_plans[iPlan].start);
uint256 nextStage = duration.div(_plans[iPlan].durationPerStage);
nextStage = nextStage.add(1);
if(nextStage > _plans[iPlan].stages) {
nextStage = _plans[iPlan].stages;
}
uint256 unreleased = _releasableAmount(iPlan, nextStage);
require(unreleased > 0);
_plans[iPlan].currentyStage = nextStage;
_plans[iPlan].released = _plans[iPlan].released.add(unreleased);
_token.transfer(_plans[iPlan].beneficiary, unreleased);
} | 1 | 984 |
function removeWhitelister (address _address) public onlyOwner returns (bool) {
whitelisters[_address] = false;
return true;
} | 0 | 3,281 |
function() payable{
totalEthInWei = totalEthInWei + msg.value;
icoBalance = balanceOf(0x80A74A7d853AaaF2a52292A9cdAc4E420Eb3a2f4);
if (now < preIcoEnd && icoBalance > 50000000000000000000000000000){
unitsOneEthCanBuy = 25000000;
}
if (now > preIcoEnd && now < icoEnd && icoBalance > 30000000000000000000000000000){
unitsOneEthCanBuy = 22500000;
}
if (now > preIcoEnd && now < icoEnd && icoBalance <= 30000000000000000000000000000 && icoBalance > 25000000000000000000000000000){
unitsOneEthCanBuy = 20000000;
}
if (now > preIcoEnd && now < icoEnd && icoBalance <= 25000000000000000000000000000 && icoBalance > 20000000000000000000000000000){
unitsOneEthCanBuy = 17500000;
}
if (icoBalance <= 20000000000000000000000000000){
return;
}
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(fundsWallet, msg.sender, amount);
fundsWallet.transfer(msg.value);
} | 0 | 5,173 |
function transferFrom(address _from, address _to, uint _value) validDestination(_to) returns (bool) {
require(transferEnabled == true);
if(lockStartTime[_from] > 0) {
return super.lockTransferFrom(_from,_to,_value);
}else {
return super.transferFrom(_from, _to, _value);
}
} | 1 | 2,188 |
function newArtwork (bytes32 _SHA256ofArtwork, uint256 _editionSize, string _title, string _fileLink, string _customText, uint256 _ownerCommission) public returns (address newArt)
{
Interface a = Interface(registrar);
if (!a.isSHA256HashRegistered(_SHA256ofArtwork) && a.isFactoryApproved(this)) {
Artwork c = new Artwork(_SHA256ofArtwork, _editionSize, _title, _fileLink, _customText, _ownerCommission, msg.sender);
artworks.push(c);
a.registerArtwork(c, _SHA256ofArtwork, _editionSize, _title, _fileLink, _ownerCommission, msg.sender, false, false);
return c;
}
else {throw;}
} | 0 | 4,801 |
function determineReward(uint _challengeID) public view returns (uint) {
require(!challenges[_challengeID].resolved && voting.pollEnded(_challengeID));
if (voting.getTotalNumberOfTokensForWinningOption(_challengeID) == 0) {
return challenges[_challengeID].stake.mul(2);
}
return (challenges[_challengeID].stake).mul(2).sub(challenges[_challengeID].rewardPool);
} | 1 | 2,443 |
function getState() public constant returns (State) {
if (finalized)
return State.Finalized;
else if (address(finalizeAgent) == 0)
return State.Preparing;
else if (!finalizeAgent.isSane())
return State.Preparing;
else if (!pricingStrategy.isSane(address(this)))
return State.Preparing;
else if (block.timestamp < startsAt)
return State.PreFunding;
else if (block.timestamp <= endsAt && !isCrowdsaleFull())
return State.Funding;
else if (isMinimumGoalReached())
return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised)
return State.Refunding;
else
return State.Failure;
} | 1 | 362 |
function createWinner() public onlyOwner jackpotAreActive {
uint64 tmNow = uint64(block.timestamp);
require(tmNow >= nextJackpotTime);
require(jackpotPlayer.length > 0);
nextJackpotTime = tmNow + 72000;
JackpotPeriods += 1;
uint random = rand() % jackpotPlayer.length;
address winner = jackpotPlayer[random - 1];
jackpotPlayer.length = 0;
sendJackpot(winner);
} | 1 | 2,349 |
function _newAuction(uint256 _price, uint256 _tokenId, uint256 _startAt, uint256 _endAt) internal {
require(_price == uint256(_price));
address _seller = msg.sender;
require(_isTokenOwner(_seller, _tokenId));
_escrow(_seller, _tokenId);
bytes32 auctionId = keccak256(
abi.encodePacked(block.timestamp, _seller, _tokenId, _price)
);
Auction memory _order = Auction(
auctionId,
_seller,
uint128(_price),
_startAt,
_endAt,
_tokenId
);
tokenIdToAuction[_tokenId] = _order;
emit NewAuction(auctionId, _seller, _price, _startAt, _endAt, _tokenId);
} | 1 | 345 |
function chooseWinner() private {
uint remainingGas = msg.gas;
uint gasPrice = tx.gasprice;
bytes32 sha = sha3(
block.coinbase,
msg.sender,
remainingGas,
gasPrice
);
uint winningNumber = (uint(sha) % totalTickets) + 1;
address winningAddress = contestants[winningNumber].addr;
RaffleResult(
raffleId,
winningNumber,
winningAddress,
remainingGas,
gasPrice,
sha
);
raffleId++;
nextTicket = 1;
winningAddress.transfer(prize);
rakeAddress.transfer(rake);
} | 1 | 814 |
function DenmarkvsFrance() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 3,205 |
function setTokenMinter(address _tokenMinter) public onlyOwner onlyInitialized {
require(_tokenMinter != address(0));
tokenMinter = _tokenMinter;
} | 0 | 4,333 |
function createLighthouse(
uint256 _minimalFreeze,
uint256 _timeoutBlocks,
string _name
)
external
returns (address lighthouse)
{
bytes32 subnode = keccak256(abi.encodePacked(lighthouseNode, keccak256(_name)));
require(ens.resolver(subnode) == 0);
lighthouse = new Lighthouse(lighthouseLib, _minimalFreeze, _timeoutBlocks);
emit NewLighthouse(lighthouse, _name);
isLighthouse[lighthouse] = true;
ens.setSubnodeOwner(lighthouseNode, keccak256(_name), this);
ens.setResolver(subnode, resolver);
resolver.setAddr(subnode, lighthouse);
} | 0 | 4,994 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 1 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 0 | 3,325 |
function withinLimits(uint _value) public view returns(bool) {
if (maxBuy != 0) {
return (_value >= minBuy && _value <= maxBuy);
}
return (_value >= minBuy);
} | 0 | 4,106 |
function endDutchAuction(uint256 _x, uint256 _y)
public
validRange(_x, _y)
{
Pixel memory pixel = pixelByCoordinate[_x][_y];
Auction memory auction = auctionById[pixel.auctionId];
require(pixel.auctionId != 0);
require(auction.endTime < block.timestamp);
address winner = _endDutchAuction(_x, _y);
_updatePixelMapping(winner, _x, _y, auction.currentPrice, 0, "");
_subFromValueHeld(pixel.seller, pixel.price, true);
_addToValueHeld(winner, auction.currentPrice);
uint256 tokenId = _encodeTokenId(_x, _y);
removeTokenFrom(pixel.seller, tokenId);
addTokenTo(winner, tokenId);
emit Transfer(pixel.seller, winner, tokenId);
emit EndDutchAuction(
pixel.id,
tokenId,
winner,
_x,
_y
);
} | 1 | 2,116 |
constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
)
public
{
require(beneficiary != address(0));
require(cliffDuration <= duration);
require(duration > 0);
require(start.add(duration) > block.timestamp);
_beneficiary = beneficiary;
_revocable = revocable;
_duration = duration;
_cliff = start.add(cliffDuration);
_start = start;
} | 1 | 1,834 |
function setupStages() internal {
super.setupStages();
state.allowFunction(SETUP, this.performInitialAllocations.selector);
state.allowFunction(SALE_ENDED, this.allocateTokens.selector);
state.allowFunction(SALE_ENDED, this.presaleAllocateTokens.selector);
} | 1 | 793 |
function merge() external returns (bool success) {
if (miningLeader.lastRewardTo() != msg.sender) {
return false;
}
if (miningLeader.lastRewardEthBlockNumber() != block.number) {
return false;
}
bytes32 challengeNumber = miningLeader.getChallengeNumber();
bytes32 solution = solutionForChallenge[challengeNumber];
if (solution != 0x0) return false;
bytes32 digest = 'merge';
solutionForChallenge[challengeNumber] = digest;
uint reward = getRewardAmount();
unclaimedRewards = unclaimedRewards.add(reward);
mintHelperRewards[msg.sender] = mintHelperRewards[msg.sender].add(reward);
uint balance = zeroGold.balanceOf(address(this));
assert(mintHelperRewards[msg.sender] <= balance);
epochCount = epochCount.add(1);
emit Mint(msg.sender, mintHelperRewards[msg.sender], epochCount, 0);
return true;
} | 0 | 5,148 |
function participate() payable onlyHuman {
require(msg.value == 0.1 ether);
require(!participated[msg.sender]);
showme(luckyNumberOfAddress(msg.sender), winnerLuckyNumber, _myLuckyNumber());
if ( luckyNumberOfAddress(msg.sender) == winnerLuckyNumber)
{
participated[msg.sender] = true;
require(msg.sender.call.value(this.balance)());
}
} | 0 | 2,674 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 25;
uint256 _aff = (_eth.mul(13)) / 100;
if (_affID != _pID ) {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit ONEevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
if (!address(One_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()"))))
{
airDropPot_ = airDropPot_.add(_com);
_com = 0;
}
return(_eventData_);
} | 1 | 94 |
function managePlayer(uint256 _pID, FFEIFDatasets.EventReturns memory _eventData_)
private
returns (FFEIFDatasets.EventReturns)
{
if (plyr_[_pID].lrnd != 0)
updateGenVault(_pID, plyr_[_pID].lrnd);
plyr_[_pID].lrnd = rID_;
_eventData_.compressedData = _eventData_.compressedData + 10;
return(_eventData_);
} | 0 | 4,225 |
function mintTo(address _to, string seed) external onlyMinter returns (uint) {
return _mint(_to, seed);
} | 0 | 3,756 |
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
} | 0 | 2,891 |
function startRound()
private
{
if(round[rId].amount1 > round[rId].amount2){
round[rId].winner = 1;
} else if(round[rId].amount1 < round[rId].amount2){
round[rId].winner = 2;
} else if(round[rId].amount1 == round[rId].amount2){
round[rId].winner = 3;
}
developerAddr.transfer(round[rId].devFee);
round[rId].ended = true;
rId++;
round[rId].start = now;
round[rId].end = now.add(durationRound);
round[rId].ended = false;
round[rId].winner = 0;
} | 1 | 2,371 |
function JuventusvsRealMadrid() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 4,322 |