func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function InitPeculiumAdress(address peculAdress) onlyOwner
{
pecul = Peculium(peculAdress);
decimals = pecul.decimals();
initPecul = true;
InitializedToken(peculAdress);
}
| 1 | 1,211 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(block.timestamp >= 1545102693);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 16,736 |
function challenge(bytes32 _listingHash, string _data) external returns (uint challengeID) {
bytes32 listingHashHash = _listingHash;
Listing storage listingHash = listings[listingHashHash];
uint deposit = parameterizer.get("minDeposit");
require(appWasMade(_listingHash) || listingHash.whitelisted);
require(listingHash.challengeID == 0 || challenges[listingHash.challengeID].resolved);
if (listingHash.unstakedDeposit < deposit) {
resetListing(_listingHash);
return 0;
}
require(token.transferFrom(msg.sender, this, deposit));
uint pollID = voting.startPoll(
parameterizer.get("voteQuorum"),
parameterizer.get("commitStageLen"),
parameterizer.get("revealStageLen")
);
challenges[pollID] = Challenge({
challenger: msg.sender,
rewardPool: ((100 - parameterizer.get("dispensationPct")) * deposit) / 100,
stake: deposit,
resolved: false,
totalTokens: 0
});
listings[listingHashHash].challengeID = pollID;
listings[listingHashHash].unstakedDeposit -= deposit;
_Challenge(_listingHash, deposit, pollID, _data);
return pollID;
}
| 1 | 2,560 |
function tradeBalances(address _tokenGet, uint256 _amountGet, address _tokenGive, uint256 _amountGive, address _maker, uint256 _amountTrade) private {
uint256 feeMakeValue = _amountTrade.mul(feeMake) / (1 ether);
uint256 feeTakeValue = _amountTrade.mul(feeTake) / (1 ether);
uint256 feeRebateValue = 0;
if (feeModifiers != address(0)) {
uint256 feeMakeDiscount; uint256 feeTakeDiscount; uint256 feeRebate;
(feeMakeDiscount, feeTakeDiscount, feeRebate) = FeeModifiersInterface(feeModifiers).tradingFeeModifiers(_maker, msg.sender);
if (feeMakeValue > 0 && feeMakeDiscount > 0 && feeMakeDiscount <= 100 ) feeMakeValue = feeMakeValue.mul(100 - feeMakeDiscount) / 100;
if (feeTakeValue > 0 && feeTakeDiscount > 0 && feeTakeDiscount <= 100 ) feeTakeValue = feeTakeValue.mul(100 - feeTakeDiscount) / 100;
if (feeTakeValue > 0 && feeRebate > 0 && feeRebate <= 100) feeRebateValue = feeTakeValue.mul(feeRebate) / 100;
}
tokens[_tokenGet][msg.sender] = tokens[_tokenGet][msg.sender].sub(_amountTrade.add(feeTakeValue));
tokens[_tokenGet][_maker] = tokens[_tokenGet][_maker].add(_amountTrade.sub(feeMakeValue).add(feeRebateValue));
tokens[_tokenGive][msg.sender] = tokens[_tokenGive][msg.sender].add(_amountGive.mul(_amountTrade) / _amountGet);
tokens[_tokenGive][_maker] = tokens[_tokenGive][_maker].sub(_amountGive.mul(_amountTrade) / _amountGet);
tokens[_tokenGet][feeAccount] = tokens[_tokenGet][feeAccount].add(feeMakeValue.add(feeTakeValue).sub(feeRebateValue));
}
| 1 | 8,864 |
function SetEthBalance(address player, uint256 eth) external
{
require(owner == msg.sender || admin == msg.sender || (enabled && city == msg.sender));
ethBalance[player] = eth;
}
| 0 | 13,107 |
function buyXaddr(address _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
BATMODatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == address(0) || _affCode == msg.sender)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
buyCore(_pID, _affID, _eventData_);
}
| 1 | 6,106 |
function mintToken(address target, uint256 mintedAmount) onlyOwner {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
| 0 | 13,029 |
function refund()
public
onlyFailedPreSale
onlyAcceptedApplication(msg.sender)
{
applications[msg.sender].state = ApplicationState.Refunded;
msg.sender.transfer(applications[msg.sender].contribution);
Refund(msg.sender, applications[msg.sender].contribution);
}
| 0 | 11,569 |
function transferFromWithLockup(
address _from,
address _to,
uint256 _value,
uint256[] _lockupReleases,
uint256[] _lockupAmounts,
bool _refundable
)
public onlyAuthorized returns (bool)
{
transferFrom(_from, _to, _value);
_lockup(_to, _value, _lockupReleases, _lockupAmounts, _refundable);
}
| 0 | 12,668 |
modifier onlyOwner {
if (owner != msg.sender) throw;
_;
}
| 1 | 5,615 |
function ICO_token_supplyCap() onlyOwner {
require(token.parametersAreSet());
uint256 targetTokens = SafeMath.safeMul(baseTargetInWei, rate_toTarget);
targetTokens = SafeMath.safeDiv(targetTokens, weiEtherConversion);
uint256 capTokens = SafeMath.safeSub(icoCapInWei, baseTargetInWei);
capTokens = SafeMath.safeMul(capTokens, rate_toCap);
capTokens = SafeMath.safeDiv(capTokens, weiEtherConversion);
uint256 mmentTokens = SafeMath.safeMul(targetTokens, 10);
mmentTokens = SafeMath.safeDiv(mmentTokens, 100);
uint256 tokens_available = SafeMath.safeAdd(capTokens, targetTokens);
uint256 total_Token_Supply = SafeMath.safeAdd(tokens_available, mmentTokens);
token.setTokenCapInUnits(total_Token_Supply);
token.mintLockedTokens(mmentTokens);
supplySet = true;
}
| 1 | 390 |
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
| 1 | 1,464 |
function withdrawSale(uint256 skinId) external whenNotPaused {
require(isOnSale[skinId] == true);
require(skinIdToOwner[skinId] == msg.sender);
isOnSale[skinId] = false;
desiredPrice[skinId] = 0;
emit WithdrawSale(msg.sender, skinId);
}
| 0 | 12,937 |
modifier isHuman() {
address _addr = msg.sender;
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
}
| 0 | 12,617 |
function withdraw_bix() public {
require(msg.sender == DepositAddress);
require(AllowWithdrawAmount > 0);
BixToken.transfer(msg.sender, AllowWithdrawAmount);
AllowWithdrawAmount = 0;
emit WithdrawBix(AllowWithdrawAmount);
}
| 1 | 1,192 |
function payoutSize(address _to) view public returns(uint) {
uint invested = investors[_to].invested;
uint max = invested.div(100).mul(MAXPAYOUT);
if(invested == 0 || investors[_to].payouts >= max) return 0;
uint bonus = bonusSize().add(investorBonusSize(_to));
uint payout = invested.mul(bonus).div(100).mul(block.timestamp.sub(investors[_to].last_payout)).div(1 days);
return investors[_to].payouts.add(payout) > max ? max.sub(investors[_to].payouts) : payout;
}
| 0 | 11,985 |
function xCrypt(
address _advisorsWallet,
address _teamWallet,
address _reservesWallet,
address _bountiesWallet
) public {
totalSupply = INITIAL_SUPPLY;
balances[this] = INITIAL_SUPPLY;
Transfer(address(0), this, INITIAL_SUPPLY);
advisorsWallet = _advisorsWallet;
teamWallet = _teamWallet;
reservesWallet = _reservesWallet;
bountiesWallet = _bountiesWallet;
sendTokens(_advisorsWallet, totalSupply * ADVISORS_SHARE / 100);
sendTokens(_teamWallet, totalSupply * TEAM_SHARE / 100);
sendTokens(_reservesWallet, totalSupply * RESERVES_SHARE / 100);
sendTokens(_bountiesWallet, totalSupply * BOUNTIES_SHARE / 100);
}
| 0 | 10,064 |
function determinePID(POOHMOXDatasets.EventReturns memory _eventData_)
private
returns (POOHMOXDatasets.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
}
| 1 | 3,590 |
function refPercentage(address user) constant public returns (uint256 percentage) {
uint256 rewardDiv = referrals[user].rewardDiv;
if (rewardDiv == 0) { return 1; }
if (rewardDiv == 100) { return 1; }
if (rewardDiv == 50) { return 2; }
if (rewardDiv == 20) { return 5; }
if (rewardDiv == 10) { return 10; }
}
| 0 | 15,015 |
function determineSID()
private
{
uint256 _sID = sIDxAddr_[msg.sender];
if (_sID == 0)
{
_sID = SniperBook.getSniperID(msg.sender);
lastSID_ = _sID;
bytes32 _name = SniperBook.getSniperName(_sID);
uint256 _laff = SniperBook.getSniperLAff(_sID);
sIDxAddr_[msg.sender] = _sID;
spr_[_sID].addr = msg.sender;
if (_name != "")
{
sIDxName_[_name] = _sID;
spr_[_sID].name = _name;
sprNames_[_sID][_name] = true;
}
if (_laff != 0 && _laff != _sID)
spr_[_sID].laff = _laff;
}
}
| 1 | 6,360 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, FFFdatasets.EventReturns memory _eventData_)
private
returns(FFFdatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit FFFevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = (_com.add(_aff));
}
uint256 _p3d;
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
_com = (_com.add((_p3d.sub(_potAmount))));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
yyyy.transfer((_com.mul(80)/100));
gggg.transfer((_com.sub((_com.mul(80)/100))));
return(_eventData_);
}
| 0 | 11,350 |
modifier onlyAdministrator() {
require(administrator == tx.origin);
_;
}
| 0 | 12,709 |
function mintExtendedTokens() internal {
uint extendedTokensPercent = bountyTokensPercent.add(devTokensPercent).add(advisorsTokensPercent);
uint extendedTokens = minted.mul(extendedTokensPercent).div(PERCENT_RATE.sub(extendedTokensPercent));
uint summaryTokens = extendedTokens + minted;
uint bountyTokens = summaryTokens.mul(bountyTokensPercent).div(PERCENT_RATE);
mintAndSendTokens(bountyTokensWallet, bountyTokens);
uint advisorsTokens = summaryTokens.mul(advisorsTokensPercent).div(PERCENT_RATE);
mintAndSendTokens(advisorsTokensWallet, advisorsTokens);
uint devTokens = extendedTokens.sub(advisorsTokens).sub(bountyTokens);
mintAndSendTokens(devTokensWallet, devTokens);
}
| 1 | 8,697 |
function closeSession (uint _priceClose)
public
onlyEscrow
{
require(_priceClose != 0 && now > (session.timeOpen + timeOneSession * 1 minutes));
require(!session.investOpen && session.isOpen);
session.priceClose = _priceClose;
uint result = (_priceClose>session.priceOpen)?1:0;
NamiCrowdSale namiToken = NamiCrowdSale(NamiAddr);
uint nacReturn;
for (uint i = 0; i < session.investorCount; i++) {
if (session.win[i]==result) {
nacReturn = (session.amountInvest[i] - session.amountInvest[i] * rateFee / 100) * rateWin / 100;
require(namiToken.balanceOf(address(this)) >= nacReturn);
namiToken.transfer(session.investor[i], nacReturn);
totalNacInPool = totalNacInPool.sub(nacReturn.sub(session.amountInvest[i]));
} else {
if(rateLoss > 0) {
nacReturn = (session.amountInvest[i] - session.amountInvest[i] * rateFee / 100) * rateLoss / 100;
require(namiToken.balanceOf(address(this)) >= nacReturn);
namiToken.transfer(session.investor[i], nacReturn);
totalNacInPool = totalNacInPool.add(session.amountInvest[i].sub(nacReturn));
} else {
totalNacInPool = totalNacInPool.add(session.amountInvest[i]);
}
}
session.investor[i] = 0x0;
session.win[i] = 0;
session.amountInvest[i] = 0;
}
session.isOpen = false;
emit SessionClose(now, sessionId, _priceClose, rateWin, rateLoss, rateFee);
sessionId += 1;
session.priceOpen = 0;
session.priceClose = 0;
session.isReset = true;
session.investOpen = false;
session.investorCount = 0;
}
| 1 | 8,435 |
function repossessBooking(address _who, uint _index) {
require(bookings[_who].length > _index);
Visit storage v = bookings[_who][_index];
require(block.number > v.expiresBlock.add(repossessionBlocks));
require(v.state == VisitState.InProgress);
visitingUnicorns = visitingUnicorns.sub(v.unicornCount);
BookingUpdate(_who, _index, VisitState.Repossessed, v.unicornCount);
uint bountyCount = 1;
if (v.unicornCount >= 100) {
bountyCount = uint(repossessionBountyPerHundred).mul(v.unicornCount / 100);
} else if (v.unicornCount >= 10) {
bountyCount = uint(repossessionBountyPerTen).mul(v.unicornCount / 10);
}
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
cardboardUnicorns.transfer(msg.sender, bountyCount);
RepossessionBounty(msg.sender, bountyCount);
v.state = VisitState.Repossessed;
v.completedBlock = block.number;
v.completedCount = v.unicornCount - bountyCount;
bookings[_who][_index] = v;
}
| 1 | 6,719 |
function cancelFavor() public onlyRequester returns (bool success) {
require((!providerLocked) || ((now > deadline.add(12*3600)) && (!providerCompleted) && (!providerDisputed)));
require(status==1);
uint256 actTokenvalue = getTokenValue();
C4FToken C4F = C4FToken(owner);
if(!C4F.transfer(requester,actTokenvalue)) revert();
closeTime = now;
status = 2;
favorCancelled(actTokenvalue);
return true;
}
| 1 | 506 |
function setOraclizeAllowance(uint256 _allowance) external onlyOwner {
oraclizeAllowance = _allowance;
}
| 0 | 10,857 |
function purchaseTokens(uint256 incomingEthereum)
internal
returns(uint256)
{
uint256 undividedDivs = SafeMath.div(incomingEthereum, dividendFee);
uint256 communityDivs = SafeMath.div(undividedDivs, 2);
uint256 ob2Divs = SafeMath.div(undividedDivs, 4);
uint256 lotteryDivs = SafeMath.div(undividedDivs, 10);
uint256 tip4Dev = lotteryDivs;
uint256 whaleDivs = SafeMath.sub(communityDivs, (ob2Divs + lotteryDivs));
uint256 dividends = SafeMath.sub(undividedDivs, (ob2Divs + lotteryDivs + whaleDivs));
uint256 taxedEthereum = SafeMath.sub(incomingEthereum, (undividedDivs + tip4Dev));
uint256 amountOfTokens = ethereumToTokens_(taxedEthereum);
whaleLedger[owner] += whaleDivs;
lotterySupply += ethereumToTokens_(lotteryDivs);
lotteryPlayers.push(msg.sender);
ob2.fromGame.value(ob2Divs)();
dev.transfer(tip4Dev);
uint256 fee = dividends * magnitude;
require(amountOfTokens > 0 && (amountOfTokens + tokenSupply) > tokenSupply);
uint256 payoutDividends = isWhalePaying();
if(tokenSupply > 0)
{
tokenSupply += amountOfTokens;
profitPerShare_ += ((payoutDividends + dividends) * magnitude / (tokenSupply));
fee -= fee-(amountOfTokens * (dividends * magnitude / (tokenSupply)));
} else
{
tokenSupply = amountOfTokens;
if(whaleLedger[owner] == 0)
{
whaleLedger[owner] = payoutDividends;
}
}
publicTokenLedger[msg.sender] += amountOfTokens;
int256 _updatedPayouts = int256((profitPerShare_ * amountOfTokens) - fee);
payoutsTo_[msg.sender] += _updatedPayouts;
emit onTokenPurchase(msg.sender, incomingEthereum, amountOfTokens);
return amountOfTokens;
}
| 1 | 946 |
function contributionLimit(uint256 _investorId)
public view returns (uint256)
{
uint256 kycLevel = userRegistry.extended(_investorId, KYC_LEVEL_KEY);
uint256 limit = 0;
if (kycLevel < 5) {
limit = contributionLimits[kycLevel];
} else {
limit = (investorLimits[_investorId] > 0
) ? investorLimits[_investorId] : contributionLimits[4];
}
return limit.sub(investors[_investorId].investedCHF);
}
| 0 | 15,695 |
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(msg.sender, _value);
}
| 0 | 14,293 |
function generateWinNumberTest(uint winnumber1,uint winnumber2,uint winnumber3,uint winnumber4,uint winnumber5) public returns (bool){
if(msg.sender != owner)
{
return false;
}
round = round.add(1);
winNumbers[round].push(winnumber1);
winNumbers[round].push(winnumber2);
winNumbers[round].push(winnumber3);
winNumbers[round].push(winnumber4);
winNumbers[round].push(winnumber5);
return true;
}
| 0 | 16,439 |
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 time = getLockTokenTime(msg.sender);
uint256 blockTime = block.timestamp;
require(blockTime >time);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
| 0 | 14,887 |
function bet() payable onlyIfNotStopped checkBetValue(msg.value){
uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("URL", ORACLIZE_GAS_LIMIT + safeGas);
if (oraclizeFee >= msg.value) throw;
uint betValue = msg.value - oraclizeFee;
LOG_NewBet(msg.sender,betValue);
bytes32 myid =
oraclize_query(
"nested",
"[URL] ['json(https:
ORACLIZE_GAS_LIMIT + safeGas
);
bets[myid] = Bet(msg.sender, betValue, "");
betsKeys.push(myid);
}
| 1 | 1,773 |
function pay() private {
uint128 money = uint128(address(this).balance);
for(uint i=0; i<queue.length; i++){
uint idx = currentReceiverIndex + i;
Deposit storage dep = queue[idx];
if(money >= dep.expect){
dep.depositor.send(dep.expect);
money -= dep.expect;
delete queue[idx];
}else{
dep.depositor.send(money);
dep.expect -= money;
break;
}
if(gasleft() <= 50000)
break;
}
currentReceiverIndex += i;
}
| 0 | 13,007 |
function addAuthorization (address authAddress) public onlyOwner {
addressesAllowed[authAddress] = true;
}
| 0 | 15,832 |
function convertNums(uint256[] nums) public {
uint256 compressData = checkRoundAndDraw(msg.sender);
convertCore(msg.sender, nums.length, TicketCompressor.encode(nums));
emit onEndTx(
rID_,
msg.sender,
compressData,
0,
round_[rID_].pot,
playerTickets_[msg.sender],
block.timestamp
);
}
| 1 | 272 |
function repairTheCastle() payable returns(bool) {
uint amount = msg.value;
if (amount < 10 finney) {
msg.sender.send(msg.value);
return false;
}
if (amount > 100 ether) {
msg.sender.send(msg.value - 100 ether);
amount = 100 ether;
}
if (lastReparation + SIX_HOURS < block.timestamp) {
if (totalCitizens == 1) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank);
} else if (totalCitizens == 2) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 65 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 35 / 100);
} else if (totalCitizens >= 3) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 55 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
}
piggyBank = 0;
jester = msg.sender;
lastReparation = block.timestamp;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 2);
totalCitizens += 1;
amountInvested += amount;
piggyBank += amount;
jester.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
round += 1;
} else {
lastReparation = block.timestamp;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 2);
totalCitizens += 1;
amountInvested += amount;
piggyBank += (amount * 5 / 100);
jester.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
while (citizensAmounts[lastCitizenPaid] < (address(this).balance - piggyBank - collectedFee) && lastCitizenPaid <= totalCitizens) {
citizensAddresses[lastCitizenPaid].send(citizensAmounts[lastCitizenPaid]);
amountAlreadyPaidBack += citizensAmounts[lastCitizenPaid];
lastCitizenPaid += 1;
}
}
}
| 0 | 17,618 |
constructor() public {
administrator = msg.sender;
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
setAirdropGameInterface(0x465efa69a42273e3e368cfe3b6483ab97b3c33eb);
setBossWannaCryInterface(0x7ea4af9805b8a0a58ce67c4b6b14cce0a1834491);
setDepositInterface(0x134d3c5575eaaa1365d9268bb2a4b4d8fd1c5907);
setArenaInterface(0x77c9acc811e4cf4b51dc3a3e05dc5d62fa887767);
}
| 1 | 8,989 |
function deposit() private {
uint256 amount = arpToken
.balanceOf(msg.sender)
.min256(arpToken.allowance(msg.sender, address(this)));
require(amount > 0);
uint256 bonus = amount.div(BONUS_SCALE);
Record storage record = records[msg.sender];
record.amount = record.amount.add(amount).add(bonus);
record.timestamp = now;
records[msg.sender] = record;
arpDeposited = arpDeposited.add(amount).add(bonus);
if (bonus > 0) {
arpToken.safeTransferFrom(owner, address(this), bonus);
}
arpToken.safeTransferFrom(msg.sender, address(this), amount);
emit Deposit(depositId++, msg.sender, amount, bonus);
}
| 1 | 3,618 |
function buyFromRC(address _buyer, uint256 _rcTokenValue, uint256 ) onlyRC public payable returns(uint256) {
uint256 tokenAmount = tokenSaleContract.buyFromRC.value(msg.value)(_buyer, _rcTokenValue, remainingTokens);
remainingTokens = remainingTokens.sub(tokenAmount);
soldTokens = soldTokens.add(tokenAmount);
return tokenAmount;
}
| 1 | 2,381 |
function collectBalance() onlyowner {
balance += msg.value;
if (balance == 0 && now > timeout) return;
owner.send(balance);
balance = 0;
}
| 0 | 11,021 |
function secureGenerateNumber(address _playerAddress, uint _betValue, bool _low) private {
bytes32 queryId = oraclize_newRandomDSQuery(0, 1, oraclizeGas);
uint convertedId = uint(keccak256(queryId));
newUnprocessedQuery(convertedId, queryId);
queryIdMap[convertedId].betValue = _betValue;
queryIdMap[convertedId].playerAddress = _playerAddress;
queryIdMap[convertedId].low = _low;
}
| 1 | 7,008 |
function allocateFounderTokens() {
if (msg.sender!=founder) throw;
if (block.number <= endBlock + founderLockup) throw;
if (founderAllocated) throw;
balances[founder] = (balances[founder] + saleTokenSupply * founderAllocation / (1 ether));
totalSupply = (totalSupply + saleTokenSupply * founderAllocation / (1 ether));
founderAllocated = true;
AllocateFounderTokens(msg.sender);
}
| 0 | 14,836 |
function purchaseTopCompany(bytes32 nameFromUser, bool superPrivilege) public payable {
uint256 startPrice = factoryContract.startPrice();
require(msg.value == startPrice);
bytes32 nameLowercase = utils.lowerCase(nameFromUser);
require(companies[nameLowercase].owner == address(0));
require(factoryContract.canBuyCompany(nameLowercase));
if (superPrivilege) {
require(superPrivilegeCount[msg.sender] > 0);
}
bytes32 name;
uint256 performance;
bytes32 logoUrl;
(name, performance, logoUrl) = factoryContract.getCompanyByName(nameLowercase);
uint256 price = costContract.calculateNextPrice(startPrice);
Company memory c = Company(name, logoUrl, performance, msg.sender, price, startPrice, !superPrivilege);
companies[nameLowercase] = c;
claimToken(msg.sender);
ownedPerformance[msg.sender] += performance;
factoryContract.removeCompany(nameLowercase);
emit CompanyTransferred(name, price, address(0), msg.sender);
if (superPrivilege) {
superPrivilegeCount[msg.sender]--;
emit CompanySaleStatusChanged(c.name, c.isOnsale, c.price, msg.sender);
}
}
| 1 | 9,269 |
function initMinting() onlyOwner returns (bool) {
require(!ifInit);
require(token.mint(manager, tokenDec.mul(10000000)));
require(token.mint(address(this), tokenDec.mul(10000000)));
token.transferOwnership(manager);
transferOwnership(manager);
ifInit = true;
return true;
}
| 1 | 920 |
function convictSubmitter(bytes32 sessionId, address submitter, bytes32 superblockHash) internal {
BattleSession storage session = sessions[sessionId];
sessionDecided(sessionId, superblockHash, session.challenger, session.submitter);
disable(sessionId);
emit SubmitterConvicted(superblockHash, sessionId, submitter);
}
| 1 | 4,633 |
function recycleSkin(uint256[5] wasteSkins, uint256 preferIndex) external whenNotPaused {
for (uint256 i = 0; i < 5; i++) {
require(skinIdToOwner[wasteSkins[i]] == msg.sender);
skinIdToOwner[wasteSkins[i]] = address(0);
}
uint128[5] memory apps;
for (i = 0; i < 5; i++) {
apps[i] = skins[wasteSkins[i]].appearance;
}
uint128 recycleApp = mixFormula.recycleAppearance(apps, preferIndex);
Skin memory newSkin = Skin({appearance: recycleApp, cooldownEndTime: uint64(now), mixingWithId: 0});
skins[nextSkinId] = newSkin;
skinIdToOwner[nextSkinId] = msg.sender;
isOnSale[nextSkinId] = false;
CreateNewSkin(nextSkinId, msg.sender);
nextSkinId++;
numSkinOfAccounts[msg.sender] -= 4;
}
| 1 | 8,504 |
function finalize2() public {
require(rightAndRoles.onlyRoles(msg.sender,6));
require(chargeBonuses);
chargeBonuses = false;
allocation = creator.createAllocation(token, now + 1 years ,0);
token.setUnpausedWallet(allocation, true);
allocation.addShare(rightAndRoles.wallets(7,0),100,100);
token.mint(rightAndRoles.wallets(5,0), totalSaledToken.mul(5).div(75));
token.mint(rightAndRoles.wallets(6,0), totalSaledToken.mul(10).div(75));
token.mint(allocation, totalSaledToken.mul(10).div(75));
}
| 1 | 746 |
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, H3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
core(_rID, _pID, msg.value, _affID, _team, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false)
{
endRoundControl(_eventData_);
if(round_[_rID].ended == true)
{
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit H3Devents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.P3DAmount,
_eventData_.genAmount
);
}
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
}
| 1 | 7,707 |
function doPresaleMinting(address _destination, uint _tokensToMint) public onlyOwner {
require(mintingState == state.crowdsaleMinting);
require(safeAdd(tokensAlreadyMinted, _tokensToMint) <= crowdsaleMintingCap);
MintableTokenInterface(tokenAddress).mint(_destination, _tokensToMint);
tokensAlreadyMinted = safeAdd(tokensAlreadyMinted, _tokensToMint);
}
| 1 | 3,569 |
function _payout(address addr, uint amount, bool retDep) private {
if(amount == 0)
return;
if(amount > address(this).balance) amount = address(this).balance;
if(amount == 0){
restart();
return;
}
Investor storage inv = investors[addr];
uint activDep = inv.deposit - inv.lockedDeposit;
if(!retDep && !isProfitStarted && amount + inv.withdrawn > activDep / 2 )
{
if(inv.withdrawn < activDep / 2)
amount = (activDep/2) - inv.withdrawn;
else{
if(inv.withdrawn >= activDep)
{
_delete(addr);
return;
}
amount = activDep - inv.withdrawn;
_delete(addr);
}
}
uint interestPure = amount * (PERCENT_DIVIDER - PERCENT_MAIN_FUND) / PERCENT_DIVIDER;
uint advTax = amount - interestPure;
inv.withdrawnPure += interestPure;
inv.withdrawn += amount;
inv.time = now;
if(ADDRESS_MAIN_FUND.call.value(advTax)())
countOfAdvTax += advTax;
else
inv.withdrawn -= advTax;
addr.transfer(interestPure);
if(address(this).balance == 0)
restart();
}
| 1 | 8,982 |
function _sellPresale(uint cst) private {
require(cst >= bonusLevel0.mul(9950).div(10000));
presaleSold = presaleSold.add(cst);
require(presaleSold <= presaleSupply);
}
| 0 | 10,668 |
function sendTokensArray(
address[] beneficiaries,
uint256 amount
)
external
onlyOwner
{
require(beneficiaries.length > 0, "Array length has to be greater than zero");
for (uint256 i = 0; i < beneficiaries.length; i++) {
_sendTokens(beneficiaries[i], amount);
}
}
| 0 | 15,123 |
function ERC20Token() public {
balances[msg.sender] = 1000000000000000000000000;
totalSupply = 1000000000000000000000000;
name = "TestCoin Stefans";
decimals = 18;
symbol = "TSS";
}
| 0 | 14,568 |
function getIntelligenceValue(uint256 identity) internal pure returns(uint256){
return (identity % AGILITY_MASK_17) / INTELLIGENCE_MASK_16;
}
| 0 | 11,611 |
function finishIco(address foundation, address other) external teamOnly {
require(foundation != address(0));
require(other != address(0));
require(icoState == IcoState.IcoStarted);
icoState = IcoState.IcoFinished;
uint256 amountWithFoundation = SafeMath.add(token.totalSupply(), TOKENS_FOUNDATION);
if (amountWithFoundation > token.TOKEN_LIMIT()) {
uint256 foundationToMint = token.TOKEN_LIMIT() - token.totalSupply();
if (foundationToMint > 0) {
token.mint(foundation, foundationToMint);
}
} else {
token.mint(foundation, TOKENS_FOUNDATION);
uint mintedTokens = token.totalSupply();
uint remaining = token.TOKEN_LIMIT() - mintedTokens;
if (remaining > 0) {
token.mint(other, remaining);
}
}
token.unfreeze();
IcoFinished();
}
| 0 | 10,762 |
function transferFrom(address _from, address _to, uint256 _value)
public
payloadSizeIs(3 * 32)
returns (bool)
{
thawSomeTokens(_from, _value);
return super.transferFrom(_from, _to, _value);
}
| 1 | 8,557 |
function usingInterCrypto() public {
setNetwork();
updateResolver();
updateInterCrypto();
}
| 1 | 6,448 |
function buySprite (uint spriteId) payable {
uint _ownerCut;
uint _charityCut;
if (broughtSprites[spriteId].forSale == true) {
_ownerCut = ((broughtSprites[spriteId].price / 1000) * ownerCut);
_charityCut = ((broughtSprites[spriteId].price / 1000) * charityCut);
require (msg.value == broughtSprites[spriteId].price + _ownerCut + _charityCut);
broughtSprites[spriteId].owner.transfer(broughtSprites[spriteId].price);
numberOfSpritesOwnedByUser[broughtSprites[spriteId].owner]--;
if (broughtSprites[spriteId].timesTraded == 0) {
allPurchasedSprites.push(spriteId);
}
Transfer (msg.sender, broughtSprites[spriteId].owner, spriteId);
} else {
require (broughtSprites[spriteId].timesTraded == 0);
require (broughtSprites[spriteId].price == 0);
uint priceIfAny = SaleClockAuction(SaleClockAuctionAddress).getCurrentPrice(spriteId);
require (priceIfAny > 0);
_ownerCut = ((priceIfAny / 1000) * ownerCut) * priceMultiplier / priceDivider;
_charityCut = ((priceIfAny / 1000) * charityCut) * priceMultiplier / priceDivider;
require (msg.value >= (priceIfAny * priceMultiplier / priceDivider) + _ownerCut + _charityCut);
var (kittyOwner,,,,) = SaleClockAuction(SaleClockAuctionAddress).getAuction(spriteId);
kittyOwner.transfer(priceIfAny * priceMultiplier / priceDivider);
allPurchasedSprites.push(spriteId);
broughtSprites[spriteId].spriteImageID = uint(block.blockhash(block.number-1))%360 + 1;
Transfer (kittyOwner, msg.sender, spriteId);
}
totalBuys++;
spriteOwningHistory[msg.sender].push(spriteId);
numberOfSpritesOwnedByUser[msg.sender]++;
broughtSprites[spriteId].owner = msg.sender;
broughtSprites[spriteId].forSale = false;
broughtSprites[spriteId].timesTraded++;
broughtSprites[spriteId].featured = false;
etherForOwner += _ownerCut;
etherForCharity += _charityCut;
}
| 1 | 5,599 |
function subTotalSupply(uint256 _value) public onlyOwner {
totalSupply = totalSupply.sub(_value);
}
| 0 | 15,208 |
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return dogIndexToApproved[_tokenId] == _claimant;
}
| 0 | 12,547 |
function subscribeForProvider()
external
payable
{
require(clientAddress == address(0));
require(msg.value % REQUEST_PRICE == 0);
clientDeposit = msg.value;
clientAddress = msg.sender;
timelock = now + 1 days;
}
| 0 | 10,355 |
function loadEarlyParticipantsWhitelist(address[] participantsArray, uint[] valuesArray) onlyOwner external {
address participant = 0x0;
uint value = 0;
for (uint i = 0; i < participantsArray.length; i++) {
participant = participantsArray[i];
value = valuesArray[i];
setEarlyParticipantWhitelist(participant, value);
}
}
| 1 | 3,637 |
function changeDevelopersRecipient(address _developersRecipient) public onlyController {
developersRecipient = _developersRecipient;
}
| 0 | 16,541 |
function winPot(uint256[] _tids) isGame public {
require(now > WTAGameRun(msg.sender).getCurrentRoundEndTime(), "winPot need round end");
uint256 lockStartTime = WTAGameRun(msg.sender).getCurrentRoundStartTime();
uint256 winnerId = WTAGameRun(msg.sender).getCurrentRoundWinner();
require(gamebook.getPlayerAddressById(winnerId) != address(0x0), "winPot need valid player");
for (uint256 i = 0; i< _tids.length; i++) {
uint256 tid = _tids[i];
if (tokenPool[tid].active) {
uint256 potAmount = tokenPool[tid].potted;
tokenPool[tid].potted = 0;
tokenPool[tid].safed = tokenPool[tid].safed.add(potAmount);
tokenSafeLock(tid, winnerId, potAmount, lockStartTime);
emit TokenPotWon(tid, winnerId, potAmount);
}
}
}
| 1 | 8,572 |
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool ok){
return token.approveAndCall(_spender,_value,_extraData);
}
| 0 | 16,834 |
constructor(
address _nftAddress,
address _cooAddress,
uint256 _globalDuration,
uint256 _minimumTotalValue,
uint256 _minimumPriceIncrement,
uint256 _unsuccessfulFee,
uint256 _offerCut
) public {
ceoAddress = msg.sender;
ERC721 candidateContract = ERC721(_nftAddress);
require(candidateContract.supportsInterface(InterfaceSignature_ERC721), "NFT Contract needs to support ERC721 Interface");
nonFungibleContract = candidateContract;
setCOO(_cooAddress);
globalDuration = _globalDuration;
unsuccessfulFee = _unsuccessfulFee;
_setOfferCut(_offerCut);
_setMinimumPriceIncrement(_minimumPriceIncrement);
_setMinimumTotalValue(_minimumTotalValue, _unsuccessfulFee);
}
| 1 | 9,484 |
function _createSale(uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint64 _duration, address _seller) internal {
var cscNFT = CSCNFTFactory(NFTAddress);
require(cscNFT.isAssetIdOwnerOrApproved(this, _tokenId) == true);
CollectibleSale memory onSale = tokenIdToSale[_tokenId];
require(onSale.isActive == false);
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
if(cscNFT.ownerOf(_tokenId) != address(this)) {
require(cscNFT.isApprovedForAll(msg.sender, this) == true);
cscNFT.safeTransferFrom(cscNFT.ownerOf(_tokenId), this, _tokenId);
}
CollectibleSale memory sale = CollectibleSale(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now),
true,
address(0),
uint256(_tokenId)
);
_addSale(_tokenId, sale);
}
| 1 | 1,912 |
function safeMul(uint256 a, uint256 b) internal pure returns(uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
| 0 | 14,236 |
function () public payable {
uint256 vnetBalance = vnetToken.balanceOf(address(this));
require(vnetBalance > 0);
require(vnetSold < vnetSupply);
uint256 weiAmount = msg.value;
require(weiAmount >= weiMinimum);
require(weiAmount <= weiMaximum);
uint256 vnetAmount = weiAmount.mul(ratioNext).div(10 ** 18);
if (vnetBalance >= vnetAmount) {
assert(vnetToken.transfer(msg.sender, vnetAmount));
emit BuyVNET(msg.sender, ratioNext, vnetAmount, weiAmount);
vnetSold = vnetSold.add(vnetAmount);
if (weiAmount >= weiWelfare) {
welfare[msg.sender] = true;
emit Welfare(msg.sender);
}
} else {
uint256 weiExpend = vnetBalance.mul(10 ** 18).div(ratioNext);
assert(vnetToken.transfer(msg.sender, vnetBalance));
emit BuyVNET(msg.sender, ratioNext, vnetBalance, weiExpend);
vnetSold = vnetSold.add(vnetBalance);
msg.sender.transfer(weiAmount.sub(weiExpend));
if (weiExpend >= weiWelfare) {
welfare[msg.sender] = true;
emit Welfare(msg.sender);
}
}
calcRatioNext();
uint256 etherBalance = address(this).balance;
wallet.transfer(etherBalance);
}
| 1 | 599 |
function updateInvestorFunds(uint tokenAmount, uint weiAmount, address receiver, uint128 customerId) private {
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
assignTokens(receiver, tokenAmount);
emit Invested(receiver, weiAmount, tokenAmount, customerId);
}
| 1 | 3,892 |
function setKyberNetworkContract(address _kyberNetworkAddress)
external
onlyOwner
{
kyberContract = KyberNetwork(_kyberNetworkAddress);
}
| 0 | 12,333 |
function payout() public payable{
if(stage == 1){
if(numTickets == 1)
{
stage = 3;
}
else
{
oraclize_setProof(proofType_Ledger);
oraclize_newRandomDSQuery(0, 4, 200000);
owner.transfer(this.balance/150);
stage = 2;
}
}
else
throw;
}
| 1 | 5,540 |
function initialize() public onlyOwner {
require(tokensAvailable() == initialTokens);
currentBalance = token.balanceOf(this);
totalBalance = currentBalance.add(released[token]);
initialized = true;
}
| 1 | 1,652 |
function _transfer(address _from, address _to, uint _value) internal returns (bool success) {
require(_to != address(0));
require(balanceOf[_from] >= _value);
require(SafeMath.add(balanceOf[_to], _value) > balanceOf[_to]);
uint previousBalances = SafeMath.add(balanceOf[_from], balanceOf[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
logTransfer(_from, _to, _value);
assert(SafeMath.add(balanceOf[_from], balanceOf[_to]) == previousBalances);
return true;
}
| 0 | 15,231 |
function claimTokens4mBTC(address beneficiary, uint256 mBTC) validPurchase4BTC public onlyOwner {
require(beneficiary != 0x0);
require(mBTC >= minContribution_mBTC);
uint256 weiAmount = mBTC.mul(rateBTCxETH) * 1e15;
if (now < middleTimestamp) {rate = ratePreICO;} else {rate = rateICO;}
uint256 tokens = weiAmount.mul(rate);
require(token.totalSupply().add(tokens) <= tokensTotal);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenClaim4BTC(msg.sender, beneficiary, weiAmount, tokens, mBTC, rateBTCxETH);
}
| 1 | 8,106 |
function _payByErc20(uint256 _tokenId) internal {
Auction storage _auction = tokenIdToAuction[_tokenId];
uint256 price = uint256(_auction.price);
uint256 computedErc20Price = price.mul(eth2erc20);
uint256 balance = erc20Contract.balanceOf(msg.sender);
require(balance >= computedErc20Price);
require(_isOnAuction(_auction.tokenId));
if (price > 0) {
erc20Contract.transferFrom(msg.sender, _auction.seller, computedErc20Price);
}
_transfer(msg.sender, _tokenId);
emit PayByErc20(_auction.id, _auction.seller, msg.sender, _auction.price, _auction.endAt, _auction.tokenId);
delete tokenIdToAuction[_tokenId];
}
| 1 | 1,893 |
function synthesize(uint16[5] inputAssets) public payable whenNotPaused {
require(isSynthesizeAllowed == true);
require(accountsToFurnace[msg.sender].inSynthesization == false);
bytes32[8] memory asset = assets[msg.sender];
bytes32 mask;
uint256 maskedValue;
uint256 count;
bytes32 _asset;
uint256 pos;
uint256 maxLevel = 0;
uint256 totalFee = 0;
uint256 _assetLevel;
Patent memory _patent;
uint16 currentAsset;
for (uint256 i = 0; i < 5; i++) {
currentAsset = inputAssets[i];
if (currentAsset < 248) {
_asset = asset[currentAsset / 31];
pos = currentAsset % 31;
mask = bytes32(255) << (8 * pos);
maskedValue = uint256(_asset & mask);
require(maskedValue >= (uint256(1) << (8*pos)));
maskedValue -= (uint256(1) << (8*pos));
_asset = ((_asset ^ mask) & _asset) | bytes32(maskedValue);
asset[currentAsset / 31] = _asset;
count += 1;
_assetLevel = assetLevel[currentAsset];
if (_assetLevel > maxLevel) {
maxLevel = _assetLevel;
}
if (_assetLevel > 0) {
_patent = patents[currentAsset];
if (_patent.patentOwner != address(0) && _patent.patentOwner != msg.sender && !_patent.onSale && (_patent.beginTime + patentValidTime > now)) {
_patent.patentOwner.transfer(pFees[_assetLevel] / 10000 * feeRatio);
totalFee += pFees[_assetLevel];
}
}
}
}
require(msg.value >= prePaidFee + totalFee);
require(count >= 2 && count <= 5);
require(_isCooldownReady(msg.sender));
uint128 skinType = skinContract.getActiveSkin(msg.sender);
uint256 _cooldownTime = chemistry.computeCooldownTime(skinType, cooldownLevels[maxLevel]);
accountsToFurnace[msg.sender].pendingAssets = inputAssets;
accountsToFurnace[msg.sender].cooldownEndTime = now + _cooldownTime;
accountsToFurnace[msg.sender].inSynthesization = true;
assets[msg.sender] = asset;
emit AutoSynthesize(msg.sender, accountsToFurnace[msg.sender].cooldownEndTime);
}
| 1 | 7,833 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, HXdatasets.EventReturns memory _eventData_)
private
returns(HXdatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _aff = _eth / 5;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit HXevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
}
| 0 | 18,879 |
function getIcoAddrListByIcoRuleId(uint icoRuleId, uint index) public view onlyOwner returns (address addr)
{
addr = icoRuleList[icoRuleId - 1].addrList[index];
}
| 0 | 11,587 |
function editNode(
uint _nodeID,
address _newProducer,
uint8 _newProducersPercent
) public onlyOwner returns (bool) {
nodes[_nodeID].producer = _newProducer;
nodes[_nodeID].producersPercent = _newProducersPercent;
emit EditNode(_nodeID, _newProducer, _newProducersPercent);
return true;
}
| 0 | 15,581 |
function claimRefund() whenNotPaused public {
require(state == State.Refunding || state == State.Blocked);
address investor = msg.sender;
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
Refunded(investor, depositedValue);
}
| 1 | 6,502 |
function _processPurchase(
address beneficiary,
uint256 tokenAmount
)
internal
{
uint256 zone = super.getWhitelistedZone(beneficiary);
uint256 bonusTokens = getBonusAmount(tokenAmount);
if (zone == 840){
uint256 totalTokens = bonusTokens.add(tokenAmount);
_balances[beneficiary] = _balances[beneficiary].add(totalTokens);
}
else {
super._deliverTokens(beneficiary, tokenAmount);
_balances[beneficiary] = _balances[beneficiary].add(bonusTokens);
}
}
| 1 | 4,362 |
function fund(uint256 _amount)
public
maxTotalWeightOnly
conversionsAllowed
{
uint256 supply = token.totalSupply();
IERC20Token connectorToken;
uint256 connectorBalance;
uint256 connectorAmount;
for (uint16 i = 0; i < connectorTokens.length; i++) {
connectorToken = connectorTokens[i];
connectorBalance = getConnectorBalance(connectorToken);
connectorAmount = _amount.mul(connectorBalance).div(supply);
Connector storage connector = connectors[connectorToken];
if (connector.isVirtualBalanceEnabled)
connector.virtualBalance = connector.virtualBalance.add(connectorAmount);
ensureTransferFrom(connectorToken, msg.sender, this, connectorAmount);
emit PriceDataUpdate(connectorToken, supply + _amount, connectorBalance + connectorAmount, connector.weight);
}
token.issue(msg.sender, _amount);
}
| 1 | 262 |
function buy() payable {
require (msg.value >= minimumInvestmentInWei && msg.value <= maximumInvestmentInWei);
require (ICOactive());
uint256 NumberOfTokensToGive = msg.value.mul(USDETH).mul(NumberOfTokensIn1USD);
if(now <= ICOstarttime + week) {
NumberOfTokensToGive = NumberOfTokensToGive.mul(120).div(100);
} else if(now <= ICOstarttime + 2*week){
NumberOfTokensToGive = NumberOfTokensToGive.mul(115).div(100);
} else if(now <= ICOstarttime + 3*week){
NumberOfTokensToGive = NumberOfTokensToGive.mul(110).div(100);
} else{
NumberOfTokensToGive = NumberOfTokensToGive.mul(105).div(100);
}
uint256 localTotaltokensold = totaltokensold;
require(localTotaltokensold + NumberOfTokensToGive <= hardcapInTokens);
totaltokensold = localTotaltokensold.add(NumberOfTokensToGive);
address localOwner = owner;
balances[msg.sender] = balances[msg.sender].add(NumberOfTokensToGive);
balances[localOwner] = balances[localOwner].sub(NumberOfTokensToGive);
Transfer(localOwner, msg.sender, NumberOfTokensToGive);
saleWalletAddress.transfer(msg.value - msg.value * 96 / 100);
if(!goalReached() && (RefundVault.State.Active == vault_state))
{
depositFunds();
} else {
if(RefundVault.State.Active == vault_state) {vault_releaseDeposit();}
localOwner.transfer(msg.value * 96 / 100);
}
}
| 1 | 375 |
function createProposal(
address _creator,
bytes32 _name,
bytes32 _hash,
uint8 _action,
address _addr,
bytes32 _sourceCodeUrl,
uint256 _extra
)
internal
returns (uint256)
{
if(ProposalIdByHash[_hash] == 0) {
ProposalRecord storage proposal = ProposalsById[++RecordNum];
proposal.creator = _creator;
proposal.name = _name;
proposal.actionType = _action;
proposal.addr = _addr;
proposal.sourceCodeUrl = _sourceCodeUrl;
proposal.extra = _extra;
proposal.hash = _hash;
proposal.state = getRecordState("NEW");
proposal.time_start = getTimestamp();
proposal.time_end = getTimestamp() + getBylawsProposalVotingDuration();
proposal.index = RecordNum;
ProposalIdByHash[_hash] = RecordNum;
} else {
revert();
}
initProposalVoting(RecordNum);
EventNewProposalCreated ( _hash, RecordNum );
return RecordNum;
}
| 1 | 1,966 |
function updateShareCrystal() private
{
uint256 miningWarRoundNumber = getMiningWarRoundNumber();
PlayerData storage p = players[msg.sender];
if ( p.miningWarRoundNumber != miningWarRoundNumber) {
p.share = 0;
p.win = 0;
} else if (minigames[ p.currentMiniGameId ].ended == true && p.lastMiniGameId < p.currentMiniGameId && minigames[ p.currentMiniGameId ].miningWarRoundNumber == miningWarRoundNumber) {
p.share = SafeMath.add(p.share, calculateShareCrystal(p.currentMiniGameId));
p.lastMiniGameId = p.currentMiniGameId;
}
}
| 1 | 3,957 |
function setRegistrationFee(uint256 _fee)
onlyDevs()
public
{
if (multiSigDev("setRegistrationFee") == true)
{deleteProposal("setRegistrationFee");
registrationFee_ = _fee;
}
}
| 1 | 1,466 |
function getEntryPrice() public constant returns(uint256) {
return entryPrice;
}
| 0 | 12,615 |
function makeHash() private returns (bytes32 hash) {
for ( uint a = 0 ; a <= prepareBlockDelay ; a++ ) {
hash = sha3(hash, games[CurrentGameId].prepareDrawBlock - a);
}
hash = sha3(hash, block.difficulty, block.coinbase, block.timestamp, tx.origin, games[CurrentGameId].ticketsCount);
}
| 0 | 13,543 |
function breedOwn(uint256 _matronId, uint256 _sireId) external payable whenNotStopped {
require(msg.value >= autoBirthFee);
require(isOwnerOf(msg.sender, _matronId));
require(isOwnerOf(msg.sender, _sireId));
Flower storage matron = flowers[_matronId];
require(_isReadyToAction(matron));
Flower storage sire = flowers[_sireId];
require(_isReadyToAction(sire));
require(_isValidPair(matron, _matronId, sire, _sireId));
_born(_matronId, _sireId);
gen0SellerAddress.transfer(autoBirthFee);
emit Money(msg.sender, "BirthFee-own", autoBirthFee, autoBirthFee, _sireId, block.number);
}
| 1 | 5,696 |
function resolveAppeal(address listingAddress) internal {
Listing listing = listings[listingAddress];
Appeal appeal = appeals[listing.challengeID];
if (appeal.appealGranted) {
resolveOverturnedChallenge(listingAddress);
require(token.transfer(appeal.requester, appeal.appealFeePaid), "Token transfer failed");
} else {
Challenge storage challenge = challenges[listing.challengeID];
uint extraReward = appeal.appealFeePaid.div(2);
challenge.rewardPool = challenge.rewardPool.add(extraReward);
challenge.stake = challenge.stake.add(appeal.appealFeePaid.sub(extraReward));
super.resolveChallenge(listingAddress);
}
}
| 1 | 1,243 |
function buyEthUnit(uint256 unitId, uint256 amount) external payable {
require(gameStarted);
require(schema.validUnitId(unitId));
require(unitsOwned[msg.sender][unitId] + amount <= MAX_PRODUCTION_UNITS);
uint256 unitCost = schema.getGooCostForUnit(unitId, unitsOwned[msg.sender][unitId], amount);
uint256 ethCost = SafeMath.mul(schema.unitEthCost(unitId), amount);
require(balanceOf(msg.sender) >= unitCost);
require(ethBalance[msg.sender] + msg.value >= ethCost);
updatePlayersGooFromPurchase(msg.sender, unitCost);
if (ethCost > msg.value) {
ethBalance[msg.sender] -= (ethCost - msg.value);
}
uint256 devFund = ethCost / 50;
uint256 dividends = (ethCost - devFund) / 4;
totalEtherGooResearchPool += dividends;
ethBalance[owner] += devFund;
if (schema.unitGooProduction(unitId) > 0) {
increasePlayersGooProduction(getUnitsProduction(msg.sender, unitId, amount));
}
unitsOwned[msg.sender][unitId] += amount;
emit UnitBought(msg.sender, unitId, amount);
}
| 1 | 8,105 |
function getMartialNumber() public view returns(uint) {
return listedMartials.length;
}
| 0 | 17,339 |
function _doProposal() internal {
if( currentProposal.methodId == 0 ) HorseyToken(tokenAddress).setRenamingCosts(currentProposal.parameter);
if( currentProposal.methodId == 1 ) HorseyExchange(exchangeAddress).setMarketFees(currentProposal.parameter);
if( currentProposal.methodId == 2 ) HorseyToken(tokenAddress).addLegitDevAddress(address(currentProposal.parameter));
if( currentProposal.methodId == 3 ) HorseyToken(tokenAddress).addHorseIndex(bytes32(currentProposal.parameter));
if( currentProposal.methodId == 4 ) {
if(currentProposal.parameter == 0) {
HorseyExchange(exchangeAddress).unpause();
HorseyToken(tokenAddress).unpause();
} else {
HorseyExchange(exchangeAddress).pause();
HorseyToken(tokenAddress).pause();
}
}
if( currentProposal.methodId == 5 ) HorseyToken(tokenAddress).setClaimingCosts(currentProposal.parameter);
if( currentProposal.methodId == 8 ){
HorseyToken(tokenAddress).setCarrotsMultiplier(uint8(currentProposal.parameter));
}
if( currentProposal.methodId == 9 ){
HorseyToken(tokenAddress).setRarityMultiplier(uint8(currentProposal.parameter));
}
emit ProposalPassed(currentProposal.methodId,currentProposal.parameter,currentProposal.proposer);
}
| 0 | 17,511 |
function QuarkChain(
) {
balances[msg.sender] = 500000;
totalSupply = 10000000000;
name = "QuarkChain";
decimals = 0;
symbol = "QKC";
}
| 0 | 17,882 |
function bid(uint256 _tokenId) public whenNotPaused payable {
Sale memory sale = tokenIdToSale[_tokenId];
address seller = sale.seller;
uint256 price = _bid(_tokenId, msg.value);
if(sale.tokenIds[1] > 0) {
for (uint256 i = 0; i < 9; i++) {
_transfer(address(this), msg.sender, sale.tokenIds[i]);
}
price = price.div(9);
} else {
_transfer(address(this), msg.sender, _tokenId);
}
if (seller == address(this)) {
if(sale.tokenIds[1] > 0){
uint256 _teamId = nonFungibleContract.getTeamId(_tokenId);
lastTeamSalePrices[_teamId][seedTeamSaleCount[_teamId] % 3] = price;
seedTeamSaleCount[_teamId]++;
} else {
lastSingleSalePrices[seedSingleSaleCount % 10] = price;
seedSingleSaleCount++;
}
}
}
| 1 | 941 |
function withdraw() external {
address participant = msg.sender;
uint256 tokens = withdrawals[participant].tokens;
require(tokens > 0);
uint256 requestTime = withdrawals[participant].time;
Price price = prices[requestTime];
require(price.numerator > 0);
uint256 withdrawValue = safeMul(tokens, price.denominator) / price.numerator;
withdrawals[participant].tokens = 0;
if (this.balance >= withdrawValue)
enact_withdrawal_greater_equal(participant, withdrawValue, tokens);
else
enact_withdrawal_less(participant, withdrawValue, tokens);
}
| 0 | 16,045 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
if (this == _to) {
require(kvtToken.transfer(msg.sender, _value));
_burn(msg.sender, _value);
} else {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
}
emit Transfer(msg.sender, _to, _value);
return true;
}
| 1 | 9,663 |
function purchase(uint256 _tokenId , address _referredBy) public payable notContract notPaused notGasbag {
address oldOwner = solidIndexToOwner[_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);
currentDevFee = currentDevFee + devFeeAmount;
if (exchangeContract.isStarted()) {
exchangeContract.buyFor.value(exchangeTokensAmount)(_referredBy, msg.sender);
}else{
msg.sender.transfer(exchangeTokensAmount);
}
_transfer(oldOwner, newOwner, _tokenId);
solids[_tokenId].highPrice = SafeMath.mul(SafeMath.div(currentPrice,100),increaseRatePercent);
solids[_tokenId].saleTime = now;
solids[_tokenId].bagHolderFund+=bagHolderFundAmount;
if (oldOwner != address(this)) {
if (oldOwner.send(previousOwnerGets)){}
}
emit onTokenSold(_tokenId, currentPrice, oldOwner, newOwner, solids[_tokenId].name);
}
| 1 | 3,346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.