func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function PK(uint8 num,bytes32 name)
notLock
msgSendFilter
public payable {
require(msg.value == mConfig.getPrice(),"msg.value is error");
require(msg.sender != mWinner.addr,"msg.sender != winner");
uint winRate = mConfig.getWinRate(mWinner.winCount);
uint curWinRate ; uint curOverRate;
(curWinRate,curOverRate) = getRandom(100);
inviteHandler(name);
address oldWinAddr = mWinner.addr;
if(mWinner.addr == address(0) ) {
mWinner = Winner(num,0,msg.sender);
}
else if( winRate < curWinRate ) {
mWinner = Winner(num,1,msg.sender);
}
else{
mWinner.winCount = mWinner.winCount + 1;
}
uint overRate = mConfig.getOverRate(mWinner.winCount);
emit pkEvent(mWinner.addr,msg.sender,name, winRate, overRate, curWinRate, curOverRate,msg.sender == mWinner.addr, mConfig.getPrice());
if(oldWinAddr != address(0) && curOverRate < overRate ) {
require(mWinner.addr != address(0),"Winner.addr is null");
uint pumpRate = mConfig.getPumpRate();
uint totalBalace = address(this).balance;
uint giveToOwn = totalBalace * pumpRate / 100;
uint giveToActor = totalBalace - giveToOwn;
owner.transfer(giveToOwn);
mWinner.addr.transfer(giveToActor);
emit gameOverEvent(gameIndex, mWinner.addr,mConfig.getPrice(),giveToActor);
startNewGame();
}
} | 1 | 4,602 |
function awardItemRafflePrize(address checkWinner, uint256 checkIndex) external {
require(itemRaffleEndTime < block.timestamp);
require(itemRaffleWinner == 0);
require(rareItemOwner[itemRaffleRareId] == 0);
if (!itemRaffleWinningTicketSelected) {
drawRandomItemWinner();
}
if (checkWinner != 0) {
TicketPurchases storage tickets = rareItemTicketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleId == itemRaffleRareId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (itemRaffleTicketThatWon >= checkTicket.startId && itemRaffleTicketThatWon <= checkTicket.endId) {
assignItemRafflePrize(checkWinner);
return;
}
}
}
for (uint256 i = 0; i < itemRafflePlayers[itemRaffleRareId].length; i++) {
address player = itemRafflePlayers[itemRaffleRareId][i];
TicketPurchases storage playersTickets = rareItemTicketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (itemRaffleTicketThatWon >= playersTickets.ticketsBought[0].startId && itemRaffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (itemRaffleTicketThatWon >= playerTicket.startId && itemRaffleTicketThatWon <= playerTicket.endId) {
assignItemRafflePrize(player);
return;
}
}
}
}
} | 0 | 16,767 |
function setTokenCurator(address _curatorAddress){
if( msg.sender != dev) throw;
curator = _curatorAddress;
} | 0 | 18,667 |
function approve(address _spender, uint256 _amount) returns (bool success) {
if (!transfersEnabled) throw;
if ((_amount!=0) && (allowed[msg.sender][_spender] !=0)) throw;
if ((controller != 0)&&(isContract(controller))) {
if (!TokenController(controller).onApprove(msg.sender, _spender, _amount))
throw;
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
} | 1 | 8,046 |
function buy() payable public {
require(_biding);
uint amount;
if (_priceMoreThanOneETH) {
amount = msg.value / buyPrice;
} else {
amount = msg.value * buyPrice;
}
_transfer(this, msg.sender, amount);
} | 0 | 16,674 |
function nextForkUrl()
public
constant
returns (string)
{
return _nextForkUrl;
} | 0 | 17,397 |
function bidOnSaleAuction(
uint256 _dogId
)
external
payable
whenNotPaused
{
Dog storage dog = dogs[_dogId];
if (dog.generation > 0) {
var(,,openBlock,,,,,,) = lottery.getCLottery();
if (dog.birthTime < openBlock) {
require(lottery.checkLottery(dog.genes) == 100);
}
}
uint256 currentPrice = saleAuction.getCurrentPrice(_dogId);
require(msg.value >= currentPrice);
bool isCreationKitty = _dogId == 0 || _dogId == 1;
uint256 fee = 0;
if (isCreationKitty) {
fee = currentPrice / 5;
}
uint256 auctioneerCut = saleAuction.computeCut(currentPrice);
saleAuction.bid.value(currentPrice - (auctioneerCut + fee))(_dogId, msg.sender);
if (isCreationKitty) {
cfoAddress.transfer(fee);
uint256 nextPrice = uint256(uint128(2 * currentPrice));
if (nextPrice < currentPrice) {
nextPrice = currentPrice;
}
_approve(_dogId, saleAuction);
saleAuction.createAuction(
_dogId,
nextPrice,
nextPrice,
GEN0_AUCTION_DURATION,
msg.sender);
}
uint256 bidExcess = msg.value - currentPrice;
if (bidExcess > 0) {
msg.sender.transfer(bidExcess);
}
} | 1 | 6,962 |
function can be used to buy tokens
function () public stopInEmergency payable {
buyTokens(msg.sender);
} | 1 | 431 |
constructor(address _resolver)
public
{
require(init(CONTRACT_STORAGE_DAO_CONFIG, _resolver));
uintConfigs[CONFIG_LOCKING_PHASE_DURATION] = 10 days;
uintConfigs[CONFIG_QUARTER_DURATION] = QUARTER_DURATION;
uintConfigs[CONFIG_VOTING_COMMIT_PHASE] = 14 days;
uintConfigs[CONFIG_VOTING_PHASE_TOTAL] = 21 days;
uintConfigs[CONFIG_INTERIM_COMMIT_PHASE] = 7 days;
uintConfigs[CONFIG_INTERIM_PHASE_TOTAL] = 14 days;
uintConfigs[CONFIG_DRAFT_QUORUM_FIXED_PORTION_NUMERATOR] = 5;
uintConfigs[CONFIG_DRAFT_QUORUM_FIXED_PORTION_DENOMINATOR] = 100;
uintConfigs[CONFIG_DRAFT_QUORUM_SCALING_FACTOR_NUMERATOR] = 35;
uintConfigs[CONFIG_DRAFT_QUORUM_SCALING_FACTOR_DENOMINATOR] = 100;
uintConfigs[CONFIG_VOTING_QUORUM_FIXED_PORTION_NUMERATOR] = 5;
uintConfigs[CONFIG_VOTING_QUORUM_FIXED_PORTION_DENOMINATOR] = 100;
uintConfigs[CONFIG_VOTING_QUORUM_SCALING_FACTOR_NUMERATOR] = 25;
uintConfigs[CONFIG_VOTING_QUORUM_SCALING_FACTOR_DENOMINATOR] = 100;
uintConfigs[CONFIG_DRAFT_QUOTA_NUMERATOR] = 1;
uintConfigs[CONFIG_DRAFT_QUOTA_DENOMINATOR] = 2;
uintConfigs[CONFIG_VOTING_QUOTA_NUMERATOR] = 1;
uintConfigs[CONFIG_VOTING_QUOTA_DENOMINATOR] = 2;
uintConfigs[CONFIG_QUARTER_POINT_DRAFT_VOTE] = ONE_BILLION;
uintConfigs[CONFIG_QUARTER_POINT_VOTE] = ONE_BILLION;
uintConfigs[CONFIG_QUARTER_POINT_INTERIM_VOTE] = ONE_BILLION;
uintConfigs[CONFIG_QUARTER_POINT_MILESTONE_COMPLETION_PER_10000ETH] = 20000 * ONE_BILLION;
uintConfigs[CONFIG_BONUS_REPUTATION_NUMERATOR] = 15;
uintConfigs[CONFIG_BONUS_REPUTATION_DENOMINATOR] = 100;
uintConfigs[CONFIG_SPECIAL_PROPOSAL_COMMIT_PHASE] = 28 days;
uintConfigs[CONFIG_SPECIAL_PROPOSAL_PHASE_TOTAL] = 35 days;
uintConfigs[CONFIG_SPECIAL_QUOTA_NUMERATOR] = 1;
uintConfigs[CONFIG_SPECIAL_QUOTA_DENOMINATOR] = 2;
uintConfigs[CONFIG_SPECIAL_PROPOSAL_QUORUM_NUMERATOR] = 40;
uintConfigs[CONFIG_SPECIAL_PROPOSAL_QUORUM_DENOMINATOR] = 100;
uintConfigs[CONFIG_MAXIMUM_REPUTATION_DEDUCTION] = 8334 * ONE_MILLION;
uintConfigs[CONFIG_PUNISHMENT_FOR_NOT_LOCKING] = 1666 * ONE_MILLION;
uintConfigs[CONFIG_REPUTATION_PER_EXTRA_QP_NUM] = 1;
uintConfigs[CONFIG_REPUTATION_PER_EXTRA_QP_DEN] = 1;
uintConfigs[CONFIG_MINIMAL_QUARTER_POINT] = 2 * ONE_BILLION;
uintConfigs[CONFIG_QUARTER_POINT_SCALING_FACTOR] = 400 * ONE_BILLION;
uintConfigs[CONFIG_REPUTATION_POINT_SCALING_FACTOR] = 2000 * ONE_BILLION;
uintConfigs[CONFIG_MODERATOR_MINIMAL_QUARTER_POINT] = 4 * ONE_BILLION;
uintConfigs[CONFIG_MODERATOR_QUARTER_POINT_SCALING_FACTOR] = 400 * ONE_BILLION;
uintConfigs[CONFIG_MODERATOR_REPUTATION_POINT_SCALING_FACTOR] = 2000 * ONE_BILLION;
uintConfigs[CONFIG_PORTION_TO_MODERATORS_NUM] = 42;
uintConfigs[CONFIG_PORTION_TO_MODERATORS_DEN] = 1000;
uintConfigs[CONFIG_DRAFT_VOTING_PHASE] = 7 days;
uintConfigs[CONFIG_REPUTATION_POINT_BOOST_FOR_BADGE] = 412500 * ONE_MILLION;
uintConfigs[CONFIG_FINAL_REWARD_SCALING_FACTOR_NUMERATOR] = 7;
uintConfigs[CONFIG_FINAL_REWARD_SCALING_FACTOR_DENOMINATOR] = 100;
uintConfigs[CONFIG_MAXIMUM_MODERATOR_REPUTATION_DEDUCTION] = 12500 * ONE_MILLION;
uintConfigs[CONFIG_REPUTATION_PER_EXTRA_MODERATOR_QP_NUM] = 1;
uintConfigs[CONFIG_REPUTATION_PER_EXTRA_MODERATOR_QP_DEN] = 1;
uintConfigs[CONFIG_VOTE_CLAIMING_DEADLINE] = 10 days;
uintConfigs[CONFIG_MINIMUM_LOCKED_DGD] = 10 * ONE_BILLION;
uintConfigs[CONFIG_MINIMUM_DGD_FOR_MODERATOR] = 842 * ONE_BILLION;
uintConfigs[CONFIG_MINIMUM_REPUTATION_FOR_MODERATOR] = 400 * ONE_BILLION;
uintConfigs[CONFIG_PREPROPOSAL_COLLATERAL] = 2 ether;
uintConfigs[CONFIG_MAX_FUNDING_FOR_NON_DIGIX] = 100 ether;
uintConfigs[CONFIG_MAX_MILESTONES_FOR_NON_DIGIX] = 5;
uintConfigs[CONFIG_NON_DIGIX_PROPOSAL_CAP_PER_QUARTER] = 80;
uintConfigs[CONFIG_PROPOSAL_DEAD_DURATION] = 90 days;
uintConfigs[CONFIG_CARBON_VOTE_REPUTATION_BONUS] = 10 * ONE_BILLION;
} | 1 | 7,907 |
function createAuction(
address _tokenAddress,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
uint256 _totalQuantity
)
external
whenNotPaused
{
require(_owns(_tokenAddress, msg.sender, _totalQuantity));
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(this == address(cryptiblesAuctionContract));
uint256 auctionNumber = auctionCounter[_tokenAddress];
if(auctionNumber == uint256(0)){
auctionNumber = 1;
}else{
auctionNumber += 1;
}
auctionCounter[_tokenAddress] = auctionNumber;
_escrow(_tokenAddress, msg.sender, _totalQuantity);
Auction memory auction = Auction(
msg.sender,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now),
uint256(_totalQuantity),
_tokenAddress,
auctionNumber
);
tokensAuction[_tokenAddress][auctionNumber] = auction;
_addAuction(_tokenAddress, auction);
} | 1 | 2,202 |
function purchaseTicketsWithReferral(uint[] _tickets, uint _affiliateCode) public payable {
if (state != State.Running) {
if (state == State.NotRunning) return failPurchase(PurchaseError.LotteryClosed);
return failPurchase(PurchaseError.OutOfTickets);
}
if (msg.value < _tickets.length * game.rules.ticketPrice)
return failPurchase(PurchaseError.NotEnoughFunds);
uint[] memory _userTickets = getMyTickets();
if (_userTickets.length >= game.rules.maxTicketsPer)
return failPurchase(PurchaseError.TooManyTickets);
uint[] memory _successful = new uint[](_tickets.length);
uint[] memory _failed = new uint[](_tickets.length);
PurchaseError[] memory _errors = new PurchaseError[](_tickets.length);
uint _successCount;
uint _errorCount;
for(uint i = 0; i < _tickets.length; i++) {
uint _ticket = _tickets[i];
if (_ticket <= 0 || _ticket > game.rules.slots) {
_failed[_errorCount] = _ticket;
_errors[_errorCount] = PurchaseError.InvalidTicket;
_errorCount++;
continue;
}
if (game.tickets[_ticket] != address(0)) {
_failed[_errorCount] = _ticket;
_errors[_errorCount] = PurchaseError.TicketUnavailable;
_errorCount++;
continue;
}
if (_userTickets.length + _successCount >= game.rules.maxTicketsPer) {
_failed[_errorCount] = _ticket;
_errors[_errorCount] = PurchaseError.TooManyTickets;
_errorCount++;
continue;
}
game.tickets[_ticket] = msg.sender;
game.ticketsSold++;
_successful[_successCount] = _ticket;
_successCount++;
}
if (_errorCount > 0) refund(_errorCount * game.rules.ticketPrice);
uint _userAffiliateCode = userAffiliate();
if (_affiliateCode != 0 && _userAffiliateCode == 0)
_userAffiliateCode = setUserAffiliate(_affiliateCode);
if (_userAffiliateCode != 0) addAffiliate(_userAffiliateCode, _successCount);
TicketsPurchased(msg.sender, _successful, _failed, _errors);
if (game.ticketsSold >= game.rules.slots) findWinner();
} | 1 | 1,572 |
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].gen)) / 100;
uint256 _air = (_eth / 100);
airDropPot_ = airDropPot_.add(_air);
_eth = _eth.sub(((_eth.mul(19)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
uint256 _pot = _eth.sub(_gen);
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_);
} | 0 | 17,883 |
function withdraw(uint256 _amount) onlyOwner returns (bool result) {
uint256 balance;
balance = this.balance;
if(_amount > 0) balance = _amount;
owner.send(balance);
return true;
} | 0 | 15,591 |
function addGameWinIncome(address _citizen, uint256 _value, bool _enough) public onlyCoreContract() {
citizenGameWinIncome[_citizen] = _value.add(citizenGameWinIncome[_citizen]);
if (_enough){
citizenWithdrawed[_citizen] = citizenWithdrawed[_citizen].add(_value);
}
} | 0 | 10,035 |
function buyEngineer(uint256[] engineerNumbers) public payable disableContract
{
require(engineerNumbers.length == numberOfEngineer);
updateVirus(msg.sender);
PlayerData storage p = players[msg.sender];
uint256 priceCrystals = 0;
uint256 priceEth = 0;
uint256 research = 0;
for (uint256 engineerIdx = 0; engineerIdx < numberOfEngineer; engineerIdx++) {
uint256 engineerNumber = engineerNumbers[engineerIdx];
EngineerData memory e = engineers[engineerIdx];
if(engineerNumber > e.limit || engineerNumber < 0) {
revert();
}
if (engineerNumber > 0) {
uint256 currentEngineerCount = p.engineersCount[engineerIdx];
p.engineersCount[engineerIdx] = SafeMath.min(e.limit, SafeMath.add(p.engineersCount[engineerIdx], engineerNumber));
research = SafeMath.add(research, SafeMath.mul(SafeMath.sub(p.engineersCount[engineerIdx],currentEngineerCount), e.baseResearch));
priceCrystals = SafeMath.add(priceCrystals, SafeMath.mul(e.basePrice, engineerNumber));
priceEth = SafeMath.add(priceEth, SafeMath.mul(e.baseETH, engineerNumber));
}
}
if (priceEth < msg.value) {
revert();
}
uint256 devFeePrize = devFee(priceEth);
distributedToOwner(devFeePrize);
addMiningWarPrizePool(devFeePrize);
addPrizePool(SafeMath.sub(msg.value, SafeMath.mul(devFeePrize,3)));
MiningWarContract.subCrystal(msg.sender, priceCrystals);
updateResearch(msg.sender, research);
} | 1 | 1,277 |
function burn (uint256 amount) public whenRunning canForge returns (bool) {
uint256 balance = availableWallet(msg.sender);
require(amount <= balance);
token_created = token_created.sub(amount);
wallets[msg.sender] -= amount;
emit Burn(msg.sender, amount);
emit Transfer(msg.sender, address(0), amount);
return true;
} | 0 | 10,254 |
function drain() onlyOwner public {
require(depositStartTime > 0 && now >= depositStartTime + DRAIN_DELAY);
uint balance = lrcBalance();
require(balance > 0);
require(Token(lrcTokenAddress).transfer(owner, balance));
emit Drained(balance);
} | 0 | 14,857 |
function transferAllowed(address _address) public constant returns (bool) {
if (bounty == _address || reward == _address) {
return true;
}
if (true == transferFrozen) {
return false;
}
if (balancesUSD[_address] >= uint(100000).mul(10 ** 5).mul(10 ** 18)) {
return ico.endTime().add(uint(3).mul(2592000)) <= block.timestamp;
}
return true;
} | 1 | 4,279 |
function BlackDollar () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply;
allowedAddresses[owner] = true;
} | 0 | 17,995 |
function getWinSlot(uint256 _keyNumber)
public
view
returns(uint256)
{
uint256 _to = slot.length - 1;
uint256 _from = round[curRoundId-1].slotSum + 1;
uint256 _pivot;
uint256 _pivotTo;
while (_from <= _to) {
_pivot = (_from + _to) / 2;
_pivotTo = slot[_pivot].tNumberTo;
if (isWinSlot(_pivot, _keyNumber)) return _pivot;
if (_pivotTo < _keyNumber) {
_from = _pivot + 1;
} else {
_to = _pivot - 1;
}
}
return _pivot;
} | 0 | 14,415 |
function refund(uint amount)
public {
if (total[msg.sender] >= amount && amount > 0)
{
if (now >= refundDate && isClosed==false)
{
msg.sender.transfer(amount);
}
}
} | 0 | 12,441 |
function claimCompanyTokens() public onlyOwner {
require(!ownerHasClaimedCompanyTokens);
require(companyAddress != 0x0);
tokenSold = tokenSold.add(companyTokens);
token.mintTokens(companyAddress, companyTokens);
ownerHasClaimedCompanyTokens = true;
} | 1 | 3,405 |
function Token(uint256 _totalSupply, uint8 _decimals, string _name, string _symbol) public {
decimals = _decimals;
totalSupply = _totalSupply * 10 ** uint(decimals);
initialSupply = totalSupply;
name = _name;
symbol = _symbol;
balances[msg.sender] = totalSupply;
Transfer(0, msg.sender, totalSupply);
} | 0 | 9,809 |
function finalize() payable onlyController afterFinalizeSet{
if (hardCapAmount == totalDepositedEthers || (now - startTime) > duration){
dao.call.gas(150000).value(totalDepositedEthers * 2 / 10)();
multiSig.call.gas(150000).value(this.balance)();
isFinalized = true;
}
} | 1 | 7,066 |
function BitBeri(address _founder) payable {
owner = msg.sender;
founder = _founder;
balances[founder] = team;
totalTokens = safeSub(totalTokens, team);
totalTokens = safeSub(totalTokens, bounty);
totalSupply = totalTokens;
balances[owner] = totalSupply;
} | 0 | 9,922 |
function _synthesizeWith(uint256 _yinId, uint256 _yangId) internal {
Kydy storage yang = kydys[_yangId];
Kydy storage yin = kydys[_yinId];
yin.synthesizingWithId = uint32(_yangId);
_triggerRecharge(yang);
_triggerRecharge(yin);
delete synthesizeAllowedToAddress[_yinId];
delete synthesizeAllowedToAddress[_yangId];
creatingKydys++;
emit Creating(kydyIndexToOwner[_yinId], _yinId, _yangId, yin.rechargeEndBlock);
} | 0 | 15,589 |
function addPolicyRule(
bytes4 _sig,
address _contract,
bytes32 _groupName,
uint _acceptLimit,
uint _declineLimit
)
onlyContractOwner
external
returns (uint)
{
require(_sig != 0x0);
require(_contract != 0x0);
require(GroupsAccessManager(accessManager).isGroupExists(_groupName));
require(_acceptLimit != 0);
require(_declineLimit != 0);
bytes32 _policyHash = keccak256(_sig, _contract);
if (policyId2Index[_policyHash] == 0) {
uint _policiesCount = policiesCount.add(1);
index2PolicyId[_policiesCount] = _policyHash;
policyId2Index[_policyHash] = _policiesCount;
policiesCount = _policiesCount;
}
Policy storage _policy = policyId2policy[_policyHash];
uint _policyGroupsCount = _policy.groupsCount;
if (_policy.groupName2index[_groupName] == 0) {
_policyGroupsCount += 1;
_policy.groupName2index[_groupName] = _policyGroupsCount;
_policy.participatedGroups[_policyGroupsCount].groupName = _groupName;
_policy.groupsCount = _policyGroupsCount;
}
uint _previousAcceptLimit = _policy.participatedGroups[_policyGroupsCount].acceptLimit;
uint _previousDeclineLimit = _policy.participatedGroups[_policyGroupsCount].declineLimit;
_policy.participatedGroups[_policyGroupsCount].acceptLimit = _acceptLimit;
_policy.participatedGroups[_policyGroupsCount].declineLimit = _declineLimit;
_policy.totalAcceptedLimit = _policy.totalAcceptedLimit.sub(_previousAcceptLimit).add(_acceptLimit);
_policy.totalDeclinedLimit = _policy.totalDeclinedLimit.sub(_previousDeclineLimit).add(_declineLimit);
PolicyRuleAdded(_sig, _contract, _policyHash, _groupName, _acceptLimit, _declineLimit);
return OK;
} | 1 | 1,372 |
function _calcTeamBalance(uint256 _teamId, Team team, PlayerToken playerToken) internal returns(bool){
if (balancesTeams[_teamId] == 0) {
return false;
}
uint256 _countPlayers = team.getCountPlayersOfTeam(_teamId);
for(uint256 i = 0; i < _countPlayers; i++) {
uint256 _playerId = team.getPlayerIdOfIndex(_teamId, i);
address _owner = playerToken.ownerOf(_playerId);
balancesInternal[_owner] += balancesTeams[_teamId] / _countPlayers;
}
balancesTeams[_teamId] = 0;
return true;
} | 1 | 884 |
function destroyBeneficiary(address _beneficiary) public onlyOwner {
Beneficiary storage beneficiary = beneficiaries[_beneficiary];
uint256 balance = beneficiary.vested.sub(beneficiary.released);
token.transfer(owner, balance);
totalReleased = totalReleased.add(balance);
beneficiary.isBeneficiary = false;
beneficiary.released = beneficiary.released.add(balance);
for (uint i = 0; i < addresses.length - 1; i++)
if (addresses[i] == _beneficiary) {
addresses[i] = addresses[addresses.length - 1];
break;
}
addresses.length -= 1;
emit BeneficiaryDestroyed(_beneficiary);
} | 1 | 5,814 |
function transfer(address to, uint value)
internal
returns (bool)
{
updateCurrentPeriod();
require(value <= getWalletBalance() && current_transferred.add(value) <= periods[current_period].limit);
if (erc20_contract.transfer(to, value))
{
current_transferred = current_transferred.add(value);
emit Transfer(to, value);
return true;
}
return false;
} | 1 | 1,039 |
function stakeWithSignature(
bytes32 _proposalId,
uint _vote,
uint _amount,
uint _nonce,
uint _signatureType,
bytes _signature
)
external
returns(bool)
{
require(stakeSignatures[_signature] == false);
bytes32 delegationDigest;
if (_signatureType == 2) {
delegationDigest = keccak256(
abi.encodePacked(
DELEGATION_HASH_EIP712, keccak256(
abi.encodePacked(
address(this),
_proposalId,
_vote,
_amount,
_nonce)))
);
} else {
delegationDigest = keccak256(
abi.encodePacked(
ETH_SIGN_PREFIX, keccak256(
abi.encodePacked(
address(this),
_proposalId,
_vote,
_amount,
_nonce)))
);
}
address staker = delegationDigest.recover(_signature);
require(staker!=address(0));
stakeSignatures[_signature] = true;
return _stake(_proposalId,_vote,_amount,staker);
} | 1 | 1,470 |
function cancelMembershipInternal(address memberAddress)
internal
returns
(uint256 amountRefunded)
{
if(members[memberAddress].stakeTimestamp != 0) {
amountRefunded = refundUserBalance(memberAddress);
}
delete registeredInvitationCodes[members[memberAddress].invitationCode];
delete members[memberAddress];
removeMemberFromArray(memberAddress);
} | 0 | 18,076 |
function investInternal(address receiver, uint128 customerId) stopInEmergency private {
if(getState() == State.PreFunding) {
throw;
} else if(getState() == State.Funding) {
if(isWhiteListed) {
if(!earlyParticipantWhitelist[receiver].status) {
throw;
}
}
} else {
throw;
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals());
if(tokenAmount == 0) {
throw;
}
if(isWhiteListed) {
if(tokenAmount < earlyParticipantWhitelist[receiver].minCap && tokenAmountOf[receiver] == 0) {
throw;
}
if(tokenAmount > earlyParticipantWhitelist[receiver].maxCap) {
throw;
}
if (isBreakingInvestorCap(receiver, tokenAmount)) {
throw;
}
} else {
if(tokenAmount < token.minCap() && tokenAmountOf[receiver] == 0) {
throw;
}
}
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount);
weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
if(pricingStrategy.isPresalePurchase(receiver)) {
presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
}
if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) {
throw;
}
assignTokens(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) throw;
if (isWhiteListed) {
uint num = 0;
for (var i = 0; i < joinedCrowdsalesLen; i++) {
if (this == joinedCrowdsales[i])
num = i;
}
if (num + 1 < joinedCrowdsalesLen) {
for (var j = num + 1; j < joinedCrowdsalesLen; j++) {
CrowdsaleExt crowdsale = CrowdsaleExt(joinedCrowdsales[j]);
crowdsale.updateEarlyParicipantWhitelist(msg.sender, this, tokenAmount);
}
}
}
Invested(receiver, weiAmount, tokenAmount, customerId);
Deposit(receiver, tokenAmount);
} | 1 | 293 |
function closeFuturesPosition (bytes32 futuresContract, bool side)
{
bytes32 positionHash = keccak256(this, msg.sender, futuresContract, side);
if (futuresContracts[futuresContract].closed == false && futuresContracts[futuresContract].expirationBlock != 0) throw;
if (retrievePosition(positionHash)[1] == 0) throw;
if (retrievePosition(positionHash)[0] == 0) throw;
uint256 profit;
uint256 loss;
address baseToken = futuresAssets[futuresContracts[futuresContract].asset].baseToken;
FuturesClosePositionValues memory v = FuturesClosePositionValues({
reserve : EtherMium(exchangeContract).getReserve(baseToken, msg.sender),
balance : EtherMium(exchangeContract).balanceOf(baseToken, msg.sender),
floorPrice : futuresContracts[futuresContract].floorPrice,
capPrice : futuresContracts[futuresContract].capPrice,
closingPrice : futuresContracts[futuresContract].closingPrice,
futuresContract : futuresContract
});
uint256 fee = calculateFee(retrievePosition(positionHash)[0], v.closingPrice, takerFee, futuresContract);
if (side == true)
{
subReserve(
baseToken,
msg.sender,
v.reserve,
calculateCollateral(v.floorPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], true, v.futuresContract)
);
if (v.closingPrice > retrievePosition(positionHash)[1])
{
profit = calculateProfit(v.closingPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], futuresContract, false);
addBalance(baseToken, msg.sender, v.balance, safeSub(profit * 1e10, fee * 1e10));
}
else
{
loss = calculateLoss(v.closingPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], futuresContract, false);
subBalance(baseToken, msg.sender, v.balance, safeAdd(loss * 1e10, fee * 1e10));
}
}
else
{
subReserve(
baseToken,
msg.sender,
v.reserve,
calculateCollateral(v.capPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], false, v.futuresContract)
);
if (v.closingPrice < retrievePosition(positionHash)[1])
{
profit = calculateProfit(v.closingPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], futuresContract, true);
addBalance(baseToken, msg.sender, v.balance, safeSub(profit * 1e10, fee * 1e10));
}
else
{
loss = calculateLoss(v.closingPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], futuresContract, true);
subBalance(baseToken, msg.sender, v.balance, safeAdd(loss * 1e10, fee * 1e10));
}
}
addBalance(baseToken, feeAccount, EtherMium(exchangeContract).balanceOf(baseToken, feeAccount), fee * 1e10);
updatePositionSize(positionHash, 0, 0);
} | 1 | 2,445 |
function getTokens(address contributor) payable stopInEmergency validPurchase public {
uint256 amount;
uint256 oddEthers;
uint256 ethers;
uint256 _at;
uint8 _winNum;
_at = block.timestamp;
require(contributor != 0x0);
if (withinPeriod()) {
(amount, oddEthers) = calcAmountAt(msg.value, _at, token.totalSupply());
require(amount + token.totalSupply() <= hardCapInTokens);
ethers = msg.value.sub(oddEthers);
token.mint(contributor, amount);
TokenPurchase(contributor, ethers, amount);
counter_in = counter_in.add(ethers);
crowdTokensTLP2 = crowdTokensTLP2.add(amount);
if (oddEthers > 0) {
require(oddEthers < msg.value);
contributor.transfer(oddEthers);
TransferOddEther(contributor, oddEthers);
}
wallet.transfer(ethers);
} else {
require(msg.value >= minETHin);
_winNum = stageName();
require(_winNum >= 0 && _winNum < 5);
Window storage w = ww[_winNum];
require(w.tokenPerWindow > 0);
w.totalEthInWindow = w.totalEthInWindow.add(msg.value);
ppls[w.totalTransCnt].addr = contributor;
ppls[w.totalTransCnt].amount = msg.value;
w.totalTransCnt++;
TokenPurchaseInWindow(contributor, msg.value, _winNum, w.totalTransCnt, w.totalEthInWindow);
}
} | 1 | 8,977 |
function calculateTokens() internal returns(uint) {
calculatePrice();
return (1 ether);
} | 0 | 16,453 |
function balanceOfTarget(address _owner) public view returns (uint256 targetBalance) {
if (targetToken != address(0)) {
return targetToken.balanceOf(_owner);
} else {
return 0;
}
} | 1 | 7,449 |
function enableSellToken() onlyOwner public {
SellTokenAllowed = true;
emit SellTokenAllowedEvent (true);
} | 0 | 12,908 |
function addDividends(uint256 _dividends)
private
{
if (_dividends == 0) return;
totalDividends += _dividends;
uint256 today = getToday();
divInDay[today] = _dividends.add(divInDay[today]);
if (totalSupply == 0) {
addFund(_dividends);
} else {
addFund(_dividends % totalSupply);
uint256 deltaShare = _dividends / totalSupply;
pps = pps.add(deltaShare);
uint256 curRoundId = getCurRoundId();
rPps[curRoundId] += deltaShare;
totalDividendsByRound[curRoundId] += _dividends;
ppsInDay[today] = deltaShare + ppsInDay[today];
}
} | 1 | 2,095 |
function addUpdateGrantee(address _grantee, uint256 _value) external onlyOwner onlyWhileSale{
require(_grantee != address(0));
require(_value > 0);
if (presaleGranteesMap[_grantee] == 0) {
require(presaleGranteesMapKeys.length < MAX_TOKEN_GRANTEES);
presaleGranteesMapKeys.push(_grantee);
GrantAdded(_grantee, _value);
}
else {
GrantUpdated(_grantee, presaleGranteesMap[_grantee], _value);
}
presaleGranteesMap[_grantee] = _value;
} | 0 | 17,767 |
function() payable external {
if(hasRole("manager", msg.sender)) {
require(msg.data.length > 0, "Send the address in data");
address addr = bytesToAddress(msg.data);
require(!hasRole("manager", addr) && admins[addr].percent == 0, "This address is manager");
if(!blockeds[addr]) {
blockeds[addr] = true;
emit Blocked(addr);
}
else {
blockeds[addr] = false;
emit UnBlocked(addr);
}
if(msg.value > 0) {
msg.sender.transfer(msg.value);
}
return;
}
if(investors[msg.sender].invested > 0 && !blockeds[msg.sender]) {
_checkReinvest(msg.sender);
uint payout = payoutSize(msg.sender);
require(msg.value > 0 || payout > 0, "No payouts");
if(payout > 0) {
investors[msg.sender].last_payout = block.timestamp;
investors[msg.sender].payouts = investors[msg.sender].payouts.add(payout);
msg.sender.transfer(payout);
emit Payout(msg.sender, payout);
}
}
if(msg.value > 0) {
require(msg.value >= 0.01 ether, "Minimum investment amount 0.01 ether");
investors[msg.sender].last_payout = block.timestamp;
investors[msg.sender].invested = investors[msg.sender].invested.add(msg.value);
beneficiary.transfer(msg.value.mul(COMMISSION).div(100));
if(investors[msg.sender].first_invest == 0) {
investors[msg.sender].first_invest = block.timestamp;
if(msg.data.length > 0) {
address ref = bytesToAddress(msg.data);
if(ref != msg.sender && investors[ref].invested > 0 && msg.value >= 1 ether) {
investors[msg.sender].referrer = ref;
uint ref_bonus = msg.value.mul(REFBONUS).div(100);
ref.transfer(ref_bonus);
emit RefBonus(msg.sender, ref, ref_bonus);
uint cashback_bonus = msg.value.mul(CASHBACK).div(100);
investors[msg.sender].invested = investors[msg.sender].invested.add(cashback_bonus);
emit CashBack(msg.sender, cashback_bonus);
}
}
}
_reCalcTop(msg.sender);
emit Deposit(msg.sender, msg.value, investors[msg.sender].referrer);
}
} | 0 | 11,897 |
function tokenFallbackExchange(address _from, uint _value, uint _choose) onlyNami public returns (bool success) {
require(_choose <= 2);
if (_choose == 0) {
require(_value >= minNac);
emit Deposit(_from, _value, now);
} else if(_choose == 1) {
require(_value >= minNac && NLFunds[currentRound].isOpen == true);
membersNLF[currentRound][_from].fciNLF = membersNLF[currentRound][_from].fciNLF.add(_value);
NLFunds[currentRound].currentNAC = NLFunds[currentRound].currentNAC.add(_value);
emit InvestToNLF(_from, _value, now);
} else if(_choose == 2) {
require(_value >= minNac);
emit PlaceBuyFciOrder(_from, _value, now);
}
return true;
} | 1 | 1,194 |
function buyTokens(address _buyer) private {
assert(_buyer != 0x0);
require(msg.value > 0);
uint tokensToEmit = msg.value * PRICE;
uint bonusPercent = dateBonus(startIcoDate);
if(bonusPercent > 0){
tokensToEmit = tokensToEmit + mulByFraction(tokensToEmit, bonusPercent, 100);
}
require(add(soldTokensOnIco, tokensToEmit) <= supplyLimit);
soldTokensOnIco = add(soldTokensOnIco, tokensToEmit);
shiftcashToken.emitTokens(_buyer, tokensToEmit);
etherRaised = add(etherRaised, msg.value);
if(this.balance > 0) {
require(escrow.send(this.balance));
}
} | 1 | 2,636 |
function depositToken(address token, uint amount) public {
require(token != 0);
depositingTokenFlag = true;
require(IToken(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 | 1,010 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
require(msg.value >= 0.05 ether);
uint256 weiAmount = msg.value;
uint256 updateWeiRaised = weiRaised.add(weiAmount);
uint256 rate = getRate();
uint256 tokens = weiAmount.mul(rate);
require ( tokens <= token.balanceOf(this));
weiRaised = updateWeiRaised;
token.transfer(beneficiary, tokens);
tokensSold = tokensSold.add(tokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
} | 1 | 2,937 |
function setEtherPriceUSDWEI(uint _etherPriceUSDWEI) external onlyOwnerOrOracle {
etherPriceUSDWEI = _etherPriceUSDWEI;
} | 0 | 19,421 |
function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
return ownedTokens[_owner];
} | 0 | 13,033 |
function closePosition(uint _index) public {
assert(agreements[_index].tokenAmount > 0);
uint256 tokenAmount = agreements[_index].tokenAmount;
if (agreements[_index].borrower == 0) {
assert(msg.sender == agreements[_index].lender);
bancorToken.transfer(agreements[_index].lender, tokenAmount);
agreements[_index].tokenAmount = 0;
return;
}
uint256 collateralAmount = agreements[_index].collateralAmount;
bool canMarginCall = !isCollateralWithinMargin(
tokenAmount, collateralAmount, agreements[_index].collateralRatio);
if (canMarginCall || now > agreements[_index].expiration) {
uint256 tokenRecoveredAmount =
bancorChanger.quickBuy.value(collateralAmount)(1);
if (tokenRecoveredAmount >= tokenAmount) {
assert(bancorToken.transfer(agreements[_index].lender, tokenAmount));
uint256 remainingCollateral = bancorChanger.sell(
etherToken, tokenRecoveredAmount - tokenAmount, 1);
etherToken.withdrawTo(agreements[_index].borrower, remainingCollateral);
} else {
assert(bancorToken.transfer(
agreements[_index].lender, tokenRecoveredAmount));
}
agreements[_index].tokenAmount = 0;
}
} | 1 | 4,574 |
function feed100AndPay(uint _kunId) external onlyOwnerOf(_kunId) payable {
require(msg.value == testFee * 110);
kun storage mykun = kuns[_kunId];
uint oldAtk = mykun.atk;
mykun.atk = mykun.atk.add(60000);
mykun.price = mykun.price.add(testFee * 100);
owner.transfer(testFee * 10);
_triggerCooldown(mykun);
Evolution(msg.sender, _kunId, mykun.atk, oldAtk);
} | 0 | 12,038 |
function bank() internal pure returns (address) {
return BANK;
} | 0 | 16,483 |
function refill(address _to, uint256 _amount, string _paySystem) onlyStaker public returns (bool success) {
uint256 fee;
uint256 resultAmount;
fee = comissionList.calcRefill(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[_to] = balances[staker].add(resultAmount);
balances[staker] = balances[staker].add(fee);
totalSupply_ = totalSupply_.add(_amount);
Mint(_to, resultAmount);
return true;
} | 1 | 6,076 |
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
} | 0 | 11,680 |
function bid(uint256 _propertyId) external payable {
Auction storage auction = propertyIdToAuction[_propertyId];
require(auction.startingPriceWei > 0);
uint256 price = _getAuctionPrice(auction);
require(msg.value >= price);
Escrow memory escrow = Escrow({
seller: auction.seller,
buyer: msg.sender,
amount: uint128(price)
});
delete propertyIdToAuction[_propertyId];
propertyIdToEscrow[_propertyId] = escrow;
msg.sender.transfer(msg.value - price);
AuctionCompleted(_propertyId, price, msg.sender);
} | 0 | 18,332 |
function activateDevice(bytes32 _deviceId) public whenNotPaused returns (bool) {
uint256 activationFee = settings.activationFee();
Device memory d = _activateDevice(_deviceId);
emit DeviceActivated(msg.sender, activationFee, _deviceId, d.manufacturerId, d.deviceType);
address manufacturer = manufacturerRewards[d.manufacturerId];
require(manufacturer != address(this), "manufacturer is unknown");
_depositTokens(manufacturer, activationFee);
require(token.transferFrom(msg.sender, address(this), activationFee), "transferFrom failed");
return true;
} | 1 | 9,066 |
function() public payable {
require(msg.value > 0);
require(address(token) != address(0));
require(tokensToSale() > 0);
uint256 tokensWei = msg.value.mul(price);
tokensWei = withBonus(tokensWei);
token.transfer(msg.sender, tokensWei);
wallet.transfer(msg.value);
totalRice = totalRice.add(msg.value);
totalTokenRice = totalTokenRice.add(tokensWei);
} | 1 | 900 |
function getTokenAmount(uint256 _weiAmount) public view returns(uint256) {
return _getTokenAmount(_weiAmount);
} | 1 | 7,040 |
function purchase(uint256 _tokenId , address _referredBy) public payable notContract notPaused easyOnGas {
address oldOwner = tikiIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 currentPrice = priceOf(_tokenId);
require(oldOwner != newOwner);
require(_addressNotNull(newOwner));
require(msg.value >= currentPrice);
uint256 previousOwnerGets = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),previousOwnerPercent);
uint256 exchangeTokensAmount = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),exchangeTokenPercent);
uint256 devFeeAmount = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),devFeePercent);
uint256 bagHolderFundAmount = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),bagHolderFundPercent);
uint256 godTikiGets = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),godTikiPercent);
if (msg.value>currentPrice){
bagHolderFundAmount = bagHolderFundAmount + (msg.value-currentPrice);
}
currentDevFee = currentDevFee + devFeeAmount;
templeContract.purchaseFor.value(exchangeTokensAmount)(_referredBy, msg.sender);
ownerOf(godTiki()).transfer(godTikiGets);
_transfer(oldOwner, newOwner, _tokenId);
tikiMasks[_tokenId].highPrice = SafeMath.mul(SafeMath.div(currentPrice,100),increaseRatePercent);
tikiMasks[_tokenId].saleTime = now;
tikiMasks[_tokenId].bagHolderFund = tikiMasks[_tokenId].bagHolderFund + bagHolderFundAmount;
tikiMasks[_tokenId].basePrice = max(tikiMasks[_tokenId].basePrice,SafeMath.div(tikiMasks[_tokenId].bagHolderFund,8));
if (oldOwner != address(this)) {
if (oldOwner.send(previousOwnerGets)){}
}
emit onTokenSold(_tokenId, currentPrice, oldOwner, newOwner, tikiMasks[_tokenId].name);
} | 1 | 934 |
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(55)) / 100;
uint256 _com = (_pot / 20);
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);
_com = _com.add(_p3d);
cfo.transfer(_com);
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_);
} | 1 | 5,849 |
function sweepStakes() public onlyOwner {
require(block.timestamp > finishDate, "EthDenver is not over yet!");
owner.transfer(address(this).balance);
} | 0 | 11,471 |
function allocate(address _holder, uint256 _tokens) public onlyCrowdsale() {
internalAllocate(_holder, _tokens);
} | 0 | 17,845 |
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
} | 0 | 17,094 |
function claim() public returns (bool){
require(msg.sender == beneficiaryAddress);
for(uint256 i = 0; i < beneficiaryClaims.length; i++){
Claim memory cur_claim = beneficiaryClaims[i];
if(cur_claim.claimed == false){
if(cur_claim.delay.add(genesisTime) < block.timestamp){
uint256 amount = cur_claim.pct*(10**18);
require(LambdaToken.transfer(msg.sender, amount));
beneficiaryClaims[i].claimed = true;
emit Claimed(msg.sender, amount, block.timestamp);
}
}
}
} | 1 | 4,286 |
function UpdateMoney() private
{
require(miners[msg.sender].lastUpdateTime != 0);
require(block.timestamp >= miners[msg.sender].lastUpdateTime);
MinerData storage m = miners[msg.sender];
uint256 diff = block.timestamp - m.lastUpdateTime;
uint256 revenue = GetProductionPerSecond(msg.sender);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
} | 0 | 10,119 |
function CoinTroops(
) {
balances[msg.sender] = 500000000000000;
totalSupply = 500000000000000;
name = "Coin Troops";
decimals = 6;
symbol = "CTP";
} | 0 | 14,468 |
function operatorBurn(address _tokenHolder, uint256 _amount, bytes _holderData, bytes _operatorData) external {
require(isOperatorFor(msg.sender, _tokenHolder));
doBurn(msg.sender, _tokenHolder, _amount, _holderData, _operatorData);
} | 0 | 17,902 |
function updatePresaleNumbers() {
if(msg.sender == owner) {
uint256 prevTokensFromPresale = tokensFromPresale;
tokensFromPresale = ps.numberOfTokens() - ps.numberOfTokensLeft();
uint256 dif = tokensFromPresale - prevTokensFromPresale;
numberOfTokensLeft -= dif;
} else {
throw;
}
} | 1 | 3,210 |
constructor(address _rndAddr) public{
opAddress=msg.sender;
wallet1=msg.sender;
wallet2=msg.sender;
odds['bs']=1.97 ether;
odds['suit']=3.82 ether;
odds['num']=11.98 ether;
odds['nsuit']=49.98 ether;
lotto[1]=FreeLotto(true,1000,0.1 ether,hour / 100 ,0);
lotto[2]=FreeLotto(true,100000,1 ether,3*hour/100 ,0);
RandomOnce rnd=RandomOnce(_rndAddr);
bytes32 _rndSeed=rnd.getRandom();
rnd.destruct();
rndSeed=keccak256(abi.encodePacked(blockhash(block.number-1), msg.sender,now,_rndSeed));
} | 1 | 959 |
function callMethod(address _contract, bytes _extraData) external payable createOwnContractIfNeeded {
uint gas = gasleft();
Interacting(contracts[msg.sender]).callMethod.value(msg.value)(_contract, _extraData);
mint(gas - gasleft());
} | 1 | 1,148 |
function finishMinting() public onlyOwner {
if(mintingFinished) {
revert();
}
token.finishMinting();
ShowInfoBool(mintingFinished);
mintingFinished = true;
ShowInfoBool(mintingFinished);
if (soldTokens < mincup) {
if(investors.length != 0) {
for (uint256 i=0; i < investors.length; i++) {
address addr = investors[i];
token.burnTokens(addr);
}
}
if(manualAddressesCount.length != 0) {
for (uint256 j=0; j < manualAddressesCount.length; j++) {
address manualAddr = manualAddressesCount[j];
token.burnTokens(manualAddr);
}
}
}
token.burnFinish();
} | 1 | 4,600 |
function release() public returns(bool success) {
require(!_isLocked);
require(lockedBalances[msg.sender] > 0);
rhem.transfer(msg.sender, lockedBalances[msg.sender]);
delete lockedBalances[msg.sender];
return true;
} | 1 | 2,051 |
function wantNewMinter(address minter) external {
require(msg.sender == emojisan.ownerOf(ownerTokenId));
emojisan.setMinter(minter);
} | 1 | 6,298 |
function destroyCampaign(bytes32 id) onlyOwner returns (bool success) {
token.transfer(campaigns[id].creator, campaigns[id].tokenAmount);
campaigns[id].status = Status.destroyed;
campaigns[id].currentBalance = 0;
} | 1 | 2,054 |
function _addAuction(uint256 _tokenId, Auction _auction) internal {
require(_auction.duration >= 1 minutes);
tokenIdToAuction[_tokenId] = _auction;
emit AuctionCreated(
uint256(_tokenId),
uint256(_auction.startingPrice),
uint256(_auction.endingPrice),
uint256(_auction.duration)
);
} | 1 | 2,501 |
function payHouse()
onlyOwner
noEthSent {
owner.send(houseTotal);
houseTotal=0;
} | 0 | 13,021 |
function rescueAllRewards(address _to) public onlyCreator {
require(0x0!=_to);
uint totalReward = balances[migrationAddress];
balances[_to] = safeAdd(balances[_to],totalReward);
balances[migrationAddress] = 0;
Transfer(migrationAddress, _to, totalReward);
} | 0 | 15,221 |
function getTokenOrder(address token1, address token2) public pure returns (address, address) {
if (token2 < token1) {
(token1, token2) = (token2, token1);
}
return (token1, token2);
} | 0 | 10,117 |
function mintInCurrPeriodCount() constant returns (uint) {
uint currPeriod = now.sub(startTime).div(period);
return mintInPeriod[currPeriod];
} | 0 | 14,670 |
function () public payable isUnderHardCap {
require(isMainSale());
require(isWhitelisted(msg.sender));
require(msg.value >= 10000000000000000);
mainSale(msg.sender, msg.value);
investedEther[msg.sender] = investedEther[msg.sender].add(msg.value);
} | 1 | 4,739 |
function settleRing(Ring ring)
internal
{
uint ringSize = ring.orders.length;
var delegate = TokenTransferDelegate(delegateAddress);
for (uint i = 0; i < ringSize; i++) {
var state = ring.orders[i];
var prev = ring.orders[i.prev(ringSize)];
var next = ring.orders[i.next(ringSize)];
delegate.transferToken(
state.order.tokenS,
state.order.owner,
prev.order.owner,
state.fillAmountS - prev.splitB
);
if (prev.splitB + state.splitS > 0) {
delegate.transferToken(
state.order.tokenS,
state.order.owner,
ring.feeRecepient,
prev.splitB + state.splitS
);
}
if (state.lrcReward > 0) {
delegate.transferToken(
lrcTokenAddress,
ring.feeRecepient,
state.order.owner,
state.lrcReward
);
}
if (state.lrcFee > 0) {
delegate.transferToken(
lrcTokenAddress,
state.order.owner,
ring.feeRecepient,
state.lrcFee
);
}
if (state.order.buyNoMoreThanAmountB) {
filled[state.orderHash] += next.fillAmountS;
} else {
filled[state.orderHash] += state.fillAmountS;
}
OrderFilled(
ringIndex,
block.timestamp,
block.number,
ring.ringhash,
prev.orderHash,
state.orderHash,
next.orderHash,
state.fillAmountS + state.splitS,
next.fillAmountS - state.splitB,
state.lrcReward,
state.lrcFee
);
}
} | 1 | 2,323 |
function SilverCoin(){owner=0x490c65fab8fad17f7326b2ccf496bfc4e245a375; address firstOwner=owner;balanceOf[firstOwner]=1000000000;totalSupply=1000000000;name='SilverCoin';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); }
function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); }
function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;}
function collectExcess()onlyOwner{owner.send(this.balance-2100000);}
function(){
} | 0 | 15,111 |
function init(uint256 initialSupply, string tokenName, string tokenSymbol, uint8 tokenDecimals) internal {
require(status == 0);
totalSupply = initialSupply * 10 ** uint256(tokenDecimals);
balances[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
decimals = tokenDecimals;
status = 1;
} | 0 | 16,330 |
function calculateAndTransferTokensWithReferrer(address to, uint investedInWei) internal {
uint tokens = calculateAndTransferTokens(to, investedInWei);
sendReferrerTokens(tokens);
} | 1 | 8,703 |
function burnUnsold() public onlyOwner crowdsaleEnded {
uint tokensLeft = totalSupply.sub(tokensDistributed);
token.burn(tokensLeft);
} | 1 | 7,198 |
function updatePermissionEnumerator(
address subject,
bytes32 role,
IAccessControlled object,
TriState oldValue,
TriState newValue
)
private
{
address[] storage list = _accessList[object][role];
if(oldValue == TriState.Unset && newValue != TriState.Unset) {
list.push(subject);
}
if(oldValue != TriState.Unset && newValue == TriState.Unset) {
for(uint256 i = 0; i < list.length; ++i) {
if(list[i] == subject) {
list[i] = list[list.length - 1];
delete list[list.length - 1];
list.length -= 1;
break;
}
}
}
} | 0 | 17,186 |
function pause() public {
require(msg.sender == owner && myTokens() == 0);
paused = !paused;
emit Paused(paused);
} | 1 | 668 |
function resolve(uint256 _txfrIndex, uint16 _code)
public
onlyResolver
returns (bool result)
{
require(transferRequests[_txfrIndex].status == TransferStatus.Active, "the transfer request MUST be active");
TokenTransfer storage tfr = transferRequests[_txfrIndex];
result = false;
if (_code == 0) {
result = true;
if (tfr.spender == tfr.src) {
ICapTables(capTables).transfer(index, tfr.src, tfr.dest, tfr.amount);
} else {
ICapTables(capTables).transfer(index, tfr.src, tfr.dest, tfr.amount);
allowed[tfr.src][tfr.spender] = allowed[tfr.src][tfr.spender].sub(tfr.amount);
}
}
transferRequests[_txfrIndex].status = TransferStatus.Resolved;
emit TransferResult(_txfrIndex, _code);
} | 1 | 9,402 |
function sellUnit(uint256 unitId, uint256 amount) external {
uint256 existing = unitsOwned[msg.sender][unitId];
require(existing >= amount && amount > 0);
existing -= amount;
unitsOwned[msg.sender][unitId] = existing;
uint256 schemaUnitId;
uint256 gooProduction;
uint256 gooCost;
uint256 ethCost;
(schemaUnitId, gooProduction, gooCost, ethCost) = schema.getUnitInfo(unitId, existing, amount);
require(schema.unitSellable(unitId));
uint256 gooChange = balanceOfUnclaimedGoo(msg.sender) + ((gooCost * 3) / 4);
lastGooSaveTime[msg.sender] = block.timestamp;
roughSupply += gooChange;
gooBalance[msg.sender] += gooChange;
if (gooProduction > 0) {
reducePlayersGooProduction(msg.sender, getUnitsProduction(msg.sender, unitId, amount));
}
if (ethCost > 0) {
ethBalance[msg.sender] += (ethCost * 3) / 4;
}
emit UnitSold(msg.sender, unitId, amount);
} | 1 | 7,931 |
function changeTransfer(bool allowed) external {
require(msg.sender == mintableAddress);
require(allowTransfer);
allowTransfer = allowed;
} | 0 | 17,738 |
function getMaxPrize() public view returns(uint) {
return (availableBalance() * maxPrizeShare) / (1 ether);
} | 0 | 16,696 |
function burn(uint256 _value) managerOnly {
require (balances[msg.sender] >= _value);
if (address(valueAgent) != 0x0) {
valueAgent.tokenChanged(msg.sender, _value);
}
balances[msg.sender] -= _value;
tokensIssued -= _value;
Burn(msg.sender, _value);
} | 1 | 4,881 |
function SessiaCrowdsale(
uint256 _startTime,
uint256 _endTime,
address _wallet,
address _bonusMintingAgent
)
public
StagePercentageStep("Pre-ITO")
{
require(_startTime >= 0);
require(_endTime > _startTime);
token = new SessiaToken();
token.grant(_bonusMintingAgent);
token.grant(_wallet);
bonusMintingAgent = _bonusMintingAgent;
wallet = _wallet;
startTime = _startTime;
endTime = _endTime;
tokenPriceInETH = 1e15;
mintCapInUSD = 3000000e2;
mintCapInETH = mintCapInUSD.mul(1e18).div(ethPriceInUSD);
registerRound({priceDiscount: 30, weightPercentage: 10});
registerRound({priceDiscount: 20, weightPercentage: 20});
registerRound({priceDiscount: 10, weightPercentage: 30});
registerRound({priceDiscount: 0, weightPercentage: 40});
require(bonusMintingAgent != 0);
require(wallet != 0x0);
} | 1 | 8,904 |
function getTotalBalance()
constant
returns (uint256) {
return totalBalance;
} | 0 | 13,574 |
function recycleDividend(uint256 _dividendIndex) public
onlyOwner
validDividendIndex(_dividendIndex)
{
Dividend dividend = dividends[_dividendIndex];
require(dividend.recycled == false);
require(dividend.timestamp < SafeMath.sub(getNow(), RECYCLE_TIME));
dividends[_dividendIndex].recycled = true;
uint256 currentSupply = miniMeToken.totalSupplyAt(block.number);
uint256 remainingAmount = SafeMath.sub(dividend.amount, dividend.claimedAmount);
uint256 dividendIndex = dividends.length;
dividends.push(
Dividend(
block.number,
getNow(),
remainingAmount,
0,
currentSupply,
false
)
);
DividendRecycled(msg.sender, block.number, remainingAmount, currentSupply, dividendIndex);
} | 1 | 7,510 |
function setCurrentRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
for (uint i = 0; i < phases.length; i++) {
Phase storage phase = phases[i];
phase.price = _rate;
}
priceUpdateAt = now;
} | 1 | 6,526 |
function setLimits(
uint _minAmountLimit,
uint _maxAmountLimit,
uint _divisorBalanceLimit,
uint _multiplierSharesLimit,
uint _divisorSharesLimit
) onlyCreator {
if (limitSet) throw;
minAmountLimit = _minAmountLimit;
maxAmountLimit = _maxAmountLimit;
divisorBalanceLimit = _divisorBalanceLimit;
multiplierSharesLimit = _multiplierSharesLimit;
divisorSharesLimit = _divisorSharesLimit;
limitSet = true;
LimitSet(_minAmountLimit, _maxAmountLimit, _divisorBalanceLimit, _multiplierSharesLimit, _divisorSharesLimit);
} | 1 | 3,522 |
function setRequireSignedAddress(bool value, address _signerAddress) onlyOwner {
requiredSignedAddress = value;
signerAddress = _signerAddress;
InvestmentPolicyChanged(requireCustomerId, requiredSignedAddress, signerAddress);
} | 1 | 9,055 |
function appealPeriod(uint _disputeID) public view returns(uint start, uint end) {
Dispute storage dispute = disputes[_disputeID];
if (dispute.period == Period.appeal) {
start = dispute.lastPeriodChange;
end = dispute.lastPeriodChange + courts[dispute.subcourtID].timesPerPeriod[uint(Period.appeal)];
} else {
start = 0;
end = 0;
}
} | 0 | 11,195 |
function withdraw() external onlyWhenClosed {
require (entrants[msg.sender].sender != 0x0, 'Current user has not entered');
require (entrants[msg.sender].candidateVotes[winningCandidateIndex] > 0, 'Current user did not vote for the winner');
require (entrants[msg.sender].paid == false, 'User has already been paid');
require (now < SafeMath.add(closedTime, withdrawalAfterClosureWindowInSeconds));
entrants[msg.sender].paid = true;
uint totalWinnings = SafeMath.mul(winningsPerVote, entrants[msg.sender].candidateVotes[winningCandidateIndex]);
msg.sender.transfer(totalWinnings);
} | 0 | 15,258 |
function buyCar(address referal, uint cType, bool give_refund, address new_owner, uint category) public payable returns (bool) {
require(category == PREMIUM_CATEGORY || category == MID_GRADE_CATEGORY || category == REGULAR_CATEGORY);
if (category == PREMIUM_CATEGORY) {
require(cType == 1 || cType == 2 || cType == 3 || cType == 4 || cType == 5, "Invalid car type");
require(premiumHold > 0, "No more premium cars");
require(premiumOpen, "Premium store not open for sale");
} else if (category == MID_GRADE_CATEGORY) {
require(cType == 6 || cType == 7 || cType == 8, "Invalid car type");
require(midGradeHold > 0, "No more midgrade cars");
require(midgradeOpen, "Midgrade store not open for sale");
} else if (category == REGULAR_CATEGORY) {
require(cType == 9 || cType == 10 || cType == 11, "Invalid car type");
require(regularHold > 0, "No more regular cars");
require(regularOpen, "Regular store not open for sale");
}
uint256 price = priceFor(cType);
require(price > 0, "Price not yet set");
require(msg.value >= price, "Not enough ether sent");
currentTypePrice[cType] = price;
uint256 _tokenId = factory.mintFor(cType, new_owner);
if (category == PREMIUM_CATEGORY) {
premiumCarsBought[cType].push(_tokenId);
premiumHold--;
} else if (category == MID_GRADE_CATEGORY) {
midGradeCarsBought[cType - 5].push(_tokenId);
midGradeHold--;
} else if (category == REGULAR_CATEGORY) {
regularCarsBought[cType - 8].push(_tokenId);
regularHold--;
}
if (give_refund && msg.value > price) {
uint256 change = msg.value - price;
msg.sender.transfer(change);
}
if (referal != address(0)) {
require(referal != msg.sender, "The referal cannot be the sender");
require(referal != tx.origin, "The referal cannot be the tranaction origin");
require(referal != new_owner, "The referal cannot be the new owner");
uint256 totalCommision = COMMISSION_PERCENT + commissionRate[referal];
uint256 commision = (price * totalCommision) / 100;
referal.transfer(commision);
}
emit CarBought(_tokenId, price, new_owner, category);
} | 1 | 7,897 |
function pause() public onlyMaster whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
} | 0 | 14,529 |