Sponsored:   [Largest VC Funded] TEMCO, millions sold out in seconds. Join TEMCO's last presale at CoinBene!
Contract Overview
Balance: 1.04816697981419889 Ether
Ether Value: $92.31 (@ $88.07/ETH)
Transactions: 65 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0x5df8259a6ee3cc03e6229c8c9ede019967edd477at txn 0x829f2c8067653186bbe0933b2074837faf941cb2710d7be5fb821834f26bff25
 Latest 25 transactions from a total of 65 transactions

TxHash Age From To Value [TxFee]
0x5a814bfea7bde42c7b072930e0d32a088558b43523ad0f70f2c2de2d3befecdc16 days 18 hrs ago0xb6c563bc4efb306d9d1df68b4ac1744b74a670f1  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00053228
0x0bd2211151be352c6977efc08fb9f063a90b370c65537592513a51cc79dd9e8216 days 22 hrs ago0x5ab00bf937d4a83b9841ca462689773aba62e5d1  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.0002714628
0xaebf68ed61f189b659847dfac310ab76016196ee06b28bf944600196ba8dd0c816 days 22 hrs ago0xc882a723ff3926ef2150366117425c4742fee66e  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00051524704
0xa5ecc5fa8f3f5f80ff2aecf29199c655af479fa56369ea7d39a6f80e9bb230d016 days 22 hrs ago0x906b53a538602fe3fb6f66eab42eb8fd734fbc17  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00053228
0x151506f3fedd64e834489cdb1758644a5798e1dc8a7c9fed5a2bfc18f69699ca17 days 12 hrs ago0x4f8d1e671423bf9e216350c797eb3ccd8a96edf3  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000425824
0x0b53b8b5676d3077a319184cec44e06956c3061608662b033c9ddad6278185b617 days 17 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00053228
0xd40601ad76ba860f9a9ec26347fca1bd8d24d2909f1cdf456b43e4cf08cbd1f617 days 17 hrs ago0x00004242ca3469e30ae4a62775fee6584ed3fdca  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0 Ether0.00051482
0xb47a771c6c9f375bdf62749a24326a009818a6258e96a2c9b92d37521931095717 days 17 hrs ago0xa09258d96eea38c031bfaa14c69cd56e6e1a938d  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.001965978
0xe7786608fd59f920a7e6d8870a871f7e78702af1e7a33b569e91530c4952d00620 days 15 hrs ago0xc882a723ff3926ef2150366117425c4742fee66e  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000319368
0xb163d28a261560c36cf217a6d8aa8fe447f4540076893a77f9e028c4ca15bb9a21 days 14 hrs ago0xa09258d96eea38c031bfaa14c69cd56e6e1a938d  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000319368
0xfdf08176bb1a05b459d61731583965422118daf4b3be79a9075d8dbda2c4593121 days 15 hrs ago0x5ab00bf937d4a83b9841ca462689773aba62e5d1  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00035205
0x17bd784b7d47e810ce2fd8166b4da8972f8eff4dad2e2fe5eab6f5947082cb8885 days 8 hrs ago0x00004242ca3469e30ae4a62775fee6584ed3fdca  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0 Ether0.0005161
0x5d5c32413d8715aedb26a2a591e51cc1392ee727b0db81442c6986f8f54e9e2785 days 8 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.001549236
0xc047224b25eed40b06d9765a4083fb50f0f3734d189387f5e5dc02d370102d2886 days 12 hrs ago0xbf84421732b49331dc1a03dc20128a083789b9ee  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000306210156
0x921d8ae26564013896acaf9905a87ac68d2fdd3d79cd2bfacde814507b93cf8487 days 13 hrs ago0x00004242f4449d49ec9c64ad6f9385a56b2a6297  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0 Ether0.0005161
0xbb6da38659ea524cd817e42c6430a5d5692b27e9c498d3dba33b726efe79640887 days 13 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.002145096
0xfabc75e0c9f84dae4e731eb9f074be6f503464612e5c16e6c5397e19795ece16104 days 18 hrs ago0xbf84421732b49331dc1a03dc20128a083789b9ee  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000159684
0x0a609813611a755106387981064f995ba0697f75539a5a1883ff3b70036bc86a104 days 18 hrs ago0x000042425e06b0b1e8e20a811c91d6864608324b  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0 Ether0.00051482
0x8d60f5b7debbee738ddafbdf551c7f8c3e53393607991ab35eee39c766fc353d104 days 19 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000655326
0x726a22882e3c16953bcc623b4c06a4c7fee22d2c9436340f5c343157f3d9faa5104 days 19 hrs ago0xbf84421732b49331dc1a03dc20128a083789b9ee  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00013307
0xf72d4396cf930ebd16e9d8a258944badc49c12d05ede743c7ba0a42d250f698e104 days 19 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.0001277472
0x1cc4b29eb368e7ff6e7c61e08ea0f12b5d1b627335deede2e837f1088ed4e722105 days 18 hrs ago0xbf84421732b49331dc1a03dc20128a083789b9ee  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00015223208
0x6346447db97a2782f15b18c0d62e9cacf96aa57f369e7881ceda21271363ec8f105 days 19 hrs ago0x00004242ca3469e30ae4a62775fee6584ed3fdca  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0 Ether0.00051482
0xfe8dee160c9955ba083203ff1334428c0520c5c832198b6364d84fd0816c1fec105 days 19 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.00059824344
0x49843d2e96890aa9af212b2f3bf6642823958fbda5898d8383a8375a3d9db2fe106 days 22 hrs ago0x18be67393dd30094ee9d25ea73f04230203a9659  IN   0x49a6e5b6c0801d9775938a0201f85448cca11fcb0.1 Ether0.000188993348
[ 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
0xb47a771c6c9f375bdf62749a24326a009818a6258e96a2c9b92d375219310957678742917 days 17 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x18be67393dd30094ee9d25ea73f04230203a96590.36 Ether
0xb47a771c6c9f375bdf62749a24326a009818a6258e96a2c9b92d375219310957678742917 days 17 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00428387585162755 Ether
0x5d5c32413d8715aedb26a2a591e51cc1392ee727b0db81442c6986f8f54e9e27637394785 days 8 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xbf84421732b49331dc1a03dc20128a083789b9ee0.18 Ether
0x5d5c32413d8715aedb26a2a591e51cc1392ee727b0db81442c6986f8f54e9e27637394785 days 8 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00413682386208154 Ether
0xbb6da38659ea524cd817e42c6430a5d5692b27e9c498d3dba33b726efe796408636076887 days 13 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xbf84421732b49331dc1a03dc20128a083789b9ee0.18 Ether
0xbb6da38659ea524cd817e42c6430a5d5692b27e9c498d3dba33b726efe796408636076887 days 13 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00413682386208154 Ether
0x8d60f5b7debbee738ddafbdf551c7f8c3e53393607991ab35eee39c766fc353d6257311104 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x18be67393dd30094ee9d25ea73f04230203a96590.36 Ether
0x8d60f5b7debbee738ddafbdf551c7f8c3e53393607991ab35eee39c766fc353d6257311104 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410692137714733 Ether
0xfe8dee160c9955ba083203ff1334428c0520c5c832198b6364d84fd0816c1fec6251342105 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x18be67393dd30094ee9d25ea73f04230203a96590.18 Ether
0xfe8dee160c9955ba083203ff1334428c0520c5c832198b6364d84fd0816c1fec6251342105 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410692137714733 Ether
0x92230b7cda459a42e7c0bbdc212d7bf01d045040f556c1812702019d82860fe46238525107 days 23 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x18be67393dd30094ee9d25ea73f04230203a96590.27 Ether
0x92230b7cda459a42e7c0bbdc212d7bf01d045040f556c1812702019d82860fe46238525107 days 23 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410178462373618 Ether
0x23870201432c8fe5e57bad2b55c7fd86492fa38f4dca4780a9e2410aa305a0ac6232577108 days 23 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xbf84421732b49331dc1a03dc20128a083789b9ee0.18 Ether
0x23870201432c8fe5e57bad2b55c7fd86492fa38f4dca4780a9e2410aa305a0ac6232577108 days 23 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0xa231196caec25c1da8f56acf3a733ca86ef46ac7c00c3efcb22cec602d16cdc16222732110 days 15 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xbf84421732b49331dc1a03dc20128a083789b9ee0.27 Ether
0xa231196caec25c1da8f56acf3a733ca86ef46ac7c00c3efcb22cec602d16cdc16222732110 days 15 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0xd7356ab68be167400841af6ae63127e038aa15f4f35a88cf5fb8fec407c8883f6216423111 days 16 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xbf84421732b49331dc1a03dc20128a083789b9ee0.27 Ether
0xd7356ab68be167400841af6ae63127e038aa15f4f35a88cf5fb8fec407c8883f6216423111 days 16 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0xe6e19234352dab07509948f983c9af5dedfa6c700c329f1a599363a0408ad77e6209944112 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x5ab00bf937d4a83b9841ca462689773aba62e5d10.18 Ether
0xe6e19234352dab07509948f983c9af5dedfa6c700c329f1a599363a0408ad77e6209944112 days 19 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0xb716be660c1c2819a4236c375e4e8461e37106cc6c6c068d5c09cb4ae7f20e3c6203479113 days 21 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xa09258d96eea38c031bfaa14c69cd56e6e1a938d0.27 Ether
0xb716be660c1c2819a4236c375e4e8461e37106cc6c6c068d5c09cb4ae7f20e3c6203479113 days 21 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0x992146543d7df3143dcc2003cd496291a7ab59c4e69bcb4acea139f3eaddb0e26197425114 days 22 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x5ab00bf937d4a83b9841ca462689773aba62e5d10.18 Ether
0x992146543d7df3143dcc2003cd496291a7ab59c4e69bcb4acea139f3eaddb0e26197425114 days 22 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.00410886526109518 Ether
0xc9ca9d570ae6b7b06b365130a14a93b7d8bee4c385abb7cb0dea6bf85bba2e506187850116 days 12 hrs ago0x49a6e5b6c0801d9775938a0201f85448cca11fcb0xc882a723ff3926ef2150366117425c4742fee66e0.18 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: VfSE_Lottery_2
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.23;
 
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

// This api is currently targeted at 0.4.18, please import oraclizeAPI_pre0.4.sol or oraclizeAPI_0.4 where necessary

pragma solidity >=0.4.18;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) public payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) external payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) public payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) external payable returns (bytes32 _id);
    function getPrice(string _datasource) public returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) public returns (uint _dsprice);
    function setProofType(byte _proofType) external;
    function setCustomGasPrice(uint _gasPrice) external;
    function randomDS_getSessionPubKeyHash() external constant returns(bytes32);
}

