Contract Overview
Balance: 2.957868241039947879 Ether
Ether Value: $609.53 (@ $206.07/ETH)
Transactions: 47 txns
 Latest 25 txns From a total of 47 Transactions

TxHash Age From To Value [TxFee]
0x6540c5b5f230001f6b4926f61961e282db801a5662cb62b5a8f4224ea0ddc82e4 days 7 hrs ago0x14eb26801f7b452275f2f6b18385dd04982fec92  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.025 Ether0.000128352
0xe29f769ca9548d011ab42bee8bcba979d4dc23088e6257159bf9d1731e36481c5 days 7 hrs ago0x14eb26801f7b452275f2f6b18385dd04982fec92  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.095 Ether0.000192528
0xf5cc97669432b65e83d42a9c76cb56d2afb0ebc7bce5bdd90f803c42f198616d5 days 7 hrs ago0xfcfd50ce30968c587b47920f147420cc85384e82  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.029 Ether0.000192528
0x457f86948643ae6c2dd40bdd631a1753c5f2ff1a4e1e3712f7f43cd03c0e1ba85 days 8 hrs ago0x8558cf546362659d56d774a5f53ab7e3f2db5925  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.09 Ether0.000192528
0xe1a2e8b3de6d80ef6409c678d6a22f243fe8789a842db0afeae44743871ccb685 days 8 hrs ago0x2422d3403d6767219f804167c3b7d65c0d55f8bf  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.0386 Ether0.000192528
0x007425003bcfdb258cdc85d951c9274fa16aab278064f1f6384e7425b11a766b5 days 8 hrs ago0x5ef22b04c15594f3f25116322531e945fe9aaa01  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.11 Ether0.000301857
0x4965303aefe98b2466209f21c881b8ea8f65a0b729237cb07fe95701a0633a8e5 days 8 hrs ago0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.56 Ether0.000336963
0x0493a397fa2b3b1cbe5f55fcf39364d07d3230d648b21bf3039057940aad8d365 days 8 hrs ago0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0 Ether0.000067662
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e255 days 8 hrs ago0x2f4e909609834f98d310184431bc40aabda30502  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0 Ether0.000408306
0x63758073eb57c83caac205cf2a6a09b1a5645927cc2453a0a5a8740f906cb0728 days 3 hrs ago0x14eb26801f7b452275f2f6b18385dd04982fec92  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.017 Ether0.000256704
0x91d870bf34f109969547161431a8ca160f59ec6ab9dbcbc7db3c87a03b80bf2a9 days 7 hrs ago0x14eb26801f7b452275f2f6b18385dd04982fec92  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.027 Ether0.00032088
0x9e94dfaa90092322524d55212fbcdf399bf4337c2a2d9a99f41a1fac8aeaada811 days 7 hrs ago0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.178 Ether0.000381963
0x2ae830d8cee0f4579e3e3387a061c2bea15678b09986aeff8881fe3a5e71b04811 days 7 hrs ago0x5ef22b04c15594f3f25116322531e945fe9aaa01  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.044 Ether0.000282528
0xbc580ffe967edd6c085fcbc6756a800e32f59a2193256eeeaf9b3fe37d32f53f12 days 2 hrs ago0x2f4e909609834f98d310184431bc40aabda30502  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0 Ether0.000507025
0xd01ce9d7edf9108b2e17054e54b9248de1a864d12345b788a342c6829814860512 days 2 hrs ago0x2f4e909609834f98d310184431bc40aabda30502  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0 Ether0.00051655
0x50a4898a617923ba8aa0636ef09ec7451678351a78bff32712923c6f9727f05a12 days 3 hrs ago0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.52 Ether0.000449284
0x6b448b8003326f6af1f7124d592fae54d776b7023e128bdcd52e12f6315f8e7c12 days 3 hrs ago0xfcfd50ce30968c587b47920f147420cc85384e82  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.02 Ether0.000256704
0x9a9258ff56376370cbe6df398dbb6f6a93e6c8564624f58c0dcb54d166f6fc1912 days 3 hrs ago0x14eb26801f7b452275f2f6b18385dd04982fec92  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.16228246830507 Ether0.000402476
0x6a18f9631167456ccd1fe14d8f71c766410561eb8033c936c5cc1fb9cd20c02312 days 3 hrs ago0x5ef22b04c15594f3f25116322531e945fe9aaa01  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.116386633266203 Ether0.000402476
0x96a84bf7d8001c0b3cc91fdf1126c6211a74ba4ad637634734ea3d80c690f1e612 days 3 hrs ago0x2422d3403d6767219f804167c3b7d65c0d55f8bf  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.034 Ether0.000256704
0x6ff2633c7b21936b544981102188e0daba033613594150909b3614386523faba12 days 3 hrs ago0x8558cf546362659d56d774a5f53ab7e3f2db5925  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.054 Ether0.000256704
0xc10d15020888d318e238f9915971322d1f5213563d5028ab393894b3b74ee60812 days 3 hrs ago0x2f4e909609834f98d310184431bc40aabda30502  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0 Ether0.000544408
0x4d08754573f7258408e9730ffab350d33df98f31264bee0094640f6f3e8a4cd916 days 2 hrs ago0xfcfd50ce30968c587b47920f147420cc85384e82  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.1 Ether0.001056905
0x8c020acaa6bbcd001ce386fda093b0ca55e621c89115094af5a4d7182b581b9716 days 3 hrs ago0xfcfd50ce30968c587b47920f147420cc85384e82  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.1 Ether0.00105
0xdefb9fd1a9c4147f8c8a3886c363a8a16c73aba151e7fa483f36ab24e2d1501d16 days 16 hrs ago0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d  IN   0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0.6 Ether0.000673926
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click Here To View More View All
ParentTxHash Block Age From To Value
0x6540c5b5f230001f6b4926f61961e282db801a5662cb62b5a8f4224ea0ddc82e65228504 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0045 Ether
0xe29f769ca9548d011ab42bee8bcba979d4dc23088e6257159bf9d1731e36481c65166805 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0171 Ether
0xf5cc97669432b65e83d42a9c76cb56d2afb0ebc7bce5bdd90f803c42f198616d65166655 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00522 Ether
0x457f86948643ae6c2dd40bdd631a1753c5f2ff1a4e1e3712f7f43cd03c0e1ba865166595 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0162 Ether
0xe1a2e8b3de6d80ef6409c678d6a22f243fe8789a842db0afeae44743871ccb6865166555 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.006948 Ether
0x007425003bcfdb258cdc85d951c9274fa16aab278064f1f6384e7425b11a766b65166515 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0198 Ether
0x4965303aefe98b2466209f21c881b8ea8f65a0b729237cb07fe95701a0633a8e65166505 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.1008 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0xfcfd50ce30968c587b47920f147420cc85384e820.028566465277777777 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x8558cf546362659d56d774a5f53ab7e3f2db59250.089829343859953703 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2422d3403d6767219f804167c3b7d65c0d55f8bf0.038188780162037037 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x14eb26801f7b452275f2f6b18385dd04982fec920.073551363324667908 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d0.578130277083333333 Ether
0x48ab524cfd248d52b4035d40dfa6577dc5267504219e828369c6e5e551ca9e2565166335 days 8 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x5ef22b04c15594f3f25116322531e945fe9aaa010.110426876782449969 Ether
0x63758073eb57c83caac205cf2a6a09b1a5645927cc2453a0a5a8740f906cb07264992318 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00306 Ether
0x91d870bf34f109969547161431a8ca160f59ec6ab9dbcbc7db3c87a03b80bf2a64920259 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00486 Ether
0x9e94dfaa90092322524d55212fbcdf399bf4337c2a2d9a99f41a1fac8aeaada8647994811 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.03204 Ether
0x2ae830d8cee0f4579e3e3387a061c2bea15678b09986aeff8881fe3a5e71b048647990811 days 7 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00792 Ether
0xbc580ffe967edd6c085fcbc6756a800e32f59a2193256eeeaf9b3fe37d32f53f647480212 days 2 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0xcafa20783d8a8caa3d1763d15ba6cce4a812fe0d0.044373691015712743 Ether
0xd01ce9d7edf9108b2e17054e54b9248de1a864d12345b788a342c68298148605647479912 days 2 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x5ef22b04c15594f3f25116322531e945fe9aaa010.044373691015712743 Ether
0x50a4898a617923ba8aa0636ef09ec7451678351a78bff32712923c6f9727f05a647475612 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0936 Ether
0x6b448b8003326f6af1f7124d592fae54d776b7023e128bdcd52e12f6315f8e7c647469712 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.0036 Ether
0x9a9258ff56376370cbe6df398dbb6f6a93e6c8564624f58c0dcb54d166f6fc19647469312 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.02921084429491271 Ether
0x6a18f9631167456ccd1fe14d8f71c766410561eb8033c936c5cc1fb9cd20c023647469312 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.020949593987916666 Ether
0x96a84bf7d8001c0b3cc91fdf1126c6211a74ba4ad637634734ea3d80c690f1e6647469312 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00612 Ether
0x6ff2633c7b21936b544981102188e0daba033613594150909b3614386523faba647469312 days 3 hrs ago0x4a7b59efa94626b5ce4842ced3303ca8afd789ac0x2f4e909609834f98d310184431bc40aabda305020.00972 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Exact Match)
Contract Name: Star
Compiler Text: v0.4.25+commit.59dbf8f1
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.24;

