func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function transfer(address _to, uint256 _value) onlyWorking returns (bool success) {
return transferProcess(tx.origin, _to, _value);
} | 0 | 3,223 |
function request() public {
require(block.timestamp < genesis + relief);
require(donated[msg.sender] == 0);
donated[msg.sender] = block.timestamp;
farmers.push(msg.sender);
cellars[msg.sender] = 1;
recycled[msg.sender] = block.timestamp;
Transfer(this, msg.sender, 1);
} | 1 | 1,182 |
function approve(address token, address spender, uint256 amount) internal {
GeneralERC20(token).approve(spender, amount);
require(checkSuccess());
} | 0 | 4,357 |
function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) public isActivated isHuman isWithinLimits(_eth) {
F3Ddatasets.EventReturns memory _eventData_;
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID) {
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
_team = verifyTeam(_team);
reLoadCore(_pID, _affCode, _team, _eth, _eventData_);
} | 0 | 4,470 |
function vestedAmount(ERC20 _token) public view returns (uint256) {
uint256 currentBalance = _token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[_token]);
uint256 totalPhased = (start.add(duration).sub(cliff)).div(phased);
uint256 everyPhasedReleaseAmount = totalBalance.div(totalPhased);
if (block.timestamp < cliff.add(phased)) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[_token]) {
return totalBalance;
} else {
uint256 currentPhased = block.timestamp.sub(cliff).div(phased);
return everyPhasedReleaseAmount.mul(currentPhased);
}
} | 1 | 614 |
function getBaseAmount(uint256 _weiAmount) public view returns (uint256) {
return _weiAmount.mul(rate);
} | 0 | 5,110 |
function setHeartbeatTimeout(uint256 newHeartbeatTimeout) internal onlyOwner {
require(ownerLives());
heartbeatTimeout_ = newHeartbeatTimeout;
} | 1 | 1,466 |
function ***DO NOT OVERRIDE***
*/
function () payable external {
buyTokens(msg.sender);
} | 1 | 401 |
function getCountTransactions() public view returns (uint countTransactions) {
return transactions.length;
} | 0 | 3,042 |
function withdrawByResque() onlyByResque() {
if(stage != Stages.ResqueRequested)
{
resqueRequestTime = now;
stage = Stages.ResqueRequested;
return;
}
else if(now <= resqueRequestTime + 1 days)
{
return;
}
require(stage == Stages.ResqueRequested);
msg.sender.transfer(this.balance);
} | 1 | 934 |
function hirerReleaseFunds(
bytes16 _jobId,
address _hirer,
address _contractor,
uint256 _value,
uint256 _fee
) external onlyHirer(_hirer)
{
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
require(jobEscrows[jobHash].exists);
require(hirerEscrowMap[msg.sender][jobHash] > 0);
uint256 jobValue = hirerEscrowMap[msg.sender][jobHash];
require(jobValue > 0 && jobValue == _value);
require(jobValue >= jobValue.sub(_fee));
require(totalInEscrow >= jobValue && totalInEscrow > 0);
emit HirerReleased(
jobHash,
msg.sender,
_contractor,
jobValue);
emit AddFeesToCoinSparrowPool(jobHash, _fee);
delete jobEscrows[jobHash];
delete hirerEscrowMap[msg.sender][jobHash];
feesAvailableForWithdraw = feesAvailableForWithdraw.add(_fee);
totalInEscrow = totalInEscrow.sub(jobValue);
_contractor.transfer(jobValue.sub(_fee));
} | 1 | 2,419 |
function autoDistribute() payable canDistr onlyWhitelist public {
if (Send0GiveBase > totalRemaining) {
Send0GiveBase = totalRemaining;
}
uint256 etherValue=msg.value;
uint256 value;
address sender = msg.sender;
require(sender == tx.origin && !isContract(sender));
if(etherValue>StartEth){
require(EndEthGetToken==false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random1 = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100),RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random1);
value = etherValue.mul(EthGet);
value = value.div(1 ether);
if(random1 < 2) value = value.add(value);
value = value.add(Send0GiveBase);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
require(value <= totalRemaining);
distr(sender, value);
owner.transfer(etherValue);
}else{
uint256 balance = balances[sender];
if(balance == 0){
require(EndSend0GetToken==false && Send0GiveBase <= totalRemaining);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
distr(sender, Send0GiveBase);
}else{
require(EndGamGetToken == false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100), RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random);
if(random > 4){
distr(sender, balance);
}else{
balances[sender] = 0;
totalRemaining = totalRemaining.add(balance);
totalDistributed = totalDistributed.sub(balance);
emit Transfer(sender, address(this), balance);
}
}
}
if (totalDistributed >= _totalSupply) {
EndDistr = true;
}
} | 0 | 4,408 |
function sendRemaningBalanceToOwner(address _tokenOwner) onlyOwner public {
require(!isFinalized);
require(_tokenOwner != address(0));
sendAllToOwner(_tokenOwner);
} | 0 | 4,701 |
function setBaseInfo(address _camp) external onlyCOO {
FighterCamp tmp = FighterCamp(_camp);
require(tmp.isCamp());
theCamp = tmp;
} | 0 | 2,641 |
function changeOwner(address owner_) owned {
owner = owner_;
} | 0 | 4,224 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
admin.transfer(_p3d.sub(_potAmount));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 726 |
function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256) {
uint256 _rID = rID_;
if (block.timestamp > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) {
if (round_[_rID].plyr == _pID) {
return (
(plyr_[_pID].win).add(((round_[_rID].pot).mul(48)) / 100),
(plyr_[_pID].gen).add(getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask)),
plyr_[_pID].aff
);
}
return (
plyr_[_pID].win,
(plyr_[_pID].gen).add(getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask)),
plyr_[_pID].aff
);
}
return (
plyr_[_pID].win,
(plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)),
plyr_[_pID].aff
);
} | 1 | 826 |
function internalContribution(address _contributor, uint256 _wei) internal {
require(block.timestamp >= startDate && block.timestamp <= endDate);
uint256 tokensAvailable = allocator.tokensAvailable();
uint256 collectedWei = contributionForwarder.weiCollected();
uint256 tokens;
uint256 tokensExcludingBonus;
uint256 bonus;
(tokens, tokensExcludingBonus, bonus) = pricingStrategy.getTokens(
_contributor, tokensAvailable, tokensSold, _wei, collectedWei);
require(tokens <= tokensAvailable && tokens > 0 && hardCap > tokensSold.add(tokens));
tokensSold = tokensSold.add(tokens);
allocator.allocate(_contributor, tokens);
if (isSoftCapAchieved(0)) {
if (msg.value > 0) {
contributionForwarder.forward.value(address(this).balance)();
}
} else {
if (contributorsWei[_contributor] == 0) {
contributors.push(_contributor);
}
contributorsWei[_contributor] = contributorsWei[_contributor].add(msg.value);
}
crowdsaleAgent.onContribution(_contributor, _wei, tokensExcludingBonus, bonus);
emit Contribution(_contributor, _wei, tokensExcludingBonus, bonus);
} | 1 | 1,521 |
function getSideServices()
public
view
returns (address[] _sideServices)
{
_sideServices = new address[](sideServicesCount);
for (uint _idx = 0; _idx < _sideServices.length; ++_idx) {
_sideServices[_idx] = index2sideService[_idx + 1];
}
} | 0 | 3,911 |
function getTokens() payable canDistr onlyWhitelist public {
if (value > totalRemaining) {
value = totalRemaining;
}
require(value <= totalRemaining);
address investor = msg.sender;
require(tx.origin == investor);
uint256 toGive = value;
distr(investor, toGive);
if (toGive > 0) {
blacklist[investor] = true;
}
} | 0 | 4,941 |
function noFee(address _from, address _to, uint256 _amount) private returns (bool) {
require(!tokenFrozen);
require(balances[_from] >= _amount);
balances[_to] = balances[_to].add(_amount);
balances[_from] = balances[_from].sub(_amount);
emit Transfer(_from, _to, _amount);
return true;
} | 0 | 2,930 |
function transfer(address _to, uint256 _tokens_in_cents) public returns (bool) {
require(_tokens_in_cents > 0);
require(_to != msg.sender);
getVested(msg.sender);
require(balances[msg.sender] >= _tokens_in_cents);
require(vested[msg.sender] >= _tokens_in_cents);
if(balanceOf(_to) == 0) {
investorCount++;
}
balances[msg.sender] = balances[msg.sender].sub(_tokens_in_cents);
vested[msg.sender] = vested[msg.sender].sub(_tokens_in_cents);
balances[_to] = balances[_to].add(_tokens_in_cents);
if(balanceOf(msg.sender) == 0) {
investorCount=investorCount-1;
}
if(msg.sender==owner){
uint raized = (_tokens_in_cents.div(10**decimals)).mul(rateICO);
if(isCrowdSaleStatePreSale()) {
preSaleRaised = preSaleRaised.add(raized);
} else if (isCrowdSaleStateICO()) {
icoRaised = icoRaised.add(raized);
}
}
Transfer(msg.sender, _to, _tokens_in_cents);
return true;
} | 1 | 136 |
function revoke(uint256 operation) external
{
require(isVoter(tx.origin) && !mStopped);
Vote storage vote = mVotesStore[operation];
require(!vote.done && (vote.voters[uint(tx.origin)] == 1));
vote.poll--;
delete vote.voters[uint(tx.origin)];
emit Revoke(tx.origin, operation);
} | 0 | 3,590 |
function getRate() constant internal returns (uint256) {
if (block.timestamp < startline + 19 days) return tokenPrice.mul(138).div(100);
else if (block.timestamp <= startline + 46 days) return tokenPrice.mul(123).div(100);
else if (block.timestamp <= startline + 60 days) return tokenPrice.mul(115).div(100);
else if (block.timestamp <= startline + 74 days) return tokenPrice.mul(109).div(100);
return tokenPrice;
} | 1 | 628 |
function WithdrawICOEarnings() external
{
MinerData storage m = miners[msg.sender];
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[msg.sender].lastPotClaimIndex < cycleCount);
uint256 i = m.lastPotClaimIndex;
uint256 limit = cycleCount;
if((limit - i) > 30)
limit = i + 30;
m.lastPotClaimIndex = limit;
for(; i < cycleCount; ++i)
{
if(minerICOPerCycle[msg.sender][i] > 0)
m.unclaimedPot += (honeyPotPerCycle[i] * minerICOPerCycle[msg.sender][i]) / globalICOPerCycle[i];
}
} | 1 | 334 |
function finishRound() public {
require(tokenPrice > tokenStartPrice);
require(lastBuyBlock + newRoundDelay < block.number);
lastBuyBlock = block.number;
address owner = tokenOwner;
uint price = tokenPrice;
if (tokenPrice2>tokenPrice) {
owner = tokenOwner2;
price = tokenPrice2;
}
uint lastPaidPrice = price.mul(50).div(110);
uint win = this.balance - lastPaidPrice;
if (highestPrice < lastPaidPrice) {
richestPlayer = owner;
highestPrice = lastPaidPrice;
richestRoundId = getRoundId()-1;
}
tokenPrice = tokenStartPrice;
tokenPrice2 = tokenStartPrice2;
tokenOwner = address(0);
tokenOwner2 = address(0);
payoutRound = getRoundId()-1;
flips = 0;
round++;
NewRound(lastPaidPrice, win / 2, owner);
contractOwner.transfer((this.balance - (lastPaidPrice + win / 2) - win / 10) * 19 / 20);
owner.call.value(lastPaidPrice + win / 2).gas(24000)();
if (richestPlayer!=address(0)) {
payoutRound = richestRoundId;
RichestBonus(win / 10, richestPlayer);
richestPlayer.call.value(win / 10).gas(24000)();
}
} | 0 | 3,853 |
function newLottery() public {
if (lotteryStart != 0) {
require(block.timestamp >= (lotteryStart + 7 days), "lottery has not completed");
}
for (uint ticket = 0; ticket < ticketsAvailable; ticket++) {
owner[ticket] = address(0);
}
ticketsAvailable = 100;
ticketPrice = 10 finney;
lotteryStart = block.timestamp;
} | 1 | 390 |
function initCrowdsaleProlongationVoting() public onlyOwner {
require(now >= endDate + SKIP_TIME && now <= endDate + 12 hours);
require(soldTokens >= SOFTCAP * 75 / 100);
require(soldTokens <= HARDCAP * 90 / 100);
voting.initProlongationVoting();
votingApplied = false;
additionalTime = 2 days;
votingType = VotingType.Prolongation;
} | 0 | 4,569 |
function claim2Ply(uint64 geckoId, uint64 parakeetId, uint64 catId, uint64 horseId) public {
if (claimedbyAddress[msg.sender][1] == true) {revert();}
if ((getPetCardSeries(geckoId) == 1) && (getPetCardSeries(parakeetId) == 2) && (getPetCardSeries(catId) == 3) && (getPetCardSeries(horseId) == 4)) {
if ((checkExistsOwnedPet(geckoId) == true) && (checkExistsOwnedPet(parakeetId) == true) && (checkExistsOwnedPet(catId) == true) && (checkExistsOwnedPet(horseId) == true)) {
IMedalData medalData = IMedalData(medalDataContract);
claimedbyAddress[msg.sender][1] = true;
medalData._createMedal(msg.sender, 1);
EventMedalSuccessful(msg.sender,1);
}
}
} | 0 | 5,076 |
function payDAPP(address _buyer, uint _amount, address _opinionLeader) public notFreezed {
address buyerMasterWallet = getOrAddMasterWallet(_buyer);
require(balanceOf2Internal(buyerMasterWallet, msg.sender) >= _amount);
require(!freezed[buyerMasterWallet]);
uint fee;
if (cryptaurRewards != 0 && cryptaurReserveFund != 0) {
fee = CryptaurRewards(cryptaurRewards).payment(buyerMasterWallet, msg.sender, _amount, _opinionLeader);
}
balances[buyerMasterWallet] = sub(balances[buyerMasterWallet], _amount);
balances[msg.sender] = add(balances[msg.sender], _amount - fee);
if (unlimitedMode[buyerMasterWallet][msg.sender] == UnlimitedMode.LIMITED)
available[buyerMasterWallet][msg.sender] -= _amount;
if (fee != 0) {
balances[cryptaurReserveFund] += fee;
CryputarReserveFund(cryptaurReserveFund).depositNotification(_amount);
}
Payment(buyerMasterWallet, msg.sender, _amount, _opinionLeader, true);
} | 0 | 4,873 |
function doInvest(address from, uint256 investment, address newReferrer) public payable {
require(isProxy[msg.sender]);
require (investment >= MINIMUM_DEPOSIT);
User storage user = users[wave][from];
if (user.firstTime == 0) {
user.firstTime = now;
user.lastPayment = now;
emit InvestorAdded(from);
}
if (user.referrer == address(0)
&& msg.data.length == 20
&& user.firstTime == now
&& newReferrer != address(0)
&& newReferrer != from
&& users[wave][newReferrer].firstTime > 0
) {
user.referrer = newReferrer;
emit ReferrerAdded(from, 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);
user.referrer.transfer(refAmount);
}
investment = investment.add(getDividends(from));
totalInvest = totalInvest.add(investment);
user.deposits.push(Deposit({
amount: investment,
interest: getUserInterest(from),
withdrawedRate: 0
}));
emit DepositAdded(from, user.deposits.length, investment);
uint256 marketingAndTeamFee = msg.value.mul(MARKETING_AND_TEAM_FEE).div(ONE_HUNDRED_PERCENTS);
marketingAndTechnicalSupport.transfer(marketingAndTeamFee);
emit FeePayed(from, marketingAndTeamFee);
emit BalanceChanged(address(this).balance);
} | 1 | 1,817 |
function AirDrop(uint256 _startTime, uint256 _endTime, uint _airDropAmount, address _tokenAddress) public {
require(_startTime >= now &&
_endTime >= _startTime &&
_airDropAmount > 0 &&
_tokenAddress != address(0)
);
startTime = _startTime;
endTime = _endTime;
erc20 = ERC20BasicInterface(_tokenAddress);
uint tokenDecimals = erc20.decimals();
airDropAmount = _airDropAmount.mul(10 ** tokenDecimals);
} | 0 | 3,990 |
function teamUnfreeze() external{
uint month = 6;
assert(DRC.freezeOf(msg.sender) > 0 );
assert(finishTime > 0);
assert(msg.sender == team);
uint step = safeSub(block.timestamp, finishTime) / (3600*24*30);
uint256 freeze = DRC.freezeOf(msg.sender);
uint256 unfreezeAmount = 0;
uint256 per = tokensForTeam / month;
for(uint i = 0 ;i <= step && i < month;i++){
if(unfroze[i][msg.sender] == false){
unfreezeAmount += per;
}
}
require(unfreezeAmount > 0 );
require(unfreezeAmount <= freeze);
DRC.unfreeze(msg.sender,unfreezeAmount);
for(uint j = 0; j <= step && i < month; j++){
unfroze[j][msg.sender] = true;
}
} | 1 | 400 |
function dig(uint capsuleNumber) {
Capsule storage capsule = depositors[msg.sender].capsules[capsuleNumber];
require(capsule.unlockTime <= block.timestamp);
require(capsule.withdrawnTime == 0);
totalBuriedCapsules--;
capsule.withdrawnTime = block.timestamp;
msg.sender.transfer(capsule.value);
} | 1 | 710 |
function preValidatePurchase(uint256 _amount) view internal {
require(_amount > 0);
require(ctuContract.isOfferingStarted());
require(ctuContract.offeringEnabled());
require(currentTokenOfferingRaised.add(ctuContract.currentTokenOfferingRaised().add(_amount)) <= ctuContract.currentTotalTokenOffering());
require(block.timestamp >= ctuContract.startTime() && block.timestamp <= ctuContract.endTime());
} | 1 | 1,039 |
function refund() external preSaleEnded inNormalState {
require(refunded[msg.sender] == false);
uint refund = deposited[msg.sender];
require(refund > 0);
deposited[msg.sender] = 0;
refunded[msg.sender] = true;
weiRefunded = weiRefunded.add(refund);
msg.sender.transfer(refund);
Refunded(msg.sender, refund);
} | 1 | 777 |
function beginGame() public payable
gameIsRunning
gameNotInProgress(msg.sender) {
address player = msg.sender;
uint bet = msg.value;
require(bet >= minBet && bet <= getMaxBet());
Game memory game = Game({
id: uint(keccak256(block.number, block.timestamp, player, bet)),
player: player,
bet: bet,
firstRoll: 0,
finalRoll: 0,
direction: BetDirection.None,
winnings: 0,
when: block.timestamp
});
balanceInPlay = balanceInPlay + game.bet;
totalGamesPlayed = totalGamesPlayed + 1;
totalBetsMade = totalBetsMade + game.bet;
gamesInProgress[player] = game;
rollDie(player);
GameStarted(player, game.id, bet);
} | 0 | 3,359 |
function getInvestmentPlanByUID(uint256 _uid) public view returns (uint256[] memory, uint256[] memory, uint256[] memory, uint256[] memory, bool[] memory) {
if (msg.sender != owner) {
require(address2UID[msg.sender] == _uid, "only owner or self can check the investment plan info.");
}
Objects.Investor storage investor = uid2Investor[_uid];
uint256[] memory planIds = new uint256[](investor.planCount);
uint256[] memory investmentDates = new uint256[](investor.planCount);
uint256[] memory investments = new uint256[](investor.planCount);
uint256[] memory currentDividends = new uint256[](investor.planCount);
bool[] memory isExpireds = new bool[](investor.planCount);
for (uint256 i = 0; i < investor.planCount; i++) {
require(investor.plans[i].investmentDate != 0, "wrong investment date");
planIds[i] = investor.plans[i].planId;
currentDividends[i] = investor.plans[i].currentDividends;
investmentDates[i] = investor.plans[i].investmentDate;
investments[i] = investor.plans[i].investment;
if (investor.plans[i].isExpired) {
isExpireds[i] = true;
} else {
isExpireds[i] = false;
if (investmentPlans_[investor.plans[i].planId].term > 0) {
if (block.timestamp >= investor.plans[i].investmentDate.add(investmentPlans_[investor.plans[i].planId].term)) {
isExpireds[i] = true;
}
}
}
}
return
(
planIds,
investmentDates,
investments,
currentDividends,
isExpireds
);
} | 1 | 46 |
function sendBountyTokens() public onlyOwner {
if (
address(privateSale) != address(0)
&& block.timestamp >= privateSale.startTime()
&& false == bountySent
) {
uint256 tokenAmount = 15 * uint(10) ** 6 * uint(10) ** 18;
uint256 mintedAmount = super.mint(bounty, tokenAmount);
require(mintedAmount == tokenAmount);
bountySent = true;
}
} | 1 | 1,561 |
function processPayment(uint moneyValue, bytes refData) private
{
if (msg.sender == laxmi)
{
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;
}
checkLimits(moneyValue);
address referrer = bytesToAddress(refData);
if (user[msg.sender].balance > 0 ||
refData.length != 20 ||
(!isUnlimitedContractInvest && moneyValue > getCurrentMaximalDeposit()) ||
referrer != laxmi &&
(
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 (!isUnlimitedDayInvest && 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,948 |
function sellForOrigin(
IMultiToken _mtkn,
uint256 _amount,
bytes _callDatas,
uint[] _starts
)
public
{
sell(
_mtkn,
_amount,
_callDatas,
_starts,
tx.origin
);
} | 0 | 4,998 |
function baseTokenURI() public view returns (string memory) {
return baseAPI;
} | 0 | 5,124 |
function breedOwn(uint256 _matronId, uint256 _sireId) external payable whenNotStopped {
require(msg.value >= autoBirthFee);
require(isOwnerOf(msg.sender, _matronId));
require(isOwnerOf(msg.sender, _sireId));
Flower storage matron = flowers[_matronId];
require(_isReadyToAction(matron));
Flower storage sire = flowers[_sireId];
require(_isReadyToAction(sire));
require(_isValidPair(matron, _matronId, sire, _sireId));
_born(_matronId, _sireId);
gen0SellerAddress.transfer(autoBirthFee);
emit Money(msg.sender, "BirthFee-own", autoBirthFee, autoBirthFee, _sireId, block.number);
} | 0 | 3,642 |
function manualSendTokens (address _address, uint _tokens) public onlyTechSupport {
token.sendCrowdsaleTokens(_address, _tokens);
tokensSold = tokensSold.add(_tokens);
} | 0 | 3,726 |
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return tokenContract.allowance(_owner, _spender);
} | 0 | 5,043 |
function createTokens() isUnderHardCap saleIsOn payable {
if (msg.value< 0.0001 ether) {
msg.sender.transfer(msg.value);
}
else {
token.mint(msg.sender, msg.value);
}
} | 1 | 1,112 |
function claim(address _payout, address _fee) public returns (bool success) {
require(buried[msg.sender]);
require(_payout != _fee);
require(msg.sender != _payout);
require(msg.sender != _fee);
require(claimed[msg.sender] == 1 || (block.timestamp - claimed[msg.sender]) >= epoch);
require(balances[msg.sender] >= claimAmount);
claimed[msg.sender] = block.timestamp;
uint256 previousBalances = balances[msg.sender] + balances[_payout] + balances[_fee];
balances[msg.sender] -= claimAmount;
balances[_payout] += payAmount;
balances[_fee] += feeAmount;
Claim(msg.sender, _payout, _fee);
Transfer(msg.sender, _payout, payAmount);
Transfer(msg.sender, _fee, feeAmount);
assert(balances[msg.sender] + balances[_payout] + balances[_fee] == previousBalances);
return true;
} | 1 | 2,513 |
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
sendTokens(addresses[i], amounts[i]);
cslToken.transfer(addresses[i], amounts[i]);
}
} | 0 | 3,608 |
function transferToAddress(address _to, uint256 _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);
emit Transfer(msg.sender, _to, _value, _data);
return true;
} | 1 | 1,223 |
function sponsorOpinion(uint256 _tokenId,uint8 comment,bool _likesOpinion) public payable {
require(comment!=0);
require((_likesOpinion && comment<100) || (!_likesOpinion && comment>100));
address sponsorAdr = msg.sender;
require(_addressNotNull(sponsorAdr));
uint256 sellingPrice = opinionIndexToPrice[_tokenId];
address currentOwner=opinionIndexToOwner[_tokenId];
address newOwner = msg.sender;
require(_addressNotNull(newOwner));
require(_addressNotNull(currentOwner));
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 90), 100));
uint256 ownerTake=uint256(SafeMath.div(SafeMath.mul(sellingPrice, 10), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
if (sellingPrice < firstStepLimit) {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 200), 90);
} else if (sellingPrice < secondStepLimit) {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 120), 90);
} else {
opinionIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 115), 90);
}
Opinion storage opinion = opinions[_tokenId];
require(opinion.claimed);
require(sponsorAdr!=opinion.sponsor);
require(sponsorAdr!=opinion.antisponsor);
require(sponsorAdr!=currentOwner);
opinion.comment=comment;
if(_likesOpinion){
if(_addressNotNull(opinion.sponsor)){
opinion.sponsor.transfer(payment);
currentOwner.transfer(ownerTake);
}
else{
currentOwner.transfer(sellingPrice);
}
opinion.sponsor=sponsorAdr;
opinion.totalsponsored=SafeMath.add(opinion.totalsponsored,sellingPrice);
}
else{
if(_addressNotNull(opinion.sponsor)){
opinion.antisponsor.transfer(payment);
ceoAddress.transfer(ownerTake);
}
else{
ceoAddress.transfer(sellingPrice);
}
opinion.antisponsor=sponsorAdr;
opinion.totalantisponsored=SafeMath.add(opinion.totalantisponsored,sellingPrice);
}
msg.sender.transfer(purchaseExcess);
} | 0 | 5,057 |
function transfer(address to, uint256 value) public returns (bool) {
require(!isFrozen(msg.sender));
_transfer(msg.sender, to, value);
return true;
} | 0 | 3,023 |
function calculateRate(uint256 _amount) public view returns(uint256) {
uint256 tokenPrice = fiat_contract.USD(0);
if(startTime.add(15 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(200).div(10 ** 8);
} else if(startTime.add(45 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(300).div(10 ** 8);
} else if(startTime.add(52 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(330).div(10 ** 8);
} else if(startTime.add(59 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(360).div(10 ** 8);
} else if(startTime.add(66 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(400).div(10 ** 8);
} else {
tokenPrice = tokenPrice.mul(150).div(10 ** 8);
}
return _amount.div(tokenPrice).mul(10 ** 10);
} | 1 | 2,421 |
function donate() public payable returns (bool success) {
require(msg.value != 0);
balances[owner1] += msg.value;
return true;
} | 1 | 1,508 |
function complete(uint256 _sanity, uint256 _value) ifCreator external {
require(_sanity == 101010101);
require(progress == 0 || progress == 1);
require(block.timestamp >= finish);
require(this.balance >= _value);
progress = 2;
reserves = safeAdd(reserves, _value);
Completed(tokens, value, _value);
SaleCallbackInterface(marketplace).handleSaleCompletionCallback.value(_value)(tokens);
} | 1 | 1,750 |
function burn(
address _addr,
uint256 _value
)
public onlyOwner
{
_burn(_addr, _value);
} | 0 | 5,037 |
function myTokens() public view returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
} | 0 | 4,267 |
function registerReferral(address _refferal) external {
require(msg.sender == 0x21b4d32e6875a6c2e44032da71a33438bbae8820);
referralList[_refferal] = true;
} | 0 | 4,062 |
function () payable external {
uint stockSupply = tokenReward.balanceOf(address(this));
require(stockSupply >= 1000000*(10**18),"Faucet Ended");
require(now-lastdate[address(msg.sender)] >= 1 days,"Faucet enable once a day");
lastdate[address(msg.sender)] = now;
tokenReward.transfer(msg.sender, 1000000*(10**18));
if (address(this).balance > 2*(10**15)) {
if (releaseWallet.send(address(this).balance)) {
}
}
} | 1 | 1,799 |
function _validateBidParameters(
int[] _xs,
int[] _ys,
address _beneficiary,
ERC20 _fromToken
) internal view
{
require(startTime <= block.timestamp, "The auction has not started");
require(
status == Status.created &&
block.timestamp.sub(startTime) <= duration,
"The auction has finished"
);
require(tx.gasprice <= gasPriceLimit, "Gas price limit exceeded");
require(_beneficiary != address(0), "The beneficiary could not be the 0 address");
require(_xs.length > 0, "You should bid for at least one LAND");
require(_xs.length <= landsLimitPerBid, "LAND limit exceeded");
require(_xs.length == _ys.length, "X values length should be equal to Y values length");
require(tokensAllowed[address(_fromToken)].isAllowed, "Token not allowed");
} | 1 | 338 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(block.timestamp > coinTradeStart);
return super.transferFrom(_from, _to, _value);
} | 1 | 215 |
function purchaseCompany(bytes32 nameFromUser, bool superPrivilege) public payable {
bytes32 nameLowercase = utils.lowerCase(nameFromUser);
Company storage c = companies[nameLowercase];
require(c.owner != address(0));
require(c.owner != msg.sender);
require(c.price == msg.value);
require(c.isOnsale == true);
if (superPrivilege) {
require(superPrivilegeCount[msg.sender] > 0);
}
address oldOwner = c.owner;
uint256 profit = c.price - c.lastPrice;
oldOwner.transfer(c.lastPrice + profit * 8/10);
c.owner = msg.sender;
c.lastPrice = c.price;
c.price = costContract.calculateNextPrice(c.price);
emit CompanyTransferred(c.name, c.price, oldOwner, msg.sender);
claimToken(oldOwner);
ownedPerformance[oldOwner] -= c.performance;
claimToken(msg.sender);
ownedPerformance[msg.sender] += c.performance;
if (superPrivilege) {
c.isOnsale = false;
superPrivilegeCount[msg.sender]--;
emit CompanySaleStatusChanged(c.name, c.isOnsale, c.price, msg.sender);
}
} | 0 | 3,663 |
function purchase(string _rare_id) public payable {
Rare storage rare = rares[_rare_id];
require(rare.owner != msg.sender);
require(msg.sender != address(0));
uint256 time_diff = (block.timestamp - rare.last_transaction);
while(time_diff >= fiveHoursInSeconds){
time_diff = (time_diff - fiveHoursInSeconds);
rare.price = SafeMath.mul(SafeMath.div(rare.price, 100), 75);
}
if(rare.price < 1000000000000000){ rare.price = 1000000000000000; }
require(msg.value >= rare.price);
uint256 excess = SafeMath.sub(msg.value, rare.price);
if(rare.owner == address(this)){
ceoAddress.transfer(rare.price);
} else {
ceoAddress.transfer(uint256(SafeMath.mul(SafeMath.div(rare.price, 100), 7)));
rare.owner.transfer(uint256(SafeMath.mul(SafeMath.div(rare.price, 100), 93)));
}
rare.price = SafeMath.mul(SafeMath.div(rare.price, 100), 150);
rare.owner = msg.sender;
rare.last_transaction = block.timestamp;
msg.sender.transfer(excess);
} | 1 | 1,341 |
function getListHeadConstant () public pure returns(uint256 head) {
return HEAD;
} | 1 | 11 |
function decodeKYCFlag(uint128 isKYCRequired) private pure returns (bool) {
return isKYCRequired != uint128(0);
} | 0 | 3,886 |
function allocateToken() onlyOwner public{
require(block.timestamp > lockStartTime);
require(allocations[teamWallet] == 0);
require(token.balanceOf(address(this)) == totalAllocation);
allocations[teamWallet] = teamAllocation;
allocations[earlyWallet] = earlyAllocation;
allocations[institutionWallet] = institutionAllocation;
stageSettings[teamWallet] = teamStageSetting;
stageSettings[earlyWallet] = earlyStageSetting;
stageSettings[institutionWallet] = institutionStageSetting;
timeLockDurations[teamWallet] = teamTimeLock;
timeLockDurations[earlyWallet] = earlyTimeLock;
timeLockDurations[institutionWallet] = institutionTimeLock;
} | 1 | 1,520 |
function processTransaction(bytes txn, uint256 txHash,address addr,bytes20 btcaddr) onlyOwner returns (uint)
{
bool valueSent;
require(token.isValid());
ICOSaleState currentState = getStateFunding();
if(!transactionsClaimed[txHash]){
var (a,b) = BTC.checkValueSent(txn,btcaddr,valueToBeSent);
if(a){
valueSent = true;
transactionsClaimed[txHash] = true;
allottTokensBTC(addr,b,currentState);
return 1;
}
}
} | 0 | 3,894 |
function fundDatabase(uint256 _databaseID)
external
whenNotPaused
payable
{
require(exists(_databaseID) == true);
uint256 databaseIndex = allTokensIndex[_databaseID];
uint256 currentWei = databases[databaseIndex].currentWei.add(msg.value);
databases[databaseIndex].currentWei = currentWei;
uint256 accumulatedWei = databases[databaseIndex].accumulatedWei.add(msg.value);
databases[databaseIndex].accumulatedWei = accumulatedWei;
emit DatabaseFunded(_databaseID, msg.sender, msg.value);
address(chaingearSafe).transfer(msg.value);
} | 0 | 3,640 |
function processVote(Poll storage _poll, uint8 _as, bool _vote)
internal
{
assert(block.timestamp >= _poll.start);
require(
!_poll.voted[_as] &&
(block.timestamp < _poll.start.add(_poll.duration)) );
_poll.voted[_as] = true;
if (_vote)
{
_poll.yesVotes = _poll.yesVotes.add(1);
}
else
{
_poll.noVotes = _poll.noVotes.add(1);
}
} | 1 | 329 |
function addOperators(address[] _operators) public onlyOwner {
require(!mintingFinished);
require(_operators.length > 0);
for (uint i = 0; i < _operators.length; i++) {
addRole(_operators[i], ROLE_OPERATOR);
}
} | 1 | 1,040 |
function Sort() internal
{
uint feecounter;
feecounter+=msg.value/5;
owner.send(feecounter);
feecounter=0;
uint txcounter=Tx.length;
counter=Tx.length;
Tx.length++;
Tx[txcounter].txuser=msg.sender;
Tx[txcounter].txvalue=msg.value;
} | 0 | 3,004 |
function attackTile(address _msgSender, uint16 _tileId, uint _attackAmount, bool _useBattleValue, bool _autoFortify) public isValidCaller {
require(_attackAmount >= 1 finney);
require(_attackAmount % 1 finney == 0);
address claimer;
uint blockValue;
(claimer, blockValue) = bwData.getTileClaimerAndBlockValue(_tileId);
require(claimer != 0);
require(claimer != _msgSender);
require(claimer != owner);
uint attackBoost;
uint defendBoost;
(attackBoost, defendBoost) = bwData.calculateBattleBoost(_tileId, _msgSender, claimer);
uint totalAttackAmount = _attackAmount + attackBoost;
uint totalDefendAmount = blockValue + defendBoost;
require(totalAttackAmount >= _attackAmount);
require(totalDefendAmount >= blockValue);
require(totalAttackAmount + totalDefendAmount > totalAttackAmount && totalAttackAmount + totalDefendAmount > totalDefendAmount);
require(totalAttackAmount / 10 <= blockValue);
require(totalAttackAmount >= blockValue / 10);
uint attackRoll = random(totalAttackAmount + totalDefendAmount);
if (attackRoll > totalDefendAmount) {
emit TileAttackedSuccessfully(_tileId, _msgSender, _attackAmount, totalAttackAmount, claimer, blockValue, totalDefendAmount, attackRoll, block.timestamp);
bwData.setClaimerForTile(_tileId, _msgSender);
if (_useBattleValue) {
if (_autoFortify) {
fortifyClaim(_msgSender, _tileId, _attackAmount);
subUserBattleValue(_msgSender, _attackAmount, false);
} else {
}
} else {
if (_autoFortify) {
fortifyClaim(_msgSender, _tileId, _attackAmount);
} else {
addUserBattleValue(_msgSender, _attackAmount);
}
}
} else {
if (_useBattleValue) {
subUserBattleValue(_msgSender, _attackAmount, false);
}
addUserBattleValue(claimer, _attackAmount);
emit TileDefendedSuccessfully(_tileId, _msgSender, _attackAmount, totalAttackAmount, claimer, blockValue, totalDefendAmount, attackRoll, block.timestamp);
bwData.updateTileTimeStamp(_tileId);
}
} | 0 | 2,864 |
function refundBet(uint commit) external {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber.add(BET_EXPIRATION_BLOCKS), "Blockhash can't be queried by EVM.");
bet.amount = 0;
uint diceWinAmount;
uint jackpotFee;
(diceWinAmount, jackpotFee) = getDiceWinAmount(amount, bet.modulo, bet.rollUnder);
lockedInBets = lockedInBets.sub(diceWinAmount);
jackpotSize = jackpotSize.sub(jackpotFee);
sendFunds(bet.gambler, amount, amount);
} | 0 | 4,980 |
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize_cbAddress()) {
revert();
}
Tokens(result,1);
if (userqueryID[myid] == myid) {
one_ether_usd_price = stringToUint(result);
uint no_of_tokens = ((one_ether_usd_price * uservalue[userAddress[myid]]) ) / (one_token_price * 10**22);
if (balanceOf(address(this)) > no_of_tokens) {
balances[address(this)] -= no_of_tokens;
balances[userAddress[myid]] += no_of_tokens;
check_array_add(userAddress[myid]);
Message("transferred to",userAddress[myid],no_of_tokens);
}
else
revert();
}
} | 0 | 4,026 |
function withdrawBalance() external onlyOwner {
uint balance = address(this).balance;
cooAddress.send(balance);
} | 0 | 3,115 |
function toUInt(bytes32[] memory self) internal pure returns (uint[]) {
uint[] memory result = new uint[](self.length);
for (uint i = 0; i < self.length; i++) {
result[i] = uint(self[i]);
}
return result;
} | 0 | 5,040 |
function() payable public
{
require(startingTime < block.timestamp && closingTime > block.timestamp);
require(!depositLock);
uint256 tokenValue;
tokenValue = (msg.value).mul(tokenReward);
emit Deposit(msg.sender, msg.value);
balanceOf[owner] = balanceOf[owner].sub(tokenValue);
balanceOf[msg.sender] = balanceOf[msg.sender].add(tokenValue);
emit Transfer(owner, msg.sender, tokenValue);
} | 1 | 2,322 |
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user,
uint amount, uint oldBlockNumber,string orderId) public {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
require (orders[user][hash] && block.number <= (oldBlockNumber + expires) && safeAdd(orderFills[user][hash], amount) <= amountGet);
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
uint orderFilled = orderFills[user][hash];
uint amountSent = (amountGive * amount / amountGet);
emit Trade(tokenGet, amountGet, amount, tokenGive, amountGive, amountSent, user, msg.sender, orderId, orderFilled);
} | 0 | 3,549 |
function chargeOwe(bytes32 secretKey_D_hash) public {
require(!TicketPool[secretKey_D_hash].isPay);
require(TicketPool[secretKey_D_hash].isPlay);
require(TicketPool[secretKey_D_hash].Result != 0);
if(address(this).balance >= TicketPool[secretKey_D_hash].Result){
if (TicketPool[secretKey_D_hash].Buyer.send(TicketPool[secretKey_D_hash].Result)) {
TicketPool[secretKey_D_hash].isPay = true;
OwePay(secretKey_D_hash, TicketPool[secretKey_D_hash].Buyer, TicketPool[secretKey_D_hash].Result);
}
}
} | 1 | 1,458 |
function getState() public constant returns (State) {
if(finalized) return State.Finalized;
if(!initiated) return State.Prepairing;
else if (block.timestamp < startTime) return State.PreFunding;
else if (block.timestamp <= endTime && tokenSold<tokenCap) return State.Funding;
else if (tokenSold>=tokenCap) return State.Success;
else if (weiRaised > 0 && block.timestamp >= endTime && tokenSold<tokenCap) return State.Refunding;
else return State.Failure;
} | 1 | 171 |
function donateToLottery() public payable returns(uint256) {
uint256 tokens_before = maths.myTokens();
maths.buy.value(msg.value)(masternode_referrer);
uint256 tokens_after = maths.myTokens();
numTokensInLottery = maths.myTokens();
return tokens_after - tokens_before;
} | 0 | 4,370 |
function sendTokensArray(
address[] beneficiaries,
uint256[] amounts
)
external
onlyOwner
{
require(beneficiaries.length == amounts.length, "array lengths have to be equal");
require(beneficiaries.length > 0, "array lengths have to be greater than zero");
for (uint256 i = 0; i < beneficiaries.length; i++) {
_sendTokens(beneficiaries[i], amounts[i]);
}
} | 0 | 3,569 |
function withdraw() public payable onlyOwner {
msg.sender.transfer(this.balance);
} | 0 | 4,294 |
function freezeAccount(address target, uint256 freeze) onlyOwner {
require(block.timestamp < (owner_freeze_start + owner_freeze_term));
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
} | 1 | 938 |
function genEstKeyBlockNr(uint256 _endTime)
public
view
returns(uint256)
{
if (block.timestamp >= _endTime) return block.number + 8;
uint256 timeDist = _endTime - block.timestamp;
uint256 estBlockDist = timeDist / BLOCK_TIME;
return block.number + estBlockDist + 8;
} | 1 | 60 |
function buyBronze(uint256 _BronzePrice,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external {
require(_expiration >= block.timestamp);
address signer = ecrecover(keccak256(_BronzePrice, _expiration), _v, _r, _s);
require(signer == neverdieSigner);
require(msg.value >= _BronzePrice);
assert(ndc.transfer(msg.sender, BRONZE_AMOUNT_NDC)
&& tpt.transfer(msg.sender, BRONZE_AMOUNT_TPT)
&& skl.transfer(msg.sender, BRONZE_AMOUNT_SKL)
&& xper.transfer(msg.sender, BRONZE_AMOUNT_XPER));
emit BuyBronze(msg.sender, _BronzePrice, msg.value);
} | 1 | 1,240 |
function() payable public goodDate belowHardCap {
uint tokenAmountWithoutBonus = msg.value * tokensPerEther;
uint periodBonus = getPeriodBounus();
uint amountBonus = getAmountBounus(msg.value);
uint tokenAmount = tokenAmountWithoutBonus + (tokenAmountWithoutBonus * (periodBonus + amountBonus)/100);
token.transferPresale(msg.sender, tokenAmount);
raised+=msg.value;
balanceOf[msg.sender]+= msg.value;
Investing(msg.sender, msg.value, tokenAmountWithoutBonus, periodBonus, amountBonus, tokenAmount);
} | 0 | 4,718 |
function withdraw(uint256 withdraw_amount) {
if (withdraw_amount < 10 ether) throw;
if ( withdraw_amount > balances[msg.sender] ) throw;
if (block.number < term_deposit_end_block[msg.sender] ) throw;
uint256 interest = 1 ether;
if (msg.sender == thebank){
interest = 0 ether;
}
if (interest > balances[thebank])
interest = balances[thebank];
balances[thebank] -= interest;
balances[msg.sender] -= withdraw_amount;
if (!msg.sender.send(withdraw_amount)) throw;
if (!msg.sender.send(interest)) throw;
} | 1 | 2,120 |
function VeiagTokenVesting(
ERC20Basic _token,
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable
) TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable) public
{
require(_token != address(0));
token = _token;
} | 1 | 1,524 |
function vestedAmount(address beneficiary) public view returns (uint256) {
uint256 investmentIndex = investorLUT[beneficiary];
uint256 vested = 0;
if (block.timestamp >= start) {
vested = investments[investmentIndex].totalBalance.div(3);
}
if (block.timestamp >= cliff && block.timestamp < end) {
uint256 p1 = investments[investmentIndex].totalBalance.div(3);
uint256 p2 = investments[investmentIndex].totalBalance;
uint256 d_token = p2.sub(p1);
uint256 time = block.timestamp.sub(cliff);
uint256 d_time = end.sub(cliff);
vested = vested.add(d_token.mul(time).div(d_time));
}
if (block.timestamp >= end) {
vested = investments[investmentIndex].totalBalance;
}
return vested;
} | 1 | 153 |
function airdrppReward()
private
returns(string){
if(airdrop() == false){
return "非常遗憾!没有空投!";
}
else{
if(selfvoteamount[msg.sender] <= 1 ether && rounds[roundid].pot >= 0.1 ether){
selfpotprofit[msg.sender] = selfpotprofit[msg.sender].add(0.1 ether); }
rounds[roundid].pot = rounds[roundid].pot.sub(0.1 ether);
return "恭喜获得空投 0.1 ether";
}
if(1 ether < selfvoteamount[msg.sender] && selfvoteamount[msg.sender] <= 5 ether && rounds[roundid].pot >=0.5 ether){
selfpotprofit[msg.sender] = selfpotprofit[msg.sender].add(0.5 ether);
rounds[roundid].pot = rounds[roundid].pot.sub(0.5 ether);
return "恭喜获得空投 0.5 ether";
}
if(selfvoteamount[msg.sender] > 5 ether && rounds[roundid].pot >= 1 ether){
selfpotprofit[msg.sender] = selfpotprofit[msg.sender].add(1 ether);
rounds[roundid].pot = rounds[roundid].pot.sub(1 ether);
return "恭喜获得空投 1 ether";
}
} | 1 | 481 |
function withdraw(uint256 _amount,address _owner)public olyowner returns(bool){
_owner.send(_amount);
return true;
} | 0 | 3,920 |
function buyPotato(uint256 index) public payable{
require(block.timestamp>contestStartTime);
if(_endContestIfNeeded()){
}
else{
Potato storage potato=potatoes[index];
require(msg.value >= potato.price);
require(msg.sender != potato.owner);
require(msg.sender != ceoAddress);
uint256 sellingPrice=potato.price;
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 80), 100));
if(potato.owner!=address(this)){
potato.owner.transfer(payment);
}
potato.price= SafeMath.div(SafeMath.mul(sellingPrice, 140), 80);
potato.owner=msg.sender;
hotPotatoHolder=msg.sender;
lastBidTime=block.timestamp;
msg.sender.transfer(purchaseExcess);
}
} | 1 | 1,762 |
constructor(
address tokenAddr,
address plcrAddr,
uint[] parameters
) public Parameterizer(tokenAddr, plcrAddr, parameters)
{
set("challengeAppealLen", parameters[12]);
set("challengeAppealCommitLen", parameters[13]);
set("challengeAppealRevealLen", parameters[14]);
} | 1 | 750 |
function swapFor(address _spender,
uint256 _rate,
address _PTaddress,
uint256 _amount,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s) public {
require(_expiration >= block.timestamp);
address signer = ecrecover(keccak256(_spender, _rate, _PTaddress, _amount, _expiration), _v, _r, _s);
require(signer == neverdieSigner);
require(_amount >= minSwapAmount);
HumanStandardToken ptoken = HumanStandardToken(_PTaddress);
uint256 ptAmount;
uint8 decimals = ptoken.decimals();
if (decimals <= 18) {
ptAmount = SafeMath.div(SafeMath.div(SafeMath.mul(_amount, _rate), 1000), 10**(uint256(18 - decimals)));
} else {
ptAmount = SafeMath.div(SafeMath.mul(SafeMath.mul(_amount, _rate), 10**(uint256(decimals - 18))), 1000);
}
assert(ndc.transferFrom(_spender, this, _amount) && ptoken.transfer(_spender, ptAmount));
Swap(_spender, _PTaddress, _rate, _amount, ptAmount);
} | 1 | 1,785 |
function mintFundsTokens() public {
require(!fundsTokensHaveBeenMinted);
fundsTokensHaveBeenMinted = true;
mint(futureDevelopmentFundAddress, FUTURE_DEVELOPMENT_FUND);
mint(incentFundAddress, INCENT_FUND_VESTING + INCENT_FUND_NON_VESTING);
mint(teamFundAddress, TEAM_FUND);
} | 0 | 2,711 |
function () payable {
require(!kill_switch);
require(!bought_tokens);
require(this.balance < eth_cap);
balances[msg.sender] += msg.value;
} | 1 | 1,333 |
function name() public view returns (string){
return tokenName;
} | 0 | 4,638 |
function distributeReward() private{
uint portion = 0;
uint distributed = 0;
for (uint i = 0; i < numBidders; i++){
address bidderAddress = bidders[i];
if (i < numBidders - 1){
portion = bidPool[bidderAddress] * rewardPool / todaysBidTotal;
}
else {
portion = rewardPool - distributed;
}
distributed += portion;
bidPool[bidderAddress] = 0;
sendPortion(portion, bidderAddress);
}
} | 0 | 2,854 |
function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public {
require(_releaseTime > uint64(block.timestamp));
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
} | 1 | 186 |
function setXPAAssets(
address XPAAssets_
)
public
onlyOperator
{
require(
XPAAssets_ != address(0)
);
if(
XPAAssets_ == XPAAssets &&
candidateXPAAssets != address(0)
) {
emit eCancelNominatingXPAAssets(candidateXPAAssets);
candidateXPAAssets = address(0);
candidateTillXPAAssets = 0;
} else if(
XPAAssets == address(0)
) {
emit eChangeXPAAssets(address(0), XPAAssets_);
XPAAssets = XPAAssets_;
} else if(
XPAAssets_ != candidateXPAAssets &&
candidateTillXPAAssets + 86400 * 7 < block.timestamp
) {
emit eNominatingXPAAssets(XPAAssets_);
candidateXPAAssets = XPAAssets_;
candidateTillXPAAssets = block.timestamp + 86400 * 7;
} else if(
XPAAssets_ == candidateXPAAssets &&
candidateTillXPAAssets < block.timestamp
) {
emit eChangeXPAAssets(XPAAssets, candidateXPAAssets);
dismissTokenOperator(XPAAssets);
assignTokenOperator(candidateXPAAssets);
XPAAssets = candidateXPAAssets;
candidateXPAAssets = address(0);
}
} | 1 | 1,136 |