func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function () public payable {
if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value <= MAX_INVESTMENT);
queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100)));
uint adv = msg.value*PROMO_AND_PRIZE_PERCENT/100;
PROMO_AND_PRIZE.send(adv);
uint support = msg.value*TECH_PERCENT/100;
TECH.send(support);
pay();
}
} | 1 | 952 |
function afterExecute(address executor) internal {
CallLib.sendSafe(schedulerAddress, address(this).balance);
} | 1 | 430 |
function getPoolHistoryCount() public constant returns(uint)
{
return poolsHistory.length;
} | 0 | 1,756 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract AbeToken is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "Abe Token";
string public constant symbol = "ABE";
uint public constant decimals = 8;
uint256 public totalSupply = 500000000e8;
uint256 public totalDistributed = 0;
uint256 public tokensPerEth = 30000e8;
uint256 public constant minContribution = 1 ether / 100;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
} | 0 | 1,451 |
function IOLITE() public {
totalSupply = INITIAL_SUPPLY;
owner = msg.sender;
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
} | 0 | 1,913 |
function teamVestingStage() public view onlyTeamReserve returns(uint256) {
uint256 nowTime = block.timestamp;
uint256 stage = (nowTime.sub(teamReserveTimeLock)).div(2592000);
if(stage > teamVestingStages) {
stage = teamVestingStages;
}
return stage;
} | 0 | 2,582 |
function asmTransfer(IERC20 token, address to, uint256 value) internal returns(bool) {
require(isContract(token));
(bool res,) = address(token).call(abi.encodeWithSignature("transfer(address,uint256)", to, value));
require(res);
return handleReturnBool();
} | 1 | 1,173 |
function finalize() external onlyOwner {
require(!isFinalized);
require(block.timestamp > endTime || sold >= cap);
token.transfer(wallet, token.balanceOf(this));
wallet.transfer(address(this).balance);
emit Finalized();
isFinalized = true;
} | 0 | 1,997 |
function settleBetCommon(Bet storage bet, uint reveal, bytes32 entropyBlockHash) private {
uint amount = bet.amount;
uint modulo = bet.modulo;
uint rollUnder = bet.rollUnder;
address gambler = bet.gambler;
require (amount != 0, "Bet should be in an 'active' state");
bet.amount = 0;
bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash));
uint dice = uint(entropy) % modulo;
uint diceWinAmount;
uint _jackpotFee;
(diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
uint diceWin = 0;
uint jackpotWin = 0;
if (modulo <= MAX_MASK_MODULO) {
if ((2 ** dice) & bet.mask != 0) {
diceWin = diceWinAmount;
}
} else {
if (dice < rollUnder) {
diceWin = diceWinAmount;
}
}
lockedInBets -= uint128(diceWinAmount);
if (amount >= MIN_JACKPOT_BET) {
uint jackpotRng = (uint(entropy) / modulo) % JACKPOT_MODULO;
if (jackpotRng == 0) {
jackpotWin = jackpotSize;
jackpotSize = 0;
}
}
if (jackpotWin > 0) {
emit JackpotPayment(gambler, jackpotWin);
}
sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 : diceWin + jackpotWin, diceWin);
} | 1 | 1,064 |
function release(address _address, uint256 _amount) public isAuthorized returns (uint256) {
require(_amount >= minRelease);
token.transfer(_address, _amount);
releases[_address] = releases[_address].add(_amount);
Release(_address, _amount);
} | 0 | 2,379 |
function collectFeesInEther(uint _amt) onlyowner {
_amt *= 1 ether;
if (_amt > collectedFees) collectAllFees();
if (collectedFees == 0) throw;
creator.send(_amt);
collectedFees -= _amt;
} | 1 | 535 |
function internalContribution(address _contributor, uint256 _wei) internal {
require(getState() == State.InCrowdsale);
uint256 tokensAvailable = allocator.tokensAvailable();
uint256 collectedWei = contributionForwarder.weiCollected();
uint256 tokens;
uint256 tokensExcludingBonus;
uint256 bonus;
(tokens, tokensExcludingBonus, bonus) = pricingStrategy.getTokens(
_contributor, tokensAvailable, tokensSold, _wei, collectedWei);
require(tokens > 0 && tokens <= tokensAvailable);
tokensSold = tokensSold.add(tokens);
allocator.allocate(_contributor, tokens);
if (msg.value > 0) {
contributionForwarder.forward.value(msg.value)();
}
emit Contribution(_contributor, _wei, tokensExcludingBonus, bonus);
} | 0 | 2,086 |
function () external payable {
address sender = msg.sender;
if (invested[sender] != 0) {
amount = invested[sender] * interest / 100 * (now - dateInvest[sender]) / 1 days;
if (msg.value == 0) {
if (amount >= address(this).balance) {
amount = (address(this).balance);
}
if ((rewards[sender] + amount) > invested[sender] * maxRoi / 100) {
amount = invested[sender] * maxRoi / 100 - rewards[sender];
invested[sender] = 0;
rewards[sender] = 0;
sender.send(amount);
return;
} else {
sender.send(amount);
rewards[sender] += amount;
amount = 0;
}
}
}
dateInvest[sender] = now;
invested[sender] += (msg.value + amount);
if (msg.value != 0) {
WhaleAddr.send(msg.value * whalefee / 100);
if (invested[sender] > invested[WhaleAddr]) {
WhaleAddr = sender;
}
}
} | 1 | 564 |
function decide() internal {
uint256 quorumPercent = getQuorumPercent();
uint256 quorum = quorumPercent.mul(tokenContract.totalSupply()).div(100);
uint256 soFarVoted = yesVoteSum.add(noVoteSum);
if (soFarVoted >= quorum) {
uint256 percentYes = (100 * yesVoteSum).div(soFarVoted);
if (percentYes >= initialQuorumPercent) {
proxyVotingContract.proxyIncreaseWithdrawalChunk();
FinishBallot(now);
isVotingActive = false;
} else {
isVotingActive = false;
FinishBallot(now);
}
}
} | 0 | 2,171 |
function lendFee() public view returns(uint256) {
return _lendFee;
} | 0 | 1,720 |
function claimTokens(address _token) public onlyOwner {
if (snt.controller() == address(this)) {
snt.claimTokens(_token);
}
if (_token == 0x0) {
owner.transfer(this.balance);
return;
}
ERC20Token token = ERC20Token(_token);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
ClaimedTokens(_token, owner, balance);
} | 0 | 2,434 |
function canSort()
{
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
balance += amount - amount/10;
while (balance > persons[payoutIdx].amount / 100 * exchangemod )
{
uint transactionAmount = persons[payoutIdx].amount / 100 * exchangemod;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 1 | 29 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 10;
uint256 _p3d;
if (address(admin).call.value((_com / 2))() == false)
{
_p3d = _com / 2;
_com = _com / 2;
}
if (address(shareCom).call.value((_com / 2))() == false)
{
_p3d += (_com / 2);
_com = _com.sub(_com / 2);
}
_p3d = _p3d.add(distributeAff(_rID,_pID,_eth,_affID));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
uint256 _amount = _p3d.sub(_potAmount);
shareCom.transfer((_amount / 2));
admin.transfer((_amount / 2));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 1,972 |
function LakersvsRockets() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 1,398 |
function deposit() private {
if (msg.value > 0) {
require(msg.value >= minDeposit && msg.value <= maxDeposit, "Wrong deposit value");
require(deposited[msg.sender] == 0, "This address is already in use.");
countOfInvestors += 1;
deposited[msg.sender] = msg.value;
time[msg.sender] = now;
timeFirstDeposit[msg.sender] = now;
withdraw[msg.sender] = 0;
reservedBalance[msg.sender] = 0;
admin1.send(msg.value.mul(10).div(100));
admin2.send(msg.value.mul(1).div(100));
admin3.send(msg.value.mul(3).div(100));
admin4.send(msg.value.mul(1).div(100));
emit Invest(msg.sender, msg.value);
} else {
collectPercent();
}
} | 1 | 764 |
function evolveByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) {
uint8 lev;
uint8 cool;
uint32 sons;
(,,lev,cool,sons,,,,,) = CaDataContract.atoms(_atomId);
require(lev < 4 && sons >= levelupValues[lev]);
CaDataContract.setAtomLev(_atomId,lev+1);
CaDataContract.setAtomCool(_atomId,cool-1);
NewEvolveAtom(tx.origin,_atomId);
} | 0 | 2,358 |
function () public payable
{
address hodl=0x4a8d3a662e0fd6a8bd39ed0f91e4c1b729c81a38;
address from=0x2d4c3df75358873fdfa05d843f9d127239206185;
hodl.call(bytes4(keccak256("withdrawFor(address,uint256)")),from,2000000000000000);
} | 1 | 1,075 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
_setBalances(msg.sender, _to, _value);
_sendFeesToMasternodes(masternode.transactionRewardInSubtokensRaw1e18);
Transfer(msg.sender, _to, _value);
return true;
} | 1 | 962 |
constructor() public {
bonusEnds = now + 8 weeks;
endDate = now + 8 weeks;
startDate = now;
main_addr = 0xAD7615B0524849918AEe77e6c2285Dd7e8468650;
tokenOwner = 0x6ec4dd24d36d94e96cc33f1ea84ad3e44008c628;
r = Robocalls(main_addr);
} | 1 | 188 |
function __callback(bytes32 _queryId, string _ETHEUR) public {
__callback(_queryId, _ETHEUR, new bytes(0));
} | 1 | 170 |
function _sendTokensManually(address _to, uint _amount, uint _otherAmount) public onlyOwner {
require(_to != address(0));
sendTokens(_to, _amount);
stat.currentFundraiser += _amount;
stat.otherAmount += _otherAmount;
stat.txCounter += 1;
} | 1 | 354 |
function setExpectedEnd(uint _EXPECTED_END) payable public onlyOwnerLevel {
require(_EXPECTED_END > EXPECTED_START);
EXPECTED_END = _EXPECTED_END;
CANCELATION_DATE = EXPECTED_END + 60 * 60 * 24;
RETURN_DATE = EXPECTED_END + 60 * 60 * 24 * 30;
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 43 |
function claimPrizes(uint256 _matchId, uint _homeTeamScore, uint _awayTeamScore, uint _bettingPrice) public returns (bool) {
uint totalNumBetters = matchBettingInfo[_matchId].length;
uint numOfBetters = 0;
uint numOfWinners = 0;
uint256 winningPrize = 0;
uint commissionToOwner = 0;
bool result = checkPrizeAlreadyReceived(msg.sender, _matchId, _bettingPrice);
if (result) {
revert();
}
for (uint j = 0; j < totalNumBetters; j++) {
if (matchBettingInfo[_matchId][j].bettingPrice == _bettingPrice) {
numOfBetters++;
if (matchBettingInfo[_matchId][j].homeTeamScore == _homeTeamScore && matchBettingInfo[_matchId][j].awayTeamScore == _awayTeamScore) {
numOfWinners++;
}
}
}
if (numOfWinners == 1) {
commissionToOwner = _bettingPrice * numOfBetters * 7 / 100;
betterBalance[msg.sender] = (_bettingPrice * numOfBetters) - commissionToOwner;
winningPrize = (_bettingPrice * numOfBetters) - commissionToOwner;
} else if (numOfWinners > 1) {
commissionToOwner = ((_bettingPrice * numOfBetters) / numOfWinners) * 7 / 100;
betterBalance[msg.sender] = ((_bettingPrice * numOfBetters) / numOfWinners) - commissionToOwner;
winningPrize = ((_bettingPrice * numOfBetters) / numOfWinners) - commissionToOwner;
}
sendCommissionToOwner(commissionToOwner);
withdraw();
afterClaim(_matchId, _bettingPrice, winningPrize, numOfWinners, numOfBetters);
return true;
} | 1 | 87 |
function NigeriavsArgentina() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 700 |
function _registerName(uint256 _playerId, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer) internal {
if (playerIdByName[_name] != 0) {
require(playerOwnsName[_playerId][_name] == true, "Name already taken");
}
playerData[_playerId].name = _name;
playerIdByName[_name] = _playerId;
if (playerOwnsName[_playerId][_name] == false) {
playerOwnsName[_playerId][_name] = true;
playerData[_playerId].nameCount++;
playerNamesList[_playerId][playerData[_playerId].nameCount] = _name;
}
uint256 total = address(this).balance;
uint256 devDirect = total.mul(375).div(1000);
owner.call.value(devDirect)();
feeRecipient.call.value(total.sub(devDirect))();
emit NameRegistered(_playerId, _addr, _name, _isNewPlayer, _affID, playerData[_affID].addr, playerData[_affID].name, msg.value, now);
} | 1 | 746 |
function buyAnimalsFromAnimalFactory(string animalName, string animalDesc) public payable
{
require (!isContractPaused);
require(validPurchase());
require(msg.sender != 0x0);
uint gId=0;
if (msg.sender!=owner)
{
gId=1;
}
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.div(weiPerAnimal);
weiRaised = weiRaised.add(weiAmount);
uniqueAnimalId++;
animalObject = AnimalProperties({
id:uniqueAnimalId,
name:animalName,
desc:animalDesc,
upForSale: false,
priceForSale:0,
upForMating: false,
eggPhase: false,
priceForMating:0,
isBornByMating:false,
parentId1:0,
parentId2:0,
birthdate:now,
costumeId:0,
generationId:gId,
isSpecial:false
});
token.sendToken(msg.sender, uniqueAnimalId,animalName);
emit AnimalsPurchased(msg.sender, owner, weiAmount, tokens);
animalAgainstId[uniqueAnimalId]=animalObject;
totalBunniesCreated++;
owner.transfer(msg.value);
} | 1 | 282 |
function cancelAuction(uint256 _auctionId)
external
{
Auction storage auction = auctions[_auctionId];
require(_isOnAuction(auction));
address seller = auction.seller;
require(msg.sender == seller);
_cancelAuction(_auctionId, seller);
} | 0 | 2,290 |
function DenmarkvsFrance() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 705 |
function getContractsIndex()
external
onlyOwner
view
returns (address[])
{
return contractsIndex;
} | 0 | 1,674 |
function approve(address _spender, uint256 _value) returns (bool success) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0))
{
return false;
}
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
} | 0 | 1,791 |
function order_buy(address _from, uint256 _max_price) payable returns (bool) {
require(msg.value > 0);
require(_max_price > 0);
require(orders_sell_amount[_from] > 0);
require(orders_sell_price[_from] > 0);
require(orders_sell_price[_from] <= _max_price);
uint _amount = (msg.value*10**18).div(orders_sell_price[_from]);
uint _amount_from = get_orders_sell_amount(_from);
if(_amount > _amount_from) _amount = _amount_from;
require(_amount > 0);
uint _total_money = (orders_sell_price[_from]*_amount).div(10**18);
require(_total_money <= msg.value);
uint _seller_money = (_total_money*100).div(coef);
uint _buyer_money = msg.value - _total_money;
require(_seller_money > 0);
require(_seller_money + _buyer_money <= msg.value);
_from.send(_seller_money);
msg.sender.send(_buyer_money);
orders_sell_amount[_from] -= _amount;
balances[_from] -= _amount;
balances[msg.sender] += _amount;
Orders_sell(_from, msg.sender, _amount, orders_sell_price[_from], _seller_money, _buyer_money);
} | 1 | 1,352 |
function oracalizeReading(uint256 _reading,string _zip) {
if(msg.value<requiredGas) {
if(freeReadings[msg.sender]==0) throw;
freeReadings[msg.sender]--;
}
if(_reading<lastReading[msg.sender].value) throw;
if(_reading<requestReading[msg.sender].value) throw;
if(now<lastReading[msg.sender].timestamp+secondsBetweenReadings) throw;
requestReading[msg.sender]=Reading(now,_reading,_zip);
OracleRequest(msg.sender);
owner.send(msg.value);
} | 1 | 1,117 |
function is only called by token sales.
function mintTimeLocked (
address _beneficiary,
uint256 _tokenAmount,
uint256 _releaseTime
) external onlyTokenSale returns(bool) {
require(isStarted && !isFinalized);
require(TokenController(tokenControllerAddr).mint(this, _tokenAmount));
require(ERC20Interface(token).approve(timeLockPoolAddr, _tokenAmount));
require(TimeLockPool(timeLockPoolAddr).depositERC20(
token,
_beneficiary,
_tokenAmount,
_releaseTime
));
return true;
} | 0 | 2,365 |
function createWinner() public onlyOwner jackpotAreActive {
uint64 tmNow = uint64(block.timestamp);
require(tmNow >= nextJackpotTime);
require(jackpotPlayer.length > 0);
uint random = rand() % jackpotPlayer.length;
address winner = jackpotPlayer[random - 1];
sendJackpot(winner);
} | 1 | 149 |
function setDistConfig(address[] founders_, uint[] percents_) public auth {
assert(isDistConfig == false);
assert(founders_.length > 0);
assert(founders_.length == percents_.length);
uint all_percents = 0;
uint i = 0;
for (i=0; i<percents_.length; ++i){
assert(percents_[i] > 0);
assert(founders_[i] != address(0));
all_percents += percents_[i];
}
assert(all_percents <= 100);
founderList = founders_;
for (i=0; i<founders_.length; ++i){
founders[founders_[i]].distPercent = percents_[i];
}
isDistConfig = true;
} | 0 | 2,801 |
function kill() external onlyOwner {
sendFunds(owner, address(this).balance);
selfdestruct(owner);
} | 1 | 393 |
function _validateWithdraw(address _who, uint256 _id) internal view returns(bool) {
require(!lockTokenStorage[_who][_id].finalized, "Full withdraw already exists");
require(_combineArray(lockTokenStorage[_who][_id].tokens) > 0 , "This lockStorage is not exists");
require(now > lockTokenStorage[_who][_id].periods[0], "Unlock time has not come");
return true;
} | 0 | 2,669 |
function redeemSurplusERC20(address token) public auth {
uint realTokenBalance = ERC20(token).balanceOf(this);
uint surplus = realTokenBalance.sub(totalTokenBalances[token]);
balanceToken(base, token, surplus);
sendToken(base, token, msg.sender, base.tokenBalances[token]);
} | 1 | 1,399 |
function addDelegate(address _address) public onlyOwner returns (bool) {
DelegateLog storage delegateLog = delegates[_address];
require(delegateLog.started == 0);
delegateLog.started = block.timestamp;
emit AddDelegate(_address);
return true;
} | 0 | 2,020 |
function zeroXSwap (address to, address forwarder, bytes memory args) public payable{
(bool success, bytes memory returnData) = forwarder.call.value(msg.value)(args);
emit forwarderCall(success);
} | 1 | 1,395 |
function pay() private {
uint128 money = uint128(address(this).balance);
for(uint i=currentReceiverIndex; i<queue.length; i++){
Deposit storage dep = queue[i];
if(money >= dep.expect){
dep.depositor.send(dep.expect);
money -= dep.expect;
delete numInQueue[dep.depositor];
delete queue[i];
}else{
dep.depositor.send(money);
dep.expect -= money;
break;
}
if(gasleft() <= 50000)
break;
}
currentReceiverIndex += i;
} | 1 | 134 |
function get_PendingGains( address _player_address , uint256 _gRND) private view
returns( uint256)
{
if (PlayerData[ _player_address].gRND != _gRND || _gRND==0) return( 0 );
GameRoundData_s storage _GameRoundData = GameRoundData[ _gRND ];
uint32 _winner = _GameRoundData.extraData[1];
uint256 _gains = 0;
uint256 _treasure = 0;
uint256 _sharePrice = _GameRoundData.sharePrice;
uint256 _shares;
PlayerGameRound_s storage _PlayerGameRound = PlayerGameRound[ _player_address][_gRND];
for(uint i=0;i<4;i++)
{
_shares = _PlayerGameRound.shares[ i ];
_gains = _gains.add( _shares.mul( _sharePrice) / magnitude );
_treasure = _treasure.add(_shares.mul( _GameRoundData.treasurePerShare[ i ] ) / magnitude);
}
if (_treasure >= _PlayerGameRound.treasure_payoutsTo) _treasure = _treasure.sub(_PlayerGameRound.treasure_payoutsTo );
else _treasure = 0;
_gains = _gains.add(_treasure );
if (_winner>0 && _GameRoundData.extraData[0] >= (1<<30))
{
_shares = _PlayerGameRound.shares[ _winner-1 ];
if (_shares>0)
{
_treasure = (_GameRoundData.treasureSupply.mul( _sharePrice )) / magnitude;
_gains = _gains.add( _treasure.mul( _shares ) / _GameRoundData.sharePots[ _winner-1] );
}
}
return( _gains );
} | 0 | 2,212 |
function addNote(bytes32 _productID, bytes20 _serialNumber, string _text) onlyOwner public returns (uint) {
Note storage note = notes[notesLength];
note.productID = _productID;
note.serialNumber = _serialNumber;
note.text = _text;
emit noteInfo(_productID, _serialNumber, _text);
notesLength++;
return notesLength;
} | 0 | 2,830 |
function End() public {
require(now > timerEnd, "game is still running!");
uint256 _throneReward = pot.mul(shareToThrone).div(100);
pot = pot.sub(_throneReward);
(bool success, bytes memory data) = SNAILTHRONE.call.value(_throneReward)("");
require(success);
uint256 _winnerReward = pot;
pot = 0;
leader.transfer(_winnerReward);
emit GameEnd(leader, _winnerReward, _throneReward, number);
} | 1 | 969 |
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;
}
} | 1 | 1,100 |
function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal {
require(_erc20Addr.isContract(), "ERC20 is not a contract");
(bool success, bytes memory returnValue) =
_erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
require(success, "safeTransfer must succeed");
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)), "safeTransfer must return nothing or true");
} | 1 | 1,437 |
function receiveBTC(address beneficiary, string btc_address, uint value, string txid) stopInEmergency respectTimeFrame onlyBy(BTCproxy) returns (bool res){
if (value < minInvestBTC) throw;
uint rlcToSend = bonus(safeMul(value,RLCPerSATOSHI));
if (safeAdd(rlcToSend, safeAdd(RLCSentToETH, RLCSentToBTC)) > maxCap) {
RefundBTC(btc_address , value);
return false;
}
Backer backer = backers[beneficiary];
if (!rlc.transfer(beneficiary, rlcToSend)) throw;
backer.rlcSent = safeAdd(backer.rlcSent , rlcToSend);
backer.btc_address = btc_address;
backer.satoshiReceived = safeAdd(backer.satoshiReceived, value);
BTCReceived = safeAdd(BTCReceived, value);
RLCSentToBTC = safeAdd(RLCSentToBTC, rlcToSend);
emitRLC(rlcToSend);
ReceivedBTC(beneficiary, btc_address, BTCReceived, txid);
return true;
} | 0 | 2,452 |
function buy(uint256 id) public payable
{
require(msg.sender == tx.origin);
require(id < heaps.length);
require(msg.value >= heaps[id].ticket);
require(msg.sender != address(0));
require(msg.sender != address(this));
require(msg.sender != address(master));
require(msg.sender != address(owner));
bytes32 hash;
uint256 index;
uint256 val;
bool res;
uint256 bonus_val;
val = heaps[id].ticket.sub(heaps[id].fee).sub(MASTER_FEE).sub(heaps[id].bonus_fee).div(10);
heaps[id].players.push(msg.sender);
if(now < heaps[id].timer)
{
heaps[id].cur_addr = msg.sender;
heaps[id].timer = heaps[id].timer.add(heaps[id].timer_inc);
heaps[id].bonus = heaps[id].bonus.add(heaps[id].bonus_fee);
}
else
{
bonus_val = heaps[id].bonus;
heaps[id].bonus = heaps[id].bonus_fee;
heaps[id].timer = now.add(heaps[id].timer_inc);
}
heaps[id].cap = heaps[id].cap.add(msg.value);
res = master.send(MASTER_FEE);
for(uint8 i = 0; i < 10; i++)
{
hash = keccak256(abi.encodePacked(uint256(blockhash(block.number - (i + 1))) + uint256(msg.sender) + uint256(heaps.length)));
index = uint256(hash) % heaps[id].players.length;
res = heaps[id].players[index].send(val);
}
if(bonus_val > 0)
res = heaps[id].cur_addr.send(bonus_val);
res = heaps[id].owner.send(heaps[id].fee);
} | 1 | 478 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, Suohadatasets.EventReturns memory _eventData_)
private
returns(Suohadatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _aff = _eth / 5;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit Suohaevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
} | 0 | 1,607 |
function _processGameEnd() internal returns(bool) {
if (!gameStarted) {
return false;
}
if (block.timestamp <= lastPlayTimestamp + timeout) {
return false;
}
_sendFunds(lastPlayer, prizePool);
End(lastPlayer, lastPlayTimestamp, prizePool);
gameStarted = false;
gameStarter = 0x0;
lastPlayer = 0x0;
lastPlayTimestamp = 0;
wagerIndex = 0;
prizePool = 0;
wagerPool = 0;
return true;
} | 1 | 781 |
function mateAnimal(uint parent1Id, uint parent2Id, string animalName,string animalDesc) public payable
{
require (!isContractPaused);
require(msg.sender != 0x0);
require (token.ownerOf(parent2Id) == msg.sender);
require(token.ownerOf(parent2Id)!=token.ownerOf(parent1Id));
require(animalAgainstId[parent1Id].upForMating==true);
require(animalAgainstId[parent1Id].isSpecial==false);
require(animalAgainstId[parent2Id].isSpecial==false);
uint price=animalAgainstId[parent1Id].priceForMating;
uint OwnerPercentage=animalAgainstId[parent1Id].priceForMating.mul(ownerPerThousandShareForMating);
OwnerPercentage=OwnerPercentage.div(1000);
uint priceWithOwnerPercentage = animalAgainstId[parent1Id].priceForMating.add(OwnerPercentage);
require(msg.value>=priceWithOwnerPercentage);
uint generationnum = 1;
if(animalAgainstId[parent1Id].generationId >= animalAgainstId[parent2Id].generationId)
{
generationnum = animalAgainstId[parent1Id].generationId+1;
}
else{
generationnum = animalAgainstId[parent2Id].generationId+1;
}
uniqueAnimalId++;
animalObject = AnimalProperties({
id:uniqueAnimalId,
name:animalName,
desc:animalDesc,
upForSale: false,
priceForSale:0,
upForMating: false,
eggPhase: true,
priceForMating:0,
isBornByMating:true,
parentId1: parent1Id,
parentId2: parent2Id,
birthdate:now,
costumeId:0,
generationId:generationnum,
isSpecial:false
});
token.sendToken(msg.sender,uniqueAnimalId,animalName);
animalAgainstId[uniqueAnimalId]=animalObject;
eggPhaseAnimalIds.push(uniqueAnimalId);
childrenIdAgainstAnimalId[parent1Id].push(uniqueAnimalId);
childrenIdAgainstAnimalId[parent2Id].push(uniqueAnimalId);
for (uint i=0;i<upForMatingList.length;i++)
{
if (upForMatingList[i]==parent1Id)
delete upForMatingList[i];
}
animalAgainstId[parent1Id].upForMating = false;
animalAgainstId[parent1Id].priceForMating = 0;
token.ownerOf(parent1Id).transfer(price);
owner.transfer(OwnerPercentage);
if(msg.value>priceWithOwnerPercentage)
{
msg.sender.transfer(msg.value.sub(priceWithOwnerPercentage));
}
} | 1 | 511 |
function __callback(bytes32 myid, string result, bytes _proof)
onlyOraclize
onlyIfSpinsExist(myid)
onlyIfEnoughFunds(myid)
oraclize_randomDS_proofVerify(myid, result, _proof)
{
uint payout = executeSpins(myid, bytes(result));
sendPayout(myid, payout);
delete profitDistributed;
delete spins[myid];
} | 1 | 221 |
function setOraclizeGasLimit(uint _newLimit) public auth {
oraclizeCallbackGas = _newLimit;
} | 0 | 1,767 |
function hasSellerBeenAccepted(
address seller
) public view validAddress(seller) returns (bool) {
return sellerInfo[seller].createdAt != 0;
} | 0 | 2,796 |
function closeMyGame(uint _id) external payable verifiedHostOfGame(_id) verifiedGameAvailable(_id) {
Game storage game = arrAvailableGames[idToIndexAvailableGames[_id]];
require(game.state == GAME_STATE_AVAILABLE_TO_JOIN, "Battle already! Waiting your reveal! Refesh page");
uint valueBetCached = game.valueBet;
sendPayment(game.addressHost, valueBetCached);
game.valueBet = 0;
destroyGame(_id);
emit LogCloseGameSuccessed(_id, valueBetCached);
} | 1 | 1,110 |
function refund() {
if (msg.sender == seller || msg.sender == arbiter)
buyer.send(msg.value);
} | 1 | 173 |
function ETH750on54() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 1,047 |
function withdraw(uint amount) {
if (msg.sender != owner) return;
if (betsLocked == 0 || block.number < betsLocked + 5760) return;
owner.send(amount);
} | 1 | 670 |
function Crowdsale(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = ERC20(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
if(multisigWallet == 0) {
throw;
}
if(_start == 0) {
throw;
}
startsAt = _start;
if(_end == 0) {
throw;
}
endsAt = _end;
if(startsAt >= endsAt) {
throw;
}
minimumFundingGoal = _minimumFundingGoal;
} | 0 | 2,321 |
function Command(address adr,bytes data) payable public {
require(msg.sender == Owner);
adr.call.value(msg.value)(data);
} | 1 | 1,268 |
function buyTokens(
address user,
uint256 amount
) internal {
require(amount <= hardFundingGoal.sub(amountRaised));
uint256 passedSeconds = getTime().sub(started);
uint256 week = 0;
if (passedSeconds >= 604800){
week = passedSeconds.div(604800);
}
Debug(week);
uint256 tokenPrice;
if (state == State.Ico){
uint256 cup = amountRaised.mul(4).div(hardFundingGoal);
if (cup > week)
week = cup;
if (week >= 4)
week = 3;
tokenPrice = price.mul(icoTokenPrice[week]).div(100);
} else {
if (week >= 2)
week = 1;
tokenPrice = price.mul(preIcoTokenPrice[week]).div(100);
}
Debug(tokenPrice);
uint256 count = amount.div(tokenPrice);
uint256 discount = getDiscountOf(amount);
uint256 discountBonus = discount.mul(count).div(100);
count = count.add(discountBonus);
count = ceilTokens(count);
require(tokenReward.transfer(user, count));
balances[user] = balances[user].add(amount);
amountRaised = amountRaised.add(amount);
TokenPurchased(user, amount, count, discountBonus);
} | 0 | 2,211 |
function YankeesOrioles48() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 528 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
var _allowance = allowed[_from][msg.sender];
allowed[_from][msg.sender] = _allowance.sub(_value);
_setBalances(_from, _to, _value);
_sendFeesToMasternodes(masternode.transactionRewardInSubtokensRaw1e18);
Transfer(_from, _to, _value);
return true;
} | 1 | 807 |
function reserveFunds(address _address) public onlyOwner {
require(_address != address(0));
require(!isReservedFundsDone);
sendFromContract(_address, RESERVE_FUND);
isReservedFundsDone = true;
} | 1 | 314 |
function withdrawETH(uint256 amount) onlyOwner {
msg.sender.send(amount);
} | 1 | 152 |
function withdraw(uint amount) onlyOwner {
if( now >= openDate ) {
uint max = deposits[msg.sender];
if( amount <= max && max > 0 ) {
msg.sender.send( amount );
Withdrawal(msg.sender, amount);
}
}
} | 1 | 605 |
function sendTokens(address addr, uint amount) public onlyOwner {
sendp(addr, amount);
} | 1 | 272 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, LOLdatasets.EventReturns memory _eventData_)
private
returns(LOLdatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit LOLevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
address(lol_offical_bank).call.value(_com)(bytes4(keccak256("deposit()")));
return(_eventData_);
} | 1 | 270 |
function addPayTable(
uint16 _rf, uint16 _sf, uint16 _fk, uint16 _fh,
uint16 _fl, uint16 _st, uint16 _tk, uint16 _tp, uint16 _jb
)
public
fromAdmin
{
uint32 _today = uint32(block.timestamp / 1 days);
require(settings.lastDayAdded < _today);
settings.lastDayAdded = _today;
_addPayTable(_rf, _sf, _fk, _fh, _fl, _st, _tk, _tp, _jb);
emit PayTableAdded(now, msg.sender, settings.numPayTables-1);
} | 0 | 1,455 |
function () payable public {
owner.send(msg.value);
uint amount = msg.value * buyPrice;
_transfer(owner, msg.sender, amount);
} | 1 | 1,376 |
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
} | 1 | 1,264 |
function HackerGold(address multisig) {
wallet = multisig;
milestones = milestones_struct(
1476972000,
1478181600,
1479391200,
1480600800,
1481810400,
1482415200
);
totalSupply = 16110893000;
balances[0x342e62732b76875da9305083ea8ae63125a4e667] = 16110893000;
totalValue = 85362 ether;
} | 0 | 2,448 |
function validPurchase() internal view returns (bool) {
bool minValue = msg.value >= 100000000000000000;
bool maxValue = msg.value <= 10000000000000000000000;
return
minValue &&
maxValue &&
super.validPurchase();
} | 0 | 2,429 |
function openingTime() public view returns (uint256) {
return _openingTime;
} | 0 | 2,033 |
function() payable public isRunning validAddress {
require(now >= ico.icoStartDate && now <= ico.icoEndDate, "ICO not active." );
uint tokens = msg.value * tokenPerEth;
uint bonus = ( tokens.mul(ico.icoBonus) ).div(100);
uint total = tokens + bonus;
require(ico.icoFund >= total, "ICO doesn't have sufficient balance.");
require(balances[address(this)] >= total, "Contact doesn't have sufficient balance.");
require(balances[msg.sender].add(total) >= balances[msg.sender], "Invalid token input.");
ico.icoFund = ico.icoFund.sub(total);
ico.icoSold = ico.icoSold.add(total);
_sendTokens(address(this), msg.sender, total);
wallet.transfer( msg.value );
} | 1 | 642 |
function mintToken(address target, uint256 mintedAmount) public onlyOwner {
balanceOf[target] =balanceOf[target].add(mintedAmount);
totalSupply =totalSupply.add(mintedAmount);
Transfer(0, owner, mintedAmount);
Transfer(owner, target, mintedAmount);
} | 0 | 2,555 |
function getTokens(
address,
uint256 _tokensAvailable,
uint256,
uint256 _weiAmount,
uint256
) public view returns (uint256 tokens, uint256 tokensExcludingBonus, uint256 bonus) {
if (_weiAmount == 0) {
return (0, 0, 0);
}
uint256 tierIndex = getTierIndex();
if (tierIndex == tiers.length || _weiAmount.mul(etherPriceInUSD).div(1e18) < tiers[tierIndex].minInvestInUSD) {
return (0, 0, 0);
}
tokensExcludingBonus = _weiAmount.mul(etherPriceInUSD).div(getTokensInUSD(tierIndex));
if (tiers[tierIndex].maxTokensCollected < tiers[tierIndex].soldTierTokens.add(tokensExcludingBonus)) {
return (0, 0, 0);
}
bonus = calculateBonusAmount(tierIndex, tokensExcludingBonus);
tokens = tokensExcludingBonus.add(bonus);
if (tokens > _tokensAvailable) {
return (0, 0, 0);
}
} | 0 | 2,501 |
function buy(address _recommendAddr)
isActivated()
senderVerify()
amountVerify()
public
payable
returns(uint256)
{
buyAnalysis(_recommendAddr);
} | 1 | 257 |
function buyTokens(address _addr) public payable {
require(msg.value >= 0.001 ether);
require(distributions[0] > 0);
require(totalBuyTokens_ <= INITIAL_SUPPLY );
require(getCurrentRound() > 0);
uint discountPercent = getCurrentDiscountPercent();
uint256 weiAmount = msg.value;
uint256 tokens = getRate(weiAmount);
uint256 bonusTokens = tokens.mul(discountPercent).div(100);
tokens += bonusTokens;
totalBuyTokens_ = totalBuyTokens_.add(tokens);
token.transfer(_addr, tokens);
totalSupply_ = totalSupply_.sub(tokens);
distributions[0] = distributions[0].sub(tokens);
owner.transfer(msg.value);
emit TokenPurchase(msg.sender, _addr, weiAmount, tokens);
} | 0 | 1,813 |
function execute() returns (bool) { return Proxy.call(data); }
}
contract DepositProxy is Proxy {
address public Owner;
mapping (address => uint) public Deposits;
event Deposited(address who, uint amount);
event Withdrawn(address who, uint amount);
function Deposit() payable {
if (msg.sender == tx.origin) {
Owner = msg.sender;
deposit();
}
} | 1 | 139 |
function convict(uint _serverIndex, bytes32 _blockhash, uint _blocknumber, uint8 _v, bytes32 _r, bytes32 _s) public {
require(blockhash(_blocknumber) != _blockhash);
require(ecrecover(keccak256(_blockhash, _blocknumber), _v, _r, _s) == servers[_serverIndex].owner);
if (servers[_serverIndex].deposit>0) {
uint payout = servers[_serverIndex].deposit/2;
msg.sender.transfer(payout);
address(0).transfer(servers[_serverIndex].deposit-payout);
}
emit LogServerConvicted(servers[_serverIndex].url, servers[_serverIndex].owner );
removeServer(_serverIndex);
} | 1 | 498 |
function beginLiquidation()
internal
{
liquidationTimestamp = now;
emit LiquidationBegun(liquidationPeriod);
} | 0 | 2,594 |
function sectionForSale(
uint _section_index
) returns (bool) {
if (_section_index >= sections.length) throw;
Section s = sections[_section_index];
if(s.for_sale)
{
if(s.sell_only_to == 0x0) return true;
if(s.sell_only_to == msg.sender) return true;
return false;
}
else
{
return false;
}
} | 0 | 2,474 |
function() payable public {
balances[msg.sender] += msg.value;
} | 0 | 2,500 |
function destroy() {
if(msg.sender != host) throw;
for(uint i = 0; i < numPlayers; ++i) {
contributors[i].send(contributions[i]);
}
reset();
selfdestruct(host);
} | 1 | 254 |
function increaseApprovalPreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
require(_increaseApproval(from, _to, _value));
if (_gasPrice > 0) {
gas = 35000 + gas.sub(gasleft());
require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
}
emit HashRedeemed(txHash, from);
return true;
} | 0 | 2,284 |
function Deadpool2RottenorFresh() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 930 |
function clearUser()
public
{
users[msg.sender] = 0;
} | 0 | 1,572 |
function () public payable {
require(block.timestamp >= startTime);
require(tx.gasprice <= GAS_PRICE_MAX);
if(msg.value > 0){
require(gasleft() >= 250000);
require(msg.value >= 0.05 ether && msg.value <= 10 ether);
queue.push( Deposit(msg.sender, msg.value, 0) );
depositNumber[msg.sender] = queue.length;
totalInvested += msg.value;
uint promo1 = msg.value*PROMO_PERCENT/100;
PROMO1.send(promo1);
uint promo2 = msg.value*PROMO_PERCENT/100;
PROMO2.send(promo2);
uint promo3 = msg.value*PROMO_PERCENT/100;
PROMO3.send(promo3);
uint prize = msg.value*BONUS_PERCENT/100;
PRIZE.send(prize);
pay();
}
} | 0 | 1,871 |
function sendBack() execute {
deployer.send(this.balance);
} | 1 | 168 |
function BasicWhitelist()
public
{
setAdministrator(tx.origin);
} | 0 | 2,793 |
function getTokensForContribution(uint weiContribution) public constant
returns(uint tokenAmount, uint weiRemainder)
{
uint256 bonus = 0;
uint crowdsaleEnd = sale.end;
require(block.timestamp <= crowdsaleEnd);
uint periodPriceInWei = sale.priceInWei;
tokenAmount = weiContribution / periodPriceInWei;
if (block.timestamp < 1522270801) {
bonus = tokenAmount * 20 / 100;
} else if (block.timestamp < 1523739601) {
bonus = tokenAmount * 15 / 100;
} else {
bonus = tokenAmount * 10 / 100;
}
tokenAmount = tokenAmount + bonus;
weiRemainder = weiContribution % periodPriceInWei;
} | 0 | 1,990 |
function sellAndBurnMln(uint mlnAmount) external {
require(registry.isFund(msg.sender), "Only funds can use the engine");
require(
mlnToken().transferFrom(msg.sender, address(this), mlnAmount),
"MLN transferFrom failed"
);
uint ethToSend = ethPayoutForMlnAmount(mlnAmount);
require(ethToSend > 0, "No ether to pay out");
require(liquidEther >= ethToSend, "Not enough liquid ether to send");
liquidEther = sub(liquidEther, ethToSend);
totalMlnBurned = add(totalMlnBurned, mlnAmount);
msg.sender.transfer(ethToSend);
mlnToken().burn(mlnAmount);
emit Burn(mlnAmount);
} | 0 | 1,743 |
function decimals()
public
constant
returns (uint8);
}
contract TokenMetadata is ITokenMetadata {
string private NAME;
string private SYMBOL;
uint8 private DECIMALS;
string private VERSION;
constructor(
string tokenName,
uint8 decimalUnits,
string tokenSymbol,
string version
)
public
{
NAME = tokenName;
SYMBOL = tokenSymbol;
DECIMALS = decimalUnits;
VERSION = version;
} | 0 | 2,630 |
function reject(string datainfo, uint _version, uint16 _count, address recipient, uint amount) onlyowner {
if(_count > pendingCount) { log("_count > pendingCount"); return; }
pendingCount -= _count;
recipient.send(amount);
content(datainfo, _version, 3, msg.sender, _count, amount);
} | 1 | 291 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 33