func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function validUser(string checkVal) returns(bool valid) {
uint256 i=0;
for(i; i<getGivenCount(); i++){
if (keccak256(giveAccounts[owner].given[i]) == keccak256(checkVal)) return false;
}
return true;
}
| 0 | 19,059 |
function GOSPELCOINS () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
allowedAddresses[owner] = true;
}
| 0 | 15,668 |
function setPresaleAddress(address _presale) public onlyOwner {
presale = _presale;
}
| 0 | 13,725 |
function doTransfer(uint64 from, uint64 to, uint _amount) internal {
uint amount = callPlugins(true, from, to, _amount);
if (from == to) {
return;
}
if (amount == 0) {
return;
}
Pledge storage nFrom = findPledge(from);
Pledge storage nTo = findPledge(to);
require(nFrom.amount >= amount);
nFrom.amount -= amount;
nTo.amount += amount;
Transfer(from, to, amount);
callPlugins(false, from, to, amount);
}
| 0 | 10,606 |
function updateFromRegistry() onlyOwner public {
moduleRegistry = PolymathRegistry(polymathRegistry).getAddress("ModuleRegistry");
securityTokenRegistry = PolymathRegistry(polymathRegistry).getAddress("SecurityTokenRegistry");
tickerRegistry = PolymathRegistry(polymathRegistry).getAddress("TickerRegistry");
polyToken = PolymathRegistry(polymathRegistry).getAddress("PolyToken");
}
| 1 | 3,554 |
function canSort()
{
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
balance += amount - amount/10;
while (balance > persons[payoutIdx].amount / 100 * 111)
{
uint transactionAmount = persons[payoutIdx].amount / 100 * 111;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
}
| 0 | 12,883 |
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
require(newMaxProfitAsPercent <= 50000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
| 0 | 12,690 |
function getCatsCount() public view returns (uint) {
return catsRegister.length;
}
| 0 | 15,467 |
function setupRace(uint delay, uint locking_duration) onlyOwner beforeBetting public payable returns(bool) {
if (oraclize_getPrice("URL")*3 + oraclize_getPrice("URL", horses.customGasLimit)*3 > address(this).balance) {
emit newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
return false;
} else {
chronus.starting_time = uint32(block.timestamp);
chronus.betting_open = true;
bytes32 temp_ID;
emit newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
chronus.betting_duration = uint32(delay);
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.ETH;
coinIndex[horses.ETH].preOraclizeId = temp_ID;
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.LTC;
coinIndex[horses.LTC].preOraclizeId = temp_ID;
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.BTC;
coinIndex[horses.BTC].preOraclizeId = temp_ID;
delay = delay.add(locking_duration);
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.ETH;
coinIndex[horses.ETH].postOraclizeId = temp_ID;
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.LTC;
coinIndex[horses.LTC].postOraclizeId = temp_ID;
temp_ID = oraclize_query(delay, "URL", "json(https:
oraclizeIndex[temp_ID] = horses.BTC;
coinIndex[horses.BTC].postOraclizeId = temp_ID;
chronus.race_duration = uint32(delay);
return true;
}
}
function reward() internal {
horses.BTC_delta = int64(coinIndex[horses.BTC].post - coinIndex[horses.BTC].pre)*100000/int64(coinIndex[horses.BTC].pre);
horses.ETH_delta = int64(coinIndex[horses.ETH].post - coinIndex[horses.ETH].pre)*100000/int64(coinIndex[horses.ETH].pre);
horses.LTC_delta = int64(coinIndex[horses.LTC].post - coinIndex[horses.LTC].pre)*100000/int64(coinIndex[horses.LTC].pre);
total_reward = (coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total);
if (total_bettors <= 1) {
forceVoidRace();
} else {
uint house_fee = total_reward.mul(5).div(100);
require(house_fee < address(this).balance);
total_reward = total_reward.sub(house_fee);
bettingControllerInstance.depositHouseTakeout.value(house_fee)();
}
if (horses.BTC_delta > horses.ETH_delta) {
if (horses.BTC_delta > horses.LTC_delta) {
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.BTC].total;
}
else if(horses.LTC_delta > horses.BTC_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else {
winner_horse[horses.BTC] = true;
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.BTC].total + (coinIndex[horses.LTC].total);
}
} else if(horses.ETH_delta > horses.BTC_delta) {
if (horses.ETH_delta > horses.LTC_delta) {
winner_horse[horses.ETH] = true;
winnerPoolTotal = coinIndex[horses.ETH].total;
}
else if (horses.LTC_delta > horses.ETH_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else {
winner_horse[horses.ETH] = true;
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.LTC].total);
}
} else {
if (horses.LTC_delta > horses.ETH_delta) {
winner_horse[horses.LTC] = true;
winnerPoolTotal = coinIndex[horses.LTC].total;
} else if(horses.LTC_delta < horses.ETH_delta){
winner_horse[horses.ETH] = true;
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total);
} else {
winner_horse[horses.LTC] = true;
winner_horse[horses.ETH] = true;
winner_horse[horses.BTC] = true;
winnerPoolTotal = coinIndex[horses.ETH].total + (coinIndex[horses.BTC].total) + (coinIndex[horses.LTC].total);
}
}
chronus.race_end = true;
}
function calculateReward(address candidate) internal afterRace constant returns(uint winner_reward) {
voter_info storage bettor = voterIndex[candidate];
if(chronus.voided_bet) {
winner_reward = bettor.total_bet;
} else {
uint winning_bet_total;
if(winner_horse[horses.BTC]) {
winning_bet_total += bettor.bets[horses.BTC];
} if(winner_horse[horses.ETH]) {
winning_bet_total += bettor.bets[horses.ETH];
} if(winner_horse[horses.LTC]) {
winning_bet_total += bettor.bets[horses.LTC];
}
winner_reward += (((total_reward.mul(10000000)).div(winnerPoolTotal)).mul(winning_bet_total)).div(10000000);
}
}
function checkReward() afterRace external constant returns (uint) {
require(!voterIndex[msg.sender].rewarded);
return calculateReward(msg.sender);
}
function claim_reward() afterRace external {
require(!voterIndex[msg.sender].rewarded);
uint transfer_amount = calculateReward(msg.sender);
require(address(this).balance >= transfer_amount);
voterIndex[msg.sender].rewarded = true;
msg.sender.transfer(transfer_amount);
emit Withdraw(msg.sender, transfer_amount);
}
function forceVoidRace() internal {
chronus.voided_bet=true;
chronus.race_end = true;
chronus.voided_timestamp=uint32(now);
}
function stringToUintNormalize(string s) internal pure returns (uint result) {
uint p =2;
bool precision=false;
bytes memory b = bytes(s);
uint i;
result = 0;
for (i = 0; i < b.length; i++) {
if (precision) {p = p-1;}
if (uint(b[i]) == 46){precision = true;}
uint c = uint(b[i]);
if (c >= 48 && c <= 57) {result = result * 10 + (c - 48);}
if (precision && p == 0){return result;}
}
while (p!=0) {
result = result*10;
p=p-1;
}
}
function getCoinIndex(bytes32 index, address candidate) external constant returns (uint, uint, uint, bool, uint) {
return (coinIndex[index].total, coinIndex[index].pre, coinIndex[index].post, coinIndex[index].price_check, voterIndex[candidate].bets[index]);
}
function reward_total() external constant returns (uint) {
return ((coinIndex[horses.BTC].total) + (coinIndex[horses.ETH].total) + (coinIndex[horses.LTC].total));
}
function refund() external onlyOwner {
require(now > chronus.starting_time + chronus.race_duration);
require((chronus.betting_open && !chronus.race_start)
|| (chronus.race_start && !chronus.race_end));
chronus.voided_bet = true;
chronus.race_end = true;
chronus.voided_timestamp=uint32(now);
bettingControllerInstance.remoteBettingClose();
}
function recovery() external onlyOwner{
require((chronus.race_end && now > chronus.starting_time + chronus.race_duration + (30 days))
|| (chronus.voided_bet && now > chronus.voided_timestamp + (30 days)));
bettingControllerInstance.depositHouseTakeout.value(address(this).balance)();
}
}
| 1 | 2,195 |
function transfer(address _to, uint _value, bytes _data) public {
require(balances[msg.sender] >= _value);
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
require(codeLength == 0);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
}
| 0 | 13,237 |
function transferToLimited(address _from, address _to, uint _amount, uint8 _limitType) internal {
require((_limitType >= limitTeamType) && (_limitType <= limitBranchType));
require((limited_balances[_to].limitType == 0) || (limited_balances[_to].limitType == _limitType));
doTransfer(_from, _to, _amount);
uint previousLimitedBalanceInitial = limited_balances[_to].initial;
require(previousLimitedBalanceInitial + _amount >= previousLimitedBalanceInitial);
limited_balances[_to].initial = previousLimitedBalanceInitial + _amount;
limited_balances[_to].limitType = _limitType;
}
| 1 | 2,600 |
modifier onlyCard {
require(msg.sender == cardAddess);
_;
}
| 1 | 6,163 |
function stopTge(bool _restart) external onlyOwner {
tgeActive = false;
if(_restart) tgeStartTime = 0;
}
| 0 | 19,198 |
function __callback(bytes32 betId, string result, bytes proof) public
onlyOraclize
onlyIfBetExist(betId)
onlyIfNotProcessed(betId)
{
bets[betId].numberRolled = parseInt(result);
Bet thisBet = bets[betId];
require(thisBet.numberRolled >= 1 && thisBet.numberRolled <= 100);
if (betWon(thisBet)) {
LOG_BetWon(thisBet.playerAddress, thisBet.numberRolled, thisBet.amountBet);
thisBet.playerAddress.send(thisBet.amountBet.mul(2));
} else {
LOG_BetLost(thisBet.playerAddress, thisBet.numberRolled, thisBet.amountBet);
thisBet.playerAddress.send(1);
}
}
| 1 | 1,518 |
function approve( address toAddress, uint256 tokenId) external isNotPaused {
require(toAddress != address(0));
require(_userOwnsToken(msg.sender, tokenId));
_approve(tokenId, toAddress);
LogApproval(msg.sender, toAddress, tokenId);
}
| 0 | 12,956 |
function TokenTranchePricing(uint[] init_tranches) public {
require(init_tranches.length % tranche_size == 0);
require(init_tranches[amount_offset] > 0);
tranches.length = init_tranches.length.div(tranche_size);
Tranche memory last_tranche;
for (uint i = 0; i < tranches.length; i++) {
uint tranche_offset = i.mul(tranche_size);
uint amount = init_tranches[tranche_offset.add(amount_offset)];
uint start = init_tranches[tranche_offset.add(start_offset)];
uint end = init_tranches[tranche_offset.add(end_offset)];
uint price = init_tranches[tranche_offset.add(price_offset)];
require(block.timestamp < start && start < end);
require(i == 0 || (end >= last_tranche.end && amount > last_tranche.amount) ||
(end > last_tranche.end && amount >= last_tranche.amount));
last_tranche = Tranche(amount, start, end, price);
tranches[i] = last_tranche;
}
}
| 0 | 12,506 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, RP1datasets.EventReturns memory _eventData_)
private
returns(RP1datasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _rp1;
community_addr.transfer(_com);
uint256 _long = _eth / 100;
marketing_addr.transfer(_long);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit RP1events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_rp1 = _aff;
}
_rp1 = _rp1.add((_eth.mul(fees_[_team].rp1)) / (100));
if (_rp1 > 0)
{
community_addr.transfer(_rp1);
_eventData_.rp1Amount = _rp1.add(_eventData_.rp1Amount);
}
return(_eventData_);
}
| 0 | 11,558 |
function transfer(address _to, uint _value) validDestination(_to) returns (bool) {
require(transferEnabled == true);
if(lockStartTime[msg.sender] > 0) {
return super.lockTransfer(_to,_value);
}else {
return super.transfer(_to, _value);
}
}
| 0 | 15,798 |
function hasValidTicketCore(
address _user,
uint256 _timeLeft
)
view
internal
returns
(bool)
{
if (_timeLeft == 0) return false;
bool _hasTicket = ticketRecord_[_user].hasTicket;
uint256 _expirationTime = ticketRecord_[_user].expirationTime;
return (_hasTicket && now <= _expirationTime);
}
| 0 | 14,250 |
function UniversalCryptoToken()
public
{
administrators[msg.sender] = true;
dev = msg.sender;
}
| 0 | 16,365 |
function depositToken(address token, uint amount) public {
require(token != 0);
depositingTokenFlag = true;
require(IERC20(token).transferFrom(msg.sender, this, amount));
depositingTokenFlag = false;
tokens[token][msg.sender] = tokens[token][msg.sender].add(amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
| 1 | 4,117 |
function adTransferA(address source, address[] recipents, uint256 amount,uint decimals) public {
samount=amount;
token=Token(source);
for(i=0;i<recipents.length;i++) {
token.transfer(recipents[i],amount*(10**decimals));
emit TransferToken(recipents[i], samount);
}
}
| 1 | 6,309 |
function setupAssetProxy(AssetProxy _assetProxy) onlyRole("__root__") returns(bool) {
if ((address(assetProxy) != 0x0) || (address(_assetProxy) == 0x0)) {
return false;
}
assetProxy = _assetProxy;
return true;
}
| 0 | 10,825 |
function() public payable whenNotPaused {
if(whitelist[msg.sender] | notInWhitelistAllow > 0)
{
uint8 _times_length = uint8(times.length);
uint8 _times = _times_length + 1;
for (uint32 i = 0; i < _times_length; i++)
{
if (timesEnabled[i])
{
if (times[i] * basePrice == msg.value) {
_times = uint8(i);
break;
}
}
}
if (_times > _times_length) {
revert();
}
else
{
if (participatedCounter[msg.sender][_times] < currentCounter[_times])
{
participatedCounter[msg.sender][_times] = currentCounter[_times];
if (airDrop)
{
uint256 _value = baseTokenGetRate * 10 ** 18 * times[_times];
uint256 _plus_value = uint256(keccak256(now, msg.sender)) % _value;
luckyYouToken.airDrop(msg.sender, _value + _plus_value);
}
uint256 senderBalance = luckyYouToken.balanceOf(msg.sender);
if (lastFiredStep[_times] > 0)
{
issueLottery(_times);
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
senderBalance = senderBalance.mul(2);
} else
{
fundShareParticipantsTotalTokensCurrentRound[_times] += senderBalance;
}
if (participantsCount[_times] == participants[_times].length)
{
participants[_times].length += 1;
}
participants[_times][participantsCount[_times]++] = msg.sender;
participantsHashes[_times] = keccak256(msg.sender, uint256(commonHash));
commonHash = keccak256(senderBalance,commonHash);
fundCurrentRound[_times] += times[_times] * basePrice;
if (fundShareRemainLastRound[_times] > 0)
{
uint256 _shareFund = fundShareLastRound[_times].mul(senderBalance).div(fundShareParticipantsTotalTokensLastRound[_times]);
if(_shareFund > 0)
{
if (_shareFund <= fundShareRemainLastRound[_times]) {
fundShareRemainLastRound[_times] -= _shareFund;
msg.sender.transfer(_shareFund);
} else {
uint256 _fundShareRemain = fundShareRemainLastRound[_times];
fundShareRemainLastRound[_times] = 0;
msg.sender.transfer(_fundShareRemain);
}
}
}
if (participantsCount[_times] > minParticipants)
{
if (uint256(keccak256(now, msg.sender, commonHash)) % (minParticipants * minParticipants) < minParticipants)
{
fireLottery(_times);
}
}
} else
{
revert();
}
}
}else{
revert();
}
}
| 1 | 5,755 |
function unlockFor(address _owner) public {
require(unlockStart > 0);
require(now >= (unlockStart.add(shares[_owner].periodLength)));
uint256 share = shares[_owner].proportion;
uint256 periodsSinceUnlockStart = (now.sub(unlockStart)).div(shares[_owner].periodLength);
if (periodsSinceUnlockStart < shares[_owner].periods) {
share = share.div(shares[_owner].periods).mul(periodsSinceUnlockStart);
}
share = share.sub(unlocked[_owner]);
if (share > 0) {
uint256 unlockedToken = token.balanceOf(this).mul(share).div(totalShare);
totalShare = totalShare.sub(share);
unlocked[_owner] += share;
token.transfer(_owner,unlockedToken);
}
}
| 1 | 5,633 |
function deposit(address beneficiary, uint amount, uint releaseTime) public returns(bool success) {
require(token.transferFrom(msg.sender, address(this), amount));
LockBoxStruct memory l;
l.beneficiary = beneficiary;
l.balance = amount;
l.releaseTime = releaseTime;
lockBoxStructs.push(l);
emit LogLockBoxDeposit(msg.sender, amount, releaseTime);
return true;
}
| 1 | 8,399 |
function donationAddress() public view returns(address) {
return donationAddress_;
}
| 0 | 18,199 |
function purchaseTokens(uint256 incomingEthereum, address referredyBy)
internal
returns(uint256)
{
require (msg.sender == tx.origin);
uint256 undividedDivs = SafeMath.div(SafeMath.mul(incomingEthereum, dividendFee ), 100);
uint256 lotteryAndWhaleFee = undividedDivs / 3;
uint256 referralBonus = lotteryAndWhaleFee;
uint256 dividends = SafeMath.sub(undividedDivs, (referralBonus + lotteryAndWhaleFee));
uint256 taxedEthereum = incomingEthereum - undividedDivs;
uint256 amountOfTokens = ethereumToTokens_(taxedEthereum);
uint256 whaleFee = lotteryAndWhaleFee / 2;
whaleLedger[owner] += whaleFee;
lotterySupply += ethereumToTokens_(lotteryAndWhaleFee - whaleFee);
lotteryPlayers.push(msg.sender);
uint256 fee = dividends * magnitude;
require(amountOfTokens > 0 && (amountOfTokens + tokenSupply) > tokenSupply);
if(
referredyBy != 0x0000000000000000000000000000000000000000 &&
referredyBy != msg.sender &&
gameList[referredyBy] == false &&
publicTokenLedger[referredyBy] >= referralLinkRequirement
)
{
referralBalances[referredyBy] += referralBonus;
} else
{
dividends += referralBonus;
fee = dividends * magnitude;
}
uint256 payoutDividends = isWhalePaying();
if(tokenSupply > 0)
{
tokenSupply += amountOfTokens;
profitPerShare_ += ((payoutDividends + dividends) * magnitude / (tokenSupply));
fee -= fee-(amountOfTokens * (dividends * magnitude / (tokenSupply)));
} else
{
tokenSupply = amountOfTokens;
if(whaleLedger[owner] == 0)
{
whaleLedger[owner] = payoutDividends;
}
}
publicTokenLedger[msg.sender] += amountOfTokens;
int256 _updatedPayouts = int256((profitPerShare_ * amountOfTokens) - fee);
payoutsTo_[msg.sender] += _updatedPayouts;
emit onTokenPurchase(msg.sender, incomingEthereum, amountOfTokens, referredyBy);
return amountOfTokens;
}
| 0 | 15,704 |
function systemWithdraw(address _user, uint64 _amount) external onlyServer {
uint32 userId = userIds[_user];
require(balances[userId] - blockedBalances[userId] >= _amount);
if (gameToken.transfer(_user, _amount)) {
balances[userId] -= _amount;
emit Withdraw(_user, _amount);
}
}
| 1 | 6,241 |
function setManagementProxy(uint32 _point, address _manager)
external
activePointOwner(_point)
{
azimuth.setManagementProxy(_point, _manager);
}
| 0 | 13,065 |
function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 rootOwner) {
address rootOwnerAddress = tokenIdToTokenOwner[_tokenId].tokenOwner;
require(rootOwnerAddress != address(0));
uint256 parentTokenId = tokenIdToTokenOwner[_tokenId].parentTokenId;
bool isParent = parentTokenId > 0;
if (isParent) {
parentTokenId--;
}
if((rootOwnerAddress == address(this))) {
do {
if(isParent == false) {
return ERC998_MAGIC_VALUE << 224 | bytes32(rootOwnerAddress);
}
else {
(rootOwnerAddress, parentTokenId, isParent) = _tokenOwnerOf(parentTokenId);
}
} while(rootOwnerAddress == address(this));
_tokenId = parentTokenId;
}
bytes memory calldata;
bool callSuccess;
if (isParent == false) {
calldata = abi.encodeWithSelector(0xed81cdda, address(this), _tokenId);
assembly {
callSuccess := staticcall(gas, rootOwnerAddress, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
rootOwner := mload(calldata)
}
}
if(callSuccess == true && rootOwner >> 224 == ERC998_MAGIC_VALUE) {
return rootOwner;
}
else {
return ERC998_MAGIC_VALUE << 224 | bytes32(rootOwnerAddress);
}
}
else {
calldata = abi.encodeWithSelector(0x43a61a8e, parentTokenId);
assembly {
callSuccess := staticcall(gas, rootOwnerAddress, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
rootOwner := mload(calldata)
}
}
if (callSuccess == true && rootOwner >> 224 == ERC998_MAGIC_VALUE) {
return rootOwner;
}
else {
address childContract = rootOwnerAddress;
calldata = abi.encodeWithSelector(0x6352211e, parentTokenId);
assembly {
callSuccess := staticcall(gas, rootOwnerAddress, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
rootOwnerAddress := mload(calldata)
}
}
require(callSuccess);
calldata = abi.encodeWithSelector(0xed81cdda, childContract, parentTokenId);
assembly {
callSuccess := staticcall(gas, rootOwnerAddress, add(calldata, 0x20), mload(calldata), calldata, 0x20)
if callSuccess {
rootOwner := mload(calldata)
}
}
if(callSuccess == true && rootOwner >> 224 == ERC998_MAGIC_VALUE) {
return rootOwner;
}
else {
return ERC998_MAGIC_VALUE << 224 | bytes32(rootOwnerAddress);
}
}
}
}
| 0 | 10,626 |
function joinChannel(bytes32 _lcID, uint256[2] _balances) public payable {
require(Channels[_lcID].isOpen == false);
require(msg.sender == Channels[_lcID].partyAddresses[1]);
if(_balances[0] != 0) {
require(msg.value == _balances[0], "state balance does not match sent value");
Channels[_lcID].ethBalances[1] = msg.value;
}
if(_balances[1] != 0) {
require(Channels[_lcID].token.transferFrom(msg.sender, this, _balances[1]),"joinChannel: token transfer failure");
Channels[_lcID].erc20Balances[1] = _balances[1];
}
Channels[_lcID].initialDeposit[0]+=_balances[0];
Channels[_lcID].initialDeposit[1]+=_balances[1];
Channels[_lcID].isOpen = true;
numChannels++;
emit DidLCJoin(_lcID, _balances[0], _balances[1]);
}
| 1 | 7,162 |
function UNTChain() public {
totalSupply = 2000000000 * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = "UNT Chain";
symbol = "UCH";
}
| 0 | 11,846 |
function Crowdsale(
address ifSuccessfulSendTo,
uint fundingGoalInEthers,
uint durationInMinutes,
uint etherCostOfEachToken,
address addressOfTokenUsedAsReward
) public {
beneficiary = ifSuccessfulSendTo;
fundingGoal = fundingGoalInEthers * 1 ether;
deadline = now + durationInMinutes * 1 minutes;
price = etherCostOfEachToken * 1 ether / 1000000000000;
tokenReward = token(addressOfTokenUsedAsReward);
}
| 0 | 11,467 |
function sendInternally(uint256 tokensToSend, uint256 valueToPresent) internal {
require(msg.sender != address(0));
uint balance = userXRTBalance(msg.sender);
require(balance == 0);
token.transfer(msg.sender, tokensToSend);
emit TransferredToken(msg.sender, valueToPresent);
}
| 0 | 16,948 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal isWhitelisted(_beneficiary) {
super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 0 | 16,721 |
function refund_and_die() public{
require(msg.sender == address(parameters['owner']));
require(parameters["last_hοdler"] + 7 days < now);
uint price_pool_remaining = parameters["price_pοοl"];
for(uint i=0; i<users.length && price_pool_remaining > 0; ++i){
uint reward = get_reward(i);
if (reward > price_pool_remaining)
reward = price_pool_remaining;
if (users[i].hodler.send(reward))
price_pool_remaining -= reward;
}
selfdestruct(msg.sender);
}
| 0 | 14,256 |
function transferFrom(address _from, address _to, uint256 _tokens_in_cents) public returns (bool success) {
require(_tokens_in_cents > 0);
require(_from != _to);
getVested(_from);
require(balances[_from] >= _tokens_in_cents);
require(vested[_from] >= _tokens_in_cents);
require(allowed[_from][msg.sender] >= _tokens_in_cents);
if(balanceOf(_to) == 0) {
investorCount++;
}
balances[_from] = balances[_from].sub(_tokens_in_cents);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_tokens_in_cents);
vested[_from] = vested[_from].sub(_tokens_in_cents);
balances[_to] = balances[_to].add(_tokens_in_cents);
if(balanceOf(_from) == 0) {
investorCount=investorCount-1;
}
Transfer(_from, _to, _tokens_in_cents);
return true;
}
| 0 | 12,712 |
function proposeAllocation(address _proposerAddress, address _dest, uint256 _tokensPerPeriod) public onlyOwner {
require(_tokensPerPeriod > 0);
require(_tokensPerPeriod <= remainingTokensPerPeriod);
require(allocationOf[_dest].proposerAddress == 0x0 || allocationOf[_dest].allocationState == Types.AllocationState.Rejected);
if (allocationOf[_dest].allocationState != Types.AllocationState.Rejected) {
allocationAddressList.push(_dest);
}
allocationOf[_dest] = Types.StructVestingAllocation({
tokensPerPeriod: _tokensPerPeriod,
allocationState: Types.AllocationState.Proposed,
proposerAddress: _proposerAddress,
claimedPeriods: 0
});
remainingTokensPerPeriod = remainingTokensPerPeriod - _tokensPerPeriod;
}
| 0 | 13,779 |
function pay() internal {
uint money = address(this).balance;
uint multiplier = 150;
for (uint i = 0; i < queue.length; i++){
uint idx = currentReceiverIndex + i;
Deposit storage dep = queue[idx];
uint totalPayout = dep.deposit * multiplier / 100;
uint leftPayout;
if (totalPayout > dep.payout) {
leftPayout = totalPayout - dep.payout;
}
if (money >= leftPayout) {
if (leftPayout > 0) {
dep.depositor.send(leftPayout);
money -= leftPayout;
}
depositNumber[dep.depositor] = 0;
delete queue[idx];
} else{
dep.depositor.send(money);
dep.payout += money;
break;
}
if (gasleft() <= 55000) {
break;
}
}
currentReceiverIndex += i;
}
| 0 | 11,737 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract AbeToken is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "Abe Token";
string public constant symbol = "ABE3";
uint public constant decimals = 8;
uint256 public totalSupply = 400000000e8;
uint256 public totalDistributed = 0;
uint256 public tokensPerEth = 15000e8;
uint256 public constant minContribution = 1 ether / 100;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
| 0 | 15,441 |
function transfer(
address _token,
address _from,
address _to,
uint _tokens,
address _staekholder,
uint _staek,
uint _expires,
uint _nonce,
bytes _signature
) external returns (bool success) {
bytes32 transferHash = keccak256(abi.encodePacked(
address(this),
_token,
_from,
_to,
_tokens,
_staekholder,
_staek,
_expires,
_nonce
));
bool requestHasAuthSig = _requestHasAuthSig(
_from,
transferHash,
_expires,
_signature
);
if (!requestHasAuthSig) {
revert('Oops! This relay request is NOT valid.');
}
if (_staekholder != 0x0 && _staek > 0) {
_addStaek(_from, _staekholder, _staek);
}
return _transfer(
_from, _to, _token, _tokens);
}
| 1 | 1,988 |
function bottomName() public view returns(uint name, uint index){
uint16 n = uint16(allNames.length);
uint j = 0;
name = allNames[0];
index = 0;
for (j = 1; j < n; j++) {
uint t = allNames[j];
if (t < name) {
name = t;
index = j;
}
}
}
| 0 | 12,968 |
function getPerson(uint256 _tokenId,bool generation) public view returns ( string name, string surname, uint64 genes,uint64 birthTime, uint32 readyToBreedWithId, uint32 trainedcount,uint32 beatencount,bool readyToBreedWithGen, bool gender) {
Person person;
if(generation==false) {
person = PersonsGen0[_tokenId];
}
else {
person = PersonsGen1[_tokenId];
}
name = person.name;
surname=person.surname;
genes=person.genes;
birthTime=person.birthTime;
readyToBreedWithId=person.readyToBreedWithId;
trainedcount=person.trainedcount;
beatencount=person.beatencount;
readyToBreedWithGen=person.readyToBreedWithGen;
gender=person.gender;
}
| 1 | 9,533 |
function _getLegendaryCardDetails(uint cardIndex, uint result) internal view returns (uint16 proto, uint16 purity) {
RandomnessComponents memory rc = getComponents(cardIndex, result);
ICards.Rarity rarity;
if (cardIndex == 4) {
rarity = _getLegendaryPlusRarity(rc.rarity);
} else if (cardIndex == 3) {
rarity = _getRarePlusRarity(rc.rarity);
} else {
rarity = _getCommonPlusRarity(rc.rarity);
}
purity = _getPurityBase(rc.quality) + rc.purity;
proto = cards.getRandomCard(rarity, rc.proto);
return (proto, purity);
}
| 0 | 13,723 |
function() payable stoppable note {
require(!isContract(msg.sender));
require(msg.value >= 0.01 ether);
require(tx.gasprice <= MAX_GAS_PRICE);
assert(time() >= startTime && time() < endTime);
var toFund = cast(msg.value);
var requested = wmul(toFund, PUBLIC_SALE_PRICE);
if( add(sold, requested) >= SELL_HARD_LIMIT) {
requested = SELL_HARD_LIMIT - sold;
toFund = wdiv(requested, PUBLIC_SALE_PRICE);
endTime = time();
}
var totalUserBuy = add(userBuys[msg.sender], toFund);
assert(canBuy(totalUserBuy));
userBuys[msg.sender] = totalUserBuy;
sold = hadd(sold, requested);
if( !moreThanSoftLimit && sold >= SELL_SOFT_LIMIT ) {
moreThanSoftLimit = true;
endTime = time() + 24 hours;
}
kkk.start();
kkk.transfer(msg.sender, requested);
kkk.stop();
exec(destFoundation, toFund);
uint toReturn = sub(msg.value, toFund);
if(toReturn > 0) {
exec(msg.sender, toReturn);
}
}
| 0 | 13,636 |
function buyTokens(address beneficiary) public payable nonZeroAddress(beneficiary) {
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokenPrice = fiat_contract.USD(0);
if(startTime.add(15 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(200).div(10 ** 8);
if(!compareStages(stage, "pre")){
stage = "pre";
}
} else if(startTime.add(45 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(300).div(10 ** 8);
if(!compareStages(stage, "main_first")){
stage = "main_first";
}
} else if(startTime.add(52 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(330).div(10 ** 8);
if(!compareStages(stage, "main_second")){
stage = "main_second";
}
} else if(startTime.add(59 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(360).div(10 ** 8);
if(!compareStages(stage, "main_third")){
stage = "main_third";
}
} else if(startTime.add(66 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(400).div(10 ** 8);
if(!compareStages(stage, "main_fourth")){
stage = "main_fourth";
}
} else {
tokenPrice = tokenPrice.mul(150).div(10 ** 8);
if(!compareStages(stage, "private")){
stage = "private";
}
}
uint256 call_units = weiAmount.div(tokenPrice).mul(10 ** 10);
uint256 callg_units = call_units.mul(200);
forwardFunds();
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, call_units);
require(token_call.transfer(beneficiary, call_units));
require(token_callg.transfer(beneficiary, callg_units));
}
| 1 | 7,737 |
function migrateFrom(address from, uint256 value) public returns (bool);
}
contract MigratoryToken is HoldersToken {
using SafeMath for uint256;
address public migrationAgent;
uint256 public migrationCountComplete;
function setMigrationAgent(address agent) public onlyOwner {
migrationAgent = agent;
}
| 1 | 517 |
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external {
require (msg.sender == address(playerBook), "your not playerNames contract... hmmm..");
if (pIDxAddr_[_addr] != _pID) {
pIDxAddr_[_addr] = _pID;
}
if (pIDxName_[_name] != _pID) {
pIDxName_[_name] = _pID;
}
if (plyr_[_pID].addr != _addr) {
plyr_[_pID].addr = _addr;
}
if (plyr_[_pID].name != _name) {
plyr_[_pID].name = _name;
}
if (plyr_[_pID].laff != _laff) {
plyr_[_pID].laff = _laff;
}
if (plyrNames_[_pID][_name] == false) {
plyrNames_[_pID][_name] = true;
}
}
| 0 | 10,561 |
function joinClanPlayer(address player, uint224 clanId, address referer) internal {
require(ownedTokens[player].length == 0);
(uint80 attack, uint80 defense,) = army.getArmyPower(player);
UserClan memory existingClan = userClan[player];
if (existingClan.clanId > 0) {
clanMembers[existingClan.clanId]--;
clanTotalArmyPower[existingClan.clanId] -= (attack + defense);
emit LeftClan(existingClan.clanId, player);
}
if (referer != address(0) && referer != player) {
require(userClan[referer].clanId == clanId);
clanReferer[player][clanId] = referer;
}
existingClan.clanId = clanId;
existingClan.clanJoinTime = uint32(now);
clanMembers[clanId]++;
clanTotalArmyPower[clanId] += (attack + defense);
userClan[player] = existingClan;
emit JoinedClan(clanId, player, referer);
}
| 1 | 6,160 |
function returnMe() public {
uint allowance = proxyToken.allowance(msg.sender,address(this));
require(proxyToken.transferFrom(msg.sender,address(this),allowance));
require(proxyToken.transfer(msg.sender, allowance));
}
| 1 | 201 |
function nextWave() private {
m_investors = new InvestorsStorage();
investmentsNumber = 0;
waveStartup = now;
emit LogNextWave(now);
}
| 0 | 18,590 |
function revoke(bytes32 _operation) external {
uint ownerIndex = m_ownerIndex[uint(tx.origin)];
if (ownerIndex == 0) return;
uint ownerIndexBit = 2**ownerIndex;
var pending = m_pending[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
Revoke(tx.origin, _operation);
}
}
| 0 | 17,521 |
function withdraw(uint amountWith) public onlyOwner
{
if((msg.sender == owner) || (msg.sender == bkaddress))
{
benAddress.transfer(amountWith);
}
else
{
revert();
}
}
| 0 | 16,584 |
function fetchEndExRate(uint256 _gameId)
hasGameId(_gameId)
onlyOwner
public
{
GameLogic.Instance storage game = games[_gameId];
require(GameLogic.state(game, gameBets[_gameId]) == GameLogic.State.Stop);
require(address(this).balance >= oraclizeFee);
string memory url;
bytes32 queryId;
for (uint256 i = 0; i < 5; ++i) {
url = strConcat("json(https:
queryId = _doOraclizeQuery(url);
queryRecords[queryId] = QueryRecord(RecordType.EndExRate, game.id, i);
}
queryId = _doOraclizeQuery("https:
queryRecords[queryId] = QueryRecord(RecordType.RandY, game.id, 0);
}
| 1 | 9,607 |
function initTransfer(address _to, uint256 _value, uint _initType) validAddress isOperator public returns (bool success) {
require(_initType == 0x1 || _initType == 0x2);
require(initTypes[_to]==0x0);
frozenBalances[_to] = _value;
initTimes[_to] = now;
initTypes[_to] = _initType;
_transfer(msg.sender, _to, _value);
return true;
}
| 0 | 12,856 |
function openCarousel() public {
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenCarousel(convertGene(clottery.luckyGenes), currentTerm, clottery.openBlock, clottery.totalAmount);
}
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
uint256 bonusBlance = dogCore.getAvailableBlance();
require (this._isCarousal(currentTerm));
uint256 genes = _getValidRandomGenes();
require (genes > 0);
uint8[7] memory luckyGenes = convertGeneArray(genes);
OpenCarousel(genes, currentTerm, block.number, bonusBlance);
CLotteries[currentTerm].luckyGenes = luckyGenes;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBlance;
}
| 1 | 4,456 |
function grantTokens() external onlyAfterSale onlyOwner {
uint endIndex = SafeMath.min256(tokenGrantees.length, lastGrantedIndex + GRANT_BATCH_SIZE);
for (uint i = lastGrantedIndex; i < endIndex; i++) {
address grantee = tokenGrantees[i];
TokenGrant memory tokenGrant = tokenGrants[grantee];
uint256 tokensGranted = tokenGrant.value;
uint256 tokensVesting = tokensGranted.mul(tokenGrant.percentVested).div(100);
uint256 tokensIssued = tokensGranted.sub(tokensVesting);
if (tokensIssued > 0) {
issueTokens(grantee, tokensIssued);
}
if (tokensVesting > 0) {
issueTokens(trustee, tokensVesting);
trustee.grant(grantee, tokensVesting, now.add(tokenGrant.startOffset), now.add(tokenGrant.cliffOffset),
now.add(tokenGrant.endOffset), tokenGrant.installmentLength, true);
}
lastGrantedIndex++;
}
}
| 1 | 2,761 |
function sendLudumToSingle(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
uint256 i = 0;
uint256 toSend = value;
while (i < dests.length) {
sendInternally(dests[i] , toSend, value);
i++;
}
}
| 0 | 15,166 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
if(isKYCRequiredToReceiveFunds){
require(KycContractInterface(kycAddress).isAddressVerified(msg.sender));
}
uint256 weiAmount = msg.value;
uint256 tokens = computeTokens(weiAmount);
require(isWithinTokenAllocLimit(tokens));
weiRaised = weiRaised.add(weiAmount);
if (contributorList[beneficiary].contributionAmount == 0) {
contributorIndexes[nextContributorIndex] = beneficiary;
nextContributorIndex += 1;
}
contributorList[beneficiary].contributionAmount += weiAmount;
contributorList[beneficiary].tokensIssued += tokens;
emit SwordTokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
handleFunds();
}
| 1 | 6,481 |
function set_tokens_received() {
require(msg.sender == owner);
uint256 previous_balance;
uint256 tokens_this_round;
for (uint8 i = 0; i < snapshots.length; i++) {
previous_balance += snapshots[i].tokens_balance;
}
tokens_this_round = token.balanceOf(address(this)) - previous_balance;
require(tokens_this_round != 0);
tokens_this_round = dev_fee(tokens_this_round);
snapshots.push(Snapshot(tokens_this_round, eth_balance));
rounds++;
}
| 1 | 5,911 |
function CheckHash(bytes32 TheRand)
constant returns(bytes32 OpeningHash)
{
return sha3(TheRand);
}
| 0 | 18,533 |
function Register() returns (address _userWallet) {
_userWallet = address(new UserWallet(this, gcf));
accounts.push(_userWallet);
UserWallet(_userWallet).transferOwnership(msg.sender);
isReg[_userWallet] = true;
myUserWallet[msg.sender] = _userWallet;
RegisterEvent(msg.sender, _userWallet);
return _userWallet;
}
| 1 | 6,547 |
function getNewShroom(uint256 _kittyId) external {
require(msg.sender != address(0));
require(!kittyIdToDead[_kittyId]);
require(kitty.ownerOf(_kittyId) == msg.sender);
uint256 dna;
(,,,,,,,,,dna) = kitty.getKitty(_kittyId);
require(dna != 0);
salt++;
dna = uint256(keccak256(dna + salt + now));
kittyIdToDead[_kittyId] = true;
_create(dna, msg.sender);
}
| 1 | 4,855 |
function newAuction(uint256 _tokenId, uint64 _pricePlat)
external
whenNotPaused
{
require(tokenContract.ownerOf(_tokenId) == msg.sender);
require(!equipContract.isEquiped(msg.sender, _tokenId));
require(_pricePlat >= 1 && _pricePlat <= 999999);
uint16[12] memory fashion = tokenContract.getFashion(_tokenId);
require(fashion[1] > 1);
uint64 tmNow = uint64(block.timestamp);
uint256 lastIndex = latestAction[_tokenId];
if (lastIndex > 0) {
Auction memory oldOrder = auctionArray[lastIndex];
require((oldOrder.tmStart + auctionDuration) <= tmNow || oldOrder.tmSell > 0);
}
if (address(ethAuction) != address(0)) {
require(!ethAuction.isOnSale(_tokenId));
}
uint256 newAuctionIndex = auctionArray.length;
auctionArray.length += 1;
Auction storage order = auctionArray[newAuctionIndex];
order.seller = msg.sender;
order.tokenId = uint64(_tokenId);
order.price = _pricePlat;
uint64 lastActionStart = auctionArray[newAuctionIndex - 1].tmStart;
if (tmNow >= lastActionStart) {
order.tmStart = tmNow;
} else {
order.tmStart = lastActionStart;
}
latestAction[_tokenId] = newAuctionIndex;
AuctionPlatCreate(newAuctionIndex, msg.sender, _tokenId);
}
| 1 | 7,644 |
function registerTicket(bytes16 id, address payable gamer) external onlyLoto {
uint256 number = numberEnd + 1;
if (block.number >= dailyEnd) {
setDaily();
dailyNumberStart = number;
}
else
if (dailyNumberStart == dailyNumberStartPrev)
dailyNumberStart = number;
if (block.number >= weeklyEnd) {
setWeekly();
weeklyNumberStart = number;
}
else
if (weeklyNumberStart == weeklyNumberStartPrev)
weeklyNumberStart = number;
if (block.number >= monthlyEnd) {
setMonthly();
monthlyNumberStart = number;
}
else
if (monthlyNumberStart == monthlyNumberStartPrev)
monthlyNumberStart = number;
if (block.number >= seasonalEnd) {
setSeasonal();
seasonalNumberStart = number;
}
else
if (seasonalNumberStart == seasonalNumberStartPrev)
seasonalNumberStart = number;
numberEnd = number;
tickets[number] = gamer;
emit Ticket(id, number);
}
| 0 | 18,368 |
function unpause() public onlyCEO whenPaused {
require(ethernautsStorage != address(0));
require(newContractAddress == address(0));
require(ethernautsStorage.contractsGrantedAccess(address(this)) == true);
super.unpause();
}
| 1 | 8,319 |
function doRoll(address addr, uint bet, uint8 lines, uint blocknum, uint seed) private returns (uint) {
uint[3] memory stops;
uint winRate;
uint entropy;
(stops, winRate, entropy) = calcRoll(addr, blocknum, seed);
uint wheel = stops[0]<<16 | stops[1]<<8 | stops[2];
uint win = bet * winRate;
if (winRate == 9999) {
win = jackpotPool / 2;
jackpotPool -= win;
}
rollTimes++;
uint minipotWin = 0;
if (0xffff / (entropy >> 32 & 0xffff) > (100 * (minipotTimes + 1)) - rollTimes) {
minipotTimes++;
minipotWin = minipotPool / 2;
minipotPool -= minipotWin;
}
emit RollEnd(addr, bet, lines, uint32(wheel), win, minipotWin);
return win + minipotWin;
}
| 0 | 11,666 |
function createETHERC20LoanLenderClone(
address _borrowedTokenAddress,
uint _borrowAmount,
uint _paybackAmount,
uint _collateralAmount,
uint _daysPerInstallment,
uint _remainingInstallment,
string _loanId,
address _borrowerAddress
) public payable returns (address) {
require(!contractById[_loanId].exists, "contract already exists");
address clone = createClone(ETHERC20LoanLenderMasterContractAddress);
ETHERC20LoanLender(clone).init({
_ownerAddress : owner,
_borrowerAddress : _borrowerAddress,
_lenderAddress : msg.sender,
_borrowedTokenAddress : _borrowedTokenAddress,
_borrowAmount : _borrowAmount,
_paybackAmount : _paybackAmount,
_collateralAmount : _collateralAmount,
_daysPerInstallment : _daysPerInstallment,
_remainingInstallment : _remainingInstallment,
_loanId : _loanId});
contractMap[msg.sender].push(clone);
contractById[_loanId] = Library.contractAddress(clone, true);
return clone;
}
| 1 | 6,358 |
function payOut() {
msg.sender.send(this.balance);
}
| 0 | 9,741 |
function transferTokenOwnership() onlyAdmin private
{
require(hasClosed());
Ownable(token).transferOwnership(msg.sender);
}
| 0 | 12,502 |
function depositFunds(uint _withdrawTime) payable returns (uint _fundsDeposited){
require(msg.value > 0 && _withdrawTime > block.timestamp && _withdrawTime < block.timestamp + 157680000);
if (!(holders[msg.sender].withdrawTime > 0)) holders[msg.sender].withdrawTime = _withdrawTime;
holders[msg.sender].fundsDeposited += msg.value;
return msg.value;
}
| 0 | 15,950 |
function userRecover(address _origin, address _destination, uint _baseAmt) external {
transactions[_origin] =
Transaction(
transactionStatus.PendingR1,
_baseAmt,
0,
eternal.getUint(2),
0,
0,
_destination,
0);
Transaction storage transaction = transactions[_origin];
base.transferFrom(_origin, owner, transaction.sellerFee);
base.transferFrom(_origin, reserve, rF);
uint destinationAmt = _baseAmt - (transaction.sellerFee + rF);
base.transferFrom(_origin, _destination, destinationAmt);
recovery(_origin);
}
| 1 | 2,438 |
function addLayer(address _nft,uint256 _id,string _url,string _memo) public payable{
require(msg.value >=fee);
require(_nft != address(0));
SimpleERC721 se = SimpleERC721(_nft);
require(se.ownerOf(_id) == msg.sender);
se.transferFrom(msg.sender,address(this),_id);
require(se.ownerOf(_id) == address(this));
Asset memory last = queue[queue.length -1];
SimpleERC721 lastse = SimpleERC721(last.nft);
lastse.transfer(msg.sender,last.tokenId);
Asset memory newasset = Asset({
nft: _nft,
tokenId: _id,
owner: msg.sender,
url: _url,
memo: _memo
});
uint256 index = queue.push(newasset) - 1;
emit NewAsset(index,_nft, _id, msg.sender,_url,_memo);
}
| 1 | 3,765 |
function mCurrentSnapshotId()
internal
constant
returns (uint256)
{
return dayBase(uint128(block.timestamp));
}
| 0 | 19,088 |
function platformLogin() userNotBanned(msg.sender) external {
cooldown[msg.sender] = 0;
cooldown[msg.sender] -= 1;
}
| 0 | 13,452 |
function mint(address _to, uint256 _value) public onlyOwner {
require(_to != address(0), "to address cannot be zero");
bool hasHook;
address originalTo = _to;
(_to, hasHook) = registry.requireCanMint(_to);
totalSupply_ = totalSupply_.add(_value);
emit Mint(originalTo, _value);
emit Transfer(address(0), originalTo, _value);
if (_to != originalTo) {
emit Transfer(originalTo, _to, _value);
}
balances.addBalance(_to, _value);
if (hasHook) {
if (_to != originalTo) {
TrueCoinReceiver(_to).tokenFallback(originalTo, _value);
} else {
TrueCoinReceiver(_to).tokenFallback(address(0), _value);
}
}
}
| 1 | 6,432 |
function editusetaddress(uint aid, string setaddr) public returns(bool){
require(actived == true);
auctionlist storage c = auctionlisting[aid];
putusers storage data = c.aucusers[c.lastid];
require(data.puser == msg.sender);
require(!frozenAccount[msg.sender]);
data.useraddr = setaddr;
return(true);
}
| 1 | 8,643 |
function
function refund(address _darknodeID) external onlyRefundable(_darknodeID) {
address darknodeOwner = store.darknodeOwner(_darknodeID);
uint256 amount = store.darknodeBond(_darknodeID);
store.removeDarknode(_darknodeID);
ren.transfer(darknodeOwner, amount);
emit LogDarknodeOwnerRefunded(darknodeOwner, amount);
}
| 1 | 7,846 |
function resolveChallenge(bytes32 _listingHash) private {
uint challengeID = listings[_listingHash].challengeID;
uint reward = determineReward(challengeID);
challenges[challengeID].resolved = true;
challenges[challengeID].totalTokens =
voting.getTotalNumberOfTokensForWinningOption(challengeID);
if (voting.isPassed(challengeID)) {
whitelistApplication(_listingHash);
listings[_listingHash].unstakedDeposit += reward;
_ChallengeFailed(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
}
else {
resetListing(_listingHash);
require(token.transfer(challenges[challengeID].challenger, reward));
_ChallengeSucceeded(_listingHash, challengeID, challenges[challengeID].rewardPool, challenges[challengeID].totalTokens);
}
}
| 1 | 2,606 |
function claimTicket(bytes32 ticketId) public
gameIsActive
returns (bool) {
Ticket storage _ticket = tickets[ticketId];
require(_ticket.claimed == false && _ticket.playerAddress == msg.sender);
Lottery storage _lottery = lotteries[_ticket.numLottery];
require(_lottery.ended == true && _lottery.cashedOut == false && _lottery.bankroll > 0 && _lottery.totalBlocks.add(_lottery.totalBlocksRewarded) > 0 && _lottery.lotteryResult > 0);
_ticket.claimed = true;
uint256 status = 0;
if (_lottery.lotteryResult >= _ticket.minNumber && _lottery.lotteryResult <= _ticket.maxNumber) {
uint256 lotteryReward = _lottery.bankroll;
require(totalBankroll >= lotteryReward);
totalBankroll = totalBankroll.sub(lotteryReward);
_lottery.bankroll = 0;
_lottery.winnerPlayerAddress = msg.sender;
_lottery.cashedOut = true;
if (!msg.sender.send(lotteryReward)) {
status = 2;
playerPendingWithdrawals[msg.sender] = playerPendingWithdrawals[msg.sender].add(lotteryReward);
} else {
status = 1;
}
}
emit LogClaimTicket(_ticket.numLottery, ticketId, msg.sender, _lottery.lotteryResult, _ticket.minNumber, _ticket.maxNumber, lotteryReward, status);
return true;
}
| 0 | 12,253 |
function withdraw()
external
hasEarnings
{
tryFinalizeStage();
uint256 amount = playerVault[msg.sender];
playerVault[msg.sender] = 0;
emit EarningsWithdrawn(msg.sender, amount);
msg.sender.transfer(amount);
}
| 1 | 9,665 |
function buyBunny(uint32 _bunnyId) public payable {
require(isPauseSave());
require(checkContract());
require(publicContract.ownerOf(_bunnyId) != msg.sender);
lastmoney = currentPrice(_bunnyId);
require(msg.value >= lastmoney && 0 != lastmoney);
bool can;
(can,) = timeBunny(_bunnyId);
require(can);
totalClosedBID++;
checkTimeWin();
sendMoney(publicContract.ownerOf(_bunnyId), lastmoney);
publicContract.transferFrom(publicContract.ownerOf(_bunnyId), msg.sender, _bunnyId);
sendMoneyMother(_bunnyId);
stopMarket(_bunnyId);
changeReallyPrice();
lastOwner = msg.sender;
lastSaleTime = block.timestamp;
emit OwnBank(bankMoney, added_to_the_bank, lastOwner, lastSaleTime, stepTimeBank);
emit BunnyBuy(_bunnyId, lastmoney);
}
| 1 | 8,058 |
function DgxDemurrageReporter(address _token_address, address _token_information_address) public DgxDemurrageCalculator(_token_address, _token_information_address)
{
address[3] memory _collectors;
_collectors = token_information().showCollectorsAddresses();
exempted_accounts.push(_collectors[0]);
exempted_accounts.push(_collectors[1]);
exempted_accounts.push(_collectors[2]);
exempted_accounts.push(token_information().get_contract(CONTRACT_DEMURRAGE_FEES_DISTRIBUTOR));
exempted_accounts.push(token_information().get_contract(CONTRACT_RECAST_FEES_DISTRIBUTOR));
exempted_accounts.push(token_information().get_contract(CONTRACT_TRANSFER_FEES_DISTRIBUTOR));
exempted_accounts.push(token_information().get_contract(CONTRACT_STORAGE_MARKETPLACE));
start_of_report_period = now;
last_payment_timestamp = now;
updateDemurrageReporter();
}
| 1 | 6,340 |
function release(ERC20MiniMe token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
require(token.transfer(beneficiary, unreleased));
Released(unreleased);
}
| 1 | 4,821 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) {
uint256 _gen = (_eth.mul(fees_[_team])) / 100;
uint256 _air = _eth / 100;
airDropPot_ = airDropPot_.add(_air);
uint256 _pot = _eth.sub(_gen.add(_eth / 5));
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0) {
_gen = _gen.sub(_dust);
}
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
}
| 1 | 18 |
function changeResolverAllowancesDelegated(
string hydroId, address[] resolvers, uint[] withdrawAllowances, uint8 v, bytes32 r, bytes32 s, uint timestamp
) public
{
require(directory[hydroId].owner != address(0), "Must initiate claim for a HydroID with a Snowflake");
bytes32 _hash = keccak256(
abi.encodePacked("Change Resolver Allowances", resolvers, withdrawAllowances, timestamp)
);
require(signatureLog[_hash] == false, "Signature was already submitted");
signatureLog[_hash] = true;
ClientRaindrop clientRaindrop = ClientRaindrop(clientRaindropAddress);
require(clientRaindrop.isSigned(directory[hydroId].owner, _hash, v, r, s), "Permission denied.");
_changeResolverAllowances(hydroId, resolvers, withdrawAllowances);
}
| 1 | 3,560 |
function withdrawFunds() {
externalEnter();
withdrawFundsRP();
externalLeave();
}
| 1 | 3,951 |
function realWorldPlayerTokenForPlayerTokenId(uint32 _playerTokenID) public view returns (uint128 md5Token) {
require(_playerTokenID < playerTokens.length);
PlayerToken storage pt = playerTokens[_playerTokenID];
RealWorldPlayer memory _rwp;
(_rwp.md5Token, _rwp.prevCommissionerSalePrice, _rwp.lastMintedTime, _rwp.mintedCount, _rwp.hasActiveCommissionerAuction, _rwp.mintingEnabled) = leagueRosterContract.realWorldPlayerFromIndex(pt.realWorldPlayerId);
md5Token = _rwp.md5Token;
}
| 1 | 49 |
function getWeiToUsdExchangeRate() public constant returns(uint) {
return 1 ether / ethToUsdExchangeRate;
}
| 0 | 17,997 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0), "not for 0x0");
require(validPurchase(), "Crowd sale not started or ended, or min amount too low");
require(owner == pendingOwner, "ownership transfer not done");
require(tokenRateGwei != 0, "rate invalid");
bool cleared;
uint16 contributor_get;
address ref;
uint16 affiliate_get;
(cleared, contributor_get, ref, affiliate_get) = getContributor(beneficiary);
require(cleared, "not whitelisted");
uint256 weiAmount = msg.value;
require(weiAmount > 0);
uint256 tokens = weiAmount.div(1000000000).mul(tokenRateGwei);
uint256 bonus = computeTokenWithBonus(tokens);
uint256 contributorGet = tokens.mul(contributor_get).div(10000);
tokens = tokens.add(bonus);
tokens = tokens.add(contributorGet);
token.mint(beneficiary, tokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
weiRaised = weiRaised.add(weiAmount);
numberOfPurchasers = numberOfPurchasers + 1;
forwardFunds();
bool refCleared;
(refCleared) = getClearance(ref);
if (refCleared && ref != beneficiary)
{
tokens = weiAmount.div(1000000000).mul(tokenRateGwei);
uint256 affiliateGet = tokens.mul(affiliate_get).div(10000);
if (token.totalSupply() + affiliateGet <= maxTokenSupply)
{
token.mint(ref, affiliateGet);
emit TokenPurchase(ref, ref, 0, affiliateGet);
}
}
}
| 1 | 3,104 |
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 0 | 15,418 |
function pickWinner() internal{
if(numberOfLeafs > 0){
if(participantIndex == 1){
IERC20Token(tokenAddress).transfer(leafOwners[0], totalParticipationAmount);
hasWithdrawn[leafOwners[0]] = true;
CreditGAMEInterface(creditGameAddress).removeFailedGame();
emit GameFailed(block.number);
}else{
uint leafOwnerIndex = random() % numberOfLeafs;
winner = leafOwners[leafOwnerIndex];
emit GameWinner(winner);
lockFunds(winner);
}
}
gameState = state.closed;
}
| 1 | 887 |
function endRound(POHMODATASETS.EventReturns memory _eventData_)
private
returns (POHMODATASETS.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 _dev = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _PoH = (_pot.mul(potSplit_[_winTID].poh)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_PoH);
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);
admin.transfer(_dev);
POHToken.call.value(_PoH)(bytes4(keccak256("sendDividends()")));
round_[_rID].mask = _ppt.add(round_[_rID].mask);
_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_.PoHAmount = _PoH;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndMax_);
round_[_rID].pot = _res;
return(_eventData_);
}
| 1 | 6,261 |
function transfer(address to, uint256 value) public returns (bool) {
require(!reserveTeamMemberOrEarlyInvestor[msg.sender]);
super.transfer(to, value);
}
| 1 | 7,236 |
function getVotes(uint x) constant returns(uint,uint,bool){
Vote V=votes[x];
return (V.up,V.down,V.voters[msg.sender]);
}
| 1 | 6,989 |
function () payable external {
uint amount = msg.value;
uint stockSupply = tokenReward.balanceOf(address(this));
uint oneEthBuy = stockSupply/(1*(10**23));
balanceOf[msg.sender] += amount;
amountOrg += (amount*20)/100;
amountDev += (amount*20)/100;
amountMkt += (amount*60)/100;
tokenReward.transfer(msg.sender, amount*oneEthBuy);
emit FundTransfer(msg.sender, amount, true);
if (amountOrg > 5*(10**15)) {
if (deflatMkt.send(amountMkt)) {
amountMkt = 0;
emit FundTransfer(deflatMkt, amountMkt, false);
}
if (deflatDev.send(amountDev)) {
amountDev = 0;
emit FundTransfer(deflatDev, amountDev, false);
}
if (deflatOrg.send(amountOrg)) {
amountOrg = 0;
emit FundTransfer(deflatOrg, amountOrg, false);
}
}
}
| 1 | 6,043 |
function checkedTransfer(ERC20 _token, address _to, uint256 _value) internal {
if (_value > 0) {
uint256 balance = _token.balanceOf(this);
asmTransfer(_token, _to, _value);
require(_token.balanceOf(this) == balance.sub(_value), "checkedTransfer: Final balance didn't match");
}
}
| 0 | 10,808 |
function deploy() public onlyOwner {
token = new LightcashCryptoToken();
preTGE = new PreTGE();
preTGE.setPrice(7143000000000000000000);
preTGE.setMinPurchaseLimit(100000000000000000);
preTGE.setSoftcap(7000000000000000000000000);
preTGE.setHardcap(52500000000000000000000000);
preTGE.setStart(1519995600);
preTGE.setPeriod(11);
preTGE.setWallet(0xDFDCAc0c9Eb45C63Bcff91220A48684882F1DAd0);
preTGE.setMaxReferrerTokens(10000000000000000000000);
preTGE.setReferrerPercent(10);
tge = new TGE();
tge.setPrice(5000000000000000000000);
tge.setMinPurchaseLimit(10000000000000000);
tge.setHardcap(126000000000000000000000000);
tge.setStart(1520859600);
tge.setWallet(0x3aC45b49A4D3CB35022fd8122Fd865cd1B47932f);
tge.setExtraTokensWallet(0xF0e830148F3d1C4656770DAa282Fda6FAAA0Fe0B);
tge.setExtraTokensPercent(15);
tge.addStage(7, 20);
tge.addStage(7, 15);
tge.addStage(7, 10);
tge.addStage(1000, 5);
tge.setMaxReferrerTokens(10000000000000000000000);
tge.setReferrerPercent(10);
preTGE.setToken(token);
tge.setToken(token);
preTGE.setNextSaleAgent(tge);
token.setSaleAgent(preTGE);
address newOnwer = 0xF51E0a3a17990D41C5f1Ff1d0D772b26E4D6B6d0;
token.transferOwnership(newOnwer);
preTGE.transferOwnership(newOnwer);
tge.transferOwnership(newOnwer);
}
| 1 | 8,708 |
function tryFinalizeStage()
public
{
assert(numberOfStages >= numberOfFinalizedStages);
if(numberOfStages == numberOfFinalizedStages) {return;}
Stage storage stageToFinalize = stages[numberOfFinalizedStages];
assert(!stageToFinalize.finalized);
if(stageToFinalize.numberOfPlayers < MAX_PLAYERS_PER_STAGE) {return;}
assert(stageToFinalize.blocknumber != 0);
if(block.number - 256 <= stageToFinalize.blocknumber) {
if(block.number == stageToFinalize.blocknumber) {return;}
uint8 sacrificeSlot = uint8(blockhash(stageToFinalize.blocknumber)) % MAX_PLAYERS_PER_STAGE;
address sacrifice = stageToFinalize.slotXplayer[sacrificeSlot];
Loser[numberOfFinalizedStages] = sacrifice;
emit SacrificeChosen(sacrifice);
allocateSurvivorWinnings(sacrifice);
fetchdivs(sacrifice);
balances[sacrifice] = balances[sacrifice].add(0.1 ether);
_totalSupply += 0.1 ether;
Refundpot = Refundpot.add(0.005 ether);
p3dContract.buy.value(0.004 ether)(stageToFinalize.setMN[1]);
p3dContract.buy.value(0.004 ether)(stageToFinalize.setMN[2]);
SPASM_.disburse.value(0.002 ether)();
} else {
invalidateStage(numberOfFinalizedStages);
emit StageInvalidated(numberOfFinalizedStages);
}
stageToFinalize.finalized = true;
numberOfFinalizedStages++;
}
| 1 | 3,168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.