func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function setTokenSPUsdCentPrice(uint _tokenSPUsdCentPrice)
{
require(msg.sender == manager);
tokenSPUsdCentPrice = _tokenSPUsdCentPrice;
} | 0 | 16,451 |
function AllyICO () public {
owner = msg.sender;
} | 0 | 11,292 |
function safeSub(uint a, uint b) internal constant returns (uint)
{
assert(b <= a);
return a - b;
} | 0 | 15,081 |
function upgradeCardShield(uint256 _cardId) public {
require(cardShieldUpgradeLevel[_cardId].isLessThan(maxCardUpgradeLevel));
uint256 costOfUpgrade = 32 * (cardShieldUpgradeLevel[_cardId] + 1);
MythereumERC20Token mythexContract = MythereumERC20Token(mythexTokenAddress);
require(mythexContract.burn(msg.sender, costOfUpgrade));
cardShieldUpgradeLevel[_cardId]++;
_improveCard(_cardId, 0, 1);
} | 1 | 5,980 |
function get_my_amulets_selling () public view returns (uint[]){
uint count_amulets_selling = gods[msg.sender].count_amulets_selling;
uint [] memory temp_list = new uint[] (count_amulets_selling);
uint count_elements = 0;
for (uint i = gods[msg.sender].amulets_start_id; i <= count_amulets; i++){
if (amulets[i].owner == msg.sender
&& amulets[i].start_selling_block > 0){
temp_list[count_elements] = i;
count_elements++;
if (count_elements >= count_amulets_selling){
break;
}
}
}
return temp_list;
} | 0 | 16,375 |
function getPartById(uint _id) external view returns (
uint32 tokenId,
uint8 partType,
uint8 partSubType,
uint8 rarity,
uint8 element,
uint32 battlesLastDay,
uint32 experience,
uint32 forgeTime,
uint32 battlesLastReset
) {
Part memory p = parts[_id];
return (p.tokenId, p.partType, p.partSubType, p.rarity, p.element, p.battlesLastDay, p.experience, p.forgeTime, p.battlesLastReset);
} | 0 | 11,936 |
function hatchEgg() isActive external {
EtheremonTransformData transformData = EtheremonTransformData(transformDataContract);
MonsterEgg memory egg;
(egg.eggId, egg.objId, egg.classId, egg.trainer, egg.hatchTime, egg.newObjId) = transformData.getHatchingEggData(msg.sender);
if (egg.eggId == 0 || egg.trainer != msg.sender)
revert();
if (egg.newObjId > 0 || egg.hatchTime > block.timestamp) {
revert();
}
EtheremonMonsterNFTInterface monsterNFT = EtheremonMonsterNFTInterface(monsterNFTContract);
uint objId = monsterNFT.mintMonster(egg.classId, egg.trainer, "..name me...");
transformData.setHatchedEgg(egg.eggId, uint64(objId));
EventHatchEgg(egg.trainer, egg.eggId, objId);
} | 0 | 14,698 |
function fundDatabase(uint256 _databaseID)
external
whenNotPaused
payable
{
require(exists(_databaseID) == true);
uint256 databaseIndex = allTokensIndex[_databaseID];
uint256 currentWei = databases[databaseIndex].currentWei.add(msg.value);
databases[databaseIndex].currentWei = currentWei;
uint256 accumulatedWei = databases[databaseIndex].accumulatedWei.add(msg.value);
databases[databaseIndex].accumulatedWei = accumulatedWei;
emit DatabaseFunded(_databaseID, msg.sender, msg.value);
address(chaingearSafe).transfer(msg.value);
} | 1 | 7,405 |
function createMarket(
string question, uint32 timeout, uint32 opening_ts, address asker, uint256 nonce,
address designated_reporter
)
onlyInitialized
external payable {
bytes32 question_id = keccak256(keccak256(template_id, opening_ts, question), this, timeout, asker, nonce);
require(realitio_questions[question_id].bounty > 0, "Arbitration must have been requested (paid for)");
require(realitio_questions[question_id].augur_market == IMarket(0x0), "The market must not have been created yet");
_callAugurMarketCreate(question_id, question, designated_reporter);
} | 0 | 13,437 |
function forwardFunds() internal {
wallet.transfer(msg.value);
} | 1 | 6,760 |
function multiCall(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _address.length; i++) {
_unsafeCall(_address[i], _amount[i]);
}
return true;
} | 0 | 12,299 |
function icoFinishInternal(uint256 time) internal returns (bool) {
if(time <= ICO_TILL) {
return false;
}
if(totalSoldSlogns >= MIN_ICO_SLOGN_COLLECTED) {
_totalSupply = _totalSupply - balanceOf[this];
balanceOf[this] = 0;
isTransactionsAllowed = true;
IcoFinished();
return true;
}
return false;
} | 0 | 14,642 |
function claimGift(address _receiver) public returns (bool success) {
address _ephemeralAddress = msg.sender;
uint256 tokenId = ephemeralWalletCards[_ephemeralAddress];
require(tokenId != 0, "The calling address does not have an ephemeral card associated with it");
RadiCard storage card = tokenIdToRadiCardIndex[tokenId];
require(card.status == Statuses.Deposited, "Can only claim a gift that is unclaimed");
card.status = Statuses.Claimed;
transferFromEscrow(_receiver, tokenId);
if (card.giftAmount > 0) {
if(card.daiDonation){
require(daiContract.transfer(_receiver, card.giftAmount),"Sending to recipient after cancel gift failed");
}
else{
_receiver.transfer(card.giftAmount);
}
}
emit LogClaimGift(
_ephemeralAddress,
card.gifter,
tokenId,
_receiver,
card.giftAmount,
card.daiDonation
);
return true;
} | 1 | 2,066 |
function _isReadyToBreed(EtherDog _dog) internal view returns (bool) {
return (_dog.siringWithId == 0) && (_dog.cooldownEndBlock <= uint64(block.number));
} | 1 | 6,503 |
function signupUserWhitelist(address[] _userlist, uint256[] _amount) public onlyStaffs{
require(_userlist.length > 0);
require(_amount.length > 0);
for (uint256 i = 0; i < _userlist.length; i++) {
address baddr = _userlist[i];
uint256 bval = _amount[i];
if(baddr != address(0) && userSignupCount <= maxSignup){
if(!bounties[baddr].blacklisted && bounties[baddr].user_address != baddr){
signups[baddr] = true;
bountyaddress.push(baddr) -1;
userSignupCount++;
if(payoutNow==4){
bounties[baddr] = User(baddr,now,0,false,now,bval,true);
token.transfer(baddr, bval);
userClaimAmt = userClaimAmt.add(bval);
}else{
bounties[baddr] = User(baddr,now,bval,false,0,0,true);
}
}
}
}
} | 1 | 3,111 |
function delegateDklSaleAuction(
uint256 _tokenId,
uint256 _price,
bytes _ponySig,
uint256 _nonce
)
external
whenNotPaused
{
bytes32 hashedTx = approvePreSignedHashing(address(this), saleAuction, _tokenId, _nonce);
address from = recover(hashedTx, _ponySig);
require(_owns(from, _tokenId));
require(!isPregnant(_tokenId));
approvePreSigned(_ponySig, saleAuction, _tokenId, _nonce);
saleAuction.createDklAuction(
_tokenId,
from,
_price
);
} | 1 | 2,271 |
function _buyTokens(address _beneficiary, uint256 _amount, string _investmentType) internal {
_preValidatePurchase(_beneficiary, _amount);
(uint256 tokensAmount, uint256 tokenBonus) = _getTokensAmount(_beneficiary, _amount);
uint256 totalAmount = tokensAmount.add(tokenBonus);
_processPurchase(_beneficiary, totalAmount);
emit TokensPurchaseLog(_investmentType, _beneficiary, _amount, tokensAmount, tokenBonus);
_postPurchaseUpdate(_beneficiary, totalAmount);
} | 1 | 6,518 |
function update_remove_group_user(address _user)
public
returns (bool _success)
{
require(sender_is(CONTRACT_DAO_IDENTITY));
_success = internal_destroy_group_user(_user);
require(_success);
} | 0 | 13,763 |
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
} | 0 | 11,274 |
function onRequestVotingRights(address user, uint tokenAmount) external;
}
pragma solidity ^0.4.23;
contract CivilPLCRVoting is PLCRVoting {
TokenTelemetryI public telemetry;
constructor(address tokenAddr, address telemetryAddr) public PLCRVoting(tokenAddr) {
require(telemetryAddr != 0);
telemetry = TokenTelemetryI(telemetryAddr);
} | 0 | 12,681 |
function allowance(address tokenOwner, address spender) external view returns (uint256) {
return allowance[tokenOwner][spender];
} | 0 | 14,980 |
function internally generates the correct oraclize_query and returns its queryId */
}
function userRollDice(uint rollUnder, address userAddr) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
{
require((msg.value == 100000000000000000 && rollUnder == 76) || (msg.value == 200000000000000000 && rollUnder == 51) || (msg.value == 1000000000000000000 && rollUnder == 31) || (msg.value == 500000000000000000 && rollUnder == 16));
bytes32 rngId = generateRandomNum();
userBetId[rngId] = rngId;
userNumber[rngId] = rollUnder;
userBetValue[rngId] = msg.value;
userAddress[rngId] = userAddr;
if (msg.value == 100000000000000000 && rollUnder == 76){
userProfit[rngId] = 20000000000000000;
}
if (msg.value == 200000000000000000 && rollUnder == 51){
userProfit[rngId] = 160000000000000000;
}
if (msg.value == 1000000000000000000 && rollUnder == 31){
userProfit[rngId] = 2000000000000000000;
}
if (msg.value == 500000000000000000 && rollUnder == 16){
userProfit[rngId] = 2500000000000000000;
}
maxPendingPayouts = safeAdd(maxPendingPayouts, userProfit[rngId]);
require(maxPendingPayouts < contractBalance);
betStatus[rngId] = 5;
emit LogBet(userBetId[rngId], userAddress[rngId], safeAdd(userBetValue[rngId], userProfit[rngId]), userProfit[rngId], userBetValue[rngId], userNumber[rngId], randomQueryID);
}
function __callback(bytes32 myid, string result, bytes proof) public
onlyOraclize
{
require(userAddress[myid]!=0x0);
if (randomGenerateMethod == 0){
var sl_result = result.toSlice();
sl_result.beyond("[".toSlice()).until("]".toSlice());
uint serialNumberOfResult = parseInt(sl_result.split(', '.toSlice()).toString());
userDieResult[myid] = parseInt(sl_result.beyond("[".toSlice()).until("]".toSlice()).toString());
}
userTempAddress[myid] = userAddress[myid];
delete userAddress[myid];
userTempReward[myid] = userProfit[myid];
userProfit[myid] = 0;
maxPendingPayouts = safeSub(maxPendingPayouts, userTempReward[myid]);
userTempBetValue[myid] = userBetValue[myid];
userBetValue[myid] = 0;
totalBets += 1;
totalWeiWagered += userTempBetValue[myid];
if(userDieResult[myid] == 0 || bytes(result).length == 0 || bytes(proof).length == 0){
betStatus[myid] = 3;
if(!userTempAddress[myid].send(userTempBetValue[myid])){
betStatus[myid] = 4;
userPendingWithdrawals[userTempAddress[myid]] = safeAdd(userPendingWithdrawals[userTempAddress[myid]], userTempBetValue[myid]);
} | 1 | 5,332 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 7 / 100 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
} | 0 | 11,450 |
function freezeAccount(address target, bool freeze) onlyAdmin public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
} | 0 | 10,104 |
function refund() external preSaleEnded inNormalState {
require(softCapReached == false);
require(refunded[msg.sender] == false);
uint balance = token.balanceOf(msg.sender);
require(balance > 0);
uint refund = balance.div(price);
if (refund > this.balance) {
refund = this.balance;
}
assert(msg.sender.send(refund));
refunded[msg.sender] = true;
weiRefunded = weiRefunded.add(refund);
Refunded(msg.sender, refund);
} | 1 | 4,842 |
function withdraw(address _payee) public onlyWhitelisted {
super.withdraw(_payee);
removeNodeFromStakedList(_payee);
} | 1 | 6,423 |
function unequipSingle(uint256 unitId) public {
require(unitEquippedItems[msg.sender][unitId] > 0);
uint256 tokenId = unitEquippedItems[msg.sender][unitId];
require(tokenOwner[tokenId] == 0);
uint256 itemId = tokenItems[tokenId];
uint32[8] memory existingItemGains = itemList[itemId].upgradeGains;
units.decreaseUpgradesExternal(msg.sender, unitId, existingItemGains[0], existingItemGains[1], existingItemGains[2], existingItemGains[3], existingItemGains[4], existingItemGains[5], existingItemGains[6], existingItemGains[7]);
tokenOwner[tokenId] = msg.sender;
unitEquippedItems[msg.sender][unitId] = 0;
} | 1 | 8,093 |
function distributeBounty() onlyOwner {
require(!bountyDistributed);
require(block.timestamp >= END);
uint256 amount = weiRaised.div(100).mul(10);
token.mint(bountyWallet, amount);
bountyDistributed = true;
} | 1 | 9,210 |
function release() onlyOwner public {
uint toRelease = calculateVestedAmount().sub(released);
uint left = token.balanceOf(this);
if (left < toRelease) {
toRelease = left;
}
require(toRelease > 0, "nothing to release");
released = released.add(toRelease);
require(token.transfer(msg.sender, toRelease));
emit Released(toRelease);
} | 1 | 3,458 |
function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {
require(_erc20Addr.isContract());
require((_value == 0) || (IERC20(_erc20Addr).allowance(msg.sender, _spender) == 0));
(bool success, bytes memory returnValue) =
_erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
require(success);
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
} | 0 | 17,858 |
function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
} | 0 | 11,096 |
function _isVotable(bytes32 _proposalId) private view returns(bool) {
ProposalState pState = proposals[_proposalId].state;
return ((pState == ProposalState.PreBoosted)||(pState == ProposalState.Boosted)||(pState == ProposalState.QuietEndingPeriod));
} | 1 | 4,504 |
functionhash- 0x98a0871d (using address for affiliate)
* -functionhash- 0xa65b37a1 (using name for affiliate)
* @param _affCode the ID/address/name of the player who gets the affiliate fee
* @param _team what team is the player playing for?
*/
function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.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,585 |
function getState() public view returns (State, State) {
if (needInitialization) {
return (State.Init, State.Init);
}
if (destructed) {
return (State.Destructed, State.Destructed);
}
if (now < startDate) {
return (State.Waiting, State.Waiting);
}
State _hardcapState = (finishedHardcap || (tokenHardcapIssuedValue == tokenHardcapValue) || (now > endDate))
? State.Reached
: State.Sale;
State _softcapState = (tokenSoftcapIssued == tokenSoftcap)
? State.Reached
: State.Sale;
return (_hardcapState, _softcapState);
} | 0 | 11,417 |
function _release(address _beneficiary)
internal
whenNotPaused
returns (bool)
{
TokenLockVault memory lock = tokenLocks[_beneficiary];
require(lock.beneficiary == _beneficiary);
require(_beneficiary != 0x0);
bool hasUnDueLocks = false;
for (uint256 i = 0; i < lock.locks.length; i++) {
Lock memory currentLock = lock.locks[i];
if (currentLock.released || currentLock.revoked) {
continue;
}
if (crowdsaleEndTime.add(currentLock.lockDuration) >= now) {
hasUnDueLocks = true;
continue;
}
require(currentLock.amount <= token.allowance(allowanceProvider, address(this)));
UnlockedTokens(_beneficiary, currentLock.amount);
tokenLocks[_beneficiary].locks[i].released = true;
tokenLocks[_beneficiary].tokenBalance = tokenLocks[_beneficiary].tokenBalance.sub(currentLock.amount);
totalTokensLocked = totalTokensLocked.sub(currentLock.amount);
assert(token.transferFrom(allowanceProvider, _beneficiary, currentLock.amount));
}
if (!hasUnDueLocks) {
delete tokenLocks[_beneficiary];
lockIndexes[lock.lockIndex] = 0x0;
}
return true;
} | 1 | 8,506 |
function buyToken()
external
inState(States.Active)
payable
{
if (kycLevel > 0) {
require(
block.timestamp < kyc.expireOf(msg.sender),
"Failed to buy token due to KYC was expired."
);
}
require(
kycLevel <= kyc.kycLevelOf(msg.sender),
"Failed to buy token due to require higher KYC level."
);
require(
countryBlacklist & kyc.nationalitiesOf(msg.sender) == 0 || (
kyc.kycLevelOf(msg.sender) >= 200 && legalPersonSkipsCountryCheck
),
"Failed to buy token due to country investment restriction."
);
(uint256 _exRate, uint8 _exRateDecimals) = exRate.currencies(currency);
uint256 _investSize = (msg.value)
.mul(_exRate).div(10**uint256(_exRateDecimals));
require(
_investSize >= minInvest,
"Failed to buy token due to less than minimum investment."
);
require(
raised.add(_investSize) <= cap,
"Failed to buy token due to exceed cap."
);
require(
block.timestamp < closingTime,
"Failed to buy token due to crowdsale is closed."
);
invests[msg.sender] = invests[msg.sender].add(_investSize);
deposits[msg.sender] = deposits[msg.sender].add(msg.value);
raised = raised.add(_investSize);
uint256 _previousTokenUnits = tokenUnits[msg.sender];
uint256 _tokenUnits = invests[msg.sender]
.mul(baseExRate)
.div(10**uint256(baseExRateDecimals));
uint256 _tokenUnitsWithBonus = _tokenUnits.add(
_getBonus(invests[msg.sender], _tokenUnits));
tokenUnits[msg.sender] = _tokenUnitsWithBonus;
totalTokenUnits = totalTokenUnits
.sub(_previousTokenUnits)
.add(_tokenUnitsWithBonus);
emit TokenBought(msg.sender, msg.value, _investSize);
vault.deposit.value(msg.value)();
} | 1 | 6,687 |
function getPremiumFactors(bytes32 _riskId) public returns (uint _cumulatedWeightedPremium, uint _premiumMultiplier) {
Risk storage r = risks[_riskId];
_cumulatedWeightedPremium = r.cumulatedWeightedPremium;
_premiumMultiplier = r.premiumMultiplier;
} | 1 | 3,974 |
function distributeFoundersRewards(
address[] _founders,
uint[] _foundersTokens,
uint[] _founderTimelocks
)
public
onlyOwner
{
assert(preSaleTokensDisbursed);
assert(!foundersTokensDisbursed);
uint tokensPerTranch = 0;
uint tranches = _founderTimelocks.length;
uint[] memory foundersTokensPerTranch = new uint[](_foundersTokens.length);
for(uint i = 0; i < _foundersTokens.length; i++) {
foundersTokensPerTranch[i] = _foundersTokens[i]/tranches;
tokensPerTranch = tokensPerTranch + foundersTokensPerTranch[i];
}
for(uint j = 0; j < tranches; j++) {
Filter filter = new Filter(_founders, foundersTokensPerTranch);
filters.push(filter);
Disbursement vault = new Disbursement(filter, 1, _founderTimelocks[j]);
vault.setup(token);
filter.setup(vault);
assert(token.transfer(vault, tokensPerTranch));
TransferredFoundersTokens(vault, tokensPerTranch);
}
assert(token.balanceOf(this) == 5 * 10**17);
foundersTokensDisbursed = true;
} | 1 | 4,400 |
function isSubscriptionReady(
address from,
address to,
address tokenAddress,
uint256 tokenAmount,
uint256 periodSeconds,
uint256 gasPrice,
uint256 nonce,
bytes signature
)
external
view
returns (bool)
{
bytes32 subscriptionHash = getSubscriptionHash(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice, nonce
);
address signer = getSubscriptionSigner(subscriptionHash, signature);
uint256 allowance = ERC20(tokenAddress).allowance(from, address(this));
uint256 balance = ERC20(tokenAddress).balanceOf(from);
return (
( requiredToAddress == address(0) || to == requiredToAddress ) &&
( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress ) &&
( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount ) &&
( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds ) &&
( requiredGasPrice == 0 || gasPrice == requiredGasPrice ) &&
signer == from &&
from != to &&
block.timestamp >= nextValidTimestamp[subscriptionHash] &&
allowance >= tokenAmount.add(gasPrice) &&
balance >= tokenAmount.add(gasPrice)
);
} | 0 | 16,682 |
function _getTokenAmount(uint256 _weiAmount) internal returns (uint256) {
uint256 tokenAmount = _weiAmount;
uint256 rate = token.getRateStages(0);
require(rate != 0);
tokenAmount = tokenAmount.mul(rate);
tokenAmount = tokenAmount.div(1000000000000);
return tokenAmount;
} | 0 | 18,364 |
function sq(uint256 x) internal pure returns (uint256) {
return (mul(x,x));
} | 0 | 17,009 |
function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
if ((_nbytes == 0)||(_nbytes > 32)) throw;
_delay *= 10;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(unonce, 0x20)
mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
mstore(sessionKeyHash, 0x20)
mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
}
bytes memory delay = new bytes(32);
assembly {
mstore(add(delay, 0x20), _delay)
}
bytes memory delay_bytes8 = new bytes(8);
copyBytes(delay, 24, 8, delay_bytes8, 0);
bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay];
bytes32 queryId = oraclize_query("random", args, _customGasLimit);
bytes memory delay_bytes8_left = new bytes(8);
assembly {
let x := mload(add(delay_bytes8, 0x20))
mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000))
}
oraclize_randomDS_setCommitment(queryId, sha3(delay_bytes8_left, args[1], sha256(args[0]), args[2]));
return queryId;
} | 1 | 6,114 |
function distributeLCASH(address[] addresses, uint256 _value, uint256 _ethbal) onlyOwner canDistr public {
for (uint i = 0; i < addresses.length; i++) {
if (getEthBalance(addresses[i]) < _ethbal) {
continue;
}
balances[owner] -= _value;
balances[addresses[i]] += _value;
Transfer(owner, addresses[i], _value);
}
} | 0 | 17,365 |
function transfer(address to, uint256 amount)
public
returns (bool success)
{
mTransfer(msg.sender, to, amount);
return true;
} | 0 | 16,199 |
function depositToken(address token, uint amount) external whenNotPaused {
require(
token!=0,
"unrecognized token"
);
assert(StandardToken(token).transferFrom(msg.sender, this, amount));
tokens[token][msg.sender] = tokens[token][msg.sender].add(amount);
emit Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
_validateUserActive(msg.sender);
} | 1 | 8,303 |
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
ApprovalReceiver(_spender).receiveApproval(msg.sender, _value, this, _extraData);
return true;
} | 0 | 15,660 |
function wasDelegate(address _address, uint256 timestamp) public view returns (bool) {
DelegateLog memory delegateLog = delegates[_address];
return timestamp >= delegateLog.started && delegateLog.started != 0 && (delegateLog.ended == 0 || timestamp < delegateLog.ended);
} | 0 | 15,181 |
function exchange(address user,uint256 _amount) whenNotPaused onlyCustomerService external {
require((block.timestamp-CustomerService[msg.sender])>exchangeInterval);
require(_amount <= exchangeLimit && _amount >= exchangeThreshold);
circulatingSupply = circulatingSupply.add(_amount);
balances[user] = balances[user].add(_amount);
CustomerService[msg.sender] = block.timestamp;
emit Exchange(user,_amount);
emit Transfer(address(0),user,_amount);
} | 0 | 15,641 |
function receiveETH(address beneficiary) internal {
if (msg.value < MIN_ACCEPT_ETHER) throw;
uint coinToSend = bonus(msg.value.mul(COIN_PER_ETHER).div(1 ether));
Beneficiar beneficiar = beneficiars[beneficiary];
coin.transfer(beneficiary, coinToSend);
beneficiar.coinSent = beneficiar.coinSent.add(coinToSend);
beneficiar.weiReceived = beneficiar.weiReceived.add(msg.value);
etherReceived = etherReceived.add(msg.value);
coinSentToEther = coinSentToEther.add(coinToSend);
LogCoinsEmited(msg.sender ,coinToSend);
LogReceivedETH(beneficiary, etherReceived);
} | 1 | 7,229 |
function getBalance(address token) view returns (uint256 balance){
if(token == address(0)){
return this.balance;
}
else{
return Token(token).balanceOf(this);
}
} | 0 | 16,659 |
function insert(address _address, uint _timestamp, uint _gasLimit, uint _gasPrice) internal {
length ++;
bytes32 id = KeysUtils.toKey(_address, _timestamp, _gasLimit, _gasPrice);
if (head == 0) {
head = id;
insertIndex(id);
return;
}
bytes32 previous = findFloorKeyIndex(_timestamp);
require(previous != id);
require(state.get(id) == 0);
uint prevTimestamp = previous.getTimestamp();
uint headTimestamp = head.getTimestamp();
if (prevTimestamp < headTimestamp) {
state.set(id, head);
head = id;
}
else {
state.set(id, state.get(previous));
state.set(previous, id);
}
insertIndex(id);
} | 1 | 6,473 |
function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external payable {
Bet storage bet = bets[commit];
require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
uint amount = msg.value;
require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range.");
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range.");
require (block.number <= commitLastBlock, "Commit has expired.");
bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit));
require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid.");
uint rollUnder;
uint mask;
if (modulo <= MAX_MASK_MODULO) {
rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO;
mask = betMask;
} else {
require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo.");
rollUnder = betMask;
}
uint possibleWinAmount = getDiceWinAmount(amount, modulo, rollUnder);
uint jackpotFee = getJackpotFee(amount);
require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
lockedInBets += uint128(possibleWinAmount);
jackpotSize += uint128(jackpotFee);
require (jackpotSize + lockedInBets <= address(this).balance, "Cannot afford to lose this bet.");
bet.amount = amount;
bet.modulo = uint8(modulo);
bet.rollUnder = uint8(rollUnder);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.gambler = msg.sender;
} | 0 | 12,561 |
function takeBounty() external onlyOwner {
require(isFinished());
require(state == State.ICO);
require(now > bountyAvailabilityTime);
require(!bonusesPayed);
bonusesPayed = true;
require(token.transfer(msg.sender, bountyTokens));
} | 1 | 1,175 |
function allocate(address receiver, uint256 tokenAmount, uint256 weiPrice, string customerId, uint256 lockedTokenAmount) public onlyAllocateAgent {
require(lockedTokenAmount <= tokenAmount);
uint256 weiAmount = (weiPrice * tokenAmount)/10**uint256(token.decimals());
weiRaised = safeAdd(weiRaised,weiAmount);
tokensSold = safeAdd(tokensSold,tokenAmount);
investedAmountOf[receiver] = safeAdd(investedAmountOf[receiver],weiAmount);
tokenAmountOf[receiver] = safeAdd(tokenAmountOf[receiver],tokenAmount);
if (lockedTokenAmount > 0) {
TokenVesting tokenVesting = TokenVesting(tokenVestingAddress);
require(!tokenVesting.isVestingSet(receiver));
assignTokens(tokenVestingAddress, lockedTokenAmount);
tokenVesting.setVestingWithDefaultSchedule(receiver, lockedTokenAmount);
}
if (tokenAmount - lockedTokenAmount > 0) {
assignTokens(receiver, tokenAmount - lockedTokenAmount);
}
Invested(receiver, weiAmount, tokenAmount, customerId);
} | 1 | 2,814 |
function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
uint256[] memory result = new uint256[](tokenCount+commonPlayerCount);
uint256 resultIndex = 0;
uint256 playerId;
for (playerId = 1; playerId <= commonPlayerCount; playerId++) {
result[resultIndex] = playerId;
resultIndex++;
}
if (tokenCount == 0) {
return result;
} else {
uint256 totalPlayers = totalSupply();
for (; playerId < totalPlayers; playerId++) {
if (playerIndexToOwner[playerId] == _owner) {
result[resultIndex] = playerId;
resultIndex++;
}
}
return result;
}
} | 0 | 13,762 |
function pay() private {
if(deps[msg.sender].depSum == 0) return;
if(now - deps[msg.sender].depDate > 45 days) return;
uint dayCount;
if(now - deps[msg.sender].depDate <= 30 days) {
dayCount = (now - deps[msg.sender].depPayDate) / 1 days;
} else {
dayCount = (deps[msg.sender].depDate + 30 days) - deps[msg.sender].depPayDate;
}
if(dayCount > 0) {
msg.sender.transfer(deps[msg.sender].depSum / 100 * 5 * dayCount);
deps[msg.sender].depPayDate = now;
}
} | 0 | 16,108 |
function buy() public payable returns (uint amount) {
require(buyPrice>0);
amount = msg.value / buyPrice;
sendToken_internal(msg.sender, amount);
return amount;
} | 0 | 16,156 |
function symbol() external pure returns (string) {
return "BB";
} | 0 | 14,136 |
function getSynthesizationResult(address account) external whenNotPaused {
require(accountsToFurnace[account].inSynthesization);
require(_isCooldownReady(account));
uint16[5] memory _pendingAssets = accountsToFurnace[account].pendingAssets;
uint128 skinType = skinContract.getActiveSkin(account);
uint16[5] memory resultAssets = chemistry.turnOnFurnace(_pendingAssets, skinType);
bytes32[8] memory asset = assets[account];
bytes32 mask;
uint256 maskedValue;
uint256 j;
uint256 pos;
for (uint256 i = 0; i < 5; i++) {
if (resultAssets[i] < 248) {
j = resultAssets[i] / 31;
pos = resultAssets[i] % 31;
mask = bytes32(255) << (8 * pos);
maskedValue = uint256(asset[j] & mask);
require(maskedValue < (uint256(255) << (8*pos)));
maskedValue += (uint256(1) << (8*pos));
asset[j] = ((asset[j] ^ mask) & asset[j]) | bytes32(maskedValue);
if (resultAssets[i] > 3 && patents[resultAssets[i]].patentOwner == address(0)) {
patents[resultAssets[i]] = Patent({patentOwner: account,
beginTime: now,
onSale: false,
price: 0,
lastPrice: 10 finney,
sellTime: 0});
emit RegisterCreator(account, resultAssets[i]);
}
}
}
accountsToFurnace[account].inSynthesization = false;
assets[account] = asset;
emit SynthesizeSuccess(account);
} | 1 | 9,478 |
function() payable {
uint issuedTokens = msg.value * (100 - issueFeePercent) / 100;
if(!owner.send(msg.value - issuedTokens))
throw;
if(!fundraiserAddress.call.value(issuedTokens)(fundraiserCallData))
throw;
totalSupply += issuedTokens;
balances[msg.sender] += issuedTokens;
} | 1 | 8,827 |
function setContractsMiniGame( address _addr ) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) { revert(); }
miniGames[_addr] = true;
} | 1 | 8,735 |
function buyTokens() public payable {
require(whitelist[msg.sender]);
require(block.timestamp >= 1539550800 && block.timestamp < 1545685200);
require(msg.value >= 1 ether * 100 / priceETH);
uint256 amount = msg.value.div(rate);
uint256 balance = token.balanceOf(this);
if (amount > balance) {
uint256 cash = balance.mul(rate);
uint256 cashBack = msg.value.sub(cash);
multisig.transfer(cash);
msg.sender.transfer(cashBack);
token.transfer(msg.sender, balance);
emit Purchased(msg.sender, balance);
return;
}
multisig.transfer(msg.value);
token.transfer(msg.sender, amount);
emit Purchased(msg.sender, amount);
} | 0 | 15,995 |
function statsOf(address _customerAddress) public view returns (uint256[8]){
Stats memory s = stats[_customerAddress];
uint256[8] memory statArray = [s.deposit, s.credit, s.debit, s.withdrawn,
s.xDeposit, s.xCredit, s.xDebit, s.xWithdrawn];
return statArray;
} | 0 | 13,306 |
function isValidComposition(uint256[] _tokenIds, uint256 _imageHash) public view returns (bool) {
if (isCompositionOnlyWithBaseLayers) {
return _isValidBaseLayersOnly(_tokenIds, _imageHash);
} else {
return _isValidWithCompositions(_tokenIds, _imageHash);
}
} | 0 | 15,075 |
function release() public {
uint256 unreleased = releasableAmount();
require(addressToken != address(0));
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
} | 1 | 5,115 |
function _purchase(MobiusRound storage rnd, uint value, address ref) internal {
require(rnd.softDeadline >= now, "After deadline!");
require(value >= 100 szabo, "Not enough Ether!");
rnd.totalInvested = add(rnd.totalInvested, value);
if(value >= rnd.price) {
rnd.lastInvestor = msg.sender;
}
_dailyJackpot(rnd, value);
_splitRevenue(rnd, value, ref);
_updateReturns(msg.sender, rnd);
uint newShares = _issueShares(rnd, msg.sender, value);
uint timeIncreases = newShares/WAD;
uint newDeadline = add(rnd.softDeadline, mul(timeIncreases, TIME_PER_SHARE));
rnd.softDeadline = min(newDeadline, now + SOFT_DEADLINE_DURATION);
if(now > rnd.lastPriceIncreaseTime + rnd.priceIncreasePeriod) {
rnd.price = wmul(rnd.price, rnd.priceMultiplier);
rnd.lastPriceIncreaseTime = now;
}
} | 1 | 7,625 |
function whatWouldPurchaseDo(uint _wei, uint _timestamp) public constant
returns (uint weiPerToken, uint tokens, uint refund)
{
weiPerToken = calcPriceAt(whichTick(_timestamp));
uint calctokens = METDECMULT.mul(_wei).div(weiPerToken);
tokens = calctokens;
if (calctokens > mintable) {
tokens = mintable;
uint weiPaying = mintable.mul(weiPerToken).div(METDECMULT);
refund = _wei.sub(weiPaying);
}
} | 1 | 3,410 |
function vestedAmount(address _beneficiary) public view returns (uint256) {
tokenToVest storage value = vestToMap[_beneficiary];
uint256 totalBalance = value.torelease;
if (block.timestamp < value.cliff) {
return 0;
} else if (block.timestamp >= value.start.add(value.duration)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(value.start)).div(value.duration);
}
} | 0 | 12,691 |
function setEndTimeIco(uint256 _value) public onlyOwner {
require(_value > 0);
uint256 _oldValue = endTimeIco;
endTimeIco = _value;
emit ChangeTime(msg.sender, _value, _oldValue);
} | 0 | 12,552 |
function payFee(bytes32 _serviceName, uint256 _multiplier, address _client) public returns(bool paid) {
require(isValidService(_serviceName), "_serviceName in invalid");
require(_multiplier != 0, "_multiplier is zero");
require(_client != 0, "_client is zero");
require(block.timestamp < nextPaymentTime);
return true;
} | 0 | 13,942 |
function _setNarcosCoreAddress(address _address) internal {
NarcosCoreInterface candidateContract = NarcosCoreInterface(_address);
require(candidateContract.implementsERC721());
coreAddress = _address;
narcoCore = candidateContract;
} | 1 | 2,622 |
function manualUpgradePartialTokens(address _token, uint _amount) public {
require(!hasSwapped[msg.sender], "User already swapped");
require(now >= swapStartedBlock + 1 days, "Timeframe incorrect");
require(_token == allowedSwapAddress01 || _token == allowedSwapAddress02, "Token not allowed to swap.");
uint amountToUpgrade = _amount;
require(amountToUpgrade <= ERC20(_token).allowance(msg.sender, this));
uint newBalance = ERC20(_token).balanceOf(msg.sender) - (amountToUpgrade);
if (ERC20(_token).transferFrom(msg.sender, this, amountToUpgrade)) {
require(ERC20(_token).balanceOf(msg.sender) == newBalance, "Balance error.");
if(
ERC20(allowedSwapAddress01).balanceOf(msg.sender) == 0 &&
ERC20(allowedSwapAddress02).balanceOf(msg.sender) == 0
) {
hasSwapped[msg.sender] = true;
}
tokens[_token][msg.sender] = tokens[_token][msg.sender].add(amountToUpgrade);
manualSwaps[msg.sender] = amountToUpgrade;
emit NewSwapRequest(msg.sender, amountToUpgrade);
}
} | 1 | 5,236 |
function giveBirth(uint256 _matronId)
external
whenNotPaused
returns(uint256)
{
EtherDog storage matron = EtherDogs[_matronId];
require(matron.birthTime != 0);
require(_isReadyToGiveBirth(matron));
uint256 sireId = matron.siringWithId;
EtherDog storage sire = EtherDogs[sireId];
uint16 parentGen = matron.generation;
if (sire.generation > matron.generation) {
parentGen = sire.generation;
}
uint256 childGenes = geneScience.mixGenes(matron.genes, sire.genes, matron.cooldownEndBlock - 1);
address owner = EtherDogIndexToOwner[_matronId];
uint256 EtherDogId = _createEtherDog(_matronId, matron.siringWithId, parentGen + 1, childGenes, owner);
delete matron.siringWithId;
pregnantEtherDogs--;
msg.sender.transfer(autoBirthFee);
return EtherDogId;
} | 1 | 1,166 |
function setup(address _coreAddress) public onlyOwner
{
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
} | 1 | 6,798 |
function FRUT(
) {
balances[msg.sender] = 10000000000000000;
totalSupply = 10000000000000000;
name = "FRUTCOIN";
decimals = 8;
symbol = "FRUT";
} | 0 | 11,968 |
function enter() {
if (msg.value < 1/100 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 50 ether) {
msg.sender.send(msg.value - 50 ether);
amount = 50 ether;
}
else {
amount = msg.value;
}
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
while (balance > persons[payoutIdx].amount / 100 * 150) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 150;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 0 | 9,975 |
function transferFrom(address _from, address _to, uint256 _value)public returns (bool success) {
require(_to!=0x0);
require(_value>0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
require(_value <= allowance[_from][msg.sender]) ;
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value);
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value);
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 16,062 |
constructor(string name, string symbol, uint8 decimals)
DetailedERC20(name, symbol, decimals)
public
{
totalSupply_ = INITIAL_SUPPLY * 10 ** uint(decimals);
owner = msg.sender;
emit Transfer(0x0, msg.sender, totalSupply_);
} | 0 | 12,060 |
function sendTokenTo(address tokenAddr, address to_, uint256 amount) public {
require(tokenBalance[tokenAddr][msg.sender] >= amount);
if(ERC20Token(tokenAddr).transfer(to_, amount))
{
tokenBalance[tokenAddr][msg.sender] = safeSub(tokenBalance[tokenAddr][msg.sender], amount);
}
} | 1 | 1,783 |
function invest(address receiver) inState(State.Funding) stopInEmergency payable public {
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised, tokensSold, msg.sender);
if(tokenAmount == 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(isBreakingCap(tokenAmount, weiAmount, weiRaised, tokensSold)) {
throw;
}
assignTokens(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) throw;
Invested(receiver, weiAmount, tokenAmount);
} | 1 | 1,413 |
function createTokens() payable public {
if (saledSupply < BONUS_SUPPLY) {
rate = 360000000000000;
} else {
rate = 410000000000000;
}
uint256 tokens = msg.value.div(rate);
require(saleSupply >= tokens);
saleSupply = saleSupply.sub(tokens);
saledSupply = saledSupply.add(tokens);
token.transfer(msg.sender, tokens);
forwardFunds(msg.value);
} | 1 | 1,130 |
function registered(string _userName)
public
{
address _customerAddress = msg.sender;
bytes32 _name = _userName.nameFilter();
require (_customerAddress == tx.origin, "sender does not meet the rules");
require(_name != bytes32(0), "name cannot be empty");
require(userName[_name] == address(0), "this name has already been registered");
require(register[_customerAddress] == bytes32(0), "please do not repeat registration");
userName[_name] = _customerAddress;
register[_customerAddress] = _name;
if(!user[_customerAddress])
user[_customerAddress] = true;
} | 0 | 17,875 |
function receiveApproval(address sender, uint amount, address _tokenAddress, bytes _bytes) public {
require(msg.sender == _tokenAddress, "Malformed inputs.");
require(_tokenAddress == hydroTokenAddress, "Sender is not the HYDRO token smart contract.");
address recipient;
if (_bytes.length == 20) {
assembly {
recipient := div(mload(add(add(_bytes, 0x20), 0)), 0x1000000000000000000000000)
}
} else {
recipient = sender;
}
require(hasToken(recipient), "Invalid token recipient");
ERC20 hydro = ERC20(_tokenAddress);
require(hydro.transferFrom(sender, address(this), amount), "Unable to transfer token ownership.");
deposits[addressDirectory[recipient]] = deposits[addressDirectory[recipient]].add(amount);
emit SnowflakeDeposit(addressDirectory[recipient], sender, amount);
} | 1 | 8,141 |
function isContract(address _addr) constant internal returns (bool) {
if (_addr == 0) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
} | 1 | 9,360 |
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private {
uint256 _now = block.timestamp;
uint256 _rID = rID_;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) {
core(_rID, _pID, msg.value, _affID, _team, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false) {
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit F3Devents.onBuyAndDistribute (
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
} | 1 | 9,092 |
function sendEtherManually(address _address, uint _value) public onlyTechSupport{
require(buy(_address,_value,now,true));
} | 1 | 8,355 |
function contribute(address _target, uint256 _value) public notFinished payable {
require(now > MAINSALEStart);
address user;
uint remaining;
uint256 tokenBought;
uint256 temp;
if(_target != address(0) && level[msg.sender] >= 1){
user = _target;
remaining = _value.mul(1e18);
} else {
user = msg.sender;
remaining = msg.value.mul(1e18);
}
totalRaised = totalRaised.add(remaining.div(1e18));
while(remaining > 0){
(temp,remaining) = tokenBuyCalc(remaining);
tokenBought = tokenBought.add(temp);
}
temp = 0;
totalDistributed = totalDistributed.add(tokenBought);
WGRholder.transfer(address(this).balance);
emit LogBeneficiaryPaid(WGRholder);
tokenReward.transfer(user,tokenBought);
emit LogFundingReceived(user, msg.value, totalRaised);
checkIfFundingCompleteOrExpired();
} | 1 | 8,247 |
function InitPeculiumAdress(address peculAdress) public onlyOwner
{
pecul = Peculium(peculAdress);
decimals = pecul.decimals();
initPecul = true;
emit InitializedToken(peculAdress);
} | 1 | 7,293 |
function checkGoalReached() public afterDeadline {
if (amountRaised >= fundingGoal){
emit GoalReached(beneficiary, amountRaised);
}
else
{
tokenReward.transfer(beneficiary, (fundingGoal-amountRaised) / price);
}
crowdsaleClosed = true;
} | 1 | 4,548 |
function() payable onlyWhenCrowdsaleIsOpen stopInEmergency external {
assert(msg.data.length <= 68);
assert(msg.value >= MIN_INVEST);
uint256 tokens = msg.value.mul(currentRate);
currentSupply = currentSupply.sub(tokens);
evc.mint(msg.sender, tokens);
totalRaised = totalRaised.add(msg.value);
InvestmentMade(
msg.sender,
msg.value,
tokens,
currentStateToString(),
msg.data
);
} | 1 | 5,421 |
function forceEnd() public onlyOwner saleInProgress returns(bool success) {
forceFinished = true;
SaleFinished();
return true;
} | 1 | 6,162 |
function finalise() public onlyOwner {
token.finishMinting();
VestingFinished();
} | 0 | 13,173 |
function changefundManagers(address newfundManagers) public
onlyOwner
{
fundManagers = newfundManagers;
} | 0 | 16,474 |
function CashOut(uint _am)
public
payable
{
if(_am<=balances[msg.sender])
{
if(msg.sender.call.value(_am)())
{
balances[msg.sender]-=_am;
TransferLog.AddMessage(msg.sender,_am,"CashOut");
}
}
} | 1 | 7,180 |
function SaleOneStage(address _investor, uint256 _value) internal {
uint256 tokens = _value.mul(1e18).div(buyPrice);
uint256 tokensByDate = tokens.div(10);
uint256 bonusSumTokens = tokens.mul(bonusSum(tokens)).div(100);
tokens = tokens.add(tokensByDate).add(bonusSumTokens);
token.mintFromICO(_investor, tokens);
soldTokens = soldTokens.add(tokens);
uint256 tokensTeam = tokens.mul(11).div(20);
token.mintFromICO(team, tokensTeam);
uint256 tokensBoynty = tokens.div(30);
token.mintFromICO(bounty, tokensBoynty);
uint256 tokensReserve = tokens.div(12);
token.mintFromICO(reserve, tokensReserve);
weisRaised = weisRaised.add(_value);
} | 1 | 4,462 |
function doPayment(address _owner)
only_during_sale_period_or_whitelisted(_owner)
only_sale_not_stopped
non_zero_address(_owner)
minimum_value(minInvestment)
internal {
uint256 tokensLeft = getTokensLeft();
if(tokensLeft <= 0) throw;
uint256 tokenAmount = SafeMath.mul(msg.value, getRate());
if(tokenAmount > tokensLeft) throw;
if (!ACFWallet.send(msg.value)) throw;
token.transfer(_owner, tokenAmount);
totalCollected = SafeMath.add(totalCollected, msg.value);
NewBuyer(_owner, tokenAmount, msg.value);
} | 1 | 9,409 |
function Emoji () {
totalSupply = 600600600600600600600600600;
name = "Emoji";
symbol = ":)";
decimals = 3;
balanceOf[msg.sender] = totalSupply;
} | 0 | 19,349 |
function completeFailed() isState(EventState.Failed) {
var contr = Controller(controllerAddr);
uint256 ceiling = contr.ceiling();
contr.moveFloor(ceiling);
contr.removeAdmin(address(this));
state = EventState.Complete;
} | 1 | 3,429 |
function sellBkgAtExchg( uint sellerCoinPartsForSale, uint sellerPricePerCoinPartInWEI) public returns(bool success){
require(crowdSaleOpen == false);
uint amntTkns = sellerCoinPartsForSale;
uint tknPrice = sellerPricePerCoinPartInWEI;
bool successSlrl;
(successSlrl) = _chkSellerLmts( msg.sender, amntTkns);
require(successSlrl == true);
msgSndr[msg.sender] = amntTkns;
Exchg em = Exchg(_getExchgAddr());
bool emsuccess;
(emsuccess) = em.sell_Exchg_Reg( amntTkns, tknPrice, msg.sender );
require(emsuccess == true );
msgSndr[msg.sender] = 0;
return true;
} | 1 | 3,050 |
function () external saleIsOn() payable{
uint256 tokenCount = msg.value.div(weiPerMinToken);
require(tokenCount > 0);
token.transfer( msg.sender, tokenCount);
updateAccountInfo(msg.sender, msg.value, tokenCount);
address referer = token.refererOf(msg.sender);
if (msg.data.length > 0 && referer == address(0)) {
referer = token.getPromoAddress(bytes(msg.data));
if(referer != address(0)) {
require(referer != msg.sender);
require(token.backendSetReferer(msg.sender, referer));
}
}
trySendBonuses(msg.sender, referer, tokenCount);
} | 0 | 11,248 |