Sponsored Link:   BubbleTone - Blockchain in Telecom, directly connecting mobile operators and users globally, launches its unique ICO!
Contract Overview
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 461 txns
Misc  
   
Address Watch Add To Watch List
Contract Creator 0x42abdd654de6aba2d157a1ba39245ea596eb9717at txn 0x121c02a1522dde436dd2f24bcae6b2ae1b5939a1110664db272ab5a0465ba460
Token Balances
  Latest 25 txns from a total Of 461 transactions View All

TxHash Age From To Value [TxFee]
0xfe4ea21b3f14d06fe7409c32408b93ccb17e1ea01573fc45bd97fa72a6dfb8bc15 days 21 hrs ago0x8c8961f2ef091202ccc51095efceb700427473a6  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.00095243
0xe8b366a6cff20bf409c4e12cd71f6ab981adb4efaa7c0a26d55d247ca64be0c825 days 8 hrs ago0x9f802620a6d81b36b052fbdf5df65fdd7a5ceb8f  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.003591 Ether0.000460826
0xd7ad8262bbfe430195ed54cfdc5dbbe8cef6e4ba83e446377548aadc197d6bf025 days 10 hrs ago0x290664efe58142be6a6d7a0a55c7f99a46de8036  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.0002731
0x13ced756df20373a003e51a1743605dc1ceb5aec9cd0a5cd4715908c4a48a0b245 days 1 min ago0x965105aa3acc32a29777093fb96fe33bbbedd587  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.000872152
0x727b2a7807e18d79ca780b6175c407e757d19fc02b1319e8d208dc33e02aa1ea54 days 6 hrs ago0x965105aa3acc32a29777093fb96fe33bbbedd587  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.000872152
0x1241f393c2419078144f3e4ae40eae6a4f64e0bff2e384442878be4a9bafebd396 days 3 hrs ago0x3f65c6506efd17aa7e2add2619a2f5d7eb659e11  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.0009362
0x7b1e4d13f9c2d9adbd49e41e9f749916927e073afeed402d938cf462167e0a2d97 days 2 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.010005876078528 Ether0.000021043
0x078e87b4e0b887aa413f383c8542548582c5db8e7876b41fd6273c6521ba12ec104 days 11 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.062919640309327 Ether0.000021043
0x3c141a8a4049fc6532c65c7f4b39a9dbd4635b8e19f96afcd76284a96e901b39111 days 11 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.076403385276813 Ether0.000021043
0xc4d4422abd0ffcf526b07c1879460262a41d2bb7b205964ddbac65cf71c5b27b118 days 11 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.078537646283551 Ether0.000021043
0x173271b16359968ad9397b490653cd74132ae0c65ebebc52586cc8e1d243f273124 days 16 hrs ago0xdc693a81ffe5b9f7677a54f7790a16adfce5aca4  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.000001 Ether0.000027246
0x4b978677dd896ed587bce40ca6b2ce36cebbd132b74cd6f3c8fd0e90d2817463125 days 11 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.07845758848548 Ether0.000021043
0x97cd49bb9d331017cb6319f429d6fd7a58f8d4b2b3fae6a8c4a28edc0cbec4a1132 days 11 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.100041950936399 Ether0.000021043
0x47d550a809e8493f908548c631ae2268cfd6c994f35682b2e497470e2f38fa0b140 days 17 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.096905882232795 Ether0.000021043
0xcae9a3edf3aa941e4477945ae1f70bb386bb2483ded627d50747a445cea0c100141 days 15 hrs ago0xb8d94b633d768f325e4097189425316dcd0e71f4  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.018 Ether0.000458808
0x63030f767431114ade879e5a61ee61a41d6efa742523c984826c5b0824167427141 days 15 hrs ago0xb8d94b633d768f325e4097189425316dcd0e71f4  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.000458808
0xbda1321f159311f32b5e7f4beeed5f4c882af6eff99ba44adec8518eea52df76149 days 5 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.100051913272887 Ether0.000021043
0xce58fb0cd6759f8509e81d59205354d1800fc5492e062a2b2c2cce291db17ca8152 days 7 hrs ago0x2d1583307aae33d5f9047424348c5353d50a6809  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.000588399
0xd2a1ef49c2f588803e4010b085dccd0d386733b870f797f483f56bdd27d7a01f155 days 16 hrs ago0x7f0f94823d1b0fc4d251a72e9375f2afda2faba3  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0 Ether0.000462
0xa893e846205fccb6ee46f1e7c93a9bc0df16cded3d741fcf90d78edcd5e23727157 days 10 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.100019487166247 Ether0.000021043
0x2fb6f82b5458b1ba9370a90f04135295f563cb864f17933196031e8588b311a2165 days 6 hrs ago0x734edb5b797ca700b53392bb650e85e6f0089f18  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.01 Ether0.000163476
0x0d27b44198ad9c887793d39ddd01c285da3788ab7f9e056cf495de52f3a070bc165 days 18 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.099070449536066 Ether0.000084172
0x65a4d896e7215047842f8fd82c7e7eb92d07266bb64c12a66b7d536b302969f3174 days 9 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.099024408962562 Ether0.000084172
0x1be52e3cb1c990b1004c3678d3114a6ab16200bbd506ba4e73074fe7307c03d8182 days 20 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.099087216347732 Ether0.000168344
0x1b6b27583fef1915aeb8bcf73c3ee4a3d2a5c1d64047eb08857708d7ad2dcca1201 days 19 hrs agoEthermine  IN   0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.099049518880072 Ether0.00105
[ 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
0x775d51ee443671d34751c9341ce17f48cbccea459d3893f5558b48852c0ce8e44308804208 days 16 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
0xacf378733709b31b028a96f99f83be50022adbb660d5ae77df338ce2ff1c55264305319209 days 21 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0x2cafe04e068d24cf0b919a6909cf38ceba4f3f0e0e6d10eed5b64da5259fb9ad4305294209 days 21 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d2.5 Ether
0x629b73a87c7a285b6e629870bb9c97d58a4181967363cc17dbf23c6cf08f33934304258210 days 6 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de2.5 Ether
0xb191c321defdfa8e2273fb76c3a436cde659efdd6fae81d5cb984e7ecc550a254304253210 days 6 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
0xf85256acdb9f6f3b858b091745473afb3f8a5fd588d3da4d2b7464cca5f6a2c34303161210 days 15 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0x7d780180652672521ed3f968545ed10bb244d50f3d6e00f2270c5f1adc4b6f954303131210 days 15 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d20.045 Ether
0x119ecf86e9084152503c13146453ab08952276ae9acaa6c00ebb4954ba1ee5c84299945211 days 16 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de20 Ether
0x32153e3f76a8fbce3efea0915208913b49b2427eaaa3b71ad58b0559c53c41664299930211 days 16 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.859 Ether
0x659f401413b5d45e53a1acdb5c84e70c036204824a55038393aa5b3abc9e18834296705212 days 13 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0x1238dd7ce5d01d107e5dcac2dc0a24c876ce43359fb7102db7416ffc62c90eaf4296580212 days 14 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
0xea2a4ce1c570660dc865f3489b6eb50ddd89dad5e81238fb6eb60d5b5dce281f4292456213 days 18 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0xcaecf219b05320a929199e2c0d72106af0bbe1ae60c4f2808aec2619e2ec8c524292406213 days 18 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d5.009 Ether
0x2dbe2e72057a05a5387a933a76a008e69b2f71bd38a5f09023b30a741821c2894289739214 days 12 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de5 Ether
0x806f3f6b60eb2963428595f49b6725bed2dc212f5a400cfaf74f42e667373ede4289687214 days 12 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
0xe4f58a3dd0865c6de4e5e8c5682c09ba7c368ee0607883786ed9a2e637c7bd914287549215 days 2 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0x2caf928f67c343337647065f8f1c2c02dac4f6e9b8455b354ca2aababe026da74287528215 days 3 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d2.5 Ether
0x9e8320efa86e5e7eb8aa93b870e7220763e2537ea57292880219cdf11d93241e4285691215 days 15 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de2.5 Ether
0xfa1142a06abb6774daef17f2e88b0c73fa45df3575448a7ea7ab584d74bd3bea4285675215 days 15 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
0xbf43d5f7f81f8d201fec43ead984fa23fa10f1f6e51ddb421af6f3669b3135a14284606215 days 22 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0xdedec9dda01dbc39e69d197976358242135db572a992aa1bc94eb3c122556ca64284591215 days 22 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d20.099 Ether
0x5e7a39275d843cf8b3dac680e5fdd984103f4ba3f8ba7b77df32da86830332a54281306216 days 20 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de20 Ether
0x0ca8f7010c1be4812fcaa009af73cfae553c007905bc72051e26c9711cf6cdfb4278786217 days 13 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.922 Ether
0xd6f8b2af16dca85825cbe71f3741fe27456911d972ff39061ec057f73e8bd13c4273964218 days 21 hrs ago0x8302d67bdc44dc0457e0c80312142dd353c9948d0xc0adf1ccc703a0a3393892600883a1a91a4e38de0.85 Ether
0x6595d52c71c19366725535490d88369f14dad02c00481fd2fea9e5121533b94c4273859218 days 21 hrs ago0xc0adf1ccc703a0a3393892600883a1a91a4e38de0x8302d67bdc44dc0457e0c80312142dd353c9948d0.85 Ether
[ Download CSV Export  ] 
Warning: The compiled contract might be susceptible to ZeroFunctionSelector (very low-severity), DelegateCallReturnValue (low-severity) Solidity compiler bugs.

Contract Source Code Verified (Exact match)
Contract Name: EthereumLottery
Compiler Version: v0.4.14+commit.c2215d46
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.13;

contract BTCRelay {
    function getLastBlockHeight() returns (int);
    function getBlockchainHead() returns (int);
    function getFeeAmount(int blockHash) returns (int);
    function getBlockHeader(int blockHash) returns (bytes32[3]);
}

contract PoissonData {
    function lookup(int blocks) constant returns (uint);
}

contract Escrow {
    function deposit(address recipient) payable;
}

contract EthereumLottery {
    uint constant INACTIVITY_TIMEOUT = 2 weeks;
    uint constant GAS_LIMIT = 300000;

    struct Lottery {
        uint jackpot;
        int decidingBlock;
        uint numTickets;
        uint numTicketsSold;
        uint ticketPrice;
        uint cutoffTimestamp;
        int winningTicket;
        address winner;
        uint finalizationBlock;
        address finalizer;
        string message;
        mapping (uint => address) tickets;
        int nearestKnownBlock;
        int nearestKnownBlockHash;
    }

    address public owner;
    address public admin;
    address public proposedOwner;

    int public id = -1;
    uint public lastInitTimestamp;
    uint public lastSaleTimestamp;

    uint public recentActivityIdx;
    uint[1000] public recentActivity;

    mapping (int => Lottery) public lotteries;

    address public btcRelay;
    address public poissonData;
    address public escrow;

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

    modifier onlyAdminOrOwner {
        require(msg.sender == owner || msg.sender == admin);
        _;
    }

    modifier afterInitialization {
        require(id >= 0);
        _;
    }

    function EthereumLottery(address _btcRelay,
                             address _poissonData,
                             address _escrow) {
        owner = msg.sender;
        admin = msg.sender;
        btcRelay = _btcRelay;
        poissonData = _poissonData;
        escrow = _escrow;
    }

    function needsInitialization() constant returns (bool) {
        return id == -1 || lotteries[id].finalizationBlock > 0;
    }

    function initLottery(uint _jackpot, uint _numTickets,
                         uint _ticketPrice, int _durationInBlocks)
             payable onlyAdminOrOwner {
        require(needsInitialization());
        require(msg.value > 0);
        require(msg.value == _jackpot);
        require(_numTickets * _ticketPrice > _jackpot);

        // Look up precomputed timespan in seconds where the
        // probability for n or more blocks occuring within
        // that timespan is just 1 %. This is based on
        // assuming an actual block time of 9 minutes. We
        // can use this data to figure out for how long it
        // is safe to keep selling tickets.
        uint ticketSaleDuration =
            PoissonData(poissonData).lookup(_durationInBlocks - 1);
        require(ticketSaleDuration > 0);

        id += 1;
        lotteries[id].jackpot = _jackpot;
        lotteries[id].decidingBlock =
            BTCRelay(btcRelay).getLastBlockHeight() + _durationInBlocks;
        lotteries[id].numTickets = _numTickets;
        lotteries[id].ticketPrice = _ticketPrice;
        lotteries[id].cutoffTimestamp = now + ticketSaleDuration;
        lotteries[id].winningTicket = -1;

        lastInitTimestamp = now;
    }

    function buyTickets(uint[] _tickets)
             payable afterInitialization {
        int blockHeight = BTCRelay(btcRelay).getLastBlockHeight();
        require(blockHeight + 1 < lotteries[id].decidingBlock);
        require(now < lotteries[id].cutoffTimestamp);

        require(_tickets.length > 0);
        require(msg.value == _tickets.length * lotteries[id].ticketPrice);

        for (uint i = 0; i < _tickets.length; i++) {
            uint ticket = _tickets[i];
            require(ticket >= 0);
            require(ticket < lotteries[id].numTickets);
            require(lotteries[id].tickets[ticket] == 0);

            lotteries[id].tickets[ticket] = msg.sender;
            recentActivity[recentActivityIdx] = ticket;

            recentActivityIdx += 1;
            if (recentActivityIdx >= recentActivity.length) {
                recentActivityIdx = 0;
            }
        }
        lotteries[id].numTicketsSold += _tickets.length;
        lastSaleTimestamp = now;

        // Maybe shorten ticket sale timespan if we are running ahead.
        int remainingDurationInBlocks =
            lotteries[id].decidingBlock - blockHeight;
        uint ticketSaleDuration =
            PoissonData(poissonData).lookup(remainingDurationInBlocks - 1);
        if (now + ticketSaleDuration < lotteries[id].cutoffTimestamp) {
            lotteries[id].cutoffTimestamp = now + ticketSaleDuration;
        }
    }

    function needsFinalization()
             afterInitialization constant returns (bool) {
        int blockHeight = BTCRelay(btcRelay).getLastBlockHeight();
        return blockHeight >= lotteries[id].decidingBlock + 6 &&
               lotteries[id].finalizationBlock == 0;
    }

    function finalizeLottery(uint _steps)
             afterInitialization {
        require(needsFinalization());

        if (lotteries[id].nearestKnownBlock != lotteries[id].decidingBlock) {
            walkTowardsBlock(_steps);
        } else {
            int winningTicket = lotteries[id].nearestKnownBlockHash %
                                int(lotteries[id].numTickets);
            address winner = lotteries[id].tickets[uint(winningTicket)];

            lotteries[id].winningTicket = winningTicket;
            lotteries[id].winner = winner;
            lotteries[id].finalizationBlock = block.number;
            lotteries[id].finalizer = tx.origin;

            if (winner != 0) {
                uint value = lotteries[id].jackpot;
                bool successful = winner.call.gas(GAS_LIMIT).value(value)();
                if (!successful) {
                    Escrow(escrow).deposit.value(value)(winner);
                }
            }

            var _ = admin.call.gas(GAS_LIMIT).value(this.balance)();
        }
    }

    function walkTowardsBlock(uint _steps) internal {
        int blockHeight;
        int blockHash;
        if (lotteries[id].nearestKnownBlock == 0) {
            blockHeight = BTCRelay(btcRelay).getLastBlockHeight();
            blockHash = BTCRelay(btcRelay).getBlockchainHead();
        } else {
            blockHeight = lotteries[id].nearestKnownBlock;
            blockHash = lotteries[id].nearestKnownBlockHash;
        }

        // Walk only a few steps to keep an upper limit on gas costs.
        for (uint step = 0; step < _steps; step++) {
            // We expect free access to BTCRelay.
            int fee = BTCRelay(btcRelay).getFeeAmount(blockHash);
            require(fee == 0);

            bytes32 blockHeader =
                BTCRelay(btcRelay).getBlockHeader(blockHash)[2];
            bytes32 temp;

            assembly {
                let x := mload(0x40)
                mstore(x, blockHeader)
                temp := mload(add(x, 0x04))
            }

            blockHeight -= 1;
            blockHash = 0;
            for (uint i = 0; i < 32; i++) {
                blockHash = blockHash | int(temp[uint(i)]) * int(256 ** i);
            }

            if (blockHeight == lotteries[id].decidingBlock) { break; }
        }

        // Store the progress to pick up from there next time.
        lotteries[id].nearestKnownBlock = blockHeight;
        lotteries[id].nearestKnownBlockHash = blockHash;
    }

    function getMessageLength(string _message) constant returns (uint) {
        return bytes(_message).length;
    }

    function setMessage(int _id, string _message)
             afterInitialization {
        require(lotteries[_id].winner != 0);
        require(lotteries[_id].winner == msg.sender);
        require(getMessageLength(_message) <= 500);
        lotteries[_id].message = _message;
    }

    function getLotteryDetailsA(int _id)
             constant returns (int _actualId, uint _jackpot,
                               int _decidingBlock,
                               uint _numTickets, uint _numTicketsSold,
                               uint _lastSaleTimestamp, uint _ticketPrice,
                               uint _cutoffTimestamp) {
        if (_id == -1) {
            _actualId = id;
        } else {
            _actualId = _id;
        }
        _jackpot = lotteries[_actualId].jackpot;
        _decidingBlock = lotteries[_actualId].decidingBlock;
        _numTickets = lotteries[_actualId].numTickets;
        _numTicketsSold = lotteries[_actualId].numTicketsSold;
        _lastSaleTimestamp = lastSaleTimestamp;
        _ticketPrice = lotteries[_actualId].ticketPrice;
        _cutoffTimestamp = lotteries[_actualId].cutoffTimestamp;
    }

    function getLotteryDetailsB(int _id)
             constant returns (int _actualId,
                               int _winningTicket, address _winner,
                               uint _finalizationBlock, address _finalizer,
                               string _message,
                               int _prevLottery, int _nextLottery,
                               int _blockHeight) {
        if (_id == -1) {
            _actualId = id;
        } else {
            _actualId = _id;
        }
        _winningTicket = lotteries[_actualId].winningTicket;
        _winner = lotteries[_actualId].winner;
        _finalizationBlock = lotteries[_actualId].finalizationBlock;
        _finalizer = lotteries[_actualId].finalizer;
        _message = lotteries[_actualId].message;

        if (_actualId == 0) {
            _prevLottery = -1;
        } else {
            _prevLottery = _actualId - 1;
        }
        if (_actualId == id) {
            _nextLottery = -1;
        } else {
            _nextLottery = _actualId + 1;
        }

        _blockHeight = BTCRelay(btcRelay).getLastBlockHeight();
    }

    function getTicketDetails(int _id, uint _offset, uint _n, address _addr)
             constant returns (uint8[] details) {
        require(_offset + _n <= lotteries[_id].numTickets);

        details = new uint8[](_n);
        for (uint i = 0; i < _n; i++) {
            address addr = lotteries[_id].tickets[_offset + i];
            if (addr == _addr && _addr != 0) {
                details[i] = 2;
            } else if (addr != 0) {
                details[i] = 1;
            } else {
                details[i] = 0;
            }
        }
    }


    function getTicketOwner(int _id, uint _ticket) constant returns (address) {
        require(_id >= 0);
        return lotteries[_id].tickets[_ticket];
    }

    function getRecentActivity()
             constant returns (int _id, uint _idx, uint[1000] _recentActivity) {
        _id = id;
        _idx = recentActivityIdx;
        for (uint i = 0; i < recentActivity.length; i++) {
            _recentActivity[i] = recentActivity[i];
        }
    }

    function setAdmin(address _admin) onlyOwner {
        admin = _admin;
    }

    function proposeOwner(address _owner) onlyOwner {
        proposedOwner = _owner;
    }

    function acceptOwnership() {
        require(proposedOwner != 0);
        require(msg.sender == proposedOwner);
        owner = proposedOwner;
    }

    function destruct() onlyOwner {
        require(now - lastInitTimestamp > INACTIVITY_TIMEOUT);
        selfdestruct(owner);
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"lastInitTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"poissonData","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"int256"}],"name":"lotteries","outputs":[{"name":"jackpot","type":"uint256"},{"name":"decidingBlock","type":"int256"},{"name":"numTickets","type":"uint256"},{"name":"numTicketsSold","type":"uint256"},{"name":"ticketPrice","type":"uint256"},{"name":"cutoffTimestamp","type":"uint256"},{"name":"winningTicket","type":"int256"},{"name":"winner","type":"address"},{"name":"finalizationBlock","type":"uint256"},{"name":"finalizer","type":"address"},{"name":"message","type":"string"},{"name":"nearestKnownBlock","type":"int256"},{"name":"nearestKnownBlockHash","type":"int256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"recentActivity","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"destruct","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"int256"},{"name":"_offset","type":"uint256"},{"name":"_n","type":"uint256"},{"name":"_addr","type":"address"}],"name":"getTicketDetails","outputs":[{"name":"details","type":"uint8[]"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_message","type":"string"}],"name":"getMessageLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"int256"}],"name":"getLotteryDetailsB","outputs":[{"name":"_actualId","type":"int256"},{"name":"_winningTicket","type":"int256"},{"name":"_winner","type":"address"},{"name":"_finalizationBlock","type":"uint256"},{"name":"_finalizer","type":"address"},{"name":"_message","type":"string"},{"name":"_prevLottery","type":"int256"},{"name":"_nextLottery","type":"int256"},{"name":"_blockHeight","type":"int256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getRecentActivity","outputs":[{"name":"_id","type":"int256"},{"name":"_idx","type":"uint256"},{"name":"_recentActivity","type":"uint256[1000]"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"recentActivityIdx","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"id","outputs":[{"name":"","type":"int256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_jackpot","type":"uint256"},{"name":"_numTickets","type":"uint256"},{"name":"_ticketPrice","type":"uint256"},{"name":"_durationInBlocks","type":"int256"}],"name":"initLottery","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"int256"},{"name":"_message","type":"string"}],"name":"setMessage","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"proposeOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"needsInitialization","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"needsFinalization","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_tickets","type":"uint256[]"}],"name":"buyTickets","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"btcRelay","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"int256"}],"name":"getLotteryDetailsA","outputs":[{"name":"_actualId","type":"int256"},{"name":"_jackpot","type":"uint256"},{"name":"_decidingBlock","type":"int256"},{"name":"_numTickets","type":"uint256"},{"name":"_numTicketsSold","type":"uint256"},{"name":"_lastSaleTimestamp","type":"uint256"},{"name":"_ticketPrice","type":"uint256"},{"name":"_cutoffTimestamp","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"escrow","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"int256"},{"name":"_ticket","type":"uint256"}],"name":"getTicketOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_steps","type":"uint256"}],"name":"finalizeLottery","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"lastSaleTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_btcRelay","type":"address"},{"name":"_poissonData","type":"address"},{"name":"_escrow","type":"address"}],"payable":false,"type":"constructor"}]

  Contract Creation Code Switch To Opcodes View