contract OraclizeAddrResolverI {
    function getAddress() public returns (address _addr);
}

/*
Begin solidity-cborutils
https://github.com/smartcontractkit/solidity-cborutils
MIT License
Copyright (c) 2018 SmartContract ChainLink, Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 */

library Buffer {
    struct buffer {
        bytes buf;
        uint capacity;
    }

    function init(buffer memory buf, uint _capacity) internal pure {
        uint capacity = _capacity;
        if(capacity % 32 != 0) capacity += 32 - (capacity % 32);
        // Allocate space for the buffer data
        buf.capacity = capacity;
        assembly {
            let ptr := mload(0x40)
            mstore(buf, ptr)
            mstore(ptr, 0)
            mstore(0x40, add(ptr, capacity))
        }
    }

    function resize(buffer memory buf, uint capacity) private pure {
        bytes memory oldbuf = buf.buf;
        init(buf, capacity);
        append(buf, oldbuf);
    }

    function max(uint a, uint b) private pure returns(uint) {
        if(a > b) {
            return a;
        }
        return b;
    }

    /**
     * @dev Appends a byte array to the end of the buffer. Resizes if doing so
     *      would exceed the capacity of the buffer.
     * @param buf The buffer to append to.
     * @param data The data to append.
     * @return The original buffer.
     */
    function append(buffer memory buf, bytes data) internal pure returns(buffer memory) {
        if(data.length + buf.buf.length > buf.capacity) {
            resize(buf, max(buf.capacity, data.length) * 2);
        }

        uint dest;
        uint src;
        uint len = data.length;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Length of existing buffer data
            let buflen := mload(bufptr)
            // Start address = buffer address + buffer length + sizeof(buffer length)
            dest := add(add(bufptr, buflen), 32)
            // Update buffer length
            mstore(bufptr, add(buflen, mload(data)))
            src := add(data, 32)
        }

        // Copy word-length chunks while possible
        for(; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }

        return buf;
    }

    /**
     * @dev Appends a byte to the end of the buffer. Resizes if doing so would
     * exceed the capacity of the buffer.
     * @param buf The buffer to append to.
     * @param data The data to append.
     * @return The original buffer.
     */
    function append(buffer memory buf, uint8 data) internal pure {
        if(buf.buf.length + 1 > buf.capacity) {
            resize(buf, buf.capacity * 2);
        }

        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Length of existing buffer data
            let buflen := mload(bufptr)
            // Address = buffer address + buffer length + sizeof(buffer length)
            let dest := add(add(bufptr, buflen), 32)
            mstore8(dest, data)
            // Update buffer length
            mstore(bufptr, add(buflen, 1))
        }
    }

    /**
     * @dev Appends a byte to the end of the buffer. Resizes if doing so would
     * exceed the capacity of the buffer.
     * @param buf The buffer to append to.
     * @param data The data to append.
     * @return The original buffer.
     */
    function appendInt(buffer memory buf, uint data, uint len) internal pure returns(buffer memory) {
        if(len + buf.buf.length > buf.capacity) {
            resize(buf, max(buf.capacity, len) * 2);
        }

        uint mask = 256 ** len - 1;
        assembly {
            // Memory address of the buffer data
            let bufptr := mload(buf)
            // Length of existing buffer data
            let buflen := mload(bufptr)
            // Address = buffer address + buffer length + sizeof(buffer length) + len
            let dest := add(add(bufptr, buflen), len)
            mstore(dest, or(and(mload(dest), not(mask)), data))
            // Update buffer length
            mstore(bufptr, add(buflen, len))
        }
        return buf;
    }
}

