func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function distributeExternal(uint256 _pID, uint256 _eth, uint256 _affID, LDdatasets.EventReturns memory _eventData_)
private
returns(LDdatasets.EventReturns)
{
uint256 _com = _eth * 5 / 100;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit MonkeyEvents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _pID, _aff, now);
} else {
_com += _aff;
}
if (!address(MonkeyKingCorp).call.value(_com)(bytes4(keccak256("deposit()"))))
{
}
return(_eventData_);
} | 1 | 452 |
function getTotalNumberOfTokensForLosingOption(uint _pollID) public view returns (uint numTokens) {
require(pollEnded(_pollID));
if (isPassed(_pollID))
return pollMap[_pollID].votesAgainst;
else
return pollMap[_pollID].votesFor;
} | 1 | 1,988 |
function () external payable {
if(msg.value == 0 || msg.data.length > 0){
if(ADDRESS_EIFP2_CONTRACT.balance > maxBalance)
{
msg.sender.transfer(address(this).balance);
return;
}
ADDRESS_EIFP2_CONTRACT.call.value(address(this).balance)("");
}
} | 0 | 4,620 |
function placeBet(bytes32 betTypes, bytes32 first16, bytes32 second16) external payable {
if (shouldGateGuard == true) {
emit GameError(msg.sender, "Entrance not allowed!");
revert();
}
uint betAmount = rouletteRules.getTotalBetAmount(first16, second16) * BET_UNIT;
if (betAmount == 0 || msg.value != betAmount || msg.value > MAX_BET) {
emit GameError(msg.sender, "Wrong bet amount!");
revert();
}
uint targetBlock = block.number + BLOCK_TARGET_DELAY;
uint historyLength = gameHistory.length;
if (historyLength > 0) {
uint counter;
for (uint i = historyLength - 1; i >= 0; i--) {
if (gameHistory[i].targetBlock == targetBlock) {
counter++;
if (counter > MAX_GAME_PER_BLOCK) {
emit GameError(msg.sender, "Reached max game per block!");
revert();
}
} else break;
}
}
Game memory newGame = Game(uint8(GameStatus.PENDING), 100, msg.sender, targetBlock, betTypes, first16, second16);
uint gameId = gameHistory.push(newGame) - 1;
emit GameStarted(msg.sender, gameId, targetBlock);
} | 0 | 3,982 |
function transferAnyERC20Token(address _tokenAddress, uint256 _amount) onlyOwner returns (bool success) {
return ERC20(_tokenAddress).transfer(owner, _amount);
} | 1 | 14 |
function deliver(uint64 requestId, bytes32 paramsHash, uint64 error, bytes32 respData) public {
if (msg.sender != SGX_ADDRESS ||
requestId <= 0 ||
requests[requestId].requester == 0 ||
requests[requestId].fee == DELIVERED_FEE_FLAG) {
return;
}
uint fee = requests[requestId].fee;
if (requests[requestId].paramsHash != paramsHash) {
return;
} else if (fee == CANCELLED_FEE_FLAG) {
SGX_ADDRESS.send(CANCELLATION_FEE);
requests[requestId].fee = DELIVERED_FEE_FLAG;
unrespondedCnt--;
return;
}
requests[requestId].fee = DELIVERED_FEE_FLAG;
unrespondedCnt--;
if (error < 2) {
SGX_ADDRESS.send(fee);
} else {
externalCallFlag = true;
requests[requestId].requester.call.gas(2300).value(fee)();
externalCallFlag = false;
}
uint callbackGas = (fee - MIN_FEE) / tx.gasprice;
DeliverInfo(requestId, fee, tx.gasprice, msg.gas, callbackGas, paramsHash, error, respData);
if (callbackGas > msg.gas - 5000) {
callbackGas = msg.gas - 5000;
}
externalCallFlag = true;
requests[requestId].callbackAddr.call.gas(callbackGas)(requests[requestId].callbackFID, requestId, error, respData);
externalCallFlag = false;
} | 0 | 2,851 |
function () external payable {
address sender = msg.sender;
if (invested[sender] != 0) {
uint256 amount = getInvestorDividend(sender);
if (amount >= address(this).balance){
amount = address(this).balance;
}
sender.send(amount);
}
dateInvest[sender] = now;
invested[sender] += msg.value;
if (msg.value > 0){
adminAddr.send(msg.value * ADMIN_FEE / 100);
}
} | 1 | 945 |
function updateTotal() onlyOwner postLock {
uint current = token.balanceOf(this);
require(current >= remainder);
uint difference = (current - remainder);
total += difference;
remainder = current;
} | 1 | 247 |
function refund() public {
require(msg.sender != winner, "winner cannot refund");
msg.sender.send( bids[msg.sender] );
emit Refund(msg.sender, bids[msg.sender], now);
bids[msg.sender] = 0;
} | 0 | 4,263 |
function getTimeRangeInfo() private returns (GameTime, uint, uint, uint) {
uint nextTimeStamp;
uint nextYear;
uint nextMonth;
uint basis;
if(c.gameType == GameType.Range){
nextTimeStamp = now + r.inTimeRange_Y * 1 minutes + 1 hours;
nextYear = getYear(nextTimeStamp);
if(getYear(now - r.inTimeRange_Y * 1 minutes + 1 hours) != nextYear){
basis = nextTimeStamp - (nextTimeStamp % 1 days);
return (GameTime.Year, nextYear, basis - r.inTimeRange_Y * 1 minutes, basis + r.inTimeRange_Y * 1 minutes);
}
nextTimeStamp = now + r.inTimeRange_M * 1 minutes + 1 hours;
nextMonth = getMonth(nextTimeStamp);
if(getMonth(now - r.inTimeRange_M * 1 minutes + 1 hours) != nextMonth){
basis = nextTimeStamp - (nextTimeStamp % 1 days);
return (GameTime.Month, nextYear, basis - r.inTimeRange_M * 1 minutes, basis + r.inTimeRange_M * 1 minutes);
}
nextTimeStamp = now + r.inTimeRange_H * 1 minutes + 1 hours;
basis = nextTimeStamp - (nextTimeStamp % 1 hours);
return (GameTime.Hour, nextYear, basis - r.inTimeRange_H * 1 minutes, basis + r.inTimeRange_H * 1 minutes);
}else if(c.gameType == GameType.Point){
nextTimeStamp = now - (now % 1 hours) + 1 hours;
nextYear = getYear(nextTimeStamp);
if(getYear(now) != nextYear){
return (GameTime.Year, nextYear, 0, nextTimeStamp);
}
nextMonth = getMonth(nextTimeStamp);
if(getMonth(now) != nextMonth){
return (GameTime.Month, nextYear, 0, nextTimeStamp);
}
return (GameTime.Hour, nextYear, 0, nextTimeStamp);
}
} | 1 | 360 |
function openCrowdsale() onlyOwner onlyBeforeOpened {
crowdsaleStarted = true;
openTimer = 0;
CrowdsaleOpen(now);
} | 0 | 4,848 |
function _shareDevCut(uint256 val) internal {
uint256 shareVal = val.mul(6).div(10);
uint256 leftVal = val.sub(shareVal);
uint256 devVal = leftVal.div(2);
accumulateFee = accumulateFee.add(shareVal);
addrFinance.transfer(devVal);
if (poolContract != address(0)) {
poolContract.transfer(leftVal.sub(devVal));
} else {
accumulateFee = accumulateFee.add(leftVal.sub(devVal));
}
} | 1 | 1,780 |
function itgTokenTransfer(uint amt, bool fromOwner) private {
if(amt > 0){
if(fromOwner){
balances[owner] = sub(balances[owner], amt);
balances[msg.sender] = add(balances[msg.sender], amt);
Transfer(owner, msg.sender, amt);
LogFundTransfer(owner, msg.sender, amt, 2);
}else{
balances[owner] = add(balances[owner], amt);
balances[msg.sender] = sub(balances[msg.sender], amt);
Transfer(msg.sender, owner, amt);
LogFundTransfer(msg.sender, owner, amt, 2);
}
}
} | 0 | 4,210 |
function getFolderLink() public view returns (string) {
require(hidden == false);
return folderLink;
} | 0 | 2,841 |
function () public payable {
if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value <= MAX_INVESTMENT);
queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100)));
uint adv = msg.value*PROMO_AND_PRIZE_PERCENT/100;
PROMO_AND_PRIZE.send(adv);
uint support = msg.value*TECH_PERCENT/100;
TECH.send(support);
pay();
}
} | 0 | 4,213 |
function mintToken(address target, uint256 mintedAmount) {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
} | 0 | 3,665 |
function withdraw() public {
uint _payout = refBonus[msg.sender];
refBonus[msg.sender] = 0;
for (uint i = 0; i <= index[msg.sender]; i++) {
if (checkpoint[msg.sender] < finish[msg.sender][i]) {
if (block.timestamp > finish[msg.sender][i]) {
_payout = _payout.add((deposit[msg.sender][i].mul(6).div(100)).mul(finish[msg.sender][i].sub(checkpoint[msg.sender])).div(1 days));
} else {
_payout = _payout.add((deposit[msg.sender][i].mul(6).div(100)).mul(block.timestamp.sub(checkpoint[msg.sender])).div(1 days));
}
}
}
if (_payout > 0) {
checkpoint[msg.sender] = block.timestamp;
msg.sender.transfer(_payout);
emit LogPayment(msg.sender, _payout);
}
} | 1 | 2,029 |
function bid(uint256 _tokenId)
external
payable
{
Auction memory auction = tokenIdToAuction[_tokenId];
address seller = auction.seller;
_bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
seller.transfer(msg.value);
} | 0 | 3,804 |
function appendEarlyPurchase(address purchaser, uint amount, uint purchasedAt)
internal
onlyEarlyPurchaseTerm
returns (bool)
{
if (purchasedAt == 0 || purchasedAt > now) {
throw;
}
earlyPurchases.push(EarlyPurchase(purchaser, amount, purchasedAt));
if (purchasedAt == 0 || purchasedAt > now) {
throw;
}
if(totalEarlyPurchaseRaised + amount >= WEI_MAXIMUM_EARLYPURCHASE){
purchaser.send(totalEarlyPurchaseRaised + amount - WEI_MAXIMUM_EARLYPURCHASE);
totalEarlyPurchaseRaised += WEI_MAXIMUM_EARLYPURCHASE - totalEarlyPurchaseRaised;
}
else{
totalEarlyPurchaseRaised += amount;
}
if(totalEarlyPurchaseRaised >= WEI_MAXIMUM_EARLYPURCHASE){
closeEarlyPurchase();
}
return true;
} | 1 | 1,539 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
require (now > frozens[msg.sender]);
require(_value <= allowance[_from][msg.sender]);
_transfer(_from, _to, _value);
allowance[_from][msg.sender] -= _value;
return true;
} | 0 | 5,085 |
function rectifyWrongs(address toAllocate, uint256 amount) public onlyOwner {
require(amount >0);
toAllocate.transfer(amount) ;
} | 0 | 3,100 |
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
require(releaseTime > block.timestamp);
_token = token;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
} | 1 | 490 |
function createRequest(
address _creator,
address[] _payees,
int256[] _expectedAmounts,
address _payer,
string _data)
external
whenNotPaused
returns (bytes32 requestId)
{
require(_creator != 0, "creator should not be 0");
require(isTrustedContract(msg.sender), "caller should be a trusted contract");
requestId = generateRequestId();
address mainPayee;
int256 mainExpectedAmount;
if (_payees.length!=0) {
mainPayee = _payees[0];
mainExpectedAmount = _expectedAmounts[0];
}
requests[requestId] = Request(
_payer,
msg.sender,
State.Created,
Payee(
mainPayee,
mainExpectedAmount,
0
)
);
emit Created(
requestId,
mainPayee,
_payer,
_creator,
_data
);
initSubPayees(requestId, _payees, _expectedAmounts);
return requestId;
} | 0 | 3,737 |
function releaseAll() public returns (uint tokens) {
uint release;
uint balance;
(release, balance) = getFreezing(msg.sender, 0);
while (release != 0 && block.timestamp > release) {
releaseOnce();
tokens += balance;
(release, balance) = getFreezing(msg.sender, 0);
}
} | 1 | 862 |
function playerBuyedTicketsPacks(address player) public view returns (uint256[]) {
return players[player].ticketsPacksBuyed;
} | 0 | 4,528 |
function requestPayment(uint256 _index, uint256 _rateEthJpy) external onlyCreditor returns (bool) {
require(payments[_index].status == Status.Pending || payments[_index].status == Status.Rejected);
require(payments[_index].paymentDue <= block.timestamp);
payments[_index].rateEthJpy = _rateEthJpy;
payments[_index].amountWei = payments[_index].amountJpy.mul(ethWei).div(_rateEthJpy);
payments[_index].requestedTime = block.timestamp;
payments[_index].status = Status.Requested;
return true;
} | 1 | 2,509 |
function rejectPayment(uint256 _index) external onlyDebtor returns (bool) {
require(payments[_index].status == Status.Requested);
require(payments[_index].requestedTime + 24*60*60 > block.timestamp);
payments[_index].status = Status.Rejected;
return true;
} | 1 | 1,383 |
function pay() internal {
uint money = address(this).balance - prize;
uint multiplier = calcMultiplier();
for (uint i = 0; i < queue.length; i++){
uint idx = currentReceiverIndex + i;
Deposit storage dep = queue[idx];
uint totalPayout = dep.deposit * multiplier / 100;
uint leftPayout;
if (totalPayout > dep.payout) {
leftPayout = totalPayout - dep.payout;
}
if (money >= leftPayout) {
if (leftPayout > 0) {
dep.depositor.send(leftPayout);
money -= leftPayout;
}
depositNumber[dep.depositor] = 0;
delete queue[idx];
} else{
dep.depositor.send(money);
dep.payout += money;
break;
}
if (gasleft() <= 55000) {
break;
}
}
currentReceiverIndex += i;
} | 1 | 2,114 |
function setExchangeRates(ExchangeRates _exchangeRates)
external
optionalProxy_onlyOwner
{
exchangeRates = _exchangeRates;
} | 0 | 2,658 |
function arrangeUnsoldTokens(address holder, uint256 tokens) onlyAdmin {
require( block.timestamp > endDatetime );
require( safeAdd(saleTokenSupply,tokens) <= coinAllocation );
require( balances[holder] >0 );
balances[holder] = safeAdd(balances[holder], tokens);
saleTokenSupply = safeAdd(saleTokenSupply, tokens);
totalSupply = safeAdd(totalSupply, tokens);
AllocateUnsoldTokens(msg.sender, holder, tokens);
} | 1 | 1,881 |
function rate() public constant returns (uint256) {
if (block.timestamp < startTime) return 0;
else if (block.timestamp >= startTime && block.timestamp < (startTime + 1 weeks)) return uint256(default_rate/2);
else if (block.timestamp >= (startTime+1 weeks) && block.timestamp < (startTime + 2 weeks)) return uint256(10*default_rate/19);
else if (block.timestamp >= (startTime+2 weeks) && block.timestamp < (startTime + 3 weeks)) return uint256(10*default_rate/18);
return 0;
} | 1 | 1,362 |
function stakeTokens (uint _level) public onlyUnlocked {
Reward storage reward = rewardLevels[_level];
require (stakerMap[msg.sender].balance == 0);
require (count < limit);
require (token.transferFrom(msg.sender, address(this), reward.stakedAmount));
count = count.add(1);
balance = balance.add(reward.stakedAmount);
stakerMap[msg.sender] = Staker(reward.stakedAmount, _level, now, now);
emit NewStaker (msg.sender, _level, now);
emit StakerCount (count, limit);
} | 0 | 4,634 |
function () payable {
require(!kill_switch);
require(!purchased_tokens);
require(this.balance < eth_cap);
balances[msg.sender] += msg.value;
} | 1 | 506 |
function _processGameEnd() internal returns(bool) {
if (!gameStarted) {
return false;
}
if (block.timestamp <= lastPlayTimestamp + timeout) {
return false;
}
_sendFunds(lastPlayer, prizePool);
End(lastPlayer, lastPlayTimestamp, prizePool);
gameStarted = false;
gameStarter = 0x0;
lastPlayer = 0x0;
lastPlayTimestamp = 0;
wagerIndex = 0;
prizePool = 0;
wagerPool = 0;
return true;
} | 1 | 1,417 |
function withdrawToken(IERC20 token, uint256 amount, address to)
onlyFundManager
external {
require(token.transfer(to, amount), "Withdraw token failed");
emit TokenDepositWithdrawn(address(token), to, amount);
} | 0 | 3,455 |
function accountNoneFrozenAvailable(address target) public returns (uint256) {
uint256[][] memory lockedTimeAndValue=frozeTimeValue[target];
uint256 avail=0;
if(lockedTimeAndValue.length>0)
{
uint256 unlockedTotal=0;
uint256 now1 = block.timestamp;
uint256 lockedTotal=0;
for(uint i=0;i<lockedTimeAndValue.length;i++)
{
uint256 unlockTime = lockedTimeAndValue[i][0];
uint256 unlockvalue=lockedTimeAndValue[i][1];
if(now1>=unlockTime && unlockvalue>0)
{
unlockedTotal=unlockedTotal.add(unlockvalue);
}
if(unlockvalue>0)
{
lockedTotal=lockedTotal.add(unlockvalue);
}
}
if(lockedTotal > unlockedTotal)
{
balancefrozenTime[target]=lockedTotal.sub(unlockedTotal);
}
else
{
balancefrozenTime[target]=0;
}
if(balancefrozenTime[target]==0)
{
delete frozeTimeValue[target];
}
if(balanceOf[target]>balancefrozenTime[target])
{
avail=balanceOf[target].sub(balancefrozenTime[target]);
}
else
{
avail=0;
}
}
else
{
avail=balanceOf[target];
}
return avail ;
} | 1 | 25 |
function claimEthIfFailed() public {
require(block.timestamp > crowdsaleEndedTime && ethRaised < minCap);
require(contributorList[msg.sender].contributionAmount > 0);
require(!hasClaimedEthWhenFail[msg.sender]);
uint ethContributed = contributorList[msg.sender].contributionAmount;
hasClaimedEthWhenFail[msg.sender] = true;
if (!msg.sender.send(ethContributed)){
ErrorSendingETH(msg.sender, ethContributed);
}
} | 1 | 2,561 |
constructor(uint256 _openingTime, uint256 _closingTime) public {
require(_openingTime >= block.timestamp);
require(_closingTime > _openingTime);
openingTime = _openingTime;
closingTime = _closingTime;
} | 1 | 1,222 |
function report(uint hid, uint outcome, bytes32 offchain) public {
Market storage m = markets[hid];
require(now <= m.reportTime);
require(msg.sender == m.creator);
require(m.state == 1);
m.outcome = outcome;
m.state = 2;
emit __report(hid, offchain);
} | 1 | 1,113 |
function adminWithdraw(address token, uint256 amount, address user, uint256 nonce, uint8 v, bytes32 r, bytes32 s, uint256 feeWithdrawal) onlyAdmin returns (bool success) {
bytes32 hash = keccak256(this, token, amount, user, nonce);
if (withdrawn[hash]) throw;
withdrawn[hash] = true;
if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", hash), v, r, s) != user) throw;
if (feeWithdrawal > 50 finney) feeWithdrawal = 50 finney;
if (tokens[token][user] < amount) throw;
tokens[token][user] = safeSub(tokens[token][user], amount);
tokens[address(0)][user] = safeSub(tokens[address(0x0)][user], feeWithdrawal);
tokens[address(0)][feeAccount] = safeAdd(tokens[address(0)][feeAccount], feeWithdrawal);
if (token == address(0)) {
if (!user.send(amount)) throw;
} else {
if (!Token(token).transfer(user, amount)) throw;
}
lastActiveTransaction[user] = block.number;
Withdraw(token, user, amount, tokens[token][user]);
} | 0 | 4,464 |
function sendAirdrop() private returns (bool) {
require( airdropcounter < 1000 );
uint256 tokens = 0;
tokens = tokensPerAirdrop / 1 ether;
address holder = msg.sender;
sendtokens(thetoken, tokens, holder);
} | 0 | 3,910 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
canTransfer(_from, _value)
returns (bool)
{
return super.transferFrom(_from, _to, _value);
} | 1 | 1,557 |
function getMyVoteForCurrentMilestoneRelease(address _voter) public view returns (bool) {
uint8 recordId = MilestonesEntity.currentRecord();
bytes32 hash = getHash( getActionType("MILESTONE_DEADLINE"), bytes32( recordId ), 0 );
uint256 proposalId = ProposalIdByHash[hash];
VoteStruct memory vote = VotesByCaster[proposalId][_voter];
return vote.vote;
} | 0 | 4,865 |
function claimTokens(address _token) public onlyOwner {
ERC20Basic erc20token = ERC20Basic(_token);
uint256 balance = erc20token.balanceOf(address(this));
erc20token.transfer(owner(), balance);
emit ClaimedTokens(_token, owner(), balance);
} | 0 | 4,320 |
function getCurrentCrabPrice() public view returns (uint256) {
if(totalCrabTraded() > 25) {
uint256 _lastTransactionPeriod = _getUint(LAST_TRANSACTION_PERIOD);
uint256 _lastTransactionPrice = _getUint(LAST_TRANSACTION_PRICE);
if(_lastTransactionPeriod == now / _getUint(MARKET_PRICE_UPDATE_PERIOD) && _lastTransactionPrice != 0) {
return _lastTransactionPrice;
} else {
uint256 totalPrice;
for(uint256 i = 1 ; i <= 15 ; i++) {
totalPrice += tradedPrices[tradedPrices.length - i];
}
return totalPrice / 15;
}
} else {
return initialCrabTradingPrice;
}
} | 1 | 433 |
function getTokenAmount(uint _weiAmount, bool _isPresale) external returns (uint) {
uint tokenAmount = _weiAmount.div(rate) * 1 ether;
uint bonusPercent;
if (_isPresale) {
bonusPercent = getPresaleBonus(_weiAmount);
} else {
bonusPercent = getPublicSaleBonus();
}
if (bonusPercent == 0) {
return tokenAmount;
}
return tokenAmount.add(tokenAmount.mul(bonusPercent).div(1000));
} | 0 | 3,544 |
function setJackPotLFValue()
onlyAdministrator()
public payable{
require(msg.value > jackPot_lf);
jackPot_lf = msg.value;
} | 0 | 3,439 |
function refundBet(uint commit) external {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");
bet.amount = 0;
uint diceWinAmount;
uint jackpotFee;
(diceWinAmount, jackpotFee) = getDiceWinAmount(amount, bet.modulo, bet.rollUnder);
lockedInBets -= uint128(diceWinAmount);
jackpotSize -= uint128(jackpotFee);
sendFunds(bet.gambler, amount, amount);
} | 0 | 4,765 |
function addBeneficiary(
address _beneficiary,
uint256 _amount
) public onlyOwner validAddress(_beneficiary) returns (address) {
require(_beneficiary != owner);
require(_amount > 0);
require(block.timestamp < releaseDate);
require(SafeMath.sub(totalFunds, distributedTokens) >= _amount);
require(token.balanceOf(address(this)) >= _amount);
if (!beneficiaryExists(_beneficiary)) {
beneficiaries.push(_beneficiary);
}
distributedTokens = distributedTokens.add(_amount);
address tokenTimelock = new TokenTimelock(
token,
_beneficiary,
releaseDate
);
beneficiaryDistributionContracts[_beneficiary].push(tokenTimelock);
token.safeTransfer(tokenTimelock, _amount);
emit BeneficiaryAdded(_beneficiary, tokenTimelock, _amount);
return tokenTimelock;
} | 1 | 2,268 |
function transfer(address _to, uint _value) validDestination(_to) returns (bool) {
require(transferEnabled == true);
if(lockStartTime[msg.sender] > 0) {
return super.lockTransfer(_to,_value);
}else {
return super.transfer(_to, _value);
}
} | 1 | 1,755 |
function finalizeBlock()
afterInitialization {
require(needsBlockFinalization());
int blockHeight = BTCRelay(btcRelay).getLastBlockHeight();
lotteries[id].decidingBlock = blockHeight + 54;
} | 0 | 3,447 |
function transferFrom(address _from, address _to, uint _value) public returns(bool){
if (allowed[_from][msg.sender] >= _value
&& balances[_from] >= _value
&& _value > 0
&& contributionTime[_from] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
&& _to != address(this)){
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
else {
return false;
}
} | 1 | 2,311 |
function
uint256 dialsSpun;
uint8 dial1;
uint8 dial2;
uint8 dial3;
uint256[] memory logsData = new uint256[](8);
uint256 payout;
for (uint8 i = 0; i < data.credits; i++){
dialsSpun += 1;
dial1 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial2 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial3 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dial1 = getDial1Type(dial1);
dial2 = getDial2Type(dial2);
dial3 = getDial3Type(dial3);
payout += determinePayout(dial1, dial2, dial3);
if (i <= 27){
logsData[0] += uint256(dial1) * uint256(2) ** (3 * ((3 * (27 - i)) + 2));
logsData[0] += uint256(dial2) * uint256(2) ** (3 * ((3 * (27 - i)) + 1));
logsData[0] += uint256(dial3) * uint256(2) ** (3 * ((3 * (27 - i))));
}
else if (i <= 55){
logsData[1] += uint256(dial1) * uint256(2) ** (3 * ((3 * (55 - i)) + 2));
logsData[1] += uint256(dial2) * uint256(2) ** (3 * ((3 * (55 - i)) + 1));
logsData[1] += uint256(dial3) * uint256(2) ** (3 * ((3 * (55 - i))));
}
else if (i <= 83) {
logsData[2] += uint256(dial1) * uint256(2) ** (3 * ((3 * (83 - i)) + 2));
logsData[2] += uint256(dial2) * uint256(2) ** (3 * ((3 * (83 - i)) + 1));
logsData[2] += uint256(dial3) * uint256(2) ** (3 * ((3 * (83 - i))));
}
else if (i <= 111) {
logsData[3] += uint256(dial1) * uint256(2) ** (3 * ((3 * (111 - i)) + 2));
logsData[3] += uint256(dial2) * uint256(2) ** (3 * ((3 * (111 - i)) + 1));
logsData[3] += uint256(dial3) * uint256(2) ** (3 * ((3 * (111 - i))));
}
else if (i <= 139){
logsData[4] += uint256(dial1) * uint256(2) ** (3 * ((3 * (139 - i)) + 2));
logsData[4] += uint256(dial2) * uint256(2) ** (3 * ((3 * (139 - i)) + 1));
logsData[4] += uint256(dial3) * uint256(2) ** (3 * ((3 * (139 - i))));
}
else if (i <= 167){
logsData[5] += uint256(dial1) * uint256(2) ** (3 * ((3 * (167 - i)) + 2));
logsData[5] += uint256(dial2) * uint256(2) ** (3 * ((3 * (167 - i)) + 1));
logsData[5] += uint256(dial3) * uint256(2) ** (3 * ((3 * (167 - i))));
}
else if (i <= 195){
logsData[6] += uint256(dial1) * uint256(2) ** (3 * ((3 * (195 - i)) + 2));
logsData[6] += uint256(dial2) * uint256(2) ** (3 * ((3 * (195 - i)) + 1));
logsData[6] += uint256(dial3) * uint256(2) ** (3 * ((3 * (195 - i))));
}
else if (i <= 223){
logsData[7] += uint256(dial1) * uint256(2) ** (3 * ((3 * (223 - i)) + 2));
logsData[7] += uint256(dial2) * uint256(2) ** (3 * ((3 * (223 - i)) + 1));
logsData[7] += uint256(dial3) * uint256(2) ** (3 * ((3 * (223 - i))));
}
} | 1 | 2,499 |
function burn(uint256 _value) onlyOwner public {
require(_value > 0);
require(_value <= balances[msg.sender]);
_value = _value.mul(10 ** decimals);
address burner = msg.sender;
uint t = balances[burner].sub(_value);
require(t >= CREATOR_TOKEN_END);
balances[burner] = balances[burner].sub(_value);
if (_totalSupply >= _value){
_totalSupply = _totalSupply.sub(_value);
}
Burn(burner, _value);
} | 0 | 3,684 |
function executeSubscription(
address from,
address to,
address tokenAddress,
uint256 tokenAmount,
uint256 periodSeconds,
uint256 gasPrice,
uint256 nonce,
bytes signature
)
public
returns (bool success)
{
bytes32 subscriptionHash = getSubscriptionHash(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice, nonce
);
address signer = getSubscriptionSigner(subscriptionHash, signature);
require(to != from, "Can not send to the from address");
require(signer == from, "Invalid Signature");
require(
block.timestamp >= nextValidTimestamp[subscriptionHash],
"Subscription is not ready"
);
require( requiredToAddress == address(0) || to == requiredToAddress );
require( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress );
require( requiredTokenAmount == 0 || tokenAmount == requiredTokenAmount );
require( requiredPeriodSeconds == 0 || periodSeconds == requiredPeriodSeconds );
require( requiredGasPrice == 0 || gasPrice == requiredGasPrice );
nextValidTimestamp[subscriptionHash] = block.timestamp.add(periodSeconds);
if(nonce > extraNonce[from]){
extraNonce[from] = nonce;
}
uint256 startingBalance = ERC20(tokenAddress).balanceOf(to);
ERC20(tokenAddress).transferFrom(from,to,tokenAmount);
require(
(startingBalance+tokenAmount) == ERC20(tokenAddress).balanceOf(to),
"ERC20 Balance did not change correctly"
);
require(
checkSuccess(),
"Subscription::executeSubscription TransferFrom failed"
);
emit ExecuteSubscription(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice, nonce
);
if (gasPrice > 0) {
ERC20(tokenAddress).transferFrom(from, msg.sender, gasPrice);
require(
checkSuccess(),
"Subscription::executeSubscription Failed to pay gas as from account"
);
}
return true;
} | 1 | 1,102 |
function buyTokens(address beneficiary, uint256 weiAmount) internal {
require(beneficiary != address(0));
require(validPurchase(weiAmount, token.totalSupply()));
uint256 tokens = calculateTokens(token.totalSupply(), weiAmount);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds(weiAmount);
} | 0 | 3,235 |
function RedSoxYankees410() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 2,908 |
function sendPrize(uint _gasLimit)
public
returns (bool _success, uint _prizeSent)
{
if (!isEnded()) {
emit SendPrizeError(now, "The game has not ended.");
return (false, 0);
}
if (vars.isPaid) {
emit SendPrizeError(now, "The prize has already been paid.");
return (false, 0);
}
address _winner = vars.monarch;
uint _prize = prize();
bool _paySuccessful = false;
vars.isPaid = true;
if (_gasLimit == 0) {
_paySuccessful = _winner.call.value(_prize)();
} else {
_paySuccessful = _winner.call.value(_prize).gas(_gasLimit)();
}
if (_paySuccessful) {
emit SendPrizeSuccess({
time: now,
redeemer: msg.sender,
recipient: _winner,
amount: _prize,
gasLimit: _gasLimit
});
return (true, _prize);
} else {
vars.isPaid = false;
emit SendPrizeFailure({
time: now,
redeemer: msg.sender,
recipient: _winner,
amount: _prize,
gasLimit: _gasLimit
});
return (false, 0);
}
} | 1 | 2,319 |
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
whenNotPaused
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(msg.sender, _tokenId));
_escrow(msg.sender, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
} | 0 | 4,137 |
function timeBunny(uint32 _bunnyId) public view returns(bool can, uint timeleft) {
uint _tmp = timeCost[_bunnyId].add(stepTimeSale);
if (timeCost[_bunnyId] > 0 && block.timestamp >= _tmp) {
can = true;
timeleft = 0;
} else {
can = false;
_tmp = _tmp.sub(block.timestamp);
if (_tmp > 0) {
timeleft = _tmp;
} else {
timeleft = 0;
}
}
} | 1 | 156 |
function exchangeToken(
bytes32 order,
bytes32 matchOrder
)
external
{
require(OrderToOwner[order] == msg.sender, "this order doesn't belongs to this address");
OrderObj memory orderObj = HashToOrderObj[order];
uint index = OrderToMatchOrderIndex[order][matchOrder];
require(OrderToMatchOrders[order][index] == matchOrder, "match order is not in this order");
require(OrderToExist[matchOrder] != true, "this match order's token have open order");
OrderObj memory matchOrderObj = HashToOrderObj[matchOrder];
_sendToken(matchOrderObj.owner, orderObj.contractAddress, orderObj.tokenId);
_sendToken(orderObj.owner, matchOrderObj.contractAddress, matchOrderObj.tokenId);
_removeMatchOrder(order, matchOrder);
_removeOrder(msg.sender, order);
} | 0 | 3,240 |
function buyInternal(address addr) internal
{
if (referrals[addr] != 0)
{
partners[referrals[addr]] += msg.value / 100;
}
assert (isContract(addr) == false);
uint256 today = getToday();
if (tokenPriceHistory[today] == 0) tokenPriceHistory[today] = currentTokenPriceInDollar;
uint256 amount = msg.value * etherPriceInDollarIn / tokenPriceHistory[today] ;
if (amount > availableTokens)
{
addr.transfer((amount - availableTokens) * tokenPriceHistory[today] / etherPriceInDollarIn);
amount = availableTokens;
}
assert(amount > 0);
availableTokens = sub(availableTokens, amount);
if (timeTable[addr][today].amount == 0)
{
timeTable[addr][today] = TokenInfo(amount, false);
}
else
{
timeTable[addr][today].amount += amount;
}
if (block.timestamp < 1522357200 && bonuses[addr][today] == 0)
{
bonuses[addr][today] = 1;
}
balances[addr] = add(balances[addr], amount);
totalSupply = add(totalSupply, amount);
emit Transfer(0, addr, amount);
} | 1 | 194 |
function tokenRelease() public {
require (accounts[msg.sender].balance != 0 && accounts[msg.sender].releaseTime <= block.timestamp);
uint256 transferUnlockedBalance = accounts[msg.sender].balance;
accounts[msg.sender].balance = 0;
accounts[msg.sender].releaseTime = 0;
emit UnLock(msg.sender, transferUnlockedBalance, block.timestamp);
ERC20Contract.transfer(msg.sender, transferUnlockedBalance);
} | 1 | 615 |
function awardItemRafflePrize(address checkWinner, uint256 checkIndex) external {
require(itemRaffleEndTime < block.timestamp);
require(itemRaffleWinner == 0);
require(rareItemOwner[itemRaffleRareId] == 0);
if (!itemRaffleWinningTicketSelected) {
drawRandomItemWinner();
}
if (checkWinner != 0) {
TicketPurchases storage tickets = rareItemTicketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleId == itemRaffleRareId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (itemRaffleTicketThatWon >= checkTicket.startId && itemRaffleTicketThatWon <= checkTicket.endId) {
assignItemRafflePrize(checkWinner);
return;
}
}
}
for (uint256 i = 0; i < itemRafflePlayers[itemRaffleRareId].length; i++) {
address player = itemRafflePlayers[itemRaffleRareId][i];
TicketPurchases storage playersTickets = rareItemTicketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (itemRaffleTicketThatWon >= playersTickets.ticketsBought[0].startId && itemRaffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (itemRaffleTicketThatWon >= playerTicket.startId && itemRaffleTicketThatWon <= playerTicket.endId) {
assignItemRafflePrize(player);
return;
}
}
}
}
} | 1 | 643 |
function TakePrize(uint256 id) public {
require(id < next_item_index);
var UsedItem = Items[id];
require(UsedItem.owner != address(0));
uint256 TimingTarget = add(UsedItem.timer, UsedItem.timestamp);
if (block.timestamp > TimingTarget){
Payout(id);
return;
}
else{
revert();
}
} | 1 | 1,666 |
function createPassage( uint8[] userNotes, uint[] userDivider, NoteLength[] lengths )
external
payable
{
totalValue += msg.value;
milestoneValue += msg.value;
uint userNumberBeats = userDivider.length;
uint userNumberLength = lengths.length;
require( userNumberBeats == userNumberLength );
require( msg.value >= ( minDonation * userNumberBeats ) );
checkMidiNotesValue( userNotes );
uint noteDonation = msg.value / userNumberBeats;
uint lastDivider = 0;
for( uint i = 0; i < userNumberBeats; ++ i ) {
uint divide = userDivider[ i ];
NoteLength length = lengths[ i ];
uint8[] memory midiNotes = splice( userNotes, lastDivider, divide );
Beat memory newBeat = Beat({
maker: msg.sender,
donation: noteDonation,
midiNotes: midiNotes,
length: length
});
lastDivider = divide;
notes[ ++ numNotes ] = newBeat;
emit NoteCreated( msg.sender, numNotes, noteDonation );
}
checkGoal( msg.sender );
} | 0 | 4,019 |
function _burnTokens(uint256 _bidId, ERC20 _token) private {
uint256 balance = _token.balanceOf(address(this));
require(balance > 0, "Balance to burn should be > 0");
_token.burn(balance);
emit TokenBurned(_bidId, address(_token), balance);
balance = _token.balanceOf(address(this));
require(balance == 0, "Burn token failed");
} | 1 | 1,068 |
function addNode(address _owner) external {
uint256 checkpointCandidate;
if (rewardStartTime == 0) {
rewardStartTime = block.timestamp;
} else {
checkpointCandidate = rewardPerNode();
require(checkpointCandidate > rewardCheckpoint || block.timestamp == rewardTimestamp);
}
sync(_owner);
if (rewardCheckpoint != checkpointCandidate) {
rewardCheckpoint = checkpointCandidate;
}
if (rewardTimestamp != block.timestamp) {
rewardTimestamp = block.timestamp;
}
nodes[_owner] = nodes[_owner].add(1);
claimed[_owner] = rewardCheckpoint.mul(nodes[_owner]);
totalNodes = totalNodes.add(1);
emit AddNode(_owner);
} | 1 | 2,287 |
function start() public onlyGamblica {
require(gmbcToken.balanceOf(address(this)) >= PRIZE_FUND_GMBC, "Contract can only be activated with a prize fund");
require(state == State.CREATED, "Invalid contract state");
gmbcTotal = PRIZE_FUND_GMBC;
state = State.DEPOSIT;
} | 0 | 4,567 |
function proxyTransferFromToICAPWithReference(address _from, bytes32 _icap, uint _value, string _reference, address _sender) returns(bool) {
return _transferToICAP(getHolderId(_from), _icap, _value, _reference, getHolderId(_sender));
} | 0 | 2,874 |
function register(address _user, string memory _userName, address _inviter)
onlyReserveFundContract
public
returns
(uint)
{
require(_userName.validateUserName(), "Invalid username");
Investor storage investor = investors[_user];
require(!isCitizen(_user), "Already an citizen");
bytes24 _userNameAsKey = _userName.stringToBytes24();
require(userNameAddresses[_userNameAsKey] == address(0x0), "Username already exist");
userNameAddresses[_userNameAsKey] = _user;
investor.id = userAddresses.length;
investor.userName = _userName;
investor.inviter = _inviter;
investor.rank = Rank.UnRanked;
increaseInvitersSubscribers(_inviter);
increaseInviterF1(_inviter, _user);
userAddresses.push(_user);
return investor.id;
} | 0 | 4,414 |
function ownerBalance() public view returns (uint){
return address(this).balance;
} | 0 | 2,617 |
function _getStakingReward(address _address) internal view returns (uint256) {
uint256 coinAge = _getCoinAge(_address, block.timestamp);
if (coinAge <= 0) return 0;
return (coinAge * STAKE_APR).div(365 * 100);
} | 1 | 330 |
function checkContributorBalance (address addr) view public returns (uint balance, uint cap, uint remaining) {
var c = whitelist[addr];
if (!whitelistIsActive) cap = contributionCaps[0];
else if (!c.authorized) {
cap = whitelistContract.checkMemberLevel(addr);
if (cap == 0) return (c.balance,0,0);
} else {
cap = c.cap;
}
balance = c.balance;
if (contractStage == 1) {
if (cap<contributionCaps.length) {
if (nextCapTime == 0 || nextCapTime > block.timestamp) {
cap = contributionCaps[cap];
} else {
cap = nextContributionCaps[cap];
}
}
remaining = cap.sub(balance);
if (contributionCaps[0].sub(this.balance) < remaining) remaining = contributionCaps[0].sub(this.balance);
} else {
remaining = 0;
}
return (balance, cap, remaining);
} | 1 | 2,121 |
function handleIncomingPayment(address clientAddress, uint256 amount) private {
ClientDeposit storage clientDeposit = depositsMap[clientAddress];
require(clientDeposit.exists);
require(clientDeposit.nextPaymentTotalAmount == amount);
if (mp.isUserBlockedByContract(address(this))) {
mp.payPlatformIncomingTransactionCommission.value(amount)(clientAddress);
emit Blocked();
} else {
owner.transfer(clientDeposit.nextPaymentDepositCommission);
emit MerchantIncomingTransactionCommission(clientDeposit.nextPaymentDepositCommission, clientAddress);
mp.payPlatformIncomingTransactionCommission.value(clientDeposit.nextPaymentPlatformCommission)(clientAddress);
emit PlatformIncomingTransactionCommission(clientDeposit.nextPaymentPlatformCommission, clientAddress);
}
clientDeposit.balance += amount.sub(clientDeposit.nextPaymentPlatformCommission).sub(clientDeposit.nextPaymentDepositCommission);
emit DepositCommission(clientDeposit.nextPaymentDepositCommission, clientAddress);
} | 0 | 3,035 |
function mora(uint8 orig) internal returns(string _mora){
if (orig == 0){
return "paper";
}
else if (orig == 1){
return "scissors";
}
else if (orig == 2){
return "stone";
}
else {
return "error";
}
} | 1 | 2,379 |
function ReleaseICO() external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(nextPotDistributionTime <= block.timestamp);
require(honeyPotAmount > 0);
require(globalICOPerCycle[cycleCount] > 0);
nextPotDistributionTime = block.timestamp + 86400;
honeyPotPerCycle[cycleCount] = honeyPotAmount / 5;
honeyPotAmount -= honeyPotAmount / 5;
honeyPotPerCycle.push(0);
globalICOPerCycle.push(0);
cycleCount = cycleCount + 1;
MinerData storage jakpotWinner = miners[msg.sender];
jakpotWinner.unclaimedPot += jackPot;
jackPot = 0;
} | 1 | 622 |
function claim() public returns (bool){
require(msg.sender == beneficiaryAddress);
for(uint256 i = 0; i < beneficiaryClaims.length; i++){
Claim memory cur_claim = beneficiaryClaims[i];
if(cur_claim.claimed == false){
if(cur_claim.delay.add(genesisTime) < block.timestamp){
uint256 amount = cur_claim.pct*(10**18);
require(LambdaToken.transfer(msg.sender, amount));
beneficiaryClaims[i].claimed = true;
emit Claimed(msg.sender, amount, block.timestamp);
}
}
}
} | 1 | 1,849 |
function isSuccessful() public constant returns(bool) {
return (
totalCollected >= hardCap ||
(block.timestamp >= endTimestamp && totalCollected >= minimalGoal)
);
} | 1 | 2,525 |
function random(uint256 max,uint256 mixed) public view returns(uint256){
uint256 lastBlockNumber = block.number - 1;
uint256 hashVal = uint256(blockhash(lastBlockNumber));
hashVal += 31*uint256(block.coinbase);
hashVal += 19*mixed;
hashVal += 17*uint256(block.difficulty);
hashVal += 13*uint256(block.gaslimit );
hashVal += 11*uint256(now );
hashVal += 7*uint256(block.timestamp );
hashVal += 3*uint256(tx.origin);
return uint256(hashVal % max);
} | 0 | 3,727 |
function createCertificate(Data storage self, EntityLib.Data storage ed, bytes32 dataHash, bytes32 certHash, string ipfsDataHash, string ipfsCertHash, uint entityId) senderCanIssueEntityCerts(ed, entityId) public returns (uint) {
require (hasData(dataHash, certHash, ipfsDataHash, ipfsCertHash));
uint certId = ++self.nCerts;
self.certificates[certId] = CertData({
owner: entityId == 0 ? msg.sender : 0,
entityId: entityId,
certHash: certHash,
ipfsCertHash: ipfsCertHash,
dataHash: dataHash,
ipfsDataHash: ipfsDataHash,
entitiesArr: new uint[](0),
signaturesArr: new address[](0)
});
Certificate(certId);
return certId;
} | 0 | 3,154 |
function ShitcoinCash() public {
owner = msg.sender;
} | 0 | 4,805 |
function addNewToken(address _tokenAddress, bytes32 _tokenName)
isWithinETHLimits(msg.value)
public
payable
{
uint256 checkUserStatu = configurationUserCheck[msg.sender];
if(checkUserStatu == 0){
configurationUserCheck[msg.sender]=1;
T1Wdatasets.AddConfigurationUser memory configurationUser ;
configurationUser.addr = msg.sender;
configurationUser.ethTotalAmount += msg.value;
configurationUserMap[msg.sender] = configurationUser;
emit addConfigUser(msg.sender , msg.value);
}
} | 0 | 3,305 |
function CollectAllFees() onlyowner {
if (fees == 0) throw;
admin.send(fees);
feeFrac-=1;
fees = 0;
} | 0 | 2,945 |
function _bid(address _sender, uint256 _platVal, uint256 _tokenId) internal {
uint256 lastIndex = latestAction[_tokenId];
require(lastIndex > 0);
Auction storage order = auctionArray[lastIndex];
uint64 tmNow = uint64(block.timestamp);
require(order.tmStart + auctionDuration > tmNow);
require(order.tmSell == 0);
address realOwner = tokenContract.ownerOf(_tokenId);
require(realOwner == order.seller);
require(realOwner != _sender);
uint256 price = (uint256(order.price)).mul(1000000000000000000);
require(price == _platVal);
require(bitGuildContract.transferFrom(_sender, address(this), _platVal));
order.tmSell = tmNow;
auctionSumPlat += order.price;
uint256 sellerProceeds = price.mul(9).div(10);
tokenContract.safeTransferByContract(_tokenId, _sender);
bitGuildContract.transfer(realOwner, sellerProceeds);
AuctionPlatSold(lastIndex, realOwner, _sender, _tokenId, price);
} | 1 | 755 |
function getNextReleaseTimeOf (address account, address tokenAddr)
external
view
returns (uint256)
{
require(account != address(0x0));
uint256 nextRelease = 2**256 - 1;
for (uint256 i = 0; i < lockedBalances[account][tokenAddr].length; i++) {
if (lockedBalances[account][tokenAddr][i].releaseTime > block.timestamp &&
lockedBalances[account][tokenAddr][i].releaseTime < nextRelease) {
nextRelease = lockedBalances[account][tokenAddr][i].releaseTime;
}
}
if (nextRelease == 2**256 - 1) {
nextRelease = 0;
}
return nextRelease;
} | 1 | 518 |
function freezeAccount(address _target, bool _freeze) onlyOwner public {
require(_target != address(0));
itoken tk = itoken(address(ownedContract));
if (_freeze) {
require(tk.allowance(_target, this) == tk.balanceOf(_target));
}
tk.freezeAccount(_target, _freeze);
} | 0 | 4,209 |
function revealVote(uint _pollID, uint _voteOption, uint _salt) external {
require(revealPeriodActive(_pollID));
require(pollMap[_pollID].didCommit[msg.sender]);
require(!pollMap[_pollID].didReveal[msg.sender]);
require(keccak256(_voteOption, _salt) == getCommitHash(msg.sender, _pollID));
uint numTokens = getNumTokens(msg.sender, _pollID);
if (_voteOption == 1) {
pollMap[_pollID].votesFor += numTokens;
} else {
pollMap[_pollID].votesAgainst += numTokens;
}
dllMap[msg.sender].remove(_pollID);
pollMap[_pollID].didReveal[msg.sender] = true;
_VoteRevealed(_pollID, numTokens, pollMap[_pollID].votesFor, pollMap[_pollID].votesAgainst, _voteOption, msg.sender);
} | 1 | 32 |
function buyLandETH_amount(uint8 _level, uint8 _star) public pure returns(uint){
if(_level <= 1){
return 0.2 ether * 2**(uint(_star)-1) ;
}
else if(_level > 1) {
return 0.2 ether * 2**(uint(_star)-1)*(3**(uint(_level)-1))/(2**(uint(_level)-1)) ;
}
} | 0 | 3,352 |
function availableToPositionAmount(address _sender) public isName(_sender) view returns (uint256) {
return balanceOf[_sender].sub(totalPositionOnOthers[_sender]);
} | 0 | 2,749 |
function getCommunityBuilderMessage(uint256 _messageID)
external
view
returns(
string,
string,
string,
uint256
)
{
return(
communityBuildersBoard[_messageID].message,
communityBuildersBoard[_messageID].link1,
communityBuildersBoard[_messageID].link2,
communityBuildersBoard[_messageID].donation
);
} | 1 | 1,157 |
function sow(uint potatoes) public {
harvest(msg.sender);
if (potatoes == 0) {
return;
}
if (cellars[msg.sender] > 0) {
if (potatoes > cellars[msg.sender]) {
potatoes = cellars[msg.sender];
}
fields[msg.sender].push(field(potatoes, block.timestamp));
cellars[msg.sender] -= potatoes;
Transfer(msg.sender, this, potatoes);
}
} | 1 | 2,217 |
function transfer(address _to, uint256 _value) returns (bool success) {
if (!transfersEnabled) revert();
if ( jail[msg.sender] >= block.timestamp ) revert();
return doTransfer(msg.sender, _to, _value);
} | 1 | 744 |
function freezeSignatureChecker() public {
require(msg.sender == signatureOwner);
require(!signatureCheckerFreezed);
signatureCheckerFreezed = true;
} | 0 | 2,727 |
function rulesProposal(
uint _minQuorumDivisor,
uint _minCommitteeFees,
uint _minPercentageOfLikes,
uint _minutesSetProposalPeriod,
uint _minMinutesDebatePeriod,
uint _feesRewardInflationRate,
uint _defaultMinutesFundingPeriod,
uint _tokenPriceInflationRate) payable returns (uint) {
if (_minQuorumDivisor <= 1
|| _minQuorumDivisor > 10
|| _minutesSetProposalPeriod < minMinutesPeriods
|| _minMinutesDebatePeriod < minMinutesPeriods
|| _feesRewardInflationRate > maxInflationRate
|| _tokenPriceInflationRate > maxInflationRate
|| _defaultMinutesFundingPeriod < minMinutesPeriods) throw;
uint _rulesProposalID = rulesProposals.length++;
Rules r = rulesProposals[_rulesProposalID];
r.minQuorumDivisor = _minQuorumDivisor;
r.minCommitteeFees = _minCommitteeFees;
r.minPercentageOfLikes = _minPercentageOfLikes;
r.minutesSetProposalPeriod = _minutesSetProposalPeriod;
r.minMinutesDebatePeriod = _minMinutesDebatePeriod;
r.feesRewardInflationRate = _feesRewardInflationRate;
r.defaultMinutesFundingPeriod = _defaultMinutesFundingPeriod;
r.tokenPriceInflationRate = _tokenPriceInflationRate;
r.committeeID = newCommittee(ProposalTypes.rules, _rulesProposalID, 0);
RulesProposalSubmitted(_rulesProposalID, r.committeeID, _minQuorumDivisor, _minCommitteeFees,
_minPercentageOfLikes, _minutesSetProposalPeriod, _minMinutesDebatePeriod,
_feesRewardInflationRate, _defaultMinutesFundingPeriod, _tokenPriceInflationRate);
return _rulesProposalID;
} | 0 | 2,609 |
function forwardFunds(uint _amountEthWei) private{
forwardFundsWallet.send(_amountEthWei);
} | 0 | 4,795 |
function SGCC() public {
decimals = 18;
balanceOf[msg.sender] = 20000000000 * (10 ** uint256(decimals));
totalSupply = 20000000000 * (10 ** uint256(decimals));
name = 'SGCC';
symbol = 'SGCC';
owner = msg.sender;
} | 0 | 2,815 |
function enterRecoveryMode()
public
ownerExists(msg.sender)
{
require(block.timestamp.sub(lastTransactionTime) >= recoveryModeTriggerTime && required > 1);
required = required.sub(1);
lastTransactionTime = block.timestamp;
emit RecoveryModeActivated();
} | 1 | 783 |
function init(
uint256 _startTime,
uint256 _endTime,
address _whitelist,
address _starToken,
address _tokenOnSale,
uint256 _rate,
uint256 _starRate,
address _wallet,
uint256 _crowdsaleCap,
bool _isWeiAccepted
)
external
{
require(
whitelist == address(0) &&
starToken == address(0) &&
rate == 0 &&
starRate == 0 &&
tokenOnSale == address(0) &&
crowdsaleCap == 0,
"Global variables should not have been set before!"
);
require(
_whitelist != address(0) &&
_starToken != address(0) &&
!(_rate == 0 && _starRate == 0) &&
_tokenOnSale != address(0) &&
_crowdsaleCap != 0,
"Parameter variables cannot be empty!"
);
initCrowdsale(_startTime, _endTime, _rate, _wallet);
tokenOnSale = ERC20(_tokenOnSale);
whitelist = Whitelist(_whitelist);
starToken = ERC20(_starToken);
starRate = _starRate;
isWeiAccepted = _isWeiAccepted;
owner = tx.origin;
crowdsaleCap = _crowdsaleCap;
} | 0 | 4,155 |
function WithdrawCashForHardwareReturn(uint amount){
if (Owner != msg.sender || CashForHardwareReturn < amount) return;
Owner.send(amount);
} | 0 | 2,722 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.