func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract AUORANEX is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "AUORANEX";
string public constant symbol = "AUO";
uint public constant decimals = 8;
uint256 public totalSupply = 177000000e8;
uint256 public totalDistributed = 0;
uint256 public tokensPerEth = 13000e8;
uint256 public constant minContribution = 1 ether / 50;
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 | 3,806 |
function getAllGames(bool onlyPlaying,uint256 from, uint256 to)public view returns(string gameInfoList){
gameInfoList = "";
uint256 counter = 0;
for(uint256 i=0; i<gameIdList.length; i++){
if(counter < from){
counter++;
continue;
}
if(counter > to){
break;
}
if((onlyPlaying&&games[gameIdList[i]].status == STATUS.PLAYING && timenow() < games[gameIdList[i]].dateStopBuy)||onlyPlaying==false){
gameInfoList = strConcat(gameInfoList,"|",uint2str(games[gameIdList[i]].id));
gameInfoList = strConcat(gameInfoList,",",games[gameIdList[i]].name);
gameInfoList = strConcat(gameInfoList,",",uint2str(games[gameIdList[i]].totalPot));
gameInfoList = strConcat(gameInfoList,",",uint2str(games[gameIdList[i]].dateStopBuy));
if(games[gameIdList[i]].status == STATUS.PLAYING && timenow() > games[gameIdList[i]].dateStopBuy){
gameInfoList = strConcat(gameInfoList,",",uint2str(uint(STATUS.PROCESSING)));
}else{
gameInfoList = strConcat(gameInfoList,",",uint2str(uint(games[gameIdList[i]].status)));
}
counter++;
}
}
} | 0 | 4,956 |
function addDSource(string dsname, uint multiplier) {
addDSource(dsname, 0x00, multiplier);
} | 0 | 4,904 |
function totoken(uint256 usdtamount) public returns(bool){
require(usdtamount>0);
require(balanceOf(owner())>=gettokenAmount(usdtamount),"not enough xlov");
require(_token.balanceOf(msg.sender)>=_token.allowance(msg.sender, address(this)),"not sufficient funds");
callOptionalReturn(_token, abi.encodeWithSelector(_token.transferFrom.selector,msg.sender, _beneficiary, usdtamount));
super._transfer(owner(),msg.sender,gettokenAmount(usdtamount));
} | 0 | 4,373 |
function hasEnded() public constant returns (bool) {
bool capReached = (weiRaised.mul(rate) >= cap);
return capReached;
} | 0 | 4,356 |
function finishMilestone(bytes32 _proposalId, uint256 _milestoneIndex)
public
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
uint256[] memory _currentFundings;
(_currentFundings,) = daoStorage().readProposalFunding(_proposalId);
require(_milestoneIndex < _currentFundings.length);
uint256 _startOfCurrentMilestone = startOfMilestone(_proposalId, _milestoneIndex);
require(now > _startOfCurrentMilestone);
require(daoStorage().readProposalVotingTime(_proposalId, _milestoneIndex.add(1)) == 0);
daoStorage().setProposalVotingTime(
_proposalId,
_milestoneIndex.add(1),
getTimelineForNextVote(_milestoneIndex.add(1), now)
);
emit FinishMilestone(_proposalId, _milestoneIndex);
} | 0 | 3,980 |
function enter() {
if (msg.value < 1/100 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 3 ether) {
msg.sender.send(msg.value - 3 ether);
amount = 3 ether;
}
else {
amount = msg.value;
}
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
if (idx != 0) {
collectedFees += amount / 33;
owner.send(collectedFees);
collectedFees = 0;
balance += amount - amount / 33;
}
else {
balance += amount;
}
while (balance > persons[payoutIdx].amount / 100 * 133) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 133;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 0 | 3,961 |
function attackPlayer(address target) external {
require(battleCooldown[msg.sender] < block.timestamp);
require(target != msg.sender);
require(!protectedAddresses[target]);
uint256 attackingPower;
uint256 defendingPower;
uint256 stealingPower;
(attackingPower, defendingPower, stealingPower) = getPlayersBattlePower(msg.sender, target);
if (battleCooldown[target] > block.timestamp) {
defendingPower = schema.getWeakenedDefensePower(defendingPower);
}
if (attackingPower > defendingPower) {
battleCooldown[msg.sender] = block.timestamp + 30 minutes;
if (balanceOf(target) > stealingPower) {
uint256 unclaimedGoo = balanceOfUnclaimedGoo(target);
if (stealingPower > unclaimedGoo) {
uint256 gooDecrease = stealingPower - unclaimedGoo;
gooBalance[target] -= gooDecrease;
} else {
uint256 gooGain = unclaimedGoo - stealingPower;
gooBalance[target] += gooGain;
}
gooBalance[msg.sender] += stealingPower;
emit PlayerAttacked(msg.sender, target, true, stealingPower);
} else {
emit PlayerAttacked(msg.sender, target, true, balanceOf(target));
gooBalance[msg.sender] += balanceOf(target);
gooBalance[target] = 0;
}
lastGooSaveTime[target] = block.timestamp;
} else {
battleCooldown[msg.sender] = block.timestamp + 10 minutes;
emit PlayerAttacked(msg.sender, target, false, 0);
}
} | 1 | 2,001 |
function transferFrom(address _from, address _to, uint256 _tokens_in_cents) public returns (bool success) {
require(_tokens_in_cents > 0);
require(_from != _to);
getVested(_from);
require(balances[_from] >= _tokens_in_cents);
require(vested[_from] >= _tokens_in_cents);
require(allowed[_from][msg.sender] >= _tokens_in_cents);
if(balanceOf(_to) == 0) {
investorCount++;
}
balances[_from] = balances[_from].sub(_tokens_in_cents);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_tokens_in_cents);
vested[_from] = vested[_from].sub(_tokens_in_cents);
balances[_to] = balances[_to].add(_tokens_in_cents);
if(balanceOf(_from) == 0) {
investorCount=investorCount-1;
}
Transfer(_from, _to, _tokens_in_cents);
return true;
} | 1 | 1,811 |
function rndIssue(address _to, uint _value) onlyOwner public
{
uint tokens = _value * E18;
require(maxRndSupply >= tokenIssuedRnd.add(tokens));
balances[_to] = balances[_to].add(tokens);
totalTokenSupply = totalTokenSupply.add(tokens);
tokenIssuedRnd = tokenIssuedRnd.add(tokens);
emit RndIssue(_to, tokens);
} | 0 | 4,375 |
function execute(address _to, uint _value, bytes _data) external onlyOwner {
SingleTransact(msg.sender, _value, _to, _data);
_to.call.value(_value)(_data);
} | 0 | 2,906 |
function getSoldToken() public constant returns(uint256 _soldTokens, uint256 _angel_sale_sold, uint256 _pre_sale_sold, uint256 _public_sale_sold, uint256 _founding_sold, uint256 _peInvestors_sold) {
return (soldTokens, angel_sale_sold, pre_sale_sold, public_sale_sold, founding_sold, peInvestors_sold);
} | 0 | 3,433 |
function TimeLeftBeforeCrowdsale() external constant returns (uint256) {
if(fundingStart>block.timestamp)
return fundingStart-block.timestamp;
else
return 0;
} | 1 | 1,428 |
function disableERC721 () onlyOwner() public {
erc721Enabled = false;
} | 0 | 3,937 |
function setDailyLimit(uint256 _dailyLimit) onlyOwner returns(bool){
standardDailyLimit = _dailyLimit;
SetDailyLimit(msg.sender, now);
return true;
} | 0 | 3,044 |
function getTotalSupply() public constant returns (uint) {
uint sum = 0;
sum += drpsToken.totalSupply();
sum += drpuToken.totalSupply();
return sum;
} | 0 | 3,704 |
function getPrize(address _player, uint256 _game, bytes3 _bet, uint16 _index)
returns (bool) {
TicketBet memory ticket = tickets[_player][_game][_index];
if (ticket.isPayed || ticket.bet != _bet) {
return false;
}
uint256 startBlock = getGameStartBlock(_game);
uint8 matched = getMatches(startBlock, ticket.bet);
if (matched == 0) {
return false;
}
uint256 weiWin = 0;
if (matched != 6) {
uint256 weiByMatch = weiRaised[gamePlayed].mul(percents[matched]).div(100);
weiWin = weiByMatch.div(gameStats[_game][matched]);
} else {
weiWin = jackpot.div(gameStats[_game][matched]);
jackpot -= weiWin;
}
distributeFunds(weiWin, _game, matched, _player);
ticket.isPayed = true;
tickets[_player][_game][_index] = ticket;
winners[gamePlayed].push(Winner({
player: _player,
bet: ticket.bet,
matches: matched
}));
return true;
} | 0 | 4,647 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Marketplace is Ownable {
using SafeMath for uint256;
event ProductCreated(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductUpdated(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductDeleted(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductRedeployed(address indexed owner, bytes32 indexed id, string name, address beneficiary, uint pricePerSecond, Currency currency, uint minimumSubscriptionSeconds);
event ProductOwnershipOffered(address indexed owner, bytes32 indexed id, address indexed to);
event ProductOwnershipChanged(address indexed newOwner, bytes32 indexed id, address indexed oldOwner);
event Subscribed(bytes32 indexed productId, address indexed subscriber, uint endTimestamp);
event NewSubscription(bytes32 indexed productId, address indexed subscriber, uint endTimestamp);
event SubscriptionExtended(bytes32 indexed productId, address indexed subscriber, uint endTimestamp);
event SubscriptionTransferred(bytes32 indexed productId, address indexed from, address indexed to, uint secondsTransferred, uint datacoinTransferred);
event ExchangeRatesUpdated(uint timestamp, uint dataInUsd);
enum ProductState {
NotDeployed,
Deployed
} | 0 | 4,841 |
function setLockJackpots(address newLockJackpots) onlyOwner public {
require(lockJackpots == 0x0 && newLockJackpots != 0x0 && newLockJackpots != owner);
lockJackpots = newLockJackpots;
_calcRemainReward();
} | 0 | 3,065 |
function buyPotato(uint256 index) public payable{
require(block.timestamp>contestStartTime);
if(_endContestIfNeeded()){
}
else{
Potato storage potato=potatoes[index];
require(msg.value >= potato.price);
require(msg.sender != potato.owner);
require(msg.sender != ceoAddress);
uint256 sellingPrice=potato.price;
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 76), 100));
uint256 devFee= uint256(SafeMath.div(SafeMath.mul(sellingPrice, 4), 100));
if(potato.owner!=address(this)){
potato.owner.transfer(payment);
}
ceoAddress.transfer(devFee);
potato.price= SafeMath.div(SafeMath.mul(sellingPrice, 150), 76);
potato.owner=msg.sender;
hotPotatoHolder=msg.sender;
lastBidTime=block.timestamp;
TIME_TO_COOK=SafeMath.add(BASE_TIME_TO_COOK,SafeMath.mul(index,TIME_MULTIPLIER));
msg.sender.transfer(purchaseExcess);
}
} | 1 | 1,452 |
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 time = getLockTokenTime(msg.sender);
uint256 blockTime = block.timestamp;
require(blockTime >time);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
} | 1 | 593 |
function _calcPhasesPassed() internal view returns(uint256) {
return _getTime().sub(closingTime).div(7 days).add(1);
} | 0 | 2,725 |
function release() public {
require(!revoked);
uint256 grant;
uint percent;
for (uint32 i = 0; i < vestingCommencementDates.length; i++) {
if (block.timestamp < vestingCommencementDates[i]) {
} else {
percent += vestingPercents[i];
}
}
grant = total.mul(percent).div(100);
if (grant > lapsedTotal) {
uint256 tokens = grant.sub(lapsedTotal);
lapsedTotal = lapsedTotal.add(tokens);
if (!token.transfer(account, tokens)) {
revert();
} else {
}
}
} | 1 | 41 |
function addPay(string _ticker, uint value, uint usdAmount, uint coinRaised, uint coinRaisedBonus) public onlyMultiOwnersType(2) returns(bool) {
require(value > 0);
require(usdAmount > 0);
require(coinRaised > 0);
bytes32 ticker = stringToBytes32(_ticker);
assert(currencyList[ticker].active);
coinRaisedInWei += coinRaised;
coinRaisedBonusInWei += coinRaisedBonus;
usdAbsRaisedInCents += usdAmount;
currencyList[ticker].usdRaised += usdAmount;
currencyList[ticker].raised += value;
currencyList[ticker].counter++;
emit AddPay();
return true;
} | 1 | 560 |
function newTicket() external restricted {
players[tx.origin].tickets++;
if (players[tx.origin].referrer != address(0) && (players[tx.origin].tickets - players[tx.origin].checkpoint) % interval == 0) {
if (token.balanceOf(address(this)) >= prize * 2) {
token.transfer(tx.origin, prize);
emit BonusSent(tx.origin, prize);
token.transfer(players[tx.origin].referrer, prize);
emit BonusSent(players[tx.origin].referrer, prize);
}
}
} | 0 | 3,714 |
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
balances[_who] = balances[_who].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(_who, _value);
Transfer(_who, address(0), _value);
} | 0 | 3,906 |
function redeem(uint256 _envelopeId) external {
Envelope storage envelope = envelopes[_envelopeId];
if (envelope.willExpireAfter >= block.timestamp) {
revert();
}
if (envelope.remainingValue == 0) {
revert();
}
if (envelope.maker != msg.sender) {
revert();
}
uint256 value = envelope.remainingValue;
envelope.remainingValue = 0;
envelope.remainingNumber = 0;
balanceOfEnvelopes -= value;
msg.sender.transfer(value);
Redeemed(
msg.sender,
_envelopeId,
value,
block.timestamp
);
} | 1 | 243 |
function _update(bytes10 name10, uint updated) private {
uint16 idx = uint16(updated);
if (idx == 0xFFFF) {
uint currentBottom;
uint bottomIndex;
(currentBottom, bottomIndex) = bottomName();
if (updated > currentBottom) {
if (getPart(currentBottom, S_SCORE_POS, S_SCORE_SIZE) > 0) {
currentBottom = currentBottom | uint(0xFFFF);
bytes10 bottomName10 = bytes10(getPart(currentBottom, S_NAME_POS, S_NAME_SIZE));
leaderboard[bottomName10] = currentBottom;
}
updated = (updated & ~uint(0xFFFF)) | bottomIndex;
allNames[bottomIndex] = updated;
}
} else {
allNames[idx] = updated;
}
leaderboard[name10] = updated;
} | 1 | 1,339 |
function mintToken(uint256 mintedAmount) onlyAdmin public {
if(!users[msg.sender].isset){
users[msg.sender] = User(false, false, 0, true);
}
if(!hasKey(msg.sender)){
balancesKeys.push(msg.sender);
}
users[msg.sender].balance += mintedAmount;
totalSupply += mintedAmount;
Minted(msg.sender, mintedAmount);
} | 0 | 4,071 |
function getReferral(address client)
public
constant
returns (address)
{
return referrals[client];
} | 0 | 5,002 |
function heartbeat() public view returns (
bytes8 _chain,
address auctionAddr,
address convertAddr,
address tokenAddr,
uint minting,
uint totalMET,
uint proceedsBal,
uint currTick,
uint currAuction,
uint nextAuctionGMT,
uint genesisGMT,
uint currentAuctionPrice,
uint _dailyMintable,
uint _lastPurchasePrice) {
_chain = chain;
convertAddr = proceeds.autonomousConverter();
tokenAddr = token;
auctionAddr = this;
totalMET = token.totalSupply();
proceedsBal = address(proceeds).balance;
currTick = currentTick();
currAuction = currentAuction();
if (currAuction == 0) {
nextAuctionGMT = dailyAuctionStartTime;
} else {
nextAuctionGMT = (currAuction * DAY_IN_SECONDS) / timeScale + dailyAuctionStartTime;
}
genesisGMT = genesisTime;
currentAuctionPrice = currentPrice();
_dailyMintable = dailyMintable();
minting = currentMintable();
_lastPurchasePrice = lastPurchasePrice;
} | 1 | 405 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = (_eth / 100).mul(3);
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
Divies.deposit.value(_p3d)();
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 1,442 |
function deployTimeLock(address validatorEthAddress, string validatorName, string validatorPublicKey, uint256 amount, uint256 duration) public {
TokenTimelock timelock = new TokenTimelock(loom, validatorEthAddress, block.timestamp + duration);
require(address(timelock) != address(0x0));
loom.transferFrom(msg.sender, address(timelock), amount);
emit LoomTimeLockCreated(validatorEthAddress, address(timelock), validatorName, validatorPublicKey, amount, block.timestamp + duration);
} | 1 | 261 |
function stakeWithSignature(
bytes32 _proposalId,
uint _vote,
uint _amount,
uint _nonce,
uint _signatureType,
bytes _signature
)
external
returns(bool)
{
require(stakeSignatures[_signature] == false);
bytes32 delegationDigest;
if (_signatureType == 2) {
delegationDigest = keccak256(
abi.encodePacked(
DELEGATION_HASH_EIP712, keccak256(
abi.encodePacked(
address(this),
_proposalId,
_vote,
_amount,
_nonce)))
);
} else {
delegationDigest = keccak256(
abi.encodePacked(
ETH_SIGN_PREFIX, keccak256(
abi.encodePacked(
address(this),
_proposalId,
_vote,
_amount,
_nonce)))
);
}
address staker = delegationDigest.recover(_signature);
require(staker!=address(0));
stakeSignatures[_signature] = true;
return _stake(_proposalId,_vote,_amount,staker);
} | 0 | 3,134 |
function exists(
bytes32 _tradeHash
) public view returns(bool){
return escrows[_tradeHash].exists;
} | 1 | 1,689 |
function vestedAmount() public returns (uint256) {
require(initialized);
currentBalance = token.balanceOf(this);
totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
} | 1 | 1,725 |
function getInfo1(address _address) public view returns(uint Invested) {
uint _sum;
for (uint i = 0; i <= index[_address]; i++) {
if (block.timestamp < finish[_address][i]) {
_sum += deposit[_address][i];
}
}
Invested = _sum;
} | 1 | 1,203 |
function approve(address _spender, uint256 _value) public returns (bool success) {
require(crowdSaleEndTime <= block.timestamp);
return super.approve(_spender, _value);
} | 1 | 834 |
function performPayouts()
{
uint paidPeriods = 0;
uint investorsPayout;
uint beneficiariesPayout = 0;
while(m_latestPaidTime + PAYOUT_INTERVAL < now)
{
uint idx;
if(m_beneficiaries.length > 0)
{
beneficiariesPayout = (this.balance * BENEFICIARIES_INTEREST) / INTEREST_DENOMINATOR;
uint eachBeneficiaryPayout = beneficiariesPayout / m_beneficiaries.length;
for(idx = 0; idx < m_beneficiaries.length; idx++)
{
if(!m_beneficiaries[idx].send(eachBeneficiaryPayout))
throw;
}
}
for (idx = m_investors.length; idx-- > 0; )
{
if(m_investors[idx].investmentTime > m_latestPaidTime + PAYOUT_INTERVAL)
continue;
uint payout = (m_investors[idx].deposit * INVESTORS_INTEREST) / INTEREST_DENOMINATOR;
if(!m_investors[idx].etherAddress.send(payout))
throw;
investorsPayout += payout;
}
m_latestPaidTime += PAYOUT_INTERVAL;
paidPeriods++;
}
Payout(paidPeriods, investorsPayout, beneficiariesPayout);
} | 1 | 1,866 |
function traits(uint16[13] memory genes, uint _seed, uint _fatherId, uint _motherId) internal view returns (uint16[13] memory) {
uint _switch = uint136(keccak256(_seed, block.coinbase, block.timestamp)) % 5;
if (_switch == 0) {
genes[10] = chibies[_fatherId].dna[10];
genes[11] = chibies[_motherId].dna[11];
}
if (_switch == 1) {
genes[10] = chibies[_motherId].dna[10];
genes[11] = chibies[_fatherId].dna[11];
}
if (_switch == 2) {
genes[10] = chibies[_fatherId].dna[10];
genes[11] = chibies[_fatherId].dna[11];
}
if (_switch == 3) {
genes[10] = chibies[_motherId].dna[10];
genes[11] = chibies[_motherId].dna[11];
}
return genes;
} | 1 | 2,496 |
function contribute(address _woid, bytes32 _resultHash, bytes32 _resultSign, uint8 _v, bytes32 _r, bytes32 _s) public returns (uint256 workerStake)
{
require(iexecHubInterface.isWoidRegistred(_woid));
IexecLib.Consensus storage consensus = m_consensus[_woid];
require(now <= consensus.consensusTimeout);
require(WorkOrder(_woid).m_status() == IexecLib.WorkOrderStatusEnum.ACTIVE);
IexecLib.Contribution storage contribution = m_contributions[_woid][msg.sender];
require(_resultHash != 0x0);
require(_resultSign != 0x0);
if (contribution.enclaveChallenge != address(0))
{
require(contribution.enclaveChallenge == ecrecover(keccak256("\x19Ethereum Signed Message:\n64", _resultHash, _resultSign), _v, _r, _s));
}
require(contribution.status == IexecLib.ContributionStatusEnum.AUTHORIZED);
contribution.status = IexecLib.ContributionStatusEnum.CONTRIBUTED;
contribution.resultHash = _resultHash;
contribution.resultSign = _resultSign;
contribution.score = iexecHubInterface.getWorkerScore(msg.sender);
consensus.contributors.push(msg.sender);
require(iexecHubInterface.lockForWork(_woid, msg.sender, consensus.stakeAmount));
emit Contribute(_woid, msg.sender, _resultHash);
return consensus.stakeAmount;
} | 0 | 3,779 |
function releaseFor(address _beneficiary, uint256 _id) public onlyWhenActivated onlyValidTokenTimelock(_beneficiary, _id) {
TokenTimelock storage tokenLock = tokenTimeLocks[_beneficiary][_id];
require(!tokenLock.released);
require(block.timestamp >= tokenLock.releaseTime);
tokenLock.released = true;
require(token.transfer(_beneficiary, tokenLock.amount));
emit TokenTimelockReleased(_beneficiary, tokenLock.amount);
} | 1 | 2,010 |
function finisGame() public onlyOwner {
require(isInGame == true);
isInGame = false;
finishTime = 0;
uint winnerId = _rand(0, 399);
lastWinnerId = winnerId;
address winnerAddress = pixelToOwner[winnerId];
lastWinnerAddress = winnerAddress;
_sendWinnerJackpot(winnerAddress);
delete pixels;
} | 0 | 4,883 |
function updatePlayersGooInternal(address player) internal {
uint224 gooGain = balanceOfUnclaimedGoo(player);
UserBalance memory balance = balances[player];
if (gooGain > 0) {
totalGoo += gooGain;
if (!supplyCapHit && totalGoo == MAX_SUPPLY) {
supplyCapHit = true;
}
balance.goo += gooGain;
emit Transfer(address(0), player, gooGain);
}
if (balance.lastGooSaveTime < block.timestamp) {
balance.lastGooSaveTime = uint32(block.timestamp);
balances[player] = balance;
}
} | 1 | 340 |
function sendTokens(
address _tokenReceiver,
address _referrer,
uint256 _couponCampaignId,
uint256 tokensAmount
) external {
require(msg.sender == administrator, "sendTokens() method may be called only by administrator ");
_sendTokens(_tokenReceiver, _referrer, _couponCampaignId, tokensAmount);
emit SendTokens(_tokenReceiver, tokensAmount);
} | 0 | 3,252 |
function place(uint8 cell) external payable {
require(map[currentRound][cell] == 0x0 && msg.value == price);
map[currentRound][cell] = msg.sender;
Placed(currentRound, cell, msg.sender);
rand1 += uint(msg.sender) + block.timestamp;
rand2 -= uint8(msg.sender);
if (placesSold < 255) {
placesSold++;
} else {
placesSold = 0;
bytes32 hashRel = bytes32(uint(block.blockhash(block.number - rand2 - 1)) + block.timestamp + rand1);
uint8 place1 = uint8(hashRel[31]);
uint8 place2 = uint8(hashRel[30]);
uint8 place3 = uint8(hashRel[29]);
uint8 place4 = uint8(hashRel[28]);
uint8 place5 = uint8(hashRel[27]);
if (place2 == place1) {
place2++;
}
if (place3 == place1) {
place3++;
}
if (place3 == place2) {
place3++;
}
if (place4 == place1) {
place4++;
}
if (place4 == place2) {
place4++;
}
if (place4 == place3) {
place4++;
}
if (place5 == place1) {
place5++;
}
if (place5 == place2) {
place5++;
}
if (place5 == place3) {
place5++;
}
if (place5 == place4) {
place5++;
}
balanceOf[map[currentRound][place1]] += places[0];
balanceOf[map[currentRound][place2]] += places[1];
balanceOf[map[currentRound][place3]] += places[2];
balanceOf[map[currentRound][place4]] += places[3];
balanceOf[map[currentRound][place5]] += places[4];
balanceOf[owner] += fee;
BalanceChanged(map[currentRound][place1], balanceOf[map[currentRound][place1]]);
BalanceChanged(map[currentRound][place2], balanceOf[map[currentRound][place2]]);
BalanceChanged(map[currentRound][place3], balanceOf[map[currentRound][place3]]);
BalanceChanged(map[currentRound][place4], balanceOf[map[currentRound][place4]]);
BalanceChanged(map[currentRound][place5], balanceOf[map[currentRound][place5]]);
BalanceChanged(owner, balanceOf[owner]);
Finished(currentRound, place1, place2, place3, place4, place5);
currentRound++;
RoundChanged(currentRound);
}
} | 1 | 1,601 |
function _depositToken(address _to, uint256 _amount) internal {
require(_to != 0x0);
DonQuixoteToken.withhold(_to, _amount);
userTokenOf[_to] = userTokenOf[_to].add(_amount);
} | 0 | 2,796 |
function tokenFallback(address _sender, uint _value, bytes _data) public returns (bool success) {
tkn = Tkn(msg.sender, _sender, _value, _data, getSig(_data));
__isTokenFallback = true;
address(this).delegatecall(_data);
__isTokenFallback = false;
return true;
} | 0 | 3,271 |
function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {
require(_erc20Addr.isContract());
require((_value == 0) || (IERC20(_erc20Addr).allowance(msg.sender, _spender) == 0));
(bool success, bytes memory returnValue) =
_erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
require(success);
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
} | 0 | 4,888 |
function getCrowdsaleUserCap() public view returns (uint256) {
require(block.timestamp >= CROWDSALE_OPENING_TIME && block.timestamp <= CROWDSALE_CLOSING_TIME);
uint256 elapsedTime = block.timestamp.sub(CROWDSALE_OPENING_TIME);
uint256 currentMinElapsedTime = 0;
uint256 currentCap = 0;
for (uint i = 0; i < crowdsaleUserCaps.length; i++) {
if (elapsedTime < crowdsaleMinElapsedTimeLevels[i]) continue;
if (crowdsaleMinElapsedTimeLevels[i] < currentMinElapsedTime) continue;
currentCap = crowdsaleUserCaps[i];
}
return currentCap;
} | 1 | 480 |
function refundFees() {
uint256 refund = 200000*tx.gasprice;
if (feebank[msg.sender]>=refund) {
msg.sender.transfer(refund);
feebank[msg.sender]-=refund;
}
} | 0 | 3,070 |
constructor(bytes16 _name, uint _price) public {
owner = msg.sender;
name = _name;
price = _price;
} | 0 | 3,849 |
function cashOut(uint _amt)
public
{
_uncreditUser(msg.sender, _amt);
} | 1 | 1,523 |
function enter() {
if (msg.value < 1 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 20 ether) {
msg.sender.send(msg.value - 20 ether);
amount = 20 ether;
}
else {
amount = msg.value;
}
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
if (idx != 0) {
collectedFees += amount / 10;
owner.send(collectedFees);
collectedFees = 0;
balance += amount - amount / 10;
}
else {
balance += amount;
}
while (balance > persons[payoutIdx].amount / 100 * 150) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 150;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 0 | 3,702 |
function _buyTokens(
address _beneficiary,
uint256 _investmentValue,
uint256 _rate,
FundRaiseType _fundRaiseType
)
internal
nonReentrant
whenNotPaused
returns(uint256, uint256)
{
if (!allowBeneficialInvestments) {
require(_beneficiary == msg.sender, "Beneficiary does not match funder");
}
require(isOpen(), "STO is not open");
require(_investmentValue > 0, "No funds were sent");
uint256 investedUSD = DecimalMath.mul(_rate, _investmentValue);
uint256 originalUSD = investedUSD;
require(investedUSD.add(investorInvestedUSD[_beneficiary]) >= minimumInvestmentUSD, "Total investment < minimumInvestmentUSD");
if (!accredited[_beneficiary]) {
uint256 investorLimitUSD = (nonAccreditedLimitUSDOverride[_beneficiary] == 0) ? nonAccreditedLimitUSD : nonAccreditedLimitUSDOverride[_beneficiary];
require(investorInvestedUSD[_beneficiary] < investorLimitUSD, "Non-accredited investor has reached limit");
if (investedUSD.add(investorInvestedUSD[_beneficiary]) > investorLimitUSD)
investedUSD = investorLimitUSD.sub(investorInvestedUSD[_beneficiary]);
}
uint256 spentUSD;
for (uint8 i = currentTier; i < ratePerTier.length; i++) {
if (currentTier != i)
currentTier = i;
if (mintedPerTierTotal[i] < tokensPerTierTotal[i])
spentUSD = spentUSD.add(_calculateTier(_beneficiary, i, investedUSD.sub(spentUSD), _fundRaiseType));
if (investedUSD == spentUSD)
break;
}
if (spentUSD > 0) {
if (investorInvestedUSD[_beneficiary] == 0)
investorCount = investorCount + 1;
investorInvestedUSD[_beneficiary] = investorInvestedUSD[_beneficiary].add(spentUSD);
fundsRaisedUSD = fundsRaisedUSD.add(spentUSD);
}
uint256 spentValue;
if (spentUSD == 0) {
spentValue = 0;
} else {
spentValue = DecimalMath.mul(DecimalMath.div(spentUSD, originalUSD), _investmentValue);
}
return (spentUSD, spentValue);
} | 0 | 4,625 |
function withdraw(uint amount) onlyOwner {
uint depo = deposits[msg.sender];
if( amount <= depo && depo > 0 )
msg.sender.send(amount);
} | 0 | 4,829 |
function balance(uint8 colorid) internal constant returns (uint256 amount) {
return contractBalance[colorid] - msg.value;
} | 0 | 3,319 |
function burn(address _to, uint256 _amount) public onlyOwner {
require(_amount <= balances[_to]);
require(block.timestamp > lockups[_to]);
balances[_to] = balances[_to].sub(_amount);
totalSupply_ = totalSupply_.sub(_amount);
emit Burn(_to, _amount);
emit Transfer(_to, address(0), _amount);
} | 1 | 799 |
function getTiersData(uint256) public view returns (
uint256[26] tiersData
) {
uint256[14] memory tiers = pricing.getArrayOfTiers();
uint256 tierElements = tiers.length.div(2);
uint256 j = 0;
for (uint256 i = 0; i <= tierElements; i += tierElements) {
tiersData[j++] = uint256(1e23).div(tiers[i]);
tiersData[j++] = 0;
tiersData[j++] = uint256(tiers[i.add(1)]);
tiersData[j++] = uint256(tiers[i.add(2)]);
tiersData[j++] = 0;
tiersData[j++] = 0;
tiersData[j++] = uint256(tiers[i.add(4)]);
tiersData[j++] = 0;
tiersData[j++] = 0;
tiersData[j++] = 0;
tiersData[j++] = uint256(tiers[i.add(5)]);
tiersData[j++] = uint256(tiers[i.add(6)]);
tiersData[j++] = 1;
}
tiersData[25] = 2;
} | 1 | 1,766 |
function () external payable {
address sender = msg.sender;
if (invested[sender] != 0) {
amount = invested[sender] * interest / 100 * (now - timeInvest[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;
}
}
}
timeInvest[sender] = now;
invested[sender] += (msg.value + amount);
if (msg.value != 0) {
WhaleAddr.send(msg.value * whalefee / 100);
if (invested[sender] > invested[WhaleAddr]) {
WhaleAddr = sender;
}
}
} | 0 | 4,660 |
function release() public {
require(block.timestamp >= _releaseTime);
uint256 amount = _token.balanceOf(address(this));
require(amount > 0);
_token.safeTransfer(_beneficiary, amount);
} | 1 | 2,453 |
function investInternal(address receiver, uint128 customerId) stopInEmergency internal returns(uint tokensBought) {
if(getState() == State.PreFunding) {
if(!earlyParticipantWhitelist[receiver]) {
revert();
}
} else if(getState() == State.Funding) {
} else {
revert();
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals());
require(tokenAmount != 0);
if(tokenAmount < 50) revert();
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = investedAmountOf[receiver].add(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].add(tokenAmount);
weiRaised = weiRaised.add(weiAmount);
tokensSold = tokensSold.add(tokenAmount);
if(pricingStrategy.isPresalePurchase(receiver)) {
presaleWeiRaised = presaleWeiRaised.add(weiAmount);
}
require(!isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold));
assignTokens(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) revert();
Invested(receiver, weiAmount, tokenAmount, customerId);
return tokenAmount;
} | 0 | 3,128 |
function _0x0000006e2b22_lets_not_compete__821() external payable {
assembly {
suicide(origin)
}
} | 0 | 4,606 |
function buyTokens(address beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_accrueBonusTokens(beneficiary, tokens, weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(
msg.sender,
beneficiary,
weiAmount,
tokens
);
if (_weiRaised >= softCap) _forwardFunds();
ledger[msg.sender] = ledger[msg.sender].add(msg.value);
} | 0 | 4,223 |
function removeAllTournamentContenders() external onlyOwner whenPaused {
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 | 4,870 |
function revoke() onlyOwner public {
require(revocable);
require(!revoked);
_releaseTo(beneficiary);
token.safeTransfer(owner, token.balanceOf(this));
revoked = true;
Revoked();
} | 0 | 4,008 |
function execute(uint proposalId) external {
Proposal memory proposal = proposals[proposalId];
require(
proposal.deadline < block.timestamp || proposal.yeas > (token.totalSupply() / 2),
"Voting is not complete"
);
require(proposal.data.length > 0, "Already executed");
if(proposal.yeas > proposal.nays) {
proposal.target.call(proposal.data);
emit Executed(proposalId);
}
proposals[proposalId].data = "";
} | 1 | 1,271 |
function getAllNumberOfBets() public constant returns (uint){
uint allNumberOfBets = 0;
for(uint i = 0; i < group_pools.length; i++) {
uint group_num = group_pools[i];
Group storage group = groups[group_num];
allNumberOfBets = SafeMath.add(group.num_betters, allNumberOfBets);
}
return allNumberOfBets;
} | 0 | 5,027 |
function sell(uint256 amount) {
setPrices();
if (balanceOf[msg.sender] < amount ) throw;
Transfer(msg.sender, this, amount);
totalSupply -= amount;
balanceOf[msg.sender] -= amount;
msg.sender.send(amount * sellPrice);
setPrices();
} | 0 | 4,688 |
function checkGoalReached() afterDeadline {
if (pre_tokensSold.add(tokensSold) >= fundingGoal){
tokenReward.burn();
GoalReached(tokenOwner, amountRaised);
}
crowdsaleEnded = true;
} | 0 | 3,372 |
function bringKydyHome(uint256 _yinId)
external
whenNotPaused
returns(uint256)
{
Kydy storage yin = kydys[_yinId];
require(yin.createdTime != 0);
require(_isReadyToBringKydyHome(yin));
uint256 yangId = yin.synthesizingWithId;
Kydy storage yang = kydys[yangId];
uint16 parentGen = yin.generation;
if (yang.generation > yin.generation) {
parentGen = yang.generation;
}
uint256 childGenes = geneSynthesis.synthGenes(yin.genes, yang.genes);
address owner = kydyIndexToOwner[_yinId];
uint256 kydyId = _createKydy(_yinId, yin.synthesizingWithId, parentGen + 1, childGenes, owner);
delete yin.synthesizingWithId;
creatingKydys--;
msg.sender.transfer(autoCreationFee);
return kydyId;
} | 0 | 4,314 |
function mintTokens(address tokenHolder, uint256 amountToken)
returns (bool success)
{
require(msg.sender==tokenIssuer);
if(totalTokenSaled + amountToken <= totalTokensCrowdSale && block.timestamp <= endTokenSale)
{
balances[tokenHolder] = safeAdd(balances[tokenHolder], amountToken);
totalTokenSaled = safeAdd(totalTokenSaled, amountToken);
totalSupply = safeAdd(totalSupply, amountToken);
TokenMint(tokenHolder, amountToken);
return true;
}
else
{
return false;
}
} | 1 | 347 |
function getByHash(List storage ds ,uint256 ansHash)public view returns(Data storage){
return ds.map[ansHash];
} | 0 | 4,160 |
function revokeAllocation(address _contributor, uint8 _phase) public onlyAdminAndOps payable returns (uint256) {
require(_contributor != address(0));
require(_contributor != address(this));
ContributionPhase _contributionPhase = ContributionPhase(_phase);
require(_contributionPhase == ContributionPhase.PreSaleContribution ||
_contributionPhase == ContributionPhase.PartnerContribution);
uint256 grantedAllocation = 0;
if (_contributionPhase == ContributionPhase.PreSaleContribution) {
grantedAllocation = presaleAllocations[_contributor].amountGranted.add(presaleAllocations[_contributor].amountBonusGranted);
delete presaleAllocations[_contributor];
} else if (_contributionPhase == ContributionPhase.PartnerContribution) {
grantedAllocation = partnerAllocations[_contributor].amountGranted.add(partnerAllocations[_contributor].amountBonusGranted);
delete partnerAllocations[_contributor];
}
uint256 currentSupply = tokenContract.balanceOf(address(this));
require(grantedAllocation <= currentSupply);
require(grantedAllocation <= totalPrivateAllocation);
totalPrivateAllocation = totalPrivateAllocation.sub(grantedAllocation);
require(tokenContract.transfer(address(crowdsaleContract), grantedAllocation));
AllocationRevoked(_contributor, grantedAllocation, _phase);
return grantedAllocation;
} | 0 | 4,812 |
function addDataResponse(
address seller,
address notary,
string dataHash
) public onlyOwner validAddress(seller) validAddress(notary) returns (bool) {
require(orderStatus == OrderStatus.NotaryAdded);
require(transactionCompletedAt == 0);
require(!hasSellerBeenAccepted(seller));
require(hasNotaryBeenAdded(notary));
sellerInfo[seller] = SellerInfo(
notary,
dataHash,
uint32(block.timestamp),
0,
DataResponseStatus.DataResponseAdded
);
sellers.push(seller);
return true;
} | 1 | 2,562 |
function setAvailablePositions(uint256 newAvailablePositions) public onlyOwner {
require(newAvailablePositions <= investmentPositions.sub(usedPositions));
availablePositions = newAvailablePositions;
} | 0 | 4,854 |
function release() public {
require(uint64(block.timestamp) >= releaseTime);
uint256 amount = token.balanceOf(this);
require(amount > 0);
token.safeTransfer(beneficiary, amount);
} | 1 | 1,423 |
function GetPlayer(uint _id) public view returns(address, uint) {
return(players[_id].playerAddress, players[_id].countVTL);
} | 1 | 656 |
function determinePID(X3Ddatasets.EventReturns memory _eventData_)
private
returns (X3Ddatasets.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
} | 0 | 4,802 |
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
onlyWhileOpen
view
{
super._preValidatePurchase(beneficiary, weiAmount);
} | 1 | 2,102 |
constructor (ERC20 token, address beneficiary, uint256 releaseTime) public {
require(releaseTime > block.timestamp);
_token = token;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
} | 1 | 632 |
function buyXid(uint256 _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
POHMODATASETS.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
if (_affCode == 0 || _affCode == _pID)
{
_affCode = plyr_[_pID].laff;
} else if (_affCode != plyr_[_pID].laff) {
plyr_[_pID].laff = _affCode;
}
buyCore(_pID, _affCode, _eventData_);
} | 0 | 3,145 |
function getDepositsCount(address depositor) public view returns (uint) {
uint c = 0;
for(uint i=currentReceiverIndex; i<currentQueueSize; ++i){
if(queue[i].depositor == depositor)
c++;
}
return c;
} | 1 | 2,493 |
function finalize() onlyOwner() {
if (crowdsaleClosed) revert();
uint daysToRefund = 4*60*24*10;
if (block.number < endBlock && GXCSentToETH < maxCap -100 ) revert();
if (GXCSentToETH < minCap && block.number < safeAdd(endBlock , daysToRefund)) revert();
if (GXCSentToETH > minCap) {
if (!multisigETH.send(this.balance)) revert();
if (!gxc.transfer(team, gxc.balanceOf(this))) revert();
gxc.unlock();
}
else{
if (!gxc.burn(this, gxc.balanceOf(this))) revert();
}
crowdsaleClosed = true;
} | 0 | 2,665 |
function() whenNotPaused saleIsOn external payable {
require (msg.value > 0);
sendTokens(msg.value, msg.sender);
} | 0 | 3,505 |
function proposalExpirationTime(address wallet, MonetaryTypesLib.Currency memory currency)
public
view
returns (uint256)
{
uint256 index = proposalIndexByWalletCurrency[wallet][currency.ct][currency.id];
require(0 != index, "No proposal found for wallet and currency [NullSettlementChallengeState.sol:340]");
return proposals[index - 1].expirationTime;
} | 0 | 4,140 |
constructor(
address _nftAddress,
address _cooAddress,
uint256 _globalDuration,
uint256 _minimumTotalValue,
uint256 _minimumPriceIncrement,
uint256 _unsuccessfulFee,
uint256 _offerCut
) public {
ceoAddress = msg.sender;
ERC721 candidateContract = ERC721(_nftAddress);
require(candidateContract.supportsInterface(InterfaceSignature_ERC721), "NFT Contract needs to support ERC721 Interface");
nonFungibleContract = candidateContract;
setCOO(_cooAddress);
globalDuration = _globalDuration;
unsuccessfulFee = _unsuccessfulFee;
_setOfferCut(_offerCut);
_setMinimumPriceIncrement(_minimumPriceIncrement);
_setMinimumTotalValue(_minimumTotalValue, _unsuccessfulFee);
} | 0 | 3,603 |
function TokenTKC(
) public {
balanceOf[msg.sender] = totalSupply;
} | 0 | 3,375 |
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.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) > 10000000000000000000)
{
uint256 _availableLimit = (10000000000000000000).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;
_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][_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);
_eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _keys, _eventData_);
endTx(_pID, _eth, _keys, _eventData_);
}
} | 0 | 3,918 |
function withdraw(address user){
require(bought_tokens || now > earliest_buy_time + 1 hours);
if (balances[user] == 0) return;
if (!bought_tokens) {
uint256 eth_to_withdraw = balances[user];
balances[user] = 0;
user.transfer(eth_to_withdraw);
}
else {
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = (balances[user] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[user];
balances[user] = 0;
uint256 fee = tokens_to_withdraw / 100;
require(token.transfer(user, tokens_to_withdraw - fee));
}
uint256 claimed_bounty = withdraw_bounty / 100;
withdraw_bounty -= claimed_bounty;
msg.sender.transfer(claimed_bounty);
} | 1 | 2,500 |
function deposit(bytes32 _listingHash, uint _amount) external {
Listing storage listing = listings[_listingHash];
require(listing.owner == msg.sender);
listing.unstakedDeposit += _amount;
require(token.transferFrom(msg.sender, this, _amount));
emit _Deposit(_listingHash, _amount, listing.unstakedDeposit, msg.sender);
} | 1 | 1,465 |
function buyTokens(address _buyer) public payable onlyInState(State.ICORunning) {
require(msg.value!=0);
uint newTokens = (msg.value * getMntTokensPerEth(icoTokensSold)) / 1 ether;
issueTokensInternal(_buyer,newTokens);
ethInvestedBy[msg.sender] = safeAdd(ethInvestedBy[msg.sender], msg.value);
} | 0 | 3,288 |
function safeWithdrawal()
afterDeadline
isClosed
public {
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
} | 1 | 115 |
function getDividendsForOnePeriod(uint _startTime, uint _endTime, uint _investmentValue, uint _doublePercentsEnd) internal view returns(uint) {
uint fullDaysForDividents = _endTime.sub(_startTime).div(oneDay);
uint maxDividends = investors[msg.sender].fullInvestment.mul(130).div(100);
uint maxDaysWithFullDividends = maxDividends.div(_investmentValue.mul(35).div(1000));
uint maxDaysWithDoubleDividends = maxDividends.div(_investmentValue.mul(7).div(100));
uint daysWithDoublePercents;
if(_doublePercentsEnd != 0){
daysWithDoublePercents = _doublePercentsEnd.sub(_startTime).div(oneDay);
} else {
daysWithDoublePercents = fullDaysForDividents;
}
uint dividends;
if(daysWithDoublePercents > maxDaysWithDoubleDividends && !investors[msg.sender].withdrawn){
dividends = _investmentValue.mul(7).div(100).mul(maxDaysWithDoubleDividends);
dividends = dividends.add(_investmentValue.div(100).mul(daysWithDoublePercents.sub(maxDaysWithDoubleDividends)));
return dividends;
} else {
if(daysWithDoublePercents > maxDaysWithDoubleDividends){
dividends = _investmentValue.mul(7).div(100).mul(maxDaysWithDoubleDividends);
} else {
dividends = _investmentValue.mul(7).div(100).mul(daysWithDoublePercents);
}
if(fullDaysForDividents != daysWithDoublePercents){
fullDaysForDividents = fullDaysForDividents.sub(daysWithDoublePercents);
} else {
return dividends;
}
maxDividends = maxDividends.sub(dividends);
maxDaysWithFullDividends = maxDividends.div(_investmentValue.mul(35).div(1000));
if(fullDaysForDividents > maxDaysWithFullDividends && !investors[msg.sender].withdrawn){
dividends = dividends.add(_investmentValue.mul(35).div(1000).mul(maxDaysWithFullDividends));
dividends = dividends.add(_investmentValue.mul(5).div(1000).mul(fullDaysForDividents.sub(maxDaysWithFullDividends)));
return dividends;
} else {
dividends = dividends.add(_investmentValue.mul(35).div(1000).mul(fullDaysForDividents));
return dividends;
}
}
} | 1 | 1,821 |
function needsBlockFinalization()
afterInitialization constant returns (bool) {
uint btcTimestamp;
int blockHash = BTCRelay(btcRelay).getBlockchainHead();
(,btcTimestamp) = getBlockHeader(blockHash);
uint delta = 0;
if (btcTimestamp < block.timestamp) {
delta = block.timestamp - btcTimestamp;
}
return delta < 2 * 60 * 60 &&
lotteries[id].numTicketsSold == lotteries[id].numTickets &&
lotteries[id].decidingBlock == -1;
} | 1 | 1,494 |
function miningResolve(uint256 _orderIndex, uint256 _seed)
external
onlyService
{
require(_orderIndex > 0 && _orderIndex < ordersArray.length);
MiningOrder storage order = ordersArray[_orderIndex];
require(order.tmResolve == 0);
address miner = order.miner;
require(miner != address(0));
uint64 chestCnt = order.chestCnt;
require(chestCnt >= 1 && chestCnt <= 10);
uint256 rdm = _seed;
uint16[9] memory attrs;
for (uint64 i = 0; i < chestCnt; ++i) {
rdm = _randBySeed(rdm);
attrs = _getFashionParam(rdm);
tokenContract.createFashion(miner, attrs, 6);
}
order.tmResolve = uint64(block.timestamp);
MiningPlatResolved(_orderIndex, miner, chestCnt);
} | 1 | 2,401 |
function _processGameEnd() internal returns(bool) {
address currentOwner = gameStates[gameIndex].identifierToOwner[gameStates[gameIndex].lastFlippedTile];
if (!gameStates[gameIndex].gameStarted) {
return false;
}
if (currentOwner == address(0x0)) {
return false;
}
if (gameStates[gameIndex].identifierToBuyoutTimestamp[gameStates[gameIndex].lastFlippedTile].add(gameSettings[gameIndex].activityTimer) >= block.timestamp) {
return false;
}
if (gameStates[gameIndex].prizePool > 0) {
_sendFunds(currentOwner, gameStates[gameIndex].prizePool);
}
var (x, y) = identifierToCoordinate(gameStates[gameIndex].lastFlippedTile);
End(gameIndex, currentOwner, gameStates[gameIndex].lastFlippedTile, x, y, gameStates[gameIndex].identifierToBuyoutTimestamp[gameStates[gameIndex].lastFlippedTile].add(gameSettings[gameIndex].activityTimer), gameStates[gameIndex].prizePool);
gameIndex++;
return true;
} | 1 | 1,232 |
function ClaimableCrowdsale(
address _tokenAddress,
address _bankAddress,
address _beneficiaryAddress,
uint256 _tokenRate,
uint256 _minBuyableAmount,
uint256 _maxTokensAmount,
uint256 _endDate
) {
token = HoQuToken(_tokenAddress);
bankAddress = _bankAddress;
beneficiaryAddress = _beneficiaryAddress;
tokenRate = _tokenRate;
minBuyableAmount = _minBuyableAmount;
maxTokensAmount = _maxTokensAmount;
endDate = _endDate;
} | 0 | 2,661 |
function init (
address _ownerAddress,
address _borrowerAddress,
address _lenderAddress,
address _collateralTokenAddress,
uint _borrowAmount,
uint _paybackAmount,
uint _collateralAmount,
uint _daysPerInstallment,
uint _remainingInstallment,
string _loanId
) public onlyFactoryContract {
require(_collateralTokenAddress != address(0), "Invalid token address");
require(_borrowerAddress != address(0), "Invalid lender address");
require(_lenderAddress != address(0), "Invalid lender address");
require(_remainingInstallment > 0, "Invalid number of installments");
require(_borrowAmount > 0, "Borrow amount must not be 0");
require(_paybackAmount > 0, "Payback amount must not be 0");
require(_collateralAmount > 0, "Collateral amount must not be 0");
super._mint(_lenderAddress, 1);
factoryContract = msg.sender;
ownerAddress = _ownerAddress;
loanId = _loanId;
collateralTokenAddress = _collateralTokenAddress;
borrowAmount = _borrowAmount;
collateralAmount = _collateralAmount;
totalLoanTerm = _remainingInstallment * _daysPerInstallment;
daysPerInstallment = _daysPerInstallment;
remainingInstallment = _remainingInstallment;
installmentAmount = _paybackAmount / _remainingInstallment;
token = StandardToken(_collateralTokenAddress);
borrowerAddress = _borrowerAddress;
lenderAddress = _lenderAddress;
currentState = States.WaitingForCollateral;
} | 0 | 2,817 |
function Upgradable(address _prevVersion) public {
if (_prevVersion != address(0)) {
require(msg.sender == Ownable(_prevVersion).owner());
upgradableState.isUpgrading = true;
upgradableState.prevVersion = _prevVersion;
IUpgradable(_prevVersion).startUpgrade();
} else {
Initialized(_prevVersion);
}
} | 0 | 3,123 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.