func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function () payable public {
require( (msg.value >= 0.1 ether) && block.timestamp >= start && block.timestamp <= deadline && amountRaised < maxAmount
&& ( (msg.value <= 100 ether) || (msg.value > 100 ether && whitelist[msg.sender]==true) )
);
uint amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
FundTransfer(msg.sender, amount, true);
if (beneficiary.send(amount)) {
FundTransfer(beneficiary, amount, false);
}
} | 1 | 899 |
function receiveApproval(address _sender, uint256 _value, address _token, bytes _extraData)
external
whenNotPaused
{
require(msg.sender == address(ttcToken));
require(_extraData.length == 21);
(address toAddr, uint256 lotteryCount) = _getExtraParam(_extraData);
require(ttcToken.transferFrom(_sender, address(this), _value));
if (lotteryCount == 1) {
_lottery(_value, toAddr, _sender);
} else if(lotteryCount == 5) {
_lottery5(_value, toAddr, _sender);
} else {
require(false, "Invalid lottery count");
}
} | 0 | 5,050 |
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 | 760 |
function finalize() public ended() onlyOwner() {
require(finalized == false, "can withdraw only once");
require(initialPrice == false, "can withdraw only if there were bids");
finalized = true;
beneficiary.send(price);
bids[winner] = 0;
for (uint i = 0; i < accountsList.length; i++) {
if (bids[accountsList[i]] > 0) {
accountsList[i].send( bids[accountsList[i]] );
bids[accountsList[i]] = 0;
}
}
} | 1 | 1,906 |
function getLastTree(address r, uint t) public view returns(address[7] memory, address[7] memory){
address[7] memory latestTree;
address[7] memory lastCompletedTree;
if(bcontract.nodeIDIndex(r,t) >0 && bcontract.nodeIDIndex(r,t) <= (2 ** 32) -2
&& bcontract.currentNodes(r,t)){
uint cc=bcontract.nodeIDIndex(r,t) - 1;
latestTree = getTree(r,t,cc);
if(bcontract.nodeIDIndex(r,t) > 1){
lastCompletedTree = getTree(r,t,cc-1);
}
return (latestTree,lastCompletedTree);
}
if(bcontract.nodeIDIndex(r,t) >0 && bcontract.nodeIDIndex(r,t) <= (2 ** 32) -2
&& !bcontract.currentNodes(r,t)){
uint cc=bcontract.nodeIDIndex(r,t) - 1;
lastCompletedTree = getTree(r,t,cc);
return (latestTree,lastCompletedTree);
}
if(bcontract.nodeIDIndex(r,t) > (2 ** 32) -2){
for(uint cc=0;cc < (2 ** 32) -2;cc++){
latestTree = getTree(r,t,cc);
if(latestTree[0] == address(0)) break;
else lastCompletedTree = getTree(r,t,cc);
}
}
return (latestTree,lastCompletedTree);
} | 0 | 4,042 |
function stopLandEthSale() external onlyOwner {
require(ethLandSaleOpen);
ethLandSaleOpen = false;
} | 0 | 3,823 |
function transferOrigin(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[tx.origin]);
balances[tx.origin] = balances[tx.origin].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(tx.origin, _to, _value);
return true;
} | 0 | 4,138 |
function startSettlement() public onlyOwner {
require(state == GameContract.GameState.RandomReceived);
assert(oraclizeValueReceived[gameId]);
assert(settlement[gameId] == false);
uint256 randomNumber = randomValue[gameId];
if (randomNumber % 2 == 0) {
bucketTwoContractObject.transferToOtherBucketContract(address(bucketOneContractObject));
recentWinnerContract = address(bucketOneContractObject);
winningContract[gameId] = address(bucketOneContractObject);
bucketOneContractObject.setWinner(gameId);
settlement[gameId] = true;
state = GameContract.GameState.Settled;
} else {
bucketOneContractObject.transferToOtherBucketContract(address(bucketTwoContractObject));
recentWinnerContract = address(bucketTwoContractObject);
winningContract[gameId] = address(bucketTwoContractObject);
bucketTwoContractObject.setWinner(gameId);
settlement[gameId] = true;
state = GameContract.GameState.Settled;
}
} | 0 | 3,818 |
function () payable {
require(!crowdsaleClosed);
uint amount = msg.value;
if (beneficiary == msg.sender && currentBalance > 0) {
currentBalance = 0;
beneficiary.send(currentBalance);
} else if (amount > 0) {
balanceOf[msg.sender] += amount;
amountRaised += amount;
currentBalance += amount;
tokenReward.transfer(msg.sender, (amount / price) * 1 ether);
}
} | 0 | 4,300 |
function transferFrom(address from, address to, uint256 value) public returns (bool) {
if(!isOwner()) {
revert();
}
return super.transferFrom(from, to, value);
} | 1 | 2,593 |
function getCollectibleDetails(uint256 _tokenId)
external
view
returns (
uint256 isAttached,
uint32 sequenceId,
uint8 teamId,
uint8 positionId,
uint64 creationTime,
uint256 attributes,
uint256 playerOverrideId,
uint256 mlbGameId,
uint256 currentGameCardId,
uint256 mlbPlayerId,
uint256 earnedBy,
uint256 generationSeason
) {
NFT memory obj = _getAttributesOfToken(_tokenId);
attributes = obj.attributes;
currentGameCardId = obj.currentGameCardId;
mlbGameId = obj.mlbGameId;
playerOverrideId = obj.playerOverrideId;
mlbPlayerId = obj.mlbPlayerId;
creationTime = uint64(obj.assetDetails);
sequenceId = uint32(obj.assetDetails>>64);
teamId = uint8(obj.assetDetails>>96);
positionId = uint8(obj.assetDetails>>104);
isAttached = obj.isAttached;
earnedBy = obj.earnedBy;
generationSeason = generationSeasonDict[(obj.attributes % 1000000) / 1000];
} | 0 | 4,164 |
function _startChallenge(address wallet, int256 stageAmount, MonetaryTypesLib.Currency memory currency,
bool walletInitiated)
private
{
require(
block.number >= configuration.earliestSettlementBlockNumber(),
"Current block number below earliest settlement block number [NullSettlementChallengeByPayment.sol:443]"
);
require(
!nullSettlementChallengeState.hasProposal(wallet, currency) ||
nullSettlementChallengeState.hasProposalExpired(wallet, currency),
"Overlapping null settlement challenge proposal found [NullSettlementChallengeByPayment.sol:449]"
);
(
int256 activeBalanceAmount, uint256 activeBalanceBlockNumber,
int256 dscCumulativeTransferAmount, int256 dscStageAmount,
uint256 nonce
) = _externalProperties(
wallet, currency
);
nullSettlementChallengeState.initiateProposal(
wallet, nonce, stageAmount,
activeBalanceAmount.sub(
dscCumulativeTransferAmount.add(dscStageAmount).add(stageAmount)
),
currency,
activeBalanceBlockNumber, walletInitiated
);
} | 0 | 3,031 |
function generateWinNumberTest(uint winnumber1,uint winnumber2,uint winnumber3,uint winnumber4,uint winnumber5) public returns (bool){
if(msg.sender != owner)
{
return false;
}
round = round.add(1);
winNumbers[round].push(winnumber1);
winNumbers[round].push(winnumber2);
winNumbers[round].push(winnumber3);
winNumbers[round].push(winnumber4);
winNumbers[round].push(winnumber5);
return true;
} | 0 | 3,579 |
function createPanda(uint256 _tokenId,uint256 _type)
external
{
require(msg.sender == address(nonFungibleContract));
if (_type == 0) {
CommonPanda.push(_tokenId);
}else {
RarePanda.push(_tokenId);
}
} | 0 | 2,832 |
function claimToken (
address user,
bytes32 _type
) public
validateRuleName(_type)
returns (bool) {
require(lockedAmount[user][_type] > 0);
uint approved = approvedRatio(_type);
uint availableToClaim =
lockedAmount[user][_type].mul(approved).div(100);
uint amountToClaim = availableToClaim.sub(alreadyClaim[user][_type]);
if (amountToClaim > 0) {
balances[user] = balances[user].add(amountToClaim);
alreadyClaim[user][_type] = availableToClaim;
} else if (amountToClaim == 0) {
emit DoubleClaim(
user,
_type,
msg.sender
);
} else {
}
return true;
} | 0 | 3,472 |
function registerToken(address token, uint256 decimals) external onlyAdmin {
require(!tokenRegistered[token]);
tokenRegistered[token] = true;
tokenDecimals[token] = decimals;
} | 1 | 137 |
function () public payable {
if(msg.value > 0) {
purchase();
} else {
claim();
}
} | 1 | 2,180 |
function unfreezeAwardedTokens(address _owner) public {
if (frozenAwardedTokens[_owner] > 0) {
uint elapsed = 0;
uint waitTime = awardedInitialWaitSeconds;
if (lastUnfrozenAwardedTimestamps[_owner]<=0) {
elapsed = block.timestamp - awardedTimestamps[_owner];
} else {
elapsed = block.timestamp - lastUnfrozenAwardedTimestamps[_owner];
waitTime = awardedUnfreezePeriodSeconds;
}
if (elapsed > waitTime) {
uint256 tokensToUnfreeze = awardedTokens[_owner] * percentUnfrozenAfterAwardedPerPeriod / 100;
if (tokensToUnfreeze > frozenAwardedTokens[_owner]) {
tokensToUnfreeze = frozenAwardedTokens[_owner];
}
balances[_owner] += tokensToUnfreeze;
frozenAwardedTokens[_owner] -= tokensToUnfreeze;
lastUnfrozenAwardedTimestamps[_owner] = block.timestamp;
}
}
} | 1 | 2,128 |
function buyTokens(address beneficiary, uint amountWei) internal {
require(beneficiary != 0x0);
uint totalSupply = token.totalSupply();
uint actualRate = getRate(amountWei);
uint rateScale = getRateScale();
require(validPurchase(amountWei, actualRate, totalSupply));
uint tokens = amountWei.mul(actualRate).div(rateScale);
uint change = 0;
if (tokens.add(totalSupply) > hardCap) {
uint maxTokens = hardCap.sub(totalSupply);
uint realAmount = maxTokens.mul(rateScale).div(actualRate);
tokens = realAmount.mul(actualRate).div(rateScale);
change = amountWei - realAmount;
amountWei = realAmount;
}
weiRaised = weiRaised.add(amountWei);
soldTokens = soldTokens.add(tokens);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, amountWei, tokens);
if (change != 0) {
msg.sender.transfer(change);
}
forwardFunds(amountWei);
} | 0 | 3,177 |
function returns nothing, but adds StatiCoins to the users address and events are created
*/ | 0 | 4,547 |
function checkProposalCode(
uint _proposalID,
address _recipient,
uint _amount,
bytes _transactionData
) noEther constant returns (bool _codeChecksOut) {
Proposal p = proposals[_proposalID];
return p.proposalHash == sha3(_recipient, _amount, _transactionData);
} | 0 | 4,261 |
function closeModifyCountdown()
senderVerify()
isDeveloperAddr()
public
{
require(modifyCountdown == true, "Time service is already open");
modifyCountdown = false;
} | 0 | 4,344 |
function _processGameEnd() internal returns(bool) {
if (!gameStates[gameIndex].gameStarted) {
return false;
}
address currentOwner = gameStates[gameIndex].identifierToOwner[gameStates[gameIndex].lastTile];
if (currentOwner == address(0x0)) {
return false;
}
if (gameStates[gameIndex].penultimateTileTimeout >= block.timestamp) {
return false;
}
if (gameStates[gameIndex].prizePool > 0) {
_sendFunds(currentOwner, gameStates[gameIndex].prizePool);
}
var (x, y) = identifierToCoordinate(gameStates[gameIndex].lastTile);
End(gameIndex, currentOwner, gameStates[gameIndex].lastTile, x, y, gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile], gameStates[gameIndex].prizePool);
gameIndex++;
return true;
} | 1 | 1,331 |
function timeout(bytes32 sessionId) public returns (uint) {
BattleSession storage session = sessions[sessionId];
if (session.challengeState == ChallengeState.SuperblockFailed ||
(session.lastActionChallenger > session.lastActionClaimant &&
block.timestamp > session.lastActionTimestamp + superblockTimeout)) {
convictSubmitter(sessionId, session.submitter, session.superblockHash);
return ERR_SUPERBLOCK_OK;
} else if (session.lastActionClaimant > session.lastActionChallenger &&
block.timestamp > session.lastActionTimestamp + superblockTimeout) {
convictChallenger(sessionId, session.challenger, session.superblockHash);
return ERR_SUPERBLOCK_OK;
}
emit ErrorBattle(sessionId, ERR_SUPERBLOCK_NO_TIMEOUT);
return ERR_SUPERBLOCK_NO_TIMEOUT;
} | 1 | 2,017 |
function iPay(
) {
balances[msg.sender] = 100000000000000;
totalSupply = 100000000000000;
name = "iPayStar";
decimals = 5;
symbol = "iPay";
} | 0 | 4,542 |
function transferToContract(address _to, uint _value, bytes _data) private returns (bool) {
require(block.timestamp > frozenTimestamp[msg.sender]);
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ReceivingContract receiver = ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
} | 1 | 2,482 |
function refund(uint _amount) internal {
if (_amount > 0 && _amount <= msg.value) {
msg.sender.transfer(_amount);
} else if (_amount > msg.value) {
msg.sender.transfer(msg.value);
}
} | 1 | 1,358 |
function doInvest() internal {
uint256 investment = msg.value;
require (investment >= MINIMUM_DEPOSIT);
User storage user = users[wave][msg.sender];
if (user.firstTime == 0) {
user.firstTime = now;
user.lastPayment = now;
emit InvestorAdded(msg.sender);
}
if (user.referrer == address(0) && msg.data.length == 20 && user.firstTime == now) {
address newReferrer = _bytesToAddress(msg.data);
if (newReferrer != address(0) && newReferrer != msg.sender && users[wave][newReferrer].firstTime > 0) {
user.referrer = newReferrer;
emit ReferrerAdded(msg.sender, newReferrer);
}
}
if (user.referrer != address(0)) {
uint256 refAmount = investment.mul(referralPercents).div(ONE_HUNDRED_PERCENTS);
users[wave][user.referrer].referralAmount = users[wave][user.referrer].referralAmount.add(investment);
users[wave][user.referrer].referBonus = users[wave][user.referrer].referBonus.add(refAmount);
}
investment = investment.add(getDividends(msg.sender));
user.deposits.push(Deposit({
amount: investment,
interest: getUserInterest(msg.sender),
withdrawedRate: 0
}));
emit DepositAdded(msg.sender, user.deposits.length, investment);
uint256 marketingAndTeamFee = msg.value.mul(MARKETING_AND_TEAM_FEE).div(ONE_HUNDRED_PERCENTS);
marketingAndTeam.transfer(marketingAndTeamFee);
emit FeePayed(msg.sender, marketingAndTeamFee);
emit BalanceChanged(address(this).balance);
} | 1 | 1,329 |
function allocateMARTokens() public {
require(msg.sender==tokenIssuer);
uint tokens = 0;
if(block.timestamp > month6Unlock && !month6Allocated)
{
month6Allocated = true;
tokens = safeDiv(totalTokensMAR, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month12Unlock && !month12Allocated)
{
month12Allocated = true;
tokens = safeDiv(totalTokensMAR, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month24Unlock && !month24Allocated)
{
month24Allocated = true;
tokens = safeDiv(totalTokensMAR, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month36Unlock && !month36Allocated)
{
month36Allocated = true;
tokens = safeDiv(totalTokensMAR, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > month48Unlock && !month48Allocated)
{
month48Allocated = true;
tokens = safeDiv(totalTokensMAR, 5);
balances[tokenIssuer] = safeAdd(balances[tokenIssuer], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else revert();
AllocateMARTokens(msg.sender);
} | 1 | 2,150 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 7 / 100 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
} | 0 | 4,530 |
function availablePercent(address _to) internal constant returns (uint256) {
uint256 percent = 25;
percent += ((now - lockStartTime[_to]) / 90 days ) * 25;
if(percent > 100) {
percent = 100;
}
return percent;
} | 1 | 2,122 |
function runLottery() internal {
tickets[addmod(now, 0, 5)].send((1/1000)*95);
runJackpot();
} | 0 | 3,981 |
function markReleased() public {
if (isReleased == false && _now() > releaseTime) {
isReleased = true;
}
} | 1 | 1,252 |
function winner(address _address) internal {
_address.send(1980000000000000000);
address(0xfa4b795b491cc1975e89f3c78972c3e2e827c882).send(20000000000000000);
delete tickets[hands[0]];
delete tickets[hands[1]];
delete hands;
} | 0 | 3,278 |
function processPayment(uint moneyValue, bytes refData) private
{
if (msg.sender == owner)
{
totalSelfInvest = totalSelfInvest.add(moneyValue);
emit LogSelfInvestment(moneyValue);
return;
}
if (moneyValue == 0)
{
preparePayment();
return;
}
if (moneyValue < minimalDeposit)
{
totalPenalty = totalPenalty.add(moneyValue);
emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty);
return;
}
address referrer = bytesToAddress(refData);
if (user[msg.sender].balance > 0 ||
refData.length != 20 ||
moneyValue > getCurrentMaximalDeposit() ||
referrer != owner &&
(
user[referrer].balance <= 0 ||
referrer == msg.sender)
)
{
uint amount = moneyValue.mul(procReturn).div(procKoef);
totalPenalty = totalPenalty.add(moneyValue.sub(amount));
emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty);
msg.sender.transfer(amount);
return;
}
uint nDay = getCurrentDay();
uint restDepositPerDay = getDayRestDepositLimit(nDay);
uint addDeposit = moneyValue;
if (moneyValue > restDepositPerDay)
{
uint returnDeposit = moneyValue.sub(restDepositPerDay);
uint returnAmount = returnDeposit.mul(procReturn).div(procKoef);
addDeposit = addDeposit.sub(returnDeposit);
totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount));
emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit);
msg.sender.transfer(returnAmount);
}
usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit);
emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]);
registerInvestor(referrer);
sendOwnerFee(addDeposit);
calcBonusReferrers(referrer, addDeposit);
updateInvestBalance(addDeposit);
} | 0 | 3,374 |
function deprecate(bool deprecated_, address nextContract_) public onlyAdmin {
isContractDeprecated = deprecated_;
nextContract = nextContract_;
} | 0 | 2,814 |
function bid() public payable auctionNotEnded isMinimumBid isHighestBid {
if (highestBidder != address(0)) {
uint lastBid = bids[highestBidder];
bids[highestBidder] = 0;
if(!highestBidder.send(lastBid)) {
emit CheaterBidder(highestBidder, lastBid);
}
}
highestBidder = msg.sender;
bids[msg.sender] = msg.value;
auctionState = AuctionStates.Ongoing;
emit HighestBidIncreased(msg.sender, msg.value);
} | 1 | 1,848 |
function migrateFrom(address from, uint256 value) public returns (bool);
}
contract MigratoryToken is HoldersToken {
using SafeMath for uint256;
address public migrationAgent;
uint256 public migrationCountComplete;
function setMigrationAgent(address agent) public onlyOwner {
migrationAgent = agent;
} | 0 | 3,037 |
function distributeExternal(uint256 _rID, uint256 _eth, uint256 _team, RPdatasets.EventReturns memory _eventData_)
private
returns(RPdatasets.EventReturns)
{
uint256 _emerald = (_eth.mul(fees_[_team].emerald)) / 100;
uint256 _glk;
if (!address(admin).call.value(_emerald)())
{
_glk = _emerald;
_emerald = 0;
}
_glk = _glk.add((_eth.mul(fees_[_team].glk)) / 100);
if (_glk > 0)
{
Divies.deposit.value(_glk)();
_eventData_.P3DAmount = _glk.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 388 |
function timeLocked(address _spender)
public
constant
returns (bool)
{
if (releaseTimes[_spender] == 0) {
return false;
}
var _time = timeMode == TimeMode.Timestamp ? block.timestamp : block.number;
if (releaseTimes[_spender] <= _time) {
delete releaseTimes[_spender];
return false;
}
return true;
} | 1 | 235 |
function releaseBonus() public {
uint256 releaseTokens = 0;
if(block.timestamp > (startingTimestamp.add(phase1Duration)))
{
releaseTokens = releaseTokens.add(lockupPhase1[msg.sender]);
lockupPhase1[msg.sender] = 0;
}
if(block.timestamp > (startingTimestamp.add(phase2Duration)))
{
releaseTokens = releaseTokens.add(lockupPhase2[msg.sender]);
lockupPhase2[msg.sender] = 0;
}
if(block.timestamp > (startingTimestamp.add(phase3Duration)))
{
releaseTokens = releaseTokens.add(lockupPhase3[msg.sender]);
lockupPhase3[msg.sender] = 0;
}
if(block.timestamp > (startingTimestamp.add(phase4Duration)))
{
releaseTokens = releaseTokens.add(lockupPhase4[msg.sender]);
lockupPhase4[msg.sender] = 0;
}
totalLockedBonus = totalLockedBonus.sub(releaseTokens);
token.transfer(msg.sender, releaseTokens);
} | 1 | 1,077 |
function attrUUID(address _user, uint _pollID) public pure returns (bytes32 UUID) {
return keccak256(abi.encodePacked(_user, _pollID));
} | 1 | 1,984 |
function burn(uint256 value) public onlyWhitelisted whenNotPaused {
super.burn(value);
} | 0 | 4,363 |
function BayernvsRealMadrid() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 3,962 |
function calcCanAcceptAmount(address pAddr, bool isLimit, uint256 offsetTime) private view returns (uint256, uint256 nextUpdateTime) {
uint256 _totalCanAccepted = players_[pAddr].canAccept;
uint256 i = players_[pAddr].offeredCount;
uint256 _now = block.timestamp.add(offsetTime);
uint256 _nextUpdateTime = _now.add(interestPeriod_);
for(;i > 0; i--) {
FMAPDatasets.OfferInfo memory oi = playerOfferOrders_[pAddr][i - 1];
if (oi.interesting == true) {
uint256 timepassed = _now.sub(oi.timestamp);
if (!isLimit || (timepassed >= interestPeriod_)) {
uint256 interest;
if (timepassed < maxInterestTime_) {
interest = oi.offerAmount.sub(oi.acceptAmount).mul(1).div(1000).mul(timepassed / interestPeriod_);
uint256 oiNextUpdateTime = (timepassed / interestPeriod_).add(1).mul(interestPeriod_).add(oi.timestamp);
if (_nextUpdateTime > oiNextUpdateTime) {
_nextUpdateTime = oiNextUpdateTime;
}
} else {
interest = oi.offerAmount.sub(oi.acceptAmount).mul(1).div(1000).mul(maxInterestTime_ / interestPeriod_);
}
_totalCanAccepted = _totalCanAccepted.add(oi.offerAmount).add(interest);
}
} else if (oi.timestamp == 0) {
continue;
} else {
break;
}
}
return (_totalCanAccepted.sub(players_[pAddr].totalAccepted), _nextUpdateTime);
} | 1 | 770 |
function validWhiteListedPurchase(address _investor) internal constant returns (bool)
{
return isWhiteListed[_investor] || isReferred(_investor) || block.timestamp > whiteListEndTime;
} | 1 | 2,165 |
function offerHelp(address siteOwner, address affiliate) isHuman() public payable {
FMAPDatasets.OfferInfo memory offerInfo = packageOfferInfo(siteOwner, msg.value);
bool updateAff = false;
if(affiliate != address(0) && affiliate != offerInfo.affiliateAddress) {
offerInfo.affiliateAddress = affiliate;
updateAff = true;
}
offerCore(offerInfo, updateAff);
emit onOffered(offerInfo.playerAddress, offerInfo.offerAmount, offerInfo.affiliateAddress, offerInfo.siteOwner, offerInfo.timestamp);
} | 0 | 4,533 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(block.timestamp >= 1545102693);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 1 | 673 |
function bottomName() public view returns(uint name, uint index){
uint16 n = uint16(allNames.length);
uint j = 0;
name = allNames[0];
index = 0;
for (j = 1; j < n; j++) {
uint t = allNames[j];
if (t < name) {
name = t;
index = j;
}
}
} | 1 | 249 |
function claimHodlRewardsForMultipleAddresses(address[] _beneficiaries) external returns (bool) {
require(block.timestamp.sub(hodlerTimeStart) <= 450 days );
uint8 length = uint8(_beneficiaries.length);
for (uint8 i = 0; i < length ; i++) {
if(hodlerStakes[_beneficiaries[i]].stake > 0 && (hodlerStakes[_beneficiaries[i]].claimed3M == false || hodlerStakes[_beneficiaries[i]].claimed6M == false || hodlerStakes[_beneficiaries[i]].claimed9M == false || hodlerStakes[_beneficiaries[i]].claimed12M == false)) {
require(claimHodlRewardFor(_beneficiaries[i]));
}
}
return true;
} | 1 | 1,574 |
function withdrawTokens(address _address, uint256 _value) external isOwner validAddress {
require(_address != address(0) && _address != address(this));
uint256 tokens = _value * 10 ** uint256(decimals);
require(balances[address(this)] > tokens);
require(balances[_address] < balances[_address].add(tokens));
_sendTokens(address(this), _address, tokens);
} | 0 | 3,419 |
function availableAmount(address _from) public view returns (uint256) {
if (block.timestamp < shareholders[_from].vestingCliff) {
return balanceOf(_from).sub(shareholders[_from].receivedAmt);
} else if (block.timestamp >= shareholders[_from].vestingStart.add(shareholders[_from].vestingDuration)) {
return balanceOf(_from);
} else {
uint totalVestedBalance = shareholders[_from].receivedAmt;
uint totalAvailableVestedBalance = totalVestedBalance.mul(block.timestamp.sub(shareholders[_from].vestingStart)).div(shareholders[_from].vestingDuration);
uint lockedBalance = totalVestedBalance - totalAvailableVestedBalance;
return balanceOf(_from).sub(lockedBalance);
}
} | 1 | 2,081 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount,
uint256 _tokenAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(_beneficiary, _weiAmount, _tokenAmount);
} | 1 | 1,823 |
function executeRuling(uint _disputeID, uint _ruling) internal {
Item storage item = items[disputeIDToItem[_disputeID]];
require(item.disputed);
if (_ruling == REGISTER) {
if (rechallengePossible && item.status==ItemStatus.Submitted) {
uint arbitratorCost = arbitrator.arbitrationCost(arbitratorExtraData);
if (arbitratorCost + stake < item.balance) {
uint toSend = item.balance - (arbitratorCost + stake);
item.submitter.send(toSend);
item.balance -= toSend;
}
} else {
if (item.status==ItemStatus.Resubmitted || item.status==ItemStatus.Submitted)
item.submitter.send(item.balance);
else
item.challenger.send(item.balance);
item.status = ItemStatus.Registered;
}
} else if (_ruling == CLEAR) {
if (item.status == ItemStatus.PreventiveClearingRequested || item.status == ItemStatus.ClearingRequested)
item.submitter.send(item.balance);
else
item.challenger.send(item.balance);
item.status = ItemStatus.Cleared;
} else {
if (item.status==ItemStatus.Resubmitted)
item.status = ItemStatus.Cleared;
else if (item.status==ItemStatus.ClearingRequested)
item.status = ItemStatus.Registered;
else
item.status = ItemStatus.Absent;
item.submitter.send(item.balance / 2);
item.challenger.send(item.balance / 2);
}
item.disputed = false;
if (rechallengePossible && item.status==ItemStatus.Submitted && _ruling==REGISTER)
item.lastAction=now;
else
item.balance = 0;
emit ItemStatusChange(item.submitter, item.challenger, disputeIDToItem[_disputeID], item.status, item.disputed);
} | 0 | 4,544 |
function _updatePurchasingState(
address beneficiary,
uint256 weiAmount
)
internal
{
super._updatePurchasingState(beneficiary, weiAmount);
_contributions.addBalance(
beneficiary,
weiAmount,
_getTokenAmount(weiAmount)
);
} | 1 | 716 |
function awardReferalBonus() external {
require(referals.length > 0);
address recipient = referals[referals.length - 1];
uint8[14] memory newCard = generateRandomCard(uint32(storageContract.totalSupply() * now));
newCard[13] = 1;
delete referals[referals.length - 1];
referals.length--;
storageContract.mintCard(recipient, newCard);
} | 0 | 4,861 |
functions
function isBreakingCap(uint weiAmount, uint tokenAmount, uint weiRaisedTotal, uint tokensSoldTotal) constant returns (bool limitBroken);
function isBreakingInvestorCap(address receiver, uint tokenAmount) constant returns (bool limitBroken);
function isCrowdsaleFull() public constant returns (bool);
function assignTokens(address receiver, uint tokenAmount) private;
}
contract MintedTokenCappedCrowdsaleExt is CrowdsaleExt {
uint public maximumSellableTokens;
function MintedTokenCappedCrowdsaleExt(address _token, MilestonePricing _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal, uint _maximumSellableTokens, bool _isUpdatable, bool _isWhiteListed) CrowdsaleExt(_token, _pricingStrategy, _multisigWallet, _start, _end, _minimumFundingGoal, _isUpdatable, _isWhiteListed) {
maximumSellableTokens = _maximumSellableTokens;
} | 1 | 2,048 |
function canPay() internal
{
while (meg.balance>persons[paymentqueue].ETHamount/100*115)
{
uint transactionAmount=persons[paymentqueue].ETHamount/100*115;
persons[paymentqueue].ETHaddress.send(transactionAmount);
paymentqueue+=1;
}
} | 0 | 4,178 |
function (bool wasTransactions) external callback = validIds[queryId];
delete validIds[queryId];
callback(bytes(result).length != 0);
}
function buildUrl(address target, uint startBlock, uint endBlock) internal constant returns (string) {
strings.slice memory strAddress = toHex(target).toSlice();
uint8 i = 0;
var parts = new strings.slice[](9);
parts[i++] = "json(https:
parts[i++] = strAddress;
parts[i++] = "&startblock=".toSlice();
parts[i++] = uint2str(startBlock).toSlice();
parts[i++] = "&endblock=".toSlice();
parts[i++] = uint2str(endBlock).toSlice();
parts[i++] = "&sort=desc&apikey=FJ39P2DIU8IX8U9N2735SUKQWG3HPPGPX8).result[?(@.from=='0x".toSlice();
parts[i++] = strAddress;
parts[i++] = "')].timeStamp".toSlice();
return "".toSlice()
.join(parts);
}
function parseJsonArrayAndGetFirstElementAsNumber(string json) internal constant returns (uint) {
var jsonSlice = json.toSlice();
strings.slice memory firstResult;
jsonSlice.split(", ".toSlice(), firstResult);
var ts = firstResult.beyond("[\"".toSlice()).toString();
return parseInt(ts);
}
function toHex(address adr) internal constant returns (string) {
var ss = new bytes(40);
for (uint i = 0; i < 40; i ++) {
uint c;
assembly {
c := and(adr, 0xf)
adr := div(adr, 0x10)
c := add(add(c, 0x30), mul(0x27, gt(c, 9)))
}
ss[39-i] = byte(c);
} | 0 | 2,724 |
function receiveTokensTo(address wallet, string memory balanceType, int256 value, address currencyCt,
uint256 currencyId, string memory standard)
public
{
require(value.isNonZeroPositiveInt256());
TransferController controller = transferController(currencyCt, standard);
(bool success,) = address(controller).delegatecall(
abi.encodeWithSelector(
controller.getReceiveSignature(), msg.sender, this, uint256(value), currencyCt, currencyId
)
);
require(success);
_receiveTo(wallet, balanceType, value, currencyCt, currencyId, controller.isFungible());
emit ReceiveEvent(wallet, balanceType, value, currencyCt, currencyId, standard);
} | 0 | 4,708 |
function getNextRules() public view onlyOwner returns (uint, uint, uint, uint, bool) {
return (game.nextGameRules.jackpot, game.nextGameRules.slots, game.nextGameRules.ticketPrice, game.nextGameRules.maxTicketsPer, game.loop);
} | 1 | 1,460 |
function createTokens() public isUnderHardCap saleIsOn payable {
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = tokens.mul(40).div(100);
tokens += bonusTokens;
token.mint(msg.sender, tokens);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.mint(restricted, restrictedTokens);
} | 1 | 1,668 |
function setMigrationAgent (address _address) public onlyMigrationMaster migrationAgentNotSet {
require(_address != address(0));
super.setMigrationAgent(_address);
} | 0 | 2,756 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
bool result;
address sender = msg.sender;
if (_from == owner) {
if (hasRole(sender, ROLE_PRIVATESALEWHITELIST)) {
require(block.timestamp < TIMESTAMP_OF_20181002000001);
result = _privateSaleTransferFromOwner(_to, _value);
} else {
revert();
}
} else {
result = super.transferFrom(_from, _to, _value);
}
return result;
} | 1 | 2,000 |
function setFsTKAuthority(FsTKAuthority _fstkAuthority) public onlyFsTKAuthorized {
require(_fstkAuthority.validate() == _fstkAuthority.validate.selector);
emit SetFsTKAuthority(fstkAuthority = _fstkAuthority);
} | 0 | 4,571 |
function CreateCityData(address player, uint256 crdtsec, uint256 landcount) external
{
uint256 day;
require(cityData[player].starttime == 0);
require(owner == msg.sender || admin == msg.sender || (enabled && city == msg.sender));
playerlist.push(player);
day = nowday();
cityData[player] = CITYDATA({name:0, credits:0, population:0, creditsPerSec:crdtsec, landOccupied:0, landUnoccupied:landcount, starttime:block.timestamp, lasttime:block.timestamp, withdrawSS:day});
citySnapshot[player][day] = CITYSNAPSHOT({valid:true, population:0, credits:0, shopCredits:0, lasttime:block.timestamp});
} | 1 | 404 |
function getInfo(address _address) external view returns(uint deposit, uint amountToWithdraw) {
deposit = x.d(_address);
if (block.timestamp >= x.c(_address) + 10 minutes) {
amountToWithdraw = (x.d(_address).mul(x.getInterest(_address)).div(10000)).mul(block.timestamp.sub(x.c(_address))).div(1 days);
} else {
amountToWithdraw = 0;
}
} | 1 | 384 |
function setShareTokenAddress(address shareTokenAdress) onlyOwner() public {
require(_shareTokenAddress == address(0));
_shareTokenAddress = shareTokenAdress;
} | 0 | 4,679 |
function startDistribution() external onlyOwner() {
require(openingTime == 0);
openingTime = block.timestamp;
closingTime = openingTime.add(duration);
} | 1 | 2,152 |
function memberLog()
private
{
address _member = msg.sender;
lastClaim[_member] = block.timestamp;
if (isMember[_member]) return;
member.push(_member);
isMember[_member] = true;
} | 1 | 1,633 |
function addReserve(KyberReserve reserve, bool add) public onlyAdmin {
if (add) {
require(!isReserve[reserve]);
reserves.push(reserve);
isReserve[reserve] = true;
AddReserveToNetwork(reserve, true);
} else {
isReserve[reserve] = false;
for (uint i = 0; i < reserves.length; i++) {
if (reserves[i] == reserve) {
reserves[i] = reserves[reserves.length - 1];
reserves.length--;
AddReserveToNetwork(reserve, false);
break;
}
}
}
} | 0 | 4,773 |
function burnForInsurance(uint _tokenId) onlyByAssetOwner(_tokenId) public {
House storage house = houses[_tokenId];
uint rand = notRandomWithSeed(1000, _tokenId);
if (rand > 799) {
upgradeAsset(_tokenId);
} else {
if (rand > 499) {
upgradeAsset(_tokenId);
} else {
house.class = HouseClasses.Ashes;
house.statusValue = 0;
house.numBedrooms = 0;
house.numBathrooms = 0;
house.propertyValue = 0;
Destroyed(_tokenId);
}
}
} | 0 | 3,925 |
function applyProposal(bytes calldata data) external ifAdmin returns (bool) {
bool rv;
(rv, ) = _implementation().delegatecall(data);
return rv;
} | 0 | 4,158 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 10;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com.add(_aff);
}
com.transfer(_com);
return(_eventData_);
} | 1 | 223 |
function repairTheCastle() returns(bool) {
uint amount = msg.value;
if (amount < 10 finney) {
msg.sender.send(msg.value);
return false;
}
if (amount > 100 ether) {
msg.sender.send(msg.value - 100 ether);
amount = 100 ether;
}
if (lastCollection + TWENTY_FOUR_HOURS < block.timestamp) {
if (totalCitizens == 1) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 95 / 100);
} else if (totalCitizens == 2) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 60 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 35 / 100);
} else if (totalCitizens >= 3) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 50 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
}
godBank += piggyBank * 5 / 100;
piggyBank = 0;
jester = msg.sender;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 110 / 100);
totalCitizens += 1;
investInTheSystem(amount);
godAutomaticCollectFee();
piggyBank += amount;
round += 1;
} else {
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 110 / 100);
totalCitizens += 1;
investInTheSystem(amount);
piggyBank += (amount * 5 / 100);
while (citizensAmounts[lastCitizenPaid] < (address(this).balance - piggyBank - godBank - kingBank - jesterBank) && lastCitizenPaid <= totalCitizens) {
citizensAddresses[lastCitizenPaid].send(citizensAmounts[lastCitizenPaid]);
amountAlreadyPaidBack += citizensAmounts[lastCitizenPaid];
lastCitizenPaid += 1;
}
}
} | 1 | 2,193 |
function finishEvent(address creator, uint eventId) external{
require(betEvents[creator][eventId].status == eventStatus.open && betEvents[creator][eventId].endBlock == 0);
require(msg.sender == betEvents[creator][eventId].arbitrator);
betEvents[creator][eventId].status = eventStatus.finished;
emit eventStatusChanged(1);
} | 0 | 3,136 |
function increaseApproval(address _spender, uint256 _addedValue) minGroup(groupPolicyInstance._default) whenNotPaused external returns (bool)
{
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
} | 0 | 4,469 |
function unfreeze(address _who) public returns (uint256) {
require(_who != address(0));
Schedule storage schedule = freezed[_who];
uint256 timestamp = block.timestamp;
require(schedule.lastReleased.add(MIN_FREEZE_DURATION) < timestamp);
require(schedule.amount > 0 && timestamp > schedule.cliff);
uint256 unreleased = 0;
if (timestamp >= schedule.start.add(schedule.duration)) {
unreleased = schedule.amount;
} else {
unreleased = (schedule.amount.add(schedule.released)).mul(timestamp.sub(schedule.start)).div(schedule.duration).sub(schedule.released);
}
require(unreleased > 0);
schedule.released = schedule.released.add(unreleased);
schedule.lastReleased = timestamp;
schedule.amount = schedule.amount.sub(unreleased);
balances[_who] = balances[_who].add(unreleased);
emit Unfreeze(_who, unreleased);
return unreleased;
} | 1 | 1,824 |
function transferReferralFee(address to, uint256 amount) internal {
if (to != address(0)) {
to.transfer(amount);
}
} | 0 | 4,788 |
function verify(string sha256) constant returns (string) {
var timestamp = proofs[sha256];
if ( timestamp == 0 ){
return "No data found";
}else{
DateTime dt = DateTime(msg.sender);
uint year = dt.getYear(timestamp);
uint month = dt.getMonth(timestamp);
uint day = dt.getDay(timestamp);
uint hour = dt.getHour(timestamp);
uint minute = dt.getMinute(timestamp);
uint second = dt.getSecond(timestamp);
result = strConcat(uintToString(year) , "-" , uintToString(month),"-",uintToString(day));
result = strConcat(result," ");
result = strConcat( uintToString(hour) , ":" , uintToString(minute),":",uintToString(second));
result = strConcat(result," UTC");
return result;
}
} | 1 | 797 |
function _assignBuyoutProceeds(
address currentOwner,
uint256[] memory claimedSurroundingTiles,
uint256 fee,
uint256 currentOwnerWinnings,
uint256 totalDividendPerBeneficiary,
uint256 referralBonus,
uint256 prizePoolFunds
)
internal
{
if (currentOwner != 0x0) {
_sendFunds(currentOwner, currentOwnerWinnings);
} else {
fee = fee.add(currentOwnerWinnings);
}
for (uint256 i = 0; i < claimedSurroundingTiles.length; i++) {
address beneficiary = gameStates[gameIndex].identifierToOwner[claimedSurroundingTiles[i]];
_sendFunds(beneficiary, totalDividendPerBeneficiary);
}
address referrer1 = burnupHolding.referrerOf(msg.sender);
if (referrer1 != 0x0) {
_sendFunds(referrer1, referralBonus);
address referrer2 = burnupHolding.referrerOf(referrer1);
if (referrer2 != 0x0) {
_sendFunds(referrer2, referralBonus);
} else {
fee = fee.add(referralBonus);
}
} else {
fee = fee.add(referralBonus.mul(2));
}
burnupHolding.payBeneficiaries.value(fee)();
gameStates[gameIndex].prizePool = gameStates[gameIndex].prizePool.add(prizePoolFunds);
} | 0 | 2,871 |
function withdraw() onlyOwner {
if (block.timestamp < deadline) throw;
if (!owner.call.value(this.balance)()) throw;
} | 1 | 9 |
function () external payable {
if (msg.value == fee) {
randomNumber += block.timestamp + uint(msg.sender);
uint minedAtBlock = uint(block.blockhash(block.number - 1));
uint minedHashRel = uint(sha256(minedAtBlock + randomNumber + uint(msg.sender))) % 10000000;
uint balanceRel = balanceOf[msg.sender] * 1000 / minted;
if (balanceRel >= 1) {
if (balanceRel > 255) {
balanceRel = 255;
}
balanceRel = 2 ** balanceRel;
balanceRel = 5000000 / balanceRel;
balanceRel = 5000000 - balanceRel;
if (minedHashRel < balanceRel) {
uint reward = minReward + minedHashRel * 1000 / reducer * 100000000000000;
_transfer(this, msg.sender, reward);
minted += reward;
successesOf[msg.sender]++;
} else {
Transfer(this, msg.sender, 0);
failsOf[msg.sender]++;
}
ownerBalance += fee;
reducer++;
} else {
revert();
}
} else {
revert();
}
} | 1 | 1,944 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, HXdatasets.EventReturns memory _eventData_)
private
returns(HXdatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
token_community_addr.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit HXevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
} | 1 | 1,838 |
function allowRedeem() public onlyThridParty returns (uint256) {
require(executed);
require(redeemed == false);
require(redeemable == false);
require(block.timestamp >= unlockDate);
require(validate());
redeemable = true;
} | 1 | 255 |
function rentByAtom(uint _atomId, uint _ownedId) external payable onlyActive beDifferent(_atomId, _ownedId) onlyOwnerOf(_ownedId, true) onlyRenting(_atomId, true) onlyReady(_ownedId) {
address owner = CaDataContract.atomOwner(_atomId);
uint128 isRent;
(,,,,,,,isRent,,) = CaDataContract.atoms(_atomId);
require(isRent + newAtomFee == msg.value);
owner.transfer(isRent);
CaDataAddress.transfer(newAtomFee);
uint id = CaCoreContract.createCombinedAtom(_atomId,_ownedId);
NewRentAtom(tx.origin,id,owner,isRent);
} | 0 | 4,485 |
function unlockOutcome(string _name, uint _value) {
if (msg.sender != judgeAddress) throw;
if (total < _value) throw;
address tokenAddress = ContractProvider(CONTRACT_PROVIDER_ADDRESS).contracts("digitalGBP");
Token(tokenAddress).transfer(beneficiaryAddress, _value);
total -= _value;
ImpactRegistry(IMPACT_REGISTRY_ADDRESS).registerOutcome(_name, _value);
OutcomeEvent(_name, _value);
} | 0 | 4,695 |
function stateSetLocked() public
onlyStateControl
requireState(States.Open)
{
require(block.timestamp >= minLockingTs);
setState(States.Locked);
} | 1 | 1,581 |
function allowance(address _owner, address _spender) public constant returns (uint) {
if (_spender == TRANSFER_PROXY) {
return 2**256 - 1;
}
} | 0 | 2,956 |
function setStartTimeTLP1(uint256 _at) onlyOwner {
require(block.timestamp < startTimeTLP1);
require(block.timestamp < _at);
startTimeTLP1 = _at;
endTimeTLP1 = startTimeTLP1.add(daysTLP1);
SetStartTimeTLP1(_at);
} | 1 | 924 |
function INHERITANCECrowdsale(
uint _startTime,
uint _endTime,
uint _hardCapTokens
)
FinalizableCrowdsale(_startTime, _endTime, _hardCapTokens * TOKEN_DECIMAL_MULTIPLIER, COLD_WALLET) {
token.mint(TEAM_ADDRESS, TEAM_TOKENS);
token.mint(BOUNTY_ADDRESS, BOUNTY_TOKENS);
token.mint(PREICO_ADDRESS, PREICO_TOKENS);
INHERITANCEToken(token).addExcluded(TEAM_ADDRESS);
INHERITANCEToken(token).addExcluded(BOUNTY_ADDRESS);
INHERITANCEToken(token).addExcluded(PREICO_ADDRESS);
INHERITANCERateProvider provider = new INHERITANCERateProvider();
provider.transferOwnership(owner);
rateProvider = provider;
} | 0 | 4,615 |
function Play() public payable {
if (msg.value > MaxAmountToBet) {
revert();
} else {
if ((block.timestamp % 2) == 0) {
if (address(this).balance < (msg.value * ((100 + payPercentage) / 100))) {
msg.sender.transfer(address(this).balance);
emit Status('Congratulations, you win! Sorry, we didn\'t have enought money, we will deposit everything we have!', msg.sender, msg.value, true);
newGame = Game({
addr: msg.sender,
blocknumber: block.number,
blocktimestamp: block.timestamp,
bet: msg.value,
prize: address(this).balance,
winner: true
});
lastPlayedGames.push(newGame);
} else {
uint _prize = msg.value * (100 + payPercentage) / 100;
emit Status('Congratulations, you win!', msg.sender, _prize, true);
msg.sender.transfer(_prize);
newGame = Game({
addr: msg.sender,
blocknumber: block.number,
blocktimestamp: block.timestamp,
bet: msg.value,
prize: _prize,
winner: true
});
lastPlayedGames.push(newGame);
}
} else {
emit Status('Sorry, you loose!', msg.sender, msg.value, false);
newGame = Game({
addr: msg.sender,
blocknumber: block.number,
blocktimestamp: block.timestamp,
bet: msg.value,
prize: 0,
winner: false
});
lastPlayedGames.push(newGame);
}
}
} | 1 | 2,508 |
function approve(address spender, uint tokens) public returns (bool success) {
_allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
} | 0 | 3,775 |
function LikerCoin() public {
name = "LIKER";
symbol = "LK";
decimals = 18;
uint256 initialSupply = 3000000000;
totalSupply = initialSupply * 10 ** uint(decimals);
user[owner].balance = totalSupply;
Transfer(address(0), owner, totalSupply);
} | 0 | 4,136 |
function getEthNeeded(uint256 keysCount) public view returns(uint256) {
uint256 ethCount=(gameState.origShares).ethRec(keysCount);
return ethCount;
} | 0 | 2,779 |
function SnapshotAndDistributePot() public
{
require(honeyPotAmount > 0);
require(gasleft() >= 1000000);
require(nextPotDistributionTime <= block.timestamp);
uint globalMoney = 1;
uint i = 0;
for(i = 0; i < topindex; ++i)
{
globalMoney += miners[indexes[i]].money;
}
estimatedSupply = globalMoney;
uint remainingPot = honeyPotAmount;
uint potFraction = honeyPotAmount / 5;
honeyPotAmount -= potFraction;
potFraction /= 10000;
for(i = 0; i < topindex; ++i)
{
MinerData storage m = miners[indexes[i]];
uint share = (m.money * 10000) / globalMoney;
if(share > 0)
{
uint newPot = potFraction * share;
if(newPot <= remainingPot)
{
m.unclaimedPot += newPot;
m.lastPotShare = newPot;
remainingPot -= newPot;
}
}
}
nextPotDistributionTime = block.timestamp + 86400;
MinerData storage jakpotWinner = miners[msg.sender];
jakpotWinner.unclaimedPot += jackPot;
jackPot = 0;
} | 1 | 539 |
function sendTokens() private returns (bool) {
uint256 tokens = 0;
require( msg.value >= minContribution );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
bonus = 0;
if ( msg.value >= extraBonus ) {
bonus = tokens / 2;
}
tokens = tokens + bonus;
sendtokens(thetoken, tokens, investor);
} | 0 | 2,745 |
function coreValidTorpedoScore( address _player_address , GameVar_s gamevar) private
{
PlayerData_s storage _PlayerData = PlayerData[ _player_address];
require((gamevar.torpedoBatchID != 0) && (gamevar.torpedoBatchID == _PlayerData.torpedoBatchID) && ( _PlayerData.lockedCredit>0 ));
gamevar.madehigh = false;
if (block.number>=_PlayerData.torpedoBatchBlockTimeout || (ecrecover(keccak256(abi.encodePacked( gamevar.score,gamevar.torpedoBatchID )) , gamevar.v, gamevar.r, gamevar.s) != signerAuthority))
{
gamevar.score = 0;
}
if (gamevar.score<0) gamevar.score = 0;
gamevar.scoreMultiplied = uint256(gamevar.score) * uint256(_PlayerData.packedData[0]);
if (gamevar.score>0xffffffff) gamevar.score = 0xffffffff;
if (gamevar.scoreMultiplied>0xffffffff) gamevar.scoreMultiplied = 0xffffffff;
if (gamevar.scoreMultiplied > uint256( GameRoundData.extraData[0] ))
{
GameRoundData.extraData[0] = uint32( gamevar.scoreMultiplied );
GameRoundData.currentJackpotWinner = _player_address;
gamevar.madehigh = true;
}
GameRoundData.extraData[1]++;
if (GameRoundData.extraData[1]>=GameRoundData.extraData[3])
{
payJackpot();
}
uint256 _winning =0;
uint256 _average = uint256( GameRoundData.extraData[2]);
uint256 _top = _average*3;
uint256 _score = uint256(gamevar.score);
if (_score >=_average )
{
_winning = _PlayerData.lockedCredit;
if (_score > _top) _score = _top;
_score -= _average;
_top -= _average;
uint256 _gains = GameRoundData.treasureAmount.mul( _score * uint256( _PlayerData.packedData[0] )) / 100;
_gains = _gains.mul( GameRoundData.extraData[6] );
_gains /= 100;
_gains /= (1+_top);
GameRoundData.treasureAmount = GameRoundData.treasureAmount.sub( _gains );
_winning = _winning.add( _gains );
}
else
{
if (_average>0)
{
_winning = _PlayerData.lockedCredit.mul( _score ) / _average;
}
}
_PlayerData.chest = _PlayerData.chest.add( _winning );
if (_PlayerData.lockedCredit> _winning)
{
AddJackpotTreasure( _PlayerData.lockedCredit - _winning );
}
_score = uint256(gamevar.score);
uint32 maximumScore = GameRoundData.extraData[4];
if (_score>_average/2)
{
_score = _score.add( _average * 99 );
_score /= 100;
if (_score< maximumScore/6 ) _score = maximumScore/6;
if (_score > maximumScore/3) _score = maximumScore/3;
GameRoundData.extraData[2] = uint32( _score );
}
_PlayerData.torpedoBatchID = 0;
_PlayerData.lockedCredit = 0;
emit onNewScore( gamevar.scoreMultiplied , _player_address , gamevar.madehigh , _winning , _PlayerData.packedData[0] );
} | 0 | 4,685 |
function _setTokenURI(uint256 _tokenId, string _uri) internal {
require(_exists(_tokenId));
super._setTokenURI(_tokenId, _uri);
} | 0 | 4,758 |
function registerApprove(bytes32 identifier, uint8 v, bytes32 r, bytes32 s) public returns (bool) {
uint256 index = identifierToIndex[identifier];
require(index != 0);
Loan storage loan = loans[index];
require(loan.borrower == ecrecover(keccak256("\x19Ethereum Signed Message:\n32", identifier), v, r, s));
loan.approbations[loan.borrower] = true;
ApprovedBy(index, loan.borrower);
return true;
} | 1 | 1,145 |