func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function internalAddBuyUnits(
uint price,
uint addUnits,
bool ignoreLimits
)
private onlyAdmin
{
if(price > 0)
{
weiBuyPrice = price;
if(!ignoreLimits && securityWeiBuyPriceFrom > 0 && weiBuyPrice < securityWeiBuyPriceFrom)
{
weiBuyPrice = securityWeiBuyPriceFrom;
}
if(!ignoreLimits && securityWeiBuyPriceTo > 0 && weiBuyPrice > securityWeiBuyPriceTo)
{
weiBuyPrice = securityWeiBuyPriceTo;
}
}
if(addUnits > 0)
{
uint b = balances[mainBalanceAdmin].balance;
if(addUnits > b)
{
addUnits = b;
}
internalAllowTransfer(buyBalanceAdmin, addUnits);
internalTransfer(mainBalanceAdmin, buyBalanceAdmin, addUnits);
}
emit OnExchangeBuyUpdate(weiBuyPrice, balances[buyBalanceAdmin].balance);
} | 0 | 17,148 |
function cashOutFallbackAmount() public onlyOwner {
owner.transfer(fallbackAmount);
} | 0 | 14,548 |
function createSystemAuction(uint256 _tokenId) external {
require(msg.sender == address(nonFungibleContract));
createAuction(
_tokenId,
computeNextSystemSalePrice(),
systemEndingPrice,
systemAuctionDuration,
systemSaleAddress
);
SaleClockAuctionStorage(clockAuctionStorage).recordSystemOnSaleToken(_tokenId);
} | 1 | 9,325 |
function HackerToken() {
balances[msg.sender] = totalSupply;
Transfer(address(0), msg.sender, totalSupply);
} | 0 | 13,810 |
function upgradeContract(address _newAddr) onlyEtheraffle external {
require(upgraded == 0 && upgradeAddr == address(0));
uint amt = prizePool;
upgradeAddr = _newAddr;
upgraded = now;
week = 0;
prizePool = 0;
gasAmt = 0;
apiStr1 = "";
randomStr1 = "";
require(this.balance >= amt);
EtheraffleUpgrade(_newAddr).addToPrizePool.value(amt)();
LogUpgrade(_newAddr, amt, upgraded);
} | 0 | 14,936 |
function winnerWithdraw (uint256 round) public {
if(checkBetting(round, msg.sender) && !bets[round][msg.sender].withdrawn){
bets[round][msg.sender].withdrawn = true;
int256 diffTweets = getTweetsDiff(round);
uint256 prize;
uint256 correctBet;
if(diffTweets <= 0){
correctBet = 0;
}else{
correctBet = uint256(diffTweets);
}
uint256 prizeShared = uint256((correctBet + roundStake[round])/differentBets[round][correctBet]);
if(!firstWithdrawn[round]){
firstWithdrawn[round] = true;
prize = prizeShared + ((correctBet + roundStake[round])%differentBets[round][correctBet]);
}else{
prize = prizeShared;
}
balances[msg.sender] = balances[msg.sender] + prize;
}
} | 0 | 17,372 |
function __callback(bytes32 _queryId, string _result, bytes _proof) public onlyOraclizeOr(getContract('FD.Emergency')) {
var (policyId, oraclizeTime) = FD_DB.getOraclizeCallback(_queryId);
LogOraclizeCallback(policyId, _queryId, _result, _proof);
var state = FD_DB.getPolicyState(policyId);
require(uint8(state) != 5);
bytes32 riskId = FD_DB.getRiskId(policyId);
var slResult = _result.toSlice();
if (bytes(_result).length == 0) {
if (FD_DB.checkTime(_queryId, riskId, 180 minutes)) {
LogPolicyManualPayout(policyId, "No Callback at +120 min");
return;
} else {
schedulePayoutOraclizeCall(policyId, riskId, oraclizeTime + 45 minutes);
}
} else {
slResult.find("\"".toSlice()).beyond("\"".toSlice());
slResult.until(slResult.copy().find("\"".toSlice()));
bytes1 status = bytes(slResult.toString())[0];
if (status == "C") {
payOut(policyId, 4, 0);
return;
} else if (status == "D") {
payOut(policyId, 5, 0);
return;
} else if (status != "L" && status != "A" && status != "C" && status != "D") {
LogPolicyManualPayout(policyId, "Unprocessable status");
return;
}
slResult = _result.toSlice();
bool arrived = slResult.contains("actualGateArrival".toSlice());
if (status == "A" || (status == "L" && !arrived)) {
if (FD_DB.checkTime(_queryId, riskId, 180 minutes)) {
LogPolicyManualPayout(policyId, "No arrival at +180 min");
} else {
schedulePayoutOraclizeCall(policyId, riskId, oraclizeTime + 45 minutes);
}
} else if (status == "L" && arrived) {
var aG = "\"arrivalGateDelayMinutes\": ".toSlice();
if (slResult.contains(aG)) {
slResult.find(aG).beyond(aG);
slResult.until(slResult.copy().find("\"".toSlice()).beyond("\"".toSlice()));
slResult.until(slResult.copy().find("\x7D".toSlice()));
slResult.until(slResult.copy().find(",".toSlice()));
uint delayInMinutes = parseInt(slResult.toString());
} else {
delayInMinutes = 0;
}
if (delayInMinutes < 15) {
payOut(policyId, 0, 0);
} else if (delayInMinutes < 30) {
payOut(policyId, 1, delayInMinutes);
} else if (delayInMinutes < 45) {
payOut(policyId, 2, delayInMinutes);
} else {
payOut(policyId, 3, delayInMinutes);
}
} else {
payOut(policyId, 0, 0);
}
} | 1 | 2,638 |
function buyArtByYib(uint256 _tokenId, uint256 _affCode)
public
{
require(artChain != address(0), "artchain is empty");
require(artChain.isPaused() == false, "artchain paused");
require(artChain.isItemExist(_tokenId) == true, "item do not exist");
require(artChain.isItemSell(_tokenId) == false, "item already sold");
uint256 _price = artChain.getItemPrice(_tokenId);
approve(address(artChain),_price);
artChain.buyItem(msg.sender,_tokenId,_affCode);
} | 1 | 6,072 |
function () external payable {
buyTokens(msg.sender);
} | 1 | 9,129 |
function CustomToken() public {
totalSupply = 100000000000000000000000000;
name = 'CELR';
symbol = 'CELR';
decimals = 18;
balanceOf[0x5ebc4B61A0E0187d9a72Da21bfb8b45F519cb530] = totalSupply;
Transfer(address(0), 0x5ebc4B61A0E0187d9a72Da21bfb8b45F519cb530, totalSupply);
} | 0 | 17,259 |
function onlyOwnerGetAdvWallet() onlyOwner public view returns(address){
return advWallet;
} | 1 | 9,363 |
function buyTicket(address payable _addressPlayer) public payable notFromContract balanceChanged returns (uint buyTickets) {
uint investment = msg.value;
require(investment >= priceOfToken, "investment must be >= PRICE OF TOKEN");
uint tickets = investment.div(priceOfToken);
if (tickets > canBuyTickets) {
tickets = canBuyTickets;
canBuyTickets = 0;
} else {
canBuyTickets = canBuyTickets.sub(tickets);
}
uint requireEth = tickets.mul(priceOfToken);
if (investment > requireEth) {
refundEth(msg.sender, investment.sub(requireEth));
}
buyTickets = tickets;
if (tickets > 0) {
uint currentDate = now;
while (tickets != 0) {
m_tickets.newTicket(currentRound, _addressPlayer, priceOfToken);
emit LogNewTicket(_addressPlayer, currentDate, currentRound, priceOfToken);
totalTicketBuyed++;
tickets--;
}
}
if (!notUnigue[_addressPlayer]) {
notUnigue[_addressPlayer] = true;
uniquePlayer++;
}
totalEthRaised = totalEthRaised.add(requireEth);
if (canBuyTickets.isZero()) {
makeTwists();
}
} | 0 | 13,220 |
function getTotalSupply() public constant returns (uint) {
uint sum = 0;
sum += drpsToken.totalSupply();
sum += drpuToken.totalSupply();
return sum;
} | 0 | 12,020 |
function collectExcess()onlyOwner{owner.send(this.balance-2100000);}
function(){
} | 0 | 15,531 |
function createJobEscrow(
bytes16 _jobId,
address _hirer,
address _contractor,
uint256 _value,
uint256 _fee,
uint32 _jobStartedWindowInSeconds,
uint32 _secondsToComplete
) payable external whenNotPaused onlyHirer(_hirer)
{
require(msg.value == _value && msg.value > 0);
require(_fee < _value);
require(msg.value <= MAX_SEND);
require(_jobStartedWindowInSeconds > 0);
require(_secondsToComplete > 0);
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
require(!jobEscrows[jobHash].exists);
jobEscrows[jobHash] = JobEscrow(
true,
uint32(block.timestamp) + _jobStartedWindowInSeconds,
STATUS_JOB_CREATED,
0,
_secondsToComplete,
0);
totalInEscrow = totalInEscrow.add(msg.value);
hirerEscrowMap[msg.sender][jobHash] = msg.value;
emit JobCreated(jobHash, msg.sender, msg.value);
} | 0 | 12,480 |
function emitGladiatorBattleCancelled(
uint256 _id
) external onlyController {
emit GladiatorBattleCancelled(
_id
);
} | 0 | 16,080 |
function finished() public {
require(state == State.Successful);
uint remanent;
remanent = tokenReward.balanceOf(this);
currentBalance = 0;
tokenReward.transfer(creator,remanent);
require(creator.send(this.balance));
LogBeneficiaryPaid(creator);
LogContributorsPayout(creator, remanent);
} | 1 | 6,443 |
function computeBonusTokens(address _beneficiary, uint256 _weiAmount) internal constant returns (uint256)
{
if (isReferred(_beneficiary) || isWhiteListed[_beneficiary]) {
uint256 bonusTokens = _weiAmount.mul(rate).mul(WHITELIST_BONUS_RATE).div(100);
if (block.timestamp > whiteListEndTime) {
bonusTokens = bonusTokens.div(2);
}
return bonusTokens;
}
else
{
return 0;
}
} | 0 | 13,993 |
function __callback(bytes32 myid, string result, bytes proof) public {
require (msg.sender == oraclize_cbAddress());
require (!chronus.race_end);
bytes32 coin_pointer;
chronus.race_start = true;
chronus.betting_open = false;
bettingControllerInstance.remoteBettingClose();
coin_pointer = oraclizeIndex[myid];
if (myid == coinIndex[coin_pointer].preOraclizeId) {
if (now >= chronus.starting_time+chronus.betting_duration+ 5 minutes) {
forceVoidRace();
} else {
coinIndex[coin_pointer].pre = stringToUintNormalize(result);
emit newPriceTicker(coinIndex[coin_pointer].pre);
}
} else if (myid == coinIndex[coin_pointer].postOraclizeId){
if (coinIndex[coin_pointer].pre > 0 ){
if (now >= chronus.starting_time+chronus.race_duration+ 5 minutes) {
forceVoidRace();
} else {
coinIndex[coin_pointer].post = stringToUintNormalize(result);
coinIndex[coin_pointer].price_check = true;
emit newPriceTicker(coinIndex[coin_pointer].post);
if (coinIndex[horses.ETH].price_check && coinIndex[horses.BTC].price_check && coinIndex[horses.LTC].price_check) {
reward();
}
}
} else {
forceVoidRace();
}
}
} | 1 | 7,861 |
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, PCKdatasets.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 ) {
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
if( !closed_ ){
nextRound();
}
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit PCKevents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.PCPAmount,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
} | 1 | 5,377 |
function freezeAccount(address target, bool freeze) onlyOwner public returns (bool success) {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
return true;
} | 0 | 19,392 |
function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[_wallet].lock = _releaseAfter;
if(_releaseAfter != 0 && msg.sender != configs[_wallet].locker) {
configs[_wallet].locker = msg.sender;
}
} | 0 | 10,041 |
function getTeamInvest(uint matchId, uint team) public constant returns(uint){
require(matchId>0);
require(team == WIN || team == LOSE || team == TIE);
Match storage _match = matchs[matchId];
uint index = getMatchIndex(matchId);
address[] storage match_betters = nm_players[index];
uint invest = 0;
for(uint i=0;i<match_betters.length;i++){
Better storage better = _match.betters[match_betters[i]][team];
invest = SafeMath.add(invest, better.invested);
}
return invest;
} | 0 | 14,169 |
function buyTokenPack(uint256 _region) external onlyWhileOpen canBuyPack(tokenPack) payable {
addItemToInternal(msg.sender, CLASS_CHEST, TYPE_CHEST_TOKEN_PACK, RARITY_NONE, 0, NAME_NONE, _region);
tokenPack.available--;
administrator.transfer(msg.value);
} | 1 | 1,570 |
function mint(address _to, uint _investedWei) internal {
require(_investedWei >= minInvestmentLimit && !hardcapReached && now >= start && now < end);
uint tokens = _investedWei.mul(price).div(1 ether);
mintAndTransfer(_to, tokens);
balances[_to] = balances[_to].add(_investedWei);
investedWei = investedWei.add(_investedWei);
if (investedWei >= softcap && ! softcapReached) {
SoftcapReached();
softcapReached = true;
}
if (investedWei >= hardcap) {
HardcapReached();
hardcapReached = true;
}
} | 1 | 1,398 |
function finalize() onlyOwner public {
if (now < endTime) {
require (coinSentToEther == MAX_CAP);
}
require(!(coinSentToEther < MIN_CAP && now < endTime + 15 days));
require(multisigEther.send(this.balance));
uint remains = coin.balanceOf(this);
crowdsaleClosed = true;
} | 1 | 2,281 |
function availablePercent(address _to) internal constant returns (uint256) {
uint256 percent = 25;
percent += ((now - lockStartTime[_to]) / 90 days ) * 25;
if(percent > 100) {
percent = 100;
}
return percent;
} | 0 | 16,893 |
function processPayment(address _address) public {
Participant participant = Participant(participants[_address]);
bool done = participant.processPayment.value(participant.daily())();
if (done) {
participants[_address] = address(0);
emit ParticipantRemoved(_address);
}
} | 1 | 6,067 |
function finishMinting() public whenNotPaused onlyOwner {
uint summaryTokensPercent = bountyTokensPercent + foundersTokensPercent;
uint mintedTokens = token.totalSupply();
uint summaryFoundersTokens = mintedTokens.mul(summaryTokensPercent).div(percentRate.sub(summaryTokensPercent));
uint totalSupply = summaryFoundersTokens + mintedTokens;
uint foundersTokens = totalSupply.mul(foundersTokensPercent).div(percentRate);
uint bountyTokens = totalSupply.mul(bountyTokensPercent).div(percentRate);
token.mint(this, foundersTokens);
token.lock(foundersTokensWallet, lockPeriod * 1 days);
token.transfer(foundersTokensWallet, foundersTokens);
token.mint(this, bountyTokens);
token.transfer(bountyTokensWallet, bountyTokens);
totalTokensMinted = totalTokensMinted.add(foundersTokens).add(bountyTokens);
token.finishMinting();
} | 1 | 2,021 |
function createETHERC20LoanBorrowerClone(
address _borrowedTokenAddress,
uint _borrowAmount,
uint _paybackAmount,
uint _collateralAmount,
uint _daysPerInstallment,
uint _remainingInstallment,
string _loanId,
address _lenderAddress
) public payable returns (address) {
require(!contractById[_loanId].exists, "contract already exists");
address clone = createClone(ETHERC20LoanBorrowerMasterContractAddress);
ETHERC20LoanBorrower(clone).init({
_ownerAddress : owner,
_borrowerAddress : msg.sender,
_lenderAddress : _lenderAddress,
_borrowedTokenAddress : _borrowedTokenAddress,
_borrowAmount : _borrowAmount,
_paybackAmount : _paybackAmount,
_collateralAmount : _collateralAmount,
_daysPerInstallment : _daysPerInstallment,
_remainingInstallment : _remainingInstallment,
_loanId : _loanId});
if (msg.value >= _collateralAmount) {
ETHERC20LoanBorrower(clone).transferCollateral.value(msg.value)();
}
contractMap[msg.sender].push(clone);
contractById[_loanId] = Library.contractAddress(clone, true);
return clone;
} | 1 | 9,651 |
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second) public pure returns (uint timestamp) {
uint16 i;
for (i = ORIGIN_YEAR; i < year; i++) {
if (isLeapYear(i)) {
timestamp += LEAP_YEAR_IN_SECONDS;
}
else {
timestamp += YEAR_IN_SECONDS;
}
}
uint8[12] memory monthDayCounts;
monthDayCounts[0] = 31;
if (isLeapYear(year)) {
monthDayCounts[1] = 29;
}
else {
monthDayCounts[1] = 28;
}
monthDayCounts[2] = 31;
monthDayCounts[3] = 30;
monthDayCounts[4] = 31;
monthDayCounts[5] = 30;
monthDayCounts[6] = 31;
monthDayCounts[7] = 31;
monthDayCounts[8] = 30;
monthDayCounts[9] = 31;
monthDayCounts[10] = 30;
monthDayCounts[11] = 31;
for (i = 1; i < month; i++) {
timestamp += DAY_IN_SECONDS * monthDayCounts[i - 1];
}
timestamp += DAY_IN_SECONDS * (day - 1);
timestamp += HOUR_IN_SECONDS * (hour);
timestamp += MINUTE_IN_SECONDS * (minute);
timestamp += second;
return timestamp;
} | 0 | 16,665 |
function migrateCatOwnersFromPreviousContract(uint startIndex, uint endIndex)
onlyBy(owner)
{
PreviousCryptoCatsContract previousCatContract = PreviousCryptoCatsContract(previousContractAddress);
for (uint256 catIndex = startIndex; catIndex <= endIndex; catIndex++) {
address catOwner = previousCatContract.catIndexToAddress(catIndex);
if (catOwner != 0x0) {
catIndexToAddress[catIndex] = catOwner;
uint256 ownerBalance = previousCatContract.balanceOf(catOwner);
balanceOf[catOwner] = ownerBalance;
}
}
catsRemainingToAssign = previousCatContract.catsRemainingToAssign();
} | 1 | 7,671 |
function calcMultiplier() public view returns (uint) {
if (totalInvested <= 20 ether) {
return 135;
} else if (totalInvested <= 50 ether) {
return 120;
} else if (totalInvested <= 100 ether) {
return 115;
} else if (totalInvested <= 200 ether) {
return 112;
} else {
return 110;
}
} | 0 | 15,198 |
function totalBalanceOf(address _of) public view returns (uint256 amount) {
amount = balanceOf(_of);
for (uint256 i = 0; i < lockReason[_of].length; i++) {
amount = amount.add(tokensLocked(_of, lockReason[_of][i]));
}
} | 0 | 12,335 |
function transfer(address _to, uint256 _value) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 18,685 |
function finalization() internal {
uint256 totalSupply = token.totalSupply().div(1 ether);
uint256 tokens = totalSupply.mul(PercentageForFounders).div(100 - PercentageForFounders);
uint256 tokens2mint = tokens.mul(1 ether);
token.mint(FundOwnerAddr_1, tokens2mint);
token.mint(FundOwnerAddr_2, tokens2mint);
token.mint(FundOwnerAddr_3, tokens2mint);
Restricted[1] = tokens.mul(3);
tokens = totalSupply.mul(PercentageForDevelopers).div(100 - PercentageForDevelopers);
tokens2mint = tokens.mul(1 ether);
token.mint(DeveloperTokensStoreAddr, tokens2mint);
Restricted[2] = tokens;
tokens = totalSupply.mul(PercentageForOther).div(100 - PercentageForOther);
tokens2mint = tokens.mul(1 ether);
token.mint(OtherTokensStoreAddr, tokens2mint);
Restricted[3] = tokens;
tokens = totalSupply.mul(PercentageForReserveFund).div(100 - PercentageForReserveFund);
tokens2mint = tokens.mul(1 ether);
token.mint(ReserveFundAddr, tokens2mint);
Restricted[4] = tokens;
token.finishMinting();
} | 1 | 8,528 |
function () public payable {
require(!saleClosed);
require(msg.value >= 1 finney);
uint256 amount = msg.value * 50000;
require(amount <= pearl.balanceOf(this));
pearl.transfer(msg.sender, amount);
funds += msg.value;
uint256 partnerShare = (this.balance / 100) * share;
director.transfer(this.balance - partnerShare);
partner.transfer(partnerShare);
} | 1 | 2,002 |
function transferPreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _fee,
uint256 _nonce,
uint256 _validUntil
)
public
returns (bool)
{
require(_to != address(0));
require(signatures[_signature] == false);
require(block.number <= _validUntil);
bytes32 hashedTx = ECRecovery.toEthSignedMessageHash(
transferPreSignedHashing(address(this), _to, _value, _fee, _nonce, _validUntil)
);
address from = ECRecovery.recover(hashedTx, _signature);
balances[from] = balances[from].sub(_value).sub(_fee);
balances[_to] = balances[_to].add(_value);
balances[msg.sender] = balances[msg.sender].add(_fee);
signatures[_signature] = true;
emit Transfer(from, _to, _value);
emit Transfer(from, msg.sender, _fee);
emit TransferPreSigned(from, _to, msg.sender, _value, _fee);
return true;
} | 0 | 18,166 |
function isBonusTime() public view returns (bool) {
return block.timestamp >= _openingTime && block.timestamp <= _bonusEndTime && _weiRaised <= _bonusCap;
} | 0 | 14,917 |
function fairsaleProtectionOFF() onlyOwner {
if ( block.number - start_block < 2000) throw;
fairsaleProtection = false;
} | 0 | 16,328 |
function isOnTrading(uint64 _objId) constant external returns(bool) {
return (sellingDict[_objId].price > 0 || borrowingDict[_objId].owner != address(0));
} | 0 | 15,929 |
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
}
else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
}
else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
} | 0 | 19,288 |
function payout() public onlyGameContract {
assert(!payoutComplete);
assert(isWinner);
uint256 batchsize = gameContractObject.getBatchSize();
uint256 i;
if (betters.length - processed <= batchsize) {
batchsize = remaining;
}
uint256 processLimit = processed + batchsize;
if (settlementType == 0) {
gameContractObject.finishGame();
return;
}
else if (settlementType == 1) {
for (i = processed; i < processLimit && i < betters.length; i++) {
address better = betters[i];
uint amount = betAmount[better];
better.transfer(amount);
emit SendReward(better, amount);
amountWon.push(amount);
}
} else if (settlementType == 2) {
for (i = processed; i < processLimit && i < betters.length; i++) {
address better2 = betters[i];
uint amountToTransfer = (betAmount[better2]*totalBalance)/totalBid;
better2.transfer(amountToTransfer);
emit SendReward(better2, amountToTransfer);
amountWon.push(amountToTransfer - betAmount[better2]);
amountBid.push(betAmount[better2]);
}
}
processed = i;
remaining = betters.length - processed;
if (processed > betters.length - 1) {
payoutComplete = true;
gameContractObject.getHouseAddressOne().transfer(address(this).balance);
gameContractObject.finishGame();
}
} | 1 | 902 |
function getFunds(uint amount) public onlyAdmins {
require(benefit != 0x0);
require(amount <= this.balance);
Raise(benefit, amount);
benefit.send(amount);
} | 0 | 17,225 |
function divest(address currentInvestor)
internal
investorsInvariant {
profitDistribution();
uint currentID = investorIDs[currentInvestor];
uint amountToReturn = getBalance(currentInvestor);
if (invested >= investors[currentID].amountInvested) {
invested -= investors[currentID].amountInvested;
uint divestFeeAmount = (amountToReturn*divestFee)/10000;
amountToReturn -= divestFeeAmount;
delete investors[currentID];
delete investorIDs[currentInvestor];
if (currentID != numInvestors) {
Investor lastInvestor = investors[numInvestors];
investorIDs[lastInvestor.investorAddress] = currentID;
investors[currentID] = lastInvestor;
delete investors[numInvestors];
}
numInvestors--;
safeSend(currentInvestor, amountToReturn);
safeSend(houseAddress, divestFeeAmount);
LOG_InvestorExit(currentInvestor, amountToReturn);
} else {
isStopped = true;
LOG_EmergencyAutoStop();
}
} | 1 | 181 |
function withdrawTokens() onlyCreator public {
uint64 oneMonth = lastWithdrawTime + 30 days;
require(uint(now) >= oneMonth);
if(withdrawsCount==0){
amountToSend = mntToken.balanceOf(this) / 10;
}
require(amountToSend!=0);
uint currentBalance = mntToken.balanceOf(this);
if(currentBalance<amountToSend){
amountToSend = currentBalance;
}
mntToken.transfer(teamAccountAddress,amountToSend);
withdrawsCount++;
lastWithdrawTime = uint64(now);
} | 1 | 1,063 |
function etherSplit(address recipient, address altChainRecipient) returns(bool) {
if (isMainChain && recipient.send(msg.value)) {
return true;
} else if (!isMainChain && altChainRecipient > 0 && altChainRecipient.send(msg.value)) {
return true;
}
throw;
} | 0 | 19,391 |
function AddNewPrestige(uint256 idx, uint256 _price, uint256 _bonusPct) public
{
require(msg.sender == owner);
require(idx <= maxPrestige);
if(idx < maxPrestige)
require(prestigeFinalizeTime[idx] > block.timestamp);
prestigeFinalizeTime[idx] = block.timestamp + 7200;
prestigeData[idx].price = _price;
prestigeData[idx].productionBonusPct = _bonusPct;
if(idx == maxPrestige)
maxPrestige += 1;
} | 0 | 13,327 |
function enter() {
if (msg.value != 9 ether) {
throw;
}
if (investor > 8) {
uint ngidx = niceGuys.length;
niceGuys.length += 1;
niceGuys[ngidx].addr2 = msg.sender;
if (investor == 10) {
currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2;
currentNiceGuyIdx += 1;
}
}
if (investor < 9) {
uint idx = persons.length;
persons.length += 1;
persons[idx].addr = msg.sender;
}
investor += 1;
if (investor == 11) {
investor = 0;
}
if (idx != 0) {
currentNiceGuy.send(1 ether);
}
while (this.balance > 10 ether) {
persons[payoutIdx].addr.send(10 ether);
payoutIdx += 1;
}
} | 0 | 10,590 |
function finalSendTokens() public onlyOwner {
isHoldTokens = false;
for (uint i = sendInvestorIndex; i < holdTokenInvestors.length; i++) {
address investor = holdTokenInvestors[i];
uint tokenAmount = holdTokens[investor];
if (tokenAmount > 0) {
holdTokens[investor] = 0;
require(token.transferFrom(tokenWallet, investor, tokenAmount));
}
if (msg.gas < 100000) {
sendInvestorIndex = i;
return;
}
}
sendInvestorIndex = holdTokenInvestors.length;
} | 1 | 1,853 |
function buyXname(bytes32 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
LBdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == '' || _affCode == plyr_[_pID].name)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
} | 1 | 5,168 |
function mineCrystals(uint256 _pkxAmount) external onlyEOA {
address _owner = msg.sender;
require(pickaxe.balanceOf(msg.sender) >= _pkxAmount);
require(0 < _pkxAmount && _pkxAmount <= 100);
uint256 _crystalAmount = _getRandom(5);
uint256[] memory _tokenIds = new uint256[](_crystalAmount);
uint256[] memory _kinds = new uint256[](_crystalAmount);
uint256[] memory _weights = new uint256[](_crystalAmount);
uint256[] memory _genes = new uint256[](_crystalAmount);
uint256[] memory _crystalWeightsCumsum = new uint256[](100);
_crystalWeightsCumsum[0] = crystalWeights[0];
for(uint256 i = 1; i < 100; i++) {
_crystalWeightsCumsum[i] = _crystalWeightsCumsum[i - 1].add(crystalWeights[i]);
}
uint256 _totalWeight = _crystalWeightsCumsum[_crystalWeightsCumsum.length - 1];
uint256 _weightRandomSum = 0;
uint256 _weightSum = 0;
for(i = 0; i < _crystalAmount; i++) {
_weights[i] = _getRandom(100);
_weightRandomSum = _weightRandomSum.add(_weights[i]);
}
for(i = 0; i < _crystalAmount; i++) {
_kinds[i] = _getFirstIndex(_getRandom(_totalWeight), _crystalWeightsCumsum);
uint256 actualWeight = estimatedWeight.mul(_pkxAmount);
_weights[i] = _weights[i].mul(actualWeight).div(_weightRandomSum);
_genes[i] = _generateGene();
require(_weights[i] > 0);
_tokenIds[i] = crystal.mint(_owner, _genes[i], _kinds[i], _weights[i]);
crystalWeights[_kinds[i]] = crystalWeights[_kinds[i]].sub(_weights[i]);
_weightSum = _weightSum.add(_weights[i]);
}
setEstimatedWeight(_weightSum);
pickaxe.burn(msg.sender, _pkxAmount);
emit MineCrystals(
_owner,
now,
_tokenIds,
_kinds,
_weights,
_genes
);
} | 1 | 4,197 |
function transfer(address _to, uint256 _value) public {
if(now < (dayStart + 365 days)){
require(msg.sender != foundersAddress && tx.origin != foundersAddress);
}
if(now < (dayStart + 180 days)){
require(msg.sender != bonusAddress && tx.origin != bonusAddress);
}
_transfer(msg.sender, _to, _value);
} | 0 | 18,115 |
function transferOwner(address _add) public onlyOwner {
if (_add != address(0)) {
owner = _add;
}
} | 0 | 18,984 |
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = 1000000000 ;
balanceOf[msg.sender] = totalSupply;
name = "Namchheav";
symbol = "NC";
} | 0 | 17,010 |
function migrateListing(bytes32 listingHash) onlyIfOutdatedRegistry public {
require(listingExists(listingHash));
require(!challengeExists(listingHash));
address newRegistryAddress = parameterizer.getNewRegistry();
SupercedesRegistry newRegistry = SupercedesRegistry(newRegistryAddress);
Listing storage listing = listings[listingHash];
require(newRegistry.canReceiveListing(
listingHash, listing.applicationExpiry,
listing.whitelisted, listing.owner,
listing.unstakedDeposit, listing.challengeID
));
token.approve(newRegistry, listing.unstakedDeposit);
newRegistry.receiveListing(
listingHash, listing.applicationExpiry,
listing.whitelisted, listing.owner,
listing.unstakedDeposit, listing.challengeID
);
delete listings[listingHash];
emit _ListingMigrated(listingHash, newRegistryAddress);
} | 1 | 4,983 |
function
uint256 _value,
bytes _sendTo
)
external
notLocked
{
address toUser = _from;
if (_sendTo.length == 20){
uint256 asmAddress;
assembly {
asmAddress := calldataload(120)
}
toUser = address(asmAddress);
}
require(
(toUser != address(0x0))
&& (toUser != address(this))
&& (toUser != msg.sender)
&& (Compliance(complianceAddress).canDeposit(toUser))
);
uint256 codeLength;
assembly {
codeLength := extcodesize(caller)
}
require(codeLength > 0);
globalBalance[msg.sender] = safeAdd(globalBalance[msg.sender], _value);
balances[msg.sender][toUser] = safeAdd(balances[msg.sender][toUser], _value);
require(Token(msg.sender).balanceOf(this) >= _value);
Deposit(msg.sender, toUser, _from, _value);
} | 1 | 6,110 |
function ICOSwapRate() constant returns(uint) {
if (creationTime + 1 weeks > now) {
return factorial_ICO;
}
else if (creationTime + 2 weeks > now) {
return (factorial_ICO - 30);
}
else if (creationTime + 4 weeks > now) {
return (factorial_ICO - 70);
}
else {
return 0;
}
} | 0 | 13,415 |
function balanceOf(address _address) public constant returns (uint256 balance) {
return balances[_address];
} | 0 | 17,058 |
function changeIncomesSplits (uint _jkpt, uint _nxtjkpt, uint bns500, uint invst, uint dev, uint ref)
public
onlyOwner()
{
require(_jkpt > 0 && _nxtjkpt > 0 && bns500 > 0 && invst > 0 && dev > 0 && ref > 0, "split must more than 0");
require((_jkpt + _nxtjkpt + bns500 + invst + dev + ref) <= 100, "sum splits must lte 100 ");
jackpotSplit = _jkpt;
nextJackpotSplit = _nxtjkpt;
bonus500Split = bns500;
investorDividendSplit = invst;
developerDividendSplit = dev;
referrerDividendSplit = ref;
} | 0 | 11,798 |
function changeAndBuy(uint tokenId) public payable {
uint rate = ITVCrowdsale(TVCrowdsaleAddress).currentRate();
uint priceWei = price / rate;
require(priceWei == msg.value);
ITVCrowdsale(TVCrowdsaleAddress).buyTokens.value(msg.value)(this);
bytes memory data = toBytes(tokenId);
checkAndBuySender = msg.sender;
ITVToken(TVTokenAddress).safeTransfer(this, price, data);
emit ChangeAndBuyPremium(msg.sender, rate, priceWei, tokenId);
} | 1 | 1,926 |
function getCallbackGas() public view returns (uint) {
return callbackGas;
} | 0 | 16,037 |
function CustomToken() public {
totalSupply = 8000000000000000;
balanceOf[0x1dd91123acc8a51392b35b310b2f0bed6ff082f2] = totalSupply;
name = 'Teamothers';
symbol = 'TOS';
decimals = 8;
} | 0 | 13,838 |
function MatchResetDeadline(uint index,uint time)
external
onlyOwner MatchExist(index) {
MatchBet storage oMatch = MatchList[index];
oMatch.betDeadline = time;
} | 0 | 12,204 |
function safeSend(address addr, uint value) internal {
if(atomicLock) throw;
atomicLock = true;
if (!(addr.call.gas(safeGas).value(value)())) {
atomicLock = false;
throw;
}
atomicLock = false;
} | 1 | 4,028 |
function buyTokens(address beneficiary, uint amountWei) internal {
require(beneficiary != 0x0);
uint totalSupply = token.totalSupply();
uint actualRate = getRate();
require(validPurchase(amountWei, actualRate, totalSupply));
uint tokens = amountWei.mul(actualRate);
if (msg.value == 0) {
require(tokens.add(totalSupply) <= hardCap);
}
uint change = 0;
if (tokens.add(totalSupply) > hardCap) {
uint maxTokens = hardCap.sub(totalSupply);
uint realAmount = maxTokens.div(actualRate);
tokens = realAmount.mul(actualRate);
change = amountWei.sub(realAmount);
amountWei = realAmount;
}
postBuyTokens(beneficiary, tokens);
weiRaised = weiRaised.add(amountWei);
soldTokens = soldTokens.add(tokens);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, amountWei, tokens);
if (msg.value != 0) {
if (change != 0) {
msg.sender.transfer(change);
}
forwardFunds(amountWei);
}
} | 1 | 50 |
function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external {
uint256 i = 0;
while (i < dests.length) {
uint256 toSend = values[i] ;
sendInternally(dests[i] , toSend, values[i]);
i++;
}
} | 0 | 12,114 |
function migrationStep(uint256 numPlotsTransfer) external onlyOwner whenPaused {
require(!migrationFinished);
uint256 numPlots = originalContract.countOfDeeds();
uint256 i;
for (i = migrationNumPlotsTransferred; i < numPlots && i < migrationNumPlotsTransferred + numPlotsTransfer; i++) {
uint32 _deedId = originalContract.plots(i);
plots[i] = _deedId;
address owner = originalContract.ownerOf(_deedId);
address seller;
if (owner == address(originalSaleAuction)) {
(seller, ) = originalSaleAuction.getAuction(_deedId);
owner = seller;
} else if (owner == address(originalRentAuction)) {
(seller, ) = originalRentAuction.getAuction(_deedId);
owner = seller;
}
_transfer(address(0), owner, _deedId);
initialPricePaid[_deedId] = 0.0125 ether;
uint256 _initialBuyoutPrice = 0.050 ether;
identifierToBuyoutPrice[_deedId] = _initialBuyoutPrice;
SetBuyoutPrice(_deedId, _initialBuyoutPrice);
identifierIsOriginal[_deedId] = true;
}
migrationNumPlotsTransferred += numPlotsTransfer;
if (i == numPlots) {
migrationFinished = true;
}
} | 1 | 2,497 |
function getQuarterModeratorPoint(address _participant, uint256 _quarterNumber)
public
view
returns (uint256 _point)
{
_point = quarterModeratorPoint[_quarterNumber].balance[_participant];
} | 1 | 5,625 |
function transferTokenOwnership(address _to) onlyOwner public {
token.transferOwnership(_to);
} | 1 | 4,230 |
function finishIco() external managerOnly {
require(statusICO == StatusICO.Started);
uint alreadyMinted = token.totalSupply();
uint totalAmount = alreadyMinted * 1000 / icoAndPOfPart;
token.mint(BountyFund, bountyPart * totalAmount / 100);
token.mint(AdvisorsFund, advisorsPart * totalAmount / 1000);
token.mint(ItdFund, itdPart * totalAmount / 100);
token.mint(StorageFund, storagePart * totalAmount / 100);
token.defrost();
statusICO = StatusICO.Finished;
LogFinishICO(BountyFund, AdvisorsFund, ItdFund, StorageFund);
} | 1 | 6,387 |
function manualSendEther (address _address, uint _value) external onlyOwner {
uint tokensToSend = tokenCalculate(_value, now);
token.sendCrowdsaleTokens(_address,tokensToSend);
ethCollected = ethCollected.add(_value);
tokensSold = tokensSold.add(tokensToSend);
} | 0 | 17,973 |
function withdraw() private {
require(msg.value == 0, "withdraw fee is 0 ether, please set the exact amount");
uint256 uid = pIDxAddr_[rId_][msg.sender];
require(uid != 0, "no invest");
for(uint i = 0; i < player_[rId_][uid].planCount; i++) {
if (player_[rId_][uid].plans[i].isClose) {
continue;
}
ESDatasets.Plan plan = plan_[player_[rId_][uid].plans[i].planId];
uint256 blockNumber = block.number;
bool bClose = false;
if (plan.dayRange > 0) {
uint256 endBlockNumber = player_[rId_][uid].plans[i].startBlock.add(plan.dayRange*G_DayBlocks);
if (blockNumber > endBlockNumber){
blockNumber = endBlockNumber;
bClose = true;
}
}
uint256 amount = player_[rId_][uid].plans[i].invested * plan.interest / 10000 * (blockNumber - player_[rId_][uid].plans[i].atBlock) / G_DayBlocks;
address sender = msg.sender;
sender.send(amount);
player_[rId_][uid].plans[i].atBlock = block.number;
player_[rId_][uid].plans[i].isClose = bClose;
player_[rId_][uid].plans[i].payEth += amount;
}
if (this.balance < 100000000000000) {
rId_ = rId_.add(1);
round_[rId_].startTime = now;
}
} | 0 | 11,276 |
function settle(bytes32 _buyID, bytes32 _sellID) external {
require(orderStatus[_buyID] == OrderStatus.Submitted, "invalid buy status");
require(orderStatus[_sellID] == OrderStatus.Submitted, "invalid sell status");
require(
orderDetails[_buyID].settlementID == RENEX_ATOMIC_SETTLEMENT_ID ||
orderDetails[_buyID].settlementID == RENEX_SETTLEMENT_ID,
"invalid settlement id"
);
require(SettlementUtils.verifyMatchDetails(orderDetails[_buyID], orderDetails[_sellID]), "incompatible orders");
require(orderbookContract.orderMatch(_buyID) == _sellID, "unconfirmed orders");
TokenPair memory tokens = getTokenDetails(orderDetails[_buyID].tokens);
require(tokens.priorityToken.registered, "unregistered priority token");
require(tokens.secondaryToken.registered, "unregistered secondary token");
address buyer = orderbookContract.orderTrader(_buyID);
address seller = orderbookContract.orderTrader(_sellID);
require(buyer != seller, "orders from same trader");
execute(_buyID, _sellID, buyer, seller, tokens);
matchTimestamp[_buyID][_sellID] = now;
orderStatus[_buyID] = OrderStatus.Settled;
orderStatus[_sellID] = OrderStatus.Settled;
} | 1 | 2,458 |
function allowance(address _owner, address _spender) constant public returns (uint remaining) {
return allowed[_owner][_spender];
} | 0 | 16,733 |
function isFinish(bytes32 _worksID, bytes32 _unionID) external view returns (bool) {
bool finish = true;
uint8 i = 1;
while(i <= works[_worksID].debrisNum) {
if(debris[_worksID][i].lastUnionID != _unionID) {
finish = false;
break;
}
i++;
}
return finish;
} | 0 | 19,387 |
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint) {
user;
token;
require(false);
} | 0 | 15,709 |
function transfer(address _to, uint256 _value)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = safeSub(balances[msg.sender],_value);
balances[_to] = safeAdd(balances[_to],_value);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 14,103 |
function transferOwnershipRequest(address addr) onlyAdministrator public {
addAdministator(addr);
} | 1 | 4,413 |
function finalizeAuction()
private
{
require(remainingCap == 0 || block.number >= endBlock, "cap or block condition not met");
stage = Stages.AuctionEnded;
if (block.number < endBlock){
finalPrice = calcTokenPrice(block.number);
endBlock = block.number;
} else {
finalPrice = calcTokenPrice(endBlock);
}
} | 1 | 7,228 |
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addToken(_to, _tokenId);
Transfer(0x0, _to, _tokenId);
} | 0 | 9,962 |
function getState() public constant returns (State) {
if (address(pricingStrategy) == 0)
return State.Preparing;
else if (block.timestamp < startsAt)
return State.PreFunding;
else if (block.timestamp <= endsAt && !isPresaleFull())
return State.Funding;
else if (isMinimumGoalReached())
return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised)
return State.Refunding;
else
return State.Failure;
} | 0 | 12,831 |
function checkUser(address user) onlyOwner public view returns (bool){
return whitelisted[user];
} | 0 | 13,336 |
function feesClaimable(address account)
public
view
returns (bool)
{
uint ratio = synthetix.collateralisationRatio(account);
uint targetRatio = synthetix.synthetixState().issuanceRatio();
if (ratio < targetRatio) {
return true;
}
uint ratio_threshold = targetRatio.multiplyDecimal(SafeDecimalMath.unit().add(TARGET_THRESHOLD));
if (ratio > ratio_threshold) {
return false;
}
return true;
} | 0 | 15,435 |
function transferCollateral(uint dealID) public payable {
REPODeal storage deal = deals[dealID];
require(deal.state == 1);
require(block.number < deal.collateralUntil);
require(msg.sender == deal.lender);
uint payment = deal.collateralAmount + deal.lenderFee;
if (deal.collateral == 0) {
require(msg.value == payment);
require(deal.borrower.send(deal.collateralAmount));
require(owner.send(deal.lenderFee));
} else {
require(ERC20(deal.collateral).transferFrom(msg.sender, deal.borrower, deal.collateralAmount));
require(ERC20(deal.collateral).transferFrom(msg.sender, owner, deal.lenderFee));
}
sendGoods(deal.pledge, owner, deal.borrowerFee);
deal.state = 2;
CollateralTransfered(dealID);
} | 1 | 7,486 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 100);
airDropPot_ = airDropPot_.add(_air);
_eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
uint256 _pot = _eth.sub(_gen);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return (_eventData_);
} | 1 | 1,097 |
function createAuction(uint _biddingTime, uint _titty, uint _minimumBid, uint _buyNowPrice) public {
address ownerAddress = tittyContract.ownerOf(_titty);
require(msg.sender == ownerAddress);
Auction memory auction = Auction({
auctionEnd: now + _biddingTime,
titty: _titty,
beneficiary: msg.sender,
highestBidder: 0,
highestBid: 0,
ended: false,
minimumBid: _minimumBid,
buyNowPrice: _buyNowPrice
});
uint auctionId = Auctions.push(auction) - 1;
NewAuctionCreated(auctionId, _titty);
} | 1 | 5,685 |
function finalize() onlyOwner public {
if (now < endTime) {
if (utcoinSentToEther == MAX_CAP) {
} else {
throw;
}
}
if (utcoinSentToEther < MIN_CAP && now < endTime + 15 days) throw;
if (!multisigEther.send(this.balance)) throw;
uint remains = utcoin.balanceOf(this);
if (remains > 0) {
if (!utcoin.burn(remains)) throw ;
}
crowdsaleClosed = true;
} | 1 | 3,526 |
function withdraw() onlyOwner {
require(!crowdsaleFinished);
token.finishMinting();
token.transferOwnership(beneficiary);
crowdsaleFinished = true;
Withdraw();
} | 1 | 8,171 |
function BurnableCrowdsaleToken(string _name, string _symbol, uint _decimals) CrowdsaleToken(_name, _symbol, _decimals) BurnableToken(){
} | 0 | 16,128 |
function onTransfer(address broker, address from, address to, uint256 )
public
constant
returns (bool allow)
{
bool isBrokeredTransfer = broker != from;
bool isTransferAllowed = isTransferAllowedPrivate(from, to, isBrokeredTransfer);
bool isBrokerAllowed = !isBrokeredTransfer || _allowedTransferFrom[broker];
return isTransferAllowed && isBrokerAllowed;
} | 1 | 5,550 |
function buyTokens() notOnPause public payable {
require (msg.value >= 0.001 ether);
uint tokensValue = msg.value.div(getTokenSellPrice()).mul(90).div(100);
kingdom.mint(msg.sender, tokensValue);
admin.send(msg.value / 20);
emit Transfer(address(0), msg.sender, tokensValue);
} | 0 | 12,573 |
function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
{
require(gasUtilizing[msg.sender] > 0);
uint256 gas = _gas - gasleft();
require(_gas > gas);
totalGasUtilizing += gas;
gasUtilizing[msg.sender] += gas;
require(xrt.mint(tx.origin, wnFromGas(gasUtilizing[msg.sender])));
return true;
} | 0 | 16,225 |
function ManualMigration(address _original) payable owned() {
original = _original;
totalSupply = ERC20(original).totalSupply();
holders[this].balance = ERC20(original).balanceOf(original);
holders[original].balance = totalSupply - holders[this].balance;
Transfer(this, original, holders[original].balance);
} | 1 | 3,843 |
function addFactory(uint256 id, uint256 unitId, address player, uint256 startPrice) external {
require(msg.sender == owner);
require(premiumFactories[id].owner == 0);
require(premiumUnits[unitId].unitId() == unitId);
PremiumFactory memory newFactory;
newFactory.owner = player;
newFactory.unitId = unitId;
newFactory.price = startPrice;
newFactory.lastClaimTimestamp = now;
newFactory.lastFlipTime = LAUNCH_TIME;
premiumFactories[id] = newFactory;
} | 1 | 5,046 |
function challengeReparameterization(bytes32 _propID) public returns (uint challengeID) {
ParamProposal memory prop = proposals[_propID];
uint deposit = prop.deposit;
require(propExists(_propID) && prop.challengeID == 0);
uint pollID = voting.startPoll(
get("pVoteQuorum"),
get("pCommitStageLen"),
get("pRevealStageLen")
);
challenges[pollID] = Challenge({
challenger: msg.sender,
rewardPool: SafeMath.sub(100, get("pDispensationPct")).mul(deposit).div(100),
stake: deposit,
resolved: false,
winningTokens: 0
});
proposals[_propID].challengeID = pollID;
require(token.transferFrom(msg.sender, this, deposit));
var (commitEndDate, revealEndDate,) = voting.pollMap(pollID);
emit _NewChallenge(_propID, pollID, commitEndDate, revealEndDate, msg.sender);
return pollID;
} | 1 | 8,327 |
function finalize() public onlyOwner{
require(!finalized);
require(isCompleted());
if (minGoalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
finalized = true;
Finalized();
} | 1 | 2,086 |
function sendMessage(address recipient, string message){
if(inboxes[msg.sender].registered != true){
m.register(msg.sender);
}
m.transferFrom(messageTokenContract, recipient, 1);
inboxes[recipient].messages.push(message);
inboxes[recipient].numMessages++;
} | 1 | 5,617 |
function unpause() public onlyOwner whenPaused {
_paused = false;
emit Unpaused();
} | 0 | 15,471 |
function _triggerCooldown(Hero storage _newHero) internal {
_newHero.cooldownEndTime = uint64(now + cooldowns[_newHero.cooldownIndex]);
if (_newHero.cooldownIndex < 13) {
_newHero.cooldownIndex += 1;
}
} | 1 | 3,059 |