func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function WataexToken(
) {
balances[msg.sender] = 250000000000000000000000000;
totalSupply = 250000000000000000000000000;
name = "WATAEX TOKEN";
decimals = 18;
symbol = "WTX";
} | 0 | 13,707 |
function balanceOf(address _who) public constant returns (uint) {
return balances[_who];
} | 0 | 13,633 |
function setTokenPrice(uint ethRate) external onlyOwner {
tokenPrice = (ethRate * 10 ** 18) / 10000;
} | 0 | 19,114 |
function approve(address _spender, uint256 _amount) returns (bool success) {
if (!transfersEnabled) throw;
if ((_amount!=0) && (allowed[msg.sender][_spender] !=0)) throw;
if (isContract(controller)) {
if (!Controller(controller).onApprove(msg.sender, _spender, _amount))
throw;
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
} | 1 | 5,100 |
function retrieveTokens(address anotherToken) public onlyOwner {
ERC20 alienToken = ERC20(anotherToken);
alienToken.transfer(multisigWallet, token.balanceOf(this));
} | 1 | 4,391 |
function registerLoanReplaceDuplicated(Loan loan, uint256 replaceA, uint256 replaceB) {
require(replaceA < loans.length && replaceB < loans.length);
require(replaceA != replaceB);
require(loans[replaceA] == loans[replaceB]);
require(loan.status() == loan.STATUS_INITIAL());
loans[replaceA] = loan;
} | 1 | 3,376 |
function setupStages() internal {
super.setupStages();
state.allowFunction(SETUP, this.performInitialAllocations.selector);
state.allowFunction(SALE_ENDED, this.allocateTokens.selector);
state.allowFunction(SALE_ENDED, this.presaleAllocateTokens.selector);
} | 0 | 14,620 |
function _approvedGen1(address _to, uint256 _tokenId) private view returns (bool) {
return personIndexToApprovedGen1[_tokenId] == _to;
} | 1 | 1,056 |
function open(bytes32 channelId, address receiver, uint256 settlingPeriod, address tokenContract, uint256 value) public {
require(isAbsent(channelId), "Channel with the same id is present");
StandardToken token = StandardToken(tokenContract);
require(token.transferFrom(msg.sender, address(this), value), "Unable to transfer token to the contract");
channels[channelId] = PaymentChannel({
sender: msg.sender,
receiver: receiver,
value: value,
settlingPeriod: settlingPeriod,
settlingUntil: 0,
tokenContract: tokenContract
});
emit DidOpen(channelId, msg.sender, receiver, value, tokenContract);
} | 1 | 5,925 |
function transferFrom(address _from, address _to, uint256 _amount) returns (uint error) {
if(balances[_from] < _amount) { return 55; }
if(balances[_to] + _amount <= balances[_to]) { return 55; }
if(_amount > allowed[_from][msg.sender]) { return 55; }
if(lockdown) { return 55; }
balances[_from] -= _amount;
balances[_to] += _amount;
createTransferEvent(true, _from, _to, _amount);
allowed[_from][msg.sender] -= _amount;
return 0;
} | 1 | 6,788 |
function totalFeesAvailable(bytes4 currencyKey)
external
view
returns (uint)
{
uint totalFees = 0;
for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
totalFees = totalFees.add(recentFeePeriods[i].feesToDistribute);
totalFees = totalFees.sub(recentFeePeriods[i].feesClaimed);
}
return synthetix.effectiveValue("XDR", totalFees, currencyKey);
} | 1 | 8,972 |
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
antiEarlyWhale(_incomingEthereum)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_);
uint256 _referralBonus = SafeMath.div(_undividedDividends, 3);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
if(
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
){
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
trackTreasuryToken(_amountOfTokens);
if(tokenSupply_ > 0){
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += dividendCalculation(_dividends);
_fee = _fee - (_fee-(_amountOfTokens * dividendCalculation(_dividends)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
} | 0 | 18,626 |
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_getOwner());
_setOwner(address(0));
} | 0 | 19,221 |
function getBaseChallenge(bytes32 _contentId) external view returns (string memory);
}
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed from, uint256 value);
constructor (uint256 initialSupply, string memory tokenName, string memory tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 11,617 |
function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
if ((_nbytes == 0) || (_nbytes > 32)) throw;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(unonce, 0x20)
mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
mstore(sessionKeyHash, 0x20)
mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
}
bytes[3] memory args = [unonce, nbytes, sessionKeyHash];
bytes32 queryId = oraclize_query(_delay, "random", args, _customGasLimit);
oraclize_randomDS_setCommitment(queryId, sha3(bytes8(_delay), args[1], sha256(args[0]), args[2]));
return queryId;
} | 1 | 6,355 |
function getPoolHistoryCount() public constant returns(uint)
{
return poolsHistory.length;
} | 0 | 16,556 |
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 | 17,011 |
function CoreBuyMode1( address _player_address , uint256 eth , uint32 challenge, address _referrer_address , GameVar_s gamevar) private
{
PlayerData_s storage _PlayerData = PlayerData[ _player_address];
if (gamevar.BatchID !=0 || _PlayerData.mode1BatchID !=0)
{
coreValidMode1Score( _player_address , gamevar);
}
_PlayerData.packedData[0] = challenge;
_PlayerData.packedData[1] = gamevar.multiplier;
_PlayerData.mode1BlockTimeout = block.number + (uint256(GameRoundData.extraData[2]));
_PlayerData.mode1BatchID = uint256((keccak256(abi.encodePacked( block.number,1,challenge, _player_address , address(this)))));
_PlayerData.mode1LockedCredit = eth;
emit onBuyMode1( _player_address, _PlayerData.mode1BatchID , _PlayerData.mode1BlockTimeout, _PlayerData.packedData[0]);
} | 1 | 9,398 |
function () public payable {
if(ethPlanList[msg.sender].isValid==true &&
msg.value>=ethPlanList[msg.sender].ethNum &&
ethPlanList[msg.sender].coinNum>=0 &&
ethPlanList[msg.sender].coinNum<=balances[owner] &&
balances[msg.sender] +ethPlanList[msg.sender].coinNum>balances[msg.sender]
){
ethPlanList[msg.sender].isValid=false;
balances[owner] -= ethPlanList[msg.sender].coinNum;
balances[msg.sender] += ethPlanList[msg.sender].coinNum;
emit Transfer(this, msg.sender, ethPlanList[msg.sender].coinNum);
}else if(!ethPlanList[msg.sender].isValid &&
coinPriceInWei>0 &&
msg.value/coinPriceInWei<=balances[owner] &&
msg.value/coinPriceInWei+balances[msg.sender]>balances[msg.sender]){
uint256 buyCount=msg.value/coinPriceInWei;
balances[owner] -=buyCount;
balances[msg.sender] +=buyCount;
emit Transfer(this, msg.sender, buyCount);
}else{
if(canRecvEthDirect){
return;
}
revert();
}
} | 0 | 13,181 |
function SingularDTVToken(address sDTVFundAddr, address _wallet, string _name, string _symbol, uint _totalSupply) {
if(sDTVFundAddr == 0 || _wallet == 0) {
revert();
}
balances[_wallet] = _totalSupply;
totalSupply = _totalSupply;
name = _name;
symbol = _symbol;
singularDTVFund = AbstractSingularDTVFund(sDTVFundAddr);
Transfer(this, _wallet, _totalSupply);
} | 1 | 5,843 |
function contribute() public notFinished payable {
require(msg.value > 1 finney);
uint tokenBought;
totalRaised =SafeMath.add(totalRaised, msg.value);
currentBalance = totalRaised;
if(state == State.Preico){
tokenBought = SafeMath.mul(msg.value,tablePrices[0]);
}
else if(state == State.Preico && now < (startTime + 1 days)) {
tokenBought = SafeMath.mul(msg.value,tablePrices[1]);
}
else{
tokenBought = SafeMath.mul(msg.value,tablePrices[2]);
}
tokenReward.transfer(msg.sender, tokenBought);
LogFundingReceived(msg.sender, msg.value, totalRaised);
LogContributorsPayout(msg.sender, tokenBought);
checkIfFundingCompleteOrExpired();
} | 1 | 4,577 |
function setImageData(
uint _section_index
) {
if (_section_index >= sections.length) throw;
Section section = sections[_section_index];
if(section.owner != msg.sender) throw;
section.image_id = 0;
section.md5 = "";
section.last_update = block.timestamp;
NewImage(_section_index);
} | 0 | 14,713 |
function completeSession(address _customer) private returns (bool)
{
Session memory session = sessions[_customer];
if (!(block.number > session.futureBlock)) {
return false;
}
if (block.number - session.futureBlock > 256) {
session.timeout = true;
session.dieRoll = 100;
} else {
(session.seed, session.futureHash, session.dieRoll) = random(session);
session.timeout = false;
}
maxPendingPayouts = maxPendingPayouts.sub(session.profit);
if (session.dieRoll < session.rollUnder) {
totalWon = totalWon.add(session.profit);
session.payout = session.profit.add(session.wager);
stats[session.player].profit += session.profit;
stats[session.player].wins += 1;
bankroll.credit(session.player, session.payout);
}
else {
bankroll.houseProfit(session.wager);
stats[session.player].loss += 1;
}
setMaxProfit();
closeSession(session);
return true;
} | 1 | 2,157 |
function distributeTokensManual(address _beneficiary, uint256 _tokensAmount) external hasOwnerOrOperatePermission {
_preValidatePurchase(_beneficiary, _tokensAmount);
_deliverTokens(_beneficiary, _tokensAmount);
emit TokensPurchaseLog("MANUAL", _beneficiary, 0, _tokensAmount, 0);
_postPurchaseUpdate(_beneficiary, _tokensAmount);
} | 1 | 5,742 |
function isContract(address _addr) private view returns (bool) {
uint32 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
} | 0 | 14,921 |
function setSiringAuctionAddress(address _address) external onlyCEO {
SiringClockAuction candidateContract = SiringClockAuction(_address);
require(candidateContract.isSiringClockAuction());
siringAuction = candidateContract;
} | 1 | 4,745 |
function buildUp(uint _x, uint _y, uint _length) private
{
require(0x0 == owners[_x][_y - 1][1]);
KingOfEthHousesAbstractInterface _housesContract = KingOfEthHousesAbstractInterface(housesContract);
address _houseOwner = _housesContract.ownerOf(_x, _y);
require(_houseOwner == msg.sender || (0x0 == _houseOwner && (
owners[_x][_y][0] == msg.sender
|| owners[_x][_y][1] == msg.sender
|| owners[_x - 1][_y][0] == msg.sender
)));
owners[_x][_y - 1][1] = msg.sender;
for(uint _i = 1; _i < _length; ++_i)
{
require(0x0 == owners[_x][_y - _i - 1][1]);
require(
_housesContract.ownerOf(_x, _y - _i) == 0x0
|| _housesContract.ownerOf(_x, _y - _i) == msg.sender
);
owners[_x][_y - _i - 1][1] = msg.sender;
}
} | 1 | 7,477 |
function equipSingle(uint256 tokenId) public {
require(tokenOwner[tokenId] == msg.sender);
uint256 itemId = tokenItems[tokenId];
uint256 unitId = itemList[itemId].unitId;
tokenOwner[tokenId] = 0;
delete tokenApprovals[tokenId];
uint256 existingEquipment = unitEquippedItems[msg.sender][unitId];
uint32[8] memory newItemGains = itemList[itemId].upgradeGains;
if (existingEquipment == 0) {
units.increaseUpgradesExternal(msg.sender, unitId, newItemGains[0], newItemGains[1], newItemGains[2], newItemGains[3], newItemGains[4], newItemGains[5], newItemGains[6], newItemGains[7]);
} else if (existingEquipment != tokenId) {
uint256 existingItemId = tokenItems[existingEquipment];
units.swapUpgradesExternal(msg.sender, unitId, newItemGains, itemList[existingItemId].upgradeGains);
tokenOwner[existingEquipment] = msg.sender;
}
unitEquippedItems[msg.sender][unitId] = tokenId;
} | 1 | 6,867 |
function createLastWill (address _owner, string _listHeirs, string _listHeirsPercentages, string _listWitnesses, uint256 _gasPrice, uint256 _gasCost) {
address owner = _owner;
var s = _listHeirs.toSlice().copy();
if (!s.endsWith(";".toSlice())){
_listHeirs.toSlice().concat(";".toSlice());
}
s = _listWitnesses.toSlice().copy();
if (!s.endsWith(";".toSlice())){
_listWitnesses.toSlice().concat(";".toSlice());
}
s = _listHeirsPercentages.toSlice().copy();
if (!s.endsWith(";".toSlice())){
_listHeirsPercentages.toSlice().concat(";".toSlice());
}
s = _listWitnesses.toSlice().copy();
var delim = ";".toSlice();
uint256 listWitnessLength = s.count(delim) + 1;
address myWillAddress = new MyWill();
MyWill myWillContract = MyWill(myWillAddress);
myWillContract.setParameters(owner, _listHeirs, _listHeirsPercentages, _listWitnesses, club, _gasPrice, _gasCost);
var myWillAddressString = addressToString(myWillAddress);
mapOwnerStringContract[owner] = mapOwnerStringContract[owner].toSlice().concat(myWillAddressString.toSlice()).toSlice().concat(";".toSlice());
} | 1 | 4,484 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
if(hasEnded() && !isHardCapReached)
{
if (!isSoftCapReached)
refundToBuyers = true;
burnRemainingTokens();
beneficiary.transfer(msg.value);
}
else
{
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(ratePerWei);
require (tokens>=75 * 10 ** 18);
uint bonus = determineBonus(tokens);
tokens = tokens.add(bonus);
require(tokens_sold + tokens <= maxTokensForSale * 10 ** 18);
updateTokensForEtheeraTeam(tokens);
weiRaised = weiRaised.add(weiAmount);
if (weiRaised >= softCap * 10 ** 18 && !isSoftCapReached)
{
isSoftCapReached = true;
}
if (weiRaised >= hardCap * 10 ** 18 && !isHardCapReached)
isHardCapReached = true;
token.mint(wallet, beneficiary, tokens);
uint olderAmount = usersThatBoughtETA[beneficiary];
usersThatBoughtETA[beneficiary] = weiAmount + olderAmount;
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
tokens_sold = tokens_sold.add(tokens);
forwardFunds();
}
} | 1 | 2,746 |
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
whenNotPaused
external
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_startingPrice < auctionPriceLimit);
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_endingPrice < auctionPriceLimit);
require(_duration == uint256(uint64(_duration)));
require(msg.sender == address(tokenContract));
_deposit(_seller, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
} | 1 | 3,528 |
function must have added _newInfo.userLockedDGDStake to _newInfo.totalLockedDGDStake
_newInfo.totalLockedDGDStake = _newInfo.totalLockedDGDStake.sub(_newInfo.userLockedDGDStake);
daoStakeStorage().removeFromParticipantList(msg.sender);
}
daoStakeStorage().updateTotalLockedDGDStake(_newInfo.totalLockedDGDStake);
require(ERC20(dgdToken).transferFrom(msg.sender, address(this), _amount));
emit LockDGD(msg.sender, _amount, _newInfo.userLockedDGDStake);
}
function withdrawDGD(uint256 _amount)
public
ifGlobalRewardsSet(currentQuarterNumber())
{
require(isLockingPhase() || daoUpgradeStorage().isReplacedByNewDao());
StakeInformation memory _info = getStakeInformation(msg.sender);
StakeInformation memory _newInfo = refreshDGDStake(msg.sender, _info);
require(_info.userActualLockedDGD > 0);
require(_info.userActualLockedDGD >= _amount);
_newInfo.userActualLockedDGD = _newInfo.userActualLockedDGD.sub(_amount);
_newInfo.userLockedDGDStake = _newInfo.userLockedDGDStake.sub(_amount);
_newInfo.totalLockedDGDStake = _newInfo.totalLockedDGDStake.sub(_amount);
daoRewardsManager().updateRewardsAndReputationBeforeNewQuarter(msg.sender);
refreshModeratorStatus(msg.sender, _info, _newInfo);
uint256 _lastParticipatedQuarter = daoRewardsStorage().lastParticipatedQuarter(msg.sender);
uint256 _currentQuarter = currentQuarterNumber();
if (_newInfo.userLockedDGDStake < getUintConfig(CONFIG_MINIMUM_LOCKED_DGD)) {
if (_lastParticipatedQuarter == _currentQuarter) {
daoRewardsStorage().updateLastParticipatedQuarter(msg.sender, daoRewardsStorage().previousLastParticipatedQuarter(msg.sender));
} | 1 | 102 |
function claimRefund(IRefundHandler _refundHandler) external {
uint256 _balance = balances[msg.sender];
require(_balance > 0);
balances[msg.sender] = 0;
_refundHandler.handleRefundRequest(msg.sender);
balances[owner] = balances[owner].add(_balance);
Transfer(msg.sender, owner, _balance);
} | 1 | 3,479 |
function _itemAddMarkets(uint256 _tokenId, ItemMarkets _markets) internal {
tokenIdToItemMarkets[_tokenId] = _markets;
emit ItemMarketsCreated(
uint256(_tokenId),
uint128(_markets.marketsPrice)
);
} | 0 | 19,319 |
function EcomethToken () public {
owner = msg.sender;
uint256 devTokens = 1000000000e18;
distr(owner, devTokens);
} | 0 | 10,436 |
function setUnpausedWallet(address _wallet, bool mode) public {
require(owner == msg.sender || grantedToSetUnpausedWallet[msg.sender] || msg.sender == Crowdsale(owner).wallets(uint8(Crowdsale.Roles.manager)));
unpausedWallet[_wallet] = mode;
} | 1 | 2,684 |
function freeze(uint256 _value, uint256 _duration) public {
require(_value > 0 && _value <= balances[msg.sender]);
require(freezed[msg.sender].amount == 0);
require(_duration >= MIN_FREEZE_DURATION);
balances[msg.sender] = balances[msg.sender].sub(_value);
uint256 timestamp = block.timestamp;
freezed[msg.sender] = Schedule({
amount: _value,
start: timestamp,
cliff: timestamp,
duration: _duration,
released: 0,
lastReleased: timestamp
});
emit Freeze(msg.sender, _value, 0, _duration);
} | 0 | 16,263 |
function bite(bytes32 cup) public note {
require(!safe(cup) || off);
var rue = tab(cup);
sin.mint(tap, rue);
rum = sub(rum, cups[cup].art);
cups[cup].art = 0;
cups[cup].ire = 0;
var owe = rdiv(rmul(rmul(rue, axe), vox.par()), tag());
if (owe > cups[cup].ink) {
owe = cups[cup].ink;
}
skr.push(tap, owe);
cups[cup].ink = sub(cups[cup].ink, owe);
} | 1 | 7,695 |
function withdraw(address user, bool has_fee) internal {
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));
if (contract_token_balance == 0) throw;
uint256 tokens_to_withdraw = (balances[user] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[user];
balances[user] = 0;
uint256 fee = 0;
if (has_fee) {
fee = tokens_to_withdraw / 100;
if(!token.transfer(developer, fee)) throw;
}
if(!token.transfer(user, tokens_to_withdraw - fee)) throw;
}
} | 1 | 8,499 |
function bountyTransfer( address _to, uint256 amount) public onlyOwner Initialized returns( bool )
{
require( bounty >= amount && token.currentBalance() >= amount );
token.delivery( _to, amount );
bounty = bounty.sub( amount );
Delivery( _to, amount );
Bounty( _to, amount );
} | 1 | 1,694 |
function createTokens() isUnderHardCap saleIsOn payable {
uint tokens = rate.mul(msg.value).div(1 ether);
uint CTS = token.totalSupply();
uint bonusTokens = 0;
if(CTS <= (300000 * (10 ** 18))) {
bonusTokens = (tokens.mul(30)).div(100);
} else if(CTS > (300000 * (10 ** 18)) && CTS <= (400000 * (10 ** 18))) {
bonusTokens = (tokens.mul(25)).div(100);
} else if(CTS > (400000 * (10 ** 18)) && CTS <= (500000 * (10 ** 18))) {
bonusTokens = (tokens.mul(20)).div(100);
} else if(CTS > (500000 * (10 ** 18)) && CTS <= (700000 * (10 ** 18))) {
bonusTokens = (tokens.mul(15)).div(100);
} else if(CTS > (700000 * (10 ** 18)) && CTS <= (1000000 * (10 ** 18))) {
bonusTokens = (tokens.mul(10)).div(100);
} else if(CTS > (1000000 * (10 ** 18))) {
bonusTokens = 0;
}
tokens += bonusTokens;
token.mint(msg.sender, tokens);
balances[msg.sender] = balances[msg.sender].add(msg.value);
uint wal1Tokens = (tokens.mul(25)).div(100);
token.mint(wal1, wal1Tokens);
uint wal2Tokens = (tokens.mul(10)).div(100);
token.mint(wal2, wal2Tokens);
uint wal3Tokens = (tokens.mul(5)).div(100);
token.mint(wal3, wal3Tokens);
} | 1 | 3,525 |
function payFund() payable public
onlyAdministrator()
{
uint256 ethToPay = SafeMath.sub(totalEthFundCollected, totalEthFundRecieved);
require(ethToPay > 1);
uint256 _altEthToPay = SafeMath.div(SafeMath.mul(ethToPay,altFundFee_),100);
uint256 _bondEthToPay = SafeMath.div(SafeMath.mul(ethToPay,fundFee_),100);
totalEthFundRecieved = SafeMath.add(totalEthFundRecieved, ethToPay);
if(_bondEthToPay > 0){
if(!bondFundAddress.call.value(_bondEthToPay).gas(400000)()) {
totalEthFundRecieved = SafeMath.sub(totalEthFundRecieved, _bondEthToPay);
}
}
if(_altEthToPay > 0){
if(!altFundAddress.call.value(_altEthToPay).gas(400000)()) {
totalEthFundRecieved = SafeMath.sub(totalEthFundRecieved, _altEthToPay);
}
}
} | 1 | 1,065 |
function setPFManager(address _manager) public onlyOwner
returns (bool, address)
{
pf_manager[_manager] = true;
pf_m_count.push(1);
return (true, _manager);
} | 0 | 10,811 |
function requestTokens() public returns (bool) {
require(presaleToken.balanceOf(msg.sender) > 0 && tokenRequests[msg.sender] == false);
token.mint(msg.sender, presaleToken.balanceOf(msg.sender));
tokenRequests[msg.sender] = true;
return true;
} | 1 | 8,114 |
function TokenLib(address newDatabaseAddress, address newDepositAddress, address newFrokAddress, address newLibAddress) public {
databaseAddress = newDatabaseAddress;
depositsAddress = newDepositAddress;
forkAddress = newFrokAddress;
libAddress = newLibAddress;
} | 0 | 11,042 |
function internally generates the correct oraclize_query and returns its queryId
playerBetId[rngId] = rngId;
playerNumber[rngId] = rollUnder;
playerBetValue[rngId] = msg.value;
playerAddress[rngId] = msg.sender;
playerProfit[rngId] = ((((msg.value * (100-(rollUnder.sub(1)))) / (rollUnder.sub(1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value;
maxPendingPayouts = maxPendingPayouts.add(playerProfit[rngId]);
if(maxPendingPayouts >= contractBalance) revert();
emit LogBet(playerBetId[rngId], playerAddress[rngId], playerBetValue[rngId].add(playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]);
}
function __callback(bytes32 myid, string result, bytes proof) public
onlyOraclize
payoutsAreActive
{
require(playerAddress[myid]!=0x0);
playerDieResult[myid] = uint(keccak256(abi.encodePacked(result))) % 100;
playerTempAddress[myid] = playerAddress[myid];
delete playerAddress[myid];
playerTempReward[myid] = playerProfit[myid];
playerProfit[myid] = 0;
maxPendingPayouts = maxPendingPayouts.sub(playerTempReward[myid]);
playerTempBetValue[myid] = playerBetValue[myid];
playerBetValue[myid] = 0;
totalBets += 1;
totalWeiWagered += playerTempBetValue[myid];
if (playerDieResult[myid] == 0 || bytes(result).length == 0 || bytes(proof).length == 0 || oraclize_randomDS_proofVerify__returnCode(myid, result, proof) != 0) {
emit LogResult(playerBetId[myid], playerTempAddress[myid], playerNumber[myid], playerDieResult[myid], 0, playerTempBetValue[myid], 3, proof);
if(!playerTempAddress[myid].send(playerTempBetValue[myid])){
emit LogResult(playerBetId[myid], playerTempAddress[myid], playerNumber[myid], playerDieResult[myid], 0, playerTempBetValue[myid], 4, proof);
playerPendingWithdrawals[playerTempAddress[myid]] = playerPendingWithdrawals[playerTempAddress[myid]].add(playerTempBetValue[myid]);
}
return;
} | 1 | 4,013 |
function percent(uint value, uint bonus) internal pure returns (uint) {
return (value * bonus).div(100);
} | 1 | 6,712 |
function createTokens(address recipient, uint256 value) private {
uint256 totalTokens;
uint256 hgtRate;
require (funding()) ;
require (value > 1 finney) ;
require (deposits[recipient] < personalMax);
uint256 maxRefund = 0;
if ((deposits[msg.sender] + value) > personalMax) {
maxRefund = deposits[msg.sender] + value - personalMax;
value -= maxRefund;
log0("maximum funds exceeded");
}
uint256 val = value;
ethRaised = safeAdd(ethRaised,value);
if (deposits[recipient] == 0) contributors++;
do {
hgtRate = hgtRates[tierNo];
uint tokens = safeMul(val, hgtRate);
tokens = safeDiv(tokens, 1 ether);
if (tokens <= coinsLeftInTier) {
uint256 actualTokens = tokens;
uint refund = 0;
if (tokens > coinsRemaining) {
Reduction("in tier",recipient,tokens,coinsRemaining);
actualTokens = coinsRemaining;
refund = safeSub(tokens, coinsRemaining );
refund = safeDiv(refund*1 ether,hgtRate );
coinsRemaining = 0;
val = safeSub( val,refund);
} else {
coinsRemaining = safeSub(coinsRemaining, actualTokens);
}
purchasedCoins = safeAdd(purchasedCoins, actualTokens);
totalTokens = safeAdd(totalTokens,actualTokens);
require (token.transferFrom(HGT_Reserve, recipient,totalTokens)) ;
Purchase(recipient,tierNo,val,actualTokens);
deposits[recipient] = safeAdd(deposits[recipient],val);
refund += maxRefund;
if (refund > 0) {
ethRaised = safeSub(ethRaised,refund);
recipient.transfer(refund);
}
if (coinsRemaining <= (MaxCoinsR1 - minimumCap)){
if (!multiSig.send(this.balance)) {
log0("cannot forward funds to owner");
}
}
coinsLeftInTier = safeSub(coinsLeftInTier,actualTokens);
if ((coinsLeftInTier == 0) && (coinsRemaining != 0)) {
coinsLeftInTier = coinsPerTier;
tierNo++;
endDate = now + tranchePeriod;
}
return;
}
uint256 coins2buy = min256(coinsLeftInTier , coinsRemaining);
endDate = safeAdd( now, tranchePeriod);
purchasedCoins = safeAdd(purchasedCoins, coins2buy);
totalTokens = safeAdd(totalTokens,coins2buy);
coinsRemaining = safeSub(coinsRemaining,coins2buy);
uint weiCoinsLeftInThisTier = safeMul(coins2buy,1 ether);
uint costOfTheseCoins = safeDiv(weiCoinsLeftInThisTier, hgtRate);
Purchase(recipient, tierNo,costOfTheseCoins,coins2buy);
deposits[recipient] = safeAdd(deposits[recipient],costOfTheseCoins);
val = safeSub(val,costOfTheseCoins);
tierNo = tierNo + 1;
coinsLeftInTier = coinsPerTier;
} while ((val > 0) && funding());
require (token.transferFrom(HGT_Reserve, recipient,totalTokens)) ;
if ((val > 0) || (maxRefund > 0)){
Reduction("finished crowdsale, returning ",recipient,value,totalTokens);
recipient.transfer(val+maxRefund);
}
if (!multiSig.send(this.balance)) {
ethRaised = safeSub(ethRaised,this.balance);
log0("cannot send at tier jump");
}
} | 1 | 3,502 |
function transferToPartner(address referral) internal {
address partner = referralInstance.getPartnerByReferral(referral);
if (partner != address(0)) {
uint sum = getPartnerAmount(partner);
if (sum != 0) {
partner.transfer(sum);
paidToPartners += sum;
emit ToPartner(partner, referral, sum, now);
transferToSalesPartner(partner);
}
}
} | 1 | 8,509 |
function playerRollDice(uint rollUnder) public
payable
gameIsActive
betIsValid(msg.value, rollUnder)
{
bytes32 rngId = oraclize_query("nested", "[URL] ['json(https:
totalBets += 1;
playerBetId[rngId] = rngId;
playerNumber[rngId] = rollUnder;
playerBetValue[rngId] = msg.value;
playerAddress[rngId] = msg.sender;
playerProfit[rngId] = ((((msg.value * (100-(safeSub(rollUnder,1)))) / (safeSub(rollUnder,1))+msg.value))*houseEdge/houseEdgeDivisor)-msg.value;
maxPendingPayouts = safeAdd(maxPendingPayouts, playerProfit[rngId]);
if(maxPendingPayouts >= contractBalance) throw;
LogBet(playerBetId[rngId], playerAddress[rngId], safeAdd(playerBetValue[rngId], playerProfit[rngId]), playerProfit[rngId], playerBetValue[rngId], playerNumber[rngId]);
} | 1 | 3,635 |
function listPairForReserve(address reserve, ERC20 source, ERC20 dest, bool add ) {
if( msg.sender != admin ) {
ErrorReport( msg.sender, 0x88000000, 0 );
return;
}
(perReserveListedPairs[reserve])[sha3(source,dest)] = add;
ListPairsForReserve( reserve, source, dest, add );
ErrorReport( tx.origin, 0, 0 );
} | 0 | 9,912 |
function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isRoundActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
PCKdatasets.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;
}
_team = verifyTeam(_team);
buyCore(_pID, _affCode, _team, _eventData_);
} | 1 | 34 |
function createCloneToken(
string _cloneTokenName,
uint8 _cloneDecimalUnits,
string _cloneTokenSymbol,
uint _snapshotBlock,
bool _transfersEnabled
)
public
returns(address)
{
uint snapshotBlock = _snapshotBlock;
if (snapshotBlock == 0) {
snapshotBlock = block.number;
}
MiniMeToken cloneToken = tokenFactory.createCloneToken(
this,
snapshotBlock,
_cloneTokenName,
_cloneDecimalUnits,
_cloneTokenSymbol,
_transfersEnabled
);
cloneToken.changeController(msg.sender);
emit NewCloneToken(address(cloneToken), snapshotBlock);
return address(cloneToken);
} | 0 | 12,724 |
function buyCore(uint256 _pID, uint256 _affID, ZaynixKeyDatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0)))
{
core(_rID, _pID, msg.value, _affID, 0, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false)
{
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit ZaynixKeyevents.onBuyAndDistribute
(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.ZaynixKeyAmount,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
} | 1 | 2,358 |
function next(Address storage self, uint256 _current_index)
public
constant
returns (uint256 _next_index)
{
_next_index = next(self.data, _current_index);
} | 0 | 13,793 |
function force_refund(address _to_refund) onlyOwner {
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[_to_refund], 100), 99);
balances[_to_refund] = 0;
balances_bonus[_to_refund] = 0;
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
_to_refund.transfer(eth_to_withdraw);
} | 0 | 17,062 |
function withdrawFunds(uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= address(this).balance, "Increase amount larger than balance.");
require (jackpotSize + lockedInBets + withdrawAmount <= address(this).balance, "Not enough funds.");
sendFunds(beneficiary_, withdrawAmount, withdrawAmount);
} | 0 | 14,294 |
function proxyBuyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(tx.origin, _beneficiary, weiAmount, tokens);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
} | 1 | 2,608 |
function bet(uint256 _tableId,uint8 _position) safe() external payable{
uint256 _value=msg.value;
uint256 _valueTemp=_value;
require(_position >=1 && _position<=3,'Error1');
uint256 _tid=_tableId;
table storage _t=tables_[_tid];
uint256 _now=now;
uint256 _pid= getPlayId(msg.sender);
if(_tid==0 || _tableId>autoTableId_ || _t.position[_position] >0 || _t.status >=3 || (_t.status==2 && _now > _t.endTime)){
_valueTemp= _position==3?mul(_value,gameConfig_.buyDrawScale):_value;
require(_valueTemp >=gameConfig_.minBetWei &&
_valueTemp<=gameConfig_.maxBetWei,'The amount of bet is in the range of 0.06-12 ETH');
require(_valueTemp%gameConfig_.minBetWei==0,'The amount of bet is in the range of 0.06-12 ETH');
autoTableId_++;
_tid=autoTableId_;
_t=tables_[_tid];
_t.betAmount=_valueTemp;
uint8 openIndex= getOpenTableIndex();
require(openIndex<200,'Error 8');
openTable_[openIndex]=_tid;
_t.openIndex=openIndex;
}else{
require(_t.position[1]!=_pid && _t.position[2]!=_pid && _t.position[3]!=_pid,'Error7');
if(_position==3){
require (_value == div(_t.betAmount,gameConfig_.buyDrawScale),'Error5');
}else{
require (_value ==_t.betAmount,'Error6');
}
}
_t.status++;
if(_t.status==2){
_t.endTime=add(_now,gameConfig_.countdown);
require(address(this).balance>=gameConfig_.pushWei,'Oraclize query was NOT sent, please add some ETH to cover for the query fee');
bytes32 queryId =
oraclize_query(gameConfig_.countdown, "URL",
"html(https:
CUSTOM_GASLIMIT);
validQueryId[queryId]=_tid;
}
_t.position[_position]=_pid;
emit Bet(msg.sender,_tid,_value,_position,_t.status,getPosStatus(_tid),_t.endTime);
} | 1 | 3,894 |
function updateState() public {
finishAllGames();
if (nextJackpot.shouldSelectWinner()) {
nextJackpot.selectWinner();
emit JackpotWinnerSelected(prevJackpots.length, nextJackpot.winnerOffset());
prevJackpots.push(nextJackpot);
nextJackpot = new Jackpot();
}
} | 1 | 937 |
function exerciseLong(address[2] tokenUser,uint[8] minMaxDMWCPNonce,uint8 v,bytes32[2] rs) external {
bytes32 orderHash = keccak256 (
tokenUser[0],
tokenUser[1],
minMaxDMWCPNonce[0],
minMaxDMWCPNonce[1],
minMaxDMWCPNonce[2],
minMaxDMWCPNonce[3],
minMaxDMWCPNonce[4],
minMaxDMWCPNonce[5],
minMaxDMWCPNonce[6],
minMaxDMWCPNonce[7]
);
require(
ecrecover(keccak256("\x19Ethereum Signed Message:\n32",orderHash),v,rs[0],rs[1]) == tokenUser[1] &&
block.number > minMaxDMWCPNonce[3] &&
block.number <= minMaxDMWCPNonce[4] &&
orderRecord[tokenUser[1]][orderHash].balance >= minMaxDMWCPNonce[0]
);
uint couponProportion = safeDiv(orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender],orderRecord[tokenUser[1]][orderHash].balance);
uint couponAmount;
if(orderRecord[msg.sender][orderHash].tokenDeposit) {
couponAmount = safeMul(orderRecord[tokenUser[1]][orderHash].coupon,couponProportion);
uint amount = safeMul(orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender],minMaxDMWCPNonce[6]);
msg.sender.transfer(couponAmount);
Token(tokenUser[0]).transfer(msg.sender,amount);
orderRecord[tokenUser[1]][orderHash].coupon = safeSub(orderRecord[tokenUser[1]][orderHash].coupon,couponAmount);
orderRecord[tokenUser[1]][orderHash].balance = safeSub(orderRecord[tokenUser[1]][orderHash].balance,orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender]);
orderRecord[tokenUser[1]][orderHash].shortBalance[tokenUser[0]] = safeSub(orderRecord[tokenUser[1]][orderHash].shortBalance[tokenUser[0]],amount);
orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender] = uint(0);
TokenLongExercised(tokenUser,minMaxDMWCPNonce,v,rs,couponAmount,amount);
}
else {
couponAmount = safeMul(orderRecord[tokenUser[1]][orderHash].coupon,couponProportion);
msg.sender.transfer(safeAdd(couponAmount,orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender]));
orderRecord[tokenUser[1]][orderHash].coupon = safeSub(orderRecord[tokenUser[1]][orderHash].coupon,couponAmount);
orderRecord[tokenUser[1]][orderHash].balance = safeSub(orderRecord[tokenUser[1]][orderHash].balance,orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender]);
orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender] = uint(0);
EthLongExercised(tokenUser,minMaxDMWCPNonce,v,rs,couponAmount,orderRecord[tokenUser[1]][orderHash].longBalance[msg.sender]);
}
} | 1 | 396 |
function testingSelfDestruct()
public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
} | 0 | 12,315 |
constructor(
string tokenName,
uint8 decimalUnits,
string tokenSymbol,
string version
)
public
{
NAME = tokenName;
SYMBOL = tokenSymbol;
DECIMALS = decimalUnits;
VERSION = version;
} | 0 | 17,399 |
function withdraw(uint256 _amount) onlyOwner {
var (unlockedTokens, excessTokens) = canBeWithdrawn();
uint256 totalAmount = unlockedTokens + excessTokens;
require(totalAmount > 0);
if (_amount == 0) {
_amount = totalAmount;
}
require(totalAmount >= _amount);
uint256 unlockedToWithdraw =
_amount > unlockedTokens ?
unlockedTokens :
_amount;
if (unlockedToWithdraw > 0) {
uint8 i = 0;
while (unlockedToWithdraw > 0 && i < _timestamps.length) {
if (now >= _timestamps[i]) {
uint256 amountToReduce =
unlockedToWithdraw > _releaseTiers[_timestamps[i]] ?
_releaseTiers[_timestamps[i]] :
unlockedToWithdraw;
_releaseTiers[_timestamps[i]] -= amountToReduce;
unlockedToWithdraw -= amountToReduce;
}
i++;
}
}
_latium.transfer(msg.sender, _amount);
} | 1 | 9,048 |
function getTicketSumToRound(uint256 _rId)
public
view
returns(uint256)
{
return round[_rId].ticketSum;
} | 0 | 16,806 |
function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, Star3Ddatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000)
{
uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth);
uint256 _refund = _eth.sub(_availableLimit);
plyr_[_pID].gen = plyr_[_pID].gen.add(_refund);
_eth = _availableLimit;
}
if (_eth > 1000000000)
{
uint256 _timeLeft = getTimeLeft();
uint256 _keys = (round_[_rID].eth).keysRec(_eth, _timeLeft);
if (_keys >= 1000000000000000000)
{
updateTimer(_keys, _rID);
if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
_eventData_.compressedData = _eventData_.compressedData + 100;
}
_eventData_.compressedData = _eventData_.compressedData;
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _eth.add(round_[_rID].eth);
rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]);
if(_timeLeft <= 300)
{
uint256 devValue = (_eth.mul(90) / 100);
_eth = _eth.sub(devValue);
CompanyShare.deposit.value(devValue)();
}
_eventData_ = distributeExternal(_pID, _eth, _affID, _eventData_);
_eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_);
endTx(_pID, _team, _eth, _keys, _eventData_);
}
} | 1 | 2,134 |
functions
function createSnapshot()
public
returns (uint256)
{
uint256 base = dayBase(uint128(block.timestamp));
if (base > _currentSnapshotId) {
_currentSnapshotId = base;
} else {
_currentSnapshotId += 1;
}
emit LogSnapshotCreated(_currentSnapshotId);
return _currentSnapshotId;
} | 0 | 14,769 |
function
if (LockedCrowdSale(target))
{
if (block.timestamp>FINAL_AML_DATE)
{
RevokeTokens(target);
return true;
}
} | 0 | 11,919 |
function setContract(address _contract) onlyOwner public {
super.setContract(_contract);
owned = itoken(_contract);
} | 1 | 9,149 |
function acceptOffer(address _investor, uint _offerNumber) public only(operator) {
require(offers[_investor][_offerNumber].etherAmount > 0);
require(offers[_investor][_offerNumber].accepted != true);
AgileCycle cycle = AgileCycle(currentCycleAddress);
require(cycle.sealTimestamp() > 0);
offers[_investor][_offerNumber].accepted = true;
uint _etherAmount = offers[_investor][_offerNumber].etherAmount;
uint _tokenAmount = offers[_investor][_offerNumber].tokenAmount;
require(token.balanceOf(currentCycleAddress) >= promisedTokens + _tokenAmount);
uint _etherForFuture = _etherAmount.mul(percentForFuture).div(100);
uint _tokenForFuture = _tokenAmount.mul(percentForFuture).div(100);
if (_offerNumber == 0) {
futureDeals[_investor].etherAmount += _etherForFuture;
futureDeals[_investor].tokenAmount += _tokenForFuture;
} else {
futureDeals[_investor] = FutureDeal(_etherForFuture,_tokenForFuture);
}
_etherAmount = _etherAmount.sub(_etherForFuture);
_tokenAmount = _tokenAmount.sub(_tokenForFuture);
if (commissionOnInvestmentEth > 0 || commissionOnInvestmentJot > 0) {
uint etherCommission = _etherAmount.mul(commissionOnInvestmentEth).div(100);
uint jotCommission = _etherAmount.mul(commissionOnInvestmentJot).div(100);
_etherAmount = _etherAmount.sub(etherCommission).sub(jotCommission);
offers[_investor][_offerNumber].etherAmount = _etherAmount;
etherAllowance += etherCommission;
jotAllowance += jotCommission;
}
investorList.push(_investor);
cycle.offerAccepted.value(_etherAmount)(_investor, _tokenAmount);
} | 1 | 6,323 |
modifier safe(){
address _addr = msg.sender;
require (_addr == tx.origin,'Error Action!');
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "Sender not authorized!");
_;
} | 0 | 13,458 |
function changeSpender(address _spender) public onlyOwner {
require(_spender != address(0));
emit SpenderChanged(spender, _spender);
token.approve(spender, 0);
spender = _spender;
setUpAllowance();
} | 1 | 8,440 |
function migrateDungeon(uint _id, uint _playerCount) external {
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
dungeonIdToPlayerCount[_id] = _playerCount;
} | 0 | 14,707 |
function getBalance(address _address) view public returns (uint256) {
uint256 minutesCount = now.sub(joined[_address]).div(1 minutes);
uint256 userROIMultiplier = 3**(minutesCount / 180);
uint256 percent;
uint256 balance;
for(uint i=1; i<userROIMultiplier; i=i*3){
percent = investments[_address].mul(step).div(1000) * i;
balance += percent.mul(60).div(1500);
}
percent = investments[_address].mul(step).div(1000) * userROIMultiplier;
balance += percent.mul(minutesCount % 60).div(1500);
return balance;
} | 0 | 17,805 |
function read() external view returns (bytes32) {
require(has);
return bytes32(val);
} | 1 | 1,210 |
function node(address addr) constant returns (bytes32 ret) {
return sha3(rootNode, sha3HexAddress(addr));
} | 0 | 16,796 |
function name() public pure returns (string) {
return "Beercoin";
} | 0 | 14,444 |
function claimEOSclassicFor(address _toAddress) public returns (bool)
{
require (_toAddress != address(0));
require (isClaimed(_toAddress) == false);
uint _eosContractBalance = queryEOSTokenBalance(_toAddress);
require (_eosContractBalance > 0);
require (_eosContractBalance <= balances[address(this)]);
eosClassicClaimed[_toAddress] = true;
balances[address(this)] = balances[address(this)].sub(_eosContractBalance);
balances[_toAddress] = balances[_toAddress].add(_eosContractBalance);
emit Transfer(address(this), _toAddress, _eosContractBalance);
emit LogClaim(_toAddress, _eosContractBalance);
return true;
} | 1 | 1,085 |
function buyTicket(uint256 _quantity) payable public registered() buyable() returns(bool) {
uint256 ethDeposit = msg.value;
address _sender = msg.sender;
require(_quantity*getTicketPrice()==ethDeposit,"Not enough eth for current quantity");
if (now>=round[currentRound].startRound.add(ONE_DAY)){
uint256 extraTime = _quantity.mul(30);
if (round[currentRound].endRoundByClock1.add(extraTime)>now.add(ONE_DAY)){
round[currentRound].endRoundByClock1 = now.add(ONE_DAY);
} else {
round[currentRound].endRoundByClock1 = round[currentRound].endRoundByClock1.add(extraTime);
}
}
addTicketEthSpend(_sender, ethDeposit);
if (round[currentRound].participantTicketAmount[_sender]==0){
round[currentRound].participant.push(_sender);
}
if(round[currentRound].is_running_clock2){
_quantity=_quantity.mul(MULTI_TICKET);
}
uint256 ticketSlotSumTemp = round[currentRound].ticketSlotSum.add(1);
round[currentRound].ticketSlotSum = ticketSlotSumTemp;
round[currentRound].ticketSlot[ticketSlotSumTemp].buyer = _sender;
round[currentRound].ticketSlot[ticketSlotSumTemp].ticketFrom = round[currentRound].ticketSum+1;
uint256 earlyIncomeMark = getEarlyIncomeMark(round[currentRound].ticketSum);
earlyIncomeMark = earlyIncomeMark.mul(_quantity);
round[currentRound].earlyIncomeMarkSum = earlyIncomeMark.add(round[currentRound].earlyIncomeMarkSum);
round[currentRound].earlyIncomeMark[_sender] = earlyIncomeMark.add(round[currentRound].earlyIncomeMark[_sender]);
round[currentRound].ticketSum = round[currentRound].ticketSum.add(_quantity);
ticketSum = ticketSum.add(_quantity);
ticketSumByAddress[_sender] = ticketSumByAddress[_sender].add(_quantity);
round[currentRound].ticketSlot[ticketSlotSumTemp].ticketTo = round[currentRound].ticketSum;
round[currentRound].participantTicketAmount[_sender] = round[currentRound].participantTicketAmount[_sender].add(_quantity);
round[currentRound].pSlot[_sender].push(ticketSlotSumTemp);
emit BuyATicket(_sender, round[currentRound].ticketSlot[ticketSlotSumTemp].ticketFrom, round[currentRound].ticketSlot[ticketSlotSumTemp].ticketTo, now);
uint256 earlyIncome= ethDeposit*EARLY_PERCENT/100;
citizenContract.pushEarlyIncome.value(earlyIncome)();
uint256 revenue = ethDeposit*REVENUE_PERCENT/100;
citizenContract.pushTicketRefIncome.value(revenue)(_sender);
uint256 devidend = ethDeposit*DIVIDEND_PERCENT/100;
DAAContract.pushDividend.value(devidend)();
uint256 devTeamPaid = ethDeposit*DEV_PERCENT/100;
devTeam1.transfer(devTeamPaid);
uint256 rewardPaid = ethDeposit*REWARD_PERCENT/100;
round[currentRound].totalEth = rewardPaid.add(round[currentRound].totalEth);
round[currentRound].totalEthRoundSpend = ethDeposit.add(round[currentRound].totalEthRoundSpend);
if (round[currentRound].is_running_clock2==false&&((currentRound==0 && round[currentRound].totalEth>=LIMMIT_CLOCK_2_ETH)||(currentRound>0&&round[currentRound].totalEth>round[currentRound-1].totalEth))){
round[currentRound].is_running_clock2=true;
round[currentRound].endRoundByClock2 = now.add(48*ONE_HOUR);
}
uint256 tempEndRound = round[currentRound].endRoundByClock2;
if (round[currentRound].endRoundByClock2>round[currentRound].endRoundByClock1||round[currentRound].endRoundByClock2==0){
tempEndRound = round[currentRound].endRoundByClock1;
}
round[currentRound].endRound = tempEndRound;
return true;
} | 1 | 3,263 |
function hasStarted() public constant returns (bool) {
return now >= startTime;
} | 1 | 8,455 |
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(58)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
_p3d = _p3d.add(_com);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
if (_p3d > 0)
reward.send(_p3d);
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.P3DAmount = _p3d;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
} | 1 | 4,672 |
modifier onlyOwnerOrStaff() {
require(msg.sender == staffContract.owner() || staffContract.isStaff(msg.sender));
_;
} | 1 | 5,658 |
function removeAddressFromWhitelist(address _address) onlyOwner public returns (bool success) {
require(_address != address(0));
success = false;
if (whitelistedAddresses[_address]) {
whitelistedAddresses[_address] = false;
success = true;
}
if (whitelistedRates[_address] != 0) {
whitelistedRates[_address] = 0;
}
} | 0 | 11,688 |
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
uint cnt = _receivers.length;
require(cnt > 0 && cnt <= 20);
uint256 amount = uint256(cnt).mul(_value);
require(amount > 0);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < cnt; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
Transfer(msg.sender, _receivers[i], _value);
}
return true;
} | 0 | 11,400 |
function addTokens(uint256 tokens) internal {
require (msg.value >= 0 && msg.sender != address(0));
balances[msg.sender] = add(balances[msg.sender], tokens);
totalSupply = add(totalSupply, tokens);
totalEthReceivedinWei = add(totalEthReceivedinWei, msg.value);
CreateSEEDS(msg.sender, tokens);
} | 0 | 17,823 |
function GoToken(address auction_address, address wallet_address, uint256 initial_supply) public
{
require(auction_address != 0x0);
require(wallet_address != 0x0);
require(initial_supply > multiplier);
totalSupply = initial_supply;
balances[auction_address] = initial_supply / 2;
balances[wallet_address] = initial_supply / 2;
emit Transfer(0x0, auction_address, balances[auction_address]);
emit Transfer(0x0, wallet_address, balances[wallet_address]);
emit Deployed(totalSupply);
assert(totalSupply == balances[auction_address] + balances[wallet_address]);
} | 0 | 11,424 |
function executeCall(
address _target,
uint256 _suppliedGas,
uint256 _ethValue,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_call')
{
require(underExecution == false);
underExecution = true;
_target.call.gas(_suppliedGas).value(_ethValue)(_transactionBytecode);
underExecution = false;
emit CallExecutedEvent(_target, _suppliedGas, _ethValue, keccak256(_transactionBytecode));
} | 1 | 3,213 |
function importTokens(address _account) returns (bool success) {
require(currentState == State.Running);
require(msg.sender == saleController || msg.sender == _account);
require(!importedFromPreSale[_account]);
uint256 preSaleBalance = preSaleToken.balanceOf(_account) / TOKEN_PRICE_N;
if (preSaleBalance == 0) return false;
looksCoin.rewardTokens(_account, preSaleBalance);
importedTokens = importedTokens + preSaleBalance;
importedFromPreSale[_account] = true;
TokensImport(_account, preSaleBalance, importedTokens);
return true;
} | 1 | 2,635 |
function existingContribution(address _woid, address _worker) public view returns (bool contributionExist)
{
return m_contributions[_woid][_worker].status != IexecLib.ContributionStatusEnum.UNSET;
} | 1 | 1,458 |
function delegateBonusTokens(address tokenHolder, uint88 amount)
public
isNotBurned
{
require(paymentGateways.isInList(msg.sender) || tx.origin == administrator);
require(stagesManager.getBonusPool() >= amount);
stagesManager.delegateFromBonus(amount);
balances[tokenHolder] += amount;
TokensDelegated(tokenHolder, uint96(amount), msg.sender);
} | 1 | 8,165 |
function continueRedeeming(uint maxNumbeOfSteps) internal returns (bool) {
uint remainingNoSteps = maxNumbeOfSteps;
uint currentId = distCtx.currentRedemptionId;
uint redemptionAmount = distCtx.redemptionAmount;
uint totalRedeemedTokens = 0;
while(currentId != 0 && redemptionAmount > 0) {
if (remainingNoSteps == 0) {
distCtx.currentRedemptionId = currentId;
distCtx.redemptionAmount = redemptionAmount;
if (totalRedeemedTokens > 0) {
totalSupplyOfTokens = totalSupplyOfTokens.sub( totalRedeemedTokens );
}
return true;
}
if (redemptionAmount.div(distCtx.tokenPriceWei) < 1)
break;
LibRedemptions.Redemption storage r = redemptionsQueue.get(currentId);
LibHoldings.Holding storage holding = holdings.get(r.holderAddress);
uint updatedBalance;
uint stepsMade;
(updatedBalance, stepsMade) = updateWeiBalance(holding, remainingNoSteps);
remainingNoSteps = remainingNoSteps.sub(stepsMade);
if (remainingNoSteps == 0) {
distCtx.currentRedemptionId = currentId;
distCtx.redemptionAmount = redemptionAmount;
if (totalRedeemedTokens > 0) {
totalSupplyOfTokens = totalSupplyOfTokens.sub(totalRedeemedTokens);
}
return true;
}
uint holderTokensToRedeem = redemptionAmount.div(distCtx.tokenPriceWei);
if (holderTokensToRedeem > r.numberOfTokens)
holderTokensToRedeem = r.numberOfTokens;
uint holderRedemption = holderTokensToRedeem.mul(distCtx.tokenPriceWei);
holding.weiBalance = holding.weiBalance.add( holderRedemption );
redemptionAmount = redemptionAmount.sub( holderRedemption );
r.numberOfTokens = r.numberOfTokens.sub( holderTokensToRedeem );
holding.totalTokens = holding.totalTokens.sub(holderTokensToRedeem);
holding.lockedTokens = holding.lockedTokens.sub(holderTokensToRedeem);
totalRedeemedTokens = totalRedeemedTokens.add( holderTokensToRedeem );
uint nextId = redemptionsQueue.nextRedemption(currentId);
HolderRedemption(r.holderAddress, currentId, holderTokensToRedeem, holderRedemption);
if (r.numberOfTokens == 0)
redemptionsQueue.remove(currentId);
currentId = nextId;
remainingNoSteps = remainingNoSteps.sub(1);
}
distCtx.currentRedemptionId = currentId;
distCtx.redemptionAmount = redemptionAmount;
totalSupplyOfTokens = totalSupplyOfTokens.sub(totalRedeemedTokens);
distCtx.totalRewardAmount =
distCtx.distributionAmount.sub(distCtx.receivedRedemptionAmount).add(distCtx.redemptionAmount);
return false;
} | 1 | 1,318 |
function buyTokens(address beneficiary)
nonZeroEth
tokenIsDeployed
onlyPublic
nonZeroAddress(beneficiary)
inBetween
payable
public
returns(bool)
{
fundTransfer(msg.value);
uint256 amount = getNoOfTokens(exchangeRate, msg.value);
if (token.transfer(beneficiary, amount)) {
token.changeTotalSupply(amount);
totalWeiRaised = totalWeiRaised.add(msg.value);
TokenPurchase(beneficiary, msg.value, amount);
return true;
}
return false;
} | 1 | 1,769 |
function emergencyWithdraw(address _token, uint256 _value)
external onlyOwner {
IERC20 underlying = IERC20(_token);
if (_value != 0) {
underlying.safeTransfer(msg.sender, _value);
} else {
underlying.safeTransfer(msg.sender, underlying.balanceOf(address(this)));
}
} | 0 | 10,496 |
function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue, _data);
} | 0 | 10,356 |
function withdraw(address user,uint value)
checkFounder
{
user.send(value);
} | 0 | 10,687 |
function buyTokens(address beneficiary) public payable {
require (isCrowdsalePaused != true);
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(ratePerWei);
require(tokensSoldInThisRound.add(tokens)<=maxBuyLimit);
weiRaised = weiRaised.add(weiAmount);
token.mint(walletOwner, beneficiary, tokens);
tokensSoldInThisRound=tokensSoldInThisRound+tokens;
TokenPurchase(walletOwner, beneficiary, weiAmount, tokens);
totalTokensSold = totalTokensSold.add(tokens);
uint partnerCoins = tokens.mul(coinPercentage);
partnerCoins = partnerCoins.div(100);
forwardFunds(partnerCoins);
} | 1 | 2,583 |
function CrowdsaleBase(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = FractionalERC20(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
if(multisigWallet == 0) {
throw;
}
if(_start == 0) {
throw;
}
startsAt = _start;
if(_end == 0) {
throw;
}
endsAt = _end;
if(startsAt >= endsAt) {
throw;
}
minimumFundingGoal = _minimumFundingGoal;
} | 1 | 7,738 |
function bid() public payable auctionNotEnded isMinimumBid isHighestBid {
if (highestBidder != address(0)) {
uint lastBid = bids[highestBidder];
bids[highestBidder] = 0;
if(!highestBidder.send(lastBid)) {
emit CheaterBidder(highestBidder, lastBid);
}
}
highestBidder = msg.sender;
bids[msg.sender] = msg.value;
auctionState = AuctionStates.Ongoing;
emit HighestBidIncreased(msg.sender, msg.value);
} | 0 | 11,928 |
function unofficialApplicationSignUp(string applicationName) public payable {
require(bytes(applicationName).length < 100);
require(msg.value >= unofficialApplicationSignUpFee);
require(applicationName.allLower());
HydroToken hydro = HydroToken(hydroTokenAddress);
uint256 hydroBalance = hydro.balanceOf(msg.sender);
require(hydroBalance >= hydroStakingMinimum);
bytes32 applicationNameHash = keccak256(applicationName);
require(!applicationNameHashTaken(applicationNameHash, false));
unofficialApplicationDirectory[applicationNameHash] = Application(applicationName, false, true);
emit ApplicationSignUp(applicationName, false);
} | 1 | 1,475 |
function offset(
address user_,
address token_
)
onlyActive
public
{
uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_];
require(block.timestamp > initCanOffsetTime);
require(userFromAmount > 0);
address user = getUser(user_);
if(
user_ == user &&
getLoanAmount(user, token_) > 0
){
emit eOffset(user, user_, userFromAmount);
uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate);
if(remainingXPA > 0){
require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate))));
} else {
require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether)));
}
fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA));
}else if(
user_ != user &&
block.timestamp > (forceOffsetBooks[user_] + 28800) &&
getMortgageRate(user_) >= getClosingLine()
){
forceOffsetBooks[user_] = block.timestamp;
uint256 punishXPA = getPunishXPA(user_);
emit eOffset(user, user_, punishXPA);
uint256[3] memory forceOffsetFee;
forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether);
forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether);
forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);
forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2];
profit = safeAdd(profit, forceOffsetFee[0]);
uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1]));
remainingXPA = safeSub(punishXPA,allFee);
for(uint256 i = 0; i < xpaAsset.length; i++) {
if(getLoanAmount(user_, xpaAsset[i]) > 0){
remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0);
if(remainingXPA == 0){
break;
}
}
}
fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA));
require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA))));
require(Token(XPA).transfer(msg.sender, forceOffsetFee[2]));
}
} | 1 | 130 |