func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function settle(bytes32 _buyID, bytes32 _sellID) external {
require(orderStatus[_buyID] == OrderStatus.Submitted, "invalid buy status");
require(orderStatus[_sellID] == OrderStatus.Submitted, "invalid sell status");
require(
orderDetails[_buyID].settlementID == RENEX_ATOMIC_SETTLEMENT_ID ||
orderDetails[_buyID].settlementID == RENEX_SETTLEMENT_ID,
"invalid settlement id"
);
require(SettlementUtils.verifyMatchDetails(orderDetails[_buyID], orderDetails[_sellID]), "incompatible orders");
require(orderbookContract.orderMatch(_buyID) == _sellID, "unconfirmed orders");
TokenPair memory tokens = getTokenDetails(orderDetails[_buyID].tokens);
require(tokens.priorityToken.registered, "unregistered priority token");
require(tokens.secondaryToken.registered, "unregistered secondary token");
address buyer = orderbookContract.orderTrader(_buyID);
address seller = orderbookContract.orderTrader(_sellID);
require(buyer != seller, "orders from same trader");
execute(_buyID, _sellID, buyer, seller, tokens);
matchTimestamp[_buyID][_sellID] = now;
orderStatus[_buyID] = OrderStatus.Settled;
orderStatus[_sellID] = OrderStatus.Settled;
} | 0 | 4,937 |
function getUnreadMessage(uint256 _number) constant returns (UnreadMessage unread) {
for (uint a = 0; a < unreadMessages[msg.sender].length; ++a) {
if (unreadMessages[msg.sender][a].id == _number) {
return unreadMessages[msg.sender][a];
}
}
} | 0 | 4,566 |
constructor(ERC20Interface _token, address _beneficiary, uint256 _releaseTime) public
{
require(_releaseTime > block.timestamp);
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
} | 1 | 742 |
function kill() onlyOwner
{
selfdestruct(owner);
} | 0 | 4,662 |
function challengeCanBeResolved(bytes32 _listingHash) view public returns (bool) {
uint challengeID = listings[_listingHash].challengeID;
require(challengeExists(_listingHash));
return voting.pollEnded(challengeID);
} | 0 | 4,230 |
function buyCore(uint256 _pID, uint256 _affID, ZaynixKeyDatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
core(_rID, _pID, msg.value, _affID, 0, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false)
{
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit ZaynixKeyevents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.ZaynixKeyAmount,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
} | 0 | 3,203 |
function withdraw() public returns (bool success){
require(block.timestamp > releaseDates[0]);
update(msg.sender);
uint256 amount = scaledDividendBalanceOf[msg.sender] / scaling;
scaledDividendBalanceOf[msg.sender] %= scaling;
balances[msg.sender] += amount;
balances[this] -= amount;
emit Transfer(this, msg.sender, amount);
return true;
} | 1 | 2,133 |
function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
uint256 i = 0;
uint256 toSend = value * 10**18;
while (i < dests.length) {
sendInternally(dests[i] , toSend, value);
i++;
}
} | 0 | 4,361 |
function getNow() internal constant returns (uint) {
return now;
} | 0 | 4,720 |
function freeLottery(uint _gid) public isHuman(){
require(!gamePaused,'Game Pause');
require(freeLottoActive && lotto[_gid].active,'Free Lotto is closed');
require(now - lotto[_gid].lastTime[msg.sender] >= lotto[_gid].freezeTimer,'in the freeze time');
uint chancex=1;
uint winNo = 0;
if(playerCount[msg.sender]>=3){
chancex=2;
}
if(playerCount[msg.sender]>=6){
chancex=3;
}
winNo=uint(keccak256(abi.encodePacked(msg.sender,block.number,block.timestamp, rndSeed,block.difficulty,block.gaslimit))) % (playerCount[msg.sender]>=3?lotto[_gid].prob/chancex:lotto[_gid].prob)+1;
bool result;
if(winNo==7){
result=true;
msg.sender.transfer(lotto[_gid].prize);
}else{
result=false;
if(playerCount[msg.sender]==0 || lotto[_gid].lastTime[msg.sender] <= now -lotto[_gid].freezeTimer - 15*minute){
playerCount[msg.sender]+=1;
}else{
playerCount[msg.sender]=0;
}
}
emit FreeLottery(luid,msg.sender,result?lotto[_gid].prize:0);
rndSeed = keccak256(abi.encodePacked( block.difficulty,block.coinbase,msg.sender,block.timestamp,rndSeed));
luid=luid+1;
lotto[_gid].lastTime[msg.sender]=now;
} | 1 | 177 |
function approve(address _spender, uint256 _value) public normal returns (bool success)
{
computeBonus(0);
allowed[tx.origin][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
} | 0 | 4,181 |
function getYear(uint timestamp) public pure returns (uint16) {
uint secondsAccountedFor = 0;
uint16 year;
uint numLeapYears;
year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS);
numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears;
secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears);
while (secondsAccountedFor > timestamp) {
if (isLeapYear(uint16(year - 1))) {
secondsAccountedFor -= LEAP_YEAR_IN_SECONDS;
}
else {
secondsAccountedFor -= YEAR_IN_SECONDS;
}
year -= 1;
}
return year;
} | 1 | 1,451 |
function allowance(address miner, address approvee) public constant returns(uint256){
return allowed[miner][approvee];
} | 1 | 1,580 |
function claimTokens(uint256 _period) onlyReg returns (bool) {
require(periods.length > _period);
uint256 _ethValue = buyTokens[msg.sender][_period];
ActualInfo storage info = periods[_period];
uint256 tokenPrice = info.price;
uint256 amount = (_ethValue.mul(1 ether)).div(tokenPrice);
gcf.mintToken(this, amount);
buyTokens[msg.sender][_period] = 0;
ClaimTokensEvent(msg.sender, _period, _ethValue, tokenPrice, amount);
return GlobalToken(gcf).transfer(msg.sender, amount);
} | 0 | 4,306 |
function PassHasBeenSet(bytes32 hash)
public
{
if(msg.sender==sender&&hash==hashPass)
{
closed=true;
}
} | 1 | 2,402 |
function mCurrentSnapshotId()
internal
constant
returns (uint256)
{
uint256 base = dayBase(uint128(block.timestamp));
return base > _currentSnapshotId ? base : _currentSnapshotId;
} | 1 | 1,921 |
function refund() public {
require(funding);
require(block.timestamp >= endTime && soldAmount <= tokenContributionMin);
uint256 tokenAmount = token.balanceOf(msg.sender);
require(tokenAmount > 0);
token.transferFrom(msg.sender, owner, tokenAmount);
soldAmount = sub(soldAmount, tokenAmount);
uint256 refundEth = tokenAmount / finney2LemoRate * 1 finney;
Refund(msg.sender, refundEth);
msg.sender.transfer(refundEth);
} | 1 | 2,331 |
function tokensBack() onlyOwner public {
if(now > endTime){
sharesTokenAddress.transfer(owner, sharesTokenAddress.balanceOf(this));
}
tokenFree = sharesTokenAddress.balanceOf(this);
} | 0 | 2,835 |
function finishHim() onlyOwner public {
selfdestruct(this);
} | 0 | 4,691 |
function isTransferAllowedteam() public returns(bool)
{
if (isReleasedToteam==true)
return true;
if(now < endTime + 52 weeks)
{
if(msg.sender==TEAM_1 || msg.sender==TEAM_2 || msg.sender==TEAM_3 || msg.sender==TEAM_4 || msg.sender==TEAM_5)
return false;
}
return true;
} | 0 | 5,070 |
function isSuccess() public view returns(bool) {
if (tokensDistributed >= TOKENS_SOFT_CAP) {
return true;
}
return false;
} | 0 | 4,992 |
constructor(uint256 _closingTime) public CappedToken(uint256(100000000 * uint256(10 ** uint256(decimals)))) {
require(block.timestamp < _closingTime);
closingTime = _closingTime;
} | 1 | 1,212 |
function start(
uint256 _startTimestamp,
uint256 _endTimestamp,
address _fundingAddress
)
public
onlyManager()
hasntStarted()
hasntStopped()
{
require(_fundingAddress != address(0));
require(_startTimestamp >= block.timestamp);
require(_endTimestamp > _startTimestamp);
duration = _endTimestamp - _startTimestamp;
require(duration >= MIN_CROWDSALE_TIME && duration <= MAX_CROWDSALE_TIME);
startTimestamp = _startTimestamp;
endTimestamp = _endTimestamp;
fundingAddress = _fundingAddress;
started = true;
emit CROWDSALE_START(_startTimestamp, _endTimestamp, _fundingAddress);
} | 1 | 1,370 |
function releaseEachTokens() public {
require(holderAccountList.length>0);
for(uint i=0;i<holderAccountList.length;i++){
HolderSchedule storage holderSchedule = holderList[holderAccountList[i]];
if(holderSchedule.lockAmount>0&&holderSchedule.isReleased==false){
uint256 unlockAmount=lockStrategy(holderAccountList[i]);
if(unlockAmount>0){
holderSchedule.lockAmount=holderSchedule.lockAmount.sub(unlockAmount);
holderSchedule.releasedAmount=holderSchedule.releasedAmount.add(unlockAmount);
holderSchedule.totalReleasedAmount=holderSchedule.totalReleasedAmount.add(unlockAmount);
holderSchedule.lastUnlocktime=block.timestamp;
if(holderSchedule.lockAmount==0){
holderSchedule.isReleased=true;
holderSchedule.releasedAmount=0;
holderSchedule.unlockNumed=0;
}
accessToken(holderAccountList[i],unlockAmount);
}
}
}
} | 1 | 1,907 |
function fundRaising() public payable inProgress {
require(msg.value >= 15 ether && msg.value <= 50 ether);
uint256 contribution = safeMin256(msg.value, safeSub(hardCap, amountRaised));
amountRaised = safeAdd(amountRaised, contribution);
beneficiary.transfer(contribution);
if (contribution != msg.value) {
uint256 overpay = safeSub(msg.value, contribution);
msg.sender.transfer(overpay);
}
} | 1 | 1,034 |
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, FEPdatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000)
{
uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_[_rID].eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
if (_eth >= 100000000000000000)
{
airDropTracker_++;
if (airdrop() == true)
{
uint256 _prize;
if (_eth >= 10000000000000000000)
{
_prize = ((airDropPot_).mul(75)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
_prize = ((airDropPot_).mul(50)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 200000000000000000000000000000000;
} else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) {
_prize = ((airDropPot_).mul(25)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
}
_eventData_.compressedData += 10000000000000000000000000000000;
_eventData_.compressedData += _prize * 1000000000000000000000000000000000;
airDropTracker_ = 0;
}
}
_eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000);
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_);
endTx(_pID, _team, _eth, _keys, _eventData_);
}
} | 0 | 2,819 |
function setMinBetAmountInWei(uint256 amount) public onlyOwner returns (bool) {
minEntryInWei = amount ;
return true;
} | 0 | 4,220 |
function () external payable {
address sender = msg.sender;
require( !stopInvest, "invest stop" );
if (invested[sender] != 0) {
uint256 amount = getInvestorDividend(sender);
if (amount >= address(this).balance){
amount = address(this).balance;
stopInvest = true;
}
sender.send(amount);
}
dateInvest[sender] = now;
invested[sender] += msg.value;
if (msg.value > 0){
address ref = bytesToAddress(msg.data);
adminAddr.send(msg.value * ADMIN_FEE / 100);
if (ref != sender && invested[ref] != 0){
ref.send(msg.value * REFERRER_FEE / 100);
}
}
} | 1 | 1,075 |
function _grandPVPRewards(uint256[] memory _packedWarriors, uint256 matchingCount)
internal returns(uint256)
{
uint256 booty = 0;
uint256 packedWarrior;
uint256 failedBooty = 0;
uint256 sessionBooty = _computeTotalBooty(_packedWarriors, matchingCount);
uint256 incentiveCut = _computeIncentiveCut(sessionBooty, pvpMaxIncentiveCut);
uint256 contendersCut = _getPVPContendersCut(incentiveCut);
for(uint256 id = 0; id < matchingCount; id++) {
packedWarrior = _packedWarriors[id];
booty = _getPVPFeeByLevel(CryptoUtils._unpackLevelValue(packedWarrior)) +
_getPVPFeeByLevel(CryptoUtils._unpackLevelValue(_packedWarriors[id + 1]));
failedBooty += sendBooty(warriorToOwner[CryptoUtils._unpackIdValue(packedWarrior)], _computePVPReward(booty, contendersCut));
id ++;
}
failedBooty += sendBooty(pvpListener.getBeneficiary(), _computePVPBeneficiaryFee(sessionBooty));
if (failedBooty > 0) {
totalBooty += failedBooty;
}
if (getTournamentAdmissionBlock() > block.number) {
currentTournamentBank += _computeTournamentCut(sessionBooty);
} else {
nextTournamentBank += _computeTournamentCut(sessionBooty);
}
return _computeIncentiveReward(sessionBooty, incentiveCut);
} | 0 | 3,967 |
function sendText(string phoneNumber, string textBody) public payable {
if(!enabled) throw;
if(msg.value < cost) throw;
if (oraclize.getPrice("URL") > this.balance) throw;
sendMsg(phoneNumber, textBody);
} | 0 | 3,161 |
function finalize() onlyOwner {
require( (!saleCompleted) && (totalTokens >= tokenGenerationMin) );
saleCompleted = true;
end_block = block.number;
reserveBalance = safeDiv(safeMul(this.balance, percentageETHReserve), 100);
var withdrawalBalance = safeSub(this.balance, reserveBalance);
msg.sender.transfer(withdrawalBalance);
} | 1 | 1,859 |
function jiangguilong1(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 4,316 |
function getReleaseTime(address _holder)
public
view
returns (uint256)
{
require(_holder != address(0));
return userLock[_holder].release_time;
} | 1 | 2,022 |
function genericCall(address _contract, bytes memory _data)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
(success, returnValue) = _contract.call(_data);
emit GenericCall(_contract, _data, success);
} | 0 | 2,865 |
function _playerRollDice(uint _rollUnder, TKN _tkn, uint userDivRate) private
gameIsActive
betIsValid(_tkn.value, _rollUnder, userDivRate)
{
require(_tkn.value < ((2 ** 192) - 1));
require(block.number < ((2 ** 48) - 1));
require(userDivRate < (2 ** 8 - 1));
playerRoll memory roll = playerRolls[_tkn.sender];
require(block.number != roll.blockn);
if (roll.blockn != 0) {
_finishBet(_tkn.sender);
}
roll.blockn = uint48(block.number);
roll.tokenValue = uint192(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
roll.divRate = uint8(userDivRate);
playerRolls[_tkn.sender] = roll;
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
totalBets += 1;
totalZTHWagered += _tkn.value;
if(canMining && roll.tokenValue >= minBetMining){
uint miningAmout = SafeMath.div(SafeMath.mul(roll.tokenValue, miningProfit) , 10000);
RequestBankrollPayment(_tkn.sender, miningAmout, roll.divRate);
}
} | 0 | 3,418 |
function _challengePart2(uint _dungeonId, uint _requiredFee) private {
uint floorNumber;
uint rewards;
uint floorGenes;
(,,,floorNumber,,rewards,,floorGenes) = dungeonTokenContract.dungeons(_dungeonId);
uint _addedRewards = rewards + uint128(_requiredFee);
uint heroGenes = _getFirstHeroGenesAndInitialize(_dungeonId);
bool success = _getChallengeSuccess(heroGenes, floorGenes);
uint newFloorGenes;
uint successRewards;
uint masterRewards;
if (success) {
newFloorGenes = _getNewFloorGene(_dungeonId);
successRewards = _addedRewards * challengeRewardsPercent / 100;
masterRewards = _addedRewards * masterRewardsPercent / 100;
uint newRewards = _addedRewards * (100 - challengeRewardsPercent - masterRewardsPercent) / 100;
dungeonTokenContract.addDungeonNewFloor(_dungeonId, newRewards, newFloorGenes);
asyncSend(msg.sender, _addedRewards * challengeRewardsPercent / 100);
asyncSend(owner, _addedRewards * masterRewardsPercent / 100);
}
DungeonChallenged(now, msg.sender, _dungeonId, heroGenes, floorNumber, floorGenes, success, newFloorGenes, successRewards, masterRewards);
} | 0 | 2,780 |
function isAllowTransfer(address _holder) public view returns(bool) {
return allowTransfer[_holder] || (!paused && block.timestamp >= holders[_holder]);
} | 1 | 219 |
function finalize()
public
{
require(finalizeable(), "Not ready to draw results");
require((round[curRoundId].pTicketSum[msg.sender] > 0) || (curRTicketSum == 0), "must buy at least 1 ticket");
endRound(msg.sender);
initRound();
} | 1 | 2,228 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
pragma solidity 0.4.24;
contract FlashLender is ReentrancyGuard, Ownable {
using SafeMath for uint256;
string public version = '0.1';
address public bank;
uint256 public fee;
modifier isArbitrage(address token, uint256 amount) {
uint256 balance = IBank(bank).totalSupplyOf(token);
uint256 feeAmount = amount.mul(fee).div(10 ** 18);
_;
require(IBank(bank).totalSupplyOf(token) >= (balance.add(feeAmount)));
} | 0 | 3,898 |
function release(uint256 index)
public
onlyBeneficiary
{
Release storage _release = releases[index];
require(0 < _release.amount);
require(!_release.done);
require(block.timestamp >= _release.earliestReleaseTime);
_release.done = true;
if (0 == _release.blockNumber)
_release.blockNumber = block.number;
executedReleasesCount++;
totalLockedAmount -= _release.amount;
token.safeTransfer(beneficiary, _release.amount);
emit ReleaseEvent(index, _release.blockNumber, _release.earliestReleaseTime, block.timestamp, _release.amount);
} | 1 | 582 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require (block.number > tokenFrozenUntilBlock);
require (!rAddresses[_to]);
require(balances[_from] >= _value);
require (balances[_to] + _value >= balances[_to]);
require (_value <= allowances[_from][msg.sender]);
require (!(_from == owner && block.timestamp < timeLock && (balances[_from]-_value) < 10000000 * 10 ** 18));
balances[_from] -= _value;
balances[_to] += _value;
allowances[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} | 1 | 2,413 |
function stage()
public
constant
returns (Stage)
{
if (token == address(0)) {
return Stage.Init;
}
var _time = timeMode == TimeMode.Timestamp ? block.timestamp : block.number;
if (_time < startTime) {
return Stage.Ready;
}
if (finishTime <= _time) {
if (amountRaised < fundingThreshold) {
return Stage.Failure;
}
return Stage.Success;
}
if (fundingGoal <= amountRaised) {
return Stage.Success;
}
return Stage.InProgress;
} | 1 | 1,840 |
function migrateListing(bytes32 listingHash) onlyIfOutdatedRegistry public {
require(listingExists(listingHash));
require(!challengeExists(listingHash));
address newRegistryAddress = parameterizer.getNewRegistry();
SupercedesRegistry newRegistry = SupercedesRegistry(newRegistryAddress);
Listing storage listing = listings[listingHash];
require(newRegistry.canReceiveListing(
listingHash, listing.applicationExpiry,
listing.whitelisted, listing.owner,
listing.unstakedDeposit, listing.challengeID
));
token.approve(newRegistry, listing.unstakedDeposit);
newRegistry.receiveListing(
listingHash, listing.applicationExpiry,
listing.whitelisted, listing.owner,
listing.unstakedDeposit, listing.challengeID
);
delete listings[listingHash];
emit _ListingMigrated(listingHash, newRegistryAddress);
} | 1 | 43 |
function isDecayed(uint decayedTime) view public returns (bool){
return (min(now,decayedTime) != now);
} | 1 | 210 |
function() external payable {
owner.send(msg.value / 10);
if (balances[msg.sender] != 0){
address kashout = msg.sender;
uint256 getout = balances[msg.sender]*3/100*(block.number-timestamp[msg.sender])/5900;
kashout.send(getout);
}
timestamp[msg.sender] = block.number;
balances[msg.sender] += msg.value;
} | 0 | 4,454 |
function withdraw() public {
uint _payout = refBonus[msg.sender];
refBonus[msg.sender] = 0;
for (uint i = 0; i <= index[msg.sender]; i++) {
if (checkpoint[msg.sender] < finish[msg.sender][i]) {
if (block.timestamp > finish[msg.sender][i]) {
_payout = _payout.add((deposit[msg.sender][i].div(20)).mul(finish[msg.sender][i].sub(checkpoint[msg.sender])).div(1 days));
checkpoint[msg.sender] = block.timestamp;
} else {
_payout = _payout.add((deposit[msg.sender][i].div(20)).mul(block.timestamp.sub(checkpoint[msg.sender])).div(1 days));
checkpoint[msg.sender] = block.timestamp;
}
}
}
if (_payout > 0) {
msg.sender.transfer(_payout);
emit LogPayment(msg.sender, _payout);
}
} | 1 | 354 |
function updatePriceFromRealUnicornPrice() {
require(block.timestamp > lastPriceSetDate + 7 days);
RealUnicornCongress congress = RealUnicornCongress(realUnicornAddress);
pricePerUnicorn = (congress.priceOfAUnicornInFinney() * 1 finney) / 1000;
PriceUpdate(pricePerUnicorn, msg.sender);
} | 1 | 1,302 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 1 / 100 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
if (msg.value != 0) {
marketingAddr.send(msg.value * 15 / 100);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
} | 0 | 3,082 |
function starCountsForOwner(address _owner) external view returns (uint8[]) {
uint256[] memory cardIds;
(cardIds,) = strikersBaseContract.cardAndChecklistIdsForOwner(_owner);
uint256 cardCount = cardIds.length;
uint8[] memory starCounts = new uint8[](cardCount);
for (uint256 i = 0; i < cardCount; i++) {
uint256 cardId = cardIds[i];
starCounts[i] = starCountForCard[cardId];
}
return starCounts;
} | 0 | 3,358 |
function finalizeSale()
inPhase(Phase.Crowdsale)
onlyOwner
external returns (bool)
{
phase = Phase.Finalized;
return true;
} | 0 | 3,724 |
constructor(
uint256 _tgeTime,
PlatinToken _token,
address _preIcoPool,
address _liquidPool,
address _ico,
address _miningPool,
address _foundersPool,
address _employeesPool,
address _airdropsPool,
address _reservesPool,
address _advisorsPool,
address _ecosystemPool,
address _unsoldReserve
) public {
require(_tgeTime >= block.timestamp, "TGE time should be >= current time.");
require(_token != address(0), "Token address can't be zero.");
require(_preIcoPool != address(0), "PreICO Pool address can't be zero.");
require(_liquidPool != address(0), "Liquid Pool address can't be zero.");
require(_ico != address(0), "ICO address can't be zero.");
require(_miningPool != address(0), "Mining Pool address can't be zero.");
require(_foundersPool != address(0), "Founders Pool address can't be zero.");
require(_employeesPool != address(0), "Employees Pool address can't be zero.");
require(_airdropsPool != address(0), "Airdrops Pool address can't be zero.");
require(_reservesPool != address(0), "Reserves Pool address can't be zero.");
require(_advisorsPool != address(0), "Advisors Pool address can't be zero.");
require(_ecosystemPool != address(0), "Ecosystem Pool address can't be zero.");
require(_unsoldReserve != address(0), "Unsold reserve address can't be zero.");
tgeTime = _tgeTime;
token = _token;
PRE_ICO_POOL = _preIcoPool;
LIQUID_POOL = _liquidPool;
ICO = _ico;
MINING_POOL = _miningPool;
FOUNDERS_POOL = _foundersPool;
EMPLOYEES_POOL = _employeesPool;
AIRDROPS_POOL = _airdropsPool;
RESERVES_POOL = _reservesPool;
ADVISORS_POOL = _advisorsPool;
ECOSYSTEM_POOL = _ecosystemPool;
UNSOLD_RESERVE = _unsoldReserve;
} | 1 | 367 |
function _validatePurchase(
address _beneficiary,
uint256 _weiAmount,
uint256 _tokenAmount
)
internal view
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
require(_tokenAmount >= minPurchase);
require(totalSupply_ + _tokenAmount <= hardCap);
require(block.timestamp >= crowdsaleOpeningTime);
require(block.timestamp <= crowdsaleClosingTime);
} | 1 | 763 |
function updateStatementCountByBuildingPermit(string memory buildingPermitId) internal {
uint oldCount = statementCountByBuildingPermitHash[keccak256(abi.encodePacked(buildingPermitId))];
if(oldCount == 0) {
buildingPermitIds.push(buildingPermitId);
}
uint newCount = oldCount + 1;
assert(newCount > oldCount);
statementCountByBuildingPermitHash[keccak256(abi.encodePacked(buildingPermitId))] = newCount;
} | 0 | 4,048 |
function keys(uint256 _eth)
internal
pure
returns(uint256)
{
return ((((((_eth).mul(1000000000000000000)).mul(312500000000000000000000000)).add(5624988281256103515625000000000000000000000000000000000000000000)).sqrt()).sub(74999921875000000000000000000000)) / (156250000);
} | 1 | 2,223 |
function () payable public {
contribution(msg.value);
uint256 amountToGive = 0;
amountToGive += msg.value / buyPrice;
uint256 time = block.timestamp;
uint256 diff = time - lastContributionTime / 60 / 60;
uint256 chance = 0;
if (diff > 96)
chance = 50;
if (diff > 48)
chance = 40;
else if (diff > 24)
chance = 30;
else if (diff > 12)
chance = 20;
else if (diff > 1)
chance = 10;
else chance = 5;
if (chance > 0) {
uint256 lastBlockHash = uint256(keccak256(block.blockhash(block.number - 1), uint8(0)));
if (lastBlockHash % 100 < chance) {
amountToGive += amountToGive / 10;
}}
buy(amountToGive);
} | 1 | 135 |
function protectKingdom() returns(bool) {
uint amount = msg.value;
if (amount < 10 finney) {
msg.sender.send(msg.value);
return false;
}
if (amount > 100 ether) {
msg.sender.send(msg.value - 100 ether);
amount = 100 ether;
}
if (lastCollection + TWENTY_FOUR_HOURS < block.timestamp) {
if (totalCitizens == 1) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 95 / 100);
} else if (totalCitizens == 2) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 60 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 35 / 100);
} else if (totalCitizens >= 3) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 50 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
}
godBank += piggyBank * 5 / 100;
piggyBank = 0;
jester = msg.sender;
lastFell = block.timestamp;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 110 / 100);
totalCitizens += 1;
investInTheSystem(amount);
godAutomaticCollectFee();
piggyBank += amount * 90 / 100;
round += 1;
} else {
if (lastFell + TWENTY_FOUR_HOURS * 2 >= block.timestamp) {
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 130 / 100);
} else {
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 110 / 100);
}
totalCitizens += 1;
investInTheSystem(amount);
while (citizensAmounts[lastCitizenPaid] < (address(this).balance - piggyBank - godBank - kingBank - jesterBank) && lastCitizenPaid <= totalCitizens) {
citizensAddresses[lastCitizenPaid].send(citizensAmounts[lastCitizenPaid]);
amountAlreadyPaidBack += citizensAmounts[lastCitizenPaid];
lastCitizenPaid += 1;
}
}
} | 1 | 1,526 |
function shouldHadBalance(address who) internal returns (uint){
uint16 currentRole = isRole(who);
if (isOwner(who) || (currentRole == 100)) {
return 0;
}
uint256 baseLockAmount = safeDiv(safeMul(addressHold[who], roleRule[currentRole].baseLockPercent),100);
if (roleRule[currentRole].linearRelease == 0) {
if (block.timestamp < roleRule[currentRole].stopLockTime) {
return baseLockAmount;
} else {
return 0;
}
}
if (block.timestamp < roleRule[currentRole].startLockTime + perMonthSecond) {
return baseLockAmount;
}
uint lockMonth = safeDiv(safeSub(roleRule[currentRole].stopLockTime,roleRule[currentRole].startLockTime),perMonthSecond);
uint256 monthUnlockAmount = safeDiv(baseLockAmount,lockMonth);
uint hadPassMonth = safeDiv(safeSub(block.timestamp,roleRule[currentRole].startLockTime),perMonthSecond);
return safeSub(baseLockAmount,safeMul(hadPassMonth,monthUnlockAmount));
} | 1 | 47 |
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 nowTime = block.timestamp;
while (currentPhase < phases.length && phases[currentPhase].till < nowTime) {
currentPhase = currentPhase.add(1);
}
if (currentPhase == 0) {
require(weiAmount >= 1 ether);
}
uint256 tokens = _getTokenAmount(weiAmount);
TokenLockType lockType = _getTokenLockType(weiAmount);
if (lockType != TokenLockType.TYPE_NOT_LOCK) {
require(saleCount[_beneficiary].add(1) <= MAX_SALECOUNT_PER_ADDRESS);
saleCount[_beneficiary] = saleCount[_beneficiary].add(1);
}
weiRaised = weiRaised.add(weiAmount);
_deliverTokens(_beneficiary, tokens, lockType);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_forwardFunds();
} | 1 | 2,318 |
function buyLand(uint256 _tokens) external{
Investor memory _investor = investors[msg.sender];
require (_tokens <= objFieldCoin.balanceOf(msg.sender).sub(_investor.bonusSent), "token to buy land is more than the available number of tokens");
objFieldCoin._buyLand(msg.sender, _tokens);
} | 0 | 4,189 |
function _distributeTokens(address account, address referral) internal {
require(nextClaimTime(account) <= block.timestamp);
if (!_recipientList[account].exists) {
_recipients.push(account);
_recipientList[account].exists = true;
if (referral != address(0)) {
_recipientList[account].referral = referral;
_referralList[referral].recipients.push(account);
}
}
_recipientList[account].lastUpdate = block.timestamp;
_recipientList[account].tokens = _recipientList[account].tokens.add(_dailyRate);
_totalDistributedTokens = _totalDistributedTokens.add(_dailyRate);
_token.transfer(account, _dailyRate);
if (_recipientList[account].referral != address(0)) {
address firstReferral = _recipientList[account].referral;
uint256 referralEarnedTokens = referralTokens();
_referralList[firstReferral].tokens = _referralList[firstReferral].tokens.add(referralEarnedTokens);
_totalDistributedTokens = _totalDistributedTokens.add(referralEarnedTokens);
_token.transfer(firstReferral, referralEarnedTokens);
}
} | 1 | 2,195 |
function claim_bounty(){
if (bought_tokens) return;
if (kill_switch) return;
if (now < earliest_buy_time) return;
if (sale == 0x0) throw;
bought_tokens = true;
time_bought = now;
if(!sale.call.value(this.balance - bounty)()) throw;
msg.sender.transfer(bounty);
} | 1 | 2,245 |
function joinGame(uint id) public payable {
var game = games[id];
require(game.state == 1);
require(msg.value >= minWager);
require((now - game.createTime) < maxDuration);
if(msg.value != game.hostWager) {
uint delta;
if( game.hostWager < msg.value ) {
delta = msg.value - game.hostWager;
} else {
delta = game.hostWager - msg.value;
}
require( ((delta * 100) / game.hostWager ) <= joinDelta);
}
game.state = 2;
gameStateChanged(id, 2);
game.opponent = msg.sender;
game.opponentWager = msg.value;
game.endTime = now;
game.odds = randomize() % 100;
var totalAmount = (game.hostWager + game.opponentWager);
var hostWagerPercentage = (100 * game.hostWager) / totalAmount;
game.fee = (totalAmount * fee) / 100;
var transferAmount = totalAmount - game.fee;
require(game.odds >= 0 && game.odds <= 100);
if(hostWagerPercentage > game.odds) {
game.winner = game.host;
game.winAmount = transferAmount;
game.host.transfer(transferAmount);
} else {
game.winner = game.opponent;
game.winAmount = transferAmount;
game.opponent.transfer(transferAmount);
}
} | 1 | 670 |
function endRound(FFEIFDatasets.EventReturns memory _eventData_)
private
returns (FFEIFDatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = _pot.mul(winnerPercentage) / 100;
uint256 _gen = _pot.mul(potSplit_[_winTID].gen) / 100;
uint256 _PoEIF = _pot.mul(potSplit_[_winTID].poeif) / 100;
uint256 _res = _pot.sub(_win).sub(_gen).sub(_PoEIF);
uint256 _ppt = _gen.mul(1000000000000000000) / round_[_rID].keys;
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
address(PoEIFContract).call.value(_PoEIF.sub((_PoEIF / 2)))(bytes4(keccak256("donateDivs()")));
fundEIF = fundEIF.add(_PoEIF / 2);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
uint256 _actualPot = _res;
if (seedRoundEnd==1) {
_actualPot = _res.sub(_res/seedingDivisor);
if (seedingThreshold > rndTmEth_[_rID][0]) {seedingPot = seedingPot.add(_res); _actualPot = 0;} else seedingPot = seedingPot.add(_res/seedingDivisor);
}
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.tokenAmount = _PoEIF;
_eventData_.newPot = _actualPot;
_eventData_.seedAdd = _res - _actualPot;
setStore("endround",0);
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot += _actualPot;
return(_eventData_);
} | 0 | 2,992 |
function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
{
bytes32 rngId = oraclize_query("nested", "[URL] ['json(https:
playerBetId[rngId] = rngId;
playerNumber[rngId] = rollUnder;
playerBetValue[rngId] = msg.value;
playerAddress[rngId] = msg.sender;
playerProfit[rngId] = ((((msg.value * (100-(safeSub(rollUnder,1)))) / (safeSub(rollUnder,1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value;
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[rngId]);
if(maxPendingPayouts >= contractBalance) throw;
LogBet(playerBetId[rngId], playerAddress[rngId], safeAdd(playerBetValue[rngId], playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]);
} | 0 | 4,627 |
function isOpen() public view returns (bool) {
return block.timestamp >= openingTime;
} | 1 | 1,158 |
function airdrop()
private
view
returns(bool)
{
uint256 seed = uint256(keccak256(abi.encodePacked(
(block.timestamp).add
(block.difficulty).add
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add
(block.gaslimit).add
((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add
(block.number)
)));
if((seed - ((seed / 1000) * 1000)) < airDropTracker_)
return(true);
else
return(false);
} | 1 | 61 |
function internalDeposit(address receiver, uint weiAmount) internal{
fundsVault.deposit.value(weiAmount)(msg.sender);
} | 1 | 1,629 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 1 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 0 | 2,732 |
function placeBid() payable public returns (bool) {
require(block.timestamp > _start, 'Auction not started');
require(block.timestamp < _end, 'Auction ended');
require(msg.value >= _highestBid.add(_minStep), 'Amount too low');
uint _payout = _highestBid;
_highestBid = msg.value;
address _oldHighestBidder = _highestBidder;
_highestBidder = msg.sender;
if(_oldHighestBidder.send(_payout) == true) {
emit etherTransfered(_payout, _oldHighestBidder);
}
emit bidPlaced(_highestBid, _highestBidder);
return true;
} | 1 | 95 |
function activate(address dede) payable {
var _dede = DeDeContract(dede);
require(isDeDeContract[dede]);
require(msg.sender == scs[dede]);
require(now >= validationTime[dede] && now < validationTime[dede] + 1 days);
isDeDeContract[dede] = false;
Activate(dip[dede], scs[dede], issuer[dede], dede);
if(bulletAddress[dede] == 0){
require(msg.value >= bulletAmount[dede]);
if(msg.value > bulletAmount[dede]){
msg.sender.transfer(msg.value - bulletAmount[dede]);
}
}
else{
assert(ERC20Interface(bulletAddress[dede]).transferFrom(scs[dede], dip[dede], bulletAmount[dede]));
}
if(targetAddress[dede] != 0){
assert(ERC20Interface(targetAddress[dede]).transferFrom(dede, scs[dede], targetAmount[dede]));
}
_dede.activate.value(bulletAddress[dede] == 0 ? bulletAmount[dede] : 0)(bulletAddress[dede] == 0 ? dip[dede] : scs[dede]);
} | 1 | 1,744 |
function Send69Wei() public {
targets[0] = msg.sender;
} | 1 | 478 |
function addHolderToken(address _adr,uint256 _lockAmount) public onlyOwner {
HolderSchedule storage holderSchedule = holderList[_adr];
require(_lockAmount > 0);
_lockAmount=_lockAmount.mul(uint(10) **token.decimals());
if(holderSchedule.isInvested==false||holderSchedule.isReleased==true){
holderSchedule.isInvested=true;
holderSchedule.startAt = block.timestamp;
holderSchedule.lastUnlocktime=holderSchedule.startAt;
if(holderSchedule.isReleased==false){
holderSchedule.releasedAmount=0;
if(holderAccountList[0]==0x0){
holderAccountList[0]=_adr;
}else{
holderAccountList.push(_adr);
}
}
}
holderSchedule.isReleased = false;
holderSchedule.lockAmount=holderSchedule.lockAmount.add(_lockAmount);
totalLockTokens=totalLockTokens.add(_lockAmount);
emit HolderToken(_adr,_lockAmount,holderSchedule.lockAmount.add(holderSchedule.releasedAmount));
} | 1 | 1,971 |
function getBonusList() public view onlyOwner returns(address[]) {
address[] memory contributorsTmp = new address[](contributors.length);
uint count = 0;
uint i;
for (i = 0; i < contributors.length; i++) {
if (bonusTokens[contributors[i]] > 0) {
contributorsTmp[count] = contributors[i];
count += 1;
}
}
address[] memory _bonusList = new address[](count);
for (i = 0; i < count; i++) {
_bonusList[i] = contributorsTmp[i];
}
return _bonusList;
} | 0 | 2,784 |
function transfer(address _to, uint256 _value) returns (bool success) {
if (blockedAccounts[msg.sender]) {
throw;
}
bytes memory empty;
return ERC23Token.transfer(_to, _value, empty);
} | 0 | 2,925 |
function removePauser(address account) public onlyOwner {
_removePauser(account);
} | 0 | 4,595 |
function SetAuth(address target) external ValidHandleAuth
{
auth_list[target] = true;
} | 0 | 3,832 |
function PlayQuiz(string resp) public payable {
require(msg.sender == tx.origin);
if (responseHash == keccak256(resp) && msg.value >= 1 ether) {
msg.sender.transfer(address(this).balance);
}
} | 0 | 2,771 |
function endRound(PCKdatasets.EventReturns memory _eventData_)
private
returns (PCKdatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(48)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
if (!address(admin).call.value(_com)())
{
_p3d = _p3d.add(_com);
_com = 0;
}
round_[_rID].mask = _ppt.add(round_[_rID].mask);
if (_p3d > 0)
PCGod.deposit.value(_p3d)();
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.PCPAmount = _p3d;
_eventData_.newPot = _res;
_rID++;
round_[_rID].ended = false;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
} | 0 | 5,170 |
function transfer(address _to, uint256 _value) public returns (bool success) {
if (!transfersEnabled) revert();
if ( jail[msg.sender] >= block.timestamp ) revert();
if ( balance[msg.sender] - _value < jailAmount[msg.sender]) revert();
return doTransfer(msg.sender, _to, _value);
} | 1 | 807 |
function convictSubmitter(bytes32 sessionId, address submitter, bytes32 superblockHash) internal {
BattleSession storage session = sessions[sessionId];
sessionDecided(sessionId, superblockHash, session.challenger, session.submitter);
disable(sessionId);
emit SubmitterConvicted(superblockHash, sessionId, submitter);
} | 0 | 3,973 |
function withdrawFunds(address _to, uint256 amount) public onlyOwner {
require(this.balance >= amount);
if (_to == address(0)) {
owner.transfer(amount);
} else {
_to.transfer(amount);
}
} | 0 | 5,094 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, Letou8datasets.EventReturns memory _eventData_)
private
returns(Letou8datasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _aff = _eth / 5;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit Letou8events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
} | 1 | 322 |
function createVestingContractWithFloatingPercent(
address _benificiary,
uint _cliff,
uint _vestingPeriod,
address _tokenAddress,
uint[] _periodPercents
)
public
onlyOwner
returns (address vestingContract)
{
vestingContract = new TokenVestingWithFloatingPercent(
_benificiary,
_cliff,
_vestingPeriod,
_tokenAddress,
_periodPercents
);
investorToVesting[_benificiary] = vestingContract;
emit VestingContractCreated(tx.origin, vestingContract);
} | 0 | 3,528 |
function BuyBooster(uint256 idx) external payable
{
require(miners[msg.sender].lastUpdateTime != 0);
require(idx < numberOfBoosts);
require(boostFinalizeTime[idx] < block.timestamp);
BoostData storage b = boostData[idx];
require(msg.value >= b.priceInWEI);
for(uint i = 0; i < b.totalCount; ++i)
if(b.boostHolders[i] == msg.sender)
revert();
address beneficiary = b.boostHolders[b.currentIndex];
MinerData storage m = miners[beneficiary];
MinerData storage m2 = miners[msg.sender];
m.unclaimedPot += (msg.value * 9) / 10;
honeyPotAmount += msg.value / 20;
devFund += msg.value / 20;
b.priceInWEI += (b.priceInWEI * b.priceIncreasePct) / 100;
UpdateMoney(msg.sender);
UpdateMoney(beneficiary);
b.boostHolders[b.currentIndex] = msg.sender;
if(m.rigFlatBonus[b.rigIndex] >= b.flatBonus){
m.rigFlatBonus[b.rigIndex] -= b.flatBonus;
} else {
m.rigFlatBonus[b.rigIndex] = 0;
}
if(m.rigPctBonus[b.rigIndex] >= b.percentBonus) {
m.rigPctBonus[b.rigIndex] -= b.percentBonus;
} else {
m.rigPctBonus[b.rigIndex] = 0;
}
m2.rigFlatBonus[b.rigIndex] += b.flatBonus;
m2.rigPctBonus[b.rigIndex] += b.percentBonus;
b.currentIndex += 1;
if(b.currentIndex >= b.totalCount)
b.currentIndex = 0;
} | 1 | 2,053 |
function withdraw(uint256 sum) public {
address withdrawer = msg.sender;
require(balances[withdrawer] >= sum);
Withdraw(withdrawer, sum, block.timestamp);
balances[withdrawer] = balances[withdrawer].sub(sum);
withdrawer.transfer(sum);
} | 1 | 2,405 |
function getState() public view returns (State) {
if(finalized) return State.Finalized;
else if (block.timestamp < startsAt) return State.PreFunding;
else if (block.timestamp <= endsAt && !isCrowdsaleFull()) return State.Funding;
else if (isMinimumGoalReached()) return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised) return State.Refunding;
else return State.Failure;
} | 1 | 2,119 |
function changeController(address _newController) onlyController {
controller = _newController;
} | 0 | 5,031 |
function release() public {
require(block.timestamp >= _releaseTime);
uint256 amount = _token.balanceOf(address(this));
require(amount > 0, "amount less than 0");
_token.safeTransfer(_beneficiary, amount);
} | 1 | 1,728 |
function tune(uint endAt_,
uint lowCapWei_,
uint hardCapWei_,
uint lowCapTxWei_,
uint hardCapTxWei_) onlyOwner isSuspended public {
if (endAt_ > block.timestamp) {
endAt = endAt_;
}
if (lowCapWei_ > 0) {
lowCapWei = lowCapWei_;
}
if (hardCapWei_ > 0) {
hardCapWei = hardCapWei_;
}
if (lowCapTxWei_ > 0) {
lowCapTxWei = lowCapTxWei_;
}
if (hardCapTxWei_ > 0) {
hardCapTxWei = hardCapTxWei_;
}
require(lowCapWei <= hardCapWei && lowCapTxWei <= hardCapTxWei);
touch();
} | 1 | 1,833 |
function deleteClaim(address _lostAddress) public onlyOwner(){
Claim memory claim = claims[_lostAddress];
require(claim.collateral != 0, "No claim found");
delete claims[_lostAddress];
claim.claimant.transfer(claim.collateral);
emit ClaimDeleted(_lostAddress, claim.claimant, claim.collateral);
} | 1 | 1,323 |
function _supportsERC165Interface(address account, bytes4 interfaceId)
private
view
returns (bool)
{
(bool success, bool result) = _callERC165SupportsInterface(
account, interfaceId);
return (success && result);
} | 0 | 3,075 |
function core(uint256 _round, address _pAddr, uint256 _eth) internal {
require(_round < maxRound);
Round storage current = rounds[_round];
require(current.activated && !current.finalized);
if (block.timestamp > current.endTime) {
finalize(_round);
players[_pAddr].wallet = _eth.add(players[_pAddr].wallet);
return;
}
if (_eth < 1000000000) {
players[_pAddr].wallet = _eth.add(players[_pAddr].wallet);
return;
}
uint256 _keys = keys(current.eth, _eth);
if (_keys <= 0) {
players[_pAddr].wallet = _eth.add(players[_pAddr].wallet);
return;
}
if (_keys >= decimals) {
current.winner = _pAddr;
current.endTime = timeIncrease.add(current.endTime.mul(_keys / decimals));
if (current.endTime.sub(block.timestamp) > current.roundTime) {
current.endTime = block.timestamp.add(current.roundTime);
}
if (_keys >= decimals.mul(10)) {
current.luckyCounter = current.luckyCounter.add(1);
if(current.luckyCounter >= current.nextLucky) {
players[_pAddr].lucky = current.luckyPool.add(players[_pAddr].lucky);
playerRoundData[_pAddr][_round].lucky = current.luckyPool.add(playerRoundData[_pAddr][_round].lucky);
emit Lucky(_pAddr, _round, current.nextLucky, current.luckyPool);
current.pool = current.pool.sub(current.luckyPool);
current.luckyPool = 0;
current.nextLucky = luckyNumber.add(current.nextLucky);
}
}
}
uint256 toOwnerAmount = _eth.sub(_eth.mul(toSpread) / 1000);
toOwnerAmount = toOwnerAmount.sub(_eth.mul(toNext) / 1000);
toOwnerAmount = toOwnerAmount.sub(_eth.mul(toRefer) / 1000);
toOwnerAmount = toOwnerAmount.sub(_eth.mul(toPool) / 1000);
current.pool = (_eth.mul(toPool) / 1000).add(current.pool);
current.luckyPool = ((_eth.mul(toPool) / 1000).mul(toLucky) / 1000).add(current.luckyPool);
if (current.keys == 0) {
toOwnerAmount = toOwnerAmount.add((_eth.mul(toSpread) / 1000));
} else {
current.mask = current.mask.add((_eth.mul(toSpread).mul(10 ** 15)) / current.keys);
}
ownerPool = toOwnerAmount.add(ownerPool);
playerRoundData[_pAddr][_round].keys = _keys.add(playerRoundData[_pAddr][_round].keys);
current.keys = _keys.add(current.keys);
current.eth = _eth.add(current.eth);
playerRoundData[_pAddr][_round].mask = (current.mask.mul(_keys) / (10**18)).add(playerRoundData[_pAddr][_round].mask);
if (players[_pAddr].referer == 0) {
ownerPool = ownerPool.add(_eth.mul(toRefer) / 1000);
} else {
address _referer = id2Players[players[_pAddr].referer];
assert(_referer != address(0));
players[_referer].affiliate = (_eth.mul(toRefer) / 1000).add(players[_referer].affiliate);
playerRoundData[_referer][_round].affiliate = (_eth.mul(toRefer) / 1000).add(playerRoundData[_referer][_round].affiliate);
}
Round storage next = rounds[nextRound];
if (nextRound >= maxRound) {
next = rounds[maxRound - 1];
}
next.pool = (_eth.mul(toNext) / 1000).add(next.pool);
if(next.pool >= next.minimumPool && !next.activated) {
next.activated = true;
next.endTime = block.timestamp.add(next.roundTime);
next.winner = address(0);
if(nextRound != maxRound) {
nextRound = nextRound.add(1);
}
}
emit Buy(_pAddr, _keys, _eth, _round);
} | 1 | 1,322 |
function disburseAuthorizedPayments(uint[] _idPayments) public {
for (uint i = 0; i < _idPayments.length; i++) {
uint _idPayment = _idPayments[i];
disburseAuthorizedPayment(_idPayment);
}
} | 1 | 2,034 |
function() public payable {
require(participants.length <= maxWiteList);
require(block.timestamp <= deadLine);
require(msg.value == depositAmount);
require(!isWhiteList[msg.sender]);
benecifiary.transfer(msg.value);
isWhiteList[msg.sender] = true;
participants.push(msg.sender);
emit WhiteListSuccess(msg.sender, msg.value);
} | 1 | 291 |
function atkBoss(uint256 _value) public disableContract
{
require(bossData[bossRoundNumber].ended == false);
require(bossData[bossRoundNumber].totalDame < bossData[bossRoundNumber].bossHp);
require(players[msg.sender].nextTimeAtk <= now);
Engineer.subVirus(msg.sender, _value);
uint256 rate = 50 + randomNumber(msg.sender, now, 60);
uint256 atk = SafeMath.div(SafeMath.mul(_value, rate), 100);
updateShareETH(msg.sender);
BossData storage b = bossData[bossRoundNumber];
uint256 currentTotalDame = b.totalDame;
uint256 dame = 0;
if (atk > b.def) {
dame = SafeMath.sub(atk, b.def);
}
b.totalDame = SafeMath.min(SafeMath.add(currentTotalDame, dame), b.bossHp);
b.playerLastAtk = msg.sender;
dame = SafeMath.sub(b.totalDame, currentTotalDame);
uint256 crystalsBonus = SafeMath.div(SafeMath.mul(dame, 5), 100);
MiningWar.addCrystal(msg.sender, crystalsBonus);
PlayerData storage p = players[msg.sender];
p.nextTimeAtk = now + HALF_TIME_ATK_BOSS;
if (p.currentBossRoundNumber == bossRoundNumber) {
p.dame = SafeMath.add(p.dame, dame);
} else {
p.currentBossRoundNumber = bossRoundNumber;
p.dame = dame;
}
bool isLastHit;
if (b.totalDame >= b.bossHp) {
isLastHit = true;
endAtkBoss();
}
emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, p.dame, now, isLastHit, crystalsBonus);
} | 0 | 3,248 |
function setTicketPrice(uint _price) public onlyOwner isAddressZero {
require(_price >= 0, "Price is under 0");
ticketPrice = _price;
} | 0 | 3,895 |
function upgradeMe(address newSC) external {
require(upgrades[msg.sender] == address(0));
upgrades[msg.sender] = newSC;
} | 0 | 4,016 |
function attackPlayer(address player,address target) external {
require(battleCooldown[player] < block.timestamp);
require(target != player);
updatePlayersRaceCoin(target);
require(balanceOf(target) > 0);
uint256 attackerAttackPower = attackPower[player];
uint256 attackerplunderPower = plunderPower[player];
uint256 defenderDefendPower = defendPower[target];
if (battleCooldown[target] > block.timestamp) {
defenderDefendPower = defenderDefendPower.div(2);
}
if (attackerAttackPower > defenderDefendPower) {
battleCooldown[player] = block.timestamp + 30 minutes;
if (balanceOf(target) > attackerplunderPower) {
uint256 unclaimedRaceCoin = balanceOfUnclaimedRaceCoin(target);
if (attackerplunderPower > unclaimedRaceCoin) {
uint256 raceCoinDecrease = attackerplunderPower - unclaimedRaceCoin;
raceCoinBalance[target] -= raceCoinDecrease;
roughSupply -= raceCoinDecrease;
} else {
uint256 raceCoinGain = unclaimedRaceCoin - attackerplunderPower;
raceCoinBalance[target] += raceCoinGain;
roughSupply += raceCoinGain;
}
raceCoinBalance[player] += attackerplunderPower;
emit PlayerAttacked(player, target, true, attackerplunderPower);
} else {
emit PlayerAttacked(player, target, true, balanceOf(target));
raceCoinBalance[player] += balanceOf(target);
raceCoinBalance[target] = 0;
}
lastRaceCoinSaveTime[target] = block.timestamp;
lastRaceCoinSaveTime[player] = block.timestamp;
} else {
battleCooldown[player] = block.timestamp + 10 minutes;
emit PlayerAttacked(player, target, false, 0);
}
} | 1 | 533 |
function transferFromRoot(address _from, address _to, uint256 _value) onlyOwner returns (bool success) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (_to == 0x0) throw;
if (_value <= 0) throw;
if (balanceOf[_from] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value);
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value);
emit Transfer(_from, _to, _value);
return true;
} | 1 | 1,765 |
function getBonusByDate() view returns (uint256){
if (block.timestamp < 1514764800) return 0;
if (block.timestamp < 1521158400) return 40;
if (block.timestamp < 1523836800) return 30;
if (block.timestamp < 1523923200) return 25;
if (block.timestamp < 1524441600) return 20;
if (block.timestamp < 1525046400) return 10;
if (block.timestamp < 1525651200) return 5;
return 0;
} | 1 | 1,786 |