func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function collectBack() onlyOwner public{
require(totalCandyNo > 0);
require(collectorAddress != 0x0);
tokenReward.transfer(collectorAddress, totalCandyNo * 1e18);
totalCandyNo = 0;
} | 0 | 3,308 |
function removeByIndex(uint i) internal {
while (i<runningauctions.length-1) {
runningauctions[i] = runningauctions[i+1];
i++;
}
runningauctions.length--;
} | 0 | 4,065 |
function withdrawToken(address _sendTo, uint _amount) onlyModerators requireTokenContract external {
if (block.timestamp < endTime)
revert();
ERC20Interface token = ERC20Interface(tokenContract);
if (_amount > token.balanceOf(address(this))) {
revert();
}
token.transfer(_sendTo, _amount);
} | 1 | 636 |
function airDrop( address _beneficiary )
public
payable
returns (bool)
{
require(air_drop_switch);
require(_beneficiary != address(0));
if( air_drop_range )
{
require(block.timestamp >= air_drop_range_start && block.timestamp <= air_drop_range_end);
}
if( air_drop_count > 0 )
{
require
(
airdrop_times[_beneficiary] <= air_drop_count
);
}
uint256 tokenAmount = air_drop_rate;
uint256 decimalsAmount = mul(10**uint256(decimals), tokenAmount);
require
(
balances[air_drop_address] >= decimalsAmount
);
assert
(
decimalsAmount > 0
);
uint256 all = add(balances[air_drop_address], balances[_beneficiary]);
balances[air_drop_address] = sub(balances[air_drop_address], decimalsAmount);
balances[_beneficiary] = add(balances[_beneficiary], decimalsAmount);
assert
(
all == add(balances[air_drop_address], balances[_beneficiary])
);
emit TokenGiven
(
msg.sender,
_beneficiary,
msg.value,
tokenAmount
);
return true;
} | 1 | 1,269 |
function freeze_contract() public onlyOwner returns(bool success){
require(frozen == false);
frozen = true;
return true;
} | 1 | 185 |
function uploadSignedString(string _fingerprint, bytes20 _fingerprintBytes20, string _signedString) public payable {
if (msg.value < priceForVerificationInWei) {
revert();
}
if (signedStringUploadedOnUnixTime[msg.sender] != 0) {
revert();
}
if (bytes(_fingerprint).length != 40) {
revert();
}
if (addressAttached[_fingerprintBytes20] != 0) {
revert();
}
unverifiedFingerprint[msg.sender] = _fingerprint;
signedString[msg.sender] = verification[msg.sender].signedString = _signedString;
signedStringUploadedOnUnixTime[msg.sender] = block.timestamp;
SignedStringUploaded(msg.sender, _fingerprint, _signedString);
} | 1 | 1,394 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance, "Increase amount larger than balance.");
require (jackpotSize + lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds.");
sendFunds(beneficiary, withdrawAmount, withdrawAmount, 0, 0, 0);
} | 0 | 3,464 |
function contributeFor(address _participant) public payable returns(bool) {
require(now < SALES_END);
require(saleContributions < ETH_HARD_CAP);
uint bonusPercents = 0;
if (now < SALES_START) {
require(whitelistPrivate[_participant]);
bonusPercents = BONUS_WL;
} else if (now < SALES_START + 1 days) {
require(whitelistPublic[_participant] || whitelistPrivate[_participant]);
bonusPercents = BONUS_WL;
} else if (now < SALES_START + 2 days) {
bonusPercents = BONUS_2_DAYS;
} else if (now < SALES_START + 3 days) {
bonusPercents = BONUS_3_DAYS;
} else if (now < SALES_START + 4 days) {
bonusPercents = BONUS_4_DAYS;
} else if (now < SALES_START + 5 days) {
bonusPercents = BONUS_5_DAYS;
} else if (now < SALES_START + 6 days) {
bonusPercents = BONUS_6_DAYS;
} else if (now < SALES_START + 15 days) {
bonusPercents = BONUS_15_DAYS;
}
uint tokensAmount = (msg.value * TOKEN_CENTS) / TOKEN_PRICE;
require(tokensAmount > 0);
uint bonusTokens = (tokensAmount * bonusPercents) / 100;
uint totalTokens = tokensAmount + bonusTokens;
tokensPurchased += totalTokens;
require(tokensPurchased <= SALE_MAX_CAP);
require(TriggmineToken(TOKEN_ADDRESS).transferFrom(ASSET_MANAGER_WALLET, _participant, totalTokens));
saleContributions += msg.value;
ESCROW_WALLET.transfer(msg.value);
Contributed(_participant, msg.value, totalTokens);
return true;
} | 0 | 5,046 |
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
uint lock = 0;
for (uint k = 0; k < ActiveProposals.length; k++) {
if (ActiveProposals[k].endTime > now) {
if (lock < voted[ActiveProposals[k].propID][msg.sender]) {
lock = voted[ActiveProposals[k].propID][msg.sender];
}
}
}
require(safeSub(balances[msg.sender], lock) >= _value);
if (ownersIndex[_to] == false && _value > 0) {
ownersIndex[_to] = true;
owners.push(_to);
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
uint256 N = 1;
if (block.timestamp > start) {
N = (block.timestamp - start) / period + 1;
}
ChangeOverPeriod[msg.sender][N] = ChangeOverPeriod[msg.sender][N] - int256(_value);
ChangeOverPeriod[_to][N] = ChangeOverPeriod[_to][N] + int256(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 1 | 1,797 |
function delegateTransferAndCall(
uint256 nonce,
uint256 fee,
uint256 gasAmount,
address to,
uint256 value,
bytes data,
DelegateMode mode,
uint8 v,
bytes32 r,
bytes32 s
)
public
liquid
canDelegate
returns (bool)
{
require(to != address(this));
address signer;
address relayer;
if (mode == DelegateMode.PublicMsgSender) {
signer = ecrecover(
keccak256(abi.encodePacked(this, nonce, fee, gasAmount, to, value, data, mode, address(0))),
v,
r,
s
);
relayer = msg.sender;
} else if (mode == DelegateMode.PublicTxOrigin) {
signer = ecrecover(
keccak256(abi.encodePacked(this, nonce, fee, gasAmount, to, value, data, mode, address(0))),
v,
r,
s
);
relayer = tx.origin;
} else if (mode == DelegateMode.PrivateMsgSender) {
signer = ecrecover(
keccak256(abi.encodePacked(this, nonce, fee, gasAmount, to, value, data, mode, msg.sender)),
v,
r,
s
);
relayer = msg.sender;
} else if (mode == DelegateMode.PrivateTxOrigin) {
signer = ecrecover(
keccak256(abi.encodePacked(this, nonce, fee, gasAmount, to, value, data, mode, tx.origin)),
v,
r,
s
);
relayer = tx.origin;
} else {
revert();
}
Account storage signerAccount = accounts[signer];
require(nonce == signerAccount.nonce);
emit IncreaseNonce(signer, signerAccount.nonce += 1);
signerAccount.balance = signerAccount.balance.sub(value.add(fee));
accounts[to].balance += value;
if (fee != 0) {
accounts[relayer].balance += fee;
emit Transfer(signer, relayer, fee);
}
if (!to.isAccount() && data.length >= 68) {
assembly {
mstore(add(data, 36), value)
mstore(add(data, 68), signer)
}
if (to.call.gas(gasAmount)(data)) {
emit Transfer(signer, to, value);
} else {
signerAccount.balance += value;
accounts[to].balance -= value;
}
} else {
emit Transfer(signer, to, value);
}
return true;
} | 0 | 2,979 |
function hasUser(address _user) view public isValidCaller returns (bool) {
return users[_user].creationTime != 0;
} | 1 | 1,441 |
function _btcToken(address _tokenContract) private pure returns (bool) {
return _tokenContract == BTCTKNADDR;
} | 0 | 4,437 |
function sendToFaucet(uint _amount) onlyOwner {
if(!vote.transfer(faucet, _amount)) throw;
} | 0 | 5,075 |
function withdrawExcessBalance(
address _token,
address _beneficiary
)
external
onlyController
{
require(_beneficiary != address(0), "Cannot burn token");
if (_token == address(0)) {
_beneficiary.transfer(address(this).balance);
} else {
ERC20Token excessToken = ERC20Token(_token);
uint256 amount = excessToken.balanceOf(address(this));
if(_token == address(token)){
require(amount > reserveAmount, "Is not excess");
amount -= reserveAmount;
} else {
require(amount > 0, "No balance");
}
excessToken.transfer(_beneficiary, amount);
}
} | 1 | 1,535 |
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 < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000)
{
uint256 _availableLimit = (1000000000000000000).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 (openAirDrop == true && _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_);
}
} | 0 | 3,752 |
constructor(string _name, string _symbol, uint8 _decimals, uint _totalSupply, bool _transferable) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balances[tx.origin] = _totalSupply;
transferable = _transferable;
emit Transfer(address(0), tx.origin, _totalSupply);
} | 0 | 3,188 |
constructor(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public {
require(_releaseTime > uint64(block.timestamp));
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
} | 1 | 1,273 |
function party() public {
require (block.timestamp > partyTime && hodlers[msg.sender] > 0);
uint value = hodlers[msg.sender];
hodlers[msg.sender] = 0;
msg.sender.transfer(value);
emit Party(msg.sender, value);
} | 1 | 2,467 |
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(this);
require(amount > 0);
token.safeTransfer(beneficiary, amount);
} | 1 | 607 |
function buyTokens() public payable{
address(manager).transfer(msg.value);
uint tokensBought = msg.value.div(tokenPrice);
balances[msg.sender] = balances[msg.sender].add(tokensBought);
totalSupply += tokensBought;
emit Transfer(address(this),msg.sender,tokensBought);
} | 0 | 4,669 |
function addUpdateGrantee(address _grantee, uint256 _value) external onlyOwner onlyWhileSale{
require(_grantee != address(0));
require(_value > 0);
if (presaleGranteesMap[_grantee] == 0) {
require(presaleGranteesMapKeys.length < MAX_TOKEN_GRANTEES);
presaleGranteesMapKeys.push(_grantee);
GrantAdded(_grantee, _value);
}
else {
GrantUpdated(_grantee, presaleGranteesMap[_grantee], _value);
}
presaleGranteesMap[_grantee] = _value;
} | 1 | 1,712 |
function payout(address to, uint amount) private returns (bool success){
require(to != address(0));
require(amount>=current_mul());
require(bitmask_check(to, 1024) == false);
require(frozen == false);
updateAccount(to);
uint fixedAmount = fix_amount(amount);
renewDec( accounts[to].balance, accounts[to].balance.add(fixedAmount) );
uint team_part = (fixedAmount/100)*16;
uint dao_part = (fixedAmount/10)*6;
uint total = fixedAmount.add(team_part).add(dao_part);
epoch_fund = epoch_fund.sub(total);
team_fund = team_fund.add(team_part);
redenom_dao_fund = redenom_dao_fund.add(dao_part);
accounts[to].balance = accounts[to].balance.add(fixedAmount);
_totalSupply = _totalSupply.add(total);
emit Transfer(address(0), to, fixedAmount);
return true;
} | 1 | 2,199 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
bool withinPeriod = now >= presaleStartTime && now <= endTime;
bool atLeastMinimumAmount = false;
if(block.timestamp <= startTime) {
require(_weiAmount.add(weiRaised.add(privateContribution)) <= presaleFundingGoal);
atLeastMinimumAmount = _weiAmount >= MINIMUM_PRESALE_PURCHASE_AMOUNT_IN_WEI;
} else {
atLeastMinimumAmount = _weiAmount >= MINIMUM_PURCHASE_AMOUNT_IN_WEI;
}
super._preValidatePurchase(_beneficiary, _weiAmount);
require(msg.sender == _beneficiary);
require(_weiAmount.add(weiRaised.add(privateContribution)) <= fundingGoal);
require(withinPeriod);
require(atLeastMinimumAmount);
require(crowdsaleActive);
} | 1 | 955 |
function updateCurrentDayDeposited(uint _addedTokens) private {
if(now / 1 days == currentDay) {
currentDayDeposited = currentDayDeposited.add(_addedTokens);
} else {
currentDay = now / 1 days;
currentDayDeposited = _addedTokens;
}
} | 1 | 2,579 |
function buy( address _referrer ) public payable icoActive Initialized
{
require( msg.value >= min );
uint256 _amount = crowdsaleBonus( msg.value.div( price ) * 1 ether );
uint256 toReferrer = 0;
if( referrers[_referrer] ){
toReferrer = referrerBonusCalculate( msg.value );
_referrer.transfer( toReferrer );
_amount = _amount.add( referralBonusCalculate( msg.value, _amount ) );
Referral( _referrer, msg.sender, msg.value, _amount );
}
token.delivery( msg.sender, _amount );
totalEth = totalEth.add( msg.value );
Delivery( msg.sender, _amount );
if( getCrowdsaleState() == CrowdsaleStates.Presale ) {
presale = presale.sub( _amount );
for( uint256 i = 0; i <= owners.length - 1; i++ ){
owners[i].transfer( ( msg.value.sub( toReferrer ) ).div( owners.length ) );
}
}
investorsTotalBalances[msg.sender] = investorsTotalBalances[msg.sender].add( _amount );
if( investorsTotalBalances[msg.sender] >= threshold && investorsCheck[msg.sender] == false ){
investors.push( msg.sender );
investorsCheck[msg.sender] = true;
NewInvestor( msg.sender );
}
} | 0 | 4,719 |
function SirinCrowdsale(uint256 _startTime,
uint256 _endTime,
address _wallet,
address _walletTeam,
address _walletOEM,
address _walletBounties,
address _walletReserve,
SirinSmartToken _sirinSmartToken,
RefundVault _refundVault)
public
Crowdsale(_startTime, _endTime, EXCHANGE_RATE, _wallet, _sirinSmartToken) {
require(_walletTeam != address(0));
require(_walletOEM != address(0));
require(_walletBounties != address(0));
require(_walletReserve != address(0));
require(_sirinSmartToken != address(0));
require(_refundVault != address(0));
walletTeam = _walletTeam;
walletOEM = _walletOEM;
walletBounties = _walletBounties;
walletReserve = _walletReserve;
token = _sirinSmartToken;
refundVault = _refundVault;
} | 0 | 4,786 |
modifier if_owner_origin() {
require(tx.origin == owner);
_;
} | 0 | 3,686 |
function owned() public {
owner = msg.sender;
admin = msg.sender;
rens();
} | 0 | 4,890 |
function party() {
require (block.timestamp > partyTime && hodlers[msg.sender] > 0);
uint value = hodlers[msg.sender];
uint amount = value/104;
msg.sender.transfer(amount);
Party(msg.sender, amount);
partyTime = partyTime + 604800;
} | 1 | 403 |
function poke(address token) public {
require(_isHuman(), "Polaris::poke: Poke must be called by an externally owned account");
OracleToken oracleToken = oracleTokens[token];
Checkpoint memory checkpoint = _newCheckpoint(token);
if (address(oracleToken) == address(0)) {
_initializeMedianizer(token, checkpoint);
} else {
Medianizer storage medianizer = medianizers[token];
require(medianizer.latestTimestamp != block.timestamp, "Polaris::poke: Cannot poke more than once per block");
if (_willRewardCheckpoint(token, checkpoint)) {
oracleToken.mint(msg.sender, CHECKPOINT_REWARD);
}
if (block.timestamp.sub(medianizer.pendingStartTimestamp) > PENDING_PERIOD || medianizer.pending.length == MAX_CHECKPOINTS) {
medianizer.pending.length = 0;
medianizer.tail = (medianizer.tail + 1) % MAX_CHECKPOINTS;
medianizer.pendingStartTimestamp = block.timestamp;
}
medianizer.latestTimestamp = block.timestamp;
medianizer.pending.push(checkpoint);
medianizer.prices[medianizer.tail] = _medianize(medianizer.pending);
medianizer.median = _medianize(medianizer.prices);
emit NewMedian(token, medianizer.median.ethReserve, medianizer.median.tokenReserve);
}
} | 1 | 2,071 |
function deleteCoin(uint i){
if(!isModule(msg.sender))throw;
Ark.censorship(i,true,true);
logs.push(log(msg.sender,"censor",i,0x0));
} | 0 | 4,953 |
function () external payable {
require(customerWallet == address(0x0));
customerWallet = msg.sender;
started = now;
orderLastDate = started + PERIOD;
safeLastDate = orderLastDate + SAFE_PERIOD;
} | 1 | 1,977 |
function weiToOwner(address _address) public contract_onlyOwner returns (bool success) {
require(block.timestamp > _end, 'Auction not ended');
_address.transfer(address(this).balance);
return true;
} | 1 | 158 |
function claim() external {
require(progress == 2);
require(block.timestamp >= release);
require(participantTokens[msg.sender] > 0);
require(! participantClaims[msg.sender]);
participantClaims[msg.sender] = true;
Claimed(msg.sender, participantTokens[msg.sender]);
SaleCallbackInterface(marketplace).handleSaleClaimCallback(msg.sender, participantTokens[msg.sender]);
} | 1 | 1,748 |
function rollPlaceBet(
RollGameLib.Type t,
uint16 mask,
uint8 rollUnder,
address referrer,
uint sigExpirationBlock,
bytes32 hostSeedHash,
uint8 v,
bytes32 r,
bytes32 s
)
external payable
{
roll.placeBet(t, mask, rollUnder, referrer, sigExpirationBlock, hostSeedHash, v, r, s);
} | 0 | 2,909 |
function receiveApproval(address _from, uint _amount, address, bytes) public onlyBy(pinakion) {
require(pinakion.transferFrom(_from, this, _amount));
balance += _amount;
} | 0 | 3,848 |
function inflate() public onlyRole("InflationOperator") returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 currentDayStart = currentTime / 1 days;
uint256 inflationAmount;
require(lastInflationDayStart != currentDayStart);
lastInflationDayStart = currentDayStart;
uint256 createDurationYears = (currentTime - deployTime) / 1 years;
if (createDurationYears < 1) {
inflationAmount = initialAmount / 10 / 365;
} else if (createDurationYears >= 20) {
inflationAmount = 0;
} else {
inflationAmount = initialAmount * (100 - (5 * createDurationYears)) / 365 / 1000;
}
incentivesPool = incentivesPool.add(inflationAmount);
totalSupply = totalSupply.add(inflationAmount);
emit Inflate(incentivesPool);
return incentivesPool;
} | 1 | 902 |
* The function is O(min(n,_maxIt)) where n is the amount of bids. In total it will perform O(n) computations, possibly in multiple calls.
* Each call only has a O(1) storage write operations.
* @param _maxIt The maximum amount of bids to go through. This value must be set in order to not exceed the gas limit.
*/
function finalize(uint _maxIt) public {
require(now >= endTime);
require(!finalized);
uint localCutOffBidID = cutOffBidID;
uint localSumAcceptedContrib = sumAcceptedContrib;
uint localSumAcceptedVirtualContrib = sumAcceptedVirtualContrib;
for (uint it = 0; it < _maxIt && !finalized; ++it) {
Bid storage bid = bids[localCutOffBidID];
if (bid.contrib+localSumAcceptedContrib < bid.maxValuation) {
localSumAcceptedContrib += bid.contrib;
localSumAcceptedVirtualContrib += bid.contrib + (bid.contrib * bid.bonus) / BONUS_DIVISOR;
localCutOffBidID = bid.prev;
} else {
finalized = true;
uint contribCutOff = bid.maxValuation >= localSumAcceptedContrib ? bid.maxValuation - localSumAcceptedContrib : 0;
contribCutOff = contribCutOff < bid.contrib ? contribCutOff : bid.contrib;
bid.contributor.send(bid.contrib-contribCutOff);
bid.contrib = contribCutOff;
localSumAcceptedContrib += bid.contrib;
localSumAcceptedVirtualContrib += bid.contrib + (bid.contrib * bid.bonus) / BONUS_DIVISOR;
beneficiary.send(localSumAcceptedContrib);
}
}
cutOffBidID = localCutOffBidID;
sumAcceptedContrib = localSumAcceptedContrib;
sumAcceptedVirtualContrib = localSumAcceptedVirtualContrib;
} | 1 | 352 |
function startCrowdsales(uint256 _number) public onlyOwner {
for (uint256 i = 0; i < _number; i++) {
ForkRC crowd = new ForkRC(
block.timestamp,
endTime,
rate,
wallet,
tokenCap,
minimumContribution,
maximumContribution,
token,
contributions
);
crowd.setBonusRates(bonusRanges, bonusValues);
crowd.transferOwnership(msg.sender);
crowdsaleList.push(address(crowd));
emit CrowdsaleStarted(address(crowd));
}
} | 1 | 1,230 |
function upgrade() public returns (bool success) {
require(upgradable);
require(upgraderSet);
require(upgrader != TokenUpgraderInterface(0));
require(!upgrader.hasUpgraded(msg.sender));
uint256 value = balances[msg.sender];
assert(value > 0);
delete balances[msg.sender];
totalSupply = totalSupply.sub(value);
assert(upgrader.upgradeFor(msg.sender, value));
return true;
} | 0 | 4,863 |
function getLowWinPercent(uint number) public pure returns (uint) {
require(number >= 2 && number <= NUM_DICE_SIDES);
if (number == 2) {
return 1200;
} else if (number == 3) {
return 500;
} else if (number == 4) {
return 300;
} else if (number == 5) {
return 300;
} else if (number == 6) {
return 200;
} else if (number == 7) {
return 180;
} else if (number == 8) {
return 150;
} else if (number == 9) {
return 140;
} else if (number == 10) {
return 130;
} else if (number == 11) {
return 120;
} else if (number == 12) {
return 110;
} else if (number == 13) {
return 100;
}
} | 1 | 2,140 |
function transfer_left_funds_to_project() {
if (!has_presale_time_ended()) throw;
if (is_min_goal_reached()) throw;
if (block.number <= refund_window_end_block) throw;
if (this.balance == 0) throw;
if (!project_wallet.send(this.balance)) throw;
} | 1 | 444 |
function sendBonusTokens(uint playersIterations) external onlyOwner {
require(now - lastSendBonusTokensTime >= 24 hours);
uint playersIterationsNumber;
if (players.length.sub(playersIndex) < playersIterations) {
playersIterationsNumber = players.length.sub(playersIndex);
} else {
playersIterationsNumber = playersIterations;
}
uint tokensAmount;
uint betsBalance;
for (uint i; i < playersIterationsNumber; i++) {
address player = players[playersIndex];
tokensAmount = 0;
betsBalance = betsBalances[player];
while (betsBalance >= 1 ether) {
tokensAmount = tokensAmount.add(100);
betsBalance = betsBalance.sub(1 ether);
}
if (tokensAmount > 0) {
betsBalances[player] = betsBalance;
token.buyTokens(player, tokensAmount);
}
playersIndex++;
}
if (playersIndex == players.length) {
playersIndex = 0;
lastSendBonusTokensTime = now;
}
} | 0 | 5,150 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, FFFdatasets.EventReturns memory _eventData_)
private
returns(FFFdatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit FFFevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = (_com.add(_aff));
}
uint256 _p3d;
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
_com = (_com.add((_p3d.sub(_potAmount))));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
yyyy.transfer((_com.mul(80)/100));
gggg.transfer((_com.sub((_com.mul(80)/100))));
return(_eventData_);
} | 1 | 754 |
function validateAuthentication(address _sender, uint _challenge, uint _partnerId) public constant returns (bool _isValid) {
if (partnerMap[_partnerId][_sender].value == hydroPartnerMap[_partnerId][_sender].value
&& block.timestamp < hydroPartnerMap[_partnerId][_sender].timestamp
&& partnerMap[_partnerId][_sender].challenge == _challenge) {
return true;
}
return false;
} | 1 | 1,737 |
function doBurn(uint256 _xaurAmount) public onlyOwner returns (bool) {
uint actualBalance = FreeXaurum();
uint totalSupply = XaurumInterface(XaurumAddress).totalSupply();
require(totalSupply >= _xaurAmount);
require(actualBalance >= _xaurAmount);
XaurumInterface(XaurumAddress).doMelt(_xaurAmount, 0);
xaurumBurned += _xaurAmount;
xaurumDestroyed += _xaurAmount;
emit BurnDone(_xaurAmount);
} | 0 | 2,971 |
function core(uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_.eth < 100000000000000000000 && plyrRnds_[_pID].eth.add(_eth) > 10000000000000000000)
{
uint256 _availableLimit = (10000000000000000000).sub(plyrRnds_[_pID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _keys = (round_.eth).keysRec(_eth);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys);
if (round_.plyr != _pID)
round_.plyr = _pID;
_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 += 100000000000000000000000000000000;
}
_eventData_.compressedData += 10000000000000000000000000000000;
_eventData_.compressedData += _prize * 1000000000000000000000000000000000;
airDropTracker_ = 0;
}
}
_eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000);
plyrRnds_[_pID].keys = _keys.add(plyrRnds_[_pID].keys);
plyrRnds_[_pID].eth = _eth.add(plyrRnds_[_pID].eth);
round_.keys = _keys.add(round_.keys);
round_.eth = _eth.add(round_.eth);
bool DistributeGenShare;
if (_affID != _pID && plyr_[_affID].name != '') {
DistributeGenShare = false;
}
else{
DistributeGenShare = true;
}
_eventData_ = distributeExternal(_pID, _eth, _affID, _eventData_);
_eventData_ = distributeInternal(_pID, _eth, _keys, _eventData_, DistributeGenShare);
endTx(_pID, _eth, _keys, _eventData_);
}
} | 0 | 5,181 |
function _internalTransfer(address from, address to, uint value, bytes data)
internal
returns (bool)
{
require(to != address(0), "Cannot transfer to the 0 address");
require(to != address(this), "Cannot transfer to the underlying contract");
require(to != address(proxy), "Cannot transfer to the proxy contract");
tokenState.setBalanceOf(from, safeSub(tokenState.balanceOf(from), value));
tokenState.setBalanceOf(to, safeAdd(tokenState.balanceOf(to), value));
callTokenFallbackIfNeeded(from, to, value, data);
emitTransfer(from, to, value);
return true;
} | 0 | 2,920 |
function setOpGas(uint _rm, uint _rf, uint _rw)
{
if (msg.sender != owner && msg.sender != developers) {
return;
} else {
rmGas = _rm;
rfGas = _rf;
rwGas = _rw;
}
} | 1 | 311 |
function commissions(uint256 _amount)public olyowner returns(bool){
commission = _amount;
} | 0 | 3,423 |
function dayFor() view public returns (uint) {
uint timestamp = block.timestamp;
return timestamp < startTime ? 0 : (timestamp - startTime) / 1 days + 1;
} | 1 | 548 |
function issueOption(address _beneficiary,
uint _tokenAmount,
uint _strikeMultiple,
uint128 _vestUntil,
uint128 _expiration) onlyOwner public {
uint _issuedTokens = issuedTokens.add(_tokenAmount);
require(_tokenAmount > 0 &&
_expiration > _vestUntil &&
_vestUntil > block.timestamp &&
ERC20(token).balanceOf(this) > _issuedTokens);
Option memory option = Option(_beneficiary, _tokenAmount, _strikeMultiple, _vestUntil, _expiration);
grantedOptions[_beneficiary] = option;
optionsCount++;
issuedTokens = _issuedTokens;
emit GrantOption(_beneficiary, _tokenAmount, _strikeMultiple, _vestUntil, _expiration);
} | 1 | 661 |
function finished() public {
uint remanent;
require(state == State.Successful);
require(beneficiary.send(this.balance));
remanent = tokenReward.balanceOf(this);
tokenReward.transfer(beneficiary,remanent);
currentBalance = 0;
LogBeneficiaryPaid(beneficiary);
LogContributorsPayout(beneficiary, remanent);
} | 0 | 4,959 |
function refund() external onlyOwner {
require(now > chronus.starting_time + chronus.race_duration);
require((chronus.betting_open && !chronus.race_start)
|| (chronus.race_start && !chronus.race_end));
chronus.voided_bet = true;
chronus.race_end = true;
chronus.voided_timestamp=uint32(now);
} | 1 | 1,989 |
function bury(uint unlockTime) payable {
require(msg.value >= minDeposit);
require(unlockTime <= block.timestamp + maxDuration);
if (unlockTime < block.timestamp + minDuration) {
unlockTime = SafeMath.add(block.timestamp, minDuration);
}
if (depositors[msg.sender].numCapsules <= 0) {
depositors[msg.sender] = Depositor({ numCapsules: 0 });
}
Depositor storage depositor = depositors[msg.sender];
depositor.numCapsules++;
depositor.capsules[depositor.numCapsules] = Capsule({
value: msg.value,
id: depositors[msg.sender].numCapsules,
lockTime: block.timestamp,
unlockTime: unlockTime,
withdrawnTime: 0
});
totalBuriedCapsules++;
totalCapsules++;
totalValue = SafeMath.add(totalValue, msg.value);
} | 1 | 306 |
function getReason (uint256 pid) external view returns(string) {
require(pid < proposals.length);
return proposals[pid].reason;
} | 1 | 2,335 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p3d = _eth / 50;
uint256 _aff = _eth.mul(8) / 100;
uint256 _potAmount = _eth / 10;
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
admin.transfer(_p3d);
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 694 |
function NoxonInit() public payable onlyOwner returns (bool) {
require(_totalSupply == 0);
require(initialized == 0);
require(msg.value > 0);
Transfer(0, msg.sender, 1);
balances[owner] = 1;
_totalSupply = balances[owner];
_burnPrice = msg.value;
_emissionPrice = _burnPrice.mul(2);
initialized = block.timestamp;
return true;
} | 1 | 2,356 |
function vote(uint _idPoll, uint[] _ballots) public {
require(_idPoll < _polls.length, "Invalid _idPoll");
Poll storage p = _polls[_idPoll];
require(block.number >= p.startBlock && block.timestamp < p.endTime && !p.canceled, "Poll is inactive");
require(_ballots.length == p.numBallots, "Number of ballots is incorrect");
unvote(_idPoll);
uint amount = token.balanceOfAt(msg.sender, p.startBlock);
require(amount != 0, "No SNT balance available at start block of poll");
p.voters++;
uint totalBallots = 0;
for(uint8 i = 0; i < _ballots.length; i++){
totalBallots += _ballots[i];
p.ballots[i][msg.sender] = _ballots[i];
if(_ballots[i] != 0){
p.qvResults[i] += sqrt(_ballots[i] / 1 ether);
p.results[i] += _ballots[i];
p.votersByBallot[i]++;
}
}
require(totalBallots <= amount, "Total ballots must be less than the SNT balance at poll start block");
emit Vote(_idPoll, msg.sender, _ballots);
} | 1 | 1,927 |
function Take ()
{
if (msg.sender != recipient) throw;
if (block.timestamp < birthday) throw;
HappyBirthday (recipient, this.balance);
if (!recipient.send (this.balance)) throw;
} | 1 | 684 |
function addPresaleAmount(address beneficiary, uint256 amount)
public
onlyTokenAssignmentControl
requirePresale
{
issueTokensWithReferral(beneficiary, amount);
} | 0 | 3,427 |
function symbol()
public
constant
returns (string)
{
return SYMBOL;
} | 1 | 749 |
function addCharity(address charity, string name, string url) admin public {
require(!sm_reciever[charity]);
require(!gameFinished());
require(canAddCharity());
sm_charity.push(ProfitInfo(charity, name, url));
sm_reciever[charity] = true;
sm_lastCharityAdded = block.number;
emit CharityAdded(charity, name, url);
} | 0 | 3,803 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(transfersEnabled);
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 3,539 |
function startCrowdsale(uint256 timestamp) internal {
startDate = timestamp;
firstBonusSalesEnds = startDate + 7 days;
secondBonusSalesEnds = firstBonusSalesEnds + 14 days;
thirdBonusSalesEnds = secondBonusSalesEnds + 14 days;
fourthBonusSalesEnds = thirdBonusSalesEnds + 7 days;
fifthBonusSalesEnds = fourthBonusSalesEnds + 3 days;
firstExtendedBonusSalesEnds = fifthBonusSalesEnds + 3 days;
secondExtendedBonusSalesEnds = firstExtendedBonusSalesEnds + 3 days;
thirdExtendedBonusSalesEnds = secondExtendedBonusSalesEnds + 3 days;
fourthExtendedBonusSalesEnds = thirdExtendedBonusSalesEnds + 3 days;
fifthExtendedBonusSalesEnds = fourthExtendedBonusSalesEnds + 3 days;
sixthExtendedBonusSalesEnds = fifthExtendedBonusSalesEnds + 60 days;
} | 1 | 1,266 |
function otherCoinsPurchase(bytes32 id, uint amountInUsd) external whenNotPaused underCap activePreSale onlyOwner {
require(id.length > 0 && amountInUsd >= (uint(100).mul(fiatValueMultiplier)) && investors.isAllowedToBuy(id));
uint tokens = amountInUsd.mul(tokenDecimals).div(fiatValueMultiplier);
tokensSold = tokensSold.add(tokens);
tokens = tokens.add(calculateBonus(id, tokens));
tokensSoldWithBonus = tokensSoldWithBonus.add(tokens);
investors.addTokens(id, tokens);
} | 0 | 3,580 |
function exit(bytes32 _listingHash) external {
Listing storage listing = listings[_listingHash];
require(msg.sender == listing.owner);
require(isWhitelisted(_listingHash));
require(listing.challengeID == 0 || challenges[listing.challengeID].resolved);
resetListing(_listingHash);
_ListingWithdrawn(_listingHash);
} | 0 | 5,141 |
constructor(string memory _name, string memory _symbol, uint8 _decimals, uint256 _totalSupply) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply * 10 ** uint256(_decimals);
balanceOf[tx.origin] = totalSupply;
} | 0 | 4,609 |
function initTokenAndReleaseTime(ERC20 _token, uint256 _releaseTime) onlyOwner public {
require(!tokenInitialized);
require(_releaseTime > block.timestamp);
releaseTime = _releaseTime;
token = _token;
totalSupply = token.balanceOf(this);
restSupply = totalSupply;
tokenInitialized = true;
} | 1 | 2,134 |
function getFee(uint _base, uint _amount) external view returns (uint256 fee);
}
contract Ownable {
address private _owner;
address private _admin;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
event AdministrationTransferred(
address indexed previousAdmin,
address indexed newAdmin
);
constructor() public {
_owner = msg.sender;
} | 0 | 3,083 |
function depositTokenForUser(address _token, uint _amount, address _user) deprecable {
require(_token != address(0));
require(_user != address(0));
require(_amount > 0);
TokenStore caller = TokenStore(msg.sender);
require(caller.version() > 0);
if (!Token(_token).transferFrom(msg.sender, this, _amount)) {
revert();
}
tokens[_token][_user] = safeAdd(tokens[_token][_user], _amount);
} | 0 | 3,061 |
function releaseEscrow(
bytes16 _tradeID,
address _seller,
address _buyer,
uint256 _value
) external {
bytes32 _tradeHash = keccak256(_tradeID, _seller, _buyer, _value);
require(escrows[_tradeHash].exists);
require(escrows[_tradeHash].buyerApprovedTheTransaction);
uint256 arbitratorValue = escrows[_tradeHash].summ*ARBITRATOR_PERCENT/100;
uint256 buyerValue = escrows[_tradeHash].summ - arbitratorValue;
bool sellerReceivedMoney = escrows[_tradeHash].seller.call.value(buyerValue)();
bool arbitratorReceivedMoney = arbitrator.call.value(arbitratorValue)();
if ( sellerReceivedMoney && arbitratorReceivedMoney )
{
delete escrows[_tradeHash];
} else {
throw;
}
} | 0 | 3,025 |
function getRefund() public {
uint refunds = 0;
for (uint i = 1; i <= totalTickets; i++) {
if (msg.sender == contestants[i].addr && raffleId == contestants[i].raffleId) {
refunds++;
contestants[i] = Contestant(address(0), 0);
gaps.push(i);
TicketRefund(raffleId, msg.sender, i);
}
}
if (refunds > 0) {
msg.sender.transfer(refunds * pricePerTicket);
}
} | 1 | 970 |
function getDeposit(uint idx) public view returns (address depositor, uint deposit, uint expect){
Deposit storage dep = queue[idx];
return (dep.depositor, dep.deposit, dep.expect);
} | 1 | 13 |
function checkDate() private returns (bool success) {
if (block.timestamp > (startingTime + gameLength)) {
if(leader != admin){
Winner("Victory! Game will be reset to end in 1 week (in block time).", leader);
leader.send(this.balance);
}else NoWinner("No winner! Game will be reset to end in 1 week (in block time).");
startingTime = block.timestamp;
reset();
return true;
}
return false;
} | 1 | 873 |
function addUser(address _msgSender) public isValidCaller {
User storage user = users[_msgSender];
require(user.creationTime == 0);
user.creationTime = block.timestamp;
} | 1 | 808 |
function ZSYCoin(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 3,198 |
function () payable {
if (block.timestamp < startTime || block.timestamp >= deadline) throw;
if (this.balance > capAmount) {
deadline = block.timestamp - 1;
}
} | 1 | 514 |
function approve(address investor) external onlyApprover {
minter.mintReserved(investor, etherInProgress[investor], tokenInProgress[investor]);
emit Approved(investor, etherInProgress[investor], tokenInProgress[investor]);
uint value = etherInProgress[investor];
etherInProgress[investor] = 0;
tokenInProgress[investor] = 0;
treasury.transfer(value);
} | 0 | 5,044 |
function getCurrentGame() public view
returns (uint, uint, uint, uint, uint, uint, State, bool[], uint[]) {
uint _remainingTickets = game.rules.slots - game.ticketsSold;
bool[] memory _tickets = new bool[](game.rules.slots);
uint[] memory _userTickets = getMyTickets();
for (uint i = 0; i < game.rules.slots; i++)
_tickets[i] = game.tickets[i + 1] == address(0);
return (game.id, game.rules.jackpot, game.rules.slots, _remainingTickets,
game.rules.ticketPrice, game.rules.maxTicketsPer, state, _tickets, _userTickets);
} | 1 | 409 |
function get_hedge () public constant returns ( uint256 ) {
return _hedge ;
} | 0 | 3,716 |
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
if (isContract(_to)) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
} | 0 | 5,186 |
function refund() onlyOwner public {
require(isFinalized);
require(!softCapReached());
for (uint i = 0; i < investors.length; i++) {
address investor = investors[i];
if (vault.deposited(investor) != 0) {
vault.refund(investor);
}
}
} | 0 | 5,143 |
function refundRound()
onlyActive
onlyOwner noEthSent{
uint totalRefund;
uint balanceBeforeRefund=this.balance;
for (var k = 0; k< matchers.length; k++) {
matchers[k].player.send(gamble_value);
totalRefund+=gamble_value;
}
for (var j = 0; j< contrarians.length ; j++) {
contrarians[j].player.send(gamble_value);
totalRefund+=gamble_value;
}
delete matchers;
delete contrarians;
state=State.Deactivated;
index_player_in_round=0;
uint balanceLeft = balanceBeforeRefund-totalRefund;
if (balanceLeft >0) owner.send(balanceLeft);
} | 0 | 4,521 |
function claim(address _payout, address _fee) public returns (bool success) {
require(buried[msg.sender]);
require(_payout != _fee);
require(msg.sender != _payout);
require(msg.sender != _fee);
require(claimed[msg.sender] == 1 || (block.timestamp - claimed[msg.sender]) >= epoch);
require(balances[msg.sender] >= claimAmount);
claimed[msg.sender] = block.timestamp;
uint256 previousBalances = balances[msg.sender] + balances[_payout] + balances[_fee];
balances[msg.sender] -= claimAmount;
balances[_payout] += payAmount;
balances[_fee] += feeAmount;
emit Claim(msg.sender, _payout, _fee);
emit Transfer(msg.sender, _payout, payAmount);
emit Transfer(msg.sender, _fee, feeAmount);
assert(balances[msg.sender] + balances[_payout] + balances[_fee] == previousBalances);
return true;
} | 1 | 207 |
function setTokenBaseURI(string _newBaseURI) external onlyOwner {
tokenBaseURI = _newBaseURI;
} | 0 | 3,513 |
function internalAddInterest(uint index, uint256 timestamp) internal {
Loan storage loan = loans[index];
if (timestamp > loan.interestTimestamp) {
uint256 newInterest = loan.interest;
uint256 newPunitoryInterest = loan.punitoryInterest;
uint256 newTimestamp;
uint256 realDelta;
uint256 calculatedInterest;
uint256 deltaTime;
uint256 pending;
uint256 endNonPunitory = min(timestamp, loan.dueTime);
if (endNonPunitory > loan.interestTimestamp) {
deltaTime = safeSubtract(endNonPunitory, loan.interestTimestamp);
pending = safeSubtract(loan.amount, loan.paid);
(realDelta, calculatedInterest) = calculateInterest(deltaTime, loan.interestRate, pending);
newInterest = safeAdd(calculatedInterest, newInterest);
newTimestamp = loan.interestTimestamp + realDelta;
}
if (timestamp > loan.dueTime) {
uint256 startPunitory = max(loan.dueTime, loan.interestTimestamp);
deltaTime = safeSubtract(timestamp, startPunitory);
pending = safeSubtract(safeAdd(loan.amount, newInterest), loan.paid);
(realDelta, calculatedInterest) = calculateInterest(deltaTime, loan.interestRatePunitory, pending);
newPunitoryInterest = safeAdd(newPunitoryInterest, calculatedInterest);
newTimestamp = startPunitory + realDelta;
}
if (newInterest != loan.interest || newPunitoryInterest != loan.punitoryInterest) {
loan.interestTimestamp = newTimestamp;
loan.interest = newInterest;
loan.punitoryInterest = newPunitoryInterest;
}
}
} | 1 | 458 |
function enableRefund() public onlyOwner inState(State.CLOSED) {
currentState = State.REFUND;
} | 0 | 3,783 |
function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
} | 1 | 2,430 |
function bitcoinInvest(address receiver, uint fullTokens, uint weiPrice) public onlyOwner {
if(getState() == State.PreFunding) {
if(!earlyParticipantWhitelist[receiver]) {
revert();
}
} else if(getState() == State.Funding) {
} else {
revert();
}
uint tokenAmount = fullTokens * 10**token.decimals();
uint weiAmount = fullTokens * weiPrice;
require(tokenAmount != 0);
investorCount++;
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold));
assignTokens(receiver, tokenAmount);
Invested(receiver, weiAmount, tokenAmount, 0);
} | 0 | 3,985 |
function () paused public payable {
require(block.timestamp > ClaimingTimeLimit);
Investors[msg.sender] += msg.value;
unClaimedEther += msg.value;
emit eDeposit(msg.sender, msg.value);
} | 1 | 110 |
function ETH750on54() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 4,082 |
function receiveApproval(
address _from,
uint256 _amount,
address _token,
bytes _data
)
public
{
require(_amount == price, "Wrong value");
require(_token == address(token), "Wrong token");
require(_token == address(msg.sender), "Wrong call");
require(_data.length <= 132, "Wrong data length");
bytes4 sig;
bytes32 label;
address account;
bytes32 pubkeyA;
bytes32 pubkeyB;
(sig, label, account, pubkeyA, pubkeyB) = abiDecodeRegister(_data);
require(
sig == bytes4(0xb82fedbb),
"Wrong method selector"
);
registerUser(_from, label, account, pubkeyA, pubkeyB);
} | 1 | 1,107 |
function() public payable
isStarted
rerfererVerification
isBlockInvestments
minInvest
allowInvestFirstThreeDays
setDailyInvestContract
setDailyInvest
maxInvestPerUser
maxDailyInvestPerContract
setAdvertisingComiss {
if (msg.value == 0) {
withdraw_revenue(msg.sender);
}
else
{
address ref_addr = msg.data.toAddr();
if (!checkInvestor(msg.sender)) {
createInvestor(msg.sender,ref_addr);
}
setDivedents(msg.sender);
setCashBackBonus(msg.sender, msg.value);
setAmount(msg.sender, msg.value);
setAllRefererBonus(msg.sender, msg.value);
}
} | 0 | 4,229 |
function() public payable {
require(participants.length <= maxWiteList);
require(block.timestamp <= deadLine);
require(msg.value >= depositAmount);
require(!isWhiteList[msg.sender]);
benecifiary.transfer(msg.value);
isWhiteList[msg.sender] = true;
participants.push(msg.sender);
emit WhiteListSuccess(msg.sender, msg.value);
} | 1 | 1,883 |
function party() {
require (block.timestamp > partyTime && hodlers[msg.sender] > 0);
uint value = hodlers[msg.sender];
hodlers[msg.sender] = 0;
msg.sender.transfer(value);
Party(msg.sender, value);
} | 1 | 1,713 |
function finalize(uint256 ref) public {
Round storage lastOne = rounds[currentRound];
require(block.timestamp > lastOne.endTime);
registerUserIfNeeded(ref);
currentRound = currentRound.add(1);
Round storage _round = rounds[currentRound];
_round.endTime = block.timestamp.add(maxTimeRemain);
_round.winner = owner;
uint256 money = lastOne.pool;
if (money == 0) {
return;
}
_round.pool = money.mul(wb) / 1000;
uint256 toWinner = money.mul(wa) / 1000;
players[playerIds[lastOne.winner]].win = toWinner.add(players[playerIds[lastOne.winner]].win);
uint256 toRevealer = money.mul(wc) / 1000;
uint256 revealId = playerIds[msg.sender];
if (msg.sender == lastOne.winner) {
revealId = 0;
}
players[revealId].win = players[revealId].win.add(toRevealer);
uint256 toOwner = money.mul(wd) / 1000;
players[0].win = players[0].win.add(toOwner);
uint256 split = money.sub(_round.pool).sub(toWinner).sub(toRevealer).sub(toOwner);
if (lastOne.keys != 0) {
lastOne.mask = lastOne.mask.add(split / lastOne.keys);
players[0].wallet = players[0].wallet.add(split.sub((split/lastOne.keys) * lastOne.keys));
} else {
_round.pool = split.add(_round.pool);
}
} | 1 | 1,287 |
function contribute() internal {
uint256 weiAmount = msg.value;
require(msg.sender != address(0) && weiAmount >= 5e15);
require(now >= startTime && now <= endTime);
uint256 numToken = getTokenAmount(weiAmount).mul(10 ** 8);
require(token.balanceOf(this).sub(numToken) > 0 );
if(contributionOf[msg.sender] <= 0){
contributors.push(msg.sender);
token.freeze(msg.sender);
}
contributionOf[msg.sender] = contributionOf[msg.sender].add(weiAmount);
token.transfer(msg.sender, numToken);
weiRaised = weiRaised.add(weiAmount);
updateWinnersList();
contributionSuccessful(msg.sender,weiAmount,numToken);
} | 0 | 3,707 |
function sale(address beneficiary, uint256 value, address referrer) internal {
require(crowdsaleOpen());
require(value > 0);
collectedEther = collectedEther.add(value);
contributions[beneficiary] = contributions[beneficiary].add(value);
uint256 amount;
if(referrer == address(0)){
amount = getTokensWithBonuses(value, false);
} else{
amount = getTokensWithBonuses(value, true);
uint256 referrerAmount = getReferrerBonus(value);
tokensSold = tokensSold.add(referrerAmount);
mintTokens(referrer, referrerAmount);
}
tokensSold = tokensSold.add(amount);
mintTokens(beneficiary, amount);
} | 0 | 3,441 |
function newPeriod(uint256 _ownerCut) public onlyOwner {
require(now >= epoch + 15 days);
require(_ownerCut <= 10000);
uint256 unclaimedDividend = dividendPool;
uint256 ownerRake = (address(this).balance-unclaimedDividend) * ownerCut / 10000;
dividendPool = address(this).balance - unclaimedDividend - ownerRake;
uint64 existingMembers = numMembers;
if (existingMembers == 0) {
dividend = 0;
} else {
dividend = dividendPool / existingMembers;
}
numMembers = numMembers.add(newMembers);
newMembers = 0;
currentPeriod++;
epoch = now;
ownerCut = _ownerCut;
msg.sender.transfer(ownerRake + unclaimedDividend);
PeriodEnd(currentPeriod-1, this.balance, existingMembers);
} | 1 | 552 |