contract Lottery {
    using SafeMath for uint;
    using SafeMath for uint8;

    uint private lotteryBalance;
    uint private ticketsCount;

    address[] internal ticketsAddresses;
    mapping(address => uint) internal tickets;

    uint constant private DEPOSIT_MULTIPLY = 100 finney; // 0.1 eth
    uint8 constant internal ITERATION_LIMIT = 150;
    uint8 private generatorOffset = 0;
    uint private randomNumber = 0;

    Utils.winner private lastWinner;

    function addLotteryParticipant(address addr, uint depositAmount) internal {
        if (depositAmount >= DEPOSIT_MULTIPLY) {
            uint investorTicketCount = depositAmount.div(DEPOSIT_MULTIPLY);
            ticketsCount = ticketsCount.add(investorTicketCount);
            ticketsAddresses.push(addr);
            tickets[addr] = tickets[addr].add(investorTicketCount);
        }
    }

    function getLotteryBalance() public view returns(uint) {

        return lotteryBalance;
    }

    function increaseLotteryBalance(uint value) internal {

        lotteryBalance = lotteryBalance.add(value);
    }

    function resetLotteryBalance() internal {

        ticketsCount = 0;
        lotteryBalance = 0;
    }

    function setLastWinner(address addr, uint balance, uint prize, uint date) internal {
        lastWinner.addr = addr;
        lastWinner.balance = balance;
        lastWinner.prize = prize;
        lastWinner.date = date;
    }

    function getLastWinner() public view returns(address, uint, uint, uint) {
        return (lastWinner.addr, lastWinner.balance, lastWinner.prize, lastWinner.date);
    }

    function getRandomLotteryTicket() internal returns(address) {
        address addr;
        if (randomNumber != 0)
            randomNumber = random(ticketsCount);
        uint edge = 0;
        for (uint8 key = generatorOffset; key < ticketsAddresses.length && key < ITERATION_LIMIT; key++) {
            addr = ticketsAddresses[key];
            edge = edge.add(tickets[addr]);
            if (randomNumber <= edge) {
                randomNumber = 0;
                generatorOffset = 0;
                return addr;
            }
        }
        generatorOffset = key;
        return 0;
    }

    function random(uint max) private view returns (uint) {
        return uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % max + 1;
    }
}

