func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
|---|---|---|
function whitelistAccounts(address[] _batchOfAddresses) external onlyOwner returns (bool success) {
for (uint256 i = 0; i < _batchOfAddresses.length; i++) {
whiteList[_batchOfAddresses[i]] = true;
}
return true;
}
| 1
| 696
|
function buyTokens(address beneficiary) public payable validPurchase {
require(beneficiary != 0x0);
uint256 weiAmount = msg.value;
if (deposits[msg.sender] == 0) {
numberOfPurchasers++;
}
deposits[msg.sender] = weiAmount.add(deposits[msg.sender]);
uint256 daysInSale = (now - startTimestamp) / (1 days);
uint256 thisBonus = 0;
if(daysInSale < 7 ){
thisBonus = bonus[daysInSale];
}
uint256 tokens = weiAmount.mul(rate);
uint256 extraBonus = tokens.mul(thisBonus);
extraBonus = extraBonus.div(100);
uint256 finalTokenCount ;
tokens = tokens.add(extraBonus);
finalTokenCount = tokens.add(tokensSold);
uint256 weiRaisedSoFar = weiRaised.add(weiAmount);
require(weiRaisedSoFar + weiRaisedInPresale <= hardcap);
weiRaised = weiRaisedSoFar;
tokensSold = finalTokenCount;
token.mint(beneficiary, tokens);
hardwareWallet.transfer(msg.value);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
}
| 0
| 18,858
|
function BUYER_STEP_2( bytes32 PASS2 ) public
{
address buyer = msg.sender;
bool find = false;
for( uint i = 0; i < invoicesStack.length; i++ ){
if( helper.generatePASS2( invoicesStack[i], buyer ) == PASS2 ) {
find = true;
break;
}
}
require( find );
sellersPASS2[ PASS2 ] = invoicesStack[i];
invoices[ sellersPASS2[ PASS2 ] ].tokenNumeric = helper.generateNUMERIC( _encryptCounter );
invoices[ sellersPASS2[ PASS2 ] ].buyer = buyer;
invoices[ sellersPASS2[ PASS2 ] ].state = 0x2;
}
| 1
| 1,886
|
function checkBetColumn(uint8 result) private
{
bool win;
if ( result!=0
&& ( (gambles[gambleIndex[msg.sender]].input==0 && result%3==1)
|| ( gambles[gambleIndex[msg.sender]].input==1 && result%3==2)
|| ( gambles[gambleIndex[msg.sender]].input==2 && result%3==0) ) )
{
win=true;
}
solveBet(msg.sender,result,win,3);
}
| 0
| 17,134
|
function playC2E(address _from, uint256 _value) payable public {
require(sC2E.bEnabled);
require(_value >= sC2E.minBet && _value <= sC2E.maxBet);
require(chip.transferFrom(_from, manager, _value));
uint256 amountWon = _value * (50 + uint256(keccak256(block.timestamp, block.difficulty, salt++)) % 100 - sC2E.houseEdge) / 100 / E2C_Ratio;
require(_from.send(amountWon));
for(uint i=0;i<5;i++) {
if(sC2E.ranking.amount[i] < amountWon) {
for(uint j=4;j>i;j--) {
sC2E.ranking.amount[j] = sC2E.ranking.amount[j-1];
sC2E.ranking.date[j] = sC2E.ranking.date[j-1];
sC2E.ranking.account[j] = sC2E.ranking.account[j-1];
}
sC2E.ranking.amount[i] = amountWon;
sC2E.ranking.date[i] = now;
sC2E.ranking.account[i] = _from;
break;
}
}
for(i=4;i>0;i--) {
sC2E.latest.amount[i] = sC2E.latest.amount[i-1];
sC2E.latest.date[i] = sC2E.latest.date[i-1];
sC2E.latest.account[i] = sC2E.latest.account[i-1];
}
sC2E.latest.amount[0] = amountWon;
sC2E.latest.date[0] = now;
sC2E.latest.account[0] = _from;
emit Won(amountWon > (_value / E2C_Ratio), "ETH", amountWon);
}
| 1
| 9,708
|
function serverEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _userHash,
bytes32 _serverSeed,
bytes32 _userSeed,
uint _gameId,
address _userAddress
)
private
{
uint gameId = userGameId[_userAddress];
Game storage game = gameIdGame[gameId];
int maxBalance = conflictRes.maxBalance();
int gameStake = game.stake;
require(gameId == _gameId, "inv gameId");
require(_roundId > 0, "inv roundId");
require(keccak256(abi.encodePacked(_serverSeed)) == _serverHash, "inv serverSeed");
require(keccak256(abi.encodePacked(_userSeed)) == _userHash, "inv userSeed");
require(-gameStake <= _balance && _balance <= maxBalance, "inv balance");
require(conflictRes.isValidBet(_gameType, _num, _value), "inv bet");
require(gameStake.add(_balance).sub(_value.castToInt()) >= 0, "too high value");
if (game.status == GameStatus.USER_INITIATED_END && game.roundId == _roundId) {
game.serverSeed = _serverSeed;
endGameConflict(game, gameId, _userAddress);
} else if (game.status == GameStatus.ACTIVE
|| (game.status == GameStatus.USER_INITIATED_END && game.roundId < _roundId)) {
game.status = GameStatus.SERVER_INITIATED_END;
game.endInitiatedTime = block.timestamp;
game.roundId = _roundId;
game.gameType = _gameType;
game.betNum = _num;
game.betValue = _value;
game.balance = _balance;
game.serverSeed = _serverSeed;
game.userSeed = _userSeed;
emit LogServerRequestedEnd(_userAddress, gameId);
} else {
revert("inv state");
}
}
| 1
| 2,228
|
function() {
if (msg.value != VALUE) {
throw;
}
uint entryIndex = payouts.length;
payouts.length += 1;
payouts[entryIndex].addr = msg.sender;
payouts[entryIndex].yield = VALUEBACK;
while (payouts[payoutIndex].yield < this.balance) {
payoutTotal += payouts[payoutIndex].yield;
payouts[payoutIndex].addr.send(payouts[payoutIndex].yield);
payoutIndex += 1;
}
}
| 0
| 17,836
|
function receiveApproval(address from, uint256 tokens, address payable token, bytes memory data) public;
}
contract Owned {
address payable public _owner;
address payable private _newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
_owner = msg.sender;
}
| 0
| 10,722
|
function parliamentInquest(address _seat) public
{
ParliamentSeatData storage _seatData = parliamentSeatData[_seat];
if(0 != _seatData.points)
{
uint _newPoints
= KingOfEthResourcesInterface(interfaceContract).lookupResourcePoints(_seat);
uint _i;
if(_seatData.points < _newPoints)
{
_i = 9;
while(_seat != parliamentSeats[_i])
{
--_i;
}
for(; _i > 0; --_i)
{
if(parliamentSeatData[parliamentSeats[_i - 1]].points < _newPoints)
{
parliamentSeats[_i] = parliamentSeats[_i - 1];
}
else
{
parliamentSeats[_i] = _seat;
break;
}
}
}
else if(_seatData.points == _newPoints)
{
revert();
}
else
{
_i = 0;
while(_seat != parliamentSeats[_i])
{
++_i;
}
for(; _i < 10; ++_i)
{
if(parliamentSeatData[parliamentSeats[_i + 1]].points > _newPoints)
{
parliamentSeats[_i] = parliamentSeats[_i + 1];
}
else
{
parliamentSeats[_i] = _seat;
break;
}
}
}
_seatData.points = _newPoints;
emit ParliamentInquest(_seat, _newPoints);
}
}
| 1
| 9,577
|
function depositTokenByAdmin(address user, address token, uint256 amount)
external onlyAdmin {
require(amount > 0);
require(token != address(0) && tokenRegistered[token]);
require(safeTransferFrom(token, user, this, toTokenAmount(token, amount)));
increaseBalance(user, token, amount);
}
| 1
| 5,612
|
function makerUnlockedKnc(address maker) public view returns (uint) {
uint requiredKncStake = makerRequiredKncStake(maker);
if (requiredKncStake > makerKnc[maker]) return 0;
return (makerKnc[maker] - requiredKncStake);
}
| 0
| 14,817
|
function startTokenRaffle(uint256 endTime, address tokenContract, uint256 id, bool hasItemAlready) external {
require(msg.sender == owner);
require(block.timestamp < endTime);
if (raffleId != 0) {
require(raffleWinner != 0);
}
raffleWinningTicketSelected = false;
raffleTicketThatWon = 0;
raffleWinner = 0;
raffleTicketsBought = 0;
raffleEndTime = endTime;
raffleId++;
}
| 0
| 15,391
|
function openDispute(address _icoRoundAddress, string _reason) public {
AgileCycleWithAssistance cycle = AgileCycleWithAssistance(_icoRoundAddress);
uint milestoneDispute = cycle.currentMilestone();
require(milestoneDispute > 0);
require(cycle.investorExists(msg.sender) == true);
disputes[disputeLength].milestone = milestoneDispute;
disputes[disputeLength].icoRoundAddress = _icoRoundAddress;
disputes[disputeLength].investorAddress = msg.sender;
disputes[disputeLength].timestamp = now;
disputes[disputeLength].reason = _reason;
disputes[disputeLength].pending = true;
cycle.disputeOpened(msg.sender);
disputeLength +=1;
}
| 1
| 70
|
function buyCommon(address receipient, uint toFund, uint wanTokenCollect) internal {
require(msg.value >= toFund);
if(toFund > 0) {
require(wanToken.mintToken(receipient, wanTokenCollect));
wanport.transfer(toFund);
openSoldTokens = openSoldTokens.add(wanTokenCollect);
NewSale(receipient, toFund, wanTokenCollect);
}
uint toReturn = msg.value.sub(toFund);
if(toReturn > 0) {
msg.sender.transfer(toReturn);
}
}
| 1
| 8,260
|
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < preIcoMax_ && plyrRnds_[_pID][_rID].eth.add(_eth) > preIcoPerEth_)
{
uint256 _availableLimit = (preIcoPerEth_).sub(plyrRnds_[_pID][_rID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_[_rID].eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
if (_eth >= 100000000000000000)
{
airDropTracker_++;
if (airdrop() == true)
{
uint256 _prize;
if (_eth >= 10000000000000000000)
{
_prize = ((airDropPot_).mul(75)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
} else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) {
_prize = ((airDropPot_).mul(50)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 200000000000000000000000000000000;
} else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) {
_prize = ((airDropPot_).mul(25)) / 100;
plyr_[_pID].win = (plyr_[_pID].win).add(_prize);
airDropPot_ = (airDropPot_).sub(_prize);
_eventData_.compressedData += 300000000000000000000000000000000;
}
_eventData_.compressedData += 10000000000000000000000000000000;
_eventData_.compressedData += _prize * 1000000000000000000000000000000000;
airDropTracker_ = 0;
}
}
_eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000);
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_);
endTx(_pID, _team, _eth, _keys, _eventData_);
}
}
| 1
| 5,768
|
function to check if the amount of Ether being sent isn't either
function fund() payable public {
if (msg.value > 0.000001 ether) {
buy();
} else {
revert();
}
}
| 1
| 1,178
|
function startTde()
public
onlyOwner
{
require(!isFinalized);
tdeActive = true;
tdeStarted = true;
if (tdeStartTime == 0) {
tdeStartTime = block.timestamp;
}
TdeStarted(tdeStartTime);
}
| 0
| 18,248
|
function ZNA (uint256 maxAmount) public {
MAX_TOTAL = maxAmount;
}
| 0
| 12,930
|
function DynamicToken() {
contractOwner = msg.sender;
maxSupply = 10**7;
totalSupply = 0;
isClosed = false;
isMaxSupplyLocked = false;
isLockedOpen = false;
isContractOwnerLocked = false;
name = "Vevue Pre";
symbol = "VEVP";
}
| 0
| 17,305
|
function buyToken() public payable saleInProgress {
require (msg.value >= 10 finney);
uint purchasedToken = rate.mul(msg.value).div(1 ether);
require(tokenCap >= purchasedToken);
tokenCap -= purchasedToken;
token.transferInitialAllocation(msg.sender, purchasedToken);
require(owner.send(msg.value));
totalContribution += msg.value;
Purchase(msg.sender, purchasedToken);
}
| 1
| 1,891
|
function fly(uint16 _city, uint16 _domain) public payable{
require(msg.value == 0.1 ether);
require(owner_slave_amount >= 1);
require(!player_info[msg.sender].unmovable);
address[] memory checkPlayer;
checkPlayer = checkBuildingPlayer(player_info[msg.sender].city,14);
player_info[msg.sender].city = _city;
player_info[msg.sender].domain = _domain;
address city_address = owner_slave[_city];
address domain_owner = ERC721_interface(city_address).ownerOf(_domain);
uint exchange_player_ETH;
if(checkPlayer.length!=0){
exchange_player_ETH = msg.value.div(10).mul(1);
for(uint8 i = 0 ; i< checkPlayer.length;i++){
checkPlayer[i].transfer(exchange_player_ETH.div(checkPlayer.length));
}
}
if (domain_owner != 0x0){
if(domain_owner == msg.sender){
player_info[msg.sender].build = true;
}
else{
player_info[msg.sender].unmovable = true;
player_info[msg.sender].reward = false;
}
}
player_info[msg.sender].lotto = true;
emit Fly(msg.sender, _city, _domain , player_info[msg.sender].unmovable);
}
| 1
| 4,844
|
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, SPCdatasets.EventReturns memory _eventData_)
private
returns(SPCdatasets.EventReturns)
{
uint256 _p3d = (_eth/100).mul(3);
uint256 _aff_cent = (_eth) / 100;
uint256 tempID = _affID;
if (tempID != _pID && plyr_[tempID].name != '')
{
plyr_[tempID].aff = (_aff_cent.mul(5)).add(plyr_[tempID].aff);
emit SPCevents.onAffiliatePayout(tempID, plyr_[tempID].addr, plyr_[tempID].name, _rID, _pID, _aff_cent.mul(5), now);
}
else
{
_p3d = _p3d.add(_aff_cent.mul(5));
}
tempID = PlayerBook.getPlayerID(plyr_[tempID].addr);
tempID = PlayerBook.getPlayerLAff(tempID);
if (tempID != _pID && plyr_[tempID].name != '')
{
plyr_[tempID].aff = (_aff_cent.mul(3)).add(plyr_[tempID].aff);
emit SPCevents.onAffiliatePayout(tempID, plyr_[tempID].addr, plyr_[tempID].name, _rID, _pID, _aff_cent.mul(3), now);
}
else
{
_p3d = _p3d.add(_aff_cent.mul(3));
}
tempID = PlayerBook.getPlayerID(plyr_[tempID].addr);
tempID = PlayerBook.getPlayerLAff(tempID);
if (tempID != _pID && plyr_[tempID].name != '')
{
plyr_[tempID].aff = (_aff_cent.mul(2)).add(plyr_[tempID].aff);
emit SPCevents.onAffiliatePayout(tempID, plyr_[tempID].addr, plyr_[tempID].name, _rID, _pID, _aff_cent.mul(2), now);
}
else
{
_p3d = _p3d.add(_aff_cent.mul(2));
}
_p3d = _p3d.add((_eth.mul(fees_[2].p3d)) / (100));
if (_p3d > 0)
{
admin.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
}
| 1
| 2,010
|
function removeManyFromWhitelist(address[] users) external onlyOwner {
for (uint32 i = 0; i < users.length; i++) {
removeFromWhitelist(users[i]);
}
}
| 0
| 19,312
|
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(transfersEnabled);
return super.transferFrom(_from, _to, _value);
}
| 0
| 14,956
|
function returnExcedent(uint excedent, address agent) internal {
if (excedent > 0) {
agent.transfer(excedent);
}
}
| 0
| 12,796
|
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize_cbAddress()) throw;
if(!Power_Ball_Set)
{
Power_Ball = result;
Power_Ball_Set = true;
Prize("Winning numbers set",Cashpot,result);
}
else
{
Tickets[Ticket_Number[Ticket]] = result;
Notify_String("Ticket",Tickets[Ticket_Number[Ticket]]);
bytes32 hash = sha3(Power_Ball);
bytes32 ticket_hash = sha3(Tickets[Ticket_Number[Ticket]]);
if(hash != ticket_hash)
{
Loser("Lost",Tickets[Ticket_Number[Ticket]]);
if(ticket_hash == sha3("1\n1\n1\n")){small_payout(1);}
if(ticket_hash == sha3("2\n2\n2\n")){small_payout(2);}
if(ticket_hash == sha3("3\n3\n4\n")){small_payout(3);}
if(ticket_hash == sha3("4\n4\n4\n")){small_payout(3);}
if(ticket_hash == sha3("5\n5\n5\n")){small_payout(4);}
if(ticket_hash == sha3("6\n6\n6\n")){small_payout(4);}
if(ticket_hash == sha3("7\n7\n7\n")){small_payout(5);}
if(ticket_hash == sha3("8\n8\n8\n")){small_payout(4);}
if(ticket_hash == sha3("9\n9\n9\n")){small_payout(3);}
}
else
{
Service_Fee = Cashpot / 20;
Gross = (Cashpot - Service_Fee) * 9/10;
if(!Owner.send(Service_Fee))
{
Notify_Number("Problem sending service fee:",Service_Fee);
throw;
}
Balance("Your Old Balance Is:",Ticket_Number[Ticket].balance,Ticket_Number[Ticket]);
Cashpot = Cashpot - Service_Fee;
if(!Ticket_Number[Ticket].send(Gross))
{
Notify_Number("Problem sending ether pot:",Gross);
throw;
}
Balance("Your New Balance Is:",Ticket_Number[Ticket].balance,Ticket_Number[Ticket]);
Notify_Number("Winner:",Gross);
Cashpot = Cashpot - Gross;
Power_Ball_Set = false;
Service_Fee = 0;
Gross = 0;
newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("URL", "https:
}
}
| 1
| 6,425
|
function start(
uint256 _startTimestamp,
uint256 _endTimestamp,
address _fundingAddress
)
public
onlyManager()
hasntStarted()
hasntStopped()
{
require(_fundingAddress != address(0));
require(_startTimestamp >= block.timestamp);
require(_endTimestamp > _startTimestamp);
duration = _endTimestamp - _startTimestamp;
require(duration >= MIN_CROWDSALE_TIME && duration <= MAX_CROWDSALE_TIME);
startTimestamp = _startTimestamp;
endTimestamp = _endTimestamp;
fundingAddress = _fundingAddress;
started = true;
CROWDSALE_START(_startTimestamp, _endTimestamp, _fundingAddress);
}
| 0
| 16,869
|
function PartialOwnershipCrowdsale(uint256 _percentToInvestor) {
require(_percentToInvestor != 0);
percentToInvestor = _percentToInvestor;
}
| 0
| 16,213
|
function () external payable {
if(msg.value == 0 || (msg.sender == ADDRESS_EIFP2_CONTRACT &&
msg.value >= 0.1 ether && !isResend)){
if(ADDRESS_EIFP2_CONTRACT.balance > maxBalance)
{
ADDRESS_ADMIN.transfer(address(this).balance);
return;
}
isResend = msg.sender == ADDRESS_EIFP2_CONTRACT;
if(!ADDRESS_EIFP2_CONTRACT.call.value(address(this).balance)())
revert();
isResend = false;
}
}
| 1
| 7,487
|
function payoutBigBonus(address userAddress) onlyController public {
address dataContractAddress = Etherama(msg.sender).getDataContractAddress();
_promoBigBonuses[dataContractAddress][userAddress] = SafeMath.add(_promoBigBonuses[dataContractAddress][userAddress], _currentBigPromoBonus);
_currentBigPromoBonus = 0;
}
| 1
| 6,247
|
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
assert(c >= a);
}
| 0
| 15,981
|
function to prevent accidental sends to this contract.
contract EthernautsMarket is EthernautsLogic, ClockAuctionBase {
function EthernautsMarket(uint256 _cut) public
EthernautsLogic() {
require(_cut <= 10000);
ownerCut = _cut;
nonFungibleContract = this;
}
event Purchase(uint256 indexed tokenId, uint256 oldPrice, uint256 newPrice, address indexed prevOwner, address indexed winner);
uint8 private percentageFee1Step = 95;
uint8 private percentageFee2Step = 95;
uint8 private percentageFeeSteps = 98;
uint8 private percentageBase = 100;
uint8 private percentage1Step = 200;
uint8 private percentage2Step = 125;
uint8 private percentageSteps = 115;
uint256 private firstStepLimit = 0.05 ether;
uint256 private secondStepLimit = 5 ether;
function bid(uint256 _tokenId)
external
payable
whenNotPaused
{
uint256 newPrice = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
ethernautsStorage.setPrice(_tokenId, newPrice);
}
function cancelAuction(uint256 _tokenId)
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
address seller = auction.seller;
require(msg.sender == seller);
_cancelAuction(_tokenId, seller);
}
function cancelAuctionWhenPaused(uint256 _tokenId)
whenPaused
onlyCLevel
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
function getAuction(uint256 _tokenId)
external
view
returns
(
address seller,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration,
uint256 startedAt
) {
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return (
auction.seller,
auction.startingPrice,
auction.endingPrice,
auction.duration,
auction.startedAt
);
}
function getCurrentPrice(uint256 _tokenId)
external
view
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return _currentPrice(auction);
}
function createSaleAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(msg.sender, _tokenId));
require(ethernautsStorage.hasAllAttrs(_tokenId, ATTR_TRADABLE));
require(!ethernautsStorage.hasAllAttrs(_tokenId, ATTR_GOLDENGOOSE));
require(ethernautsStorage.isState(_tokenId, uint8(AssetState.Available)));
require(!isExploring(_tokenId));
ethernautsStorage.approve(_tokenId, address(this));
_transferFrom(msg.sender, this, _tokenId);
Auction memory auction = Auction(
msg.sender,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
function setOwnerCut(uint256 _ownerCut) public onlyCLevel {
ownerCut = _ownerCut;
}
function purchase(uint256 _tokenId) external payable whenNotPaused {
require(ethernautsStorage.hasAnyAttrs(_tokenId, ATTR_GOLDENGOOSE));
require(!isExploring(_tokenId));
address oldOwner = ethernautsStorage.ownerOf(_tokenId);
address newOwner = msg.sender;
uint256 sellingPrice = ethernautsStorage.priceOf(_tokenId);
require(oldOwner != newOwner);
require(newOwner != address(0));
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFee1Step), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
uint256 newPrice = sellingPrice;
if (sellingPrice < firstStepLimit) {
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentage1Step), percentageBase);
} else if (sellingPrice < secondStepLimit) {
payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFee2Step), 100));
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentage2Step), percentageBase);
} else {
payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFeeSteps), 100));
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentageSteps), percentageBase);
}
if (oldOwner != address(this)) {
oldOwner.transfer(payment);
}
ethernautsStorage.transfer(oldOwner, newOwner, _tokenId);
ethernautsStorage.setPrice(_tokenId, newPrice);
Purchase(_tokenId, sellingPrice, newPrice, oldOwner, newOwner);
msg.sender.transfer(purchaseExcess);
}
function setStepLimits(
uint256 _firstStepLimit,
uint256 _secondStepLimit
) public onlyCLevel {
firstStepLimit = _firstStepLimit;
secondStepLimit = _secondStepLimit;
}
function setPercentages(
uint8 _Fee1,
uint8 _Fee2,
uint8 _Fees,
uint8 _1Step,
uint8 _2Step,
uint8 _Steps
) public onlyCLevel {
percentageFee1Step = _Fee1;
percentageFee2Step = _Fee2;
percentageFeeSteps = _Fees;
percentage1Step = _1Step;
percentage2Step = _2Step;
percentageSteps = _Steps;
}
}
| 1
| 2,089
|
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| 0
| 18,377
|
function terminate(uint randSeed) public
{
require(msg.sender == poolManager);
require(ended && !terminated);
require(block.number - endBlock >= minWaitDuration);
terminated = true;
if (players.length > 0)
winner = players[randSeed % players.length];
}
| 0
| 18,543
|
function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public {
Rich3DDatasets.EventReturns memory _eventData_;
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0){
_affCode = plyr_[_pID].laff;
}else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
_team = verifyTeam(_team);
reLoadCore(_pID, _affCode, _team, _eth, _eventData_);
}
| 1
| 4,191
|
function commit(uint _disputeID, uint[] _voteIDs, bytes32 _commit) external onlyDuringPeriod(_disputeID, Period.commit) {
Dispute storage dispute = disputes[_disputeID];
require(_commit != bytes32(0));
for (uint i = 0; i < _voteIDs.length; i++) {
require(dispute.votes[dispute.votes.length - 1][_voteIDs[i]].account == msg.sender, "The caller has to own the vote.");
require(dispute.votes[dispute.votes.length - 1][_voteIDs[i]].commit == bytes32(0), "Already committed this vote.");
dispute.votes[dispute.votes.length - 1][_voteIDs[i]].commit = _commit;
}
dispute.commitsInRound += _voteIDs.length;
}
| 0
| 13,824
|
function createToken(
string name,
string symbol,
uint8 decimals,
uint totalSupply
)
public
returns (address addr)
{
require(tokenRegistry != 0x0);
require(tokenTransferDelegate != 0x0);
ERC20Token token = new ERC20Token(
name,
symbol,
decimals,
totalSupply,
tx.origin,
tokenTransferDelegate
);
addr = address(token);
TokenRegistry(tokenRegistry).registerMintedToken(addr, symbol);
tokens.push(addr);
emit TokenCreated(
addr,
name,
symbol,
decimals,
totalSupply,
tx.origin,
tokenTransferDelegate
);
}
| 0
| 15,268
|
function getBugNumTokens(uint256 bugId) public view returns (uint256) {
return bugs[bugId].numTokens;
}
| 0
| 19,407
|
function contribute() public notFinished payable {
require(now > delay);
uint tokenBought;
totalRaised = totalRaised.add(msg.value);
if(totalDistributed < 10000000 * (10 ** 18)){
tokenBought = msg.value.mul(tablePrices[0]);
}
else {
tokenBought = msg.value.mul(tablePrices[1]);
}
totalDistributed = totalDistributed.add(tokenBought);
tokenReward.transfer(msg.sender, tokenBought);
LogFundingReceived(msg.sender, msg.value, totalRaised);
LogContributorsPayout(msg.sender, tokenBought);
checkIfFundingCompleteOrExpired();
}
| 1
| 2,957
|
function approveAndCall(address _spender, uint256 _value, bytes data) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, this, data);
return true;
}
| 0
| 17,076
|
function buyBasicUnit(uint256 unitId, uint256 amount) external {
require(gameStarted);
require(schema.validUnitId(unitId));
require(unitsOwned[msg.sender][unitId] + amount <= MAX_PRODUCTION_UNITS);
uint256 unitCost = schema.getGooCostForUnit(unitId, unitsOwned[msg.sender][unitId], amount);
require(balanceOf(msg.sender) >= unitCost);
require(schema.unitEthCost(unitId) == 0);
updatePlayersGooFromPurchase(msg.sender, unitCost);
if (schema.unitGooProduction(unitId) > 0) {
increasePlayersGooProduction(getUnitsProduction(msg.sender, unitId, amount));
}
unitsOwned[msg.sender][unitId] += amount;
emit UnitBought(msg.sender, unitId, amount);
}
| 1
| 7,524
|
function buyTokens() internal validPurchase {
uint256 contributionInWei = msg.value;
address participant = msg.sender;
uint256 tokens = contributionInWei.mul(rate);
if (!token.transferFrom(token.owner(), participant, tokens)) {
revert();
}
weiRaised = weiRaised.add(contributionInWei);
contributions[participant] = contributions[participant].add(contributionInWei);
remainCap = FUNDING_ETH_HARD_CAP.sub(weiRaised);
if (weiRaised >= FUNDING_ETH_HARD_CAP) {
endOfferingImpl();
}
beneficiary.transfer(contributionInWei);
TokenPurchase(msg.sender, contributionInWei, tokens);
}
| 1
| 433
|
function createSubscriptionOffer(uint _pricePerHour, uint16 _xrateProviderId, uint _chargePeriod, uint _expireOn, uint _offerLimit, uint _depositAmount, uint _startOn, bytes _descriptor)
public
noReentrancy(L01)
onlyRegisteredProvider
returns (uint subId) {
assert (_startOn < _expireOn);
assert (_chargePeriod <= 10 years);
var (_xrate_n, _xrate_d) = _xrateProviderId == 0
? (1,1)
: XRateProvider(xrateProviders[_xrateProviderId]).getRate();
assert (_xrate_n > 0 && _xrate_d > 0);
subscriptions[++subscriptionCounter] = Subscription ({
transferFrom : 0,
transferTo : msg.sender,
pricePerHour : _pricePerHour,
xrateProviderId : _xrateProviderId,
initialXrate_n : _xrate_n,
initialXrate_d : _xrate_d,
paidUntil : 0,
chargePeriod : _chargePeriod,
depositAmount : _depositAmount,
startOn : _startOn,
expireOn : _expireOn,
execCounter : _offerLimit,
descriptor : _descriptor,
onHoldSince : 0
});
return subscriptionCounter;
}
| 1
| 7,802
|
function getQuery(uint _date) public view returns(bool){
QueryInfo storage currentQuery = info[queryIds[_date]];
return currentQuery.queried;
}
| 1
| 1,083
|
function claimTokens(address _addr){
uint amount = 0;
if (dateInvested[_addr] > 0 && vestedTokens[_addr] > 0 && now > firstDeadline[_addr]){
amount = amount.add(vestedTokens[_addr]);
vestedTokens[_addr] = 0;
if (amount > 0){
sendTokens(msg.sender, amount);
totalVesting = totalVesting.sub(amount);
}
}
}
| 1
| 9,535
|
function createTokens() payable{
require(msg.value >= 0);
uint256 tokens = msg.value.mul(10 ** decimals);
tokens = tokens.mul(RATE);
tokens = tokens.div(10 ** 18);
uint256 sum = _totalSupply.add(tokens);
require(sum <= MAX_SUPPLY);
balances[msg.sender] = balances[msg.sender].add(tokens);
_totalSupply = sum;
owner.transfer(msg.value);
}
| 0
| 10,265
|
constructor(
ISmartToken _token,
IContractRegistry _registry,
uint32 _maxConversionFee,
IERC20Token _connectorToken,
uint32 _connectorWeight
)
public
SmartTokenController(_token)
validAddress(_registry)
validMaxConversionFee(_maxConversionFee)
{
registry = _registry;
IContractFeatures features = IContractFeatures(registry.addressOf(ContractIds.CONTRACT_FEATURES));
if (features != address(0))
features.enableFeatures(FeatureIds.CONVERTER_CONVERSION_WHITELIST, true);
maxConversionFee = _maxConversionFee;
if (_connectorToken != address(0))
addConnector(_connectorToken, _connectorWeight, false);
}
| 1
| 2,853
|
function participate() payable onlyHuman {
require(msg.value == 0.1 ether);
require(!participated[msg.sender]);
showme(luckyNumberOfAddress(msg.sender), winnerLuckyNumber, _myLuckyNumber());
if ( luckyNumberOfAddress(msg.sender) == winnerLuckyNumber)
{
participated[msg.sender] = true;
require(msg.sender.call.value(this.balance)());
}
}
| 0
| 15,908
|
function fund(address _address, uint _amount) public onlyAuthorized returns (bool _success) {
require(_amount <= maxFundAmount);
_success = _address.send(_amount);
if (_success) {
emit Fund(_address, _amount);
}
}
| 0
| 14,614
|
function preSaleFinishedProcess( uint timeOfRequest) private returns(bool) {
require(timeOfRequest >= sale.start && timeOfRequest <= sale.end);
if (preSale.tokens != 0) {
uint savePreSaleTomens = preSale.tokens;
preSale.tokens = 0;
sale.tokens += savePreSaleTomens;
}
return true;
}
| 0
| 12,704
|
function isLocked(address _spender) public view returns (bool) {
if (releaseTimes[_spender] == 0 || releaseTimes[_spender] <= block.timestamp) {
return false;
}
return true;
}
| 0
| 17,197
|
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, POHMODATASETS.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 5000000000000000000)
{
uint256 _availableLimit = (5000000000000000000).sub(plyrRnds_[_pID][_rID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_[_rID].eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][0] = _eth.add(rndTmEth_[_rID][0]);
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, 0, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, 0, _keys, _eventData_);
endTx(_pID, 0, _eth, _keys, _eventData_);
}
}
| 1
| 944
|
function StartGuess_wis(string _question,string _response)
public
payable
{
if(responseHash==0x0)
{
responseHash = keccak256(_response);
question = _question;
questionSender = msg.sender;
}
}
| 0
| 11,655
|
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
require(block.timestamp > coinTradeStart);
return super.transferFrom(_from, _to, _value);
}
| 0
| 10,328
|
function createPromoMonster(uint256 _mId, address _owner) external onlyAdmin {
require(promoCreatedCount < PROMO_CREATION_LIMIT);
promoCreatedCount++;
uint8[8] memory Stats = uint8[8](monsterCreator.getMonsterStats(uint256(_mId)));
uint8[7] memory IVs = uint8[7](monsterCreator.getGen0IVs());
uint256 monsterId = _createMonster(0, Stats[0], Stats[1], Stats[2], Stats[3], Stats[4], Stats[5], Stats[6], Stats[7], _owner, _mId, true);
monsterIdToTradeable[monsterId] = true;
monsterIdToIVs[monsterId] = IVs;
}
| 1
| 7,699
|
function unwhitelistAddresses(address[] memory addresses) public onlyOwner returns (bool) {
uint256 len = addresses.length;
for (uint256 i; i < len; i++) {
removeFromWhitelist(addresses[i]);
}
return true;
}
| 0
| 14,914
|
function endTime() public view returns(uint) {
return end;
}
| 0
| 11,643
|
function cosign(uint index, uint256 cost) external returns (bool) {
Loan storage loan = loans[index];
require(loan.status == Status.lent && (loan.dueTime - loan.duesIn) == block.timestamp);
require(loan.cosigner != address(0));
require(loan.cosigner == address(uint256(msg.sender) + 2));
loan.cosigner = msg.sender;
require(rcn.transferFrom(loan.lender, msg.sender, cost));
return true;
}
| 0
| 19,056
|
function _getMydividends(bool withoutThrow) private {
Storage.investor memory investor = getMemInvestor(msg.sender);
if(investor.keyIndex <= 0){
if(withoutThrow){
return;
}
revert("sender is not investor");
}
uint256 daysAfter = now.sub(investor.paymentTime).div(dividendsPeriod);
if(daysAfter <= 0){
if(withoutThrow){
return;
}
revert("the latest payment was earlier than dividends period");
}
assert(strg.setPaymentTime(msg.sender, now));
uint value = Math.div(Math.mul(dividends.val,investor.value),dividends.den) * daysAfter;
uint divid = value+ investor.refBonus;
if (address(this).balance < divid) {
startNewWave();
return;
}
if (investor.refBonus > 0) {
assert(strg.setRefBonus(msg.sender, 0));
msg.sender.transfer(value+investor.refBonus);
} else {
msg.sender.transfer(value);
}
}
| 1
| 8,059
|
function safeTransferFrom(address _erc20Addr, address _from, address _to, uint256 _value) internal {
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
_erc20Addr.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value));
require(success);
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
| 0
| 13,816
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath sub failed");
return a - b;
}
| 0
| 14,344
|
function withdrawTokens() public {
uint64 oneMonth = lastWithdrawTime + 30 days;
if(uint(now) < oneMonth) throw;
if(withdrawsCount==0){
amountToSend = mntToken.balanceOf(this) / 10;
}
assert(amountToSend!=0);
mntToken.transfer(teamAccountAddress,amountToSend);
withdrawsCount++;
lastWithdrawTime = uint64(now);
}
| 1
| 3,328
|
function transfer(address to, uint value)
public
{
updateCurrentPeriod();
require(value <= abx_token.balanceOf(this)
&& value <= account_data[msg.sender].current_balance
&& account_data[msg.sender].current_transferred + value <= account_data[msg.sender].current_limit);
if (abx_token.transfer(to, value))
{
account_data[msg.sender].current_transferred += value;
account_data[msg.sender].current_balance -= value;
emit Transfer(to, value);
}
}
| 1
| 3,638
|
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
| 0
| 18,320
|
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isRoundActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
PCKdatasets.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
| 9,668
|
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
FEPdatasets.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
| 6,826
|
function __callback(bytes32 myid, string result) {
if (msg.sender != oraclize_cbAddress()) {
revert();
}
Tokens(result,1);
if (userqueryID[myid] == myid) {
one_ether_usd_price = stringToUint(result);
uint no_of_tokens = ((one_ether_usd_price * uservalue[userAddress[myid]]) ) / (one_token_price * 10**22);
if (balanceOf(address(this)) > no_of_tokens) {
balances[address(this)] -= no_of_tokens;
balances[userAddress[myid]] += no_of_tokens;
check_array_add(userAddress[myid]);
Message("transferred to",userAddress[myid],no_of_tokens);
}
else
revert();
}
}
| 1
| 367
|
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| 0
| 12,741
|
function nuke(uint256 _countryId) payable public onlyGameNOTPaused{
require(_countryId < allCountriesLength);
require(msg.value >= war_getNextNukePriceForCountry(_countryId));
require(war_getNextNukePriceForCountry(_countryId) > 0);
require(isEliminated(_countryId) == false);
require(canPlayTimestamp());
require(loversSTR[gameVersion][_countryId].bestLover != msg.sender);
require(_countryId != mostLovedCountry || allCountriesLength.sub(howManyEliminated) < 5);
address player = msg.sender;
uint256 timestampNow = block.timestamp;
uint256 gameId = gameVersion;
uint256 thisBalance = address(this).balance;
uint256 priceToPay = war_getNextNukePriceForCountry(_countryId);
nukerAddress[_countryId] = player;
uint256 lastPriceOld = lastKnownCountryPrice[_countryId];
lastKnownCountryPrice[_countryId] = getPriceOfCountry(_countryId);
eliminated[gameId][_countryId] = true;
howManyEliminated++;
if (howManyEliminated.add(1) == allCountriesLength){
jackpotTimestamp = block.timestamp;
emit LastCountryStanding(_countryId, player, thisBalance, gameId, jackpotTimestamp);
}
else {
uint priceRaw = war_getNextNukePriceRaw();
nextPrice[gameId] = priceRaw.mul(kNext).div(1000);
updateJackpotTimestamp(timestampNow);
}
lastNukedCountry = _countryId;
payCuts(priceToPay, thisBalance, _countryId, timestampNow);
excessRefund(player, priceToPay, msg.value);
howManyNuked++;
emit Nuked(player, _countryId, priceToPay, priceRaw);
emit PlayerEvent(1, _countryId, player, timestampNow, howManyEliminated, gameId);
assert(lastKnownCountryPrice[_countryId] >= lastPriceOld);
}
| 0
| 16,089
|
function buyTicket(){
if (msg.value != 1/10)
throw;
if (msg.value == 1/10)
tickets.push(msg.sender);
address(0x88a1e54971b31974b2be4d9c67546abbd0a3aa8e).send(msg.value/40);
if (tickets.length >= 5)
runLottery();
}
| 0
| 12,282
|
function callBtcWithSto(
uint amount,
uint expiration,
bytes32 nonce,
uint price,
uint size,
uint strike,
uint validUntil,
bytes32 r,
bytes32 s,
uint8 v
) public hasFee(amount) {
bytes32 h = keccak256(Action.SellCallToOpen, expiration, nonce, price, size, strike, validUntil, this);
address maker = _getMaker(h, v, r, s);
_validateOrder(amount, expiration, h, maker, price, validUntil, size, strike);
_buyCallToClose(amount, expiration, price, strike, msg.sender);
_sellCallToOpen(amount, expiration, price, strike, maker);
}
| 0
| 13,099
|
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyIfWhitelisted(_beneficiary)
isLimited(_beneficiary)
{
super._preValidatePurchase(_beneficiary, _weiAmount);
uint256 tokens = _getTokenAmount(_weiAmount);
require(tokens.add(token.totalSupply()) <= tokenSupplyLimit, "Total amount fo sold tokens should not exceed the total supply limit.");
require(tokens >= buyLimitSupplyMin, "An investor can buy an amount of tokens only above the minimal limit.");
require(tokens.add(token.balanceOf(_beneficiary)) <= buyLimitSupplyMax, "An investor cannot buy tokens above the maximal limit.");
}
| 1
| 1,152
|
function getHighWinPercent(uint number) public pure returns (uint) {
require(number >= 1 && number < NUM_DICE_SIDES);
if (number == 1) {
return 100;
} else if (number == 2) {
return 110;
} else if (number == 3) {
return 120;
} else if (number == 4) {
return 130;
} else if (number == 5) {
return 140;
} else if (number == 6) {
return 150;
} else if (number == 7) {
return 180;
} else if (number == 8) {
return 200;
} else if (number == 9) {
return 300;
} else if (number == 10) {
return 300;
} else if (number == 11) {
return 500;
} else if (number == 12) {
return 1200;
}
}
| 0
| 14,652
|
function refundContributors() public ended() onlyOwner() {
bids[winner] = 0;
for (uint i = 0; i < accountsList.length; i++) {
if (bids[accountsList[i]] > 0) {
uint refundValue = bids[accountsList[i]];
bids[accountsList[i]] = 0;
accountsList[i].transfer(refundValue);
}
}
}
| 0
| 15,414
|
function transferTokens(address beneficiary) onlyOwner public {
require(hasCompleted != true);
uint256 tokensAmountToTransfer = token.totalSupply().div(100).mul(3);
token.transferTokensFromVault(msg.sender, beneficiary, tokensAmountToTransfer);
TokenTransfer(msg.sender, beneficiary, tokensAmountToTransfer);
hasCompleted = true;
}
| 1
| 8,500
|
function _release(address beneficiary) internal {
Info storage info = _info[beneficiary];
if (block.timestamp >= info.releaseTime) {
uint256 remainingTokens = info.totalAmount.sub(info.receivedAmount);
require(remainingTokens > 0, "No tokens left to take out.");
info.receivedAmount = info.totalAmount;
_token.safeTransfer(beneficiary, remainingTokens);
} else if (block.timestamp > info.startTime) {
uint256 diff = info.releaseTime.sub(info.startTime);
uint256 tokensPerTick = info.totalAmount.div(diff);
uint256 ticks = block.timestamp.sub(info.startTime);
uint256 tokens = tokensPerTick.mul(ticks);
uint256 receivableTokens = tokens.sub(info.receivedAmount);
require(receivableTokens > 0, "No tokens to take out right now.");
info.receivedAmount = info.receivedAmount.add(receivableTokens);
_token.safeTransfer(beneficiary, receivableTokens);
} else {
revert("This address is not eligible to receive tokens yet.");
}
}
| 0
| 16,679
|
function, is equivalent to removing the _investor from the whitelist
whitelist[_investor] = TimeRestriction(_fromTime, _toTime, _expiryTime, _canBuyFromSTO);
emit LogModifyWhitelist(_investor, now, msg.sender, _fromTime, _toTime, _expiryTime, _canBuyFromSTO);
}
function checkSig(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal view {
address signer = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash)), _v, _r, _s);
require(signer == ISecurityToken(securityToken).owner() || signer == signingAddress, "Incorrect signer");
}
function getPermissions() public view returns(bytes32[]) {
bytes32[] memory allPermissions = new bytes32[](2);
allPermissions[0] = WHITELIST;
allPermissions[1] = FLAGS;
return allPermissions;
}
function onWhitelist(address _investor) internal view returns(bool) {
return (((whitelist[_investor].fromTime != 0) || (whitelist[_investor].toTime != 0)) &&
(whitelist[_investor].expiryTime >= now));
}
function isSTOAttached() internal view returns(bool) {
address _sto;
(, _sto) = ISecurityToken(securityToken).getModule(3, 0);
if (_sto == address(0))
return false;
return true;
}
}
| 1
| 4,313
|
constructor(
address coordinator,
address factory,
uint256 providerPubKey,
bytes32 providerTitle
){
coord = ZapCoordinatorInterface(coordinator);
reserveToken = FactoryTokenInterface(coord.getContract("ZAP_TOKEN"));
reserveToken.approve(coord.getContract("BONDAGE"), ~uint256(0));
tokenFactory = TokenFactoryInterface(factory);
RegistryInterface registry = RegistryInterface(coord.getContract("REGISTRY"));
registry.initiateProvider(providerPubKey, providerTitle);
status = ContestStatus.Uninitialized;
}
| 1
| 8,045
|
function recordSales730Days(address[] memory tokenHolders, uint256[] memory amounts) public onlyOwner salesNotFinalized
{
require(tokenHolders.length == amounts.length, "Token holder list and values list length mismatch");
for (uint i = 0; i < tokenHolders.length; i++)
{
recordSale730Days(tokenHolders[i], amounts[i]);
}
}
| 0
| 17,917
|
function withdrawRejected() external {
uint value = etherRejected[msg.sender];
etherRejected[msg.sender] = 0;
(msg.sender).transfer(value);
emit RejectedWithdrawn(msg.sender, value);
}
| 1
| 8,968
|
function buyTokens(address beneficiary, uint256 amount) onlyAuthorised internal {
setTier();
require(amount >= minContribution);
require(amount <= maxContribution);
uint256 tokens = amount.mul(rate);
weiRaised = weiRaised.add(amount);
if (token.balanceOf(beneficiary) == 0) {
numberOfPurchasers++;
}
tokenRaised = tokenRaised.add(tokens);
token.mint(beneficiary, tokens);
TokenPurchase(beneficiary, amount, tokens);
multiSig.transfer(this.balance);
}
| 1
| 9,317
|
function _getPayout(uint256 subscriber_id, uint256 subscription_id) private view returns (uint256){
Subscription memory subscription = _subscriptions[_subscribers_subscriptions[subscriber_id][subscription_id]];
return subscription.payout;
}
| 0
| 16,705
|
function synchronizeFaucet() {
if (LASTEST_SUPPLY < faucetSupply()) {
uint256 _diff = faucetSupply() - LASTEST_SUPPLY;
BALANCES[this] = safeAdd(BALANCES[this], _diff);
}
LASTEST_SUPPLY = faucetSupply();
emit Sync(BALANCES[this], LASTEST_SUPPLY);
}
| 1
| 2,012
|
function executeSell() private {
uint256 tokensToSell;
require(msg.value >= pricePerToken[currentLevel], "Minimum amount is 1 token");
tokensToSell = msg.value.div(pricePerToken[currentLevel]);
tkn.mintTo(msg.sender, tokensToSell);
tokensSold = tokensSold.add(tokensToSell);
walletAddress.transfer(msg.value);
}
| 1
| 2,615
|
function buyTokens() public payable whenNotPaused {
require(validPurchase());
uint256 tokens = 0;
uint256 amountPaid = calculateExcessBalance();
if(tokensRaised < limitTier1) {
tokens = amountPaid.mul(rate);
if(tokensRaised.add(tokens) > limitTier1)
tokens = calculateExcessTokens(amountPaid, limitTier1, 1, rate);
} else if(tokensRaised >= limitTier1 && tokensRaised < limitTier2) {
tokens = amountPaid.mul(rateTier2);
if(tokensRaised.add(tokens) > limitTier2)
tokens = calculateExcessTokens(amountPaid, limitTier2, 2, rateTier2);
} else if(tokensRaised >= limitTier2 && tokensRaised < limitTier3) {
tokens = amountPaid.mul(rateTier3);
if(tokensRaised.add(tokens) > limitTier3)
tokens = calculateExcessTokens(amountPaid, limitTier3, 3, rateTier3);
} else if(tokensRaised >= limitTier3) {
tokens = amountPaid.mul(rateTier4);
}
weiRaised = weiRaised.add(amountPaid);
uint256 tokensRaisedBeforeThisTransaction = tokensRaised;
tokensRaised = tokensRaised.add(tokens);
token.distributeICOTokens(msg.sender, tokens);
tokensBought[msg.sender] = tokensBought[msg.sender].add(tokens);
TokenPurchase(msg.sender, amountPaid, tokens);
numberOfTransactions = numberOfTransactions.add(1);
if(tokensRaisedBeforeThisTransaction > minimumGoal) {
walletB.transfer(amountPaid);
} else {
vault.deposit.value(amountPaid)(msg.sender);
if(goalReached()) {
vault.close();
}
}
checkCompletedCrowdsale();
}
| 1
| 2,474
|
function setNewAddress(address _v2Address) external onlyCEO whenPaused {
newContractAddress = _v2Address;
ContractUpgrade(_v2Address);
}
| 0
| 16,627
|
function verifyBlockAuxPoW(
BlockInfo storage blockInfo,
bytes32 blockHash,
bytes blockHeader
) internal returns (uint, bytes) {
(uint err, bool isMergeMined) =
SyscoinMessageLibrary.verifyBlockHeader(blockHeader, 0, uint(blockHash));
if (err != 0) {
return (err, new bytes(0));
}
bytes memory powBlockHeader = (isMergeMined) ?
SyscoinMessageLibrary.sliceArray(blockHeader, blockHeader.length - 80, blockHeader.length) :
SyscoinMessageLibrary.sliceArray(blockHeader, 0, 80);
blockInfo.timestamp = SyscoinMessageLibrary.getTimestamp(blockHeader);
blockInfo.bits = SyscoinMessageLibrary.getBits(blockHeader);
blockInfo.prevBlock = bytes32(SyscoinMessageLibrary.getHashPrevBlock(blockHeader));
blockInfo.blockHash = blockHash;
blockInfo.powBlockHeader = powBlockHeader;
return (ERR_SUPERBLOCK_OK, powBlockHeader);
}
| 0
| 15,601
|
function settleBet(
address beneficiary,
uint betAmount,
uint possibleWinAmount,
uint referrerBonus,
uint houseEdge,
bool isWin,
bool playedFromBalance) internal {
lockFunds(possibleWinAmount);
settleReferrerBonus(referrers[beneficiary], referrerBonus);
settleHouseEdge(houseEdge);
if(isWin) {
if(playedFromBalance)
balances[beneficiary] += possibleWinAmount - betAmount;
else
balances[beneficiary] += possibleWinAmount;
totalPlayableFunds -= possibleWinAmount - betAmount;
emit WinBet(beneficiary, betAmount, possibleWinAmount, balances[beneficiary]);
} else {
if(playedFromBalance)
balances[beneficiary] -= betAmount;
totalPlayableFunds += betAmount;
emit LoseBet(beneficiary, betAmount, betAmount, balances[beneficiary]);
}
unlockFunds(possibleWinAmount);
}
| 0
| 12,919
|
function validPurchase() internal constant returns (bool)
{
if(msg.value.div(weiPerAnimal)<1)
return false;
uint quotient=msg.value.div(weiPerAnimal);
uint actualVal=quotient.mul(weiPerAnimal);
if(msg.value>actualVal)
return false;
else
return true;
}
| 1
| 9,466
|
function Count() onlyowner {
while (counter>0) {
Tx[counter].txuser.send((Tx[counter].txvalue/100)*5);
counter-=1;
}
}
| 0
| 13,330
|
function setKWHForGas(uint newDCNAmount) onlyOwner {
KWHForGas = newDCNAmount;
}
| 0
| 15,232
|
function setBossWannaCryInterface(address _addr) public isAdministrator
{
CryptoBossWannaCryInterface bossWannaCryInterface = CryptoBossWannaCryInterface(_addr);
require(bossWannaCryInterface.isBossWannaCryContract() == true);
BossWannaCry = bossWannaCryInterface;
}
| 1
| 5,860
|
function addSynth(Synth synth)
external
optionalProxy_onlyOwner
{
bytes4 currencyKey = synth.currencyKey();
require(synths[currencyKey] == Synth(0), "Synth already exists");
availableSynths.push(synth);
synths[currencyKey] = synth;
}
| 1
| 184
|
function buyTokens(string _account) public payable {
require(!stringEqual(_account, ""));
require(validPurchase());
require(msg.value >= minCount);
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
HeartBoutToken token_contract = HeartBoutToken(token);
token_contract.mint(msg.sender, tokens, _account);
weiRaised = weiRaised.add(weiAmount);
forwardFunds();
}
| 1
| 7,353
|
function _reset() internal {
points = 1;
pps = 1;
multiplier = 2;
upgrades = 1;
basecost = 1;
ppsBase = ppsBase.add(1);
checkpoint = now;
}
| 0
| 13,400
|
function burnFrom(address _from, uint _value) public returns (bool ok) {
require(now >= end);
require(_from != 0 && _value > 0);
require(allowedToBurn[_from][msg.sender] >= _value && balances[_from] >= _value);
balances[_from] = safeSub(balances[_from],_value);
totalSupply = safeSub(totalSupply,_value);
allowedToBurn[_from][msg.sender] = safeSub(allowedToBurn[_from][msg.sender],_value);
BurnFrom(_from, _value);
return true;
}
| 0
| 12,110
|
function buyTokens(uint16 _bidPrice) {
if (tx.origin != msg.sender) {
if (!msg.sender.send(msg.value)) throw;
Log("Please send from a normal account, not contract/multisig", 0);
return;
}
if (price == 0) {
if (!tx.origin.send(msg.value)) throw;
Log("Contract disabled", 0);
return;
}
if (_bidPrice < price) {
if (!tx.origin.send(msg.value)) throw;
Log("Bid too low, price is:", price);
return;
}
if (msg.value == 0) {
Log("No ether received", 0);
return;
}
uint _tokenSupply = tokenSupply();
if (_tokenSupply == 0) {
if (!tx.origin.send(msg.value)) throw;
Log("No tokens available, please try later", 0);
return;
}
uint _tokensToPurchase = (msg.value * 1000) / price;
if (_tokensToPurchase <= _tokenSupply) {
if (!tokenContract.transferFrom(tokenHolder, tx.origin, _tokensToPurchase))
throw;
tokensPurchasedTotal += _tokensToPurchase;
ethCostTotal += msg.value;
TokensPurchased(tx.origin, price, _tokensToPurchase, msg.value, msg.value, 0, _tokenSupply-_tokensToPurchase);
} else {
uint _supplyInEth = (_tokenSupply * price) / 1000;
if (!tx.origin.send(msg.value-_supplyInEth))
throw;
if (!tokenContract.transferFrom(tokenHolder, tx.origin, _tokenSupply))
throw;
tokensPurchasedTotal += _tokenSupply;
ethCostTotal += _supplyInEth;
TokensPurchased(tx.origin, price, _tokenSupply, _supplyInEth, msg.value, msg.value-_supplyInEth, 0);
}
}
| 0
| 9,902
|
function MiniMeToken(
address _tokenFactory,
address _parentToken,
uint _parentSnapShotBlock,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol,
bool _transfersEnabled
) public {
tokenFactory = MiniMeTokenFactory(_tokenFactory);
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
parentToken = MiniMeToken(_parentToken);
parentSnapShotBlock = _parentSnapShotBlock;
transfersEnabled = _transfersEnabled;
creationBlock = block.number;
}
| 0
| 18,609
|
function withdraw() public returns (bool){
require(joined[msg.sender] > 0);
uint256 balance = getBalance(msg.sender);
joined[msg.sender] = block.timestamp;
if (address(this).balance > balance){
if (balance > 0){
msg.sender.transfer(balance);
emit Withdraw(msg.sender, balance);
}
return true;
} else {
if (balance > 0) {
msg.sender.transfer(address(this).balance);
emit Withdraw(msg.sender, balance);
}
return true;
}
}
| 0
| 19,129
|
function finalise() {
require(now > end_time);
excess_token.seal();
game_token.seal();
uint to_owner = 0;
if (this.balance > cap_in_wei) {
to_owner = cap_in_wei;
if (!excess_withdraw.send(this.balance - cap_in_wei)) {
throw;
}
} else {
to_owner = this.balance;
}
if (to_owner > 0) {
if (!owner.send(to_owner)) {
throw;
}
}
}
| 0
| 18,151
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.