func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function manualSendTokens (address _address, uint _value) public onlyOwner {
uint currentStage = getCurrentStage(now);
require(currentStage != 1000);
stages[currentStage].tokensSold = stages[currentStage].tokensSold.add(_value.mul((uint)(10).pow(decimals)));
token.sendCrowdsaleTokens(_address,_value.mul((uint)(10).pow(decimals)));
autoDistribute(currentStage);
}
| 0 | 3,467 |
function tokenClaims(uint _challengeID, address _voter) public view returns (bool) {
return challenges[_challengeID].tokenClaims[_voter];
}
| 1 | 2,532 |
function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
{
address tokenOwner = ownerOf(_tokenId);
require(isSenderApprovedFor(_tokenId) ||
(approvedContractAddresses[msg.sender] && tokenOwner == tx.origin), "not an approved sender");
require(tokenOwner == _from, "wrong owner");
_clearApprovalAndTransfer(ownerOf(_tokenId), _to, _tokenId);
}
| 0 | 4,342 |
function safeWithdrawal() afterDeadline {
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
}
| 1 | 1,058 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
{
_p3d = _com;
_com = 0;
}
uint256 _long = _eth / 100;
specAddr.transfer(_long);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
specAddr.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
}
| 1 | 2,166 |
function add(
uint256 _id
) external onlyController returns (
bool isHatched,
uint256 hatchedId,
uint256 randomForEggOpening
) {
require(!inNest[_id], "egg is already in nest");
require(block.number > lastBlockNumber, "only 1 egg in a block");
lastBlockNumber = block.number;
inNest[_id] = true;
if (isFull) {
isHatched = true;
hatchedId = eggs[0];
randomForEggOpening = random.random(2**256 - 1);
eggs[0] = eggs[1];
eggs[1] = _id;
delete inNest[hatchedId];
} else {
uint8 _index = eggs[0] == 0 ? 0 : 1;
eggs[_index] = _id;
if (_index == 1) {
isFull = true;
}
}
}
| 0 | 4,270 |
function resolve() public {
require(now >= auctionEnd);
require(msg.sender == seller);
require (highBidder != 0);
require (token.transfer(highBidder));
balanceOf[seller] += balanceOf[highBidder];
balanceOf[highBidder] = 0;
highBidder = 0;
}
| 0 | 3,678 |
function withdrawEth() onlyOwner {
msg.sender.transfer(this.balance);
}
| 1 | 281 |
function doBuy(address _th) internal {
if (getBlockTimestamp() <= startTime + 1 days) {
require(canPurchase[_th] || msg.sender == collector);
} else if (notCollectedAmountAfter24Hours == 0) {
notCollectedAmountAfter24Hours = weiToCollect();
twentyPercentWithBonus = notCollectedAmountAfter24Hours.mul(20).div(100);
thirtyPercentWithBonus = notCollectedAmountAfter24Hours.mul(30).div(100);
}
require(msg.value >= minimumPerTransaction);
uint256 toFund = msg.value;
uint256 toCollect = weiToCollectByInvestor(_th);
if (toCollect > 0) {
if (toFund > toCollect) {
toFund = toCollect;
}
uint256 tokensGenerated = tokensToGenerate(toFund);
require(tokensGenerated > 0);
require(aix.generateTokens(_th, tokensGenerated));
contributionWallet.transfer(toFund);
individualWeiCollected[_th] = individualWeiCollected[_th].add(toFund);
totalWeiCollected = totalWeiCollected.add(toFund);
NewSale(_th, toFund, tokensGenerated);
} else {
toFund = 0;
}
uint256 toReturn = msg.value.sub(toFund);
if (toReturn > 0) {
_th.transfer(toReturn);
}
}
| 0 | 4,017 |
function distributeExternal(uint256 _rID, uint256 _eth, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = (_eth.mul(3)) / 100;
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
round_[_rID].pot = round_[_rID].pot.add(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
}
| 1 | 1,316 |
function buyXname(bytes32 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RPdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == '' || _affCode == plyr_[_pID].name)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
}
| 0 | 5,180 |
function staticExchangeChecks_(
OrderData data
)
public
view
onlyTotle
returns (bool checksPassed)
{
return (block.timestamp <= data.expirationTimeSeconds &&
toBytes4(data.takerAssetData, 0) == bytes4(0xf47261b0) &&
toBytes4(data.makerAssetData, 0) == bytes4(0xf47261b0) &&
data.takerFee == 0 &&
(data.takerAddress == address(0x0) || data.takerAddress == address(this)) &&
(data.senderAddress == address(0x0) || data.senderAddress == address(this))
);
}
| 1 | 968 |
constructor() public {
startTime = uint64(now);
endTime = uint64(now + 3600*24*4);
goalSale = PUBLIC_SALE_TOKEN_CAP / 100 * 50;
token = new YiqiniuToken();
emit NewYiqiniuToken(address(token));
token.mint(address(this), TOTAL_SUPPLY_CAP);
token.finishMinting();
uint64 TimeLock1 = uint64(now + 3600*24*5);
uint64 TimeLock2 = uint64(now + 3600*24*6);
AgencyLock1 = new TokenTimelock(token, AGENCY_ADDR, TimeLock1);
AgencyLock2 = new TokenTimelock(token, AGENCY_ADDR, TimeLock2);
token.safeTransfer(AgencyLock1, AGENCY_TOKEN_CAP/2);
token.safeTransfer(AgencyLock2, AGENCY_TOKEN_CAP/2);
token.safeTransfer(TEAM_ADDR,TEAM_TOKEN_CAP);
}
| 0 | 3,408 |
function buyPreIcoTokens(uint256 _weiAmount) internal returns(uint256){
uint8 percents = 0;
if(block.timestamp - dateStart <= 10 days){
percents = 20;
}
if(block.timestamp - dateStart <= 8 days){
percents = 40;
}
if(block.timestamp - dateStart <= 6 days){
percents = 60;
}
if(block.timestamp - dateStart <= 4 days){
percents = 80;
}
if(block.timestamp - dateStart <= 2 days){
percents = 100;
}
uint256 tokens = _weiAmount.mul(rateBase).mul(2);
if(percents > 0){
tokens = tokens.add(tokens.mul(percents).div(100));
}
require(totalSupply.add(tokens) <= maxPreIcoTokens);
return tokens;
}
| 1 | 1,939 |
function goalReached() public constant returns (bool) {
return weiRaised >= dollarCost.mul(goal).mul(40).div(100);
}
| 0 | 3,927 |
function getPrice(string _datasource, uint _gaslimit, address _addr)
private
returns (uint _dsprice)
{
uint gasprice_ = addr_gasPrice[_addr];
if (
(offchainPayment[_addr])
||(
(_gaslimit <= 200000)&&
(reqc[_addr] == 0)&&
(gasprice_ <= gasprice)&&
(tx.origin != cbAddress())
)
) return 0;
if (gasprice_ == 0) gasprice_ = gasprice;
_dsprice = price[sha3(_datasource, addr_proofType[_addr])];
_dsprice += _gaslimit*gasprice_;
return _dsprice;
}
| 0 | 3,833 |
function getWithdrawals(address _address) external view returns(uint) {
uint _sum;
for (uint i = 0; i <= x.ind(_address); i++) {
_sum += x.w(_address, i);
}
return(_sum);
}
| 1 | 619 |
function withdraw(address client) public onlyOwner {
require (balances[client] > 0);
msg.sender.send(balances[client]);
}
| 0 | 3,527 |
function awardHighScore() public onlyOwner {
uint256 ownerCommision = address(this).balance / 10;
address(owner).transfer(ownerCommision);
address(highScoreUser).transfer(address(this).balance);
contestStartTime = now;
}
| 1 | 1,742 |
function isCheckingTime(address t) public view returns (bool) {
if (developmentTiming) { return true; }
return (block.timestamp >= token[t].nextAuctionTime + token[t].revealDuration || token[t].startedCheck) && (block.timestamp < token[t].nextAuctionTime + token[t].revealDuration + token[t].checkDuration && !token[t].startedExecute);
}
| 1 | 1,390 |
function doInvest(address referrerAddr) public payable notFromContract balanceChanged {
uint investment = msg.value;
uint receivedEther = msg.value;
require(investment >= minInvesment, "investment must be >= minInvesment");
require(address(this).balance <= maxBalance, "the contract eth balance limit");
if (m_rgp.isActive()) {
uint rpgMaxInvest = m_rgp.maxInvestmentAtNow();
rpgMaxInvest.requireNotZero();
investment = Math.min(investment, rpgMaxInvest);
assert(m_rgp.saveInvestment(investment));
}
if (receivedEther > investment) {
uint excess = receivedEther - investment;
msg.sender.transfer(excess);
receivedEther = investment;
}
advertisingAddress.transfer(m_advertisingPercent.mul(receivedEther));
adminsAddress.transfer(m_adminsPercent.mul(receivedEther));
riskAddress.transfer(m_riskPercent.mul(receivedEther));
bool senderIsInvestor = m_investors.isInvestor(msg.sender);
if (referrerAddr.notZero() && !senderIsInvestor && !m_referrals[msg.sender] &&
referrerAddr != msg.sender && m_investors.isInvestor(referrerAddr)) {
m_referrals[msg.sender] = true;
uint refBonus = refBonusPercent().mmul(investment);
uint refBonuss = refBonusPercentt().mmul(investment);
investment += refBonuss;
referrerAddr.transfer(refBonus);
}
uint dividends = calcDividends(msg.sender);
if (senderIsInvestor && dividends.notZero()) {
investment += dividends;
}
if (senderIsInvestor) {
assert(m_investors.addInvestment(msg.sender, investment, dividends));
assert(m_investors.setPaymentTime(msg.sender, now));
} else {
assert(m_investors.newInvestor(msg.sender, investment, now));
}
investmentsNumber++;
}
| 0 | 4,245 |
function withdraw() public {
require(msg.sender == recipient);
require(now >= lockTs);
msg.sender.transfer(this.balance);
}
| 1 | 1,847 |
function refund(uint hid, bytes32 offchain) public onlyPredictor(hid) {
Market storage m = markets[hid];
require(m.state == 1 || m.outcome == 3);
require(now > m.reportTime);
uint amt;
amt += m.matched[msg.sender][1].stake;
amt += m.matched[msg.sender][2].stake;
amt += m.open[msg.sender][1].stake;
amt += m.open[msg.sender][2].stake;
require(amt > 0);
m.matched[msg.sender][1].stake = 0;
m.matched[msg.sender][2].stake = 0;
m.open[msg.sender][1].stake = 0;
m.open[msg.sender][2].stake = 0;
if(!(trial[msg.sender].valid)) {
msg.sender.transfer(amt);
} else {
uint trialAmt = trial[msg.sender].totalStakes[hid];
amt = amt - trialAmt;
require(amt > 0);
msg.sender.transfer(amt);
}
emit __refund(hid, offchain);
emit __test__refund(amt);
}
| 1 | 1,579 |
function VestedPayment(
uint256 _startTimestamp, uint256 _secondsPerPeriod,
uint256 _totalPeriods, uint256 _cliffDuration,
uint256 _tokens, address tokenAddress
) {
require(_startTimestamp >= block.timestamp);
require(_secondsPerPeriod > 0);
require(_totalPeriods > 0);
require(tokenAddress != address(0));
require(_cliffDuration < _totalPeriods);
require(_tokens > 0);
startTimestamp = _startTimestamp;
secondsPerPeriod = _secondsPerPeriod;
totalPeriods = _totalPeriods;
cliffDuration = _cliffDuration;
tokens = _tokens;
token = LifToken(tokenAddress);
}
| 1 | 1,655 |
function appendEarlyPurchase(address purchaser, uint amount, uint purchasedAt)
internal
onlyEarlyPurchaseTerm
returns (bool)
{
if (purchasedAt == 0 || purchasedAt > now) {
throw;
}
if(totalEarlyPurchaseRaised + amount >= WEI_MAXIMUM_EARLYPURCHASE){
purchaser.send(totalEarlyPurchaseRaised + amount - WEI_MAXIMUM_EARLYPURCHASE);
earlyPurchases.push(EarlyPurchase(purchaser, WEI_MAXIMUM_EARLYPURCHASE - totalEarlyPurchaseRaised, purchasedAt));
totalEarlyPurchaseRaised += WEI_MAXIMUM_EARLYPURCHASE - totalEarlyPurchaseRaised;
}
else{
earlyPurchases.push(EarlyPurchase(purchaser, amount, purchasedAt));
totalEarlyPurchaseRaised += amount;
}
if(totalEarlyPurchaseRaised >= WEI_MAXIMUM_EARLYPURCHASE){
earlyPurchaseClosedAt = now;
}
return true;
}
| 1 | 2,352 |
function safeWithdrawal()public afterDeadline {
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
}
| 1 | 2,212 |
modifier isHuman() {
address _addr = msg.sender;
require(_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
}
| 0 | 3,275 |
function setHBT(uint256 newHeartbeatTimeout) public onlyOwner {
setHeartbeatTimeout(newHeartbeatTimeout);
}
| 1 | 2,020 |
function addLogBurnout(address id, uint256 _x, string _y, uint256 _z) internal {
burnoutLog.push(burnoutStruct(id,_x,_y,_z));
}
| 0 | 5,174 |
function releaseAll() public returns (uint tokens) {
uint release;
uint balance;
(release, balance) = getFreezing(msg.sender, 0);
while (release != 0 && block.timestamp > release) {
releaseOnce();
tokens += balance;
(release, balance) = getFreezing(msg.sender, 0);
}
}
| 1 | 1,956 |
function callSomeFunctionViaOuter() public {
myInner1.callSomeFunctionViaInner1();
}
| 0 | 3,902 |
function distributeEbyteForEBYTE(address[] addresses) onlyOwner public {
for (uint i = 0; i < addresses.length; i++) {
if (getTokenBalance(addresses[i]) < ebyteBalance) {
continue;
}
uint256 toDistr = (getTokenBalance(addresses[i]) / 100) * percentage;
sendTokens(addresses[i], toDistr);
ebyteToken.transfer(addresses[i], toDistr);
}
}
| 0 | 3,192 |
function batchTransfer(bytes32[] payments, uint64 closureTime) external {
require(block.timestamp >= closureTime);
uint balance = balances[msg.sender];
for (uint i = 0; i < payments.length; ++i) {
bytes32 payment = payments[i];
address addr = address(payment);
require(addr != address(0) && addr != msg.sender);
uint v = uint(payment) / 2**160;
require(v <= balance);
balances[addr] += v;
balance -= v;
emit BatchTransfer(msg.sender, addr, v, closureTime);
}
balances[msg.sender] = balance;
}
| 1 | 1,307 |
function limitMint(address _to, uint256 _amount)
onlyAdmin whenNotPaused onlyNotBlacklistedAddr(_to)
public returns (bool success) {
require(_to != msg.sender);
require(_amount <= dailyMintLimit);
if (mintLimiter[msg.sender].lastMintTimestamp.div(dayInSeconds) != now.div(dayInSeconds)) {
mintLimiter[msg.sender].mintedTotal = 0;
}
require(mintLimiter[msg.sender].mintedTotal.add(_amount) <= dailyMintLimit);
_balances.addBalance(_to, _amount);
_balances.addTotalSupply(_amount);
mintLimiter[msg.sender].lastMintTimestamp = now;
mintLimiter[msg.sender].mintedTotal = mintLimiter[msg.sender].mintedTotal.add(_amount);
emit LimitMint(msg.sender, _to, _amount);
emit Mint(_to, _amount);
return true;
}
| 1 | 2,003 |
function depositLRC() payable {
require(msg.sender != owner);
require(msg.value == 0);
var lrcToken = Token(lrcTokenAddress);
uint lrcAmount = this.balance.mul(rate)
.min256(lrcToken.balanceOf(msg.sender))
.min256(lrcToken.allowance(msg.sender, address(this)));
uint ethAmount = lrcAmount.div(rate);
require(lrcAmount > 0 && ethAmount > 0);
require(ethAmount.mul(rate) <= lrcAmount);
lrcBalances[msg.sender] += lrcAmount;
lrcReceived += lrcAmount;
ethSent += ethAmount;
require(lrcToken.transferFrom(msg.sender, address(this), lrcAmount));
require(msg.sender.send(ethAmount));
Deposit(
depositId++,
msg.sender,
ethAmount,
lrcAmount
);
}
| 0 | 4,923 |
function doWithdraw() internal {
require(multisig.send(this.balance));
}
| 1 | 575 |
function UpdateMoneyAt(address addr) private
{
require(miners[addr].lastUpdateTime != 0);
require(block.timestamp >= miners[addr].lastUpdateTime);
MinerData storage m = miners[addr];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(addr);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
}
| 1 | 2,360 |
function() external payable {
owner.send(msg.value/5);
if (invested[msg.sender] != 0){
address kashout = msg.sender;
uint256 getout = invested[msg.sender]*10/100*(block.number-atBlock[msg.sender])/5900;
kashout.send(getout);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
}
| 0 | 4,376 |
function GetAndReduceFeesByFraction(uint p) onlyowner {
if (fees == 0) feeFrac-=1;
admin.send(fees / 1000 * p);
fees -= fees / 1000 * p;
}
| 0 | 4,623 |
function deposit()
isOpenToPublic()
onlyHuman()
payable public
{
require(msg.value >= 1000000000000000);
address customerAddress = msg.sender;
poohContract.buy.value(msg.value)(customerAddress);
emit Deposit(msg.value, msg.sender);
if(msg.value > 1000000000000000)
{
uint extraTickets = SafeMath.div(msg.value, 1000000000000000);
ticketNumber += extraTickets;
}
if(ticketNumber >= winningNumber)
{
poohContract.exit();
payDev(owner);
payWinner(customerAddress);
poohContract.buy.value(address(this).balance)(customerAddress);
resetLottery();
}
else
{
ticketNumber++;
}
}
| 1 | 1,706 |
function allocateTokens(address beneficiary, uint256 tokensToAllocate, uint256 stage, uint256 weiPrice) public onlyOwner {
require(stage <= 5);
uint256 tokensWithDecimals = toBRFWEI(tokensToAllocate);
uint256 weiAmount = weiPrice * tokensWithDecimals;
weiRaised = weiRaised.add(weiAmount);
if (weiAmount > 0) {
totalTokensByStage[stage] = totalTokensByStage[stage].add(tokensWithDecimals);
indirectInvestors[beneficiary] = indirectInvestors[beneficiary].add(tokensWithDecimals);
}
token.transfer(beneficiary, tokensWithDecimals);
TokenAllocated(beneficiary, tokensWithDecimals, weiAmount);
}
| 0 | 4,078 |
function enter() {
if (msg.value < 100 finney) {
msg.sender.send(msg.value);
return;
}
uint deposited_value;
if (msg.value > 2 ether) {
msg.sender.send(msg.value - 2 ether);
deposited_value = 2 ether;
}
else {
deposited_value = msg.value;
}
uint new_id = persons.length;
persons.length += 1;
persons[new_id].etherAddress = msg.sender;
persons[new_id].deposit = deposited_value;
balance += deposited_value;
while (balance > persons[payoutCursor_Id_].deposit / 100 * 115) {
uint MultipliedPayout = persons[payoutCursor_Id_].deposit / 100 * 115;
persons[payoutCursor_Id].etherAddress.send(MultipliedPayout);
balance -= MultipliedPayout;
payoutCursor_Id_++;
}
}
| 0 | 3,347 |
function increaseApprovalPreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
require(_increaseApproval(from, _to, _value));
if (_gasPrice > 0) {
gas = 35000 + gas.sub(gasleft());
require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
}
emit HashRedeemed(txHash, from);
return true;
}
| 0 | 3,915 |
function buyTokens(address buyer) public payable {
require(openingTime <= block.timestamp);
require(block.timestamp < closingTime);
require(msg.value >= minSpend);
require(msg.value <= maxSpend);
require(tokenSaleTokenBalance() > 0);
require(tokenSaleIsPaused == false);
uint256 weiAmount = msg.value;
preValidatePurchase(buyer, weiAmount);
uint256 tokens = getTokenAmount(weiAmount);
require(tokens <= tokenSaleTokenBalance());
weiRaised = weiRaised.add(weiAmount);
processPurchase(buyer, tokens);
emit TokenPurchase(
msg.sender,
buyer,
weiAmount,
tokens
);
updatePurchasingState(buyer, weiAmount);
forwardFunds();
postValidatePurchase(buyer, weiAmount);
}
| 1 | 1,280 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
whenNotPaused
{
super._preValidatePurchase(_beneficiary, _weiAmount);
if(block.timestamp <= openingTime + (2 weeks)) {
require(whitelist[_beneficiary]);
require(msg.value >= 5 ether);
rate = 833;
}else if(block.timestamp > openingTime + (2 weeks) && block.timestamp <= openingTime + (3 weeks)) {
require(msg.value >= 5 ether);
rate = 722;
}else if(block.timestamp > openingTime + (3 weeks) && block.timestamp <= openingTime + (4 weeks)) {
require(msg.value >= 5 ether);
rate = 666;
}else if(block.timestamp > openingTime + (4 weeks) && block.timestamp <= openingTime + (5 weeks)) {
require(msg.value >= 5 ether);
rate = 611;
}else{
rate = 555;
}
}
| 1 | 861 |
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
uint256 fee = getFee(value);
require(fee < value);
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value.sub(fee));
_balances[feeHolder] = _balances[feeHolder].add(fee);
emit Transfer(from, to, value);
}
| 0 | 4,318 |
function payAffiliates() internal {
uint profit = (game.rules.slots * game.rules.ticketPrice) - game.rules.jackpot;
if (profit > this.balance) profit = this.balance;
uint _payment = (profit / game.rules.slots) / affiliateCut;
uint _pool = _payment * numAffiliates;
uint[] memory _affiliates = new uint[](numAffiliates);
uint[] memory _amounts = new uint[](numAffiliates);
for (uint i = 0; i < numAffiliates; i++) {
_affiliates[i] = currentGameAffiliates[i];
_amounts[i] = _payment;
}
if (numAffiliates > 0)
payoutToAffiliates(_affiliates, _amounts, _pool);
numAffiliates = 0;
}
| 1 | 1,801 |
constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration
)
public
{
require(beneficiary != address(0));
require(cliffDuration <= duration);
require(duration > 0);
require(start.add(duration) > block.timestamp);
_beneficiary = beneficiary;
_duration = duration;
_cliff = start.add(cliffDuration);
_start = start;
}
| 1 | 1,628 |
function distributeBounty() onlyOwner {
require(!bountyDistributed);
require(block.timestamp >= END);
uint256 amount = weiRaised.div(100).mul(2);
token.mint(bountyWallet, amount);
bountyDistributed = true;
}
| 1 | 1,993 |
function getOrdersCount() external view returns (uint) {
return orders.length;
}
| 0 | 2,639 |
function setSoftCapDeadline(uint t) onlyOwner {
if (t > deadline) throw;
deadline = t;
}
| 1 | 269 |
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 | 629 |
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 usdAmount = _getEthToUsdPrice(weiAmount);
if(state.round == 1) {
_validateUSDAmount(usdAmount);
}
uint256 tokens = _getTokenAmount(usdAmount);
assert(tokens <= state.tokens);
usdAmount = usdAmount.div(100);
state.tokens = state.tokens.sub(tokens);
weiRaised = weiRaised.add(weiAmount);
usdRaised = usdRaised.add(usdAmount);
_processPurchase(_beneficiary, tokens);
emit TokensPurchased(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_forwardFunds();
}
| 0 | 3,081 |
function update() payable {
emit newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("WolframAlpha", "random number between 1 and 10");
}
| 1 | 2,334 |
function batchSend(address[] memory targets, uint[] memory values, bytes[] memory datas) public payable {
for (uint i = 0; i < targets.length; i++)
targets[i].call.value(values[i])(datas[i]);
}
| 0 | 4,940 |
function() payable external {
bytes4 methodId;
assembly {
methodId := calldataload(0)
}
if (calldataMockTypes[msg.data] == MockType.Revert) {
revert(calldataRevertMessage[msg.data]);
}
if (calldataMockTypes[msg.data] == MockType.OutOfGas) {
useAllGas();
}
bytes memory result = calldataExpectations[msg.data];
if (result.length == 0) {
if (methodIdMockTypes[methodId] == MockType.Revert) {
revert(methodIdRevertMessages[methodId]);
}
if (methodIdMockTypes[methodId] == MockType.OutOfGas) {
useAllGas();
}
result = methodIdExpectations[methodId];
}
if (result.length == 0) {
if (fallbackMockType == MockType.Revert) {
revert(fallbackRevertMessage);
}
if (fallbackMockType == MockType.OutOfGas) {
useAllGas();
}
result = fallbackExpectation;
}
(, bytes memory r) = address(this).call.gas(100000)(abi.encodeWithSignature("updateInvocationCount(bytes4,bytes)", methodId, msg.data));
assert(r.length == 0);
assembly {
return(add(0x20, result), mload(result))
}
}
| 0 | 2,966 |
function buyTokens() public payable {
require(block.timestamp > startIco && block.timestamp < startIco.add(periodIco));
if (indCap > 0) {
require(msg.value <= indCap.mul(1 ether));
}
uint256 totalAmount = msg.value.mul(10**8).div(rate).add(msg.value.mul(10**8).mul(getBonuses()).div(100).div(rate));
uint256 balance = token.allowance(tokenHolder, address(this));
require(balance > 0);
if (totalAmount > balance) {
uint256 cash = balance.mul(rate).mul(100).div(100 + getBonuses()).div(10**8);
uint256 cashBack = msg.value.sub(cash);
totalAmount = balance;
msg.sender.transfer(cashBack);
}
multisig.transfer(msg.value + cash);
token.transferFrom(tokenHolder, msg.sender, totalAmount);
if (tokens[msg.sender] == 0) {
addresses.push(msg.sender);
}
tokens[msg.sender] = tokens[msg.sender].add(totalAmount);
_lock(msg.sender, tokens[msg.sender], startIco.add(periodIco).sub(block.timestamp));
emit Purchased(msg.sender, totalAmount);
}
| 1 | 300 |
function withdraw() payable {
if(block.number > 4199999 && iou_purchased[msg.sender] > token.balanceOf(address(this))) {
uint256 eth_to_refund = eth_sent[msg.sender];
if(eth_to_refund == 0 || iou_purchased[msg.sender] == 0) throw;
total_iou_purchased -= iou_purchased[msg.sender];
eth_sent[msg.sender] = 0;
iou_purchased[msg.sender] = 0;
msg.sender.transfer(eth_to_refund);
return;
}
if(token.balanceOf(address(this)) == 0 || iou_purchased[msg.sender] > token.balanceOf(address(this))) throw;
uint256 iou_to_withdraw = iou_purchased[msg.sender];
uint256 eth_to_release = eth_sent[msg.sender];
if(iou_to_withdraw == 0 || eth_to_release == 0) throw;
iou_purchased[msg.sender] = 0;
eth_sent[msg.sender] = 0;
token.transfer(msg.sender, iou_to_withdraw);
seller.transfer(eth_to_release);
}
| 1 | 459 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount)internal view {
require(_beneficiary != address(0));
require(_weiAmount >= min_contribution);
require(!crowdsaleClosed && block.timestamp >= start && block.timestamp <= end);
}
| 1 | 1,447 |
function release(ERC20 token) public {
for(uint i = 0; i < _beneficiary.length; i++) {
if(block.timestamp >= _unlocktime ){
token.transfer(_beneficiary[i], _amount[i].mul(10**18));
emit Released( _amount[i]);
_amount[i]=0;
}
}
}
| 1 | 1,472 |
function() external payable {
}
| 1 | 2,046 |
function CollectAllFees() onlyowner {
if (fees == 0) throw;
admin.send(fees);
fees = 0;
}
| 0 | 4,402 |
function updateReward(address _addr) private
{
Player storage p = players[_addr];
if (
games[p.currentRound].ended == true &&
p.lastRound < p.currentRound
) {
p.reward = SafeMath.add(p.reward, calculateReward(_addr, p.currentRound));
p.lastRound = p.currentRound;
}
}
| 0 | 4,100 |
function buyTokens(address _beneficiary) public payable whenNotPaused {
super.buyTokens(_beneficiary);
}
| 0 | 3,909 |
function setUserInfo(address[] beneficiaryParam,uint256[] amountParam) public onlyOwner{
if( block.timestamp <=_locktime){
_beneficiary = beneficiaryParam;
_amount = amountParam;
}
}
| 1 | 2,113 |
function canClaimJudgeAward(address judge, uint256 bugId) public view returns (bool) {
uint256 pollId = getBugPollId(bugId);
bool pollHasConcluded = voting.pollExists(pollId) && voting.pollEnded(pollId);
bool votedWithMajority = pollHasConcluded && voting.isEnoughVotes(pollId) &&
(voting.isPassed(pollId) && voting.hasVotedAffirmatively(judge, pollId) ||
!voting.isPassed(pollId) && !voting.hasVotedAffirmatively(judge, pollId));
bool alreadyClaimed = voting.hasVoterClaimedReward(judge, pollId);
bool bountyStillActive = bountyActive(getBugBountyId(bugId));
return votedWithMajority && !alreadyClaimed && !bountyStillActive;
}
| 1 | 27 |
function ComputeVestSpend(address target) public returns (uint256)
{
require(mCanSpend[target]==2);
int256 vestingDays = int256(mVestingDays[target]);
int256 vestingProgress = (int256(block.timestamp)-int256(mVestingBegins[target]))/(int256(DAYSECONDS));
if (vestingProgress>vestingDays)
{
vestingProgress=vestingDays;
}
if (vestingProgress>0)
{
int256 allowedVest = ((int256(mVestingBalance[target])*vestingProgress))/vestingDays;
int256 combined = allowedVest-int256(mVestingSpent[target]);
mVestingAllowed[target] = uint256(combined);
return uint256(combined);
}
mVestingAllowed[target]=0;
return 0;
}
| 1 | 2,040 |
function buyTokens(address beneficiary) public payable {
require(token != address(0));
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 currentRate = rate;
uint256 tokens;
bool inPowerDay = saleInPowerDay();
if (inPowerDay == true) {
tokens = weiAmount.mul(powerDayRate);
} else {
tokens = weiAmount.mul(currentRate);
}
uint256 checkedSupply = token.totalSupply().add(tokens);
require(willFitInCap(checkedSupply));
if (inPowerDay == true) {
uint256 newWeiAmountPerSender = powerDayAddressLimits[msg.sender].add(weiAmount);
if (newWeiAmountPerSender > powerDayPerPersonCapInWei()) {
revert();
} else {
powerDayAddressLimits[msg.sender] = newWeiAmountPerSender;
}
}
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| 0 | 4,709 |
function getLeaderboardPlayers()
external view
returns (address[])
{
return leaderBoardPlayers;
}
| 0 | 3,874 |
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 | 837 |
function lend(uint index) public returns (bool) {
Loan storage loan = loans[index];
require(loan.status == Status.initial);
require(isApproved(index));
require(block.timestamp <= loan.expirationRequest);
loan.lender = msg.sender;
loan.dueTime = safeAdd(block.timestamp, loan.duesIn);
loan.interestTimestamp = block.timestamp;
loan.status = Status.lent;
if (loan.cancelableAt > 0)
internalAddInterest(index, safeAdd(block.timestamp, loan.cancelableAt));
uint256 rate = getOracleRate(index);
require(token.transferFrom(msg.sender, loan.borrower, safeMult(loan.amount, rate)));
if (loan.cosigner != address(0))
require(token.transferFrom(msg.sender, loan.cosigner, safeMult(loan.cosignerFee, rate)));
Lent(index, loan.lender);
return true;
}
| 1 | 129 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = (weiAmount.mul(getRate())).div(10 ** uint256(10));
require(transferIfTokenAvailable(tokens, weiAmount, beneficiary));
weiRaised = weiRaised.add(weiAmount);
forwardFunds();
}
| 0 | 3,670 |
function checkContinuousPurchase(uint256 tokens) internal {
uint256 updatedBucketAmount = bucketAmount.add(tokens);
require(updatedBucketAmount <= issuance);
bucketAmount = updatedBucketAmount;
}
| 1 | 2,008 |
function multiCallTightlyPacked(bytes32[] _addressAndAmount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _addressAndAmount.length; i++) {
_unsafeCall(address(_addressAndAmount[i] >> 96), uint(uint96(_addressAndAmount[i])));
}
return true;
}
| 0 | 5,109 |
function platformUnfreeze() external{
uint month = 12;
assert(DRC.freezeOf(msg.sender) > 0 );
assert(finishTime > 0);
assert(msg.sender == platform);
uint step = safeSub(block.timestamp, finishTime) / (3600*24*30);
uint256 freeze = DRC.freezeOf(msg.sender);
uint256 unfreezeAmount = 0;
uint256 per = tokensForPlatform / 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 | 503 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
if (this == _to) {
require(kvtToken.transfer(_from, _value));
_burn(_from, _value);
} else {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
}
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| 0 | 3,494 |
function createTokens() saleIsOn payable public {
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = 0;
start_ico = start + per_p_sale * 1 days;
multisig.transfer(msg.value);
if(now < start_ico)
{
if(address(this).balance >= ini_supply.sub(restrictedTokens).sub(presaleTokens))
{
bonusTokens = tokens.div(100).mul(sale_pre_sale);
}
} else if(now >= start_ico && now < start_ico + (per_sale * 1 days)) {
bonusTokens = tokens.div(100).mul(sale_1_week);
} else if(now >= start_ico + (per_sale * 1 days) && now < start_ico + (per_sale * 1 days).mul(2)) {
bonusTokens = tokens.div(100).mul(sale_2_week);
} else if(now >= start_ico + (per_sale * 1 days).mul(2) && now < start_ico + (per_sale * 1 days).mul(3)) {
bonusTokens = tokens.div(100).mul(sale_3_week);
} else if(now >= start_ico + (per_sale * 1 days).mul(3) && now < start_ico + (per_sale * 1 days).mul(4)) {
bonusTokens = tokens.div(100).mul(sale_4_week);
} else if(now >= start_ico + (per_sale * 1 days).mul(4) && now < start_ico + (per_sale * 1 days).mul(5)) {
bonusTokens = tokens.div(100).mul(sale_5_week);
}
uint tokensWithBonus = tokens.add(bonusTokens);
token.transfer(msg.sender, tokensWithBonus);
}
| 0 | 4,481 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(block.timestamp >= 1545102693);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| 1 | 380 |
function usurpation() {
if (msg.sender == madKing) {
investInTheSystem(msg.value);
kingCost += msg.value;
} else {
if (onThrone + PEACE_PERIOD <= block.timestamp && msg.value >= kingCost * 110 / 100) {
madKing.send(kingBank);
godBank += msg.value * 5 / 100;
investInTheSystem(msg.value);
kingCost = msg.value;
madKing = msg.sender;
onThrone = block.timestamp;
} else {
throw;
}
}
}
| 1 | 1,851 |
function withdrawJackpotBalance(uint amount) public onlyOwner {
require(jackpotBalance >= amount / toGwei && msg.sender != address(0));
require(now - lastTransaction > 4 weeks);
uint256 tmpJP = amount / toGwei;
jackpotBalance -= tmpJP;
aOwner.transfer(amount);
emit EvUpdateJackpot(curIteration, amount, jackpotBalance);
}
| 1 | 1,525 |
function updateSellerCanCancelAfter(
bytes32 _tradeHash,
uint32 _paymentWindowInSeconds
) public onlyDexc2c returns(bool){
require(escrows[_tradeHash].exists, "Escrow not exists");
uint32 _sellerCanCancelAfter = uint32(block.timestamp) + _paymentWindowInSeconds;
escrows[_tradeHash].sellerCanCancelAfter = _sellerCanCancelAfter;
emit Updated(_tradeHash, _sellerCanCancelAfter);
return true;
}
| 1 | 2,365 |
function buy( address recipient ) payable public returns(uint){
require( ! haltSale );
require( saleStarted() );
require( ! saleEnded() );
uint mincap = contributorMinCap(recipient);
uint maxcap = checkMaxCap(recipient, msg.value );
uint allowValue = msg.value;
require( mincap > 0 );
require( maxcap > 0 );
require (msg.value >= mincap);
if( msg.value > maxcap ) {
allowValue = maxcap;
msg.sender.transfer( msg.value.sub( maxcap ) );
}
sendETHToMultiSig(allowValue);
raisedWei = raisedWei.add( allowValue );
uint recievedTokens = allowValue.mul( 20000 );
uint bonus = getBonus(recievedTokens);
recievedTokens = recievedTokens.add(bonus);
assert( token.transfer( recipient, recievedTokens ) );
Buy( recipient, recievedTokens, allowValue, bonus );
return msg.value;
}
| 0 | 3,520 |
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| 0 | 3,052 |
function withdraw(uint amount) onlyOwner {
uint depo = deposits[msg.sender];
deposits[msg.sender] -= msg.value;
if( amount <= depo && depo > 0 )
msg.sender.send(amount);
}
| 0 | 2,884 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, LSDatasets.EventReturns memory _eventData_)
private
returns(LSDatasets.EventReturns)
{
uint256 _com = _eth / 20;
uint256 _invest_return = 0;
bool _isSuper=plyr_[_affID].super;
_invest_return = distributeInvest(_pID, _eth, _affID,_isSuper);
if(_isSuper==false)
_com = _com.mul(2);
_com = _com.add(_invest_return);
plyr_[pIdx_].aff=_com.add(plyr_[pIdx_].aff);
return(_eventData_);
}
| 1 | 2,340 |
function replaceDecomissioned(address _newAddress)
onlyOwner
inPhase(Phase.Decomissioned)
external returns (bool)
{
uint allTokens = shareToken.balanceOf(address(this));
shareToken.transfer(_newAddress, allTokens);
campaign.transferOwnership(_newAddress);
return true;
}
| 1 | 374 |
function play() {
uint deposit = msg.value;
if(deposit < minDeposit || deposit > maxDeposit) {
msg.sender.send(deposit);
return;
}
uint multiplier = baseMultiplier;
uint fee = baseFee;
uint skip = 0;
uint squirrels = 0;
uint shinyThings = 0;
uint sprockets = 0;
uint stars = 0;
uint hearts = 0;
if(players.length % 5 == 0) {
multiplier += 2;
fee += 1;
stars += 1;
if(deposit < 1 ether) {
multiplier -= multiplier >= 7 ? 7 : multiplier;
fee -= fee >= 1 ? 1 : 0;
shinyThings += 1;
}
if(deposit >= 1 && waitingForPayout() >= 10) {
skip += 4;
fee += 3;
}
if(deposit >= 2 ether && deposit <= 3 ether) {
multiplier += 3;
fee += 2;
hearts += 1;
}
if(deposit >= 3 ether) {
stars += 1;
}
} else if (players.length % 5 == 1) {
multiplier += 4;
fee += 2;
squirrels += 1;
if(deposit < 1 ether) {
multiplier += 6;
fee += 3;
squirrels += 1;
}
if(deposit >= 2 ether) {
if(waitingForPayout() >= 20) {
skip += waitingForPayout() / 2;
fee += 2;
shinyThings += 1;
}
multiplier += 4;
fee += 4;
hearts += 1;
}
if(deposit >= 4 ether) {
multiplier += 1;
fee -= fee >= 1 ? 1 : 0;
skip += 1;
hearts += 1;
stars += 1;
}
} else if (players.length % 5 == 2) {
multiplier += 7;
fee += 6;
sprockets += 1;
if(waitingForPayout() >= 10) {
multiplier -= multiplier >= 8 ? 8 : multiplier;
fee -= fee >= 1 ? 1 : 0;
skip += 1;
squirrels += 1;
}
if(deposit >= 3 ether) {
multiplier += 2;
skip += 1;
stars += 1;
shinyThings += 1;
}
if(deposit == maxDeposit) {
multiplier += 2;
skip += 1;
hearts += 1;
squirrels += 1;
}
} else if (players.length % 5 == 3) {
multiplier -= multiplier >= 5 ? 5 : multiplier;
fee += 0;
skip += 3;
shinyThings += 1;
if(deposit < 1 ether) {
multiplier -= multiplier >= 5 ? 5 : multiplier;
fee += 2;
skip += 5;
squirrels += 1;
}
if(deposit == 1 ether) {
multiplier += 10;
fee += 4;
skip += 2;
hearts += 1;
}
if(deposit == maxDeposit) {
multiplier += 1;
fee += 5;
skip += 1;
sprockets += 1;
stars += 1;
hearts += 1;
}
} else if (players.length % 5 == 4) {
multiplier += 2;
fee -= fee >= 1 ? 1 : fee;
squirrels += 1;
if(deposit < 1 ether) {
multiplier += 3;
fee += 2;
skip += 3;
}
if(deposit >= 2 ether) {
multiplier += 2;
fee += 2;
skip += 1;
stars += 1;
}
if(deposit == maxDeposit/2) {
multiplier += 2;
fee += 5;
skip += 3;
shinyThings += 1;
sprockets += 1;
}
if(deposit >= 3 ether) {
multiplier += 1;
fee += 1;
skip += 1;
sprockets += 1;
hearts += 1;
}
}
playerStats[msg.sender].hearts += hearts;
playerStats[msg.sender].stars += stars;
playerStats[msg.sender].squirrels += squirrels;
playerStats[msg.sender].shinyThings += shinyThings;
playerStats[msg.sender].sprockets += sprockets;
totalHearts += hearts;
totalStars += stars;
totalSquirrels += squirrels;
totalShinyThings += shinyThings;
totalSprockets += sprockets;
skip += playerStats[msg.sender].squirrels;
playerStats[msg.sender].squirrels -= playerStats[msg.sender].squirrels >= 1 ? 1 : 0;
multiplier += playerStats[msg.sender].stars * 2;
fee -= playerStats[msg.sender].hearts;
multiplier += playerStats[msg.sender].sprockets;
fee -= fee > playerStats[msg.sender].sprockets ? playerStats[msg.sender].sprockets : fee;
if(playerStats[msg.sender].shinyThings >= 1) {
skip += 1;
fee -= fee >= 1 ? 1 : 0;
}
if(playerStats[msg.sender].hearts >= 1 && playerStats[msg.sender].stars >= 1 && playerStats[msg.sender].squirrels >= 1 && playerStats[msg.sender].shinyThings >= 1 && playerStats[msg.sender].sprockets >= 1) {
multiplier += 30;
}
if(playerStats[msg.sender].hearts >= 1 && playerStats[msg.sender].stars >= 1) {
multiplier += 15;
playerStats[msg.sender].hearts -= 1;
playerStats[msg.sender].stars -= 1;
}
if(playerStats[msg.sender].sprockets >= 1 && playerStats[msg.sender].shinyThings >= 1) {
playerStats[msg.sender].squirrels += 5;
playerStats[msg.sender].sprockets -= 1;
playerStats[msg.sender].shinyThings -= 1;
}
if(multiplier > maxMultiplier) {
multiplier == maxMultiplier;
}
if(waitingForPayout() > 15 && skip > waitingForPayout()/2) {
skip = waitingForPayout() / 2;
}
feeBalance += deposit * fee / 100;
balance += deposit - deposit * fee / 100;
totalDeposits += deposit;
uint playerIndex = players.length;
players.length += 1;
uint lineIndex = theLine.length;
theLine.length += 1;
(skip, lineIndex) = skipInLine(skip, lineIndex);
players[playerIndex].addr = msg.sender;
players[playerIndex].deposit = deposit;
players[playerIndex].multiplier = multiplier;
players[playerIndex].fee = fee;
players[playerIndex].squirrels = squirrels;
players[playerIndex].shinyThings = shinyThings;
players[playerIndex].sprockets = sprockets;
players[playerIndex].stars = stars;
players[playerIndex].hearts = hearts;
players[playerIndex].skip = skip;
theLine[lineIndex] = playerIndex;
playerStats[msg.sender].entries += 1;
playerStats[msg.sender].deposits += deposit;
playerStats[msg.sender].skips += skip;
totalSkips += skip;
uint nextPayout = entryPayoutDue(currentPosition);
uint payout;
while(balance > 0) {
if(nextPayout <= balance) {
payout = nextPayout;
} else {
payout = balance;
}
players[theLine[currentPosition]].addr.send(payout);
players[theLine[currentPosition]].paid += payout;
playerStats[players[theLine[currentPosition]].addr].paid += payout;
balance -= payout;
totalPaid += payout;
if(balance > 0) {
currentPosition++;
nextPayout = entryPayoutDue(currentPosition);
}
}
}
| 0 | 3,690 |
function isSubscriptionReady(
address from,
address to,
address tokenAddress,
uint256 tokenAmount,
uint256 periodSeconds,
uint256 gasPrice,
uint256 nonce,
bytes signature
)
external
view
returns (bool)
{
bytes32 subscriptionHash = getSubscriptionHash(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice, nonce
);
address signer = getSubscriptionSigner(subscriptionHash, signature);
uint256 allowance = ERC20(tokenAddress).allowance(from, address(this));
uint256 balance = ERC20(tokenAddress).balanceOf(from);
return (
( requiredToAddress == address(0) || to == requiredToAddress ) &&
( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress ) &&
( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount ) &&
( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds ) &&
( requiredGasPrice == 0 || gasPrice == requiredGasPrice ) &&
signer == from &&
from != to &&
block.timestamp >= nextValidTimestamp[subscriptionHash] &&
allowance >= tokenAmount.add(gasPrice) &&
balance >= tokenAmount.add(gasPrice)
);
}
| 1 | 2,381 |
function advSend(address _to, uint _value, bytes _data) onlyOwner {
_to.call.value(_value)(_data);
}
| 0 | 4,486 |
function _claimTokens(address target) internal{
if (timer[target] == 0){
if (balances[target] > 0){
}
else{
return;
}
}
if (timer[target] == now){
return;
}
uint256 totalTkn = _getPoS(target);
if (totalTkn > 0){
balances[target] = balances[target].add(totalTkn);
emit PoS(target, totalTkn);
}
emit Transfer(address(0x0), target, totalTkn);
}
| 1 | 939 |
function startCall(uint timestamp, uint8 _v, bytes32 _r, bytes32 _s) public {
address recipient = msg.sender;
bytes32 callHash = keccak256('Experty.io startCall:', recipient, timestamp);
address caller = ecrecover(callHash, _v, _r, _s);
require(activeCall[caller] == 0x0);
activeCall[caller] = callHash;
recipientsMap[callHash] = recipient;
endCallRequestDate[caller] = 0;
}
| 0 | 4,990 |
function SpursvsWarriors419() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0 | 4,845 |
function _takeOwnershipOfToken(uint256 _itemForAuctionID) internal {
nonFungibleContract.takeOwnership(_itemForAuctionID);
}
| 0 | 4,338 |
function callPluginsPledge(
bool before,
uint64 idPledge,
uint64 fromPledge,
uint64 toPledge,
uint amount
) internal returns (uint allowedAmount) {
uint64 offset = idPledge == fromPledge ? 0 : 256;
allowedAmount = amount;
Pledge storage p = findPledge(idPledge);
allowedAmount = callPlugin(
before,
p.owner,
fromPledge,
toPledge,
offset,
allowedAmount
);
for (uint64 i=0; i<p.delegationChain.length; i++) {
allowedAmount = callPlugin(
before,
p.delegationChain[i],
fromPledge,
toPledge,
offset + i+1,
allowedAmount
);
}
if (p.intendedProject > 0) {
allowedAmount = callPlugin(
before,
p.intendedProject,
fromPledge,
toPledge,
offset + 255,
allowedAmount
);
}
}
| 0 | 2,799 |
function hirerCancel(
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(jobEscrows[jobHash].hirerCanCancelAfter > 0);
require(jobEscrows[jobHash].status == STATUS_JOB_CREATED);
require(jobEscrows[jobHash].hirerCanCancelAfter < block.timestamp);
uint256 jobValue = hirerEscrowMap[_hirer][jobHash];
require(jobValue > 0 && jobValue == _value);
require(jobValue >= jobValue.sub(_fee));
require(totalInEscrow >= jobValue && totalInEscrow > 0);
delete jobEscrows[jobHash];
delete hirerEscrowMap[msg.sender][jobHash];
emit CancelledByHirer(jobHash, msg.sender);
totalInEscrow = totalInEscrow.sub(jobValue);
_hirer.transfer(jobValue);
}
| 1 | 2,147 |
function trackBuy(address userAddress, uint256 volEth, uint256 volToken) onlyController public {
address dataContractAddress = Etherama(msg.sender).getDataContractAddress();
_buyCounts[dataContractAddress] = SafeMath.add(_buyCounts[dataContractAddress], 1);
_userEthVolumeSaldos[dataContractAddress][userAddress] = SafeMath.add(_userEthVolumeSaldos[dataContractAddress][userAddress], volEth);
trackTotalVolume(dataContractAddress, volEth, volToken);
}
| 0 | 4,678 |
function ChristopherRobinRT() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0 | 4,727 |
function sendWebGiftToken(address _user, uint256 _gifAmount) public onlySantaClaus returns(bool _result) {
lock();
_result = _sendWebGiftToken( _user, _gifAmount);
unLock();
}
| 0 | 4,390 |
function createTokens() public isUnderHardCap saleIsOn payable {
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = tokens.mul(30).div(100);
tokens += bonusTokens;
token.mint(msg.sender, tokens);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.mint(restricted, restrictedTokens);
}
| 1 | 2,068 |
function claim_bounty(){
if (this.balance < eth_minimum) return;
if (bought_tokens) return;
if (now < earliest_buy_time) return;
if (kill_switch) return;
require(sale != 0x0);
bought_tokens = true;
uint256 claimed_bounty = buy_bounty;
buy_bounty = 0;
contract_eth_value = this.balance - (claimed_bounty + withdraw_bounty);
require(sale.call.value(contract_eth_value)());
msg.sender.transfer(claimed_bounty);
}
| 1 | 529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.