contract Stellar {
    using SafeMath for uint;

    uint private stellarInvestorBalance;

    struct stellar {
        address addr;
        uint balance;
    }

    stellar private stellarInvestor;

    Utils.winner private lastStellar;

    event NewStellar(address addr, uint balance);

    function checkForNewStellar(address addr, uint balance) internal {
        if (balance > stellarInvestor.balance) {
            stellarInvestor = stellar(addr, balance);
            emit NewStellar(addr, balance);
        }
    }

    function getStellarInvestor() public view returns(address, uint) {

        return (stellarInvestor.addr, stellarInvestor.balance);
    }

    function getStellarBalance() public view returns(uint) {

        return stellarInvestorBalance;
    }

    function increaseStellarBalance(uint value) internal {

        stellarInvestorBalance = stellarInvestorBalance.add(value);
    }

    function resetStellarBalance() internal {
        stellarInvestorBalance = 0;
    }

    function resetStellarInvestor() internal {
        stellarInvestor.addr = 0;
        stellarInvestor.balance = 0;
    }

    function setLastStellar(address addr, uint balance, uint prize, uint date) internal {
        lastStellar.addr = addr;
        lastStellar.balance = balance;
        lastStellar.prize = prize;
        lastStellar.date = date;
    }

    function getLastStellar() public view returns(address, uint, uint, uint) {
        return (lastStellar.addr, lastStellar.balance, lastStellar.prize, lastStellar.date);
    }
}