library CBOR {
    using Buffer for Buffer.buffer;

    uint8 private constant MAJOR_TYPE_INT = 0;
    uint8 private constant MAJOR_TYPE_NEGATIVE_INT = 1;
    uint8 private constant MAJOR_TYPE_BYTES = 2;
    uint8 private constant MAJOR_TYPE_STRING = 3;
    uint8 private constant MAJOR_TYPE_ARRAY = 4;
    uint8 private constant MAJOR_TYPE_MAP = 5;
    uint8 private constant MAJOR_TYPE_CONTENT_FREE = 7;

    function encodeType(Buffer.buffer memory buf, uint8 major, uint value) private pure {
        if(value <= 23) {
            buf.append(uint8((major << 5) | value));
        } else if(value <= 0xFF) {
            buf.append(uint8((major << 5) | 24));
            buf.appendInt(value, 1);
        } else if(value <= 0xFFFF) {
            buf.append(uint8((major << 5) | 25));
            buf.appendInt(value, 2);
        } else if(value <= 0xFFFFFFFF) {
            buf.append(uint8((major << 5) | 26));
            buf.appendInt(value, 4);
        } else if(value <= 0xFFFFFFFFFFFFFFFF) {
            buf.append(uint8((major << 5) | 27));
            buf.appendInt(value, 8);
        }
    }

    function encodeIndefiniteLengthType(Buffer.buffer memory buf, uint8 major) private pure {
        buf.append(uint8((major << 5) | 31));
    }

    function encodeUInt(Buffer.buffer memory buf, uint value) internal pure {
        encodeType(buf, MAJOR_TYPE_INT, value);
    }

    function encodeInt(Buffer.buffer memory buf, int value) internal pure {
        if(value >= 0) {
            encodeType(buf, MAJOR_TYPE_INT, uint(value));
        } else {
            encodeType(buf, MAJOR_TYPE_NEGATIVE_INT, uint(-1 - value));
        }
    }

    function encodeBytes(Buffer.buffer memory buf, bytes value) internal pure {
        encodeType(buf, MAJOR_TYPE_BYTES, value.length);
        buf.append(value);
    }

    function encodeString(Buffer.buffer memory buf, string value) internal pure {
        encodeType(buf, MAJOR_TYPE_STRING, bytes(value).length);
        buf.append(bytes(value));
    }

    function startArray(Buffer.buffer memory buf) internal pure {
        encodeIndefiniteLengthType(buf, MAJOR_TYPE_ARRAY);
    }

    function startMap(Buffer.buffer memory buf) internal pure {
        encodeIndefiniteLengthType(buf, MAJOR_TYPE_MAP);
    }

    function endSequence(Buffer.buffer memory buf) internal pure {
        encodeIndefiniteLengthType(buf, MAJOR_TYPE_CONTENT_FREE);
    }
}

/*
End solidity-cborutils
 */

