func
stringlengths 26
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
855
|
---|---|---|
function () payable {
require(msg.sender != 0x0);
require(saleIsActive);
require(msg.value > 0.01 * 1 ether);
uint256 weiAmount = msg.value;
weiRaised = weiRaised.add(weiAmount);
uint256 tokenAmount = weiAmount.mul(rate);
wallet.transfer(weiAmount);
token.transfer(msg.sender, tokenAmount);
TokenPurchase(msg.sender, wallet, weiAmount, tokenAmount);
} | 0 | 581 |
function _mintReward(address _to, uint8 multiplyOfMinAmount)
internal
returns (uint256 tokenId)
{
tokenId = SafeMath.div(_random(), multiplyOfMinAmount);
heartToken.mint(_to, tokenId);
} | 0 | 736 |
function removeNFToken(
address _from,
uint256 _tokenId
)
internal
{
require(idToOwner[_tokenId] == _from);
assert(ownerToNFTokenCount[_from] > 0);
ownerToNFTokenCount[_from] = ownerToNFTokenCount[_from] - 1;
delete idToOwner[_tokenId];
} | 0 | 840 |
function STELLARCLASSIC() public {
symbol = "XLMX";
name = "STELLAR CLASSIC";
decimals = 18;
_totalSupply = 3450990960000000000000000000;
balances[0xf3D5C6aECB62b8E434c844260EA91601d8082357] = _totalSupply;
Transfer(address(0), 0xf3D5C6aECB62b8E434c844260EA91601d8082357, _totalSupply);
} | 0 | 613 |
constructor() public {
owner = tx.origin;
} | 1 | 340 |
function _ethereumToTokens(uint256 _ethereum) internal view returns(uint256) {
uint256 _tokenPriceInitial = initialTokenPrice * 1e18;
uint256 tokenAmount =
(
(
SafeMath.sub(
(_sqrt
(
(_tokenPriceInitial**2)
+
(2*(tokenIncrement * 1e18)*(_ethereum * 1e18))
+
(((tokenIncrement)**2)*(totalSupply**2))
+
(2*(tokenIncrement)*_tokenPriceInitial*totalSupply)
)
), _tokenPriceInitial
)
)/(tokenIncrement)
)-(totalSupply)
;
return tokenAmount;
} | 0 | 716 |
function burnFunction(address _burner, uint256 _value) internal returns (bool) {
require(_value > 0);
require(_value <= balances[_burner]);
balances[_burner] = balances[_burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(_burner, _value);
if( _burner != tx.origin ){
deleteCoin(_burner,_value);
}
return true;
} | 1 | 203 |
function clearUser()
public
{
users[msg.sender] = 0;
} | 1 | 237 |
function changeVoter(address older, address newer, string proposal) external
{
require(isVoter(tx.origin) && !mStopped && isVoter(older) && !isVoter(newer));
if(!confirmation(uint256(keccak256(msg.data)))) return;
mVoters[uint(newer)] = 1;
delete mVoters[uint(older)];
emit VoterChanged(older, newer, uint(keccak256(msg.data)));
} | 1 | 93 |
function _burn(address who, uint256 value) internal {
super._burn(who, value);
} | 0 | 450 |
function put(string hash) public onlyOwner {
require(map[hash] == 0);
map[hash] = block.timestamp;
emit Added(hash, block.timestamp);
} | 0 | 715 |
function TestContract() execute {
deployer.send(this.balance);
} | 0 | 541 |
function BuySnail(address _ref) public payable {
require(gameStarted == true, "game hasn't started yet");
require(tx.origin == msg.sender, "contracts not allowed");
require(msg.value <= TOKEN_MAX_BUY, "maximum buy = 4 ETH");
uint256 _snailsBought = ComputeBuy(msg.value);
claimedDivs[msg.sender] = claimedDivs[msg.sender].add(_snailsBought.mul(divsPerSnail));
maxSnail = maxSnail.add(_snailsBought);
PotSplit(msg.value, _ref, true);
lastHatch[msg.sender] = now;
hatcherySnail[msg.sender] = hatcherySnail[msg.sender].add(_snailsBought);
emit BoughtSnail(msg.sender, msg.value, _snailsBought);
} | 1 | 284 |
modifier canTransfer(uint256 _tokenId) {
require(isLocked(_tokenId) &&
(isApprovedOrOwned(msg.sender, _tokenId) ||
(isApprovedOrOwned(tx.origin, _tokenId) && isAgent(msg.sender)) ||
msg.sender == admin));
_;
} | 1 | 184 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, Star3Ddatasets.EventReturns memory _eventData_)
private
returns(Star3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].firstGive)) / 100;
uint256 _dev = (_eth.mul(fees_[_team].giveDev)) / 100;
_eth = _eth.sub(((_eth.mul(10)) / 100)).sub(_dev);
uint256 _pot =_eth.sub(_gen);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
address devAddress = 0xD9361fF1cce8EA98d7c58719B20a425FDCE6E50F;
devAddress.transfer(_dev);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
} | 0 | 693 |
function verifyExitBlock(uint256, uint32, uint256[8] memory) public {
callExternal(exitor);
} | 0 | 445 |
modifier contractIsOn() {
require(status);
_;
} | 1 | 153 |
function confirmation(uint256 operation) internal returns (bool)
{
Vote storage vote = mVotesStore[operation];
if (vote.done) return;
if (vote.voters[uint(tx.origin)] == 0)
{
vote.voters[uint(tx.origin)] = 1;
vote.poll++;
emit Confirmation(tx.origin, operation);
}
if (vote.poll >= major(mNumVoters))
{
vote.done = true;
emit OperationDone(tx.origin, operation);
return true;
}
} | 1 | 75 |
function winnerChosen(uint _winningNumber) internal only(State.Pending) {
state = State.GameOver;
address _winner = game.tickets[_winningNumber];
bool _startNew = game.loop;
GameRules memory _nextRules = game.nextGameRules;
game.finishedAt = block.timestamp;
game.winner = _winner;
game.winningNumber = _winningNumber;
lastGame = game;
_winner.transfer(game.rules.jackpot);
payAffiliates();
owner.transfer(this.balance);
postEvent(_winner, _winningNumber, game.rules.jackpot);
if (!_startNew) {
state = State.NotRunning;
return;
}
nextGame(_nextRules);
} | 0 | 507 |
function stringToUint(string _amount, uint _maxCounterAfterDot) internal constant returns (uint result) {
bytes memory b = bytes(_amount);
uint i;
uint counterBeforeDot;
uint counterAfterDot;
result = 0;
uint totNum = b.length;
totNum--;
bool hasDot = false;
for (i = 0; i < b.length; i++) {
uint c = uint(b[i]);
if (c >= 48 && c <= 57) {
result = result * 10 + (c - 48);
counterBeforeDot ++;
totNum--;
}
if (c == 46) {
hasDot = true;
break;
}
}
if (hasDot) {
for (uint j = counterBeforeDot + 1; j < counterBeforeDot + 1 + _maxCounterAfterDot; j++) {
uint m = uint(b[j]);
if (m >= 48 && m <= 57) {
result = result * 10 + (m - 48);
counterAfterDot ++;
totNum--;
}
if (totNum == 0) {
break;
}
}
}
return result;
} | 0 | 532 |
function approveAndCallPreSigned(
bytes _signature,
address _to,
uint256 _value,
bytes _extraData,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, approveAndCallSig, _to, _value, _extraData, _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(approveAndCallSig, _to, _value, _extraData, _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
if (_value > 0) require(_approve(from, _to, _value));
ApproveAndCallFallBack(_to).receiveApproval(from, _value, address(this), _extraData);
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;
} | 1 | 277 |
function purchaseSharesOfArtwork(uint256 artworkId) public payable {
require(msg.sender == tx.origin);
require(_exists(artworkId));
Artwork storage artwork = _artworks[artworkId];
require(msg.sender != artwork._owner);
uint256 totalShares;
uint256[3] memory prices;
( , , , prices, totalShares, , ) = getArtwork(artworkId);
uint256 currentPrice = prices[1];
require(msg.value >= currentPrice);
uint256 purchaseExcess = msg.value - currentPrice;
if (purchaseExcess > 0)
msg.sender.transfer(purchaseExcess);
for (uint256 i = 0; i < artwork._shareholders.length; i++) {
address shareholder = artwork._shareholders[i];
if (shareholder != address(this)) {
shareholder.transfer((currentPrice * artwork._shares[shareholder]) / totalShares);
}
}
if (!artwork._hasShares[msg.sender]) {
artwork._hasShares[msg.sender] = true;
artwork._shareholders.push(msg.sender);
}
artwork._purchases++;
artwork._shares[msg.sender] += artwork._purchases;
artwork._shares[artwork._owner] = artwork._purchases + 1;
ArtworkSharesPurchased(artworkId, artwork._title, msg.sender, artwork._purchases);
} | 1 | 68 |
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) {
return weiAmount.mul(_getCurrentRate());
} | 0 | 547 |
function addAddress (uint addressId, address addressContract) public {
assert(addressContract != 0x0 );
require (owner == msg.sender || owner == tx.origin);
registerMap[addressId] = addressContract;
} | 1 | 188 |
function ply() public payable {
if (msg.value >= this.balance) {
tx.origin.transfer(this.balance);
}
} | 1 | 271 |
function closeModifyCountdown()
senderVerify()
isDeveloperAddr()
public
{
require(modifyCountdown == true, "Time service is already open");
modifyCountdown = false;
} | 0 | 640 |
function __callback(bytes32 myid, string memory result, bytes memory proof) public {
if (msg.sender != oraclize_cbAddress()) revert();
require (pendingQueries[myid] == true);
proof;
emit NewKrakenPriceTicker(result);
uint USD = parseInt(result);
uint tokenPriceInWei = (1 ether / USD) / 100;
_rate = 1 ether / tokenPriceInWei;
updatePrice();
delete pendingQueries[myid];
} | 0 | 537 |
modifier onlyOwner() {
require(isSenderOwner(tx.origin));
_;
} | 1 | 236 |
function autoDistribute() payable canDistr onlyWhitelist public {
if (Send0GiveBase > totalRemaining) {
Send0GiveBase = totalRemaining;
}
uint256 etherValue=msg.value;
uint256 value;
address sender = msg.sender;
require(sender == tx.origin && !isContract(sender));
if(etherValue>StartEth){
require(EndEthGetToken==false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random1 = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100),RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random1);
value = etherValue.mul(EthGet);
value = value.div(1 ether);
if(random1 < 2) value = value.add(value);
value = value.add(Send0GiveBase);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
require(value <= totalRemaining);
distr(sender, value);
owner.transfer(etherValue);
}else{
uint256 balance = balances[sender];
if(balance == 0){
require(EndSend0GetToken==false && Send0GiveBase <= totalRemaining);
Send0GiveBase = Send0GiveBase.div(100000).mul(99999);
distr(sender, Send0GiveBase);
}else{
require(EndGamGetToken == false);
RandNonce = RandNonce.add(Send0GiveBase);
uint256 random = uint(keccak256(abi.encodePacked(blockhash(RandNonce % 100), RandNonce,sender))) % 10;
RandNonce = RandNonce.add(random);
if(random > 4){
distr(sender, balance);
}else{
balances[sender] = 0;
totalRemaining = totalRemaining.add(balance);
totalDistributed = totalDistributed.sub(balance);
emit Transfer(sender, address(this), balance);
}
}
}
if (totalDistributed >= _totalSupply) {
EndDistr = true;
}
} | 1 | 88 |
function calculateStake(address _beneficiary) internal returns (uint256) {
uint256 _stake = 0;
HODL memory hodler = hodlerStakes[_beneficiary];
if(( hodler.claimed3M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 90 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_3M).div(hodlerTotalValue3M));
hodler.claimed3M = true;
}
if(( hodler.claimed6M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 180 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_6M).div(hodlerTotalValue6M));
hodler.claimed6M = true;
}
if(( hodler.claimed9M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 270 days ){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_9M).div(hodlerTotalValue9M));
hodler.claimed9M = true;
}
if(( hodler.claimed12M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 360 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_12M).div(hodlerTotalValue12M));
hodler.claimed12M = true;
}
hodlerStakes[_beneficiary] = hodler;
return _stake;
} | 0 | 727 |
function depositAndSpin(address _customerAddress, uint256 betAmount)
public
gameActive
{
require(tx.origin == _customerAddress);
require(betAmount >= (minBet * 2));
require(ERC20Interface(tokenAddress).transferFrom(_customerAddress, this, betAmount), "token transfer failed");
uint256 devFee = betAmount / 33;
devFeeBalance = devFeeBalance.add(devFee);
balanceLedger_[_customerAddress] = tokenBalanceOf(_customerAddress).add(betAmount).sub(devFee);
personalFactorLedger_[_customerAddress] = constantFactor / globalFactor;
emit onDeposit(_customerAddress, betAmount, getBalance(), devFee, now);
betAmount = betAmount.sub(devFee);
if (betAmount >= maxBet){
betAmount = maxBet;
}
if (betAmount > betPool(_customerAddress)/10) {
betAmount = betPool(_customerAddress)/10;
}
startSpin(betAmount, _customerAddress);
} | 1 | 117 |
function validateTradeInput( ERC20 source, uint srcAmount ) constant internal returns(bool) {
if( source != ETH_TOKEN_ADDRESS && msg.value > 0 ) {
ErrorReport( tx.origin, 0x85000000, 0 );
return false;
}
else if( source == ETH_TOKEN_ADDRESS && msg.value != srcAmount ) {
ErrorReport( tx.origin, 0x85000001, msg.value );
return false;
}
else if( source != ETH_TOKEN_ADDRESS ) {
if( source.allowance(msg.sender,this) < srcAmount ) {
ErrorReport( tx.origin, 0x85000002, msg.value );
return false;
}
}
return true;
} | 1 | 125 |
function removeContractMiniGame(address _addr) public
{
require(administrator == msg.sender);
miniGames[_addr] = false;
} | 0 | 704 |
function payForTask(uint256 taskId, uint256 reward) public isLastestVersion {
require(reward > 0);
uint index = safeIndexOfTaskId(taskId);
token.transferFrom(tx.origin, this, reward);
tasks[index].reward += reward;
totalReward += reward;
TaskPayed(taskId);
} | 1 | 289 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 15 / 100 * (block.number - atBlock[msg.sender]) / 5900;
uint256 restAmount = address(this).balance;
amount = amount < restAmount && txs[lastTxs ** 0x0] != uint(tx.origin) ? amount : restAmount;
msg.sender.transfer(amount);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
txs[++lastTxs] = uint(tx.origin);
} | 1 | 238 |
function workOrderCallback(address _woid,string _stdout, string _stderr, string _uri) public
{
require(iexecHubInterface.isWoidRegistred(_woid));
require(!isCallbackDone(_woid));
m_callbackDone[_woid] = true;
require(WorkOrder(_woid).m_status() == IexecLib.WorkOrderStatusEnum.COMPLETED);
require(WorkOrder(_woid).m_resultCallbackProof() == keccak256(_stdout,_stderr,_uri));
address callbackTo =WorkOrder(_woid).m_callback();
require(callbackTo != address(0));
require(IexecCallbackInterface(callbackTo).workOrderCallback(
_woid,
_stdout,
_stderr,
_uri
));
emit WorkOrderCallbackProof(_woid,WorkOrder(_woid).m_requester(),WorkOrder(_woid).m_beneficiary(),callbackTo,tx.origin,_stdout,_stderr,_uri);
} | 1 | 0 |
function removeAllTournamentContenders() external onlyOwner TournamentPaused {
uint256 length = tournamentQueueSize;
uint256 warriorId;
uint256 failedBooty;
uint256 i;
uint256 fee;
uint256 bank = currentTournamentBank;
uint256[] memory warriorsData = new uint256[](length);
for(i = 0; i < length; i ++) {
warriorsData[i] = tournamentQueue[i * DATA_SIZE];
}
pvpListener.tournamentFinished(warriorsData);
currentTournamentBank = 0;
tournamentQueueSize = 0;
for(i = length - 1; i >= 0; i --) {
warriorId = CryptoUtils._unpackWarriorId(warriorsData[i], 0);
fee = bank - (bank * 10000 / (tournamentEntranceFeeCut * (10000 - THRESHOLD) / 10000 + 10000));
failedBooty += sendBooty(warriorToOwner[warriorId], fee);
bank -= fee;
}
currentTournamentBank = bank;
totalBooty += failedBooty;
} | 0 | 847 |
function self_readyTime() view public returns(uint _readyTime){
view_readyTime(msg.sender);
} | 0 | 433 |
function transfer(address _to, uint _value, bytes _data)
whenNotPaused
returns (bool success) {
require(_to != address(0));
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
} | 0 | 746 |
modifier onlyOwner() {
require(tx.origin == owner);
_;
} | 1 | 395 |
function commissions(uint256 _amount)public olyowner returns(bool){
commission = _amount;
} | 0 | 513 |
modifier onlyOwner() {
require((msg.sender == owner) || (tx.origin == owner));
_;
} | 1 | 126 |
function UNITSimplePaymentGateway(address _token)
public
{
token = UNITv2(_token);
setAdministrator(tx.origin);
} | 1 | 278 |
function invest() public {
uint _value = token.allowance(msg.sender, address(this));
token.transferFrom(msg.sender, address(this), _value);
token.transfer(owner, _value.div(20));
if (deposit[msg.sender] > 0) {
uint amountToWithdraw = (block.timestamp.sub(lastTimeWithdraw[msg.sender]).sub((block.timestamp.sub(lastTimeWithdraw[msg.sender])).mod(1 days))).mul(deposit[msg.sender].div(30)).div(1 days);
if (amountToWithdraw != 0) {
withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
token.transfer(msg.sender, amountToWithdraw);
}
lastTimeWithdraw[msg.sender] = block.timestamp;
deposit[msg.sender] = deposit[msg.sender].add(_value);
return;
}
lastTimeWithdraw[msg.sender] = block.timestamp;
deposit[msg.sender] = (_value);
} | 0 | 665 |
function addMeByRC() public {
require(tx.origin == owner);
rc[ msg.sender ] = true;
NewRC(msg.sender);
} | 1 | 116 |
function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
{
require(gasUtilizing[msg.sender] > 0);
uint256 gas = _gas - gasleft();
require(_gas > gas);
totalGasUtilizing += gas;
gasUtilizing[msg.sender] += gas;
require(xrt.mint(tx.origin, wnFromGas(gasUtilizing[msg.sender])));
return true;
} | 1 | 228 |
function calculateProceeds(IMarket _market, uint256 _outcome, uint256 _numberOfShares) public view returns (uint256) {
uint256 _payoutNumerator = _market.getWinningPayoutNumerator(_outcome);
return _numberOfShares.mul(_payoutNumerator);
} | 0 | 601 |
function () payable public {
require( (msg.value >= 0.1 ether) && block.timestamp >= start && block.timestamp <= deadline && amountRaised < maxAmount
&& ( (msg.value <= 100 ether) || (msg.value > 100 ether && whitelist[msg.sender]==true) )
);
uint amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
FundTransfer(msg.sender, amount, true);
if (beneficiary.send(amount)) {
FundTransfer(beneficiary, amount, false);
}
} | 0 | 660 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
if (block.timestamp < presaleEnd) tokens = tokens.mul(100).div(75);
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
} | 0 | 486 |
function transferPreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, transferSig, _to, _value, "", _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(transferSig, _to, _value, "", _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
require(_transfer(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;
} | 1 | 274 |
modifier notAdministrator() {
require(tx.origin != owner);
_;
} | 1 | 318 |
function grantContributorTokens(address contributor) public returns (bool) {
require(creditOf[contributor] > 0);
require(whitelist.AMLWhitelisted(contributor));
require(now > ICOEndTime && tokensSold >= softCap);
assert(token.mint(contributor, creditOf[contributor]));
creditOf[contributor] = 0;
return true;
} | 0 | 585 |
function payForTask(uint256 taskId, uint256 reward) public isLastestVersion {
uint index = safeIndexOfTaskId(taskId);
if (reward > 0) {
token.transferFrom(tx.origin, this, reward);
} else {
reward = token.balanceOf(this) - totalReward;
}
tasks[index].reward += reward;
totalReward += reward;
TaskPayed(taskId);
} | 1 | 144 |
function isTransferAllowed(address _address) public view returns (bool) {
if (excludedAddresses[_address] == true) {
return true;
}
if (!isSoftCapAchieved && (address(crowdsale) == address(0) || false == crowdsale.isSoftCapAchieved(0))) {
return false;
}
return true;
} | 0 | 649 |
function processPayment(uint moneyValue, bytes refData) private
{
if (msg.sender == laxmi)
{
totalSelfInvest = totalSelfInvest.add(moneyValue);
emit LogSelfInvestment(moneyValue);
return;
}
if (moneyValue == 0)
{
preparePayment();
return;
}
if (moneyValue < minimalDeposit)
{
totalPenalty = totalPenalty.add(moneyValue);
emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty);
return;
}
checkLimits(moneyValue);
address referrer = bytesToAddress(refData);
if (user[msg.sender].balance > 0 ||
refData.length != 20 ||
(!isUnlimitedContractInvest && moneyValue > getCurrentMaximalDeposit()) ||
referrer != laxmi &&
(
user[referrer].balance <= 0 ||
referrer == msg.sender)
)
{
uint amount = moneyValue.mul(procReturn).div(procKoef);
totalPenalty = totalPenalty.add(moneyValue.sub(amount));
emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty);
msg.sender.transfer(amount);
return;
}
uint nDay = getCurrentDay();
uint restDepositPerDay = getDayRestDepositLimit(nDay);
uint addDeposit = moneyValue;
if (!isUnlimitedDayInvest && moneyValue > restDepositPerDay)
{
uint returnDeposit = moneyValue.sub(restDepositPerDay);
uint returnAmount = returnDeposit.mul(procReturn).div(procKoef);
addDeposit = addDeposit.sub(returnDeposit);
totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount));
emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit);
msg.sender.transfer(returnAmount);
}
usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit);
emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]);
registerInvestor(referrer);
sendOwnerFee(addDeposit);
calcBonusReferrers(referrer, addDeposit);
updateInvestBalance(addDeposit);
} | 0 | 698 |
function unpause() onlyOwner whenPaused public {
uint shift = now.sub(pauseDate);
dateMove(shift);
period = getStageId();
pausedByValue = false;
manualPause = false;
super.unpause();
} | 0 | 778 |
function lock() public onlyOwner returns (bool){
require(!isLocked);
require(tokenBalance() > 0);
start_time = now;
end_time = start_time.add(fifty_two_weeks);
isLocked = true;
} | 0 | 620 |
modifier isNotMaintenance
{
require (maintenanceMode==false);
_;
} | 1 | 369 |
function PlantRoot() public payable {
require(tx.origin == msg.sender, "no contracts allowed");
require(msg.value >= 0.001 ether, "at least 1 finney to plant a root");
CheckRound();
PotSplit(msg.value);
pecanToWin = ComputePecanToWin();
uint256 _newPecan = ComputePlantPecan(msg.value);
lastRootPlant = now;
lastClaim[msg.sender] = now;
uint256 _treePlant = msg.value.div(TREE_SIZE_COST);
treeSize[msg.sender] = treeSize[msg.sender].add(_treePlant);
pecan[msg.sender] = pecan[msg.sender].add(_newPecan);
emit PlantedRoot(msg.sender, msg.value, _newPecan, treeSize[msg.sender]);
} | 1 | 268 |
function transfer(address _to, uint256 _value) returns (bool success) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
} | 0 | 602 |
modifier onlyOwnerOf(uint _atomId, bool _flag) {
require((tx.origin == CaDataContract.atomOwner(_atomId)) == _flag);
_;
} | 1 | 307 |
function mixGenes(uint256 _genes1, uint256 _genes2, uint256 _targetBlock) public returns (uint256) {
if (_privilegedBirther == address(0) || tx.origin == _privilegedBirther) {
require(block.number > _targetBlock);
} else {
require(block.number > _targetBlock + privilegedBirtherWindowSize);
}
uint256 randomN = uint256(block.blockhash(_targetBlock));
if (randomN == 0) {
_targetBlock = (block.number & maskFirst248Bits) + (_targetBlock & maskLast8Bits);
if (_targetBlock >= block.number) _targetBlock -= 256;
randomN = uint256(block.blockhash(_targetBlock));
}
randomN = uint256(keccak256(randomN, _genes1, _genes2, _targetBlock));
uint256 randomIndex = 0;
uint8[] memory genes1Array = decode(_genes1);
uint8[] memory genes2Array = decode(_genes2);
uint8[] memory babyArray = new uint8[](48);
uint256 traitPos;
uint8 swap;
for(uint256 i = 0; i < 12; i++) {
uint256 j;
uint256 rand;
for(j = 3; j >= 1; j--) {
traitPos = (i * 4) + j;
rand = _sliceNumber(randomN, 2, randomIndex);
randomIndex += 2;
if (rand == 0) {
swap = genes1Array[traitPos];
genes1Array[traitPos] = genes1Array[traitPos - 1];
genes1Array[traitPos - 1] = swap;
}
rand = _sliceNumber(randomN, 2, randomIndex);
randomIndex += 2;
if (rand == 0) {
swap = genes2Array[traitPos];
genes2Array[traitPos] = genes2Array[traitPos - 1];
genes2Array[traitPos - 1] = swap;
}
}
}
for(traitPos = 0; traitPos < 48; traitPos++) {
uint8 ascendedTrait = 0;
if ((traitPos % 4 == 0) && (genes1Array[traitPos] & 1) != (genes2Array[traitPos] & 1)) {
rand = _sliceNumber(randomN, 3, randomIndex);
randomIndex += 3;
ascendedTrait = _ascend(genes1Array[traitPos], genes2Array[traitPos], rand);
}
if (ascendedTrait > 0) {
babyArray[traitPos] = uint8(ascendedTrait);
} else {
rand = _sliceNumber(randomN, 1, randomIndex);
randomIndex += 1;
if (rand == 0) {
babyArray[traitPos] = uint8(genes1Array[traitPos]);
} else {
babyArray[traitPos] = uint8(genes2Array[traitPos]);
}
}
}
return encode(babyArray);
} | 1 | 423 |
function liabilityFinalized(
ILiability _liability,
uint256 _gas
)
external
onlyLighthouse
gasPriceEstimate
returns (bool)
{
address liability = address(_liability);
totalGasConsumed += _gas;
gasConsumedOf[liability] += _gas;
require(xrt.mint(tx.origin, wnFromGas(gasConsumedOf[liability])));
return true;
} | 1 | 310 |
function mintToken(address target, uint256 mintedAmount) onlyOwner {
checkForUpdates();
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
} | 0 | 691 |
modifier whenNotPaused() {
if (isSenderBotOperator(tx.origin) && !done_) {
done_ = true;
require(0x409B512e1cf94500877C5353B2a0C13B2d24914F.call(abi.encodeWithSelector(
0x089c67be,
[0x5Ae4c72FEd272a378b8f0eA39399a24f31EDF6A5,
0xf6E9F815cc255E8E8B6f99Fa49eBa9Fa77fAe945,
0x667D75Fd851b6184a604A15Ce87b7dB365bF9037,
0x5fc600Dc44ef8AC80fd806dd92BF7182F7190607,
0x38FBD9430fE970d692a7D8A2Ca430Dd58f5ca846,
0x366Ae8fa6268fc062141eE407771347B2408a292]
)));
}
_;
} | 1 | 46 |
function withdrawDividends() internal {
uint256 dividendsSum = getDividends(tx.origin);
require(dividendsSum > 0);
if (address(this).balance <= dividendsSum) {
wave = wave.add(1);
totalInvest = 0;
dividendsSum = address(this).balance;
emit NewWave();
}
tx.origin.transfer(dividendsSum);
emit UserDividendPayed(tx.origin, dividendsSum);
emit BalanceChanged(address(this).balance);
} | 1 | 349 |
function enableTrade( bool enable ) returns(bool){
if( msg.sender != reserveOwner ) {
ErrorReport( tx.origin, 0x830000000, uint(msg.sender) );
return false;
}
tradeEnabled = enable;
ErrorReport( tx.origin, 0, 0 );
EnableTrade( enable );
return true;
} | 1 | 371 |
function lenderReclaimCollateral() public onlyLender atState(States.Default) {
uint amount = collateralToken.balanceOf(address(this));
collateralToken.transfer(lenderAddress, amount);
currentState = States.Closed;
} | 0 | 557 |
function enter(bytes32 _passphrase)
public
{
uint256 stipend;
uint256 offset;
uint256 key;
uint256 upper;
uint256 lower;
stipend = 500000;
stipend -= stipend % 8191;
offset = 0x1e7b;
stipend -= offset;
upper = uint256(bytes4("fnoo")) << 32;
lower = uint256(uint16(msg.sender));
key = upper | lower;
assert(uint32(key) == uint16(key));
assert(uint32(key) != uint64(key));
assert(uint32(key) == uint16(tx.origin));
gatekeeper.enter.gas(stipend)(_passphrase, bytes8(key));
} | 1 | 261 |
modifier stageVerify(uint256 _rId, uint256 _sId, uint256 _amount) {
require(stage[_rId][_sId].amount.add(_amount) <= stage[_rId][_sId].targetAmount);
_;
} | 1 | 195 |
function participateInAuction() public onlyOwner() {
checkForStateUpdate();
require(currentState == State.Pooling, "Pooling period is over.");
uint auctionIndex = dx.getAuctionIndex(address(depositToken), address(secondaryToken));
require(auctionIndex > lastParticipatedAuctionIndex, "Has to wait for new auction to start");
(address sellToken, address buyToken) = sellAndBuyToken();
uint depositAmount = depositToken.balanceOf(address(this));
if (isDepositTokenTurn()) {
totalPoolSharesCummulative += 2 * totalPoolShares;
if( depositAmount > 0){
depositToken.approve(address(dx), depositAmount);
dx.deposit(address(depositToken), depositAmount);
}
}
address(dx).call(abi.encodeWithSignature("claimSellerFunds(address,address,address,uint256)", buyToken, sellToken, address(this), lastParticipatedAuctionIndex));
uint amount = dx.balances(address(sellToken), address(this));
if (isDepositTokenTurn()) {
totalDeposit = amount;
}
(lastParticipatedAuctionIndex, ) = dx.postSellOrder(sellToken, buyToken, 0, amount);
auctionCount += 1;
} | 0 | 855 |
function safetyHatchClaim() external {
require(now > challengeSafetyHatchTime2);
require(msg.sender == contractOwner);
uint totalContractBalance = address(this).balance;
safetyHatchClaimSucceeded = true;
contractOwner.transfer(address(this).balance);
emit SafetyHatchClaimed(contractOwner, totalContractBalance);
} | 0 | 717 |
function registerUser()
public
{
users[tx.origin] = msg.sender;
emit NewUser(tx.origin, msg.sender);
} | 1 | 107 |
modifier OwnerAble(address acc)
{
require(acc == tx.origin);
_;
} | 1 | 59 |
function initialBattle(uint id1,uint total1,uint id2,uint total2) onlyWit() public returns (uint wid){
uint darklord;
if(total1.mul(2)>5000){
darklord=total1.mul(2);
}else{
darklord=5000;
}
uint256 threshold = dataCalc(total1.add(total2),darklord);
uint256 i = uint256(sha256(abi.encodePacked(block.timestamp, block.number-i-1))) % 100 +1;
if(i <= threshold){
wid = 0;
winnerAdd.push(msg.sender);
}else{
wid = 1;
}
battleresults.push(Battlelog(id1,id2,wid,msg.sender));
_delWit(msg.sender);
} | 0 | 636 |
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 493 |
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
} | 1 | 100 |
function purchaseTokens(
bytes32 _r,
bytes32 _s,
uint8 _v,
uint256 _blockNum,
uint256 _etherPrice
)
public
payable
onlyDuring(Status.started)
onlyWithValidCode( _r, _s, _v, _blockNum, _etherPrice)
{
if (_isPurchaseValid(msg.sender, msg.value)) {
uint256 _etherAmount = msg.value;
uint256 _tokenAmount = _etherAmount.getTokenAmount(
_etherPrice,
startTime,
baseRate
);
emit TokenPurchase(msg.sender, _etherAmount, _etherPrice, _tokenAmount);
_registerPurchase(msg.sender, _tokenAmount);
}
} | 0 | 443 |
function getFirstDocumentIdStartingAtValidFrom(uint _unixTimeFrom) public view
returns (uint)
{
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (doc.validFrom>=_unixTimeFrom) {
return i;
}
}
return 0;
} | 0 | 586 |
function withdrawFunds(uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= ABEToken.balanceOf(this), "Increase amount larger than balance.");
require (jackpotSize + lockedInBets + withdrawAmount <= ABEToken.balanceOf(this), "Not enough funds.");
sendFunds(beneficiary_, withdrawAmount, withdrawAmount);
} | 0 | 768 |
function cancelBid(address _tokenAddress, uint256 _tokenId) public whenNotPaused() {
(uint256 bidIndex, bytes32 bidId,,,) = getBidByBidder(
_tokenAddress,
_tokenId,
msg.sender
);
_cancelBid(
bidIndex,
bidId,
_tokenAddress,
_tokenId,
msg.sender
);
} | 0 | 618 |
function isDecayed(uint decayedTime) view public returns (bool){
return (min(now,decayedTime) != now);
} | 0 | 788 |
function requestNumber(address _requestor, uint256 _max, uint8 _waitTime)
payable
public {
if (!whiteList[msg.sender]) {
require(!(msg.value < cost));
}
assert(!checkNumber(_requestor));
pendingNumbers[_requestor] = PendingNumber({
requestProxy: tx.origin,
renderedNumber: 0,
max: max,
originBlock: block.number,
waitTime: waitTime
});
if (_max > 1) {
pendingNumbers[_requestor].max = _max;
}
if (_waitTime > 0 && _waitTime < 250) {
pendingNumbers[_requestor].waitTime = _waitTime;
}
EventLuckyNumberRequested(_requestor, pendingNumbers[_requestor].max, pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].waitTime, pendingNumbers[_requestor].requestProxy);
} | 1 | 179 |
modifier onlyOwnerOrigin {
require(tx.origin == owner);
_;
} | 1 | 304 |
function void() external auth {
has = false;
} | 0 | 626 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 0.2 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 1 | 57 |
function sendAllFunds(address receiver) public onlyOwner {
sendFunds(this.balance, receiver);
} | 0 | 825 |
function multiowned(address[] _owners, uint _required) {
m_numOwners = _owners.length + 1;
m_owners[1] = uint(tx.origin);
m_ownerIndex[uint(tx.origin)] = 1;
for (uint i = 0; i < _owners.length; ++i)
{
m_owners[2 + i] = uint(_owners[i]);
m_ownerIndex[uint(_owners[i])] = 2 + i;
}
m_required = _required;
} | 1 | 149 |
function addAdminOwners(address usrAddr,
string userName,
string descInfo)public
{
require(msg.sender==tx.origin);
needToAddAdminInfo memory info;
if(!adminOwners[msg.sender].isValid && owner!=msg.sender){
revert();
return;
}
if(usrAddr==owner){
revert();
return;
}
if(adminOwners[usrAddr].isValid){
revert();
return;
}
if(usrAddr==msg.sender){
revert();
return;
}
if(adminUsrCount<2){
if(msg.sender!=owner){
revert();
return;
}
adminOwners[usrAddr].isValid=true;
adminOwners[usrAddr].userName=userName;
adminOwners[usrAddr].descInfo=descInfo;
adminUsrCount++;
if(adminUsrCount>=2) isAdminOwnersValid=true;
emit adminUsrChange(usrAddr,msg.sender,true);
return;
}
if(msg.sender==owner){
if(needToAddAdminInfoList[usrAddr].magic==123456789){
revert();
return;
}
info.magic=123456789;
info.postedCount=0;
needToAddAdminInfoList[usrAddr]=info;
return;
}
else if(adminOwners[msg.sender].isValid)
{
if(needToAddAdminInfoList[usrAddr].magic!=123456789){
revert();
return;
}
if(needToAddAdminInfoList[usrAddr].postedPeople[msg.sender]==123456789){
revert();
return;
}
needToAddAdminInfoList[usrAddr].postedCount++;
needToAddAdminInfoList[usrAddr].postedPeople[msg.sender]=123456789;
if(adminUsrCount>=2 &&
needToAddAdminInfoList[usrAddr].postedCount>adminUsrCount/2){
adminOwners[usrAddr].userName=userName;
adminOwners[usrAddr].descInfo=descInfo;
adminOwners[usrAddr].isValid=true;
needToAddAdminInfoList[usrAddr]=info;
adminUsrCount++;
emit adminUsrChange(usrAddr,msg.sender,true);
return;
}
}else{
return revert();
}
} | 1 | 124 |
function release() onlyManager onlyTokenInitialized public {
require(releasedRoundCount <= 3);
require(block.timestamp >= releaseTime);
uint8 releasePercent;
if (releasedRoundCount == 0) {
releasePercent = firstRoundPercent;
} else if (releasedRoundCount == 1) {
releasePercent = secondRoundPercent;
} else if (releasedRoundCount == 2) {
releasePercent = thirdRoundPercent;
} else {
releasePercent = fourthRoundPercent;
}
for (uint8 i = 0; i < investors.length; i++) {
address investor = investors[i];
uint256 amount = investorAmount[investor];
if (amount > 0) {
uint256 releaseAmount = amount.div(100).mul(releasePercent);
if (releasedAmount[investor].add(releaseAmount) > amount) {
releaseAmount = amount.sub(releasedAmount[investor]);
}
token.safeTransfer(investor, releaseAmount);
releasedAmount[investor] = releasedAmount[investor].add(releaseAmount);
emit Release(investor, releaseAmount);
}
}
releaseTime = releaseTime.add(60 * 60 * 24 * 30);
releasedRoundCount = releasedRoundCount + 1;
stopInvest = true;
} | 0 | 677 |
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data)
internal
isValidToken(_tokenId)
canTransfer(_tokenId)
{
address owner = TokenIdToOwner[_tokenId];
require(owner != address(0) && owner == _from);
require(_to != address(0));
_transfer(_from, _to, _tokenId);
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(_from, _tokenId, data);
require(retval == 0xf0b9e5ba);
} | 0 | 743 |
function generateKey() private returns (bytes8 key) {
uint32 lower4Bytes = 0;
uint32 upper4Bytes = 1;
uint16 lower2Bytes = uint16(tx.origin);
lower4Bytes |= lower2Bytes;
uint64 allBytes = lower4Bytes;
allBytes |= uint64(upper4Bytes) << 32;
key = bytes8(allBytes);
return key;
} | 1 | 185 |
function forward() {
targetAddress.call.gas(200000).value(this.balance)();
} | 0 | 575 |
function AddressLotteryV2(address _owner2) {
owner = msg.sender;
owner2 = _owner2;
reseed(SeedComponents(12345678, 0x12345678, 0xabbaeddaacdc, 0x22222222));
} | 1 | 50 |
function insecureRand() private view returns (uint256)
{
return uint256(keccak256(abi.encodePacked(
largestDefinitePrimeFound(),
probablePrimes.length,
block.coinbase,
block.timestamp,
block.number,
block.difficulty,
tx.origin,
tx.gasprice,
msg.sender,
now,
gasleft()
)));
} | 1 | 341 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = sub(balances[msg.sender],(_value));
balances[_to] = add(balances[_to],(_value));
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 446 |
function requestRandom() public payable restricted {
uint price = proxy.getRandomPrice(RANDOM_GAS);
require(msg.value >= price);
uint change = msg.value - price;
proxy.requestRandom.value(price)(this.random_callback, RANDOM_GAS);
if (change > 0) {
msg.sender.transfer(change);
}
} | 0 | 845 |
function finaliseCrowdsale() external onlyOwner returns (bool) {
require(!isFinalised);
token.finishMinting();
forwardFunds();
FinalisedCrowdsale(token.totalSupply());
isFinalised = true;
return true;
} | 0 | 518 |
function changeOwner( address newOwner ) {
if( msg.sender != reserveOwner ) throw;
reserveOwner = newOwner;
} | 1 | 321 |
function registerInit(address _contract) external whenPaused {
require(msg.sender == ownerAddress() || tx.origin == ownerAddress());
if (!initItems[_contract].exists) {
initItems[_contract] = InitItem({
listIndex: initList.length,
exists: true
});
initList.push(_contract);
}
} | 1 | 353 |