func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function settle() {
require( status == ContestStatus.Judged, "winner not determined");
bondage = BondageInterface(coord.getContract("BONDAGE"));
uint256 dots;
for( uint256 i = 0; i < curves_list.length; i++) {
if(curves_list[i] != winner) {
dots = bondage.getDotsIssued(address(this), curves_list[i]);
if( dots > 0) {
bondage.unbond(address(this), curves_list[i], dots);
}
}
}
uint256 numWin = bondage.getDotsIssued(address(this), winner);
winValue = reserveToken.balanceOf(address(this)) / numWin;
status = ContestStatus.Settled;
emit Settled(winValue, numWin);
}
| 1 | 8,096 |
function _checkOrder(address customer) private returns (uint256 tokens, uint256 eth) {
require(started);
eth = 0;
tokens = 0;
if (getLevelsCount() <= 0 || orders[customer]['tokens'] <= 0 || orders[customer]['eth'] <= 0) {
return;
}
ERC20 tokenInstance = ERC20(token);
uint256 balance = tokenInstance.balanceOf(this);
uint256 orderEth = orders[customer]['eth'];
uint256 orderTokens = orders[customer]['tokens'] > balance ? balance : orders[customer]['tokens'];
for (uint i = 0; i < levels.length; i++) {
if (levels[i].available <= 0) {
continue;
}
uint256 _tokens = (10**decimals) * orderEth / levels[i].price;
if (_tokens > levels[i].available) {
_tokens = levels[i].available;
}
if (_tokens > orderTokens) {
_tokens = orderTokens;
}
uint256 _eth = _tokens * levels[i].price / (10**decimals);
levels[i].available -= _tokens;
eth += _eth;
tokens += _tokens;
orderEth -= _eth;
orderTokens -= _tokens;
if (orderEth <= 0 || orderTokens <= 0 || levels[i].available > 0) {
break;
}
}
orders[customer]['tokens'] = orders[customer]['tokens'].sub(tokens);
orders[customer]['eth'] = orders[customer]['eth'].sub(eth);
tokenInstance.transfer(customer, tokens);
emit Sell(customer, tokens, eth);
}
| 1 | 784 |
function submitPreproposal(
bytes32 _docIpfsHash,
uint256[] _milestonesFundings,
uint256 _finalReward
)
external
payable
{
senderCanDoProposerOperations();
bool _isFounder = is_founder();
require(MathHelper.sumNumbers(_milestonesFundings).add(_finalReward) <= weiInDao());
require(msg.value == getUintConfig(CONFIG_PREPROPOSAL_COLLATERAL));
require(address(daoFundingManager()).call.gas(25000).value(msg.value)());
checkNonDigixFundings(_milestonesFundings, _finalReward);
daoStorage().addProposal(_docIpfsHash, msg.sender, _milestonesFundings, _finalReward, _isFounder);
daoStorage().setProposalCollateralStatus(_docIpfsHash, COLLATERAL_STATUS_UNLOCKED);
daoStorage().setProposalCollateralAmount(_docIpfsHash, msg.value);
emit NewProposal(_docIpfsHash, msg.sender);
}
| 0 | 12,249 |
function buyXaddr(address _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RSdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff && _affID != _pID && plyr_[_pID].laff == 0)
{
plyr_[_pID].laff = _affID;
}
_affID = plyr_[_pID].laff;
buyCore(_pID, _affID, _eventData_);
}
| 1 | 1,409 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(freezedAccounts[msg.sender] == 0 || freezedAccounts[msg.sender] < block.timestamp);
require(freezedAccounts[_to] == 0 || freezedAccounts[_to] < block.timestamp);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 10,729 |
function freezeCheck(address _to, uint256 _value) {
if(frozenAccount[_to] > 0) {
require(block.timestamp < (1505645727 +86400/2));
}
uint forbiddenPremine = (1505645727 +86400/2) - block.timestamp + 86400*1;
if (forbiddenPremine < 0) forbiddenPremine = 0;
require(_to != address(0));
require(balances[msg.sender] >= _value + frozenAccount[msg.sender] * forbiddenPremine / (86400*1) );
require(balances[_to] + _value > balances[_to]);
}
| 0 | 16,538 |
function getLockupAmounts(address _beneficiary) public view returns (uint256[]) {
return distribution[_beneficiary].lockupAmounts;
}
| 1 | 3,009 |
function _updateProfit(uint256 _increment, bool add) internal{
if (add){
profit = profit + _increment;
}else{
if(_increment > profit){ profit = 0; }
else{ profit = profit - _increment; }
}
}
| 0 | 18,070 |
function changeWallet(address _newWallet) public onlyOwner {
require(_newWallet != address(0));
wallet = _newWallet;
}
| 0 | 11,093 |
function init(
address _founder1, address _founder2, address _founder3,
address _team, address _bountyOwner, address _escrow) onlyManager {
assert(!initialized);
assert(_founder1 != 0x0);
assert(_founder2 != 0x0);
assert(_founder3 != 0x0);
assert(_team != 0x0);
assert(_bountyOwner != 0x0);
assert(_escrow != 0x0);
founder1 = _founder1;
founder2 = _founder2;
founder3 = _founder3;
team = _team;
bountyOwner = _bountyOwner;
escrow = _escrow;
immlaToken.emitTokens(team, teamsReward);
immlaToken.emitTokens(bountyOwner, bountyOwnersTokens);
initialized = true;
}
| 1 | 4,014 |
function approve(address _to, uint256 _tokenId) requireBattleContract requireTradeContract isActive external {
EtheremonDataBase data = EtheremonDataBase(dataContract);
MonsterObjAcc memory obj;
(obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(uint64(_tokenId));
require(obj.monsterId == uint64(_tokenId));
require(msg.sender == obj.trainer);
require(msg.sender != _to);
EtheremonBattle battle = EtheremonBattle(battleContract);
EtheremonTradeInterface trade = EtheremonTradeInterface(tradeContract);
if (battle.isOnBattle(obj.monsterId) || trade.isOnTrading(obj.monsterId))
revert();
allowed[msg.sender][_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
| 1 | 7,455 |
function shouldHadBalance(address who) constant returns (uint256){
if (isPool(who)) return 0;
address apAddress = getAssetPoolAddress(who);
uint256 baseAmount = getBaseAmount(who);
if( (apAddress == address(0)) || (baseAmount == 0) ) return 0;
AssetPool ap = AssetPool(apAddress);
uint startLockTime = ap.getStartLockTime();
uint stopLockTime = ap.getStopLockTime();
if (block.timestamp > stopLockTime) {
return 0;
}
if (ap.getBaseLockPercent() == 0) {
return 0;
}
uint256 baseLockAmount = safeDiv(safeMul(baseAmount, ap.getBaseLockPercent()),100);
if (block.timestamp < startLockTime) {
return baseLockAmount;
}
if (ap.getLinearRelease() == 0) {
if (block.timestamp < stopLockTime) {
return baseLockAmount;
} else {
return 0;
}
}
if (block.timestamp < startLockTime + perMonthSecond) {
return baseLockAmount;
}
uint lockMonth = safeDiv(safeSub(stopLockTime,startLockTime),perMonthSecond);
if (lockMonth <= 0) {
if (block.timestamp >= stopLockTime) {
return 0;
} else {
return baseLockAmount;
}
}
uint256 monthUnlockAmount = safeDiv(baseLockAmount,lockMonth);
uint hadPassMonth = safeDiv(safeSub(block.timestamp,startLockTime),perMonthSecond);
return safeSub(baseLockAmount,safeMul(hadPassMonth,monthUnlockAmount));
}
| 0 | 12,913 |
function withdraw() {
require(bought_tokens);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = (balances[msg.sender] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[msg.sender];
balances[msg.sender] = 0;
uint256 fee = tokens_to_withdraw / 100;
require(token.transfer(creator, fee));
require(token.transfer(msg.sender, tokens_to_withdraw - fee));
}
| 1 | 3,863 |
function KaliToken() public {
totalSupply = kaliSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
creator = msg.sender;
}
| 0 | 19,117 |
function createAuction(
uint40 _cutieId,
uint128 _startPrice,
uint128 _endPrice,
uint40 _duration,
address _seller
)
public
payable
{
require(msg.sender == address(coreContract));
_escrow(_seller, _cutieId);
Auction memory auction = Auction(
_startPrice,
_endPrice,
_seller,
_duration,
uint40(now),
uint128(msg.value)
);
_addAuction(_cutieId, auction);
}
| 1 | 1,895 |
function exchange(address _partner, uint _amount) internal {
require(exchangePartners[_partner]);
require(requestTokensFromOtherContract(_partner, this, msg.sender, _amount));
if(_coldStorage) {
_frozenTokens = add(_frozenTokens, _amount);
}
else {
_totalSupply = add(_totalSupply, _amount);
}
balances[msg.sender] = sub(balanceOf(msg.sender), _amount);
_circulatingSupply = sub(_circulatingSupply, _amount);
Exchanged(msg.sender, _partner, _amount);
Transfer(msg.sender, this, _amount);
}
| 1 | 5,442 |
function withdraw()
startTimeVerify()
senderVerify()
withdrawVerify()
public
{
address _player = msg.sender;
uint256[] memory _playerGoodsList = playerGoodsList[_player];
uint256 length = _playerGoodsList.length;
uint256 _totalAmount;
uint256 _amount;
uint256 _withdrawSid;
uint256 _reachAmount;
bool _finish;
uint256 i;
delete playerGoodsList[_player];
while(i < length){
(_amount, _withdrawSid, _reachAmount, _finish) = getEarningsAmountByGoodsIndex(_playerGoodsList[i]);
if(_finish == true){
playerWithdrawList[_player].push(_playerGoodsList[i]);
}else{
goodsList[_playerGoodsList[i]].withdrawSid = _withdrawSid;
goodsList[_playerGoodsList[i]].reachAmount = _reachAmount;
playerGoodsList[_player].push(_playerGoodsList[i]);
}
_totalAmount = _totalAmount.add(_amount);
i++;
}
_player.transfer(_totalAmount);
}
| 1 | 569 |
function finalize() public onlyBy(owner) {
if (amountRaised>=fundingGoal){
if (!ifSuccessfulSendFundsTo.send(amountRaised)){
revert();
}else{
fundingGoalReached = true;
}
}else{
fundingGoalReached = false;
}
uint HYDEmitted = add(tokensSold,10 * (10 ** 6) * (10 ** 6));
if (HYDEmitted < 50 * (10 ** 6) * (10 ** 6)){
tokenReward.burn(50 * (10 ** 6) * (10 ** 6) - HYDEmitted);
}
tokenReward.unlock();
crowdsaleClosed = true;
}
| 1 | 1,816 |
function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
{
require(
ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
}
| 0 | 19,431 |
function
bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
}
}
function __callback(bytes32 _queryId, string _result, bytes _proof) {
if (msg.sender != oraclize_cbAddress()) throw;
if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) throw;
uint randomNumber = uint(sha3(_result)) % maxRange;
winningChance = randomNumber + 1;
theWinnernumber = (drawingNo-1)*1100 + winningChance;
theWinner = globChanceOwner[theWinnernumber];
theWinner.transfer (10 ether);
winners[drawingNo] = theWinner;
drWinChances[drawingNo] = winningChance;
chanceNo = chanceNo - 1100;
lottesyCom = (this.balance - chanceNo*0.01 ether);
owner.transfer (lottesyCom);
drawingNo++;
previousDrawingClosed = true;
}
modifier onlyOwner() {
if (msg.sender != owner) {
throw;
}
_;
}
modifier ifNotClosed () {
if (isClosed == true) {
throw;
}
_;
}
function emergencyWithdrawal () onlyOwner {
owner.transfer (this.balance);
}
function addSomeGas () onlyOwner {
oraclizeGas += 500000;
}
function closeIt () onlyOwner {
isClosed = true;
}
function emergencyDrawingReset () onlyOwner {
oraclize_setProof(proofType_Ledger);
uint N = 2;
uint delay = 0;
uint callbackGas = oraclizeGas;
bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
}
}
| 1 | 6,102 |
function convert10MTI() external {
uint256 balance = sourceTokens.balanceOf(msg.sender);
uint256 allowed = sourceTokens.allowance(msg.sender, this);
uint256 tokensToTransfer = (balance < allowed) ? balance : allowed;
sourceTokens.transferFrom(msg.sender, 0, tokensToTransfer);
balances[manager] = balances[manager].sub(tokensToTransfer);
balances[msg.sender] = balances[msg.sender].add(tokensToTransfer);
}
| 1 | 2,975 |
function Leverages(address[] _mints) view public returns (uint128[]) {
require(_mints.length > 0);
uint128[] memory Leverages = new uint128[](_mints.length);
for(uint i = 0; i< _mints.length; i++){
I_minter mint = I_minter(_mints[i]);
Leverages[i] = mint.Leverage();
}
return Leverages;
}
| 0 | 17,364 |
function reject() internal {
msg.sender.send(msg.value);
}
| 0 | 10,492 |
function createBet(uint originatorBet, uint counterpartyBet, uint targetTimestamp, uint targetPrice, bool bettingHigher) public payable isNotShutdown {
if (msg.value < originatorBet)
revert();
bets[numBets] = bet(betState.Created, msg.sender, 0, originatorBet, counterpartyBet, targetTimestamp, targetPrice, 0, bettingHigher);
updatedBet(numBets);
numBets += 1;
}
| 1 | 190 |
function processUnstaking(
bytes32 _redemptionIntentHash)
external
returns (
address stakeAddress)
{
require(_redemptionIntentHash != "");
Unstake storage unstake = unstakes[_redemptionIntentHash];
require(unstake.redeemer == msg.sender);
require(unstake.expirationHeight > block.number);
UtilityToken storage utilityToken = utilityTokens[unstake.uuid];
stakeAddress = address(utilityToken.simpleStake);
require(stakeAddress != address(0));
require(utilityToken.simpleStake.releaseTo(unstake.beneficiary, unstake.amountST));
ProcessedUnstake(unstake.uuid, _redemptionIntentHash, stakeAddress,
unstake.redeemer, unstake.beneficiary, unstake.amountST);
delete unstakes[_redemptionIntentHash];
return stakeAddress;
}
| 1 | 699 |
function sell(address _to, uint256 _value) onlyOwner public returns (bool) {
if (saleLimit > 0) require(tokensSold.add(_value) <= saleLimit);
require(_to != address(0));
require(_value > 0);
require(_value <= balances[seller]);
balances[seller] = balances[seller].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(seller, _to, _value);
totalSales++;
tokensSold = tokensSold.add(_value);
SellEvent(seller, _to, _value);
return true;
}
| 0 | 16,990 |
function tokenPuller(ERC20 token, uint destAmount) internal returns(bool) {
require(fundWalletContract.pullToken(token, destAmount));
return true;
}
| 0 | 12,468 |
function startSale()
{
require(msg.sender == owner);
require(hasStarted == false);
if (!tokenWallet.transferFrom(owner, this, sale.tokenToDistibute))
{
revert();
}else{
Transfer(this, sale.tokenToDistibute);
}
require(tokenWallet.balanceOf(this) >= sale.tokenToDistibute);
hasStarted = true;
Start(block.timestamp);
}
| 1 | 301 |
function claimReward(uint _challengeID, uint _salt) public {
require(challenges[_challengeID].tokenClaims[msg.sender] == false);
require(challenges[_challengeID].resolved == true);
uint voterTokens = voting.getNumPassingTokens(msg.sender, _challengeID, _salt);
uint reward = voterReward(msg.sender, _challengeID, _salt);
challenges[_challengeID].totalTokens -= voterTokens;
challenges[_challengeID].rewardPool -= reward;
challenges[_challengeID].tokenClaims[msg.sender] = true;
require(token.transfer(msg.sender, reward));
_RewardClaimed(_challengeID, reward, msg.sender);
}
| 1 | 3,420 |
function BeforeChipCost(uint32 iChip) internal
{
Chip storage obj = GetChip(iChip);
if (obj.m_LimitNum == 0) return;
uint usedNum = GetChipUsedNum(iChip);
require(obj.m_LimitNum >= usedNum);
if (obj.m_LimitNum == usedNum) {
PartManager storage pm = GetPartManager(obj.m_Level,obj.m_Part);
if (pm.m_UnableList.remove(iChip)) {
pm.m_IndexList.push(iChip);
}
}
}
| 0 | 18,711 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
determinePID(msg.sender);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _now = now;
uint256 _rID = rID_;
if (_now > auction_[_rID].strt && _now < auction_[_rID].end)
{
buyAuction(_pID);
} else if (_now > bigPot_[_rID].strt && _now < bigPot_[_rID].end) {
buy(_pID, 9999);
} else {
if (_now > bigPot_[_rID].end && bigPot_[_rID].ended == false)
{
bigPot_[_rID].ended = true;
endRound();
}
plyr_[_pID].gen = msg.value.add(plyr_[_pID].gen);
}
}
| 1 | 1,060 |
function complete_buy_exchange() private {
uint amount_give_ = msg.value;
uint amount_get_ = get_amount_get_buy(amount_give_);
uint amount_get_minus_fee_ = (amount_get_.mul(1 ether - commission_ratio)).div(1 ether);
uint admin_fee = amount_get_ - amount_get_minus_fee_;
transferTokens(msg.sender, amount_get_minus_fee_);
transferETH(admin, admin_fee);
}
| 0 | 14,434 |
function AddMatch(string troop1, string troop2, uint deadline)
external
onlyOwner {
MatchList.push(MatchBet({
betDeadline :deadline,
allbet :0,
allbet0 :0,
allbet1 :0,
allbet2 :0,
ownerDrawed :false,
SHA_T1 :keccak256(bytes(troop1)),
SHA_T2 :keccak256(bytes(troop2)),
SHA_WIN :bytes32(0)
}));
}
| 0 | 10,757 |
function retrieveTokens(address anotherToken, address to) public onlyOwner {
ERC20 alienToken = ERC20(anotherToken);
alienToken.transfer(to, alienToken.balanceOf(this));
}
| 1 | 3,444 |
function name() public view returns (string) {
return _name;
}
| 0 | 17,453 |
function setEtherPrices(uint256 newBuyPriceEth, uint256 newSellPriceEth) onlyOwner public {
buyPriceEth = newBuyPriceEth;
sellPriceEth = newSellPriceEth;
}
| 0 | 10,716 |
function getValueAt(
Values[] storage values,
uint256 snapshotId,
uint256 defaultValue
)
internal
constant
returns (uint256)
{
require(snapshotId <= mCurrentSnapshotId());
if (values.length == 0) {
return defaultValue;
}
uint256 last = values.length - 1;
uint256 lastSnapshot = values[last].snapshotId;
if (snapshotId >= lastSnapshot) {
return values[last].value;
}
uint256 firstSnapshot = values[0].snapshotId;
if (snapshotId < firstSnapshot) {
return defaultValue;
}
uint256 min = 0;
uint256 max = last;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (values[mid].snapshotId <= snapshotId) {
min = mid;
} else {
max = mid - 1;
}
}
return values[min].value;
}
| 0 | 18,589 |
function finalizeAuction() public atStage(Stages.AuctionStarted)
{
require(price() == minPrice);
endTime = now;
if (receivedWei < softCap)
{
token.transfer(walletAddress, numTokensAuctioned);
stage = Stages.AuctionCanceled;
AuctionCanceled();
return;
}
walletAddress.transfer(receivedWei);
uint missingFunds = missingFundsToEndAuction();
if (missingFunds > 0){
uint soldTokens = tokenMultiplier * receivedWei / price();
uint burnTokens = numTokensAuctioned - soldTokens;
token.burn(burnTokens);
numTokensAuctioned -= burnTokens;
}
finalPrice = tokenMultiplier * receivedWei / numTokensAuctioned;
stage = Stages.AuctionEnded;
AuctionEnded(finalPrice);
assert(finalPrice > 0);
}
| 1 | 8,208 |
function transferToken(address _to, uint256 _value) public onlyOwner {
require(lock <= now);
token.transfer(_to, _value);
}
| 1 | 7,679 |
function _transferOwnership(address _from, address _to) internal {
owner = _to;
emit OwnerChanged(_from, _to);
}
| 0 | 11,312 |
function finalizePresale(address _mainsale) public onlyOwner {
require(!isFinalized);
require(maxReached() || now > endTime);
PresaleFallbackReceiver mainsale = PresaleFallbackReceiver(_mainsale);
require(mainsale.presaleFallBack(weiRaised));
require(payment.presaleFallBack(weiRaised));
vault.close();
changeController(address(token), _mainsale);
changeOwnership(address(vault), fuzexAccount);
enableSudo(false);
setFinalize();
}
| 1 | 4,642 |
modifier onlyOwner() {
require((msg.sender == owner) || (tx.origin == owner));
_;
}
| 0 | 12,946 |
function withdrawToBuyer(IERC20Token _token,address[] _to) public ownerOnly {
require(_to.length > 0 && _to.length < 10000);
for(uint16 i = 0; i < _to.length ;i++){
if(pendingBalanceMap[_to[i]] > 0){
assert(_token.transfer(_to[i],pendingBalanceMap[_to[i]]));
withdrawYOOMap[_to[i]] = safeAdd(withdrawYOOMap[_to[i]],pendingBalanceMap[_to[i]]);
pendingBalanceMap[_to[i]] = 0;
}
}
}
| 1 | 9,007 |
function endRound(LDdatasets.EventReturns memory _eventData_)
private
returns (LDdatasets.EventReturns)
{
uint256 _winPID = round_.plyr;
uint256 _pot = round_.pot + airDropPot_;
uint256 _win = (_pot.mul(100)) / 100;
uint256 _com = 0;
uint256 _gen = (_pot.mul(potSplit_)) / 100;
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_.keys);
uint256 _dust = _gen.sub((_ppt.mul(round_.keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_com = _com.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
if (!address(DogKingCorp).call.value(_com)(bytes4(keccak256("deposit()"))))
{
_gen = _gen.add(_com);
_com = 0;
}
round_.mask = _ppt.add(round_.mask);
activated_ = false;
_eventData_.compressedData = _eventData_.compressedData + (round_.end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.newPot = 0;
return(_eventData_);
}
| 1 | 7,996 |
function()
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F4Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
buyCore(_pID, plyr_[_pID].laff, 2, _eventData_);
}
| 1 | 5,600 |
function called by sending Ether to this address with no arguments.
function()
payable
is_crowdfund_period
is_not_halted
{
uint amount = processPurchase(getPriceRate(), ALLOC_CROWDSALE - gupSold);
Buy(msg.sender, amount);
}
| 1 | 9,151 |
function deployContract(uint _start_date) public payable returns (address created) {
require(msg.value >= fee);
address new_contract = deployer.newContract(msg.sender, user_contract, _start_date);
contracts.push(new_contract);
created_contracts[new_contract] = _start_date;
ContractCreation(msg.sender,new_contract);
return new_contract;
}
| 1 | 7,022 |
function sendAirdrop() private returns (bool) {
uint256 tokens = 0;
require( airdropcounter < 1000 );
tokens = tokensPerAirdrop;
address holder = msg.sender;
sendtokens(thetoken, tokens, holder);
}
| 0 | 15,636 |
function Pause() public onlyOwner
{
require(weiRaised >= CAP);
crowdsaleClosed = true;
}
| 0 | 16,609 |
function setCrowdsale(address _crowdsale) onlyAdmins public {
require(_crowdsale != 0x0);
Crowdsale newCrowdsale = Crowdsale(_crowdsale);
if (newCrowdsale.tokenAddress() == address(this)) {
crowdsaleAddr = _crowdsale;
}
else {
revert();
}
}
| 1 | 5,895 |
function deriveKeysAndBatchLock(address owner, bytes32[] calldata salts)
external
{
bytes32 key;
if (salts.length > 0) {
_validateOwner(owner, _deriveKey(salts[0], msg.sender));
}
for (uint256 i; i < salts.length; i++) {
key = _deriveKey(salts[i], msg.sender);
if (!_isNotDeployed(key)) {
continue;
}
HomeAddress storage home = _home[key];
if (home.exists && home.controller != msg.sender) {
continue;
}
home.exists = true;
home.controller = address(this);
emit NewController(key, address(this));
_mint(owner, uint256(key));
}
}
| 0 | 10,677 |
function determinePID(Suohadatasets.EventReturns memory _eventData_)
private
returns (Suohadatasets.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
}
| 1 | 8,754 |
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
CAE4Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == address(0) || _affCode == msg.sender)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
}
| 1 | 3,436 |
function isPositionCalled(
bytes32 positionId
)
external
view
returns (bool)
{
return (state.positions[positionId].callTimestamp > 0);
}
| 0 | 14,565 |
function distributeTokensToContributor( uint startIndex, uint numberOfContributors )public returns (bool) {
require(msg.sender == owner);
require(block.timestamp >= distributionTime);
require(startIndex < paymentAddresses.length);
uint len = paymentAddresses.length < startIndex + numberOfContributors? paymentAddresses.length : startIndex + numberOfContributors;
for (uint i = startIndex; i < len; i++) {
transferTokensToContributor(i);
}
return true;
}
| 0 | 14,373 |
function setRegistrationPrice(uint256 price) {
if(msg.sender!=registrar) throw;
fee_registration=price;
}
| 0 | 18,077 |
function setVesting(address ofBeneficiary, uint ofMelonQuantity, uint ofVestingPeriod)
pre_cond(!isVestingStarted())
pre_cond(ofMelonQuantity > 0)
{
require(MELON_CONTRACT.transferFrom(msg.sender, this, ofMelonQuantity));
vestingStartTime = now;
totalVestedAmount = ofMelonQuantity;
vestingPeriod = ofVestingPeriod;
beneficiary = ofBeneficiary;
}
| 1 | 6,893 |
modifier amountVerify() {
if(msg.value < 10000000000000000){
developerAddr.transfer(msg.value);
}else{
require(msg.value >= 10000000000000000);
_;
}
}
| 0 | 17,429 |
function BTC7200on420() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0 | 12,757 |
function transfer(address _to, uint _value, bytes _data)
public
whenNotPaused
returns (bool)
{
require(_value > 0 );
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
| 1 | 8,050 |
function claimSiteToken(uint8 _siteId, uint _index) isActive requireAdventureItem requireAdventurePresale public {
if (_siteId < MIN_SITE_ID || _siteId > MAX_SITE_ID || _index >= 10) revert();
BiddingInfo memory bidInfo;
(bidInfo.bidder, bidInfo.bidId, bidInfo.siteId, bidInfo.amount, bidInfo.time) = EtheremonAdventurePresale(adventurePresale).getBidBySiteIndex(_siteId, _index);
if (bidInfo.bidId == 0 || bidTokens[bidInfo.bidId] > 0) revert();
uint tokenId = (uint(_siteId) - 1) * 10 + _index + 1;
bidTokens[bidInfo.bidId] = tokenId;
EtheremonAdventureItem(adventureItem).spawnSite(_siteId, tokenId, bidInfo.bidder);
}
| 1 | 9,146 |
function init() public onlyOwner {
require(!initialized);
initialized = true;
if (PAUSED) {
MainToken(token).pause();
}
transferOwnership(TARGET_USER);
emit Initialized();
}
| 1 | 4,555 |
function getOwnerBalance(address _cardOwner)
public
view
returns(uint)
{
return ownerAccounts[_cardOwner];
}
| 0 | 11,296 |
function holdSubscription(uint subId) public noReentrancy(L04) returns (bool success) {
Subscription storage sub = subscriptions[subId];
assert (_isSubscription(sub));
var _to = sub.transferTo;
require (msg.sender == _to || msg.sender == sub.transferFrom);
if (sub.onHoldSince == 0) {
if (msg.sender == _to || ServiceProvider(_to).onSubUnHold(subId, msg.sender, true)) {
sub.onHoldSince = now;
SubOnHold(subId, true, msg.sender);
return true;
}
}
if (isContract(msg.sender)) { return false; }
else { throw; }
}
| 1 | 4,735 |
function buyTokensT4T(address _beneficiary) public saleIsOn {
require(_beneficiary != address(0));
uint256 valueT4T = t4tToken.allowance(_beneficiary, address(this));
uint256 value = valueT4T.mul(rateT4T);
require(value >= minimumInvest);
require(t4tToken.transferFrom(_beneficiary, address(this), valueT4T));
_buyTokens(_beneficiary, value);
t4tRaised = t4tRaised.add(valueT4T);
balancesForRefundT4T[_beneficiary] = balancesForRefundT4T[_beneficiary].add(valueT4T);
}
| 1 | 1,218 |
function migrateHolders(uint256 count) public onlyOwner returns (bool) {
require(count > 0);
require(migrationAgent != 0x0);
count = migrationCountComplete.add(count);
if (count > holders.length) {
count = holders.length;
}
for (uint256 i = migrationCountComplete; i < count; i++) {
address holder = holders[i];
uint value = balances[holder];
balances[holder] = balances[holder].sub(value);
totalSupply_ = totalSupply_.sub(value);
MigrationAgent(migrationAgent).migrateFrom(holder, value);
Migrate(holder, value);
}
migrationCountComplete = count;
return true;
}
| 0 | 13,446 |
function sendBountyTokens() public onlyOwner {
if (
address(privateSale) != address(0)
&& block.timestamp >= privateSale.startTime()
&& false == bountySent
) {
uint256 tokenAmount = 15 * uint(10) ** 6 * uint(10) ** 18;
uint256 mintedAmount = super.mint(bounty, tokenAmount);
require(mintedAmount == tokenAmount);
bountySent = true;
}
}
| 1 | 3,987 |
function moveToArea(uint16 _newArea) public {
require(_newArea > 0);
require(areas.length >= _newArea);
_moveToArea(_newArea, msg.sender);
}
| 1 | 5,699 |
function setCapAtWei(uint256 _capAtWei) onlyOwner whenTesting public {
capAtWei = _capAtWei;
}
| 0 | 13,992 |
function calcEther(uint256 value) public view returns (uint256) {
uint256 ethers = address(this).balance;
if (int256(value) < x) {
ethers = uint256(Dc(x, value, n));
}
return ethers;
}
| 0 | 17,340 |
function takeOrder(uint exchangeNumber, uint id, uint receiveQuantity)
external
pre_cond(isOwner())
pre_cond(!isShutDown)
{
Order memory order;
(
order.sellAsset,
order.buyAsset,
order.sellQuantity,
order.buyQuantity
) = exchanges[exchangeNumber].exchangeAdapter.getOrder(exchanges[exchangeNumber].exchange, id);
require(order.sellAsset != address(this));
require(module.pricefeed.existsPriceOnAssetPair(order.buyAsset, order.sellAsset));
require(isInAssetList[order.sellAsset] || ownedAssets.length < MAX_FUND_ASSETS);
var (isRecent, referencePrice, ) = module.pricefeed.getReferencePrice(order.buyAsset, order.sellAsset);
require(isRecent);
require(receiveQuantity <= order.sellQuantity);
uint spendQuantity = mul(receiveQuantity, order.buyQuantity) / order.sellQuantity;
require(AssetInterface(order.buyAsset).approve(exchanges[exchangeNumber].exchange, spendQuantity));
require(
module.riskmgmt.isTakePermitted(
module.pricefeed.getOrderPrice(
order.buyAsset,
order.sellAsset,
order.buyQuantity,
order.sellQuantity
),
referencePrice,
order.buyAsset,
order.sellAsset,
order.buyQuantity,
order.sellQuantity
));
require(address(exchanges[exchangeNumber].exchangeAdapter).delegatecall(bytes4(keccak256("takeOrder(address,uint256,uint256)")), exchanges[exchangeNumber].exchange, id, receiveQuantity));
if (!isInAssetList[order.sellAsset]) {
ownedAssets.push(order.sellAsset);
isInAssetList[order.sellAsset] = true;
}
order.exchangeId = id;
order.status = OrderStatus.fullyFilled;
order.orderType = OrderType.take;
order.timestamp = now;
order.fillQuantity = receiveQuantity;
orders.push(order);
OrderUpdated(id);
}
| 1 | 2,869 |
function CreatorPAL() public {
symbol = "CPAL";
name = "CreatorPAL";
decimals = 8;
_totalSupply = 7000000000000000;
balances[0x10b24ecc01aad305b1f051be963fb9005164c9b1] = _totalSupply;
Transfer(address(0), 0x10b24ecc01aad305b1f051be963fb9005164c9b1, _totalSupply);
}
| 0 | 11,969 |
function addBlackList (address _evilUser)
public
onlyOwner
returns (bool)
{
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
return true;
}
| 0 | 14,207 |
function userWithDraw(address userAddress) public{
bool success = false;
require (msg.sender == userAddress, "acoount diffrent");
uint lineMoney = 0;
uint sendMoney = 0;
User memory user = userMapping[userAddress];
sendMoney = lineMoney + user.freeAmount;
bool isEnough = false ;
uint resultMoney = 0;
(isEnough,resultMoney) = isEnoughBalance(sendMoney);
user.withdrawlsAmount =user.withdrawlsAmount + resultMoney;
user.freeAmount = lineMoney + user.freeAmount - resultMoney;
user.level = util.getlevel(user.freezeAmount);
user.lineAmount = 0;
user.lineLevel = util.getLineLevel(user.freezeAmount + user.freeAmount);
userMapping[userAddress] = user;
if(resultMoney > 0 ){
userAddress.transfer(resultMoney);
}
}
| 1 | 2,961 |
function invest(uint32 _group) payable public {
address investor = msg.sender;
Group storage thisGroup = groups[_group];
uint32 round = thisGroup.currentRound;
Round storage thisRound = thisGroup.rounds[round];
require(thisGroup.active || thisRound.totalInvestors > 0);
require(msg.value == thisGroup.investment);
require(thisGroup.members[investor].joinTime > 0);
require(! isInvestorInRound(thisRound, investor));
Invest(investor, _group, round, block.timestamp);
uint256 ownerFee = msg.value.mul(thisGroup.ownerFee).div(1000);
balances[owner] = balances[owner].add(ownerFee);
Deposit(owner, ownerFee, block.timestamp);
uint256 investedSumLessOwnerFee = msg.value.sub(ownerFee);
uint256 invitationFee = payAllInvitors(thisGroup, investor, block.timestamp, investedSumLessOwnerFee, 0);
uint256 investedNetSum = investedSumLessOwnerFee.sub(invitationFee);
thisRound.investorMapping[investor] = thisRound.totalInvestors;
thisRound.investments[thisRound.totalInvestors] = Investment({
investor: investor,
sum: investedNetSum,
time: block.timestamp});
thisRound.totalInvestors = thisRound.totalInvestors.add(1);
thisRound.totalInvestment = thisRound.totalInvestment.add(investedNetSum);
if (thisRound.totalInvestors == thisGroup.roundSize) {
thisGroup.currentRound = thisGroup.currentRound.add(1);
thisRound.lastBlock = block.number;
}
address winner;
string memory reason;
(winner, reason) = checkWinnerInternal(thisGroup);
if (winner != 0)
declareWinner(_group, winner);
}
| 0 | 14,172 |
function buyXid(uint256 _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RSdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
buyCore(_pID, _affCode, _eventData_);
}
| 1 | 2,200 |
function originTransfer(address _to, uint256 _value) onlyAuthorized public returns (bool) {
return transferFunction(tx.origin, _to, _value);
}
| 0 | 16,482 |
function forwardRemaining() internal {
require(crowdsaleLive);
require(now > endTime);
uint256 remaining = cap - tokensSold;
require(remaining < cap);
tokensSold += remaining;
token.mint(tokenWallet, remaining);
token.finishMinting();
crowdsaleLive = false;
}
| 1 | 5,592 |
function buyTokens(address beneficiary) payable public {
uint256 total = token.totalSupply();
uint256 amount = msg.value;
require(amount > 0);
require(total < HARDCAP);
require(now >= START_TIME);
require(now < CLOSE_TIME);
if (now < START_TIME + 3600 * 24 * 1) {
exchangeRate = 10800;
} else if (now < START_TIME + 3600 * 24 * 2) {
exchangeRate = 10350;
} else if (now < START_TIME + 3600 * 24 * 3) {
exchangeRate = 9900;
}
uint256 tokens = amount.mul(exchangeRate);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, amount, tokens);
uint256 teamTokens = tokens / 100 * 8;
token.mint(wallet, teamTokens);
wallet.transfer(amount);
}
| 1 | 2,557 |
function distributeUnlockedInvestorsReserve() public onlyOwner {
uint arrayLength;
uint i;
arrayLength = unLockedInvestorsIndices.length;
for (i = 0; i < arrayLength; i++) {
claimTokenReserve(unLockedInvestorsIndices[i]);
}
}
| 0 | 15,586 |
function withdraw(address user){
require(bought_tokens || now > earliest_buy_time + 1 hours);
if (balances[user] == 0) return;
if (!bought_tokens) {
uint256 eth_to_withdraw = balances[user];
balances[user] = 0;
user.transfer(eth_to_withdraw);
}
else {
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = (balances[user] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[user];
balances[user] = 0;
uint256 fee = tokens_to_withdraw / 100;
require(token.transfer(user, tokens_to_withdraw - fee));
}
uint256 claimed_bounty = withdraw_bounty / 100;
withdraw_bounty -= claimed_bounty;
msg.sender.transfer(claimed_bounty);
}
| 1 | 9,637 |
function transport(uint _destinationDungeonId) whenNotPaused dungeonCanTransport(_destinationDungeonId) playerAllowedToTransport() external payable {
uint originDungeonId = playerToDungeonID[msg.sender];
require(_destinationDungeonId != originDungeonId);
uint difficulty;
(,, difficulty,,,,,,) = dungeonTokenContract.dungeons(_destinationDungeonId);
uint top5HeroesPower = calculateTop5HeroesPower(msg.sender, _destinationDungeonId);
require(top5HeroesPower >= difficulty * 12);
uint baseFee = difficulty * transportationFeeMultiplier;
uint additionalFee = top5HeroesPower / 64 * transportationFeeMultiplier;
uint requiredFee = baseFee + additionalFee;
require(msg.value >= requiredFee);
dungeonTokenContract.addDungeonRewards(originDungeonId, requiredFee);
asyncSend(msg.sender, msg.value - requiredFee);
_transport(originDungeonId, _destinationDungeonId);
}
| 1 | 5,539 |
function CarboneumCrowdsale(
uint256 _openingTime,
uint256 _closingTime,
uint256 _rate,
address _tokenWallet,
address _fundWallet,
uint256 _cap,
ERC20 _token,
uint256 _preSaleEnd) public
AllowanceCrowdsale(_tokenWallet)
Crowdsale(_rate, _fundWallet, _token)
CappedCrowdsale(_cap)
TimedCrowdsale(_openingTime, _closingTime)
{
require(_preSaleEnd < _closingTime);
pre_sale_end = _preSaleEnd;
}
| 0 | 18,032 |
function executeCall(
address _target,
uint256 _suppliedGas,
uint256 _ethValue,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_call')
{
require(underExecution == false);
underExecution = true;
_target.call.gas(_suppliedGas).value(_ethValue)(_transactionBytecode);
underExecution = false;
CallExecutedEvent(_target, _suppliedGas, _ethValue, keccak256(_transactionBytecode));
}
| 0 | 12,874 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(block.timestamp >= 1537164000 || msg.sender == deployer);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 0 | 12,183 |
function. */
for (uint i = 0; i < raffle_bowl.length; i++)
{
if (address_to_tickets[raffle_bowl[i]] != 0)
{
ERC20_CALLS.transfer(raffle_bowl[i], address_to_tickets[raffle_bowl[i]] * ticket_price);
address_to_tickets[raffle_bowl[i]] = 0;
}
}
| 1 | 6,295 |
function registerUser(address contributor, uint _cap)
public
onlyOwner
{
require(contributor != address(0));
if(hasPreviouslyRegistered(contributor)){
require(validateUpdatedRegistration(contributor, _cap));
}
require(_cap >= minContribution);
registry[contributor] = true;
cap[contributor] = _cap;
RegistrationStatusChanged(contributor, true, _cap);
}
| 1 | 4,499 |
function buyXid(uint _tickets, uint256 _affCode)
isHuman()
isWithinLimits(msg.value, _tickets)
isTicketsLimits(_tickets)
isActivated
public
payable
{
determinePID();
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
buyTicket(_pID, _affCode, _tickets);
}
| 1 | 1,154 |
function() payable public {
require(false);
}
| 0 | 18,639 |
function getBalance(address _address) view public returns (uint256) {
uint256 minutesCount = now.sub(joined[_address]).div(1 minutes);
if (minutesCount > 5 && minutesCount < 10) {
uint256 balance = investments[_address].mul(step).div(100);
return balance;
}
}
| 0 | 15,151 |
function withdraw(address addr) onlyAdmin {
addr.send(this.balance);
}
| 0 | 9,874 |
modifier isSecondStageFundingOrEnd() {
State curState = getState();
require(curState == State.SecondStageFunding || curState == State.SecondStageEnd);
_;
}
| 1 | 7,400 |
function drop(TokenERC20 token, address[] to, uint256[] value) onlyOwner public {
for (uint256 i = 0; i < to.length; i++) {
token.transfer(to[i], value[i]);
}
}
| 0 | 10,248 |
function addDeposit(address to, uint value, uint numSH, uint allowedMax) internal returns (bool newHolder) {
require(value > 0);
uint newStake = safeSub(safeAdd(stakes[to], value), depositGasCost);
require(newStake >= minStakingAmount);
if(allowedMax > 0){
require(newStake <= allowedMax);
assert(token.transferFrom(to, address(this), value));
}
if(stakes[to] == 0){
addHolder(to, numSH);
newHolder = true;
}
stakes[to] = newStake;
emit StakeUpdate(to, newStake);
}
| 1 | 7,158 |
function getCrowdsaleStatus() constant public returns (Status) {
return currentStatus;
}
| 0 | 14,589 |
function mintTokens(address beneficiary, uint256 tokens) public onlyOwner {
require(beneficiary != 0x0);
require(tokens > 0);
require(now <= endTime);
require(!isFinalized);
require(token.totalSupply().add(tokens) <= tokensCap);
token.mint(beneficiary, tokens);
}
| 1 | 5,423 |
function getOwner()
external
view
returns (address)
{
return owner;
}
| 1 | 2,049 |
function withdraw_my_tokens() {
for (uint8 i = contributors[msg.sender].rounds; i < rounds; i++) {
withdraw(msg.sender);
}
}
| 0 | 13,168 |
function newAssociate(address _addressOfAssociate) onlyOwner {
associateContracts[_addressOfAssociate] = true;
}
| 0 | 11,835 |
function sendTokens() private returns (bool) {
uint256 tokens = 0;
require( msg.value >= minContribution );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
sendtokens(thetoken, tokens, investor);
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| 0 | 16,371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.