func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function owner(bytes32 node) constant returns (address) {
return records[node].owner;
}
| 0 | 12,370 |
function contributeBTC(address _participant, uint256 _btcAmount) public onlyWhitelistSupplier returns(bool) {
require(now >= SALES_START && now < SALES_END);
require(whitelist[_participant]);
uint256 usdAmount = (_btcAmount * rate_BTCUSD) / 10**8;
investedUSD = investedUSD.add(usdAmount);
require(investedUSD <= USD_HARD_CAP);
investments[_participant] = investments[_participant].add(usdAmount);
require(investments[_participant] >= MIN_INVESTMENT);
uint bonusPercents = getBonusPercents(usdAmount);
uint256 ethAmount = (_btcAmount * rate_BTCUSD * 10**10) / rate_ETHUSD;
uint totalTokens = getTotalTokens(ethAmount, bonusPercents);
tokensPurchased = tokensPurchased.add(totalTokens);
require(TriggmineToken(TOKEN_ADDRESS).transferFrom(ASSET_MANAGER_WALLET, _participant, totalTokens));
investedBTC = investedBTC.add(_btcAmount);
emit ContributedBTC(_participant, _btcAmount, usdAmount, totalTokens);
return true;
}
| 1 | 4,571 |
function releaseVestedTokens(address _adr) public changesToVestingFreezed(_adr) {
VestingSchedule storage vestingSchedule = vestingMap[_adr];
require(safeSub(vestingSchedule.amount, vestingSchedule.amountReleased) > 0);
uint256 totalTime = block.timestamp - vestingSchedule.startAt;
uint256 totalSteps = totalTime / vestingSchedule.step;
require(vestingSchedule.cliff <= totalSteps);
uint256 tokensPerStep = vestingSchedule.amount / vestingSchedule.duration;
if(tokensPerStep * vestingSchedule.duration != vestingSchedule.amount) tokensPerStep++;
uint256 totalReleasableAmount = safeMul(tokensPerStep, totalSteps);
if(totalReleasableAmount > vestingSchedule.amount) totalReleasableAmount = vestingSchedule.amount;
uint256 amountToRelease = safeSub(totalReleasableAmount, vestingSchedule.amountReleased);
vestingSchedule.amountReleased = safeAdd(vestingSchedule.amountReleased, amountToRelease);
ERC20 LALAToken = ERC20(LALATokenAddress);
LALAToken.transfer(_adr, amountToRelease);
totalUnreleasedTokens = safeSub(totalUnreleasedTokens, amountToRelease);
VestedTokensReleased(_adr, amountToRelease);
}
| 1 | 8,976 |
function get_hedge () public constant returns ( uint256 ) {
return _hedge ;
}
| 0 | 13,666 |
function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RP1datasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
_team = verifyTeam(_team);
buyCore(_pID, _affCode, _team, _eventData_);
}
| 1 | 7,454 |
function createGennezise(uint32 _matron) public {
bool promo = false;
require(isPriv());
require(isPauseSave());
require(isPromoPause());
if (totalGen0 > promoGen0) {
require(getInWhitelist(msg.sender));
} else if (!(getInWhitelist(msg.sender))) {
require(!TokenBunny.getOwnerGennezise(msg.sender));
TokenBunny.setOwnerGennezise(msg.sender, true);
promo = true;
}
uint localdnk = privateContract.getNewRabbit(msg.sender);
uint32 _bunnyid = TokenBunny.setTokenBunny(0, 0, block.number, 0, 0, 0, msg.sender, localdnk);
totalGen0++;
setRabbitMother(_bunnyid, _matron);
if(_matron != 0){
emit Referral(msg.sender, _matron, _bunnyid, block.timestamp);
}
if (promo) {
TokenBunny.setGiffBlock(_bunnyid, true);
}
}
| 1 | 1,268 |
function destroyRewards() public onlyOwner {
for (uint i = 0; i < rewardSources.length; i++) {
FullERC20 rewardToken = FullERC20(rewardSources[i].rewardTokenAddress);
uint tokenBalance = rewardToken.balanceOf(this);
assert(rewardToken.transfer(owner, tokenBalance));
approvedRewardSources[rewardSources[i].rewardTokenAddress] = false;
}
rewardSources.length = 0;
}
| 1 | 864 |
function addCertificator(address newCertificator) onlyOwner {
validCertificators[newCertificator] = true;
}
| 0 | 17,551 |
function __callback(bytes32, string result, bytes) public {
require(msg.sender == oraclize_cbAddress());
uint256 price = 10 ** 23 / parseInt(result, 5);
require(price > 0);
stage_1_price = price*11/100;
stage_2_price = price*16/100;
stage_3_price = price*21/100;
priceUpdateAt = block.timestamp;
if(updateFlag){
update();
}
}
| 1 | 4,942 |
function getSellCount() public view returns(uint256) {
return _core.getSellCount(getDataContractAddress());
}
| 1 | 2,253 |
function _depositTokens(address _beneficiary, uint256 _amountTokens) internal {
require(_amountTokens != 0);
if (investors[_beneficiary] == 0) {
investorCount++;
}
investors[_beneficiary] = investors[_beneficiary].add(_amountTokens);
mintableFida.sendBoughtTokens(_beneficiary, _amountTokens);
}
| 1 | 6,010 |
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
consumerAddress.onIncreaseApproval(msg.sender, _spender, _addedValue);
return super.increaseApproval(_spender, _addedValue);
}
| 1 | 6,911 |
function totalSupply() public constant workingFlag returns (uint256 totalsupply) {
totalsupply = _totalSupply;
}
| 0 | 15,190 |
function
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
}
| 1 | 6,998 |
function invest(address _receiver) payable {
uint amount = msg.value;
var (numTokens, reachedSoftCap) = getNumTokens(amount);
require(numTokens>0);
require(!crowdsaleClosed && now >= start && now <= end && safeAdd(tokensSold, numTokens) <= maxGoal);
msWallet.transfer(amount);
balanceOf[_receiver] = safeAdd(balanceOf[_receiver], amount);
amountRaised = safeAdd(amountRaised, amount);
tokensSold += numTokens;
assert(tokenReward.transferFrom(tokenOwner, _receiver, numTokens));
FundTransfer(_receiver, amount, true, amountRaised);
if (reachedSoftCap) {
uint newEnd = now + timeAfterSoftCap;
if (newEnd < end) {
end = newEnd;
tokenReward.setStart(newEnd);
}
}
}
| 1 | 371 |
function cancelOrder(uint[3] order, bytes32 r, bytes32 s, uint8 v) external {
Order memory o = parseOrder(order);
require(validateOrderSig(o, r, s, v));
require(o.addr == msg.sender);
if (block.timestamp < o.expiry) {
filledAmounts[o.orderHash] = o.amount;
LogOrderCancel(msg.sender, o.matchId, o.orderHash);
}
}
| 0 | 16,516 |
function internalAction() internal;
modifier onlyService {
require(msg.sender == serviceAccount);
_;
}
| 0 | 15,682 |
function averageSalePrice() public view returns (uint256) {
uint256 sum = 0;
for (uint256 i = 0; i < 5; i++) {
sum += lastSalePrices[i];
}
return sum / 5;
}
| 1 | 7,940 |
function reset() public onlyOwnerOrAds {
for(uint i = 0; i < developers.length; i++){
withdraw(developers[i],balanceDevelopers[developers[i]]);
}
}
| 1 | 609 |
function generateTeamTokens() internal ICOFinished {
require(!teamTokensGenerated);
teamTokensGenerated = true;
if(tokensCap > totalSupply) {
uint unsoldAmount = tokensCap.sub(totalSupply);
token.mint(unsold, unsoldAmount);
totalSupply = totalSupply.add(unsoldAmount);
}
uint totalSupplyTokens = totalSupply;
totalSupplyTokens = totalSupplyTokens.mul(100);
totalSupplyTokens = totalSupplyTokens.div(60);
for (uint8 i = 0; i < listTeamTokens.length; ++i) {
uint teamTokensPart = percent(totalSupplyTokens, listTeamTokens[i].percent);
if (listTeamTokens[i].divider != 0) {
teamTokensPart = teamTokensPart.div(listTeamTokens[i].divider);
}
if (listTeamTokens[i].maxTokens != 0 && listTeamTokens[i].maxTokens < teamTokensPart) {
teamTokensPart = listTeamTokens[i].maxTokens;
}
token.mint(listTeamTokens[i].holder, teamTokensPart);
if(listTeamTokens[i].freezePeriod != 0) {
token.freezeTokens(listTeamTokens[i].holder, endTime + listTeamTokens[i].freezePeriod);
}
addToStat(teamTokensPart, 0);
}
}
| 1 | 4,651 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(
_weiAmount >= minimumContribution,
"Can't send less than the minimum contribution"
);
if (contributions.ethContributions(_beneficiary).add(_weiAmount) > tierZero) {
require(
contributions.isAllowedPurchase(_beneficiary, _weiAmount),
"Beneficiary is not allowed to purchase this amount"
);
}
super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 0 | 17,855 |
function allocatePreICOEthers() internal returns (bool) {
uint8 length = nodeAllocation.getPreICOLength();
require(length > 0);
uint256 totalAmount = this.balance;
for (uint8 i = 0; i < length; i++) {
uint256 amount = totalAmount.mul(nodeAllocation.getPreICOPercentage(i)).div(100);
if ((i + 1) == length) {
amount = this.balance;
}
if (amount > 0) {
nodeAllocation.getPreICOAddress(i).transfer(amount);
}
}
return true;
}
| 0 | 18,198 |
function distributeReservedTokens(uint reservedTokensDistributionBatch) public {
assert(msg.sender == address(crowdsale));
assert(reservedTokensDistributionBatch > 0);
assert(!reservedTokensAreDistributed);
assert(distributedReservedTokensDestinationsLen < token.reservedTokensDestinationsLen());
uint tokensSold = 0;
for (uint8 i = 0; i < crowdsale.joinedCrowdsalesLen(); i++) {
CrowdsaleExt tier = CrowdsaleExt(crowdsale.joinedCrowdsales(i));
tokensSold = tokensSold.plus(tier.tokensSold());
}
uint startLooping = distributedReservedTokensDestinationsLen;
uint batch = token.reservedTokensDestinationsLen().minus(distributedReservedTokensDestinationsLen);
if (batch >= reservedTokensDistributionBatch) {
batch = reservedTokensDistributionBatch;
}
uint endLooping = startLooping + batch;
for (uint j = startLooping; j < endLooping; j++) {
address reservedAddr = token.reservedTokensDestinations(j);
if (!token.areTokensDistributedForAddress(reservedAddr)) {
uint allocatedBonusInPercentage;
uint allocatedBonusInTokens = token.getReservedTokens(reservedAddr);
uint percentsOfTokensUnit = token.getReservedPercentageUnit(reservedAddr);
uint percentsOfTokensDecimals = token.getReservedPercentageDecimals(reservedAddr);
if (percentsOfTokensUnit > 0) {
allocatedBonusInPercentage = tokensSold * percentsOfTokensUnit / 10**percentsOfTokensDecimals / 100;
token.mint(reservedAddr, allocatedBonusInPercentage);
}
if (allocatedBonusInTokens > 0) {
token.mint(reservedAddr, allocatedBonusInTokens);
}
token.finalizeReservedAddress(reservedAddr);
distributedReservedTokensDestinationsLen++;
}
}
if (distributedReservedTokensDestinationsLen == token.reservedTokensDestinationsLen()) {
reservedTokensAreDistributed = true;
}
}
| 1 | 8,872 |
function participatedID(uint16 _id) public view returns (bool) {
uint _min;
uint _max;
if (_id < step) {
_min = 0;
_max = step;
}
else {
uint16 lastDigit = _id % 10;
_min = differenceOfId(_id.sub(lastDigit));
_max = _min + step;
}
return participatedIDs[_min][_max];
}
| 0 | 18,373 |
function destroy(){
selfdestruct(owner);
}
| 0 | 19,390 |
function changeLevelPrice(uint256 _mentorId, uint256 _levelPrice) external onlyOwnerOf(_mentorId) {
require(_levelPrice > 0);
require(isMentor(_mentorId));
prices[_mentorId] = _levelPrice;
emit ChangeLevelPrice(_mentorId, _levelPrice);
}
| 1 | 5,919 |
function close() public {
if (msg.sender==org)
selfdestruct(msg.sender);
}
| 0 | 18,370 |
function distributeRewards(address _woid, IexecLib.Consensus _consensus) internal returns (bool)
{
uint256 i;
address w;
uint256 workerBonus;
uint256 workerWeight;
uint256 totalWeight;
uint256 individualWorkerReward;
uint256 totalReward = _consensus.poolReward;
address[] memory contributors = _consensus.contributors;
for (i = 0; i<contributors.length; ++i)
{
w = contributors[i];
IexecLib.Contribution storage c = m_contributions[_woid][w];
if (c.status == IexecLib.ContributionStatusEnum.PROVED)
{
workerBonus = (c.enclaveChallenge != address(0)) ? 3 : 1;
workerWeight = 1 + c.score.mul(workerBonus).log();
totalWeight = totalWeight.add(workerWeight);
c.weight = workerWeight;
}
else
{
totalReward = totalReward.add(_consensus.stakeAmount);
}
}
require(totalWeight > 0);
uint256 totalWorkersReward = totalReward.percentage(uint256(100).sub(_consensus.schedulerRewardRatioPolicy));
for (i = 0; i<contributors.length; ++i)
{
w = contributors[i];
if (m_contributions[_woid][w].status == IexecLib.ContributionStatusEnum.PROVED)
{
individualWorkerReward = totalWorkersReward.mulByFraction(m_contributions[_woid][w].weight, totalWeight);
totalReward = totalReward.sub(individualWorkerReward);
require(iexecHubInterface.unlockForWork(_woid, w, _consensus.stakeAmount));
require(iexecHubInterface.rewardForWork(_woid, w, individualWorkerReward, true));
}
else
{
require(iexecHubInterface.seizeForWork(_woid, w, _consensus.stakeAmount, true));
}
}
require(iexecHubInterface.rewardForWork(_woid, _consensus.workerpoolOwner, totalReward, false));
return true;
}
| 1 | 2,364 |
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 0 | 11,405 |
function release() public {
uint256 unreleased = releasableAmount();
require(unreleased > 0);
released = released.add(unreleased);
token.safeTransfer(beneficiary, unreleased);
Released(unreleased);
}
| 1 | 7,766 |
function claimTimedOutPayment(uint64 paymentId) external onlyPayee(paymentId) {
require(now > payments[paymentId].payerInactionTimeout);
transferTokens(
address(this),
payments[paymentId].payee,
payments[paymentId].amount,
payments[paymentId].isEthPayment
);
_deletePayment(paymentId);
}
| 1 | 7,148 |
function TokenCreation(
uint _minTokensToCreate,
uint _closingTime,
address _privateCreation) {
closingTime = _closingTime;
minTokensToCreate = _minTokensToCreate;
privateCreation = _privateCreation;
extraBalance = new ManagedAccount(address(this), true);
}
| 0 | 13,648 |
function getBlockNumber() internal constant returns (uint256) {
return block.number;
}
| 1 | 9,103 |
function withdraw() public {
if (accounts[msg.sender] == 0) { throw;}
uint withdrawAmountNormal = accounts[msg.sender];
accounts[msg.sender] = 0;
msg.sender.send(withdrawAmountNormal);
}
| 0 | 10,635 |
function parseTimestamp(uint timestamp) internal pure returns (_DateTime dt) {
uint secondsAccountedFor = 0;
uint buf;
uint8 i;
dt.year = getYear(timestamp);
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR);
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf;
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf);
uint secondsInMonth;
for (i = 1; i <= 12; i++) {
secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year);
if (secondsInMonth + secondsAccountedFor > timestamp) {
dt.month = i;
break;
}
secondsAccountedFor += secondsInMonth;
}
for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) {
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) {
dt.day = i;
break;
}
secondsAccountedFor += DAY_IN_SECONDS;
}
dt.hour = getHour(timestamp);
dt.minute = getMinute(timestamp);
dt.second = getSecond(timestamp);
dt.weekday = getWeekday(timestamp);
}
| 0 | 18,492 |
function buySeeds() public payable{
require(initialized);
uint256 eggsBought=calculateSeedBuy(msg.value,SafeMath.sub(this.balance,msg.value));
eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought));
Divies.redistribution.value(devFee(msg.value))();
claimedSeeds[msg.sender]=SafeMath.add(claimedSeeds[msg.sender],eggsBought);
}
| 1 | 3,789 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(freezedAccounts[_from] == 0 || freezedAccounts[_from] < block.timestamp);
require(freezedAccounts[_to] == 0 || freezedAccounts[_to] < block.timestamp);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
| 0 | 16,672 |
function play(uint _gType,uint[] _bet) payable isHuman() public{
require(!gamePaused,'Game Pause');
require(msg.value >= minBetVal*_bet.length && msg.value <= maxBetVal*_bet.length,"value is incorrect" );
bool _ret=false;
uint _betAmount= msg.value /_bet.length;
uint _prize=0;
uint _winNo= uint(keccak256(abi.encodePacked(rndSeed,msg.sender,block.coinbase,block.timestamp, block.difficulty,block.gaslimit))) % 52 + 1;
rndSeed = keccak256(abi.encodePacked(msg.sender,block.timestamp,rndSeed, block.difficulty));
if(_gType==1){
if(_betAmount * odds['bs'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
if((_winNo > 31 && _bet.contain(2)) || (_winNo < 28 && _bet.contain(1))){
_ret=true;
_prize=(_betAmount * odds['bs']) / 1 ether;
}else if(_winNo>=28 && _winNo <=31 && _bet.contain(0)){
_ret=true;
_prize=(_betAmount * 12 ether) / 1 ether;
}
}
if(_gType==2 && _bet.contain(_winNo%4+1)){
if(_betAmount * odds['suit'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['suit']) / 1 ether;
}
if(_gType==3 && _bet.contain((_winNo-1)/4+1)){
if(_betAmount * odds['num'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['num']) / 1 ether;
}
if(_gType==4 && _bet.contain(_winNo)){
if(_betAmount * odds['nsuit'] / 1 ether >= address(this).balance/2){
revert("over max bet amount");
}
_ret=true;
_prize=(_betAmount * odds['nsuit']) / 1 ether;
}
if(_ret){
msg.sender.transfer(_prize);
}else{
jpBalance += (msg.value * jpPercent) / 100 ether;
}
uint tmpJackpot=0;
if(_betAmount >= jpMinBetAmount){
uint _jpNo= uint(keccak256(abi.encodePacked(rndSeed,msg.sender,block.coinbase,block.timestamp, block.difficulty,block.gaslimit))) % jpChance;
if(_jpNo==77 && jpBalance>jpMinPrize){
msg.sender.transfer(jpBalance);
emit JackpotPayment(guid,msg.sender,_betAmount,jpBalance);
tmpJackpot=jpBalance;
jpBalance=0;
}else{
tmpJackpot=0;
}
rndSeed = keccak256(abi.encodePacked(block.coinbase,msg.sender,block.timestamp, block.difficulty,rndSeed));
}
emit Bettings(guid,_gType,msg.sender,_bet,_ret,_winNo,msg.value,_prize,tmpJackpot);
guid+=1;
}
| 0 | 12,006 |
function tokenFallback(address _from, uint256 _value, bytes _data)
external
onlyTokenContract
returns (bool) {
require(initialized);
require(!_isContract(_from));
require(_value >= 1 finney);
uint256 halo3DBalance = tokenContract.myTokens();
uint256 eggsBought=calculateEggBuy(_value, SafeMath.sub(halo3DBalance, _value));
eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought));
reinvest();
tokenContract.transfer(ceoAddress, devFee(_value));
claimedEggs[_from]=SafeMath.add(claimedEggs[_from],eggsBought);
return true;
}
| 1 | 5,581 |
modifier onlyOwner() {
require(tx.origin == owner);
_;
}
| 0 | 17,873 |
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if(getDividends(_customerAddress, true) > 0) withdraw();
uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _undividedDividends = tokensToEthereum_(_tokenFee);
uint256 _bonus = SafeMath.div(_undividedDividends, dividendFee_);
uint256 _dividends = SafeMath.sub(_undividedDividends, SafeMath.mul(_bonus, 2));
referralBalance_[vault] = SafeMath.add(referralBalance_[vault], _bonus);
p3d.buy.value(_bonus)(_customerAddress);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
| 0 | 11,367 |
function _deposit(address euron_address, uint256 euron_amount, address niwix_address ) private returns (uint256 subscription_value){
_euron.transferFrom(euron_address, address(this), euron_amount);
uint256 subscription_change;
uint256 subscription_units;
(subscription_units, subscription_value, subscription_change) = get_subscription_value(euron_amount);
uint256 niwix_amount = getDepositNiwixValue(euron_amount);
if(niwix_amount>0){
_niwix.transferFrom(niwix_address, address(this), niwix_amount);
}
if(subscription_change > 0 ){
_euron.transfer(niwix_address, subscription_change);
}
address partner = getPartner(niwix_address);
if (partner != address(0)){
subscribe(partner, subscription_units.mul(_subscription_partner_rate), 0, 0, 0);
}
subscribe(niwix_address, subscription_units.mul(_subscription_niwix_rate), subscription_units, _subscription_niwix_rate, _subscription_partner_rate );
}
| 0 | 17,509 |
function setPOLYUSD(uint256 _price) onlyOwner public {
emit LogPriceUpdated(_price, POLYUSD, 0, now);
POLYUSD = _price;
latestUpdate = now;
}
| 1 | 5,060 |
function calculateTierBonus(uint _contribution) constant internal returns (uint) {
uint tierBonus = 0;
if (bonusPhase == BonusPhase.TenPercent) {
tierBonus = _contribution.div(10);
} else if (bonusPhase == BonusPhase.FivePercent) {
tierBonus = _contribution.div(20);
}
tierBonus = tierBonus.mul(tokenRate);
return tierBonus;
}
| 1 | 9,615 |
function compareNums() private {
if (ln[player[totalPlayCount]] == crn[player[totalPlayCount]]) {
emit message("Congratulations, you win!", ln[player[totalPlayCount]], crn[player[totalPlayCount]]);
player[totalPlayCount].transfer(payout[player[totalPlayCount]]);
payout[player[totalPlayCount]] = 0;
}
else {
emit message("Sorry, try again.", ln[player[totalPlayCount]], crn[player[totalPlayCount]]);
}
}
| 1 | 4,218 |
function createListing(uint256 tokenId, uint256 price, uint256 dateEnds) external {
require(owns(msg.sender, tokenId));
require(price > 0);
Listing memory listing = Listing(msg.sender, price, now, dateEnds);
tokenIdToListing[tokenId] = listing;
ListingCreated(tokenId, listing.price, now, dateEnds, listing.seller);
}
| 1 | 8,044 |
function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
Finalized();
isFinalized = true;
}
| 1 | 8,671 |
function createAuction(uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, address _seller, uint64 _startAt) external {
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(nonFungibleContract));
_escrow(_seller, _tokenId);
uint64 startAt = _startAt;
if (_startAt == 0) {
startAt = uint64(now);
}
Auction memory auction = Auction(_seller, uint128(_startingPrice), uint128(_endingPrice), uint64(_duration), uint64(startAt));
_addAuction(_tokenId, auction);
}
| 1 | 662 |
function completeAttack(bytes32 attackId) public {
AttackInfo storage attackInfo = attackIdToInfo[attackId];
(address winner, uint attackeeActualScore) = getWinner(attackId);
uint cnt_supported_tokens = marketDataOracle.numberOfSupportedTokens();
for (uint i=0; i<cnt_supported_tokens; i++) {
(address token_address, bool status) = marketDataOracle.getSupportedTokenByIndex(i);
if (attackInfo.attacker == winner) {
uint winnings = attackInfo.attackerWinnings[token_address];
if (winnings > 0) {
tokens[token_address][attackInfo.attackee] = tokens[token_address][attackInfo.attackee].sub(winnings);
tokens[token_address][attackInfo.attacker] = tokens[token_address][attackInfo.attacker].add(winnings);
}
}
else {
uint loosings = attackInfo.attackeeWinnings[token_address];
if (loosings > 0) {
tokens[token_address][attackInfo.attacker] = tokens[token_address][attackInfo.attacker].sub(loosings);
tokens[token_address][attackInfo.attackee] = tokens[token_address][attackInfo.attackee].add(loosings);
}
}
}
_unregisterAttack(attackId);
emit AttackCompleted(
attackId,
winner,
attackeeActualScore
);
}
| 1 | 8,386 |
function SocialLendingToken(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
totalSupply_ = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[msg.sender] = _initialSupply;
Transfer(0x0, msg.sender, _initialSupply);
}
| 0 | 15,765 |
function transferOwnership(address payable otherOwner) onlyOwner public {
require(otherOwner != address(0));
newOwner = otherOwner;
}
| 0 | 12,435 |
function _releaseBuckets(
address _tokenHolder
)
private
returns (uint256)
{
require(lockingMap[_tokenHolder].startDate != 0, "Is not a locked address");
uint256 startDate = lockingMap[_tokenHolder].startDate;
uint256 tokens = 0;
if (startDate + sixMonth <= block.timestamp) {
tokens = lockingMap[_tokenHolder].bucket1;
lockingMap[_tokenHolder].bucket1 = 0;
}
if (startDate + twelveMonth <= block.timestamp) {
tokens = tokens + lockingMap[_tokenHolder].bucket2;
lockingMap[_tokenHolder].bucket2 = 0;
}
if (startDate + eighteenMonth <= block.timestamp) {
tokens = tokens + lockingMap[_tokenHolder].bucket3;
lockingMap[_tokenHolder].bucket3 = 0;
}
require(erc20Contract.transfer(_tokenHolder, tokens), "Transfer failed");
emit ReleaseVestingEvent(_tokenHolder, tokens);
return tokens;
}
| 0 | 12,451 |
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
require(c >= _a);
return c;
}
| 0 | 11,180 |
function twitterDropSingleAmount(address[] _recipients, uint256 _amount) external
onlyAdmin
validBalance(_recipients, _amount)
{
for (uint256 i = 0 ; i < _recipients.length ; i++) {
address recipient = _recipients[i];
if (!twitterdrops[recipient]) {
assert(token.transfer(recipient, _amount));
twitterdrops[recipient] = true;
numDrops = numDrops.add(1);
dropAmount = dropAmount.add(_amount);
TokenDrop(recipient, _amount, "TWITTER");
}
}
}
| 1 | 9,311 |
function selfDestruction() external onlyVoting {
status = Status.Destructed;
updateReleasedBalance();
releasedBalance = releasedBalance.add(closingRelease.mul(tap));
updateTap(0);
uint256 _totalSupply = ERC20Interface(votingTokenAddr).totalSupply();
refundRateNano = address(this).balance.sub(getAvailableBalance()).mul(10**9).div(_totalSupply);
}
| 1 | 2,776 |
function approve(address _spender, uint256 _amount) returns (bool success) {
require(transfersEnabled);
if (isContract(controller)) {
require(TokenController(controller).onApprove(msg.sender, _spender, _amount));
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 1 | 4,535 |
function splitSignature(bytes sig)
internal
pure
returns (uint8, bytes32, bytes32)
{
require(sig.length == 65);
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
return (v, r, s);
}
| 0 | 13,667 |
function setSaleCap(uint256 _saleCap) public ownerOnly returns (uint256 toBeSold) {
notAttributed += saleCap;
saleCap = _saleCap * weisPerEth;
if (saleCap > notAttributed) {
saleCap = notAttributed;
}
notAttributed -= saleCap;
return saleCap;
}
| 0 | 15,690 |
function decreaseApproval (address _spender, uint _subtractedValue)
onlyPayloadSize(2)
returns (bool success) {
uint oldValue = allowance[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowance[msg.sender][_spender] = 0;
} else {
allowance[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
Approval(msg.sender, _spender, allowance[msg.sender][_spender]);
return true;
}
| 0 | 14,891 |
function claim() external isPayoutPaused hasNotClaimed isPayoutSetup {
uint rewardAmount = getRewardEstimate();
hasClaimed[msg.sender] = true;
require(rewardAmount <= address(this).balance);
msg.sender.transfer(rewardAmount);
}
| 1 | 7,189 |
function sendTokens() private returns (bool) {
uint256 tokens = 0;
require( msg.value >= minContribution );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
bonus = 0;
if ( msg.value >= extraBonus ) {
bonus = tokens / 2;
}
tokens = tokens + bonus;
sendtokens(cddtoken, tokens, investor);
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| 0 | 13,731 |
function getNextBugFromHunter(address hunter, uint256 previousBugId) public view returns (bool, uint256) {
if (!hunterReportedBugs[hunter].listExists()) {
return (false, 0);
}
uint256 bugId;
bool exists;
(exists, bugId) = hunterReportedBugs[hunter].getAdjacent(previousBugId, NEXT);
if (!exists || bugId == 0) {
return (false, 0);
}
return (true, bugId);
}
| 0 | 18,812 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 10;
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
_p3d = _p3d.add(distributeAff(_rID,_pID,_eth,_affID));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
uint256 _amount = _p3d.sub(_potAmount);
shareCom.transfer((_amount.mul(65)/100));
admin.transfer((_amount.mul(35)/100));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
}
| 0 | 15,054 |
function addBalances(address[] recipients, uint256[] moenys) public onlyOwner{
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].add(moenys[i]);
sum = sum.add(moenys[i]);
emit Transfer(this, recipients[i], moenys[i]);
}
balances[this] = balances[this].sub(sum);
}
| 1 | 5,573 |
function makeDeposit() private {
if (msg.value > 0) {
Investor storage inv = investors[msg.sender];
if (inv.iteration != iterationIndex) {
countOfInvestors += 1;
if(inv.deposit > inv.withdrawnPure)
inv.deposit -= inv.withdrawnPure;
else
inv.deposit = 0;
if(inv.deposit + msg.value > maxDeposit)
inv.deposit = maxDeposit - msg.value;
inv.withdrawn = 0;
inv.withdrawnPure = 0;
inv.time = now;
inv.iteration = iterationIndex;
inv.lockedDeposit = inv.deposit;
inv.isVoteProfit = false;
}
if (inv.deposit > 0 && now >= inv.time + TIME_QUANT) {
collectPercent();
}
inv.deposit += msg.value;
} else {
collectPercent();
}
}
| 1 | 6,135 |
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.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);
admin.transfer(_com);
admin.transfer(_p3d.sub(_p3d / 2));
round_[_rID].pot = _pot.add(_p3d / 2);
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_.P3DAmount = _p3d;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
}
| 0 | 13,461 |
function receiveApproval(address _sender, uint256 _value,
address _tokenContract, bytes _extraData) public{
require(_tokenContract == arina_contract);
bytes1 action = _extraData[0];
if (action == 0x0){
_payRent_ARINA(_sender, _value);
}
else if(action == 0x1){
_buyLand_ARINA(_sender, _value);
}
else if(action == 0x2){
require(_value == 100*10**8);
uint16 _city = uint16(_extraData[1]);
address[] memory checkPlayer;
checkPlayer = checkBuildingPlayer(player_info[_sender].city,17);
if(checkPlayer.length != 0){
for(uint8 i=0;i<checkPlayer.length;i++){
require(ERC20_interface(arina_contract).transferFrom(_sender, checkPlayer[i], _value.div(checkPlayer.length)),"交易失敗");
}
}else{
require(ERC20_interface(arina_contract).transferFrom(_sender, trade_address, _value),"交易失敗");
trade(trade_address).set_city_pool(_value,player_info[_sender].city);
}
change_city(_sender, _city);
}
else if(action == 0x3){
uint8 _building = uint8(_extraData[1]);
uint build_value = inquire_type_price(_building);
require(_value == build_value,"金額不對");
require(ERC20_interface(arina_contract).transferFrom(_sender, trade_address, _value),"交易失敗");
trade(trade_address).set_city_pool(_value,player_info[_sender].city);
_build(_sender, _building,_value);
}
else{revert();}
}
| 1 | 4,427 |
function adminWithdraw() public {}
}
contract AdminBank {
using SafeMath for uint256;
uint256 public fundsReceived;
address public masterAdmin;
address public mainContract;
bool public mainContractSet = false;
address public teamMemberA = 0x2597afE84661669E590016E51f8FB0059D1Ad63e;
address public teamMemberB = 0x2E6C1b2B4F7307dc588c289C9150deEB1A66b73d;
address public teamMemberC = 0xB3CaC7157d772A7685824309Dc1eB79497839795;
address public teamMemberD = 0x87395d203B35834F79B46cd16313E6027AE4c9D4;
address public teamMemberE = 0x2c3e0d5cbb08e0892f16bf06c724ccce6a757b1c;
address public teamMemberF = 0xd68af19b51c41a69e121fb5fb4d77768711c4979;
address public teamMemberG = 0x8c992840Bc4BA758018106e4ea9E7a1d6F0F11e5;
address public teamMemberH = 0xd83FAf0D707616752c4AbA00f799566f45D4400A;
address public teamMemberI = 0xca4a41Fc611e62E3cAc10aB1FE9879faF5012687;
uint256 public teamMemberArate = 20;
uint256 public teamMemberBrate = 20;
uint256 public teamMemberCrate = 15;
uint256 public teamMemberDrate = 15;
uint256 public teamMemberErate = 7;
uint256 public teamMemberFrate = 4;
uint256 public teamMemberGrate = 4;
uint256 public teamMemberHrate = 5;
uint256 public teamMemberIrate = 10;
mapping (address => uint256) public teamMemberTotal;
mapping (address => uint256) public teamMemberUnclaimed;
mapping (address => uint256) public teamMemberClaimed;
mapping (address => bool) public validTeamMember;
mapping (address => bool) public isProposedAddress;
mapping (address => bool) public isProposing;
mapping (address => uint256) public proposingAddressIndex;
constructor() public {
masterAdmin = msg.sender;
validTeamMember[teamMemberA] = true;
validTeamMember[teamMemberB] = true;
validTeamMember[teamMemberC] = true;
validTeamMember[teamMemberD] = true;
validTeamMember[teamMemberE] = true;
validTeamMember[teamMemberF] = true;
validTeamMember[teamMemberG] = true;
validTeamMember[teamMemberH] = true;
validTeamMember[teamMemberI] = true;
}
| 0 | 10,553 |
function solveTask(uint _taskId, uint256 _answerPrivateKey, uint256 publicXPoint, uint256 publicYPoint) public isLastestVersion {
uint activeTaskIndex = indexOfTaskId[_taskId].sub(1);
Task storage task = allTasks[activeTaskIndex];
require(task.answerPrivateKey == 0, "solveTask: task is already solved");
require(_answerPrivateKey >> 128 == uint256(msg.sender) >> 32, "solveTask: this solution does not match miner address");
if (TaskType(task.taskId >> 128) == TaskType.BITCOIN_ADDRESS_PREFIX) {
require(ec.publicKeyVerify(_answerPrivateKey, publicXPoint, publicYPoint));
(publicXPoint, publicYPoint) = ec.ecadd(
task.requestPublicXPoint,
task.requestPublicYPoint,
publicXPoint,
publicYPoint
);
bytes32 btcAddress = createBtcAddress(publicXPoint, publicYPoint);
require(haveCommonPrefixUntilZero(task.data, btcAddress), "solveTask: found prefix is not enough");
task.answerPrivateKey = _answerPrivateKey;
} else {
revert();
}
uint256 taskReard = task.reward;
uint256 serviceReward = taskReard.mul(serviceFee).div(MAX_PERCENT);
uint256 minerReward = taskReard - serviceReward;
if (serviceReward != 0 && task.referrer != 0) {
uint256 referrerReward = serviceReward.mul(referrerFee).div(MAX_PERCENT);
task.referrer.transfer(referrerReward);
}
msg.sender.transfer(minerReward);
totalReward -= taskReard;
_completeTask(_taskId, activeTaskIndex);
emit TaskSolved(_taskId, minerReward);
}
| 1 | 5,247 |
function __callback(bytes32 queryId, string result, bytes proof) public {
require(msg.sender == oraclizeData.oraclize_cbAddress());
if (oraclizeData.oraclize_randomDS_proofVerify__returnCode(queryId, result, proof) != 0) {
RandomProofFailed(queryId, gameId, now);
randomQueried = 0;
return;
}
__callback(queryId, result);
}
| 0 | 16,112 |
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == address(0) || _affCode == msg.sender)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
}
| 1 | 3,981 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(!emergencyFlag);
require(_value <= balances[msg.sender]);
require(_to != address(0));
if (requireBetalisted){
require(betalisted[_to]);
require(betalisted[msg.sender]);
}
require(!blacklisted[msg.sender]);
require(!blacklisted[_to]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 9,943 |
functions related to creating kittens
contract KittyMinting is KittyAuction {
uint256 public constant PROMO_CREATION_LIMIT = 5000;
uint256 public constant GEN0_CREATION_LIMIT = 45000;
uint256 public constant GEN0_STARTING_PRICE = 10 finney;
uint256 public constant GEN0_AUCTION_DURATION = 1 days;
uint256 public promoCreatedCount;
uint256 public gen0CreatedCount;
function createPromoKitty(uint256 _genes, address _owner) external onlyCOO {
address kittyOwner = _owner;
if (kittyOwner == address(0)) {
kittyOwner = cooAddress;
}
require(promoCreatedCount < PROMO_CREATION_LIMIT);
promoCreatedCount++;
_createKitty(0, 0, 0, _genes, kittyOwner);
}
function createGen0Auction(uint256 _genes) external onlyCOO {
require(gen0CreatedCount < GEN0_CREATION_LIMIT);
uint256 kittyId = _createKitty(0, 0, 0, _genes, address(this));
_approve(kittyId, saleAuction);
saleAuction.createAuction(
kittyId,
_computeNextGen0Price(),
0,
GEN0_AUCTION_DURATION,
address(this)
);
gen0CreatedCount++;
}
function _computeNextGen0Price() internal view returns (uint256) {
uint256 avePrice = saleAuction.averageGen0SalePrice();
require(avePrice == uint256(uint128(avePrice)));
uint256 nextPrice = avePrice + (avePrice / 2);
if (nextPrice < GEN0_STARTING_PRICE) {
nextPrice = GEN0_STARTING_PRICE;
}
return nextPrice;
}
}
| 1 | 7,825 |
function SGCC() public {
decimals = 18;
balanceOf[msg.sender] = 20000000000 * (10 ** uint256(decimals));
totalSupply = 20000000000 * (10 ** uint256(decimals));
name = 'SGCC';
symbol = 'SGCC';
owner = msg.sender;
}
| 0 | 11,085 |
function stageName() constant public returns (string) {
bool beforePeriod = (now < startTime);
if(beforePeriod) {
return "Not started";
}
if(withinPeriod()) {
return name;
}
return "Finished";
}
| 1 | 2,669 |
function releaseTokens(address _beneficiary) public onlyWhenUnlocked {
uint256 amount = tokens[_beneficiary];
tokens[_beneficiary] = 0;
require(tokenContract.transfer(_beneficiary, amount));
totalTokens = totalTokens.sub(amount);
ReleasedTokens(_beneficiary);
}
| 1 | 3,977 |
function sendProfits(
uint[] _gameHash,
uint256[] _profitAmount) public onlyCoOwner2 onlyStarted {
for(uint i = 0; i < _gameHash.length; i++) {
sendProfit(_gameHash[i], _profitAmount[i]);
}
}
| 0 | 15,915 |
function doInvest(address referrerAddr) public payable notFromContract balanceChanged {
uint investment = msg.value;
uint receivedEther = msg.value;
require(investment >= minInvesment, "investment must be >= minInvesment");
require(address(this).balance <= maxBalance, "the contract eth balance limit");
if (m_rgp.isActive()) {
uint rpgMaxInvest = m_rgp.maxInvestmentAtNow();
rpgMaxInvest.requireNotZero();
investment = Math.min(investment, rpgMaxInvest);
assert(m_rgp.saveInvestment(investment));
emit LogRGPInvestment(msg.sender, now, investment, m_rgp.currDay());
} else if (m_privEnter.isActive()) {
uint peMaxInvest = m_privEnter.maxInvestmentFor(msg.sender);
peMaxInvest.requireNotZero();
investment = Math.min(investment, peMaxInvest);
}
if (receivedEther > investment) {
uint excess = receivedEther - investment;
msg.sender.transfer(excess);
receivedEther = investment;
emit LogSendExcessOfEther(msg.sender, now, msg.value, investment, excess);
}
bool senderIsInvestor = m_investors.isInvestor(msg.sender);
if (referrerAddr.notZero() && !senderIsInvestor && !m_referrals[msg.sender] &&
referrerAddr != msg.sender && m_investors.isInvestor(referrerAddr)) {
}
uint dividends = calcDividends(msg.sender);
if (senderIsInvestor && dividends.notZero()) {
investment += dividends;
emit LogAutomaticReinvest(msg.sender, now, dividends);
}
if (senderIsInvestor) {
assert(m_investors.addInvestment(msg.sender, investment));
assert(m_investors.setPaymentTime(msg.sender, now));
} else {
assert(m_investors.newInvestor(msg.sender, investment, now));
emit LogNewInvestor(msg.sender, now);
}
investmentsNumber++;
emit LogNewInvesment(msg.sender, now, investment, receivedEther);
}
| 1 | 279 |
function Foodiecoin() {
balances[msg.sender] = 75000000;
totalSupply = 75000000;
name = "Foodiecoin";
decimals = 0;
symbol = "FCW";
fundsWallet = msg.sender;
}
| 0 | 13,158 |
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
require(token.transfer(beneficiary, unreleased));
emit Released(unreleased);
}
| 1 | 2,172 |
function transferFrom(address _from, address _to, uint256 _value) public notRestricted(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 0 | 10,852 |
function cast() public note {
require( !done );
exec(whom, data, mana);
done = true;
}
| 1 | 8,718 |
function updateCredit(address _owner, uint256 _currentEthAmount, uint256 _rDividends, uint256 _todayDividends)
private
{
uint256 curRoundId = getCurRoundId();
credit[_owner] = int256(pps.mul(balances[_owner])).sub(int256(_currentEthAmount));
rCredit[_owner][curRoundId] = int256(rPps[curRoundId] * balances[_owner]) - int256(_rDividends);
todayCredit[_owner] = int256(ppsInDay[getToday()] * balances[_owner]) - int256(_todayDividends);
}
| 1 | 7,452 |
function setAStore(
string _appNickname,
address _address
)
public
onlyOwner
{
require(bytes(_appNickname).length > 0);
bytes32 _appNickname32 = keccak256(_appNickname);
require(_address != address(0));
StoreInterface _store = StoreInterface(_address);
require(_store.getAppNickname() == _appNickname32);
uint _appId = _store.getAppId();
require(appNicknames32[_appId] == 0x0);
appNicknames32[_appId] = _appNickname32;
appNicknames[_appId] = _appNickname;
__appIds[_appNickname] = _appId;
__stores[_appId] = Store(
_store,
_address,
true
);
totalStores++;
StoreSet(_appNickname, _address);
StoreActive(_appNickname, _address, true);
}
| 1 | 5,197 |
function _redeemTokens(TDS.Storage storage s, uint tokensToRedeem) external {
require(s.state == TDS.State.Live || s.state == TDS.State.Settled);
require(tokensToRedeem > 0);
if (s.state == TDS.State.Live) {
require(msg.sender == s.externalAddresses.sponsor || msg.sender == s.externalAddresses.apDelegate);
s._remarginInternal();
require(s.state == TDS.State.Live);
}
ExpandedIERC20 thisErc20Token = ExpandedIERC20(address(this));
uint initialSupply = _totalSupply();
require(initialSupply > 0);
_pullAuthorizedTokens(thisErc20Token, tokensToRedeem);
thisErc20Token.burn(tokensToRedeem);
emit TokensRedeemed(s.fixedParameters.symbol, tokensToRedeem);
uint tokenPercentage = tokensToRedeem.mul(UINT_FP_SCALING_FACTOR).div(initialSupply);
uint tokenMargin = _takePercentage(_safeUintCast(s.longBalance), tokenPercentage);
s.longBalance = s.longBalance.sub(_safeIntCast(tokenMargin));
assert(s.longBalance >= 0);
s.nav = _computeNavForTokens(s.currentTokenState.tokenPrice, _totalSupply());
s._sendMargin(tokenMargin);
}
| 0 | 16,000 |
function checkIfFundingCompleteOrExpired() public {
if ( now > SaleDeadline && state != State.Successful){
state = State.Successful;
completedAt = now;
emit LogFundingSuccessful(totalRaised);
successful();
} else if(state == State.PRESALE && now >= MAINSALEStart ) {
state = State.MAINSALE;
}
}
| 0 | 9,886 |
function mintPresell(address _to, string _genome)
external presaleOnly presaleModeOnly returns(uint256)
{
require(presaleCount_ < PRESALE_LIMIT, "presale_limit");
uint256 tokenId = _createToken(_to, 0, _genome, 0, 0, 0, "");
presaleCount_ += 1;
require(_checkAndCallSafeTransfer(NA, _to, tokenId, ""), "safe_transfer");
emit Transfer(NA, _to, tokenId);
return tokenId;
}
| 0 | 18,416 |
function() payable {
issueToken();
}
| 0 | 13,210 |
function weights(address _token) public view returns(uint256) {
return _weights[_token];
}
| 0 | 11,671 |
function bonusRate() public view returns(uint256) {
return _getbonusRate();
}
| 0 | 18,668 |
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
constructor() internal {
}
| 0 | 12,608 |
function sendEtherForInvestor(address investorAddress, uint256 value, uint256 reason, address presentee, uint256 times) internal {
if (value == 0 || investorAddress == 0) return;
Investor storage investor = investors[investorAddress];
if (investor.reserveCommission > 0) {
bool isPass = investor.reserveCommission >= 3 * investor.depositedAmount;
uint256 reserveCommission = isPass ? investor.reserveCommission + value : investor.reserveCommission;
investor.reserveCommission = 0;
sendEtherForInvestor(investorAddress, reserveCommission, 4, 0, 0);
if (isPass) return;
}
uint256 withdrewAmount = investor.withdrewAmount;
uint256 depositedAmount = investor.depositedAmount;
uint256 amountToPay = value;
if (withdrewAmount + value >= 3 * depositedAmount) {
amountToPay = 3 * depositedAmount - withdrewAmount;
investor.reserveCommission = value - amountToPay;
if (reason != 2) investor.reserveCommission += getDailyIncomeForUser(investorAddress);
if (reason != 3) investor.reserveCommission += getUnpaidSystemCommission(investorAddress);
investor.maxOutTimes++;
investor.maxOutTimesInWeek++;
investor.depositedAmount = 0;
investor.withdrewAmount = 0;
investor.lastMaxOut = now;
investor.dailyIncomeWithrewAmount = 0;
emit MaxOut(investorAddress, investor.maxOutTimes, now);
} else {
investors[investorAddress].withdrewAmount += amountToPay;
}
if (amountToPay != 0) {
investorAddress.transfer(amountToPay / 100 * 94);
operationFund.transfer(amountToPay / 100 * 5);
developmentFund.transfer(amountToPay / 100 * 1);
bytes32 id = keccak256(abi.encodePacked(block.difficulty, now, investorAddress, amountToPay, reason));
Withdrawal memory withdrawal = Withdrawal({ id: id, at: now, amount: amountToPay, investor: investorAddress, presentee: presentee, times: times, reason: reason });
withdrawals[id] = withdrawal;
investor.withdrawals.push(id);
withdrawalIds.push(id);
}
}
| 0 | 18,821 |
function createDeposit() private{
uint value = msg.value;
uint rateFund1 = value.mul(5).div(100);
uint rateFund2 = value.mul(5).div(100);
uint rateStubFund = value.mul(10).div(100);
if(msg.value > 0){
if (balances[msg.sender] == 0){
emit NewInvestor(msg.sender, msg.value);
}
balances[msg.sender] = balances[msg.sender].add(msg.value);
time[msg.sender] = now;
insertBeneficiaries(msg.sender,0,0, msg.value);
fund1.transfer(rateFund1);
fund2.transfer(rateFund2);
stabFund.call.value(rateStubFund).gas(estGas)();
allDeposits+=msg.value;
emit NewDeposit(msg.sender, msg.value);
}else{
receivePayment();
}
}
| 1 | 4,155 |
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract RaRaCoin is ERC20, Ownable, Pausable {
uint128 internal MONTH = 30 * 24 * 3600;
using SafeMath for uint256;
struct LockupInfo {
uint256 releaseTime;
uint256 termOfRound;
uint256 unlockAmountPerRound;
uint256 lockupBalance;
}
| 0 | 15,680 |
function withdraw() public isActivated isHuman {
uint256 _now = block.timestamp;
uint256 _eth;
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _rID = rID_;
if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) {
F3Ddatasets.EventReturns memory _eventData_;
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eth = withdrawEarnings(_pID);
if (_eth > 0) {
plyr_[_pID].addr.transfer(_eth);
}
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit F3Devents.onWithdrawAndDistribute(
msg.sender,
plyr_[_pID].name,
_eth,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.genAmount
);
} else {
_eth = withdrawEarnings(_pID);
if (_eth > 0) {
plyr_[_pID].addr.transfer(_eth);
}
emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now);
}
}
| 1 | 4,883 |
function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
fundBankRoll(_maintenance);
if (
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
stats[_referredBy].rewarded = SafeMath.add(stats[_referredBy].rewarded, _referralBonus);
stats[_referredBy].xRewarded += 1;
stats[_customerAddress].contributed = SafeMath.add(stats[_customerAddress].contributed, _referralBonus);
stats[_customerAddress].xContributed += 1;
emit onCommunityReward(_customerAddress, _referredBy, _referralBonus);
}
| 1 | 5,807 |
function receiveApproval(address _sender, uint256 _value, address _tokenContract, bytes _extraData)
external
whenNotPaused
{
require(msg.sender == address(bitGuildContract));
require(_extraData.length == 1);
uint32 miningType = uint32(_extraData[0]);
if (miningType == 0) {
require(_value == miningOnePlat);
require(bitGuildContract.transferFrom(_sender, address(this), _value));
_miningOneSelf(_sender);
} else if (miningType == 10) {
require(_value == miningTenPlat);
require(bitGuildContract.transferFrom(_sender, address(this), _value));
_addOrder(_sender, 10);
} else if (miningType == 3) {
require(_value == miningThreePlat);
require(bitGuildContract.transferFrom(_sender, address(this), _value));
_addOrder(_sender, 3);
} else if (miningType == 5) {
require(_value == miningFivePlat);
require(bitGuildContract.transferFrom(_sender, address(this), _value));
_addOrder(_sender, 5);
} else if (miningType == 1) {
require(_value == miningOnePlat);
require(bitGuildContract.transferFrom(_sender, address(this), _value));
_addOrder(_sender, 1);
} else {
require(false);
}
_transferHelper(_sender, _value);
}
| 1 | 3,809 |
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
if (isPreSale) return _weiAmount.mul(preSaleRate);
if (isICO) return _weiAmount.mul(rate);
return 0;
}
| 0 | 15,375 |
function setTokenContract(address newTokenContractAddr) onlyowner {
if (newTokenContractAddr == address(0x0)) throw;
if (tokenCtr != address(0x0)) throw;
tokenCtr = Token(newTokenContractAddr);
}
| 0 | 10,079 |
function addGameEthSpendLose(address _citizen, uint256 _value) onlyCoreContract() public {
citizen[_citizen].citizenGameEthSpend = citizen[_citizen].citizenGameEthSpend.add(_value);
DAAContract.citizenMintToken(_citizen,_value,-1);
sortMostSpend(_citizen);
}
| 1 | 8,713 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.