6060604052600019600355341561001557600080fd5b604051606080611bd18339810160405280805191906020018051919060200180519150505b60008054600160a060020a031990811633600160a060020a0390811691821790935560018054831690911790556103f0805482168684161790556103f1805482168584161790556103f280549091169183169190911790555b5050505b611b2b806100a66000396000f3006060604052361561014e5763ffffffff60e060020a60003504166302baaf40811461015357806312d1b19a14610178578063179b51b1146101a75780631b7cf899146102b55780632b68b9c6146102dd5780634d4aa77f146102f25780635f8af0541461036e578063704b6c02146103d157806379ba5097146103f25780637bf0e0541461040757806388d0b42d146104f25780638da5cb5b1461054e578063a509b0301461057d578063af640d0f146105a2578063b105126f146105c7578063b3a1362a146105dd578063b5ed298a14610635578063b625353914610656578063bca7e96b1461067d578063d0fbe7fe146106a4578063d153b60c146106ea578063debbc6eb14610719578063e23caa0614610748578063e2fdcc17146107a5578063e67eed44146107d4578063ea7f7a5914610809578063f5c217da14610821578063f851a44014610846575b600080fd5b341561015e57600080fd5b610166610875565b60405190815260200160405180910390f35b341561018357600080fd5b61018b61087b565b604051600160a060020a03909116815260200160405180910390f35b34156101b257600080fd5b6101bd60043561088b565b6040518d8152602081018d9052604081018c9052606081018b9052608081018a905260a0810189905260c08101889052600160a060020a0387811660e0830152610100808301889052908616610120830152610160820184905261018082018390526101a061014083018181528654600260018216159094026000190116929092049083018190526101c08301908690801561029a5780601f1061026f5761010080835404028352916020019161029a565b820191906000526020600020905b81548152906001019060200180831161027d57829003601f168201915b50509e50505050505050505050505050505060405180910390f35b34156102c057600080fd5b6101666004356108fc565b60405190815260200160405180910390f35b34156102e857600080fd5b6102f0610915565b005b34156102fd57600080fd5b61031a600435602435604435600160a060020a0360643516610956565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561035a5780820151818401525b602001610341565b505050509050019250505060405180910390f35b341561037957600080fd5b61016660046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610a8995505050505050565b60405190815260200160405180910390f35b34156103dc57600080fd5b6102f0600160a060020a0360043516610a95565b005b34156103fd57600080fd5b6102f0610add565b005b341561041257600080fd5b61041d600435610b41565b604051808a815260200189815260200188600160a060020a0316600160a060020a0316815260200187815260200186600160a060020a0316600160a060020a0316815260200180602001858152602001848152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156104af5780820151818401525b602001610496565b50505050905090810190601f1680156104dc5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34156104fd57600080fd5b610505610cf8565b604051838152602081018390526040810182617d0080838360005b838110156105395780820151818401525b602001610520565b50505050905001935050505060405180910390f35b341561055957600080fd5b61018b610d51565b604051600160a060020a03909116815260200160405180910390f35b341561058857600080fd5b610166610d60565b60405190815260200160405180910390f35b34156105ad57600080fd5b610166610d66565b60405190815260200160405180910390f35b6102f0600435602435604435606435610d6c565b005b34156105e857600080fd5b6102f0600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610f4f95505050505050565b005b341561064057600080fd5b6102f0600160a060020a0360043516610ff3565b005b341561066157600080fd5b61066961103b565b604051901515815260200160405180910390f35b341561068857600080fd5b610669611068565b604051901515815260200160405180910390f35b6102f0600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061112695505050505050565b005b34156106f557600080fd5b61018b611418565b604051600160a060020a03909116815260200160405180910390f35b341561072457600080fd5b61018b611427565b604051600160a060020a03909116815260200160405180910390f35b341561075357600080fd5b61075e600435611437565b604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390f35b34156107b057600080fd5b61018b6114a4565b604051600160a060020a03909116815260200160405180910390f35b34156107df57600080fd5b61018b6004356024356114b4565b604051600160a060020a03909116815260200160405180910390f35b341561081457600080fd5b6102f06004356114f2565b005b341561082c57600080fd5b6101666116f1565b60405190815260200160405180910390f35b341561085157600080fd5b61018b6116f7565b604051600160a060020a03909116815260200160405180910390f35b60045481565b6103f154600160a060020a031681565b6103ef60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600c8b0154600d8c01549a9b999a98999798969795969495600160a060020a0394851695939490921692600a909201918d565b6007816103e8811061090a57fe5b0160005b5054905081565b60005433600160a060020a0390811691161461093057600080fd5b62127500600454420311151561094557600080fd5b600054600160a060020a0316ff5b5b565b61095e611a12565b60008581526103ef60205260408120600201548190868601111561098157600080fd5b8460405180591061098f5750595b908082528060200260200182016040525b509250600091505b84821015610a7e575060008681526103ef602090815260408083208885018452600b01909152902054600160a060020a03908116908416811480156109f55750600160a060020a03841615155b15610a1e576002838381518110610a0857fe5b60ff909216602092830290910190910152610a71565b600160a060020a03811615610a51576001838381518110610a0857fe5b60ff909216602092830290910190910152610a71565b6000838381518110610a5f57fe5b60ff9092166020928302909101909101525b5b5b6001909101906109a8565b5b5050949350505050565b6000815190505b919050565b60005433600160a060020a03908116911614610ab057600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600254600160a060020a03161515610af457600080fd5b60025433600160a060020a03908116911614610b0f57600080fd5b6002546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b6000806000806000610b51611a12565b6000806000896000191415610b6a576003549850610b6e565b8998505b60008981526103ef60209081526040918290206006810154600782015460088301546009840154600a9094018054939e50600160a060020a039283169d50909b509216985090926002600019600184161561010002019092169190910491601f830181900481020190519081016040528092919081815260200182805460018160011615610100020316600290048015610c495780601f10610c1e57610100808354040283529160200191610c49565b820191906000526020600020905b815481529060010190602001808311610c2c57829003601f168201915b505050505093508860001415610c63576000199250610c6a565b6001890392505b600354891415610c7e576000199150610c85565b8860010191505b6103f054600160a060020a031663023948726000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610cce57600080fd5b6102c65a03f11515610cdf57600080fd5b50505060405180519150505b9193959799909294969850565b600080610d03611a36565b600354600654909350915060005b6103e8811015610d4a576007816103e88110610d2957fe5b0160005b505482826103e88110610d3c57fe5b60200201525b600101610d11565b5b50909192565b600054600160a060020a031681565b60065481565b60035481565b6000805433600160a060020a0390811691161480610d98575060015433600160a060020a039081169116145b1515610da357600080fd5b610dab61103b565b1515610db657600080fd5b60003411610dc357600080fd5b348514610dcf57600080fd5b838302859011610dde57600080fd5b6103f154600160a060020a0316635a4fc9c5600019840160006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610e3457600080fd5b6102c65a03f11515610e4557600080fd5b505050604051805191505060008111610e5d57600080fd5b600380546001019081905560009081526103ef60205260408082208790556103f0548492600160a060020a03909116916302394872919051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610ec757600080fd5b6102c65a03f11515610ed857600080fd5b50505060405180516003805460009081526103ef6020526040808220939095016001909301929092558054825283822060020188905580548252838220600490810188905581548352848320428781016005909201919091559154835293909120600019600690910155909155505b5b5050505050565b6003546000901215610f6057600080fd5b60008281526103ef6020526040902060070154600160a060020a03161515610f8757600080fd5b60008281526103ef602052604090206007015433600160a060020a03908116911614610fb257600080fd5b6101f4610fbe82610a89565b1115610fc957600080fd5b60008281526103ef60205260409020600a01818051610fec929160200190611a5f565b505b5b5050565b60005433600160a060020a0390811691161461100e57600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60006003546000191480611062575060035460009081526103ef6020526040812060080154115b90505b90565b60008060006003541215151561107d57600080fd5b6103f054600160a060020a031663023948726000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156110c657600080fd5b6102c65a03f115156110d757600080fd5b505050604051805160035460009081526103ef602052604090206001015490925060060182128015915061111e575060035460009081526103ef6020526040902060080154155b91505b5b5090565b6000806000806000806003541215151561113f57600080fd5b6103f054600160a060020a031663023948726000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561118857600080fd5b6102c65a03f1151561119957600080fd5b505050604051805160035460009081526103ef6020526040902060019081015491975087011290506111ca57600080fd5b60035460009081526103ef602052604090206005015442106111eb57600080fd5b60008651116111f957600080fd5b60035460009081526103ef6020526040902060040154865102341461121d57600080fd5b600093505b855184101561132b5785848151811061123757fe5b906020019060200201519250600083101561125157600080fd5b60035460009081526103ef6020526040902060020154831061127257600080fd5b60035460009081526103ef60209081526040808320868452600b01909152902054600160a060020a0316156112a657600080fd5b60035460009081526103ef60209081526040808320868452600b019091529020805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031617905560065483906007906103e881106112ff57fe5b0160005b505560068054600101908190556103e8901061131f5760006006555b5b600190930192611222565b85516003805460009081526103ef6020526040808220830180549094019093554260055590548152818120600101546103f154908890039450600160a060020a031691635a4fc9c591600019860191516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156113b557600080fd5b6102c65a03f115156113c657600080fd5b505050604051805160035460009081526103ef60205260409020600501549092504283011015905061140e5760035460009081526103ef602052604090204282016005909101555b5b5b505050505050565b600254600160a060020a031681565b6103f054600160a060020a031681565b60008060008060008060008088600019141561145757600354975061145b565b8897505b50505060008581526103ef60205260409020805460018201546002830154600384015460058054600487015491909601549499509297509095509350905b919395975091939597565b6103f254600160a060020a031681565b6000808312156114c357600080fd5b5060008281526103ef60209081526040808320848452600b01909152902054600160a060020a03165b92915050565b6000806000806000806003541215151561150b57600080fd5b611513611068565b151561151e57600080fd5b60035460009081526103ef602052604090206001810154600c909101541461154e5761154986611706565b61140e565b60035460009081526103ef602052604090206002810154600d9091015481151561157457fe5b6003805460009081526103ef6020818152604080842096909507808452600b8701825285842054929091526006909501859055825482528382206007018054600160a060020a0392831673ffffffffffffffffffffffffffffffffffffffff19918216811790925584548452858420436008909101559354835293909120600901805490921632909116179055909550935083156116b85760035460009081526103ef602052604090819020549350600160a060020a03851690620493e090859051600060405180830381858888f1935050505091508115156116b8576103f254600160a060020a031663f340fa01848660405160e060020a63ffffffff8516028152600160a060020a0390911660048201526024016000604051808303818588803b15156116a257600080fd5b6125ee5a03f115156116b357600080fd5b505050505b5b600154600160a060020a0390811690620493e090301631604051600060405180830381858888f19450505050505b5b5b505050505050565b60055481565b600154600160a060020a031681565b60008060008060008060006103ef60006003548152602001908152602001600020600c015460001415611805576103f054600160a060020a031663023948726000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561177c57600080fd5b6102c65a03f1151561178d57600080fd5b50505060405180516103f054909850600160a060020a031690506309dd0e816000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156117e357600080fd5b6102c65a03f115156117f457600080fd5b505050604051805190509550611828565b60035460009081526103ef60205260409020600c810154600d9091015490975095505b600094505b878510156119e2576103f054600160a060020a0316630aece23c8760006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561188757600080fd5b6102c65a03f1151561189857600080fd5b505050604051805194505083156118ae57600080fd5b6103f054600160a060020a0316631f7944368760006040516060015260405160e060020a63ffffffff84160281526004810191909152602401606060405180830381600087803b151561190057600080fd5b6102c65a03f1151561191157600080fd5b5050506040516060810160405260025b60200201519250604051838152600481015192505060018703965060009550600090505b60208110156119b45761010081900a82826020811061196057fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f0100000000000000000000000000000000000000000000000000000000000000900402861795505b600101611945565b60035460009081526103ef60205260409020600101548714156119d6576119e2565b5b60019094019361182d565b6003805460009081526103ef6020526040808220600c018a90559154815220600d018690555b5050505050505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b617d006040519081016040526103e8815b6000815260200190600190039081611a475790505090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611aa057805160ff1916838001178555611acd565b82800160010185558215611acd579182015b82811115611acd578251825591602001919060010190611ab2565b5b50611121929150611ade565b5090565b61106591905b808211156111215760008155600101611ae4565b5090565b905600a165627a7a72305820c9080d3aa280bbe7c6468341f0e034801223f91400f46316baa2280ff5fd6aee002900000000000000000000000041f274c0023f83391de4e0733c609df5a124c3d4000000000000000000000000af34a44ebf712ab571730bd0768dcb93572e246e000000000000000000000000e28942df3b9502193a3547e6f6bad16ce63b1e2d

    Constructor Arguments (ABI-encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000041f274c0023f83391de4e0733c609df5a124c3d4000000000000000000000000af34a44ebf712ab571730bd0768dcb93572e246e000000000000000000000000e28942df3b9502193a3547e6f6bad16ce63b1e2d

-----Decoded View---------------
Found 3 constructor arguments :
Arg [0] : 00000000000000000000000041f274c0023f83391de4e0733c609df5a124c3d4
Arg [1] : 000000000000000000000000af34a44ebf712ab571730bd0768dcb93572e246e
Arg [2] : 000000000000000000000000e28942df3b9502193a3547e6f6bad16ce63b1e2d


   Swarm Source:
bzzr://c9080d3aa280bbe7c6468341f0e034801223f91400f46316baa2280ff5fd6aee

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.