func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function accept(uint _brickId, address[] _winners, uint[] _weights, uint _value)
external onlyMain
returns (uint)
{
require(bricks[_brickId].status == BrickStatus.Active);
require(_winners.length == _weights.length);
uint total = 0;
bool included = false;
for (uint i = 0; i < _winners.length; i++) {
require(_winners[i] != tx.origin, "Owner should not win this himself");
for (uint j =0; j < bricks[_brickId].numBuilders; j++) {
if (bricks[_brickId].builders[j].addr == _winners[i]) {
included = true;
break;
}
}
total = total.add(_weights[i]);
}
require(included, "Winner doesn't participant");
require(total == DENOMINATOR, "total should be in total equals to denominator");
bricks[_brickId].status = BrickStatus.Completed;
bricks[_brickId].winners = _winners;
bricks[_brickId].dateCompleted = uint32(now);
if (_value > 0) {
bricks[_brickId].value = bricks[_brickId].value.add(_value);
}
return bricks[_brickId].value;
} | 0 | 11,853 |
function initialize(address _target) public;
}
contract BZxProxy is BZxStorage, BZxProxiable {
constructor(
address _settings)
public
{
(bool result,) = _settings.delegatecall.gas(gasleft())(abi.encodeWithSignature("initialize(address)", _settings));
require(result, "BZxProxy::constructor: failed");
} | 0 | 19,210 |
function approveByLegacy(address from, address spender, uint value) public returns (bool);
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
} | 0 | 15,794 |
function setCaps() internal {
saleCap = distributedSaleStakes+stakeForWei(remainingInvestment());
supplyCap = saleCap.mul(100).div(saleShare);
teamCap = supplyCap.mul(teamShare).div(100);
fundariaCap = supplyCap.mul(fundariaShare).div(100);
bonusCap = supplyCap.mul(bonusShare).div(100);
bountyCap = supplyCap.sub(saleCap).sub(teamCap).sub(bonusCap);
} | 0 | 11,398 |
function returnTokensToSender(uint64 paymentId, uint amount) external onlyPayee(paymentId) {
require(amount <= payments[paymentId].amount);
transferTokens(address(this), payments[paymentId].payer, amount, payments[paymentId].isEthPayment);
if (amount == payments[paymentId].amount) {
_deletePayment(paymentId);
}
else {
payments[paymentId].amount = payments[paymentId].amount.sub(amount);
}
} | 1 | 8,408 |
function unbond(bytes32 specifier, uint numDots) public {
bondage = BondageInterface(coord.getContract("BONDAGE"));
uint issued = bondage.getDotsIssued(address(this), specifier);
currentCost = CurrentCostInterface(coord.getContract("CURRENT_COST"));
uint reserveCost = currentCost._costOfNDots(address(this), specifier, issued + 1 - numDots, numDots - 1);
bondage.unbond(address(this), specifier, numDots);
FactoryTokenInterface curveToken = FactoryTokenInterface(curves[specifier]);
curveToken.burnFrom(msg.sender, numDots);
require(reserveToken.transfer(msg.sender, reserveCost), "Error: Transfer failed");
Unbonded(specifier, numDots, msg.sender);
} | 1 | 9,586 |
function addWhiteListedInvestor(address _investor, string _referralCode) public
{
require(block.timestamp <= whiteListRegistrationEndTime);
require(_investor != 0);
require(!isWhiteListed[_investor]);
bytes32 referralCodeHash = keccak256(_referralCode);
require(referralCodes[referralCodeHash] == 0x0);
isWhiteListed[_investor] = true;
referralCodes[referralCodeHash] = _investor;
WhiteListedInvestorAdded(_investor, _referralCode);
} | 0 | 11,339 |
constructor(address _resolver)
public
{
require(init(CONTRACT_STORAGE_DAO_WHITELISTING, _resolver));
} | 1 | 5,652 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
}
contract multiowned {
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
} | 0 | 15,943 |
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (m_txs[_h].to != 0) {
require(m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data));
MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
delete m_txs[_h];
return true;
}
} | 1 | 2,676 |
function memberLog()
private
{
address _member = msg.sender;
lastClaim[_member] = block.timestamp;
if (isMember[_member]) return;
member.push(_member);
isMember[_member] = true;
} | 0 | 11,474 |
function migrate(uint256 amount) {
if (!isFinalized)
revert();
if (migrateDisabled)
revert();
if (pendingMigrations[msg.sender].amount > 0)
revert();
uint256 amount_4dp = amount / (10**14);
StandardToken(0x0042a689f1ebfca404e13c29cb6d01e00059ba9dbc).transferFrom(msg.sender, this, amount_4dp);
pendingMigrations[msg.sender].dateTimeCreated = now;
pendingMigrations[msg.sender].amount = amount;
} | 1 | 6,880 |
function pause() onlyOwner whenNotPaused public {
require(pauseCutoffTime == 0 || pauseCutoffTime >= block.timestamp);
paused = true;
emit Pause();
} | 0 | 17,935 |
function getStats() public constant returns (uint256, uint256, uint256) {
return (totalEthereumRaised, token.totalSupply(), totaldivineTokensIssued);
} | 0 | 11,117 |
function purchaseTokens()
payable
saleHappening {
uint excessAmount = msg.value % price;
uint purchaseAmount = SafeMath.sub(msg.value, excessAmount);
uint tokenPurchase = SafeMath.div(purchaseAmount, price);
require(tokenPurchase <= token.balanceOf(this));
if (excessAmount > 0) {
msg.sender.transfer(excessAmount);
}
sold = SafeMath.add(sold, tokenPurchase);
assert(sold <= cap);
wallet.transfer(purchaseAmount);
assert(token.transfer(msg.sender, tokenPurchase));
PurchasedTokens(msg.sender, tokenPurchase);
} | 1 | 6,325 |
function calculateStake(uint256 _numRTC)
internal
view
returns (
uint256 blockLocked,
uint256 blockReleased,
uint256 releaseDate,
uint256 totalCoinsMinted,
uint256 rewardPerBlock
)
{
blockLocked = block.number;
blockReleased = blockLocked.add(BLOCKHOLDPERIOD);
releaseDate = now.add(BLOCKHOLDPERIOD.mul(BLOCKSEC));
totalCoinsMinted = _numRTC.mul(MULTIPLIER);
totalCoinsMinted = totalCoinsMinted.div(1 ether);
rewardPerBlock = totalCoinsMinted.div(BLOCKHOLDPERIOD);
} | 0 | 13,801 |
function donate()
public
payable
{
require(msg.sender != receiver);
require(block.timestamp < (timeStarted + expirationInSeconds));
require(msg.value > 0);
require(minimumAmountRequired != 0);
require(hasBeenClaimed == false);
assert(donationData[msg.sender] + msg.value >= donationData[msg.sender]);
assert(totalAmountRaised + msg.value >= totalAmountRaised);
assert(numPayments + 1 >= numPayments);
donationData[msg.sender] += msg.value;
totalAmountRaised += msg.value;
numPayments += 1;
} | 0 | 13,349 |
function getTuber(uint256 _tokenId) public view returns (
string tuberName,
uint256 sellingPrice,
address owner
) {
Tuber storage tuber = tubers[_tokenId];
tuberName = tuber.name;
sellingPrice = tuberIndexToPrice[_tokenId];
owner = tuberIndexToOwner[_tokenId];
} | 0 | 12,033 |
function init_claim(uint256 balance) private atStage(Stages.initClaim) {
firstRelease = now + 26 weeks;
secondRelease = firstRelease + 26 weeks;
thirdRelease = secondRelease + 26 weeks;
fourthRelease = thirdRelease + 26 weeks;
uint256 amountToTransfer = balance.mul(52).div(100);
ERC20Token.transfer(beneficiary, amountToTransfer);
nextStage();
} | 1 | 4,930 |
function buyFirstTokens(
IMultiToken _mtkn,
ERC20 _throughToken,
address[] _exchanges,
bytes _datas,
uint[] _datasIndexes,
uint256[] _values
)
public
payable
{
require(_datasIndexes.length == _exchanges.length + 1, "buy: _datasIndexes should start with 0 and end with LENGTH");
require(_values.length == _exchanges.length, "buy: _values should have the same length as _exchanges");
for (uint i = 0; i < _exchanges.length; i++) {
bytes memory data = new bytes(_datasIndexes[i + 1] - _datasIndexes[i]);
for (uint j = _datasIndexes[i]; j < _datasIndexes[i + 1]; j++) {
data[j - _datasIndexes[i]] = _datas[j];
}
if (_throughToken != address(0) && i > 0) {
_throughToken.approve(_exchanges[i], 0);
_throughToken.approve(_exchanges[i], _throughToken.balanceOf(this));
}
require(_exchanges[i].call.value(_values[i])(data), "buy: exchange arbitrary call failed");
if (_throughToken != address(0)) {
_throughToken.approve(_exchanges[i], 0);
}
}
uint tokensCount = _mtkn.tokensCount();
uint256[] memory amounts = new uint256[](tokensCount);
for (i = 0; i < tokensCount; i++) {
ERC20 token = _mtkn.tokens(i);
amounts[i] = token.balanceOf(this);
token.approve(_mtkn, 0);
token.approve(_mtkn, amounts[i]);
}
_mtkn.bundleFirstTokens(msg.sender, msg.value.mul(1000), amounts);
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
} | 0 | 14,400 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
_p3d = _p3d.add(_com);
uint256 _long = _eth / 100;
otherF3D_.send(_long);
uint256 _aff;
uint256 _aff2;
uint256 _affID2 = plyr_[_affID].laff;
if (_affID2 != 0 && plyr_[_affID2].name != "") {
_aff = _eth.mul(10) / 100;
_aff2 = _eth.mul(5) / 100;
plyr_[_affID2].aff = _aff2.add(plyr_[_affID2].aff);
} else {
_aff = _eth.mul(15) / 100;
}
if (_affID != _pID && plyr_[_affID].name != "") {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
} else {
_p3d = _p3d.add(_aff);
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
reward.send(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 13,742 |
function GetGoodsInfo(uint32 iGoods) external view returns(
uint32,uint32,uint32,uint32,uint32,uint,uint8,uint8,uint8
)
{
Goods storage obj = g_Goods[iGoods];
return (
obj.m_Index,
obj.m_CostItem,
obj.m_ItemRef,
obj.m_Amount,
obj.m_Duration,
obj.m_CostNum,
obj.m_PurchaseLimit,
obj.m_DiscountLimit,
obj.m_DiscountRate
);
} | 0 | 19,309 |
function buyTokens(address _beneficiary) public payable {
weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = getTokenAmount(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
weiRaised = weiRaised.add(weiAmount);
_postValidatePurchase(_beneficiary, weiAmount);
weiAmount = 0;
} | 1 | 2,730 |
function getProfile() external view returns(uint, string){
Profile storage profile = profiles[msg.sender];
return (profile.avatarIndex, profile.nickName);
} | 0 | 19,093 |
function admin_transferFrom(address _from, address _to, uint256 _value) public isOwner returns(bool success)
{
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + (_value ) >= balanceOf[_to]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
} | 0 | 14,999 |
function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public {
NTech3DDatasets.EventReturns memory _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;
}
_team = verifyTeam(_team);
reLoadCore(_pID, _affCode, _team, _eth, _eventData_);
} | 1 | 4,296 |
function createTokenContract() internal returns (GRAD) {
return new GRAD();
} | 0 | 12,262 |
function getGamePrize(uint gameId) constant returns(uint) {
return games[gameId].prize;
} | 0 | 17,518 |
function removeMiner(address _address) public {
require(msg.sender == commonAdmin);
allowedMiner[_address] = 0;
} | 0 | 10,611 |
function purchaseCompany(bytes32 nameFromUser, bool superPrivilege) public payable {
bytes32 nameLowercase = utils.lowerCase(nameFromUser);
Company storage c = companies[nameLowercase];
require(c.owner != address(0));
require(c.owner != msg.sender);
require(c.price == msg.value);
require(c.isOnsale == true);
if (superPrivilege) {
require(superPrivilegeCount[msg.sender] > 0);
}
address oldOwner = c.owner;
uint256 profit = c.price - c.lastPrice;
oldOwner.transfer(c.lastPrice + profit * 8/10);
c.owner = msg.sender;
c.lastPrice = c.price;
c.price = costContract.calculateNextPrice(c.price);
emit CompanyTransferred(c.name, c.price, oldOwner, msg.sender);
claimToken(oldOwner);
ownedPerformance[oldOwner] -= c.performance;
claimToken(msg.sender);
ownedPerformance[msg.sender] += c.performance;
if (superPrivilege) {
c.isOnsale = false;
superPrivilegeCount[msg.sender]--;
emit CompanySaleStatusChanged(c.name, c.isOnsale, c.price, msg.sender);
}
} | 1 | 483 |
function ZebiMainCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _ETHtoZWeirate, address _wallet,uint256 _minTransAmount,uint256 _ethCap, address tokenAddress, address presaleAddress,address tempMngrAddress,uint256 _goldListPeriod,uint256 _postGoldPeriod,uint256 _goldPeriodCap,uint256 _vestedMintStartTime,uint256 _calenderYearStart) public {
require(_startTime >= now);
require(_endTime >= _startTime);
require(_ETHtoZWeirate > 0);
require(_wallet != address(0));
token = ZebiCoin(tokenAddress);
zcc = ZebiCoinCrowdsale(presaleAddress);
startTime = _startTime;
endTime = _endTime;
ETHtoZWeirate = _ETHtoZWeirate;
wallet = _wallet;
minTransAmount = _minTransAmount;
tokenDecimals = token.decimals();
ethCap = _ethCap;
tempMngr=ZebiCoinTempMgr(tempMngrAddress);
goldListPeriod=_goldListPeriod;
postGoldPeriod=_postGoldPeriod;
zebiZCOShare=SafeMath.mul(500000000,(10**tokenDecimals));
crowdsaleZCOCap=zebiZCOShare;
goldPeriodCap=_goldPeriodCap;
calenderYearMintCap = SafeMath.div((zebiZCOShare.mul(2)),8);
vestedMintStartTime=_vestedMintStartTime;
calenderYearStart=_calenderYearStart;
calenderYearEnd=(calenderYearStart+1 years )- 1;
} | 1 | 8,562 |
function depositToken(address _token, uint _amount) public whenNotPaused {
require(_token != address(0));
require(ERC20(_token).transferFrom(msg.sender, this, _amount));
tokens[_token][msg.sender] = SafeMath.add(tokens[_token][msg.sender], _amount);
emit Deposit(_token, msg.sender, _amount, tokens[_token][msg.sender]);
} | 1 | 1,315 |
function update(address account) internal {
if(nextRelease < 24 && block.timestamp > releaseDates[nextRelease]){
releaseDivTokens();
}
uint256 owed =
scaledDividendPerToken - scaledDividendCreditedTo[account];
scaledDividendBalanceOf[account] += balanceOf[account] * owed;
scaledDividendCreditedTo[account] = scaledDividendPerToken;
} | 0 | 13,766 |
function modifyAllLevelCaps (uint[] cap, uint time) public onlyOwner {
require (contractStage < 3);
require (cap.length == contributionCaps.length-1);
require (time == 0 || time>block.timestamp);
if (time == 0) {
for (uint8 i = 0; i < cap.length; i++) {
modifyLevelCap(i+1, cap[i]);
}
} else {
nextContributionCaps = contributionCaps;
nextCapTime = time;
for (i = 0; i < cap.length; i++) {
require (contributionCaps[i+1] <= cap[i] && contributionCaps[0] >= cap[i]);
nextContributionCaps[i+1] = cap[i];
}
}
} | 0 | 18,075 |
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) {
require(_amount <= allowances[_from][msg.sender]);
require(!tokenFrozen);
_transfer(_from, _to, _amount);
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_amount);
return true;
} | 1 | 6,677 |
function setupBankrollInterface(address ZethrMainBankrollAddress)
internal
{
Zethr = ZethrInterface(0xb9ab8eed48852de901c13543042204c6c569b811);
UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList();
for(uint i=0; i<7; i++){
ValidBankrollAddress[UsedBankrollAddresses[i]] = true;
}
} | 1 | 9,380 |
function refund() public inState(State.Refunding) {
uint weiValue = investedAmountOf[msg.sender];
require(weiValue != 0);
uint saleContractTokenCount = tokenAmountOf[msg.sender];
uint tokenContractTokenCount = token.balanceOf(msg.sender);
require(saleContractTokenCount <= tokenContractTokenCount);
investedAmountOf[msg.sender] = 0;
weiRefunded = weiRefunded.add(weiValue);
internalRefund(msg.sender, weiValue);
} | 1 | 3,820 |
function LINKFund() {
min_buy_block = 4212799;
min_refund_block = 4295743;
} | 0 | 11,568 |
function withdrawTokensRemaining() public returns (bool) {
require(msg.sender == owner);
require(block.timestamp > sale.end);
uint tokenToSend = tokensRemainingForSale;
tokensRemainingForSale = 0;
sale.tokens = 0;
bool result = tokenWallet.transfer(owner, tokenToSend);
require(result == true);
Distribute(owner, tokenToSend);
return true;
} | 0 | 12,408 |
function verifyStage()internal
{
if (stage==Stage.second&&Remain==0)
{
stage= Stage.secondreturn;
}
if (stage==Stage.firstreturn&&confirm2stage)
{
stage=Stage.second;
}
if (uint32(block.timestamp)> endtime&&Remain>10000000*10**9&&stage==Stage.first)
{
stage=Stage.fail;
}
if (uint32(block.timestamp)>= endtime&&stage==Stage.first)
{
stage=Stage.firstreturn;
}
} | 0 | 18,172 |
function transferAndCall(address _to, uint256 _value, bytes memory _extraData) public returns (bool success){
if (transferFrom(msg.sender, _to, _value)) {
ERC677Receiver receiver = ERC677Receiver(_to);
if (receiver.onTokenTransfer(msg.sender, _value, _extraData)) {
emit DataSentToAnotherContract(msg.sender, _to, _extraData);
return true;
}
}
return false;
} | 0 | 17,597 |
function changeCardboardUnicornTokenAddress(address _newTokenAddress) onlyOwner {
CardboardUnicorns cu = CardboardUnicorns(_newTokenAddress);
require(cu.owner() == address(this));
cardboardUnicornTokenAddress = _newTokenAddress;
} | 1 | 2,485 |
function getBonusUnlockAt() public view returns (uint) {
return bonusUnlockAt;
} | 0 | 11,345 |
function _mine(uint _rate, uint _inAmount) private returns (uint) {
assert(_rate > 0);
if (now > cycleEndTime && cycleMintSupply > 0) {
_startSwap();
return _inAmount;
}
uint tokens = _rate.mul(_inAmount).div(offset);
uint refund = 0;
uint futcFeed = tokens.mul(35).div(65);
if (tokens + futcFeed + cycleMintSupply > CYCLE_CAP) {
uint overage = tokens + futcFeed + cycleMintSupply - CYCLE_CAP;
uint tokenOverage = overage.mul(65).div(100);
futcFeed -= (overage - tokenOverage);
tokens -= tokenOverage;
refund = tokenOverage.mul(offset).div(_rate);
}
cycleMintSupply += (tokens + futcFeed);
require(futcFeed > 0, "Mining payment too small.");
MintableToken(this).mint(msg.sender, tokens);
MintableToken(this).mint(FUTC, futcFeed);
return refund;
} | 1 | 8,193 |
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
whenNotPaused
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(msg.sender, _tokenId));
_escrow(msg.sender, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
} | 1 | 5,034 |
function execute(address _player, uint _tokenCount, uint _tier, bytes _data)
isNotPaused
bankrollOnly
betIsValid(_tokenCount, _tier, _data)
hasNotBetThisBlock(_player)
public
{
Bet storage playerBet = getBet(_player);
if (playerBet.blockNumber != 0) {
finishBetFrom(_player);
}
playerBet.tokenValue = uint56(_tokenCount.div(1e14));
playerBet.blockNumber = uint48(block.number);
playerBet.tier = uint8(_tier);
require(_data.length == 32);
uint actual_data;
assembly{
actual_data := mload(add(_data, 0x20))
}
playerBet.bets = actual_data;
uint40[5] memory actual_bets = uintToBetsArray(actual_data);
require((uint(actual_bets[0]) + uint(actual_bets[1]) + uint(actual_bets[2]) + uint(actual_bets[3]) + uint(actual_bets[4])).mul(1e14) == _tokenCount);
pendingBetsQueue.length++;
pendingBetsQueue[queueTail] = _player;
queueTail++;
pendingBetsMapping[_player] = queueTail - 1;
emit Wager(_player, _tokenCount, _data);
} | 1 | 907 |
function jackpot()
private
{
uint256 keyBlockNr = getKeyBlockNr(lastBlockNr);
uint256 seed = getSeed(keyBlockNr);
uint256 jReward;
address winner;
while (jSlot + 1 < round[curRoundId].slotSum) {
if (MAJOR_RATE > 2) MAJOR_RATE--;
if (Helper.isJackpot(seed, MAJOR_RATE, MAJOR_MIN, slot[jSlot].ethAmount)){
winner = slot[jSlot].buyer;
jReward = majorPot / 100 * jRewardPercent;
mintReward(winner, 0, jSlot, jReward, RewardType.Major);
majorPot = majorPot - jReward;
MAJOR_RATE = 1001;
}
seed = seed + jSlot;
if (MINOR_RATE > 2) MINOR_RATE--;
if (Helper.isJackpot(seed, MINOR_RATE, MINOR_MIN, slot[jSlot].ethAmount)){
winner = slot[jSlot].buyer;
jReward = minorPot / 100 * jRewardPercent;
mintReward(winner, 0, jSlot, jReward, RewardType.Minor);
minorPot = minorPot - jReward;
MINOR_RATE = 501;
}
seed = seed + jSlot;
jSlot++;
}
} | 1 | 1,576 |
function withdraw()
public
isActivated()
{
uint256 _pID = getPlayerID();
endRoundAndGetEarnings(_pID);
uint256 _dividends;
uint256 _luckBonus;
(_dividends,_luckBonus) = withdrawEarnings(_pID);
uint256 _earnings = _dividends.add(_luckBonus);
if (_earnings > 0)
plyr_[_pID].addr.transfer(_earnings);
emit onWithdraw(msg.sender, _pID, rID_, _earnings, _dividends, _luckBonus);
} | 1 | 5,199 |
function registerEthHandle(bytes32 _handle, address _addr) public payable {
require(_addr != address(0));
if (ethHandleRegistred[_handle] && ownsEthHandle[msg.sender][_handle]) {
ahs.registerHandle(ethBase, _handle, _addr);
}
if (!ethHandleRegistred[_handle]) {
ethHandleRegistred[_handle] = true;
ownsEthHandle[msg.sender][_handle] = true;
ahs.registerHandle(ethBase, _handle, _addr);
} else {
revert();
}
} | 1 | 1,339 |
function allowRedeem() public onlyThridParty returns (uint256) {
require(executed);
require(redeemed == false);
require(redeemable == false);
require(block.timestamp >= unlockDate);
require(validate());
redeemable = true;
} | 1 | 5,170 |
function teamVestingStage() public view onlyTeamReserve returns(uint256){
uint256 vestingMonths = teamTimeLock.div(teamVestingStages);
uint256 stage = (block.timestamp).sub(firstTime).div(vestingMonths);
if(stage > teamVestingStages){
stage = teamVestingStages;
}
return stage;
} | 0 | 10,909 |
function getCryptodiamondAddress() public constant returns (address){
return cryptodiamondAddress;
} | 0 | 12,354 |
function addRound(uint256 StartTimeStamp, uint256 EndTimeStamp, uint256 Rate) onlyOwner public {
rounds.push(Round(StartTimeStamp, EndTimeStamp, Rate));
} | 1 | 3,014 |
function forwardFunds() internal {
WLMWallet.transfer(msg.value);
} | 0 | 13,476 |
function getCodeSize(address _addr)
constant
internal
returns(uint _size)
{
assembly {
_size := extcodesize(_addr)
}
} | 1 | 6,556 |
function purchase(uint256 _tokenId , address _referredBy) public payable notContract notPaused easyOnGas {
if (now >= roundEndingTime){
newRound();
}
uint256 currentPrice = tribalMasks[_tokenId].currentPrice;
require(msg.value >= currentPrice);
address oldOwner = tokenIndexToOwner[_tokenId];
address newOwner = msg.sender;
require(oldOwner != newOwner);
require(_addressNotNull(newOwner));
uint256 previousOwnerGets = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),previousOwnerPercent);
uint256 exchangeTokensAmount = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),exchangeTokenPercent);
uint256 devFeeAmount = SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),devFeePercent);
currentPot = currentPot + SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),currentPotPercent);
nextPot = nextPot + SafeMath.mul(SafeMath.div(currentPrice,increaseRatePercent),nextPotPercent);
if (msg.value > currentPrice){
if (now < roundEndingTime){
nextPot = nextPot + (msg.value - currentPrice);
}else{
msg.sender.transfer(msg.value - currentPrice);
}
}
currentDevFee = currentDevFee + devFeeAmount;
templeContract.purchaseFor.value(exchangeTokensAmount)(_referredBy, msg.sender);
_transfer(oldOwner, newOwner, _tokenId);
tribalMasks[_tokenId].currentPrice = SafeMath.mul(SafeMath.div(currentPrice,100),increaseRatePercent);
roundEndingTime = roundEndingTime + tribalMasks[_tokenId].timePowerMinutes;
lastFlip = _tokenId;
if (oldOwner != address(this)) {
if (oldOwner.send(previousOwnerGets)){}
}
emit onTokenSold(_tokenId, currentPrice, oldOwner, newOwner, tribalMasks[_tokenId].name);
} | 1 | 1,989 |
function PreSaleBuy(address _referrer) payable external returns (bool){
if(promoters[_referrer].Registered == false) revert();
if(msg.value <= 0) revert();
IcoData
DataCall = IcoData(addressbook[ContractAddr].DataAddr);
la.l1 = DataCall.GetEnd();
la.l2 = DataCall.GetPreSale();
ta.n5 = DataCall.GetEtherPrice();
ta.n6 = DataCall.GetTocPrice();
ta.n7 = DataCall.GetCommission();
if(la.l1 == true) revert();
if(la.l2 == false) revert();
ta.n8 = CalcToc(ta.n5, ta.n6, msg.value);
if(ta.n8 > orderbooks[ContractAddr].PreSupply) revert();
ta.n9 = RefCommission(msg.value, ta.n7);
ta.n10 = sub(msg.value, ta.n9);
addressbook[ContractAddr].Banker.transfer(ta.n10);
_referrer.transfer(ta.n9);
orderbooks[ContractAddr].PreSupply -= ta.n8;
buyer[msg.sender].TocBalance += ta.n8;
buyer[msg.sender].Num += 1;
ta.n11 = buyer[msg.sender].Num;
transaction[msg.sender][ta.n11].Amount = ta.n8;
transaction[msg.sender][ta.n11].EtherPrice = ta.n5;
transaction[msg.sender][ta.n11].TocPrice = ta.n6;
transaction[msg.sender][ta.n11].Block = block.number;
promoters[_referrer].TotalCommission += ta.n9;
return true;
} | 1 | 7,655 |
function closeSale() external onlyOwner
{
lynT.transfer(msg.sender, lynT.balanceOf(address(this)));
beneficiary.transfer(address(this).balance);
crowdsaleClosed = true;
emit LogSaleClosed();
} | 1 | 3,965 |
function generateTeamTokens() internal ICOFinished {
require(!teamTokensGenerated);
teamTokensGenerated = true;
uint totalSupplyTokens = totalSupply;
debugLog('totalSupplyTokens', totalSupplyTokens);
totalSupplyTokens = totalSupplyTokens.mul(100);
debugLog('totalSupplyTokens div 60', totalSupplyTokens);
totalSupplyTokens = totalSupplyTokens.div(60);
debugLog('totalSupplyTokens mul 100', totalSupplyTokens);
for (uint8 i = 0; i < listTeamTokens.length; ++i) {
uint teamTokensPart = percent(totalSupplyTokens, listTeamTokens[i].percent);
if (listTeamTokens[i].divider != 0) {
teamTokensPart = teamTokensPart.div(listTeamTokens[i].divider);
}
if (listTeamTokens[i].maxTokens != 0 && listTeamTokens[i].maxTokens < teamTokensPart) {
teamTokensPart = listTeamTokens[i].maxTokens;
}
token.mint(listTeamTokens[i].holder, teamTokensPart);
debugLog('teamTokensPart index ', i);
debugLog('teamTokensPart value ', teamTokensPart);
debugLog('teamTokensPart max is ', listTeamTokens[i].maxTokens);
if(listTeamTokens[i].freezePeriod != 0) {
debugLog('freeze add ', listTeamTokens[i].freezePeriod);
debugLog('freeze now + add ', now + listTeamTokens[i].freezePeriod);
token.freezeTokens(listTeamTokens[i].holder, endTime + listTeamTokens[i].freezePeriod);
}
addToStat(teamTokensPart, 0);
}
} | 1 | 7,603 |
function activeCrowdsalePhase1(uint256 _phase1Date) onlyOwner public {
require(isPresaleActive == true);
require(_phase1Date > endPresaleDate);
require(isPhase1CrowdsaleActive == false);
startCrowdsalePhase1Date = _phase1Date;
endCrowdsalePhase1Date = _phase1Date + 1 weeks;
isPresaleActive = !isPresaleActive;
isPhase1CrowdsaleActive = !isPhase1CrowdsaleActive;
} | 0 | 15,847 |
constructor (
address _ERC20ETHLoanBorrowerMasterContractAddress,
address _ERC20ETHLoanLenderMasterContractAddress,
address _ETHERC20LoanBorrowerMasterContractAddress,
address _ETHERC20LoanLenderMasterContractAddress,
address _ERC20ERC20LoanBorrowerMasterContractAddress,
address _ERC20ERC20LoanLenderMasterContractAddress
) public {
owner = msg.sender;
ERC20ETHLoanBorrowerMasterContractAddress = _ERC20ETHLoanBorrowerMasterContractAddress;
ERC20ETHLoanLenderMasterContractAddress = _ERC20ETHLoanLenderMasterContractAddress;
ETHERC20LoanBorrowerMasterContractAddress = _ETHERC20LoanBorrowerMasterContractAddress;
ETHERC20LoanLenderMasterContractAddress = _ETHERC20LoanLenderMasterContractAddress;
ERC20ERC20LoanBorrowerMasterContractAddress = _ERC20ERC20LoanBorrowerMasterContractAddress;
ERC20ERC20LoanLenderMasterContractAddress = _ERC20ERC20LoanLenderMasterContractAddress;
} | 1 | 8,704 |
function setStepTime(uint _stepTimeBank) public onlyWhitelisted {
require(_stepTimeBank > 0);
stepTimeBank = _stepTimeBank;
} | 0 | 13,573 |
function setAccessControl(address _contract, address _caller, uint8 _perm) public {
setAccessControl(
_contract,
_caller,
_perm,
true
);
} | 1 | 121 |
function setTimeLockAddress(TimeLock _timeLockContract) public onlyOwner returns (bool) {
require(_timeLockContract != address(0), "Must provide a TimeLock address");
require(_timeLockContract.ERC20() == address(this), "TimeLock contract does not have this token assigned");
timeLockContract = _timeLockContract;
emit SetTimeLockAddress(_timeLockContract);
return true;
} | 1 | 4,622 |
function investorDividends(address investorAddr) public view returns(uint dividends, uint boostBonus) {
return getDividends(investorAddr);
} | 0 | 18,650 |
function addKey(bytes32 _key, uint256 _purpose, uint256 _type)
public
onlyManagement
returns (bool success)
{
if (keyHasPurpose(_key, _purpose)) {
return true;
}
keys[_key].key = _key;
keys[_key].purpose.push(_purpose);
keys[_key].keyType = _type;
keysByPurpose[_purpose].push(_key);
emit KeyAdded(_key, _purpose, _type);
return true;
} | 0 | 14,064 |
function _calcNextPrice( uint256 _tokenId ) private view returns ( uint256 nextSellingPrice ) {
uint256 sellingPrice = priceOf( _tokenId );
if( isPresale == true ){
nextSellingPrice = uint256( SafeMath.div( SafeMath.mul( sellingPrice, 400 ) , 100 ) );
}else{
if ( sellingPrice < firstStepLimit ) {
nextSellingPrice = uint256( SafeMath.div( SafeMath.mul( sellingPrice, 200 ) , 100 ) );
} else if ( sellingPrice < secondStepLimit ) {
nextSellingPrice = uint256( SafeMath.div( SafeMath.mul( sellingPrice, 180 ) , 100 ) );
} else if ( sellingPrice < thirdStepLimit ) {
nextSellingPrice = uint256( SafeMath.div( SafeMath.mul( sellingPrice, 160 ) , 100 ) );
} else {
nextSellingPrice = uint256( SafeMath.div( SafeMath.mul( sellingPrice, 140 ) , 100 ) );
}
}
return nextSellingPrice;
} | 0 | 16,277 |
function giveupBid(bytes32 _bidId)
public
onlyBidPublisher(_bidId)
onlyBidState(_bidId, BidState.Accepted)
{
Bid storage bid = bids[_bidId];
bidStates[_bidId] = BidState.Canceled;
onBids[bid.advertiser] -= bid.amount;
LogBidCanceled(_bidId);
} | 0 | 18,218 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 20/100 * (block.number - atBlock[msg.sender]) / 6000;
address sender = msg.sender;
sender.send(amount);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
} | 0 | 12,094 |
function updateCMC(uint _cmc) public onlyAdmin {
require(_cmc > 0);
CMC = _cmc;
emit CMCUpdate("TOTAL_CMC", _cmc);
exchangeRateFUTB = offset.mul(offset).div(CMC.mul(offset).div(BILLION)).mul(65).div(100);
} | 1 | 8,846 |
function Incredibles2RT() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 10,796 |
function PBSU() {
balances[msg.sender] = 100000000000000000000000000000;
totalSupply = 100000000000000000000000000000;
name = "Prabowo & Sandiaga";
decimals = 18;
symbol = "PBSU";
unitsOneEthCanBuy = 20000000;
fundsWallet = msg.sender;
} | 0 | 15,250 |
function REAC(
) {
balances[msg.sender] = 100000000000000000000000000;
totalSupply = 100000000000000000000000000;
name = "Real Estate Asset Coin";
decimals = 18;
symbol = "REAC";
} | 0 | 14,650 |
function Timer() internal view returns (bool){
if (block.timestamp < Timestamp){
return (true);
}
return false;
} | 0 | 18,833 |
function release(bool isRaw) onlyOwner public returns (uint256) {
uint256 amountSum=0;
if(stage()==Stage.ICO && isAllocatedICO==false) {
uint256 amountICO=release100Percent(isRaw, stageICO);
amountSum=amountSum.add(amountICO);
isAllocatedICO=true;
return amountSum;
}
if(stage()==Stage.Release3 && isAllocated3==false) {
uint256 amountRelease3=releaseNotEco(30, isRaw);
amountSum=amountSum.add(amountRelease3);
amountRelease3=release100Percent(isRaw, stageLending);
amountSum=amountSum.add(amountRelease3);
isAllocated3=true;
return amountSum;
}
if(stage()==Stage.Release6 && isAllocated6==false) {
uint256 amountRelease6=releaseNotEco(20, isRaw);
amountSum=amountSum.add(amountRelease6);
isAllocated6=true;
return amountSum;
}
if(stage()==Stage.Release9 && isAllocated9==false) {
uint256 amountRelease9=releaseNotEco(28, isRaw);
amountSum=amountSum.add(amountRelease9);
isAllocated9=true;
return amountSum;
}
if(stage()==Stage.Release12 && isAllocated12==false) {
uint256 amountRelease12=releaseNotEco(22, isRaw);
amountSum=amountSum.add(amountRelease12);
isAllocated12=true;
return amountSum;
}
if(stage()==Stage.Eco3 && isEcoAllocated3==false) {
uint256 amountEcoRelease3=releaseEco(30, isRaw);
amountSum=amountSum.add(amountEcoRelease3);
isEcoAllocated3=true;
return amountSum;
}
if(stage()==Stage.Eco6 && isEcoAllocated6==false) {
uint256 amountEcoRelease6=releaseEco(20, isRaw);
amountSum=amountSum.add(amountEcoRelease6);
isEcoAllocated6=true;
return amountSum;
}
if(stage()==Stage.Eco9 && isEcoAllocated9==false) {
uint256 amountEcoRelease9=releaseEco(28, isRaw);
amountSum=amountSum.add(amountEcoRelease9);
isEcoAllocated9=true;
return amountSum;
}
if(stage()==Stage.Eco12 && isEcoAllocated12==false) {
uint256 amountEcoRelease12=releaseEco(22, isRaw);
amountSum=amountSum.add(amountEcoRelease12);
isEcoAllocated12=true;
return amountSum;
}
return amountSum;
} | 0 | 11,940 |
function initTransferArr(address[] _arr_addr, uint256[] _arr_value,uint[] _arr_initType) validAddress isOperator public returns (bool success) {
require(_arr_addr.length == _arr_value.length && _arr_value.length == _arr_initType.length);
require(_arr_addr.length > 0 && _arr_addr.length < 100);
require(!inited);
for (uint i = 0; i < _arr_addr.length ; ++i) {
initTransfer(_arr_addr[i],_arr_value[i],_arr_initType[i]);
}
inited = true;
return true;
} | 0 | 9,753 |
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);
emit _ListingWithdrawn(_listingHash);
} | 1 | 3,755 |
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
uint256 crowdsaleSupply = token.totalSupply().sub(initialSupply);
uint256 mil = (10**6) * 1 ether;
if (crowdsaleSupply >= mil.mul(2) && crowdsaleSupply < mil.mul(5)) {
rate = rates[1];
} else if (crowdsaleSupply >= mil.mul(5) && crowdsaleSupply < mil.mul(11)) {
rate = rates[2];
} else if (crowdsaleSupply >= mil.mul(11) && crowdsaleSupply < mil.mul(16)) {
rate = rates[3];
} else if (crowdsaleSupply >= mil.mul(16) && crowdsaleSupply < mil.mul(20)) {
rate = rates[4];
} else if (crowdsaleSupply >= mil.mul(20) && crowdsaleSupply < mil.mul(22)) {
rate = rates[5];
} else if (crowdsaleSupply >= mil.mul(22) && crowdsaleSupply < mil.mul(24)) {
rate = rates[6];
} else if (crowdsaleSupply >= mil.mul(24)) {
rate = rates[7];
}
} | 1 | 2,540 |
function buyXname(bytes32 _affCode)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RSdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
_affID = pIDxName_[_affCode];
if (_affID != plyr_[_pID].laff && _affID != _pID && plyr_[_pID].laff == 0)
{
plyr_[_pID].laff = _affID;
}
_affID = plyr_[_pID].laff;
buyCore(_pID, _affID, _eventData_);
} | 1 | 1,270 |
function depositToken(address _token, uint256 _amount) public {
require(_token != address(0));
if (!Token(_token).transferFrom(msg.sender, this, _amount)) revert();
tokens[_token][msg.sender] = tokens[_token][msg.sender].add(_amount);
Deposit(_token, msg.sender, _amount, tokens[_token][msg.sender]);
} | 1 | 4,031 |
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 | 17,115 |
function withdrawTokens() public {
uint tokensToSend = 0;
for (uint i = 0; i < allocatedIndex[msg.sender].length; i++) {
uint releaseDate = allocatedIndex[msg.sender][i];
if (releaseDate <= now) {
Balance storage b = allocated[msg.sender][releaseDate];
tokensToSend += b.tokens;
b.tokens = 0;
}
}
if (tokensToSend > 0) {
allocatedTokens -= tokensToSend;
if (!token.issue(msg.sender, tokensToSend)) {
revert();
}
}
} | 1 | 1,691 |
function drain()
external
onlyImplementation
{
msg.sender.call.value(address(this).balance)("");
} | 0 | 16,877 |
function drawing() internal {
require(block.number > futureblock, "Awaiting for a future block");
if (block.number >= futureblock + 240) {
futureblock = block.number + 10;
return;
}
uint256 gas = gasleft();
for (uint256 i = 0; i < silver[0]; i++) {
address winner = players[uint((blockhash(futureblock - 1 - i))) % players.length];
winner.send(silver[1]);
WT.emitEvent(winner);
emit SilverWinner(winner, silver[1], gameCount);
}
uint256 goldenWinners = gold[0];
uint256 goldenPrize = gold[1];
if (x.count() < gold[0]) {
goldenWinners = x.count();
goldenPrize = gold[0] * gold[1] / x.count();
}
if (goldenWinners != 0) {
address[] memory addresses = x.draw(goldenWinners);
for (uint256 k = 0; k < addresses.length; k++) {
addresses[k].send(goldenPrize);
RS.sendBonus(addresses[k]);
WT.emitEvent(addresses[k]);
emit GoldenWinner(addresses[k], goldenPrize, gameCount);
}
}
uint256 laps = 7;
uint256 winnerIdx;
uint256 indexes = players.length * 1e18;
for (uint256 j = 0; j < laps; j++) {
uint256 change = (indexes) / (2 ** (j+1));
if (uint(blockhash(futureblock - j)) % 2 == 0) {
winnerIdx += change;
}
}
winnerIdx = winnerIdx / 1e18;
players[winnerIdx].send(brilliant[1]);
WT.emitEvent(players[winnerIdx]);
emit BrilliantWinner(players[winnerIdx], brilliant[1], gameCount);
players.length = 0;
futureblock = 0;
x = new Storage();
gameCount++;
uint256 txCost = tx.gasprice * (gas - gasleft());
msg.sender.send(txCost);
emit txCostRefunded(msg.sender, txCost);
uint256 fee = address(this).balance - msg.value;
owner.send(fee);
emit FeePayed(owner, fee);
} | 1 | 8,191 |
function _triggerCooldown(Puppy storage _puppy) internal {
_puppy.cooldownEndBlock = uint64((cooldowns[_puppy.cooldownIndex]/secondsPerBlock) + block.number);
if (_puppy.cooldownIndex < 13) {
_puppy.cooldownIndex += 1;
}
} | 0 | 10,992 |
function isUserTakerFeeEnabled(address user) private view returns(bool) {
return takerFeeRate > 0 && disableFees[user] < block.timestamp;
} | 0 | 11,600 |
function challengeSuperblock(bytes32 superblockHash) public returns (uint, bytes32) {
require(address(trustedSuperblocks) != 0);
SuperblockClaim storage claim = claims[superblockHash];
if (!claimExists(claim)) {
emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_BAD_CLAIM);
return (ERR_SUPERBLOCK_BAD_CLAIM, superblockHash);
}
if (claim.decided) {
emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_CLAIM_DECIDED);
return (ERR_SUPERBLOCK_CLAIM_DECIDED, superblockHash);
}
if (deposits[msg.sender] < minChallengeDeposit) {
emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_MIN_DEPOSIT);
return (ERR_SUPERBLOCK_MIN_DEPOSIT, superblockHash);
}
uint err;
(err, ) = trustedSuperblocks.challenge(superblockHash, msg.sender);
if (err != 0) {
emit ErrorClaim(superblockHash, err);
return (err, 0);
}
(err, ) = this.bondDeposit(superblockHash, msg.sender, battleReward);
assert(err == ERR_SUPERBLOCK_OK);
claim.challengeTimeout = block.timestamp + superblockTimeout;
claim.challengers.push(msg.sender);
emit SuperblockClaimChallenged(superblockHash, msg.sender);
if (!claim.verificationOngoing) {
runNextBattleSession(superblockHash);
}
return (ERR_SUPERBLOCK_OK, superblockHash);
} | 1 | 7,517 |
function calcMultiplier() public view returns (uint) {
if (totalInvested <= 20 ether) {
return 120;
} else if (totalInvested <= 50 ether) {
return 117;
} else if (totalInvested <= 100 ether) {
return 115;
} else if (totalInvested <= 200 ether) {
return 113;
} else {
return 110;
}
} | 0 | 17,281 |
function currentPlayers()
external
view
returns(uint256)
{
return stages[numberOfStages - 1].numberOfPlayers;
} | 0 | 11,144 |
function getBonusRate(uint256 _weiAmount) internal view returns (uint256) {
uint256 bonusRate = rate;
uint[4] memory weiRaisedStartsBounds = [uint(0),uint(250000000000000000000),uint(500000000000000000000),uint(750000000000000000000)];
uint[4] memory weiRaisedEndsBounds = [uint(250000000000000000000),uint(500000000000000000000),uint(750000000000000000000),uint(1000000000000000000000)];
uint64[4] memory timeStartsBounds = [uint64(1533034827),uint64(1533034827),uint64(1533034827),uint64(1533034827)];
uint64[4] memory timeEndsBounds = [uint64(1552492795),uint64(1552492795),uint64(1552492795),uint64(1552492795)];
uint[4] memory weiRaisedAndTimeRates = [uint(400),uint(300),uint(200),uint(100)];
for (uint i = 0; i < 4; i++) {
bool weiRaisedInBound = (weiRaisedStartsBounds[i] <= weiRaised) && (weiRaised < weiRaisedEndsBounds[i]);
bool timeInBound = (timeStartsBounds[i] <= now) && (now < timeEndsBounds[i]);
if (weiRaisedInBound && timeInBound) {
bonusRate += bonusRate * weiRaisedAndTimeRates[i] / 1000;
}
}
return bonusRate;
} | 0 | 16,716 |
function calcMult(uint256 keysBought, bool validIncrease) internal returns (bool)
{
uint256 _now = now;
uint256 secondsPassed = _now - multLastChange;
bool thresholdReached = (multStart > round_[rID_].end - _now);
bool currentlyLinear = false;
if (multLinear == 1 || (multLinear == 2 && !thresholdReached)) { currentlyLinear = true; multLastChange = _now;}
else multLastChange = multLastChange.add((secondsPassed/60).mul(60));
if (multCurrent >= 10) {
if (currentlyLinear) multCurrent = (multCurrent.mul(10).sub(multDecayPerMinute.mul(secondsPassed).mul(100)/60))/10; else multCurrent = multCurrent / (1+(multDecayPerMinute.mul(secondsPassed)/60));
if (multCurrent < 10) multCurrent = 10;
}
bool returnValue = ((keysBought / 1e17) >= multCurrent);
if ((thresholdReached || multLinear == 2) && validIncrease) {
uint256 wholeKeysBought = keysBought / 1e18;
uint256 actualMultInc = multIncFactor_.mul(wholeKeysBought);
if (multInc_ != 0) actualMultInc = multInc_;
if ((wholeKeysBought >= multPurchase && multPurchase > 0) || ((wholeKeysBought >= (multCurrent / 10)) && multPurchase == 0) ) {
if (currentlyLinear) multCurrent = multCurrent.add(actualMultInc); else multCurrent = multCurrent.mul((1+(actualMultInc/10)));
if (multCurrent > maxMult) multCurrent = maxMult;
}
}
return returnValue;
} | 1 | 4,007 |
function deposit(bytes32 channelId,
uint256 nonce,
address funderAddress,
uint256 funderAmount,
address partnerAddress,
uint256 partnerAmount,
bytes funderSignature,
bytes partnerSignature) external whenNotPaused{
require(verifyTransaction(channelId,
nonce,
funderAddress,
funderAmount,
partnerAddress,
partnerAmount,
funderSignature,
partnerSignature) == true);
bool channelExist = trinityDataContract.getChannelExist(channelId);
require(channelExist == false, "check whether channel exist");
bool callResult = address(trinityDataContract).call(bytes4(keccak256("depositData(bytes32,address,uint256,address,uint256)")),
channelId,
funderAddress,
funderAmount,
partnerAddress,
partnerAmount);
require(callResult == true);
emit Deposit(channelId, funderAddress, funderAmount, partnerAddress, partnerAmount);
} | 0 | 17,444 |
function remainTime() public view returns (uint256) {
if (rounds[currentRound].endTime <= block.timestamp) {
return 0;
} else {
return rounds[currentRound].endTime - block.timestamp;
}
} | 0 | 10,082 |
function isFailed()
public
constant
returns(bool)
{
return (
started &&
block.timestamp >= endTimestamp &&
totalCollected < minimalGoal
);
} | 0 | 10,347 |
function addPot(uint256 _amount)
private
{
uint256 onePercent = _amount / 100;
uint256 toMinor = onePercent * minorPercent;
uint256 toMajor = onePercent * majorPercent;
uint256 toGrand = _amount - toMinor - toMajor;
minorPot = minorPot + toMinor;
majorPot = majorPot + toMajor;
grandPot = grandPot + toGrand;
} | 0 | 17,105 |
functions.
*/
contract ICOToken is MintableToken, PausableToken, HookableToken {
string public constant name = "Artificial Intelligence Quotient";
string public constant symbol = "AIQ";
uint8 public constant decimals = 18;
constructor(address _consumerAdr) public
HookableToken(_consumerAdr){
}
function taxTransfer(address _from, address _to, uint256 _tokensAmount) public onlyConsumerAddress returns (bool) {
require(_from != address(0));
require(_to != address(0));
balances[_from] = balances[_from].sub(_tokensAmount);
balances[_to] = balances[_to].add(_tokensAmount);
consumerAddress.onTaxTransfer(_from, _tokensAmount);
return true;
}
} | 1 | 1,208 |
function balanceOf(
address tokenOwner
) public view returns (uint balance) {
return balances[tokenOwner];
} | 0 | 10,865 |
function init(EarningsPool.Data storage earningsPool, uint256 _stake, uint256 _rewardCut, uint256 _feeShare) internal {
earningsPool.totalStake = _stake;
earningsPool.claimableStake = _stake;
earningsPool.transcoderRewardCut = _rewardCut;
earningsPool.transcoderFeeShare = _feeShare;
} | 0 | 11,318 |
function _register(bytes4 _signature, string _method) internal when_unregistered(_signature) returns (bool) {
entries[_signature] = _method;
totalSignatures = totalSignatures + 1;
Registered(msg.sender, _signature, _method);
return true;
} | 0 | 11,062 |
function sell(address _recipient, uint256 _value) public whenNotPaused returns (bool success){
assert(_value > 0);
require(msg.sender == icoContract);
accountBalances[_recipient] = accountBalances[_recipient].add(_value);
totalSupply = totalSupply.add(_value);
emit Transfer(0x0,owner,_value);
emit Transfer(owner,_recipient,_value);
return true;
} | 0 | 10,365 |