contract Star is Lottery, Stellar {

    using Math for Math.percent;
    using SafeMath for uint;

    uint constant private MIN_DEPOSIT = 10 finney; // 0.01 eth
    uint constant private PAYOUT_INTERVAL = 23 hours;
    uint constant private WITHDRAW_INTERVAL = 12 hours;
    uint constant private PAYOUT_TRANSACTION_LIMIT = 100;

    Math.percent private DAILY_PERCENT =  Math.percent(35, 10); // Math.percent(35, 10) = 35 / 10 = 3.5%
    Math.percent private FEE_PERCENT = Math.percent(18, 1);
    Math.percent private LOTTERY_PERCENT = Math.percent(1, 1);
    Math.percent private STELLAR_INVESTOR_PERCENT = Math.percent(1, 1);

    address internal owner;

    uint8 cycle;

    address[] internal addresses;

    uint internal investorCount;
    uint internal lastPayoutDate;
    uint internal lastDepositDate;

    bool public isCycleFinish = false;

    struct investor {
        uint id;
        uint balance;
        uint depositCount;
        uint lastDepositDate;
    }

    mapping(address => investor) internal investors;

    event Invest(address addr, uint amount);
    event InvestorPayout(address addr, uint amount, uint date);
    event Payout(uint amount, uint transactionCount, uint date);
    event Withdraw(address addr, uint amount);
    event NextCycle(uint8 cycle, uint now, uint);

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    constructor() public {
        owner = msg.sender;
        addresses.length = 1;
    }

    function() payable public {
        require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");

        if (msg.value == 0) {
            withdraw(msg.sender);
            return;
        }

        deposit(msg.sender, msg.value);
    }

    function restartCycle() public onlyOwner returns(bool) {
        if (isCycleFinish == true) {
            newCycle();
            return false;
        }
        return true;
    }

    function payout(uint startPosition) public onlyOwner {

        require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");

        uint transactionCount;
        uint investorsPayout;
        uint dividendsAmount;

        if (startPosition == 0)
            startPosition = 1;

        for (uint key = startPosition; key <= investorCount && transactionCount < PAYOUT_TRANSACTION_LIMIT; key++) {
            address addr = addresses[key];
            if (investors[addr].lastDepositDate + PAYOUT_INTERVAL > now) {
                continue;
            }

            dividendsAmount = getInvestorDividends(addr);

            if (address(this).balance < dividendsAmount) {
                isCycleFinish = true;
                return;
            }

            addr.transfer(dividendsAmount);
            emit InvestorPayout(addr, dividendsAmount, now);
            investors[addr].lastDepositDate = now;

            investorsPayout = investorsPayout.add(dividendsAmount);

            transactionCount++;
        }

        lastPayoutDate = now;
        emit Payout(investorsPayout, transactionCount, lastPayoutDate);
    }

    function deposit(address addr, uint amount) internal {
        require(amount >= MIN_DEPOSIT, "Too small amount, minimum 0.01 eth");

        investor storage user = investors[addr];

        if (user.id == 0) {
            user.id = addresses.length;
            addresses.push(addr);
            investorCount ++;
        }

        uint depositFee = FEE_PERCENT.getPercentFrom(amount);

        increaseLotteryBalance(LOTTERY_PERCENT.getPercentFrom(amount));
        increaseStellarBalance(STELLAR_INVESTOR_PERCENT.getPercentFrom(amount));

        addLotteryParticipant(addr, amount);

        user.balance = user.balance.add(amount);
        user.depositCount ++;
        user.lastDepositDate = now;
        lastDepositDate = now;

        checkForNewStellar(addr, user.balance);

        emit Invest(msg.sender, msg.value);

        owner.transfer(depositFee);
    }

    function withdraw(address addr) internal {
        require(isCycleFinish == false, "Cycle completed. The new cycle will start within 24 hours.");

        investor storage user = investors[addr];
        require(user.id > 0, "Account not found");

        require(now.sub(user.lastDepositDate).div(WITHDRAW_INTERVAL) > 0, "The latest payment was earlier than 12 hours");

        uint dividendsAmount = getInvestorDividends(addr);

        if (address(this).balance < dividendsAmount) {
            isCycleFinish = true;
            return;
        }

        addr.transfer(dividendsAmount);
        user.lastDepositDate = now;

        emit Withdraw(addr, dividendsAmount);
    }

    function runLottery() public onlyOwner returns(bool) {
        return processLotteryReward();
    }

    function processLotteryReward() private returns(bool) {
        if (getLotteryBalance() > 0) {
            address winnerAddress = getRandomLotteryTicket();
            if (winnerAddress == 0)
                return false;
            winnerAddress.transfer(getLotteryBalance());
            setLastWinner(winnerAddress, investors[winnerAddress].balance, getLotteryBalance(), now);
            resetLotteryBalance();
            return true;
        }

        return false;
    }

    function giveStellarReward() public onlyOwner {
        processStellarReward();
    }

    function processStellarReward() private {
        uint balance = getStellarBalance();
        if (balance > 0) {
            (address addr, uint investorBalance) = getStellarInvestor();
            addr.transfer(balance);
            setLastStellar(addr, investors[addr].balance, getStellarBalance(), now);
            resetStellarBalance();
        }
    }

    function getInvestorCount() public view returns (uint) {

        return investorCount;
    }

    function getBalance() public view returns (uint) {

        return address(this).balance;
    }

    function getLastPayoutDate() public view returns (uint) {

        return lastPayoutDate;
    }

    function getLastDepositDate() public view returns (uint) {

        return lastDepositDate;
    }

    function getInvestorDividends(address addr) public view returns(uint) {
        uint amountPerDay = DAILY_PERCENT.getPercentFrom(investors[addr].balance);
        uint timeLapse = now.sub(investors[addr].lastDepositDate);

        return amountPerDay.mul(timeLapse).div(1 days);
    }

    function getInvestorBalance(address addr) public view returns(uint) {

        return investors[addr].balance;
    }

    function getInvestorInfo(address addr) public onlyOwner view returns(uint, uint, uint, uint) {

        return (
            investors[addr].id,
            investors[addr].balance,
            investors[addr].depositCount,
            investors[addr].lastDepositDate
        );
    }

    function newCycle() private {
        address addr;
        uint8 iteration;
        uint i;

        for (i = addresses.length - 1; i > 0; i--) {
            addr = addresses[i];
            addresses.length -= 1;
            delete investors[addr];
            iteration++;
            if (iteration >= ITERATION_LIMIT) {
                return;
            }
        }

        for (i = ticketsAddresses.length - 1; i > 0; i--) {
            addr = ticketsAddresses[i];
            ticketsAddresses.length -= 1;
            delete tickets[addr];
            iteration++;
            if (iteration >= ITERATION_LIMIT) {
                return;
            }
        }

        emit NextCycle(cycle, now, getBalance());

        cycle++;
        investorCount = 0;
        lastPayoutDate = now;
        lastDepositDate = now;
        isCycleFinish = false;

        resetLotteryBalance();
        resetStellarBalance();
        resetStellarInvestor();
    }

}