contract usingOraclize {
    uint constant day = 60*60*24;
    uint constant week = 60*60*24*7;
    uint constant month = 60*60*24*30;
    byte constant proofType_NONE = 0x00;
    byte constant proofType_TLSNotary = 0x10;
    byte constant proofType_Ledger = 0x30;
    byte constant proofType_Android = 0x40;
    byte constant proofType_Native = 0xF0;
    byte constant proofStorage_IPFS = 0x01;
    uint8 constant networkID_auto = 0;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_consensys = 161;

    OraclizeAddrResolverI OAR;

    OraclizeI oraclize;
    modifier oraclizeAPI {
        if((address(OAR)==0)||(getCodeSize(address(OAR))==0))
            oraclize_setNetwork(networkID_auto);

        if(address(oraclize) != OAR.getAddress())
            oraclize = OraclizeI(OAR.getAddress());

        _;
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        _;
    }

    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
      return oraclize_setNetwork();
      networkID; // silence the warning and remain backwards compatible
    }
    function oraclize_setNetwork() internal returns(bool){
        if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet
            OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed);
            oraclize_setNetworkName("eth_mainnet");
            return true;
        }
        if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet
            OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1);
            oraclize_setNetworkName("eth_ropsten3");
            return true;
        }
        if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet
            OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e);
            oraclize_setNetworkName("eth_kovan");
            return true;
        }
        if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet
            OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48);
            oraclize_setNetworkName("eth_rinkeby");
            return true;
        }
        if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge
            OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
            return true;
        }
        if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide
            OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF);
            return true;
        }
        if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity
            OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA);
            return true;
        }
        return false;
    }

    function __callback(bytes32 myid, string result) public {
        __callback(myid, result, new bytes(0));
    }
    function __callback(bytes32 myid, string result, bytes proof) public {
      return;
      myid; result; proof; // Silence compiler warnings
    }

    function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource);
    }

    function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){
        return oraclize.getPrice(datasource, gaslimit);
    }

    function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(0, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(timestamp, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(0, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = stra2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        string[] memory dynargs = new string[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(0, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN.value(price)(timestamp, datasource, args);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        bytes memory args = ba2cbor(argN);
        return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](1);
        dynargs[0] = args[0];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](2);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](3);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](4);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        return oraclize_query(datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs);
    }
    function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(timestamp, datasource, dynargs, gaslimit);
    }
    function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) {
        bytes[] memory dynargs = new bytes[](5);
        dynargs[0] = args[0];
        dynargs[1] = args[1];
        dynargs[2] = args[2];
        dynargs[3] = args[3];
        dynargs[4] = args[4];
        return oraclize_query(datasource, dynargs, gaslimit);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address){
        return oraclize.cbAddress();
    }
    function oraclize_setProof(byte proofP) oraclizeAPI internal {
        return oraclize.setProofType(proofP);
    }
    function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal {
        return oraclize.setCustomGasPrice(gasPrice);
    }

    function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){
        return oraclize.randomDS_getSessionPubKeyHash();
    }

    function getCodeSize(address _addr) constant internal returns(uint _size) {
        assembly {
            _size := extcodesize(_addr)
        }
    }

    function parseAddr(string _a) internal pure returns (address){
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i=2; i<2+2*20; i+=2){
            iaddr *= 256;
            b1 = uint160(tmp[i]);
            b2 = uint160(tmp[i+1]);
            if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87;
            else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55;
            else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55;
            else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
            iaddr += (b1*16+b2);
        }
        return address(iaddr);
    }

    function strCompare(string _a, string _b) internal pure returns (int) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength) minLength = b.length;
        for (uint i = 0; i < minLength; i ++)
            if (a[i] < b[i])
                return -1;
            else if (a[i] > b[i])
                return 1;
        if (a.length < b.length)
            return -1;
        else if (a.length > b.length)
            return 1;
        else
            return 0;
    }

    function indexOf(string _haystack, string _needle) internal pure returns (int) {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if(h.length < 1 || n.length < 1 || (n.length > h.length))
            return -1;
        else if(h.length > (2**128 -1))
            return -1;
        else
        {
            uint subindex = 0;
            for (uint i = 0; i < h.length; i ++)
            {
                if (h[i] == n[0])
                {
                    subindex = 1;
                    while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex])
                    {
                        subindex++;
                    }
                    if(subindex == n.length)
                        return int(i);
                }
            }
            return -1;
        }
    }

    function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string) {
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
        for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
        return string(babcde);
    }

    function strConcat(string _a, string _b, string _c, string _d) internal pure returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string _a, string _b, string _c) internal pure returns (string) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string _a, string _b) internal pure returns (string) {
        return strConcat(_a, _b, "", "", "");
    }

    // parseInt
    function parseInt(string _a) internal pure returns (uint) {
        return parseInt(_a, 0);
    }

    // parseInt(parseFloat*10^_b)
    function parseInt(string _a, uint _b) internal pure returns (uint) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i=0; i<bresult.length; i++){
            if ((bresult[i] >= 48)&&(bresult[i] <= 57)){
                if (decimals){
                   if (_b == 0) break;
                    else _b--;
                }
                mint *= 10;
                mint += uint(bresult[i]) - 48;
            } else if (bresult[i] == 46) decimals = true;
        }
        if (_b > 0) mint *= 10**_b;
        return mint;
    }

    function uint2str(uint i) internal pure returns (string){
        if (i == 0) return "0";
        uint j = i;
        uint len;
        while (j != 0){
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (i != 0){
            bstr[k--] = byte(48 + i % 10);
            i /= 10;
        }
        return string(bstr);
    }

    using CBOR for Buffer.buffer;
    function stra2cbor(string[] arr) internal pure returns (bytes) {
        safeMemoryCleaner();
        Buffer.buffer memory buf;
        Buffer.init(buf, 1024);
        buf.startArray();
        for (uint i = 0; i < arr.length; i++) {
            buf.encodeString(arr[i]);
        }
        buf.endSequence();
        return buf.buf;
    }

    function ba2cbor(bytes[] arr) internal pure returns (bytes) {
        safeMemoryCleaner();
        Buffer.buffer memory buf;
        Buffer.init(buf, 1024);
        buf.startArray();
        for (uint i = 0; i < arr.length; i++) {
            buf.encodeBytes(arr[i]);
        }
        buf.endSequence();
        return buf.buf;
    }

    string oraclize_network_name;
    function oraclize_setNetworkName(string _network_name) internal {
        oraclize_network_name = _network_name;
    }

    function oraclize_getNetworkName() internal view returns (string) {
        return oraclize_network_name;
    }

    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        require((_nbytes > 0) && (_nbytes <= 32));
        // Convert from seconds to ledger timer ticks
        _delay *= 10;
        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)
            // the following variables can be relaxed
            // check relaxed random contract under ethereum-examples repo
            // for an idea on how to override and replace comit hash vars
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes memory delay = new bytes(32);
        assembly {
            mstore(add(delay, 0x20), _delay)
        }

        bytes memory delay_bytes8 = new bytes(8);
        copyBytes(delay, 24, 8, delay_bytes8, 0);

        bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay];
        bytes32 queryId = oraclize_query("random", args, _customGasLimit);

        bytes memory delay_bytes8_left = new bytes(8);

        assembly {
            let x := mload(add(delay_bytes8, 0x20))
            mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000))

        }

        oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2]));
        return queryId;
    }

    function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal {
        oraclize_randomDS_args[queryId] = commitment;
    }

    mapping(bytes32=>bytes32) oraclize_randomDS_args;
    mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified;

    function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){
        bool sigok;
        address signer;

        bytes32 sigr;
        bytes32 sigs;

        bytes memory sigr_ = new bytes(32);
        uint offset = 4+(uint(dersig[3]) - 0x20);
        sigr_ = copyBytes(dersig, offset, 32, sigr_, 0);
        bytes memory sigs_ = new bytes(32);
        offset += 32 + 2;
        sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0);

        assembly {
            sigr := mload(add(sigr_, 32))
            sigs := mload(add(sigs_, 32))
        }


        (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs);
        if (address(keccak256(pubkey)) == signer) return true;
        else {
            (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs);
            return (address(keccak256(pubkey)) == signer);
        }
    }

    function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) {
        bool sigok;

        // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH)
        bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2);
        copyBytes(proof, sig2offset, sig2.length, sig2, 0);

        bytes memory appkey1_pubkey = new bytes(64);
        copyBytes(proof, 3+1, 64, appkey1_pubkey, 0);

        bytes memory tosign2 = new bytes(1+65+32);
        tosign2[0] = byte(1); //role
        copyBytes(proof, sig2offset-65, 65, tosign2, 1);
        bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c";
        copyBytes(CODEHASH, 0, 32, tosign2, 1+65);
        sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey);

        if (sigok == false) return false;


        // Step 7: verify the APPKEY1 provenance (must be signed by Ledger)
        bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4";

        bytes memory tosign3 = new bytes(1+65);
        tosign3[0] = 0xFE;
        copyBytes(proof, 3, 65, tosign3, 1);

        bytes memory sig3 = new bytes(uint(proof[3+65+1])+2);
        copyBytes(proof, 3+65, sig3.length, sig3, 0);

        sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY);

        return sigok;
    }

    modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) {
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        require((_proof[0] == "L") && (_proof[1] == "P") && (_proof[2] == 1));

        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        require(proofVerified);

        _;
    }

    function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1;

        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) return 2;

        return 0;
    }

    function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal pure returns (bool){
        bool match_ = true;

        require(prefix.length == n_random_bytes);

        for (uint256 i=0; i< n_random_bytes; i++) {
            if (content[i] != prefix[i]) match_ = false;
        }

        return match_;
    }

    function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){

        // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId)
        uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32;
        bytes memory keyhash = new bytes(32);
        copyBytes(proof, ledgerProofLength, 32, keyhash, 0);
        if (!(keccak256(keyhash) == keccak256(sha256(context_name, queryId)))) return false;

        bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2);
        copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0);

        // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1)
        if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false;

        // Step 4: commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage.
        // This is to verify that the computed args match with the ones specified in the query.
        bytes memory commitmentSlice1 = new bytes(8+1+32);
        copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0);

        bytes memory sessionPubkey = new bytes(64);
        uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65;
        copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0);

        bytes32 sessionPubkeyHash = sha256(sessionPubkey);
        if (oraclize_randomDS_args[queryId] == keccak256(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match
            delete oraclize_randomDS_args[queryId];
        } else return false;


        // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey)
        bytes memory tosign1 = new bytes(32+8+1+32);
        copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0);
        if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false;

        // verify if sessionPubkeyHash was verified already, if not.. let's do it!
        if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){
            oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset);
        }

        return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash];
    }

    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal pure returns (bytes) {
        uint minLength = length + toOffset;

        // Buffer too small
        require(to.length >= minLength); // Should be a better way?

        // NOTE: the offset 32 is added to skip the `size` field of both bytes variables
        uint i = 32 + fromOffset;
        uint j = 32 + toOffset;

        while (i < (32 + fromOffset + length)) {
            assembly {
                let tmp := mload(add(from, i))
                mstore(add(to, j), tmp)
            }
            i += 32;
            j += 32;
        }

        return to;
    }

    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    // Duplicate Solidity's ecrecover, but catching the CALL return value
    function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {
        // We do our own memory management here. Solidity uses memory offset
        // 0x40 to store the current end of memory. We write past it (as
        // writes are memory extensions), but don't update the offset so
        // Solidity will reuse it. The memory used here is only needed for
        // this context.

        // FIXME: inline assembly can't access return values
        bool ret;
        address addr;

        assembly {
            let size := mload(0x40)
            mstore(size, hash)
            mstore(add(size, 32), v)
            mstore(add(size, 64), r)
            mstore(add(size, 96), s)

            // NOTE: we can reuse the request memory because we deal with
            //       the return code
            ret := call(3000, 1, 0, size, 128, size, 32)
            addr := mload(size)
        }

        return (ret, addr);
    }

    // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license
    function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) {
        bytes32 r;
        bytes32 s;
        uint8 v;

        if (sig.length != 65)
          return (false, 0);

        // The signature format is a compact form of:
        //   {bytes32 r}{bytes32 s}{uint8 v}
        // Compact means, uint8 is not padded to 32 bytes.
        assembly {
            r := mload(add(sig, 32))
            s := mload(add(sig, 64))

            // Here we are loading the last 32 bytes. We exploit the fact that
            // 'mload' will pad with zeroes if we overread.
            // There is no 'mload8' to do this, but that would be nicer.
            v := byte(0, mload(add(sig, 96)))

            // Alternative solution:
            // 'byte' is not working due to the Solidity parser, so lets
            // use the second best option, 'and'
            // v := and(mload(add(sig, 65)), 255)
        }

        // albeit non-transactional signatures are not specified by the YP, one would expect it
        // to match the YP range of [27, 28]
        //
        // geth uses [0, 1] and some clients have followed. This might change, see:
        //  https://github.com/ethereum/go-ethereum/issues/2053
        if (v < 27)
          v += 27;

        if (v != 27 && v != 28)
            return (false, 0);

        return safer_ecrecover(hash, v, r, s);
    }

    function safeMemoryCleaner() internal pure {
        assembly {
            let fmem := mload(0x40)
            codecopy(fmem, codesize, sub(msize, fmem))
        }
    }

}
// </ORACLIZE_API>
 
