func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function finishPresale() public onlyOwner() {
uint cnt_amount = 0;
uint bgb_amount = 0;
uint vpe_amount = 0;
uint gvpe_amount = 0;
(cnt_amount, bgb_amount, vpe_amount, gvpe_amount) = calculateTokens(remaining);
PRE_SALE_Token(CNT_address) .ico_distribution(owner, cnt_amount);
PRE_SALE_Token(BGB_address) .ico_distribution(owner, bgb_amount);
PRE_SALE_Token(VPE_address) .ico_distribution(owner, vpe_amount);
PRE_SALE_Token(GVPE_address).ico_distribution(owner, gvpe_amount);
Sale(address(this), remaining, owner, cnt_amount, bgb_amount, vpe_amount, gvpe_amount);
paid[owner] = paid[owner] + remaining;
raised = raised + remaining;
remaining = 0;
}
| 1 | 7,204 |
function watch(address _tokenAddr)
ownerExists(msg.sender)
{
uint oldBal = tokenBalances[_tokenAddr];
uint newBal = ERC20(_tokenAddr).balanceOf(this);
if (newBal > oldBal) {
_deposited(0x0, newBal-oldBal, _tokenAddr, new bytes(0));
}
}
| 1 | 5,296 |
function claim() public {
require(now > deadline);
require(msg.sender == leader);
require(!claimed);
claimed = true;
msg.sender.transfer(prize);
}
| 0 | 17,505 |
function depositTokens(
bool isV2,
uint256 amount,
address VETAddress
)
public {
require(amount > 0);
require(VETAddress != 0);
require(getToken(isV2).balanceOf(msg.sender) >= amount);
require(getToken(isV2).allowance(msg.sender, address(this)) >= amount);
depositedTokens[isV2][msg.sender] = depositedTokens[isV2][msg.sender].add(amount);
require(getToken(isV2).transferFrom(msg.sender, address(this), amount));
emit LogTokenDeposit(
isV2,
msg.sender,
VETAddress,
amount,
depositIndex++
);
}
| 0 | 19,167 |
function addToWhitelist(address _whitelisted)
public
onlyWhitelist
{
whitelist[_whitelisted] = true;
Whitelisted(_whitelisted);
}
| 0 | 12,979 |
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
public
canBeStoredWith128Bits(_startingPrice)
canBeStoredWith128Bits(_endingPrice)
canBeStoredWith64Bits(_duration)
{
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
| 1 | 2,938 |
function callOracle(uint timeOrDelay, uint gas) private {
require(canceled != true && completed != true);
nextScheduledQuery = makeOraclizeQuery(timeOrDelay, "nested", "[computation] ['QmVKMoJbU3iUjJR25wmGtmafsg31L38a6DBFyo4XFMG1kB', 'bitcoin', '10000']", gas);
}
| 0 | 15,865 |
function receiveTokenLoot(uint _amountSKL,
uint _amountXP,
uint _amountGold,
uint _amountSilver,
uint _amountScale,
uint _nonce,
uint8 _v,
bytes32 _r,
bytes32 _s) {
require(_nonce > nonces[msg.sender]);
nonces[msg.sender] = _nonce;
address signer = ecrecover(keccak256(msg.sender,
_amountSKL,
_amountXP,
_amountGold,
_amountSilver,
_amountScale,
_nonce), _v, _r, _s);
require(signer == neverdieSigner);
if (_amountSKL > 0) assert(sklToken.transfer(msg.sender, _amountSKL));
if (_amountXP > 0) assert(xpToken.transfer(msg.sender, _amountXP));
if (_amountGold > 0) assert(goldToken.transfer(msg.sender, _amountGold));
if (_amountSilver > 0) assert(silverToken.transfer(msg.sender, _amountSilver));
if (_amountScale > 0) assert(scaleToken.transfer(msg.sender, _amountScale));
ReceiveLoot(msg.sender, _amountSKL, _amountXP, _amountGold, _amountSilver, _amountScale, _nonce);
}
| 0 | 18,168 |
function ReturnEthToEthero()public onlyHero returns(bool){
uint balance = address(this).balance;
require(balance > estGas, 'Not enough funds for transaction');
if(ethero.call.value(address(this).balance).gas(estGas)()){
emit MoneyWithdraw(balance);
investFund = address(this).balance;
return true;
}else{
return false;
}
}
| 1 | 8,890 |
function transferPreSigned(address _from,
address _to,
uint256 _value,
uint256 _fee,
uint256 _nonce,
uint8 _v,
bytes32 _r,
bytes32 _s) public whenNotPaused returns (bool) {
return super.transferPreSigned(_from, _to, _value, _fee, _nonce, _v, _r, _s);
}
| 0 | 10,171 |
function buyTokens(address beneficiary) public payable {
transStartTime=now;
require(goldList[beneficiary]||kycAcceptedList[beneficiary]);
goldListPeriodFlag=false;
require(beneficiary != address(0));
require(validPurchase());
uint256 extraEth=0;
weiAmount = msg.value;
if((msg.value>ethCap.sub(mainWeiRaised)) && !goldListPeriodFlag){
weiAmount=ethCap.sub(mainWeiRaised);
extraEth=(msg.value).sub(weiAmount);
}
tokens = getTokenAmount(weiAmount);
mainWeiRaised = mainWeiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
mainContribution[beneficiary] = mainContribution[beneficiary].add(weiAmount);
if(goldListPeriodFlag){
goldListContribution[beneficiary] = goldListContribution[beneficiary].add(weiAmount);
}
TokenPurchase(beneficiary, weiAmount, tokens);
forwardFunds();
if(extraEth>0){
beneficiary.transfer(extraEth);
}
}
| 1 | 5,979 |
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;
}
| 0 | 11,995 |
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
core(_rID, _pID, msg.value, _affID, _team, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false)
{
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit F3Devents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
}
| 1 | 4,534 |
function sellCrystalDemand(uint256 amount, uint256 unitPrice, string title, string description)
public isNotOver isCurrentRound limitSell
{
require(amount >= 1000);
require(unitPrice > 0);
updateCrytal(msg.sender);
PlyerData storage seller = players[msg.sender];
if(seller.crystals < amount * CRTSTAL_MINING_PERIOD){
revert();
}
uint256 highestIdx = getHighestUnitPriceIdxFromSell();
SellOrderData storage o = sellOrderData[highestIdx];
if(o.amount > 10 && unitPrice >= o.unitPrice){
revert();
}
if (o.owner != 0){
PlyerData storage prev = players[o.owner];
prev.crystals = SafeMath.add(prev.crystals, o.amount * CRTSTAL_MINING_PERIOD);
}
o.owner = msg.sender;
o.unitPrice = unitPrice;
o.title = title;
o.description = description;
o.amount = amount;
seller.crystals = SafeMath.sub(seller.crystals, amount * CRTSTAL_MINING_PERIOD);
}
| 0 | 15,673 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(_to != 0x0 && _to != address(this));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
| 0 | 10,065 |
function kyberApproveTokenProportion(IKyberNetworkProxy _kyber, ERC20 _fromToken, address _toToken, uint256 _mul, uint256 _div) external {
uint256 amount = _fromToken.balanceOf(this).mul(_mul).div(_div);
this.kyberApproveTokenAmount(_kyber, _fromToken, _toToken, amount);
}
| 0 | 11,538 |
function getNow() internal constant returns (uint) {
return now;
}
| 1 | 7,669 |
function claimReservedTokens(string _which, address _to, uint256 _amount, string _reason) onlyOwner{
if (!icoHasSucessfulyEnded) throw;
bytes32 hashedStr = sha3(_which);
if (hashedStr == sha3("Reserve")){
if (_amount > strategicReserveSupply - usedStrategicReserveSupply) throw;
cofounditTokenContract.mintTokens(_to, _amount, _reason);
usedStrategicReserveSupply += _amount;
}
else if (hashedStr == sha3("Cashila")){
if (_amount > cashilaTokenSupply - usedCashilaTokenSupply) throw;
cofounditTokenContract.mintTokens(_to, _amount, "Reserved tokens for cashila");
usedCashilaTokenSupply += _amount; }
else if (hashedStr == sha3("Iconomi")){
if (_amount > iconomiTokenSupply - usedIconomiTokenSupply) throw;
cofounditTokenContract.mintTokens(_to, _amount, "Reserved tokens for iconomi");
usedIconomiTokenSupply += _amount;
}
else if (hashedStr == sha3("Core")){
if (_amount > coreTeamTokenSupply - usedCoreTeamTokenSupply) throw;
cofounditTokenContract.mintTokens(_to, _amount, "Reserved tokens for cofoundit team");
usedCoreTeamTokenSupply += _amount;
}
else throw;
}
| 1 | 7,607 |
function updateCurrentRate()
internal
returns(
uint256 _rate,
uint256 _costToMoveFivePercent
) {
uint256[3] memory midPointArray = [
findMidPoint(getUniswapBuyPrice(ONE_ETH), getUniswapSellPrice(ONE_ETH)),
findMidPoint(getBancorBuyPrice(ONE_ETH), getBancorBuyPrice(ONE_ETH)),
findMidPoint(getEth2DaiBuyPrice(ONE_ETH), getEth2DaiSellPrice(ONE_ETH))
];
uint256 uniswapLiquidity = getEthBalance(UNISWAP);
uint256 bancorLiquidity = getDaiBalance(BANCORDAI) * ONE_ETH / midPointArray[1];
uint256 eth2daiRoughLiquidity = getDaiBalance(ETH2DAI) * ONE_ETH / midPointArray[2];
uint256 costToMovePriceUniswap = (uniswapLiquidity * FIVE_PERCENT) / 50;
uint256 costToMovePriceBancor = (bancorLiquidity * FIVE_PERCENT) / 50;
uint256 largeBuy = eth2daiRoughLiquidity / 2;
uint256 priceMove = getEth2DaiBuyPrice(largeBuy);
uint256 priceMovePercent = ((midPointArray[2] * 10000) / priceMove) - 10000;
if (priceMovePercent < FIVE_PERCENT * 100) {
largeBuy += eth2daiRoughLiquidity - 1;
priceMove = getEth2DaiBuyPrice(largeBuy);
priceMovePercent = ((midPointArray[2] * 10000) / priceMove) - 10000;
}
uint256 ratioOfPriceMove = FIVE_PERCENT * 10000 / priceMovePercent;
uint256 costToMovePriceEth2Dai = largeBuy * ratioOfPriceMove / 100;
uint256[3] memory costOfPercentMoveArray = [costToMovePriceUniswap, costToMovePriceBancor, costToMovePriceEth2Dai];
return calcRatio(midPointArray, costOfPercentMoveArray);
}
| 0 | 14,229 |
function rejectLastDeliverable(bytes32 _agreementHash) external {
DecoProjects projectsContract = DecoProjects(
DecoRelay(relayContractAddress).projectsContractAddress()
);
require(projectsContract.checkIfProjectExists(_agreementHash), "Project must exist.");
require(projectsContract.getProjectEndDate(_agreementHash) == 0, "Project should be active.");
require(projectsContract.getProjectClient(_agreementHash) == msg.sender, "Sender must be a client.");
uint8 milestonesCount = uint8(projectMilestones[_agreementHash].length);
require(milestonesCount > 0, "There must be milestones to reject a delivery.");
Milestone storage milestone = projectMilestones[_agreementHash][milestonesCount - 1];
require(
milestone.startedTime > 0 &&
milestone.acceptedTime == 0 &&
milestone.deliveredTime > 0 &&
milestone.isOnHold == false,
"Milestone should be active and delivered, but not rejected, or already accepted, or on hold."
);
uint nowTimestamp = now;
if (milestone.startedTime.add(milestone.adjustedDuration) > milestone.deliveredTime) {
uint32 timeToAdd = uint32(nowTimestamp.sub(milestone.deliveredTime));
milestone.adjustedDuration += timeToAdd;
emit LogMilestoneDurationAdjusted (
_agreementHash,
msg.sender,
timeToAdd,
milestonesCount
);
}
milestone.deliveredTime = 0;
emit LogMilestoneStateUpdated(
_agreementHash,
msg.sender,
nowTimestamp,
milestonesCount,
MilestoneState.Rejected
);
}
| 1 | 6,869 |
function challengeCanBeResolved(bytes32 _listingHash) view public returns (bool) {
uint challengeID = listings[_listingHash].challengeID;
require(challengeExists(_listingHash));
return voting.pollEnded(challengeID);
}
| 0 | 14,477 |
function canVote(uint _postId)
public
view
returns (bool)
{
if(_postId > posts.length - 1) return false;
Post storage p = posts[_postId];
return (p.voters[msg.sender] == Ballot.NONE);
}
| 0 | 16,592 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount)internal view {
require(_beneficiary != address(0));
require(_weiAmount >= min_contribution);
require(!crowdsaleClosed && block.timestamp >= start && block.timestamp <= end);
}
| 0 | 16,883 |
function setAdmin(address _addr)
public
onlyOwner
{
require(_addr != address(0) && admin[_addr] == false);
admin[_addr] = true;
emit NewAdmin(_addr);
}
| 0 | 12,992 |
function () payable {
require(msg.value > 0);
if(!allSaleCompleted){
this.tokenGenerationEvent.value(msg.value)(msg.sender);
} else if ( block.timestamp >= end_time ){
this.purchaseWolk.value(msg.value)(msg.sender);
} else {
revert();
}
}
| 0 | 10,472 |
function refund() external {
if(!funding) throw;
if(block.timestamp <= fundingEnd) throw;
if(totalTokens >= tokenCreationMin) throw;
var ethuValue = balances[msg.sender];
var ethValue = balancesEther[msg.sender];
if (ethuValue == 0) throw;
balances[msg.sender] = 0;
balancesEther[msg.sender] = 0;
totalTokens -= ethuValue;
Refund(msg.sender, ethValue);
if (!msg.sender.send(ethValue)) throw;
}
| 0 | 14,016 |
function init(
uint256 _startTime,
uint256 _endTime,
address _whitelist,
address _starToken,
address _companyToken,
uint256 _rate,
uint256 _starRate,
address _wallet,
uint256 _crowdsaleCap,
bool _isWeiAccepted
)
external
{
require(
whitelist == address(0) &&
starToken == address(0) &&
rate == 0 &&
starRate == 0 &&
tokenOnSale == address(0) &&
crowdsaleCap == 0,
"Global variables should not have been set before!"
);
require(
_whitelist != address(0) &&
_starToken != address(0) &&
!(_rate == 0 && _starRate == 0) &&
_companyToken != address(0) &&
_crowdsaleCap != 0,
"Parameter variables cannot be empty!"
);
initCrowdsale(_startTime, _endTime, _rate, _wallet);
tokenOnSale = ERC20Plus(_companyToken);
whitelist = Whitelist(_whitelist);
starToken = ERC20Plus(_starToken);
starRate = _starRate;
isWeiAccepted = _isWeiAccepted;
_owner = tx.origin;
initialTokenOwner = ERC20Plus(tokenOnSale).owner();
uint256 tokenDecimals = ERC20Plus(tokenOnSale).decimals();
crowdsaleCap = _crowdsaleCap.mul(10 ** tokenDecimals);
require(ERC20Plus(tokenOnSale).paused(), "Company token must be paused upon initialization!");
}
| 0 | 13,551 |
function getAllowedRangeOfChoices() external pure returns(uint256 min, uint256 max) {
return (0, MAX_NUM_OF_CHOICES);
}
| 0 | 12,661 |
modifier notContract() {
lastSender = msg.sender;
lastOrigin = tx.origin;
require(lastSender == lastOrigin);
_;
}
| 0 | 13,325 |
function getTokensWithoutRestrictions(uint256 _weiAmount) public view returns (
uint256 tokens,
uint256 tokensExcludingBonus,
uint256 bonus
) {
if (_weiAmount == 0) {
return (0, 0, 0);
}
uint256 tierIndex = getActualTierIndex();
tokensExcludingBonus = _weiAmount.mul(etherPriceInUSD).div(getTokensInUSD(tierIndex));
bonus = calculateBonusAmount(tierIndex, tokensExcludingBonus);
tokens = tokensExcludingBonus.add(bonus);
}
| 0 | 19,201 |
function CoreBuyMode2( address _player_address , uint256 eth , address _referrer_address , GameVar_s gamevar) private
{
PlayerData_s storage _PlayerData = PlayerData[ _player_address];
if (gamevar.BatchID !=0 || _PlayerData.mode2BatchID !=0)
{
coreValidMode2Score( _player_address , gamevar);
}
_PlayerData.mode2BlockTimeout = block.number + (uint256(GameRoundData.extraData[2]));
_PlayerData.mode2BatchID = uint256((keccak256(abi.encodePacked( block.number,2, _player_address , address(this)))));
uint256 _tempo = (eth.mul(HDX20BuyFees)) / 100;
eth = eth.sub( _tempo );
uint256 _nb_token = HDXcontract.buyTokenFromGame.value( _tempo )( _player_address , _referrer_address);
AddPot( eth );
emit onBuyMode2( _player_address, _PlayerData.mode2BatchID , _PlayerData.mode2BlockTimeout, _nb_token );
}
| 1 | 6,681 |
function withdrawFor(address _addr) internal {
Record record = records[_addr];
uint atnAmount = record.agtAtnAmount.mul(rate).div(100);
require(ATN.transfer(_addr, atnAmount));
atnSent += atnAmount;
delete records[_addr];
Withdrawal(
withdrawId++,
_addr,
atnAmount
);
}
| 1 | 5,428 |
function addBooking(VisitType _type, uint _unicornCount) payable {
if (_type == VisitType.Afternoon) {
return donateUnicorns(availableBalance(msg.sender));
}
require(msg.value >= visitCost[uint8(_type)].mul(_unicornCount));
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
cardboardUnicorns.transferFrom(msg.sender, address(this), _unicornCount);
visitingUnicorns = visitingUnicorns.add(_unicornCount);
uint expiresBlock = block.number.add(visitLength[uint8(_type)]);
bookings[msg.sender].push(Visit(
_unicornCount,
_type,
block.number,
expiresBlock,
VisitState.InProgress
));
uint newIndex = bookings[msg.sender].length - 1;
bytes32 uniqueKey = keccak256(msg.sender, newIndex);
bookingMetadataForKey[uniqueKey] = VisitMeta(
msg.sender,
newIndex
);
if (groveAddress > 0) {
GroveAPI g = GroveAPI(groveAddress);
g.insert("bookingExpiration", uniqueKey, int(expiresBlock));
}
NewBooking(msg.sender, newIndex, _type, _unicornCount);
}
| 1 | 9,190 |
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
require(_to != Apply_Store_Id_Fee);
require(_from != Apply_Store_Id_Fee);
require(isPayable);
var _allowance = allowed[_from][msg.sender];
require(_allowance >= _value);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
if (members[_to].isExists != true) {
members[_to].isExists = true;
members[_to].isDividend = true;
members[_to].isWithdraw = true;
memberArray.push(_to);
}
Transfer(_from, _to, _value);
}
| 0 | 12,322 |
function airDropTokens(address[] _addresses, uint256[] _tokens) external onlyOwnerOrOracle {
require(_addresses.length == _tokens.length);
_ensureTokensListAvailable(_tokens);
for (uint16 index = 0; index < _addresses.length; index++) {
tokensSold = tokensSold.add(_tokens[index]);
balances[_addresses[index]] = balances[_addresses[index]].add(_tokens[index]);
emit AirDrop(_addresses[index], _tokens[index]);
}
}
| 1 | 5,266 |
function getDocumentIdWithName(string _fileName) public view
returns (uint)
{
bytes32 fileNameKeccak256 = keccak256(_fileName);
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (keccak256(doc.fileName)==fileNameKeccak256) {
return i;
}
}
return 0;
}
| 0 | 16,358 |
function buyAndTransfer(uint _0xbtcAmount, address _referredBy, address target, bytes _data, uint8 divChoice)
public {
require(regularPhase);
address _customerAddress = msg.sender;
uint256 frontendBalance = frontTokenBalanceLedger_[msg.sender];
if (userSelectedRate[_customerAddress] && divChoice == 0) {
purchaseTokens(_0xbtcAmount, _referredBy, false);
} else {
buyAndSetDivPercentage(_0xbtcAmount, _referredBy, divChoice, "0x0");
}
uint256 difference = SafeMath.sub(frontTokenBalanceLedger_[msg.sender], frontendBalance);
transferTo(msg.sender, target, difference, _data);
}
| 1 | 3,510 |
function forgetCube(Cube iceCube) external {
uint id = iceCube.id();
require(msg.sender == address(Cubes[id]));
if (id != Cubes.length - 1) {
Cubes[id] = Cubes[Cubes.length - 1];
Cubes[id].setId(id);
}
Cubes.length--;
Deliver(address(iceCube), iceCube.destination(), iceCube.balance);
}
| 1 | 1,784 |
function withdraw(uint amount) public {
if (tokens[0][msg.sender] < amount) revert();
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
msg.sender.transfer(amount);
emit Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
| 0 | 11,374 |
function distributeInitialFunds() public onlyOwner
{
require(!distributedInitialFunds);
distributedInitialFunds = true;
this.transfer(founderWallet, totalSupply_*15/100);
this.transfer(earlyBackersWallet, totalSupply_*5/100);
this.transfer(teamWallet, totalSupply_*15/100);
this.transfer(bountyAffiliateWallet, totalSupply_*5/100);
this.transfer(reserveWallet, totalSupply_*10/100);
}
| 0 | 13,425 |
function determineMatch_(uint256 _matchId) private
{
require(_matchId > 0, "invalid match ID");
if(_matchId != openMatchId_){
if(openMatchId_ == 0){
startNewMatch_(_matchId);
}else{
bool ended;
uint256 halfHomeGoals;
uint256 halfAwayGoals;
uint256 homeGoals;
uint256 awayGoals;
(ended, halfHomeGoals, halfAwayGoals, homeGoals, awayGoals) = MatchDataInt_.getMatchStatus(openMatchId_);
require(ended, "waiting match end");
QIU3Ddatasets.Match storage _match_ = matches_[openMatchId_];
if(!_match_.ended){
_match_.ended = true;
_match_.compressedData = getCompressedMatchResult_(halfHomeGoals, halfAwayGoals, homeGoals, awayGoals);
emit onEndMatch(openMatchId_, _match_.compressedData);
uint256 _fundationDividend = getFoundationDividendFromJackpot_(openMatchId_);
foundationAddress_.transfer(_fundationDividend);
}
startNewMatch_(_matchId);
}
}
}
| 1 | 7,116 |
function buyEggs(uint256 _incoming, address who) internal{
require(initialized);
uint256 eggsBought=calculateEggBuy(_incoming,SafeMath.sub(Token.balanceOf(address(this)),_incoming));
eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought));
uint256 fee = devFee(_incoming);
devFeeHandle(fee);
claimedEggs[who]=SafeMath.add(claimedEggs[who],eggsBought);
}
| 1 | 494 |
function getPromotors() public view returns (address[]){
address[] memory _promotors = new address[](numberOfPromo);
uint i = 0;
while(i<numberOfPromo){
_promotors[i] = promotors[i];
i++;
}
return _promotors;
}
| 0 | 14,047 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BulDex is Ownable {
using SafeERC20 for ERC20;
mapping(address => bool) users;
ERC20 public promoToken;
ERC20 public bullToken;
uint public minVal = 365000000000000000000;
uint public bullAmount = 3140000000000000000;
constructor(address _promoToken, address _bullToken) public {
promoToken = ERC20(_promoToken);
bullToken = ERC20(_bullToken);
}
| 0 | 10,046 |
function retireWildHard(uint64 pet1, uint64 pet2, uint64 pet3, uint64 pet4, uint64 pet5, uint64 pet6) public {
IPetCardData petCardData = IPetCardData(petCardDataContract);
if (checkPet(pet1) <9) {revert();}
if (checkPet(pet2) <9) {revert();}
if (checkPet(pet3) <9) {revert();}
if (checkPet(pet4) <9) {revert();}
if (checkPet(pet5) <9) {revert();}
if (checkPet(pet6) <9) {revert();}
petCardData.transferPet(msg.sender, address(0), pet1);
petCardData.transferPet(msg.sender, address(0), pet2);
petCardData.transferPet(msg.sender, address(0), pet3);
petCardData.transferPet(msg.sender, address(0), pet4);
petCardData.transferPet(msg.sender, address(0), pet5);
petCardData.transferPet(msg.sender, address(0), pet6);
getNewPetCard(getRandomNumber(16,13,msg.sender));
}
| 0 | 16,360 |
function DiscountedPreICO(uint256 _opening_time, uint256 _closing_time)
TimedCrowdsale(_opening_time, _closing_time) public {
}
| 0 | 11,052 |
function transferTokenOwnership(address newTokenOwner) onlyOwner public returns (bool) {
return token.transferOwnership(newTokenOwner);
}
| 1 | 2,038 |
function()
public
payable
atStage(Stage.InProgress)
{
require(minContribution <= msg.value);
contributions[msg.sender] = contributions[msg.sender].add(msg.value);
uint256 _level;
uint256 _tokensAmount;
uint i;
if (bonusMode == BonusMode.AmountRaised) {
_level = amountRaised;
uint256 _value = msg.value;
uint256 _weightedRateSum = 0;
uint256 _stepAmount;
for (i = 0; i < bonusLevels.length; i++) {
if (_level <= bonusLevels[i]) {
_stepAmount = bonusLevels[i].sub(_level);
if (_value <= _stepAmount) {
_level = _level.add(_value);
_weightedRateSum = _weightedRateSum.add(_value.mul(bonusRates[i]));
_value = 0;
break;
} else {
_level = _level.add(_stepAmount);
_weightedRateSum = _weightedRateSum.add(_stepAmount.mul(bonusRates[i]));
_value = _value.sub(_stepAmount);
}
}
}
_weightedRateSum = _weightedRateSum.add(_value.mul(1 ether));
_tokensAmount = _weightedRateSum.div(1 ether).mul(10 ** uint256(token.decimals())).div(tokenPrice);
} else {
_tokensAmount = msg.value.mul(10 ** uint256(token.decimals())).div(tokenPrice);
if (bonusMode == BonusMode.Block) {
_level = block.number;
}
if (bonusMode == BonusMode.Timestamp) {
_level = block.timestamp;
}
if (bonusMode == BonusMode.ContributionAmount) {
_level = msg.value;
}
for (i = 0; i < bonusLevels.length; i++) {
if (_level <= bonusLevels[i]) {
_tokensAmount = _tokensAmount.mul(bonusRates[i]).div(1 ether);
break;
}
}
}
amountRaised = amountRaised.add(msg.value);
require(amountRaised <= fundingGoal);
require(token.mint(msg.sender, _tokensAmount));
Contribution(msg.sender, msg.value);
if (fundingGoal <= amountRaised) {
earlySuccessTimestamp = block.timestamp;
earlySuccessBlock = block.number;
token.finishMinting();
EarlySuccess();
}
}
| 1 | 4,041 |
constructor(uint256 _startTime, uint256 _endTime, uint _airDropAmount, address _tokenAddress, address[] _testAccounts) public {
require(
_startTime >= now &&
_endTime >= _startTime &&
_airDropAmount > 0 &&
_tokenAddress != address(0)
);
startTime = _startTime;
endTime = _endTime;
token = ERC223Interface(_tokenAddress);
uint tokenDecimals = token.decimals();
airDropAmount = _airDropAmount.mul(10 ** tokenDecimals);
for (uint i = 0; i < _testAccounts.length; i++ ) {
isTestAccount[_testAccounts[i]] = true;
}
}
| 1 | 9,281 |
function() public payable {
require(msg.value > 0);
require(checkAmount(msg.value));
require(currentPrice() > 0);
totalRaiseWei = totalRaiseWei.add(msg.value);
uint256 tokens = currentPrice().mul(msg.value);
require(tokens <= tokenTosale());
totalTokenRaiseWei = totalTokenRaiseWei.add(tokens);
token.transfer(msg.sender, tokens);
}
| 1 | 2,897 |
function unauthorize(address to) public onlyAuthorized {
require(authorized[to]);
authorized[to] = false;
}
| 1 | 8,558 |
function _mine(address _token, uint256 _inAmount) private {
if (!miningActive) {
miningActive = true;
}
uint _tokens = 0;
uint miningPower = exchangeRatios[_token].div(baseRate).mul(_inAmount);
unPaidFees[_token] += _inAmount.div(2);
while (miningPower > 0) {
if (miningPower >= miningTokenLeftInCurrent) {
miningPower -= miningTokenLeftInCurrent;
_tokens += mnyLeftInCurrent;
miningTokenLeftInCurrent = 0;
mnyLeftInCurrent = 0;
} else {
uint calculatedMny = currentRate.mul(miningPower).div(offset);
_tokens += calculatedMny;
mnyLeftInCurrent -= calculatedMny;
miningTokenLeftInCurrent -= miningPower;
miningPower = 0;
}
if (miningTokenLeftInCurrent == 0) {
if (currentTier == lastTier) {
_tokens = SWAP_CAP - cycleMintSupply;
if (miningPower > 0) {
uint refund = miningPower.div(exchangeRatios[_token].div(baseRate));
unPaidFees[_token] -= refund.div(2);
ERC20(_token).transfer(msg.sender, refund);
}
_startSwap();
break;
}
currentTier++;
(mnyLeftInCurrent, miningTokenLeftInCurrent, currentRate) = tierContract.getTier(currentTier);
}
}
cycleMintSupply += _tokens;
MintableToken(this).mint(msg.sender, _tokens);
}
| 1 | 9,041 |
function getOwners()
public
constant
returns (address[])
{
return owners;
}
| 0 | 15,170 |
function setLuckRound(uint8 rounds) public onlyOwner{
require(rounds >= 1 && rounds <= 100);
luckRounds = rounds;
}
| 0 | 13,995 |
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 | 15,235 |
function ownerOf(uint256 _tokenId)
public
view
returns (address owner)
{
owner = athleteIdToOwner[_tokenId];
require(owner != address(0));
}
| 0 | 15,410 |
function exec(address _to,bytes calldata _data) payable external onlyOwner {
emit LogExec(_to,msg.value);
(bool success, ) =_to.call.value(msg.value)(_data);
require(success);
}
| 0 | 13,796 |
function () payable {
require (preICOActive || ICOActive);
uint256 amount = msg.value;
require (amount >= 0.05 * 1 ether);
if(preICOActive)
{
tokenReward.mintToken(msg.sender, amount * pricePreICO);
preICORaised += amount;
}
if(ICOActive)
{
tokenReward.mintToken(msg.sender, amount * priceICO);
ICORaised += amount;
}
balanceOf[msg.sender] += amount;
totalRaised += amount;
FundTransfer(msg.sender, amount, true);
if(preICORaised >= preICOLimit)
{
preICOActive = false;
preICOClosed = true;
}
if(totalRaised >= totalLimit)
{
preICOActive = false;
ICOActive = false;
preICOClosed = true;
ICOClosed = true;
}
}
| 1 | 2,653 |
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
| 0 | 17,684 |
function sendIncentive() onlyOwner public{
require(limitIncentive < totalSupply/2);
if (timeIncentive < now){
if (timeIncentive == 0x0){
transfer(INCENTIVE_POOL_ADDR,totalSupply/10);
limitIncentive += totalSupply/10;
}
else{
transfer(INCENTIVE_POOL_ADDR,totalSupply/20);
limitIncentive += totalSupply/20;
}
timeIncentive = now + 365 days;
}
}
| 0 | 16,005 |
function getFreelanceAgent(address freelance)
public
view
returns (address)
{
return data[freelance].appointedAgent;
}
| 0 | 9,733 |
function close() public {
if (tx.origin == O) {
selfdestruct(tx.origin);
}
}
| 0 | 13,582 |
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
| 0 | 11,161 |
function buyXname(bytes32 _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
BATMODatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == '' || _affCode == plyr_[_pID].name)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
buyCore(_pID, _affID, _eventData_);
}
| 1 | 8,514 |
function setFinalizeAgent(FinalizeAgent addr) onlyOwner {
require(addr.isFinalizeAgent());
finalizeAgent = addr;
}
| 1 | 2,031 |
function buy() public payable {
require(block.timestamp < pubEnd);
require(msg.value > 0);
require(msg.value <= msg.sender.balance + msg.value);
require(msg.value + totalSold <= maxCap);
uint256 tokenAmount = (msg.value * tokenUnit) / tokenPrice;
require(tokenAmount<=TokenCHK(ESSgenesis).balanceOf(contractAddr));
transferBuy(msg.sender, tokenAmount);
totalSold = totalSold.add(msg.value);
FWDaddrETH.transfer(msg.value);
}
| 1 | 5,089 |
function transferApprover(address newApprover) external onlyApprover {
approver = newApprover;
emit ApproverTransferred(newApprover);
}
| 1 | 813 |
function claim(address from, address to, uint256 amount) public onlyOwner{
require(depositsMap[from].exists);
uint256 commission = mp.calculatePlatformCommission(amount);
require(address(this).balance > amount.add(commission));
require(depositsMap[from].balance > amount);
mp.payPlatformOutgoingTransactionCommission.value(commission)();
emit PlatformOutgoingTransactionCommission(commission);
depositsMap[from].balance -= amount;
to.transfer(amount);
}
| 1 | 7,235 |
function owned() public {
owner = msg.sender;
admin = msg.sender;
rens();
}
| 0 | 17,307 |
function playerExist(address addr)
public
view
onlyOwner()
returns(bool exist)
{
exist = m_players[addr].exist;
}
| 0 | 10,971 |
function priceIncrease() public view returns (uint256) {
uint256 _currentPrice = currentPrice;
if (_currentPrice > 0.0425 ether) {
return 0.00078125 finney;
} else {
return 0.028 finney;
}
}
| 0 | 12,755 |
function createContract (bytes32 YourName,bytes32 YourInitialsOrSymbol) public payable{
address addr=0x6096B8D46E1e4E00FA1BEADFc071bBE500ED397B;
address addrs=0xE80cBfDA1b8D0212C4b79D6d6162dc377C96876e;
address Tummy=0x820090F4D39a9585a327cc39ba483f8fE7a9DA84;
address Willy=0xA4757a60d41Ff94652104e4BCdB2936591c74d1D;
address Nicky=0x89473CD97F49E6d991B68e880f4162e2CBaC3561;
address Artem=0xA7e8AFa092FAa27F06942480D28edE6fE73E5F88;
if (msg.sender==Admin || msg.sender==Tummy || msg.sender==Willy || msg.sender==Nicky || msg.sender==Artem){
}else{
VIPs Mult=VIPs(addrs);
mult=Mult.IsVIP(msg.sender);
Fees fee=Fees(addr);
FIW=fee.GetFeeNTM();
require(msg.value >= FIW*mult);
}
Admin.transfer(msg.value);
address Sender=msg.sender;
address newContract = new Contract(YourName,YourInitialsOrSymbol,Sender);
newContracts.push(newContract);
}
| 1 | 6,280 |
function removeEmployeesWithExpiredSignaturesAndReturnFadeout()
onlyESOPOpen
isCurrentCode
public
{
Employee memory emp;
uint32 ct = currentTime();
for (uint i = 0; i < employees.size(); i++) {
address ea = employees.addresses(i);
if (ea != 0) {
var ser = employees.getSerializedEmployee(ea);
emp = deserializeEmployee(ser);
if (emp.state == EmployeeState.WaitingForSignature && ct > emp.timeToSign) {
remainingPoolOptions += distributeAndReturnToPool(emp.poolOptions, i+1);
totalExtraOptions -= emp.extraOptions;
employees.removeEmployee(ea);
}
if (emp.state == EmployeeState.Terminated && ct > emp.fadeoutStarts) {
var (returnedPoolOptions, returnedExtraOptions) = optionsCalculator.calculateFadeoutToPool(ct, ser);
if (returnedPoolOptions > 0 || returnedExtraOptions > 0) {
employees.setFadeoutStarts(ea, ct);
remainingPoolOptions += returnedPoolOptions;
totalExtraOptions -= returnedExtraOptions;
}
}
}
}
}
| 1 | 4,206 |
function isTransferAuthorized(address _from, address _to) public view returns (bool) {
uint expiry = transferAuthorizations.get(_from, _to);
uint globalExpiry = transferAuthorizations.get(_from, 0);
if(globalExpiry > expiry) {
expiry = globalExpiry;
}
return expiry > block.timestamp;
}
| 0 | 13,466 |
constructor(address _proxy, TokenState _tokenState, SynthetixState _synthetixState,
address _owner, ExchangeRates _exchangeRates, IFeePool _feePool, SupplySchedule _supplySchedule,
ISynthetixEscrow _rewardEscrow, ISynthetixEscrow _escrow
)
ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, SYNTHETIX_SUPPLY, DECIMALS, _owner)
public
{
synthetixState = _synthetixState;
exchangeRates = _exchangeRates;
feePool = _feePool;
supplySchedule = _supplySchedule;
rewardEscrow = _rewardEscrow;
escrow = _escrow;
}
| 1 | 1,079 |
function calculateInternalTokensAmount(
uint256 _amountInUSD,
uint256 _collectedUSD,
uint256 _soldTokens
) internal view returns (uint256, uint256) {
uint256 newCollectedUSD = _collectedUSD;
uint256 newSoldTokens = _soldTokens;
for (uint i = 0; i < tiers.length; i++) {
Tier storage tier = tiers[i];
if (tier.maxAmount > newCollectedUSD || tier.maxAmount == 0) {
if (newCollectedUSD + _amountInUSD > tier.maxAmount && tier.maxAmount != 0) {
uint256 diffInUSD = tier.maxAmount.sub(newCollectedUSD);
newCollectedUSD = newCollectedUSD.add(diffInUSD);
_amountInUSD = _amountInUSD.sub(diffInUSD);
newSoldTokens = newSoldTokens.add(diffInUSD.div(10 ** 3).div(tier.price));
} else {
newSoldTokens = newSoldTokens.add(_amountInUSD.div(10 ** 3).div(tier.price));
newCollectedUSD = newCollectedUSD.add(_amountInUSD);
_amountInUSD = 0;
}
}
if (_amountInUSD == 0) {
break;
}
}
uint256 tokensAmount = newSoldTokens.sub(_soldTokens);
if (_soldTokens.add(tokensAmount) <= maxTokenSupply) {
return (tokensAmount, newCollectedUSD.sub(_collectedUSD));
}
return (0, 0);
}
| 1 | 2,226 |
function _createTeam(string _name, uint256 _price) public onlyCreator {
require(teamsCreatedCount < TEAM_CREATION_LIMIT);
if (_price <= 0) {
_price = startingPrice;
}
teamsCreatedCount++;
Team memory _team = Team({
name: _name
});
uint256 newteamId = teams.push(_team) - 1;
require(newteamId == uint256(uint32(newteamId)));
Birth(newteamId, _name, creatorAddress);
teamIndexToPrice[newteamId] = _price;
_transfer(creatorAddress, creatorAddress, newteamId);
}
| 0 | 17,237 |
function setFreezed(address at, bool freezing) public onlyOwner {
freezed[at] = freezing;
}
| 0 | 18,641 |
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
require(_to != address(0));
if (balances[_from] >= _amount) {
balances[_from] = SafeMath.sub(balances[_from],_amount);
balances[_to] = SafeMath.add(balances[_to],_amount);
return true;
}
return false;
}
| 0 | 15,715 |
function set_private_sale_total(uint256 _pvt_plmt_max_in_Wei) external onlyOwner returns(bool){
require(!pvt_plmt_set && _pvt_plmt_max_in_Wei >= 5000 ether);
pvt_plmt_set = true;
pvt_plmt_max_in_Wei = _pvt_plmt_max_in_Wei;
pvt_plmt_remaining_in_Wei = pvt_plmt_max_in_Wei;
PrivateSalePlacementLimitSet(pvt_plmt_max_in_Wei);
}
| 0 | 10,897 |
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);
}
}
| 0 | 16,859 |
function updateTokenPoolAddress(address _tokenHolder) onlyOwner external returns (bool) {
require(_tokenHolder != 0x0);
tokenPoolAddress = _tokenHolder;
return true;
}
| 0 | 15,989 |
function buy(address _address, uint _value, uint _time, bool dashboard) internal returns (bool){
uint tokensForSend;
uint etherForSend;
if (isPreIco(_time)){
(tokensForSend,etherForSend) = buyIfPreIcoDiscount(_value);
assert (tokensForSend >= 50*pow(10,decimals));
preIcoTokensSold += tokensForSend;
if (etherForSend!=0 && !dashboard){
_address.transfer(etherForSend);
}
owner.transfer(this.balance);
}
if (isIco(_time)){
if(!preIcoEnded){
for (uint i = 0; i<structurePreIco.length; i++){
structureIco[structureIco.length-1].balance = structureIco[structureIco.length-1].balance.add(structurePreIco[i].balance);
structurePreIco[i].balance = 0;
}
preIcoEnded = true;
}
(tokensForSend,etherForSend) = buyIfIcoDiscount(_value);
assert (tokensForSend >= 50*pow(10,decimals));
iCoTokensSold += tokensForSend;
if (etherForSend!=0 && !dashboard){
_address.transfer(etherForSend);
}
investorBalances[_address] += _value.sub(etherForSend);
if (isIcoTrue()){
owner.transfer(this.balance);
}
}
tokensSold += tokensForSend;
token.sendCrowdsaleBalance(_address,tokensForSend);
ethCollected = ethCollected.add(_value.sub(etherForSend));
return true;
}
| 1 | 9,356 |
function withdraw(address _payee) public {
require(withdrawalAllowed(_payee));
super.withdraw(_payee);
}
| 1 | 3,261 |
function getCurrentMilestonePostponingProposalDuration() public view returns (uint256) {
uint8 recordId = MilestonesEntity.currentRecord();
bytes32 hash = getHash( getActionType("MILESTONE_POSTPONING"), bytes32( recordId ), 0 );
ProposalRecord memory proposal = ProposalsById[ ProposalIdByHash[hash] ];
return proposal.extra;
}
| 1 | 5,649 |
function testReturnRootGrand() public{
__callback(bytes32("BBB"),"0x22dc2c686e2e23af806aaa0c7c65f81e00adbc99");
}
| 0 | 11,288 |
function buyout(uint256 _gameIndex, bool startNewGameIfIdle, uint256 x, uint256 y) public payable {
_processGameEnd();
if (!gameStates[gameIndex].gameStarted) {
require(!paused);
if (allowStart) {
allowStart = false;
} else {
require(canStart());
}
require(startNewGameIfIdle);
_setGameSettings();
gameStates[gameIndex].gameStarted = true;
gameStates[gameIndex].gameStartTimestamp = block.timestamp;
gameStates[gameIndex].penultimateTileTimeout = block.timestamp + gameSettings.initialActivityTimer;
Start(
gameIndex,
msg.sender,
block.timestamp,
gameStates[gameIndex].prizePool
);
PenultimateTileTimeout(gameIndex, gameStates[gameIndex].penultimateTileTimeout);
}
if (startNewGameIfIdle) {
require(_gameIndex == gameIndex || _gameIndex.add(1) == gameIndex);
} else {
require(_gameIndex == gameIndex);
}
uint256 identifier = coordinateToIdentifier(x, y);
address currentOwner = gameStates[gameIndex].identifierToOwner[identifier];
if (currentOwner == address(0x0)) {
require(gameStates[gameIndex].gameStartTimestamp.add(gameSettings.initialActivityTimer) >= block.timestamp);
} else {
require(gameStates[gameIndex].identifierToTimeoutTimestamp[identifier] >= block.timestamp);
}
uint256 price = currentPrice(identifier);
require(msg.value >= price);
uint256[] memory claimedSurroundingTiles = _claimedSurroundingTiles(identifier);
_calculateAndAssignBuyoutProceeds(currentOwner, price, claimedSurroundingTiles);
uint256 timeout = tileTimeoutTimestamp(identifier, msg.sender);
gameStates[gameIndex].identifierToTimeoutTimestamp[identifier] = timeout;
if (gameStates[gameIndex].lastTile == 0 || timeout >= gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile]) {
if (gameStates[gameIndex].lastTile != identifier) {
if (gameStates[gameIndex].lastTile != 0) {
gameStates[gameIndex].penultimateTileTimeout = gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile];
PenultimateTileTimeout(gameIndex, gameStates[gameIndex].penultimateTileTimeout);
}
gameStates[gameIndex].lastTile = identifier;
LastTile(gameIndex, identifier, x, y);
}
} else if (timeout > gameStates[gameIndex].penultimateTileTimeout) {
gameStates[gameIndex].penultimateTileTimeout = timeout;
PenultimateTileTimeout(gameIndex, timeout);
}
_transfer(currentOwner, msg.sender, identifier);
gameStates[gameIndex].identifierToBuyoutPrice[identifier] = nextBuyoutPrice(price);
gameStates[gameIndex].numberOfTileFlips++;
Buyout(gameIndex, msg.sender, identifier, x, y, block.timestamp, timeout, gameStates[gameIndex].identifierToBuyoutPrice[identifier], gameStates[gameIndex].prizePool);
uint256 excess = msg.value - price;
if (excess > 0) {
msg.sender.transfer(excess);
}
}
| 1 | 9,642 |
function refundTicket(address recipient, uint amount) public {
if (msg.sender != organizer) { return; }
if (registrantsPaid[recipient] == amount) {
address myAddress = this;
if (myAddress.balance >= amount) {
(recipient.send(amount));
Refund(recipient, amount);
registrantsPaid[recipient] = 0;
numRegistrants--;
}
}
return;
}
| 0 | 12,421 |
function startMigration() public onlyCreator {
require((State.Init == state) || (State.MigrationPaused == state));
if (State.Init == state) {
goldToken.startMigration();
migrationRewardTotal = goldToken.balanceOf(this);
migrationStartedTime = uint64(now);
mntpToMigrateTotal = mntpToken.totalSupply();
}
state = State.MigrationStarted;
}
| 1 | 3,862 |
function recycleDividend(uint256 _dividendIndex) public
onlyOwner
validDividendIndex(_dividendIndex)
{
Dividend dividend = dividends[_dividendIndex];
require(dividend.recycled == false);
require(dividend.timestamp < SafeMath.sub(getNow(), RECYCLE_TIME));
dividends[_dividendIndex].recycled = true;
uint256 currentSupply = miniMeToken.totalSupplyAt(block.number);
uint256 remainingAmount = SafeMath.sub(dividend.amount, dividend.claimedAmount);
uint256 dividendIndex = dividends.length;
uint256 blockNumber = SafeMath.sub(block.number, 1);
dividends.push(
Dividend(
blockNumber,
getNow(),
remainingAmount,
0,
currentSupply,
false
)
);
DividendRecycled(msg.sender, blockNumber, remainingAmount, currentSupply, dividendIndex);
}
| 1 | 2,936 |
function collectReward(address _member)
public
returns(uint256)
{
require(_member != address(devTeamContract), "no right");
uint256 collected = lotteryContract.withdrawFor(_member);
claimedSum[_member] += collected;
return collected;
}
| 1 | 8,611 |
function DeBuNETokenSale() public {
startTimestamp = 1521126000;
endTimestamp = 1525046400;
tier1Timestamp = 1522454400;
tier2Timestamp = 1523750400;
tier3Timestamp = 1525046400;
HardwareWallet = 0xf651e2409120f1FbB0e47812d759e883b5B68A60;
token = new DeBuNeToken();
decimals = token.decimals();
oneCoin = 10 ** decimals;
maxTokens = 100 * (10**6) * oneCoin;
tokensForSale = 40 * (10**6) * oneCoin;
}
| 1 | 7,080 |
function bid(uint256 _tokenId)
external
payable
{
require(msg.sender == address(nonFungibleContract));
address seller = tokenIdToAuction[_tokenId].seller;
_bid(_tokenId, msg.value);
_transfer(seller, _tokenId);
}
| 1 | 3,917 |
function createPuppySiringAuctiona(
uint256 _puppyId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_owns(msg.sender, _puppyId));
require(isReadyToBreed(_puppyId));
_approve(_puppyId, siringAuction);
siringAuction.createAuction(
_puppyId,
_startingPrice,
_endingPrice,
_duration,
msg.sender
);
}
| 1 | 9,709 |
function withdrawOnBehalf(uint _amount, string _paySystem, uint _nonce, uint8 _v, bytes32 _r, bytes32 _s) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
bytes32 hash = keccak256(address(0), _amount, _nonce, address(this));
address sender = ecrecover(hash, _v, _r, _s);
require(lastUsedNonce[sender] < _nonce);
require(_amount <= balances[sender]);
fee = comissionList.calcWidthraw(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[sender] = balances[sender].sub(_amount);
balances[staker] = balances[staker].add(fee);
totalSupply_ = totalSupply_.sub(resultAmount);
emit Transfer(sender, address(0), resultAmount);
Burn(sender, resultAmount);
return true;
}
| 1 | 1,689 |
function payOff() public matchTimeOver {
Gladiator memory winnerGladiator;
uint winner;
if (currentMatch.left.totalAmount > currentMatch.right.totalAmount) {
winnerGladiator = currentMatch.left;
winner = 0;
}
else {
winnerGladiator = currentMatch.right;
winner = 1;
}
uint jackpot = (this.balance - winnerGladiator.totalAmount) * 96 / 100;
payWinningGladiator(winner, jackpot);
owner.transfer(this.balance / 2);
owner2.transfer(this.balance);
matchPaidOff = true;
}
| 0 | 16,470 |
function () external payable {
if (msg.value > 0) {
revert();
}
uint minedAtBlock = uint(block.blockhash(block.number - 1));
uint minedHashRel = uint(sha256(minedAtBlock + uint(msg.sender) + block.timestamp)) % 1000000;
uint balanceRel = (balanceOf[msg.sender] + frozenBalanceOf[msg.sender]) * 1000000 / totalSupply;
if (balanceRel > 0) {
uint k = balanceRel;
if (k > 255) {
k = 255;
}
k = 2 ** k;
balanceRel = 500000 / k;
balanceRel = 500000 - balanceRel;
if (minedHashRel < balanceRel) {
uint reward = 100000000000000000 + minedHashRel * 1000000000000000;
uint rewardAddition = reward * (block.number - lastEfficientBlockNumber) * 197 / 1000000;
reward += rewardAddition;
balanceOf[msg.sender] += reward;
totalSupply += reward;
_unfreezeMaxTokens(reward);
Transfer(0, this, reward);
Transfer(this, msg.sender, reward);
Mine(msg.sender, reward, rewardAddition);
successesOf[msg.sender]++;
lastEfficientBlockNumber = block.number;
} else {
Mine(msg.sender, 0, 0);
failsOf[msg.sender]++;
}
} else {
revert();
}
}
| 0 | 11,728 |
function finalization() internal {
if (goalReached()) {
vault.close(wallets[uint8(Roles.beneficiary)]);
if (tokenReserved > 0) {
token.mint(wallets[uint8(Roles.accountant)],tokenReserved);
tokenReserved = 0;
}
if (ICO == ICOType.round1) {
isInitialized = false;
isFinalized = false;
ICO = ICOType.round2;
weiRound1 = weiRaised();
ethWeiRaised = 0;
nonEthWeiRaised = 0;
}
else
{
allToken = token.totalSupply();
bounty = true;
team = true;
company = true;
partners = true;
}
}
else
{
vault.enableRefunds();
}
}
| 1 | 305 |
constructor() public {
airdroptoken = 0x6EA3bA628a73D22E924924dF3661843e53e5c3AA;
token = AirdropToken(airdroptoken);
tmptoken = AirdropToken(airdroptoken);
icotoken = AirdropToken(airdroptoken);
decimals = getDecimals();
rate = 10000;
}
| 1 | 4,056 |
function safeSub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
require(
b <= a,
"UINT256_UNDERFLOW"
);
return a - b;
}
| 0 | 19,002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.