/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {

    /**
    * @dev Multiplies two numbers, reverts on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
    * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0); // Solidity only automatically asserts when dividing by 0
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
    * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
    * @dev Adds two numbers, reverts on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
    * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
    * reverts when dividing by zero.
    */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

library Math {

    struct percent {
        uint percent;
        uint base;
    }

    function getPercentFrom(percent storage p, uint value) internal view returns (uint) {
        return value * p.percent / p.base / 100;
    }

}

library Utils {

    struct winner {
        address addr;
        uint balance;
        uint prize;
        uint date;
    }

}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"getStellarInvestor","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getInvestorInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getInvestorDividends","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getStellarBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastStellar","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastPayoutDate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"runLottery","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getInvestorBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLotteryBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"restartCycle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInvestorCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastDepositDate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isCycleFinish","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"startPosition","type":"uint256"}],"name":"payout","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"giveStellarReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getLastWinner","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Invest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"date","type":"uint256"}],"name":"InvestorPayout","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"transactionCount","type":"uint256"},{"indexed":false,"name":"date","type":"uint256"}],"name":"Payout","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"cycle","type":"uint8"},{"indexed":false,"name":"now","type":"uint256"},{"indexed":false,"name":"","type":"uint256"}],"name":"NextCycle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"balance","type":"uint256"}],"name":"NewStellar","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6004805460ff19908116909155600060055560236080819052600a60a0819052601191909155601290815560c0819052600160e08190526013919091556014819055610100819052610120819052601581905560168190556101806040526101408190526101608190526017819055601855601e8054909116905534801561008657600080fd5b5060198054600160a060020a0319163317905560016100a6601a826100ac565b506100f6565b8154818355818111156100d0576000838152602090206100d09181019083016100d5565b505050565b6100f391905b808211156100ef57600081556001016100db565b5090565b90565b61148e806101056000396000f3006080604052600436106100f05763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663035e898a81146101925780630707873c146101ca57806312065fe0146102115780631d66ff8e1461023857806332492f96146102595780633e25fdd41461026e5780634fcb9e2f146102b35780635674a3ed146102c85780635ea63913146102f157806360654e47146103125780638aebebd914610327578063960524e31461033c578063b91fe64b14610351578063c03bd29214610366578063e11523431461037b578063e5b5a52714610393578063f88649a1146103a8575b601e5460ff1615610171576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b34151561018657610181336103bd565b610190565b6101903334610608565b005b34801561019e57600080fd5b506101a7610822565b60408051600160a060020a03909316835260208301919091528051918290030190f35b3480156101d657600080fd5b506101eb600160a060020a0360043516610836565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561021d57600080fd5b5061022661088b565b60408051918252519081900360200190f35b34801561024457600080fd5b50610226600160a060020a0360043516610891565b34801561026557600080fd5b50610226610914565b34801561027a57600080fd5b5061028361091a565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b3480156102bf57600080fd5b50610226610938565b3480156102d457600080fd5b506102dd61093e565b604080519115158252519081900360200190f35b3480156102fd57600080fd5b50610226600160a060020a0360043516610965565b34801561031e57600080fd5b50610226610983565b34801561033357600080fd5b506102dd610989565b34801561034857600080fd5b506102266109c9565b34801561035d57600080fd5b506102266109cf565b34801561037257600080fd5b506102dd6109d5565b34801561038757600080fd5b506101906004356109de565b34801561039f57600080fd5b50610190610c2c565b3480156103b457600080fd5b50610283610c4d565b601e54600090819060ff1615610443576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152601f602052604081208054909350116104b5576040805160e560020a62461bcd02815260206004820152601160248201527f4163636f756e74206e6f7420666f756e64000000000000000000000000000000604482015290519081900360640190fd5b60006104e061a8c06104d4856003015442610c6b90919063ffffffff16565b9063ffffffff610c8916565b1161055b576040805160e560020a62461bcd02815260206004820152602c60248201527f546865206c6174657374207061796d656e7420776173206561726c696572207460448201527f68616e20313220686f7572730000000000000000000000000000000000000000606482015290519081900360840190fd5b61056483610891565b9050303181111561058157601e805460ff19166001179055610603565b604051600160a060020a0384169082156108fc029083906000818181858888f193505050501580156105b7573d6000803e3d6000fd5b5042600383015560408051600160a060020a03851681526020810183905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a15b505050565b600080662386f26fc10000831015610690576040805160e560020a62461bcd02815260206004820152602260248201527f546f6f20736d616c6c20616d6f756e742c206d696e696d756d20302e3031206560448201527f7468000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0384166000908152601f602052604090208054909250151561071957601a8054808455600180820183556000929092527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038716179055601b805490910190555b61072a60138463ffffffff610cac16565b905061074561074060158563ffffffff610cac16565b610cd7565b61075e61075960178563ffffffff610cac16565b610cf0565b6107688484610d09565b600182015461077d908463ffffffff610dd816565b600180840191825560028401805490910190554260038401819055601d55546107a7908590610df1565b6040805133815234602082015281517fd90d253a9de34d2fdd5a75ae49ea17fcb43af32fc8ea08cc6d2341991dd3872e929181900390910190a1601954604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015801561081b573d6000803e3d6000fd5b5050505050565b600b54600c54600160a060020a0390911691565b601954600090819081908190600160a060020a0316331461085657600080fd5b50505050600160a060020a03166000908152601f60205260409020805460018201546002830154600390930154919390929190565b30315b90565b600160a060020a0381166000908152601f6020526040812060010154819081906108c39060119063ffffffff610cac16565b600160a060020a0385166000908152601f60205260409020600301549092506108f390429063ffffffff610c6b16565b905061090c620151806104d4848463ffffffff610e7a16565b949350505050565b600a5490565b600d54600e54600f54601054600160a060020a039093169290919293565b601c5490565b601954600090600160a060020a0316331461095857600080fd5b610960610ea8565b905090565b600160a060020a03166000908152601f602052604090206001015490565b60005490565b601954600090600160a060020a031633146109a357600080fd5b601e5460ff161515600114156109c3576109bb610f66565b50600061088e565b50600190565b601b5490565b601d5490565b601e5460ff1681565b6019546000908190819081908190600160a060020a03163314610a0057600080fd5b601e5460ff1615610a81576040805160e560020a62461bcd02815260206004820152603a60248201527f4379636c6520636f6d706c657465642e20546865206e6577206379636c65207760448201527f696c6c2073746172742077697468696e20323420686f7572732e000000000000606482015290519081900360840190fd5b851515610a8d57600195505b8591505b601b548211158015610aa35750606485105b15610bdd57601a805483908110610ab657fe5b6000918252602080832090910154600160a060020a0316808352601f9091526040909120600301549091504262014370919091011115610af557610bd2565b610afe81610891565b92503031831115610b1b57601e805460ff19166001179055610c24565b604051600160a060020a0382169084156108fc029085906000818181858888f19350505050158015610b51573d6000803e3d6000fd5b5060408051600160a060020a038316815260208101859052428183015290517fd5ede3acb66ee493eeb318369545bd2a34c33a3f54632e4537b62c784cdc726b9181900360600190a1600160a060020a0381166000908152601f6020526040902042600390910155610bc9848463ffffffff610dd816565b60019095019493505b600190910190610a91565b42601c819055604080518681526020810188905280820192909252517fc8be76c1b18e6f688cdb6f785d69442c4f00222e1884d39e40e761aab9e0f2949181900360600190a15b505050505050565b601954600160a060020a03163314610c4357600080fd5b610c4b611171565b565b600654600754600854600954600160a060020a039093169290919293565b60008083831115610c7b57600080fd5b5050808203805b5092915050565b600080808311610c9857600080fd5b8284811515610ca357fe5b04949350505050565b60006064836001015484600001548402811515610cc557fe5b04811515610ccf57fe5b049392505050565b600054610cea908263ffffffff610dd816565b60005550565b600a54610d03908263ffffffff610dd816565b600a5550565b600067016345785d8a0000821061060357610d328267016345785d8a000063ffffffff610c8916565b600154909150610d48908263ffffffff610dd816565b60019081556002805491820190557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516908117909155600090815260036020526040902054610dba9082610dd8565b600160a060020a038416600090815260036020526040902055505050565b600082820183811015610dea57600080fd5b9392505050565b600c54811115610e7657604080518082018252600160a060020a0384168082526020918201849052600b805473ffffffffffffffffffffffffffffffffffffffff191682179055600c849055825190815290810183905281517f56a8ddd37b32448b6fb45362a44ccfb678567ad3611afcf4d747e205be730ecb929181900390910190a15b5050565b600080831515610e8d5760009150610c82565b50828202828482811515610e9d57fe5b0414610dea57600080fd5b6000806000610eb5610983565b1115610f5d57610ec3611205565b9050600160a060020a0381161515610ede5760009150610f62565b80600160a060020a03166108fc610ef3610983565b6040518115909202916000818181858888f19350505050158015610f1b573d6000803e3d6000fd5b50600160a060020a0381166000908152601f6020526040902060010154610f4c908290610f46610983565b426112e0565b610f5461131c565b60019150610f62565b600091505b5090565b601a546000908190600019015b600081111561100a57601a805482908110610f8a57fe5b600091825260209091200154601a8054600160a060020a03909216945060001990910190610fb89082611429565b50600160a060020a0383166000908152601f602052604081208181556001808201839055600282018390556003909101919091559190910190609660ff83161061100157610603565b60001901610f73565b50600254600019015b600081111561109157600280548290811061102a57fe5b60009182526020909120015460028054600160a060020a039092169450600019909101906110589082611429565b50600160a060020a038316600090815260036020526040812055600190910190609660ff83161061108857610603565b60001901611013565b6019547ff8bb353474248000eaa7d0c64042ecf36379a75c97fc63e4561e66443743148b9074010000000000000000000000000000000000000000900460ff16426110da61088b565b6040805160ff9094168452602084019290925282820152519081900360600190a160198054600160ff74010000000000000000000000000000000000000000808404821692909201160274ff0000000000000000000000000000000000000000199091161790556000601b5542601c819055601d55601e805460ff1916905561116161131c565b611169611327565b61060361132e565b600080600061117e610914565b9250600083111561060357611191610822565b6040519193509150600160a060020a0383169084156108fc029085906000818181858888f193505050501580156111cc573d6000803e3d6000fd5b50600160a060020a0382166000908152601f60205260409020600101546111fd9083906111f7610914565b42611352565b610603611327565b60008060008060055460001415156112265761122260015461138e565b6005555b505060045460009060ff165b60025460ff82161080156112495750609660ff8216105b156112c6576002805460ff831690811061125f57fe5b6000918252602080832090910154600160a060020a0316808352600390915260409091205490935061129890839063ffffffff610dd816565b9150816005541115156112be5760006005556004805460ff1916905591925082916112da565b600101611232565b6004805460ff191660ff8316179055600093505b50505090565b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355600791909155600855600955565b600060018190558055565b6000600a55565b600b805473ffffffffffffffffffffffffffffffffffffffff191690556000600c55565b600d805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355600e91909155600f55601055565b600081424460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083106113e85780518252601f1990920191602091820191016113c9565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561141e57fe5b066001019050919050565b8154818355818111156106035760008381526020902061060391810190830161088e91905b80821115610f62576000815560010161144e5600a165627a7a72305820ff067735b6fcfc7910102c9f69d3b94b54f375a6a81ecd3773111efe8d1ed8570029

   Swarm Source:
bzzr://ff067735b6fcfc7910102c9f69d3b94b54f375a6a81ecd3773111efe8d1ed857

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.