library SafeMath {
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws 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;
  }
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}
 
contract Ownable {
  address public owner;
 
  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
 
  constructor() public {
    owner = msg.sender;
  }
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }
 
}
 
contract VfSE_Lottery_2 is Ownable, usingOraclize {
  using SafeMath for uint256;
  address[] private players;
  address[] public winners;
  uint256[] public payments;
  uint256 private feeValue;
  address public lastWinner;
  address public authorizedToDraw;
  address[] private last10Winners = [0,0,0,0,0,0,0,0,0,0];  
  uint256 public lastPayOut;
  uint256 public amountRised;
  address public house;
  uint256 public round;
  uint256 public playValue;
  uint256 public roundEnds;
  uint256 public roundDuration = 1 days;
  bool public stopped;
  mapping (address => uint256) public payOuts;
  uint256 private _seed;
 
 
  function bitSlice(uint256 n, uint256 bits, uint256 slot) private pure returns(uint256) {
    uint256 offset = slot * bits;
    uint256 mask = uint256((2**bits) - 1) << offset;
    return uint256((n & mask) >> offset);
  }
 
  function maxRandom() private returns (uint256 randomNumber) {
    bytes32 myrng = oraclize_query("WolframAlpha", "random number between 1 and 2^64");
    _seed = uint256(keccak256(_seed, myrng));
    return _seed;
  }
 
 
  function random(uint256 upper) private returns (uint256 randomNumber) {
    return maxRandom() % upper;
  }
   
  function setHouseAddress(address _house) onlyOwner public {
    house = _house;
  }
 
  function setAuthorizedToDraw(address _authorized) onlyOwner public {
    authorizedToDraw = _authorized;
  }
 
  function setFee(uint256 _fee) onlyOwner public {
    feeValue = _fee;
  }
 
  function setPlayValue(uint256 _amount) onlyOwner public {
    playValue = _amount;
  }
 
  function stopLottery(bool _stop) onlyOwner public {
    stopped = _stop;
  }
 
  function produceRandom(uint256 upper) private returns (uint256) {
    uint256 rand = random(upper);
    //output = rand;
    return rand;
  }
 
  function getPayOutAmount() private view returns (uint256) {
    //uint256 balance = address(this).balance;
    uint256 fee = amountRised.mul(feeValue).div(100);
    return (amountRised - fee);
  }
 
  function draw() private {
    require(now > roundEnds);
    uint256 howMuchBets = players.length;
    uint256 k;
    lastWinner = players[produceRandom(howMuchBets)];
    lastPayOut = getPayOutAmount();
   
    winners.push(lastWinner);
    if (winners.length > 9) {
      for (uint256 i = (winners.length - 10); i < winners.length; i++) {
        last10Winners[k] = winners[i];
        k += 1;
      }
    }
 
    payments.push(lastPayOut);
    payOuts[lastWinner] += lastPayOut;
    lastWinner.transfer(lastPayOut);
   
    players.length = 0;
    round += 1;
    amountRised = 0;
    roundEnds = now + roundDuration;
   
    emit NewWinner(lastWinner, lastPayOut);
  }
 
  function drawNow() public {
    require(authorizedToDraw == msg.sender);
    draw();
  }
 
  function play() payable public {
    require (msg.value == playValue);
    require (!stopped);
 
    if (now > roundEnds) {
      if (players.length < 2) {
        roundEnds = now + roundDuration;
      } else {
        draw();
      }
    }
    players.push(msg.sender);
    amountRised = amountRised.add(msg.value);
  }
 
  function() payable public {
    play();
  }
 
  constructor() public {
    house = msg.sender;
    authorizedToDraw = msg.sender;
    feeValue = 10;
    playValue = 100 finney;
  }
   
  function getBalance() onlyOwner public {
    uint256 thisBalance = address(this).balance;
    house.transfer(thisBalance);
  }
 
  function getPlayersCount() public view returns (uint256) {
    return players.length;
  }
 
  function getWinnerCount() public view returns (uint256) {
    return winners.length;
  }
 
  function getPlayers() public view returns (address[]) {
    return players;
  }
 
  function last10() public view returns (address[]) {
    if (winners.length < 11) {
      return winners;
    } else {
      return last10Winners;
    }
  }
  event NewWinner(address _winner, uint256 _amount);
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"lastPayOut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"round","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"last10","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"playValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_stop","type":"bool"}],"name":"stopLottery","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stopped","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"payments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPlayers","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"play","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"payOuts","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"setPlayValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"winners","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getWinnerCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_authorized","type":"address"}],"name":"setAuthorizedToDraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getPlayersCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"roundEnds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"amountRised","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"drawNow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_house","type":"address"}],"name":"setHouseAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"roundDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"authorizedToDraw","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastWinner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"house","outputs":[{"name":"","type":"address"}],"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":"_winner","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"NewWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6101c06040526000608081815260a082905260c082905260e08290526101008290526101208290526101408290526101608290526101808290526101a0919091526200005090600c90600a620000a9565b50620151806013553480156200006557600080fd5b506000805433600160a060020a03199182168117909255600f8054821683179055600b80549091169091179055600a60095567016345785d8a000060115562000137565b828054828255906000526020600020908101928215620000fb579160200282015b82811115620000fb5782518254600160a060020a03191660ff909116178255602090920191600190910190620000ca565b50620001099291506200010d565b5090565b6200013491905b8082111562000109578054600160a060020a031916815560010162000114565b90565b61159d80620001476000396000f30060806040526004361061015b5763ffffffff60e060020a6000350416630c6cbf92811461016557806312065fe01461018c578063146ca531146101a157806315bf2b51146101b657806327dc297e1461021b57806338bbfa5014610279578063479e840f1461031557806362ba16491461032a57806369fe0e2d1461034457806375f12b211461035c57806387d81789146103855780638b5b9ccc1461039d5780638da5cb5b146103b257806393e84cd91461015b578063952319de146103e35780639ad5be7b14610404578063a2fb11751461041c578063a46c363714610434578063a58daf7614610449578063a76594bf1461046a578063afa12a8a1461047f578063c892cfdf14610494578063eba60632146104a9578063ef3aaf54146104be578063f2fde38b146104df578063f7cb789a14610500578063f7ec221e14610515578063fe1881841461052a578063ff9b3acf1461053f575b610163610554565b005b34801561017157600080fd5b5061017a6105f6565b60408051918252519081900360200190f35b34801561019857600080fd5b506101636105fc565b3480156101ad57600080fd5b5061017a610654565b3480156101c257600080fd5b506101cb61065a565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102075781810151838201526020016101ef565b505050509050019250505060405180910390f35b34801561022757600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101639583359536956044949193909101919081908401838280828437509497506107299650505050505050565b34801561028557600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261016395833595369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506107419650505050505050565b34801561032157600080fd5b5061017a610746565b34801561033657600080fd5b50610163600435151561074c565b34801561035057600080fd5b50610163600435610776565b34801561036857600080fd5b50610371610792565b604080519115158252519081900360200190f35b34801561039157600080fd5b5061017a60043561079b565b3480156103a957600080fd5b506101cb6107ba565b3480156103be57600080fd5b506103c761081c565b60408051600160a060020a039092168252519081900360200190f35b3480156103ef57600080fd5b5061017a600160a060020a036004351661082b565b34801561041057600080fd5b5061016360043561083d565b34801561042857600080fd5b506103c7600435610859565b34801561044057600080fd5b5061017a610881565b34801561045557600080fd5b50610163600160a060020a0360043516610887565b34801561047657600080fd5b5061017a6108c0565b34801561048b57600080fd5b5061017a6108c6565b3480156104a057600080fd5b5061017a6108cc565b3480156104b557600080fd5b506101636108d2565b3480156104ca57600080fd5b50610163600160a060020a03600435166108f3565b3480156104eb57600080fd5b50610163600160a060020a036004351661092c565b34801561050c57600080fd5b5061017a6109b3565b34801561052157600080fd5b506103c76109b9565b34801561053657600080fd5b506103c76109c8565b34801561054b57600080fd5b506103c76109d7565b601154341461056257600080fd5b60145460ff161561057257600080fd5b60125442111561059c576006546002111561059457601354420160125561059c565b61059c6109e6565b600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054600160a060020a03191633179055600e546105f1903463ffffffff610c1e16565b600e55565b600d5481565b60008054600160a060020a0316331461061457600080fd5b50600f54604051303191600160a060020a03169082156108fc029083906000818181858888f19350505050158015610650573d6000803e3d6000fd5b5050565b60105481565b600754606090600b11156106ca5760078054806020026020016040519081016040528092919081815260200182805480156106be57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116106a0575b50505050509050610726565b600c8054806020026020016040519081016040528092919081815260200182805480156106be57602002820191906000526020600020908154600160a060020a031681526001909101906020018083116106a057505050505090505b90565b60408051600081526020810190915261065090839083905b505050565b60115481565b600054600160a060020a0316331461076357600080fd5b6014805460ff1916911515919091179055565b600054600160a060020a0316331461078d57600080fd5b600955565b60145460ff1681565b60088054829081106107a957fe5b600091825260209091200154905081565b6060600680548060200260200160405190810160405280929190818152602001828054801561081257602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116107f4575b5050505050905090565b600054600160a060020a031681565b60156020526000908152604090205481565b600054600160a060020a0316331461085457600080fd5b601155565b600780548290811061086757fe5b600091825260209091200154600160a060020a0316905081565b60075490565b600054600160a060020a0316331461089e57600080fd5b600b8054600160a060020a031916600160a060020a0392909216919091179055565b60065490565b60125481565b600e5481565b600b54600160a060020a031633146108e957600080fd5b6108f16109e6565b565b600054600160a060020a0316331461090a57600080fd5b600f8054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a0316331461094357600080fd5b600160a060020a038116151561095857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a031916600160a060020a0392909216919091179055565b60135481565b600b54600160a060020a031681565b600a54600160a060020a031681565b600f54600160a060020a031681565b6000806000601254421115156109fb57600080fd5b600680549350610a0a84610c38565b81548110610a1457fe5b600091825260209091200154600a8054600160a060020a031916600160a060020a03909216919091179055610a47610c4b565b600d55600a546007805460018101825560008290527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018054600160a060020a031916600160a060020a03909316929092179091555460091015610b215750600754600919015b600754811015610b21576007805482908110610ac657fe5b600091825260209091200154600c8054600160a060020a039092169184908110610aec57fe5b60009182526020909120018054600160a060020a031916600160a060020a039290921691909117905560019182019101610aae565b600d805460088054600181019091557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301819055600a8054600160a060020a03908116600090815260156020526040808220805490950190945591549354925193169282156108fc029291818181858888f19350505050158015610ba9573d6000803e3d6000fd5b506000610bb76006826114bd565b506010805460010190556000600e556013544201601255600a54600d5460408051600160a060020a039093168352602083019190915280517fe6b9e1659282e93b3a484308db69e5d1cac21051d45ee0fcb6f72399541cec869281900390910190a1505050565b600082820183811015610c2d57fe5b8091505b5092915050565b600080610c4483610c84565b9392505050565b600080610c766064610c6a600954600e54610c9f90919063ffffffff16565b9063ffffffff610cca16565b905080600e540391505b5090565b600081610c8f610ce1565b811515610c9857fe5b0692915050565b600080831515610cb25760009150610c31565b50828202828482811515610cc257fe5b0414610c2d57fe5b6000808284811515610cd857fe5b04949350505050565b600080610d586040805190810160405280600c81526020017f576f6c6672616d416c70686100000000000000000000000000000000000000008152506040805190810160405280602081526020017f72616e646f6d206e756d626572206265747765656e203120616e6420325e3634815250610d7f565b60168054604080519182526020820184905280519182900301902090819055925090505090565b6001546000908190600160a060020a03161580610dae5750600154610dac90600160a060020a0316611174565b155b15610dbf57610dbd6000611178565b505b600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610e1257600080fd5b505af1158015610e26573d6000803e3d6000fd5b505050506040513d6020811015610e3c57600080fd5b5051600254600160a060020a03908116911614610ef257600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610ea657600080fd5b505af1158015610eba573d6000803e3d6000fd5b505050506040513d6020811015610ed057600080fd5b505160028054600160a060020a031916600160a060020a039092169190911790555b6002546040517f524f3889000000000000000000000000000000000000000000000000000000008152602060048201818152875160248401528751600160a060020a039094169363524f388993899383926044909201919085019080838360005b83811015610f6b578181015183820152602001610f53565b50505050905090810190601f168015610f985780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015610fb757600080fd5b505af1158015610fcb573d6000803e3d6000fd5b505050506040513d6020811015610fe157600080fd5b50519050670de0b6b3a764000062030d403a02018111156110055760009150610c31565b6002546040517fadf59f99000000000000000000000000000000000000000000000000000000008152600060048201818152606060248401908152885160648501528851600160a060020a039095169463adf59f99948794938b938b939192909160448201916084019060208701908083838b5b83811015611091578181015183820152602001611079565b50505050905090810190601f1680156110be5780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b838110156110f15781810151838201526020016110d9565b50505050905090810190601f16801561111e5780820380516001836020036101000a031916815260200191505b50955050505050506020604051808303818588803b15801561113f57600080fd5b505af1158015611153573d6000803e3d6000fd5b50505050506040513d602081101561116a57600080fd5b5051949350505050565b3b90565b6000611182611188565b92915050565b6000806111a8731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed611174565b11156112195760018054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905560408051808201909152600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152611211906114aa565b506001610726565b600061123873c03a2615d5efaf5f49f60b7bb6583eaec212fdf1611174565b11156112a15760018054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905560408051808201909152600c81527f6574685f726f707374656e3300000000000000000000000000000000000000006020820152611211906114aa565b60006112c073b7a07bcf2ba2f2703b24c0691b5278999c59ac7e611174565b11156113295760018054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905560408051808201909152600981527f6574685f6b6f76616e00000000000000000000000000000000000000000000006020820152611211906114aa565b600061134873146500cfd35b22e4a392fe0adc06de1a1368ed48611174565b11156113b15760018054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905560408051808201909152600b81527f6574685f72696e6b6562790000000000000000000000000000000000000000006020820152611211906114aa565b60006113d0736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475611174565b1115611402575060018054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475178155610726565b60006114217320e12a1f859b3feae5fb2a0a32c18f5a65555bbf611174565b1115611453575060018054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf178155610726565b60006114727351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa611174565b11156114a4575060018054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa178155610726565b50600090565b80516106509060039060208401906114e1565b81548183558181111561074157600083815260209020610741918101908301611557565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061152257805160ff191683800117855561154f565b8280016001018555821561154f579182015b8281111561154f578251825591602001919060010190611534565b50610c809291505b61072691905b80821115610c80576000815560010161155d5600a165627a7a7230582033d2c9431067cb78eb3a529d58b7e755fcba9f6225d4636d44419067f05706910029

   Swarm Source:
bzzr://33d2c9431067cb78eb3a529d58b7e755fcba9f6225d4636d44419067f0570691

 

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.