Sponsored Link:  Up to 2% Cryptocurrency Cashback - Reserve your card - Monaco App - www.mona.co
Contract Overview
ETH Balance: 11.894227624763251078 Ether
ETH USD Value: $8,629.02 (@ $725.48/ETH)
No Of Transactions: 728 txns
  Latest 25 txns from a total Of 728 transactions View All

TxHash Age From To Value [TxFee]
0x22d8dc10872fc85fa5b74edfbe81749477370eeaed10899edd1055b76316276147 mins agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.0047386
0x35d30f74ffeb3b0fbc76f8a7450909cc7b5a12a74b6679cf888ba04011d1351548 mins ago0xd5e50600b347bebfc49ce86a8bd47a5d60f2e5c1  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.012 Ether0.004844994
0xaf5f27837e4c4bdedc39757470f72919e005986e89b29103b104b93663b44c091 hr 9 mins agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00475508
0xdcb86c558da7ef4fa03e9c4fd320841aff5ff24eb6d8ec47eac244ca09cf7e6f1 hr 10 mins ago0xd5e50600b347bebfc49ce86a8bd47a5d60f2e5c1  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.012 Ether0.004844994
0xbadfa21178be813342b1346776a023b8a80e7d2a67f0c76d0ef6249a88b027c116 hrs 40 mins agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00551308
0x09b83810fe54c734a5f97d49947c1256c68f1386b560bbd66eef53b631b1f2e816 hrs 42 mins ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.03 Ether0.00576785
0x9aee41b7b617725eee577fda203b8362d176c73c5bd7e19783d827e28f01a3c123 hrs ago0x831e103c11ccbff00e9965114a6da6807438d259  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.013 Ether0.0045
0x84e96c39006d7420b031b993bd45ae50fbf6ab385c8629bb304d3ec985f8b1481 day 29 mins ago0xdff27e8f9a19ee4c81f5baef07c39914b397e4c0  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.0014603 Ether0.00625
0xfd279607b90fddd09c6239b8d17ff5aeed474cc1a9d955fcad1be76a4858ad6f2 days 2 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00870756
0xe5da1ca3ce66d6481af79ee1bcfe6ef506fd65c18fa8485d8484800f34b3d3c02 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.045 Ether0.0057909214
0x44a1bc0e875e84b97493a3232abe23739a5de51f4dda37772080410863931d8d2 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.006275
0x48194db76d879c91a0a4ab91232f4beed6cce746cacffe8cc444cdfcb0f73b1b2 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.006275
0xe65c3b327dd35782232915b7a0cc547be219135bc52054ca6e3375f9cb49836c2 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.006275
0x2ff199ec881498fc8f44b076987d9d154661a2c7f4b460c01a471714399dac6d2 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.006275
0xa26875a7425e43f784638d46355181c5848db63d357c4b06197a2c784744b0632 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.006275
0x503119beb89086bc85d08bfcbb5b75320cbfb392a85d55946954ef085549a5eb2 days 2 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00950448
0x63b5acd6f7d3602d47d6810e070b9aec8fd384eb35e1c057e92c61f0d02179db2 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.0057909214
0xf6ad50d0c2ce2073444d44d3b2a63cada9796b3eb295d3a575f463822074fe9f2 days 2 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00961728
0x98e651025d941e3f09afea559e2c49da0a460d03f53ace764f12669c98097a012 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.0057909214
0x0a6c788f7e8e5f460b80ca28b67e94d50b70004a5c44b765bba812c55b08cfa92 days 2 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00977576
0x1efaceec2ad42d80b9d26656680d85c8714843b7a5d0239a4119ad8064e4bd132 days 2 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.0057909214
0x560af83f16ff9a4ae3cb44e69b83057afacfe670bd28ded1a90e404c6aec07652 days 2 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00958812
0x9e027d91a6e66a16f4b988b55bd4ff8eb8b8636b12c1856c8af82361cfdab0ea2 days 3 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.0057909214
0x5801b314cb80144c7fe8e9bf165ab83d170d8288c16973c03b8bec8c14b60eaa2 days 3 hrs agoOraclize  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00 Ether0.00974428
0x6e56aa2eabe9fed21489ba98487f264ccaacd0e8b54ef937d8d4e886b3b4b57b2 days 3 hrs ago0x5ec52bc0267ad08fa5237735d7c1edb520af03e9  IN   0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00.051 Ether0.0057909214
[ 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
0x22d8dc10872fc85fa5b74edfbe81749477370eeaed10899edd1055b763162761474990547 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.000013353333333333 Ether
0x22d8dc10872fc85fa5b74edfbe81749477370eeaed10899edd1055b763162761474990547 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00xd5e50600b347bebfc49ce86a8bd47a5d60f2e5c10.0026039 Ether
0x35d30f74ffeb3b0fbc76f8a7450909cc7b5a12a74b6679cf888ba04011d13515474990348 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.009997 Ether
0xaf5f27837e4c4bdedc39757470f72919e005986e89b29103b104b93663b44c0947498101 hr 9 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.000033383333333333 Ether
0xaf5f27837e4c4bdedc39757470f72919e005986e89b29103b104b93663b44c0947498101 hr 9 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00xd5e50600b347bebfc49ce86a8bd47a5d60f2e5c10.006509749999999999 Ether
0xdcb86c558da7ef4fa03e9c4fd320841aff5ff24eb6d8ec47eac244ca09cf7e6f47498041 hr 10 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.009997 Ether
0xbadfa21178be813342b1346776a023b8a80e7d2a67f0c76d0ef6249a88b027c1474611516 hrs 40 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.00011709 Ether
0xbadfa21178be813342b1346776a023b8a80e7d2a67f0c76d0ef6249a88b027c1474611516 hrs 40 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.02283255 Ether
0x09b83810fe54c734a5f97d49947c1256c68f1386b560bbd66eef53b631b1f2e8474611116 hrs 42 mins ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.010485 Ether
0x9aee41b7b617725eee577fda203b8362d176c73c5bd7e19783d827e28f01a3c1474451223 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.011217 Ether
0xfd279607b90fddd09c6239b8d17ff5aeed474cc1a9d955fcad1be76a4858ad6f47379042 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.000050096923076923 Ether
0xfd279607b90fddd09c6239b8d17ff5aeed474cc1a9d955fcad1be76a4858ad6f47379042 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.009768899999999999 Ether
0xe5da1ca3ce66d6481af79ee1bcfe6ef506fd65c18fa8485d8484800f34b3d3c047379002 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.012437 Ether
0x503119beb89086bc85d08bfcbb5b75320cbfb392a85d55946954ef085549a5eb47378492 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.00033102125 Ether
0x503119beb89086bc85d08bfcbb5b75320cbfb392a85d55946954ef085549a5eb47378492 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.06454914375 Ether
0x63b5acd6f7d3602d47d6810e070b9aec8fd384eb35e1c057e92c61f0d02179db47378442 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.013169 Ether
0xf6ad50d0c2ce2073444d44d3b2a63cada9796b3eb295d3a575f463822074fe9f47378392 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.0003901321875 Ether
0xf6ad50d0c2ce2073444d44d3b2a63cada9796b3eb295d3a575f463822074fe9f47378392 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.0760757765625 Ether
0x98e651025d941e3f09afea559e2c49da0a460d03f53ace764f12669c98097a0147378352 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.013169 Ether
0x0a6c788f7e8e5f460b80ca28b67e94d50b70004a5c44b765bba812c55b08cfa947378242 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.0001773328125 Ether
0x0a6c788f7e8e5f460b80ca28b67e94d50b70004a5c44b765bba812c55b08cfa947378242 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.0345798984375 Ether
0x1efaceec2ad42d80b9d26656680d85c8714843b7a5d0239a4119ad8064e4bd1347378202 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.013169 Ether
0x560af83f16ff9a4ae3cb44e69b83057afacfe670bd28ded1a90e404c6aec076547378152 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x51ffc1b089392a5bb65bf24eaf04d07d0e6f88b50.000165510625 Ether
0x560af83f16ff9a4ae3cb44e69b83057afacfe670bd28ded1a90e404c6aec076547378152 days 2 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x5ec52bc0267ad08fa5237735d7c1edb520af03e90.032274571875 Ether
0x9e027d91a6e66a16f4b988b55bd4ff8eb8b8636b12c1856c8af82361cfdab0ea47378122 days 3 hrs ago0x41ff0796a6c7a201476bff53c4cb2c48b084e5e00x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.013169 Ether
[ Download CSV Export  ] 
Warning: The compiled contract might be susceptible to ZeroFunctionSelector (very low-severity), DelegateCallReturnValue (low-severity), ECRecoverMalformedInput (medium-severity) Solidity compiler bugs.

Contract Source Code Verified
Contract Name: Slot
Compiler Version: v0.4.13+commit.fb4cb1a
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.11;

// <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.
*/

pragma solidity ^0.4.0;//please import oraclizeAPI_pre0.4.sol when solidity < 0.4.0

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) payable returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
    function useCoupon(string _coupon);
    function setProofType(byte _proofType);
    function setConfig(bytes32 _config);
    function setCustomGasPrice(uint _gasPrice);
    function randomDS_getSessionPubKeyHash() returns(bytes32);
}
contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}
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_Android = 0x20;
    byte constant proofType_Ledger = 0x30;
    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);
        oraclize = OraclizeI(OAR.getAddress());
        _;
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _;
    }

    function oraclize_setNetwork(uint8 networkID) 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) {
        __callback(myid, result, new bytes(0));
    }
    function __callback(bytes32 myid, string result, bytes proof) {
    }
    
    function oraclize_useCoupon(string code) oraclizeAPI internal {
        oraclize.useCoupon(code);
    }

    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_setConfig(bytes32 config) oraclizeAPI internal {
        return oraclize.setConfig(config);
    }
    
    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 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 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 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 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 returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

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

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

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

    // parseInt(parseFloat*10^_b)
    function parseInt(string _a, uint _b) internal 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 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);
    }
    
    function stra2cbor(string[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }

    function ba2cbor(bytes[] arr) internal returns (bytes) {
            uint arrlen = arr.length;

            // get correct cbor output length
            uint outputlen = 0;
            bytes[] memory elemArray = new bytes[](arrlen);
            for (uint i = 0; i < arrlen; i++) {
                elemArray[i] = (bytes(arr[i]));
                outputlen += elemArray[i].length + (elemArray[i].length - 1)/23 + 3; //+3 accounts for paired identifier types
            }
            uint ctr = 0;
            uint cborlen = arrlen + 0x80;
            outputlen += byte(cborlen).length;
            bytes memory res = new bytes(outputlen);

            while (byte(cborlen).length > ctr) {
                res[ctr] = byte(cborlen)[ctr];
                ctr++;
            }
            for (i = 0; i < arrlen; i++) {
                res[ctr] = 0x5F;
                ctr++;
                for (uint x = 0; x < elemArray[i].length; x++) {
                    // if there's a bug with larger strings, this may be the culprit
                    if (x % 23 == 0) {
                        uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
                        elemcborlen += 0x40;
                        uint lctr = ctr;
                        while (byte(elemcborlen).length > ctr - lctr) {
                            res[ctr] = byte(elemcborlen)[ctr - lctr];
                            ctr++;
                        }
                    }
                    res[ctr] = elemArray[i][x];
                    ctr++;
                }
                res[ctr] = 0xFF;
                ctr++;
            }
            return res;
        }
        
        
    string oraclize_network_name;
    function oraclize_setNetworkName(string _network_name) internal {
        oraclize_network_name = _network_name;
    }
    
    function oraclize_getNetworkName() internal returns (string) {
        return oraclize_network_name;
    }
    
    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        if ((_nbytes == 0)||(_nbytes > 32)) throw;
        bytes memory nbytes = new bytes(1);
        nbytes[0] = byte(_nbytes);
        bytes memory unonce = new bytes(32);
        bytes memory sessionKeyHash = new bytes(32);
        bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
        assembly {
            mstore(unonce, 0x20)
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes[3] memory args = [unonce, nbytes, sessionKeyHash]; 
        bytes32 queryId = oraclize_query(_delay, "random", args, _customGasLimit);
        oraclize_randomDS_setCommitment(queryId, sha3(bytes8(_delay), args[1], sha256(args[0]), args[2]));
        return queryId;
    }
    
    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(sha3(pubkey)) == signer) return true;
        else {
            (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs);
            return (address(sha3(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] = 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)
        if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw;
        
        bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName());
        if (proofVerified == false) throw;
        
        _;
    }
    
    function matchBytes32Prefix(bytes32 content, bytes prefix) internal returns (bool){
        bool match_ = true;
        
        for (var i=0; i<prefix.length; 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){
        bool checkok;
        
        
        // 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);
        checkok = (sha3(keyhash) == sha3(sha256(context_name, queryId)));
        if (checkok == false) 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)
        checkok = matchBytes32Prefix(sha256(sig1), result);
        if (checkok == false) return false;
        
        
        // Step 4: commitment match verification, sha3(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] == sha3(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);
        checkok = verifySig(sha256(tosign1), sig1, sessionPubkey);
        if (checkok == false) 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 returns (bytes) {
        uint minLength = length + toOffset;

        if (to.length < minLength) {
            // Buffer too small
            throw; // 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);
    }
        
}
// </ORACLIZE_API>
/// math.sol -- mixin for inline numerical wizardry

// Copyright (C) 2015, 2016, 2017  DappHub, LLC

// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND (express or implied).

pragma solidity ^0.4.10;

contract DSMath {
    
    /*
    standard uint256 functions
     */

    function add(uint256 x, uint256 y) constant internal returns (uint256 z) {
        assert((z = x + y) >= x);
    }

    function sub(uint256 x, uint256 y) constant internal returns (uint256 z) {
        assert((z = x - y) <= x);
    }

    function mul(uint256 x, uint256 y) constant internal returns (uint256 z) {
        z = x * y;
        assert(x == 0 || z / x == y);
    }

    function div(uint256 x, uint256 y) constant internal returns (uint256 z) {
        z = x / y;
    }

    function min(uint256 x, uint256 y) constant internal returns (uint256 z) {
        return x <= y ? x : y;
    }
    function max(uint256 x, uint256 y) constant internal returns (uint256 z) {
        return x >= y ? x : y;
    }

    /*
    uint128 functions (h is for half)
     */


    function hadd(uint128 x, uint128 y) constant internal returns (uint128 z) {
        assert((z = x + y) >= x);
    }

    function hsub(uint128 x, uint128 y) constant internal returns (uint128 z) {
        assert((z = x - y) <= x);
    }

    function hmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = x * y;
        assert(x == 0 || z / x == y);
    }

    function hdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = x / y;
    }

    function hmin(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x <= y ? x : y;
    }
    function hmax(uint128 x, uint128 y) constant internal returns (uint128 z) {
        return x >= y ? x : y;
    }


    /*
    int256 functions
     */

    function imin(int256 x, int256 y) constant internal returns (int256 z) {
        return x <= y ? x : y;
    }
    function imax(int256 x, int256 y) constant internal returns (int256 z) {
        return x >= y ? x : y;
    }

    /*
    WAD math
     */

    uint128 constant WAD = 10 ** 18;

    function wadd(uint128 x, uint128 y) constant internal returns (uint128) {
        return hadd(x, y);
    }

    function wsub(uint128 x, uint128 y) constant internal returns (uint128) {
        return hsub(x, y);
    }

    function wmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * y + WAD / 2) / WAD);
    }

    function wdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * WAD + y / 2) / y);
    }

    function wmin(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmin(x, y);
    }
    function wmax(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmax(x, y);
    }

    /*
    RAY math
     */

    uint128 constant RAY = 10 ** 27;

    function radd(uint128 x, uint128 y) constant internal returns (uint128) {
        return hadd(x, y);
    }

    function rsub(uint128 x, uint128 y) constant internal returns (uint128) {
        return hsub(x, y);
    }

    function rmul(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * y + RAY / 2) / RAY);
    }

    function rdiv(uint128 x, uint128 y) constant internal returns (uint128 z) {
        z = cast((uint256(x) * RAY + y / 2) / y);
    }

    function rpow(uint128 x, uint64 n) constant internal returns (uint128 z) {
        // This famous algorithm is called "exponentiation by squaring"
        // and calculates x^n with x as fixed-point and n as regular unsigned.
        //
        // It's O(log n), instead of O(n) for naive repeated multiplication.
        //
        // These facts are why it works:
        //
        //  If n is even, then x^n = (x^2)^(n/2).
        //  If n is odd,  then x^n = x * x^(n-1),
        //   and applying the equation for even x gives
        //    x^n = x * (x^2)^((n-1) / 2).
        //
        //  Also, EVM division is flooring and
        //    floor[(n-1) / 2] = floor[n / 2].

        z = n % 2 != 0 ? x : RAY;

        for (n /= 2; n != 0; n /= 2) {
            x = rmul(x, x);

            if (n % 2 != 0) {
                z = rmul(z, x);
            }
        }
    }

    function rmin(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmin(x, y);
    }
    function rmax(uint128 x, uint128 y) constant internal returns (uint128) {
        return hmax(x, y);
    }

    function cast(uint256 x) constant internal returns (uint128 z) {
        assert((z = uint128(x)) == x);
    }

}

contract LedgerProofVerifyI {
    function external_oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) public;
    function external_oraclize_randomDS_proofVerify(bytes proof, bytes32 queryId, bytes result, string context_name)  public returns (bool);
}

contract Owned {
    address public owner;

    modifier onlyOwner {
        assert(msg.sender == owner);
        _;
    }
    
    function Owned() {
        owner = msg.sender;
    }

}

contract oraclizeSettings is Owned {
    uint constant ORACLIZE_PER_SPIN_GAS_LIMIT = 6100;
    uint constant ORACLIZE_BASE_GAS_LIMIT = 220000;
    uint safeGas = 9000;
    
    event LOG_newGasLimit(uint _gasLimit);

    function setSafeGas(uint _gas) 
            onlyOwner 
    {
        assert(ORACLIZE_BASE_GAS_LIMIT + _gas >= ORACLIZE_BASE_GAS_LIMIT);
        assert(_gas <= 25000);
        assert(_gas >= 9000); 

        safeGas = _gas;
        LOG_newGasLimit(_gas);
    }       
}

contract HouseManaged is Owned {
    
    address public houseAddress;
    address newOwner;
    bool public isStopped;

    event LOG_ContractStopped();
    event LOG_ContractResumed();
    event LOG_OwnerAddressChanged(address oldAddr, address newOwnerAddress);
    event LOG_HouseAddressChanged(address oldAddr, address newHouseAddress);
    
    modifier onlyIfNotStopped {
        assert(!isStopped);
        _;
    }

    modifier onlyIfStopped {
        assert(isStopped);
        _;
    }
    
    function HouseManaged() {
        houseAddress = msg.sender;
    }

    function stop_or_resume_Contract(bool _isStopped)
        onlyOwner {

        isStopped = _isStopped;
    }

    function changeHouse(address _newHouse)
        onlyOwner {

        assert(_newHouse != address(0x0)); 
        
        houseAddress = _newHouse;
        LOG_HouseAddressChanged(houseAddress, _newHouse);
    }
        
    function changeOwner(address _newOwner) onlyOwner {
        newOwner = _newOwner; 
    }     

    function acceptOwnership() {
        if (msg.sender == newOwner) {
            owner = newOwner;       
            LOG_OwnerAddressChanged(owner, newOwner);
            delete newOwner;
        }
    }
}

contract usingInvestorsModule is HouseManaged, oraclizeSettings {
    
    uint constant MAX_INVESTORS = 5; //maximum number of investors
    uint constant divestFee = 50; //divest fee percentage (10000 = 100%)

     struct Investor {
        address investorAddress;
        uint amountInvested;
        bool votedForEmergencyWithdrawal;
    }
    
    //Starting at 1
    mapping(address => uint) public investorIDs;
    mapping(uint => Investor) public investors;
    uint public numInvestors = 0;

    uint public invested = 0;
    
    uint public investorsProfit = 0;
    uint public investorsLosses = 0;
    bool profitDistributed;
    
    event LOG_InvestorEntrance(address indexed investor, uint amount);
    event LOG_InvestorCapitalUpdate(address indexed investor, int amount);
    event LOG_InvestorExit(address indexed investor, uint amount);
    event LOG_EmergencyAutoStop();
    
    event LOG_ZeroSend();
    event LOG_ValueIsTooBig();
    event LOG_FailedSend(address addr, uint value);
    event LOG_SuccessfulSend(address addr, uint value);
    


    modifier onlyMoreThanMinInvestment {
        assert(msg.value > getMinInvestment());
        _;
    }

    modifier onlyMoreThanZero {
        assert(msg.value != 0);
        _;
    }

    
    modifier onlyInvestors {
        assert(investorIDs[msg.sender] != 0);
        _;
    }

    modifier onlyNotInvestors {
        assert(investorIDs[msg.sender] == 0);
        _;
    }
    
    modifier investorsInvariant {
        _;
        assert(numInvestors <= MAX_INVESTORS);
    }
     
    function getBankroll()
        constant
        returns(uint) {

        if ((invested < investorsProfit) ||
            (invested + investorsProfit < invested) ||
            (invested + investorsProfit < investorsLosses)) {
            return 0;
        }
        else {
            return invested + investorsProfit - investorsLosses;
        }
    }

    function getMinInvestment()
        constant
        returns(uint) {

        if (numInvestors == MAX_INVESTORS) {
            uint investorID = searchSmallestInvestor();
            return getBalance(investors[investorID].investorAddress);
        }
        else {
            return 0;
        }
    }

    function getLossesShare(address currentInvestor)
        constant
        returns (uint) {

        return (investors[investorIDs[currentInvestor]].amountInvested * investorsLosses) / invested;
    }

    function getProfitShare(address currentInvestor)
        constant
        returns (uint) {

        return (investors[investorIDs[currentInvestor]].amountInvested * investorsProfit) / invested;
    }

    function getBalance(address currentInvestor)
        constant
        returns (uint) {

        uint invested = investors[investorIDs[currentInvestor]].amountInvested;
        uint profit = getProfitShare(currentInvestor);
        uint losses = getLossesShare(currentInvestor);

        if ((invested + profit < profit) ||
            (invested + profit < invested) ||
            (invested + profit < losses))
            return 0;
        else
            return invested + profit - losses;
    }

    function searchSmallestInvestor()
        constant
        returns(uint) {

        uint investorID = 1;
        for (uint i = 1; i <= numInvestors; i++) {
            if (getBalance(investors[i].investorAddress) < getBalance(investors[investorID].investorAddress)) {
                investorID = i;
            }
        }

        return investorID;
    }

    
    function addInvestorAtID(uint id)
        private {

        investorIDs[msg.sender] = id;
        investors[id].investorAddress = msg.sender;
        investors[id].amountInvested = msg.value;
        invested += msg.value;

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

    function profitDistribution()
        private {

        if (profitDistributed) return;
                
        uint copyInvested;

        for (uint i = 1; i <= numInvestors; i++) {
            address currentInvestor = investors[i].investorAddress;
            uint profitOfInvestor = getProfitShare(currentInvestor);
            uint lossesOfInvestor = getLossesShare(currentInvestor);
            
            //Check for overflow and underflow
            if ((investors[i].amountInvested + profitOfInvestor >= investors[i].amountInvested) &&
                (investors[i].amountInvested + profitOfInvestor >= lossesOfInvestor))  {
                investors[i].amountInvested += profitOfInvestor - lossesOfInvestor;
                LOG_InvestorCapitalUpdate(currentInvestor, (int) (profitOfInvestor - lossesOfInvestor));
            }
            else {
                isStopped = true;
                LOG_EmergencyAutoStop();
            }

            copyInvested += investors[i].amountInvested; 

        }

        delete investorsProfit;
        delete investorsLosses;
        invested = copyInvested;

        profitDistributed = true;
    }
    
    function increaseInvestment()
        payable
        onlyIfNotStopped
        onlyMoreThanZero
        onlyInvestors  {

        profitDistribution();
        investors[investorIDs[msg.sender]].amountInvested += msg.value;
        invested += msg.value;
    }

    function newInvestor()
        payable
        onlyIfNotStopped
        onlyMoreThanZero
        onlyNotInvestors
        onlyMoreThanMinInvestment
        investorsInvariant {

        profitDistribution();

        if (numInvestors == MAX_INVESTORS) {
            uint smallestInvestorID = searchSmallestInvestor();
            divest(investors[smallestInvestorID].investorAddress);
        }

        numInvestors++;
        addInvestorAtID(numInvestors);
    }

    function divest()
        onlyInvestors {

        divest(msg.sender);
    }


    function divest(address currentInvestor)
        internal
        investorsInvariant {

        profitDistribution();
        uint currentID = investorIDs[currentInvestor];
        uint amountToReturn = getBalance(currentInvestor);

        if (invested >= investors[currentID].amountInvested) {
            invested -= investors[currentID].amountInvested;
            uint divestFeeAmount =  (amountToReturn*divestFee)/10000;
            amountToReturn -= divestFeeAmount;

            delete investors[currentID];
            delete investorIDs[currentInvestor];

            //Reorder investors
            if (currentID != numInvestors) {
                // Get last investor
                Investor lastInvestor = investors[numInvestors];
                //Set last investor ID to investorID of divesting account
                investorIDs[lastInvestor.investorAddress] = currentID;
                //Copy investor at the new position in the mapping
                investors[currentID] = lastInvestor;
                //Delete old position in the mappping
                delete investors[numInvestors];
            }

            numInvestors--;
            safeSend(currentInvestor, amountToReturn);
            safeSend(houseAddress, divestFeeAmount);
            LOG_InvestorExit(currentInvestor, amountToReturn);
        } else {
            isStopped = true;
            LOG_EmergencyAutoStop();
        }
    }
    
    function forceDivestOfAllInvestors()
        onlyOwner {
            
        uint copyNumInvestors = numInvestors;
        for (uint i = 1; i <= copyNumInvestors; i++) {
            divest(investors[1].investorAddress);
        }
    }
    
    function safeSend(address addr, uint value)
        internal {

        if (value == 0) {
            LOG_ZeroSend();
            return;
        }

        if (this.balance < value) {
            LOG_ValueIsTooBig();
            return;
	}

        if (!(addr.call.gas(safeGas).value(value)())) {
            LOG_FailedSend(addr, value);
            if (addr != houseAddress) {
                //Forward to house address all change
                if (!(houseAddress.call.gas(safeGas).value(value)())) LOG_FailedSend(houseAddress, value);
            }
        }

        LOG_SuccessfulSend(addr,value);
    }
}

contract EmergencyWithdrawalModule is usingInvestorsModule {
    uint constant EMERGENCY_WITHDRAWAL_RATIO = 80; //ratio percentage (100 = 100%)
    uint constant EMERGENCY_TIMEOUT = 3 days;
    
    struct WithdrawalProposal {
        address toAddress;
        uint atTime;
    }
    
    WithdrawalProposal public proposedWithdrawal;
    
    event LOG_EmergencyWithdrawalProposed();
    event LOG_EmergencyWithdrawalFailed(address indexed withdrawalAddress);
    event LOG_EmergencyWithdrawalSucceeded(address indexed withdrawalAddress, uint amountWithdrawn);
    event LOG_EmergencyWithdrawalVote(address indexed investor, bool vote);
    
    modifier onlyAfterProposed {
        assert(proposedWithdrawal.toAddress != 0);
        _;
    }
    
    modifier onlyIfEmergencyTimeOutHasPassed {
        assert(proposedWithdrawal.atTime + EMERGENCY_TIMEOUT <= now);
        _;
    }
    
    function voteEmergencyWithdrawal(bool vote)
        onlyInvestors
        onlyAfterProposed
        onlyIfStopped {

        investors[investorIDs[msg.sender]].votedForEmergencyWithdrawal = vote;
        LOG_EmergencyWithdrawalVote(msg.sender, vote);
    }

    function proposeEmergencyWithdrawal(address withdrawalAddress)
        onlyIfStopped
        onlyOwner {

        //Resets previous votes
        for (uint i = 1; i <= numInvestors; i++) {
            delete investors[i].votedForEmergencyWithdrawal;
        }

        proposedWithdrawal = WithdrawalProposal(withdrawalAddress, now);
        LOG_EmergencyWithdrawalProposed();
    }

    function executeEmergencyWithdrawal()
        onlyOwner
        onlyAfterProposed
        onlyIfStopped
        onlyIfEmergencyTimeOutHasPassed {

        uint numOfVotesInFavour;
        uint amountToWithdraw = this.balance;

        for (uint i = 1; i <= numInvestors; i++) {
            if (investors[i].votedForEmergencyWithdrawal == true) {
                numOfVotesInFavour++;
                delete investors[i].votedForEmergencyWithdrawal;
            }
        }

        if (numOfVotesInFavour >= EMERGENCY_WITHDRAWAL_RATIO * numInvestors / 100) {
            if (!proposedWithdrawal.toAddress.send(amountToWithdraw)) {
                LOG_EmergencyWithdrawalFailed(proposedWithdrawal.toAddress);
            }
            else {
                LOG_EmergencyWithdrawalSucceeded(proposedWithdrawal.toAddress, amountToWithdraw);
            }
        }
        else {
            revert();
        }
    }
    
        /*
    The owner can use this function to force the exit of an investor from the
    contract during an emergency withdrawal in the following situations:
        - Unresponsive investor
        - Investor demanding to be paid in other to vote, the facto-blackmailing
        other investors
    */
    function forceDivestOfOneInvestor(address currentInvestor)
        onlyOwner
        onlyIfStopped {

        divest(currentInvestor);
        //Resets emergency withdrawal proposal. Investors must vote again
        delete proposedWithdrawal;
    }
}

contract Slot is usingOraclize, EmergencyWithdrawalModule, DSMath {
    
    uint constant INVESTORS_EDGE = 200; 
    uint constant HOUSE_EDGE = 50;
    uint constant CAPITAL_RISK = 250;
    uint constant MAX_SPINS = 16;
    
    uint minBet = 1 wei;
 
    struct SpinsContainer {
        address playerAddress;
        uint nSpins;
        uint amountWagered;
    }
    
    mapping (bytes32 => SpinsContainer) spins;
    
    /* Both arrays are ordered:
     - probabilities are ordered from smallest to highest
     - multipliers are ordered from highest to lowest
     The probabilities are expressed as integer numbers over a scale of 10000: i.e
     100 is equivalent to 1%, 5000 to 50% and so on.
    */
    uint[] public probabilities;
    uint[] public multipliers;
    
    uint public totalAmountWagered; 
    
    event LOG_newSpinsContainer(bytes32 myid, address playerAddress, uint amountWagered, uint nSpins);
    event LOG_SpinExecuted(bytes32 myid, address playerAddress, uint spinIndex, uint numberDrawn, uint grossPayoutForSpin);
    event LOG_SpinsContainerInfo(bytes32 myid, address playerAddress, uint netPayout);

    LedgerProofVerifyI externalContract;
    
    function Slot(address _verifierAddr) {
        externalContract = LedgerProofVerifyI(_verifierAddr);
    }
    
    //SECTION I: MODIFIERS AND HELPER FUNCTIONS
    
    function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal {
        externalContract.external_oraclize_randomDS_setCommitment(queryId, commitment);
    }
    
    modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) {
        // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1)
        //if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw;
        assert(externalContract.external_oraclize_randomDS_proofVerify(_proof, _queryId, bytes(_result), oraclize_getNetworkName()));
        _;
    }

    modifier onlyOraclize {
        assert(msg.sender == oraclize_cbAddress());
        _;
    }

    modifier onlyIfSpinsExist(bytes32 myid) {
        assert(spins[myid].playerAddress != address(0x0));
        _;
    }
    
    function isValidSize(uint _amountWagered) 
        internal 
        returns(bool) {
            
        uint netPotentialPayout = (_amountWagered * (10000 - INVESTORS_EDGE) * multipliers[0])/ 10000; 
        uint maxAllowedPayout = (CAPITAL_RISK * getBankroll())/10000;
        
        return ((netPotentialPayout <= maxAllowedPayout) && (_amountWagered >= minBet));
    }

    modifier onlyIfEnoughFunds(bytes32 myid) {
        if (isValidSize(spins[myid].amountWagered)) {
             _;
        }
        else {
            address playerAddress = spins[myid].playerAddress;
            uint amountWagered = spins[myid].amountWagered;   
            delete spins[myid];
            safeSend(playerAddress, amountWagered);
            return;
        }
    }
    

        modifier onlyValidNumberOfSpins (uint _nSpins) {
        assert(_nSpins <= MAX_SPINS);
              assert(_nSpins > 0);
        _;
    }
    
    /*
        For the game to be fair, the total gross payout over a large number of 
        individual slot spins should be the total amount wagered by the player. 
        
        The game owner, called house, and the investors will gain by applying 
        a small fee, called edge, to the amount won by the player in the case of
        a successful spin. 
        
        The total gross expected payout is equal to the sum of all payout. Each 
        i-th payout is calculated:
                    amountWagered * multipliers[i] * probabilities[i] 
        The fairness condition can be expressed as the equation:
                    sum of aW * m[i] * p[i] = aW
        After having simplified the equation:
                        sum of m[i] * p[i] = 1
        Since our probabilities are defined over 10000, the sum should be 10000.
        
        The contract owner can modify the multipliers and probabilities array, 
        but the  modifier enforces that the number choosen always result in a 
        fare game.
    */
    modifier onlyIfFair(uint[] _prob, uint[] _payouts) {
        if (_prob.length != _payouts.length) revert();
        uint sum = 0;
        for (uint i = 0; i <_prob.length; i++) {
            sum += _prob[i] * _payouts[i];     
        }
        assert(sum == 10000);
        _;
    }

    function()
        payable {
        buySpins(1);
    }

    function buySpins(uint _nSpins) 
        payable 
        onlyValidNumberOfSpins(_nSpins) 
                    onlyIfNotStopped {
            
        uint gas = _nSpins*ORACLIZE_PER_SPIN_GAS_LIMIT + ORACLIZE_BASE_GAS_LIMIT + safeGas;
        uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("random", gas);
        
        // Disallow bets that even when maximally winning are a loss for player 
        // due to oraclizeFee
        assert(oraclizeFee/multipliers[0] + oraclizeFee < msg.value);
        uint amountWagered = msg.value - oraclizeFee;
        assert(isValidSize(amountWagered));
        
        bytes32 queryId = oraclize_newRandomDSQuery(0, 2*_nSpins, gas);
        spins[queryId] = 
            SpinsContainer(msg.sender,
                   _nSpins,
                   amountWagered
                  );
        LOG_newSpinsContainer(queryId, msg.sender, amountWagered, _nSpins);
        totalAmountWagered += amountWagered;
    }
    
    function executeSpins(bytes32 myid, bytes randomBytes) 
        private 
        returns(uint)
    {
        uint amountWonTotal = 0;
        uint amountWonSpin = 0;
        uint numberDrawn = 0;
        uint rangeUpperEnd = 0;
        uint nSpins = spins[myid].nSpins;
        
        for (uint i = 0; i < 2*nSpins; i += 2) {
            // A number between 0 and 2**16, normalized over 0 - 10000
            numberDrawn = ((uint(randomBytes[i])*256 + uint(randomBytes[i+1]))*10000)/2**16;
            rangeUpperEnd = 0;
            amountWonSpin = 0;
            for (uint j = 0; j < probabilities.length; j++) {
                rangeUpperEnd += probabilities[j];
                if (numberDrawn < rangeUpperEnd) {
                    amountWonSpin = (spins[myid].amountWagered * multipliers[j]) / nSpins;
                    amountWonTotal += amountWonSpin;
                    break;
                }
            }
            LOG_SpinExecuted(myid, spins[myid].playerAddress, i/2, numberDrawn, amountWonSpin);
        }
        return amountWonTotal;
    }
    
    function sendPayout(bytes32 myid, uint payout) private {

        uint investorsFee = payout*INVESTORS_EDGE/10000; 
        uint houseFee = payout*HOUSE_EDGE/10000;
      
        uint netPlayerPayout = sub(sub(payout,investorsFee), houseFee);
        uint netCostForInvestors = add(netPlayerPayout, houseFee);

        if (netCostForInvestors >= spins[myid].amountWagered) {
            investorsLosses += sub(netCostForInvestors, spins[myid].amountWagered);
        }
        else {
            investorsProfit += sub(spins[myid].amountWagered, netCostForInvestors);
        }
        
        LOG_SpinsContainerInfo(myid, spins[myid].playerAddress, netPlayerPayout);
        safeSend(spins[myid].playerAddress, netPlayerPayout);
        safeSend(houseAddress, houseFee);
    }
    
     function __callback(bytes32 myid, string result, bytes _proof) 
        onlyOraclize
        onlyIfSpinsExist(myid)
        onlyIfEnoughFunds(myid)
        oraclize_randomDS_proofVerify(myid, result, _proof)
    {
                
        uint payout = executeSpins(myid, bytes(result));
        
        sendPayout(myid, payout);
        
        delete profitDistributed;
        delete spins[myid];
    }
    
    // SETTERS - SETTINGS ACCESSIBLE BY OWNER
    
    // Check ordering as well, since ordering assumptions are made in _callback 
    // and elsewhere
    function setConfiguration(uint[] _probabilities, uint[] _multipliers) 
        onlyOwner 
        onlyIfFair(_probabilities, _multipliers) {
                
        oraclize_setProof(proofType_Ledger); //This is here to reduce gas cost as this function has to be called anyway for initialization
        
        delete probabilities;
        delete multipliers;
        
        uint lastProbability = 0;
        uint lastMultiplier = 2**256 - 1;
        
        for (uint i = 0; i < _probabilities.length; i++) {
            probabilities.push(_probabilities[i]);
            if (lastProbability >= _probabilities[i]) revert();
            lastProbability = _probabilities[i];
        }
        
        for (i = 0; i < _multipliers.length; i++) {
            multipliers.push(_multipliers[i]);
            if (lastMultiplier <= _multipliers[i]) revert();
            lastMultiplier = _multipliers[i];
        }
    }
    
    function setMinBet(uint _minBet) onlyOwner {
        minBet = _minBet;
    }
    
    // GETTERS - CONSTANT METHODS
    
    function getSpinsContainer(bytes32 myid)
        constant
        returns(address, uint) {
        return (spins[myid].playerAddress, spins[myid].amountWagered); 
    }

    // Returns minimal amount to wager to return a profit in case of max win
    function getMinAmountToWager(uint _nSpins)
        onlyValidNumberOfSpins(_nSpins)
        constant
                returns(uint) {
        uint gas = _nSpins*ORACLIZE_PER_SPIN_GAS_LIMIT + ORACLIZE_BASE_GAS_LIMIT + safeGas;
        uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("random", gas);
        return minBet + oraclizeFee/multipliers[0] + oraclizeFee;
    }
   
    function getMaxAmountToWager(uint _nSpins)
        onlyValidNumberOfSpins(_nSpins)
        constant
        returns(uint) {

        uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("random", _nSpins*ORACLIZE_PER_SPIN_GAS_LIMIT + ORACLIZE_BASE_GAS_LIMIT + safeGas);
        uint maxWage =  (CAPITAL_RISK * getBankroll())*10000/((10000 - INVESTORS_EDGE)*10000*multipliers[0]);
        return maxWage + oraclizeFee;
    }
    
}

    Contract ABI  
[{"constant":false,"inputs":[],"name":"divest","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalAmountWagered","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getBankroll","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_nSpins","type":"uint256"}],"name":"buySpins","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[{"name":"myid","type":"bytes32"}],"name":"getSpinsContainer","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_nSpins","type":"uint256"}],"name":"getMinAmountToWager","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"currentInvestor","type":"address"}],"name":"getProfitShare","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"numInvestors","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"currentInvestor","type":"address"}],"name":"getLossesShare","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"vote","type":"bool"}],"name":"voteEmergencyWithdrawal","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_isStopped","type":"bool"}],"name":"stop_or_resume_Contract","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"forceDivestOfAllInvestors","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_nSpins","type":"uint256"}],"name":"getMaxAmountToWager","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"_proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"isStopped","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"investors","outputs":[{"name":"investorAddress","type":"address"},{"name":"amountInvested","type":"uint256"},{"name":"votedForEmergencyWithdrawal","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"searchSmallestInvestor","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"withdrawalAddress","type":"address"}],"name":"proposeEmergencyWithdrawal","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"currentInvestor","type":"address"}],"name":"forceDivestOfOneInvestor","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"proposedWithdrawal","outputs":[{"name":"toAddress","type":"address"},{"name":"atTime","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"investorsLosses","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"investorsProfit","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"investorIDs","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getMinInvestment","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_minBet","type":"uint256"}],"name":"setMinBet","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"increaseInvestment","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"changeOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"multipliers","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_probabilities","type":"uint256[]"},{"name":"_multipliers","type":"uint256[]"}],"name":"setConfiguration","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"invested","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"houseAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_gas","type":"uint256"}],"name":"setSafeGas","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"executeEmergencyWithdrawal","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"probabilities","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"currentInvestor","type":"address"}],"name":"getBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newHouse","type":"address"}],"name":"changeHouse","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"newInvestor","outputs":[],"payable":true,"type":"function"},{"inputs":[{"name":"_verifierAddr","type":"address"}],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"myid","type":"bytes32"},{"indexed":false,"name":"playerAddress","type":"address"},{"indexed":false,"name":"amountWagered","type":"uint256"},{"indexed":false,"name":"nSpins","type":"uint256"}],"name":"LOG_newSpinsContainer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"myid","type":"bytes32"},{"indexed":false,"name":"playerAddress","type":"address"},{"indexed":false,"name":"spinIndex","type":"uint256"},{"indexed":false,"name":"numberDrawn","type":"uint256"},{"indexed":false,"name":"grossPayoutForSpin","type":"uint256"}],"name":"LOG_SpinExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"myid","type":"bytes32"},{"indexed":false,"name":"playerAddress","type":"address"},{"indexed":false,"name":"netPayout","type":"uint256"}],"name":"LOG_SpinsContainerInfo","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_EmergencyWithdrawalProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"withdrawalAddress","type":"address"}],"name":"LOG_EmergencyWithdrawalFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"withdrawalAddress","type":"address"},{"indexed":false,"name":"amountWithdrawn","type":"uint256"}],"name":"LOG_EmergencyWithdrawalSucceeded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"investor","type":"address"},{"indexed":false,"name":"vote","type":"bool"}],"name":"LOG_EmergencyWithdrawalVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"investor","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"LOG_InvestorEntrance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"investor","type":"address"},{"indexed":false,"name":"amount","type":"int256"}],"name":"LOG_InvestorCapitalUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"investor","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"LOG_InvestorExit","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_EmergencyAutoStop","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_ZeroSend","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_ValueIsTooBig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"LOG_FailedSend","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"addr","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"LOG_SuccessfulSend","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_gasLimit","type":"uint256"}],"name":"LOG_newGasLimit","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_ContractStopped","type":"event"},{"anonymous":false,"inputs":[],"name":"LOG_ContractResumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldAddr","type":"address"},{"indexed":false,"name":"newOwnerAddress","type":"address"}],"name":"LOG_OwnerAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldAddr","type":"address"},{"indexed":false,"name":"newHouseAddress","type":"address"}],"name":"LOG_HouseAddressChanged","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526123286008556000600b556000600c556000600d556000600e556001601255341561002e57600080fd5b604051602080613c45833981016040528080519150505b5b5b60058054600160a060020a03191633600160a060020a03161790555b60068054600160a060020a03191633600160a060020a03161790555b60178054600160a060020a031916600160a060020a0383161790555b505b613b99806100ac6000396000f300606060405236156101d25763ffffffff60e060020a600035041663058aace181146101e557806308a36a1c146101fa5780630d1fce421461021f5780630dd3fd03146102445780630ed387c11461025157806310745f7e14610289578063116c6eab146102b1578063132ae5e9146102e25780631514ea5414610307578063187a62d5146103385780631b0eaf7814610352578063232523e81461036c57806327dc297e1461038157806330e07be0146103d957806338bbfa50146104015780633f683b6a1461049b5780633feb5f2b146104c257806340a49a96146105085780634671e65e1461052d57806351404cbe1461054e578063518496b21461056f5780636128a4f3146105a457806366aee0fc146105c95780636be80de7146105ee578063724ae9d01461061f57806379ba50971461064457806388ea41b9146106595780638da5cb5b14610671578063a4beffa7146106a0578063a6f9dae1146106aa578063ac7fc263146106cb578063bf9a5fde146106f3578063cafb220214610784578063d7cee31e146107a9578063dbf5b91b146107d8578063f4993bbd146107f0578063f8833efd14610805578063f8b2cb4f1461082d578063f9153fbc1461085e578063fb099c841461087f575b6101e35b6101e06001610889565b5b565b005b34156101f057600080fd5b6101e3610aeb565b005b341561020557600080fd5b61020d610b19565b60405190815260200160405180910390f35b341561022a57600080fd5b61020d610b1f565b60405190815260200160405180910390f35b6101e3600435610889565b005b341561025c57600080fd5b610267600435610b68565b604051600160a060020a03909216825260208201526040908101905180910390f35b341561029457600080fd5b61020d600435610b90565b60405190815260200160405180910390f35b34156102bc57600080fd5b61020d600160a060020a0360043516610cee565b60405190815260200160405180910390f35b34156102ed57600080fd5b61020d610d33565b60405190815260200160405180910390f35b341561031257600080fd5b61020d600160a060020a0360043516610d39565b60405190815260200160405180910390f35b341561034357600080fd5b6101e36004351515610d7e565b005b341561035d57600080fd5b6101e36004351515610e3a565b005b341561037757600080fd5b6101e3610e7f565b005b341561038c57600080fd5b6101e3600480359060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ef895505050505050565b005b34156103e457600080fd5b61020d600435610f28565b60405190815260200160405180910390f35b341561040c57600080fd5b6101e3600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061109095505050505050565b005b34156104a657600080fd5b6104ae61136c565b604051901515815260200160405180910390f35b34156104cd57600080fd5b6104d860043561137c565b604051600160a060020a039093168352602083019190915215156040808301919091526060909101905180910390f35b341561051357600080fd5b61020d6113aa565b60405190815260200160405180910390f35b341561053857600080fd5b6101e3600160a060020a0360043516611417565b005b341561055957600080fd5b6101e3600160a060020a03600435166114f0565b005b341561057a57600080fd5b610267611541565b604051600160a060020a03909216825260208201526040908101905180910390f35b34156105af57600080fd5b61020d611556565b60405190815260200160405180910390f35b34156105d457600080fd5b61020d61155c565b60405190815260200160405180910390f35b34156105f957600080fd5b61020d600160a060020a0360043516611562565b60405190815260200160405180910390f35b341561062a57600080fd5b61020d611574565b60405190815260200160405180910390f35b341561064f57600080fd5b6101e36115bf565b005b341561066457600080fd5b6101e3600435611657565b005b341561067c57600080fd5b610684611679565b604051600160a060020a03909116815260200160405180910390f35b6101e3611688565b005b34156106b557600080fd5b6101e3600160a060020a036004351661170e565b005b34156106d657600080fd5b61020d600435611746565b60405190815260200160405180910390f35b34156106fe57600080fd5b6101e360046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061176995505050505050565b005b341561078f57600080fd5b61020d611966565b60405190815260200160405180910390f35b34156107b457600080fd5b61068461196c565b604051600160a060020a03909116815260200160405180910390f35b34156107e357600080fd5b6101e360043561197b565b005b34156107fb57600080fd5b6101e36119f7565b005b341561081057600080fd5b61020d600435611b83565b60405190815260200160405180910390f35b341561083857600080fd5b61020d600160a060020a0360043516611ba6565b60405190815260200160405180910390f35b341561086957600080fd5b6101e3600160a060020a0360043516611c27565b005b6101e3611cbe565b005b600080808084601081111561089a57fe5b600081116108a457fe5b60075460a060020a900460ff16156108b857fe5b600854600080546117d4890290920162035b60019650600160a060020a03909116906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561091557600080fd5b6102c65a03f1151561092657600080fd5b50505060405180519050600160a060020a0316632ef3accc8660006040516020015260405160e060020a63ffffffff841602815260248101919091526040600482018190526006604483015260d060020a6572616e646f6d0260648301526084909101906020905180830381600087803b15156109a257600080fd5b6102c65a03f115156109b357600080fd5b5050506040518051905093503484601560008154811015156109d157fe5b906000526020600020900160005b5054868115156109eb57fe5b0401106109f457fe5b8334039250610a0283611d79565b1515610a0a57fe5b610a1960008760020287611de9565b915060606040519081016040908152600160a060020a03331682526020808301899052818301869052600085815260139091522081518154600160a060020a031916600160a060020a0391909116178155602082015181600101556040820151600290910155507f25ef9afa70a157f7a9ec6c002639446224a5397f53eee89fad392d0242f49fec82338589604051938452600160a060020a03909216602084015260408084019190915260608301919091526080909101905180910390a160168054840190555b5b5b505050505050565b600160a060020a0333166000908152600960205260409020541515610b0c57fe5b6101e0336120d6565b5b5b565b60165481565b6000600d54600c541080610b385750600c54600d548101105b80610b4a5750600e54600d54600c5401105b15610b5757506000610b64565b50600e54600d54600c5401035b5b90565b60008181526013602052604090208054600290910154600160a060020a03909116905b915091565b60008080836010811115610ba057fe5b60008111610baa57fe5b600854600080546117d4880290920162035b60019450600160a060020a03909116906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610c0757600080fd5b6102c65a03f11515610c1857600080fd5b50505060405180519050600160a060020a0316632ef3accc8460006040516020015260405160e060020a63ffffffff841602815260248101919091526040600482018190526006604483015260d060020a6572616e646f6d0260648301526084909101906020905180830381600087803b1515610c9457600080fd5b6102c65a03f11515610ca557600080fd5b5050506040518051905091508160156000815481101515610cc257fe5b906000526020600020900160005b505483811515610cdc57fe5b04601254010193505b5b505050919050565b600c54600d54600160a060020a0383166000908152600960209081526040808320548352600a90915281206001015490929102811515610d2a57fe5b0490505b919050565b600b5481565b600c54600e54600160a060020a0383166000908152600960209081526040808320548352600a90915281206001015490929102811515610d2a57fe5b0490505b919050565b600160a060020a0333166000908152600960205260409020541515610d9f57fe5b601054600160a060020a03161515610db357fe5b60075460a060020a900460ff161515610dc857fe5b33600160a060020a03166000818152600960209081526040808320548352600a90915290819020600201805460ff19168415151790557fea22ee15de9c385abeff072b23d6e0de5ebda8c59098f5585f45e82b9faa576290839051901515815260200160405180910390a25b5b5b5b50565b60055433600160a060020a03908116911614610e5257fe5b6007805474ff0000000000000000000000000000000000000000191660a060020a831515021790555b5b50565b600554600090819033600160a060020a03908116911614610e9c57fe5b5050600b5460015b818111610ef2576001600052600a6020527fbbc70db1b6c7afd11e79c0fb0051300458f1a3acb8ee9789d9b6b26c61ad9bc754610ee990600160a060020a03166120d6565b5b600101610ea4565b5b5b5050565b610ef282826000604051805910610f0c5750595b908082528060200260200182016040525b50611090565b5b5050565b60008080836010811115610f3857fe5b60008111610f4257fe5b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610f8b57600080fd5b6102c65a03f11515610f9c57600080fd5b50505060405180519050600160a060020a0316632ef3accc60085462035b606117d48902010160006040516020015260405160e060020a63ffffffff841602815260248101919091526040600482018190526006604483015260d060020a6572616e646f6d0260648301526084909101906020905180830381600087803b151561102557600080fd5b6102c65a03f1151561103657600080fd5b5050506040518051905092506015600081548110151561105257fe5b906000526020600020900160005b50546305d75c8002611070610b1f565b622625a00281151561107e57fe5b04915082820193505b5b505050919050565b600061109a61230a565b600160a060020a031633600160a060020a03161415156110b657fe5b6000848152601360205260409020548490600160a060020a031615156110d857fe5b60008581526013602052604081206002015486919081906110f890611d79565b1561131757601754889088908890600160a060020a031663c629061d82858561111f612426565b60006040516020015260405160e060020a63ffffffff8716028152602481018490526080600482019081529081906044810190606481019060840188818151815260200191508051906020019080838360005b8381101561118b5780820151818401525b602001611172565b50505050905090810190601f1680156111b85780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b838110156111ef5780820151818401525b6020016111d6565b50505050905090810190601f16801561121c5780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b838110156112535780820151818401525b60200161123a565b50505050905090810190601f1680156112805780820380516001836020036101000a031916815260200191505b50975050505050505050602060405180830381600087803b15156112a357600080fd5b6102c65a03f115156112b457600080fd5b5050506040518051905015156112c657fe5b6112d08b8b6124cf565b97506112dc8b89612687565b600f805460ff1916905560008b81526013602052604081208054600160a060020a031916815560018101829055600201555b5b50505061135e565b505060008181526013602052604081208054600282018054600160a060020a031983168455600190930184905592909255600160a060020a039091169061135e82826127d8565b5b5b5050505b505b50505050565b60075460a060020a900460ff1681565b600a60205260009081526040902080546001820154600290920154600160a060020a03909116919060ff1683565b60006001805b600b54811161140e576000828152600a60205260409020546113da90600160a060020a0316611ba6565b6000828152600a60205260409020546113fb90600160a060020a0316611ba6565b1015611405578091505b5b6001016113b0565b8192505b505090565b60075460009060a060020a900460ff16151561142f57fe5b60055433600160a060020a0390811691161461144757fe5b5060015b600b548111611476576000818152600a60205260409020600201805460ff191690555b60010161144b565b60408051908101604052600160a060020a0383168152426020820152601081518154600160a060020a031916600160a060020a03919091161781556020820151600190910155507f6c0eb56f121418f16eaebbe01cb2694897b8578b3b1c549e634a1b7753ed2d8b60405160405180910390a15b5b5b5050565b60055433600160a060020a0390811691161461150857fe5b60075460a060020a900460ff16151561151d57fe5b611526816120d6565b60108054600160a060020a031916905560006011555b5b5b50565b601054601154600160a060020a039091169082565b600e5481565b600d5481565b60096020526000908152604090205481565b6000806005600b5414156115b55761158a6113aa565b6000818152600a60205260409020549091506115ae90600160a060020a0316611ba6565b91506115ba565b600091505b5b5090565b60075433600160a060020a03908116911614156101e05760075460058054600160a060020a031916600160a060020a03928316908117918290557f4f67fe223bca69f22bf24552638f3c95bfb9e9763c4a33a3aa67a46484d81c2b929190911690604051600160a060020a039283168152911660208201526040908101905180910390a160078054600160a060020a03191690555b5b565b60055433600160a060020a0390811691161461166f57fe5b60128190555b5b50565b600554600160a060020a031681565b60075460a060020a900460ff161561169c57fe5b3415156116a557fe5b600160a060020a03331660009081526009602052604090205415156116c657fe5b6116ce61299f565b600160a060020a0333166000908152600960209081526040808320548352600a9091529020600101805434908101909155600c805490910190555b5b5b5b565b60055433600160a060020a0390811691161461172657fe5b60078054600160a060020a031916600160a060020a0383161790555b5b50565b601580548290811061175457fe5b906000526020600020900160005b5054905081565b6005546000908190819033600160a060020a0390811691161461178857fe5b8484600080825184511461179b57600080fd5b5060009050805b83518110156117e5578281815181106117b757fe5b906020019060200201518482815181106117cd57fe5b9060200190602002015102820191505b6001016117a2565b61271082146117f057fe5b6118197f3000000000000000000000000000000000000000000000000000000000000000612b2d565b61182560146000613a0c565b61183160156000613a0c565b600096506000199550600094505b88518510156118c957601480546001810161185a8382613a2e565b916000526020600020900160005b8b888151811061187457fe5b9060200190602002015190915550899050858151811061189057fe5b9060200190602002015187106118a557600080fd5b8885815181106118b157fe5b9060200190602002015196505b60019094019361183f565b600094505b87518510156119585760158054600181016118e98382613a2e565b916000526020600020900160005b8a888151811061190357fe5b9060200190602002015190915550889050858151811061191f57fe5b90602001906020020151861161193457600080fd5b87858151811061194057fe5b9060200190602002015195505b6001909401936118ce565b5b5b505050505b5050505050565b600c5481565b600654600160a060020a031681565b60055433600160a060020a0390811691161461199357fe5b62035b6081810110156119a257fe5b6161a88111156119ae57fe5b6123288110156119ba57fe5b60088190557f5e0a6049b21a63b67799dfcd81d31721fd026db51cb7dc7707972678741434e28160405190815260200160405180910390a15b5b50565b6005546000908190819033600160a060020a03908116911614611a1657fe5b601054600160a060020a03161515611a2a57fe5b60075460a060020a900460ff161515611a3f57fe5b601154426203f4809091011115611a5257fe5b5050600160a060020a0330163160015b600b548111611ab3576000818152600a602052604090206002015460ff16151560011415611aaa576000818152600a60205260409020600201805460ff191690556001909201915b5b600101611a62565b600b546064906050025b048310611b7457601054600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515611b2f57601054600160a060020a03167f0fd1ed783bf9505e3fc2545a18e022b8bd048d240d98a3c959646ccebd569b3960405160405180910390a2611b6f565b601054600160a060020a03167fe0376e740df28d6cbdef46880b37136bc75e027766e3295d4af8a44c557ae7328360405190815260200160405180910390a25b611b79565b600080fd5b5b5b5b5b5b505050565b601480548290811061175457fe5b906000526020600020900160005b5054905081565b600160a060020a0381166000908152600960209081526040808320548352600a9091528120600101548180611bda85610cee565b9150611be585610d39565b9050818284011080611bf8575082828401105b80611c04575080828401105b15611c125760009350610ce5565b80828401039350610ce5565b5b505050919050565b60055433600160a060020a03908116911614611c3f57fe5b600160a060020a0381161515611c5157fe5b60068054600160a060020a031916600160a060020a0383811691909117918290557fb750ac854b12114073b8c76dcfe5fb889b30db5d3d60e07abc8ae66c349d7a68911682604051600160a060020a039283168152911660208201526040908101905180910390a15b5b50565b60075460009060a060020a900460ff1615611cd557fe5b341515611cde57fe5b600160a060020a03331660009081526009602052604090205415611cfe57fe5b611d06611574565b3411611d0e57fe5b611d1661299f565b6005600b541415611d4d57611d296113aa565b6000818152600a6020526040902054909150611d4d90600160a060020a03166120d6565b5b600b805460010190819055611d6290612c61565b5b600b546005901115610e3457fe5b5b5b5b5b5b50565b600080600061271060156000815481101515611d9157fe5b906000526020600020900160005b5054850261264802811515611db057fe5b049150612710611dbe610b1f565b60fa02811515611dca57fe5b049050808211158015611ddf57506012548410155b92505b5050919050565b6000611df3613a58565b611dfb613a58565b611e03613a58565b6000611e0d613a6a565b6000881580611e1c5750602089115b15611e2657600080fd5b6001604051805910611e355750595b908082528060200260200182016040525b5095508860f860020a0286600081518110611e5d57fe5b906020010190600160f860020a031916908160001a9053506020604051805910611e845750595b908082528060200260200182016040525b5094506020604051805910611ea75750595b908082528060200260200182016040525b509350611ec3612ce1565b925060208552424118600143034018602086015260208452826020850152606060405190810160405280868152602001878152602001858152509150611f2a8a604080519081016040526006815260d060020a6572616e646f6d026020820152848b612dfd565b90506120c58178010000000000000000000000000000000000000000000000008c028460015b602002015160028660005b60200201516000604051602001526040518082805190602001908083835b60208310611f9957805182525b601f199092019160209182019101611f79565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515611fdb57600080fd5b5050604051805190508660025b602002015160405177ffffffffffffffffffffffffffffffffffffffffffffffff19851681526008810184805190602001908083835b6020831061203e57805182525b601f19909201916020918201910161201e565b6001836020036101000a038019825116818451161790925250505091909101848152602001905082805190602001908083835b6020831061209157805182525b601f199092019160209182019101612071565b6001836020036101000a03801982511681845116179092525050509190910195506040945050505050518091039020612f86565b8096505b5050505050509392505050565b6000806000806120e461299f565b600160a060020a038516600090815260096020526040902054935061210885611ba6565b6000858152600a6020526040902060010154600c5491945090106122a2576000848152600a6020526040902060010154600c8054919091039055612710603284025b6000868152600a602090815260408083208054600160a060020a031916815560018101849055600201805460ff19169055600160a060020a038a1683526009909152812055600b549190049384900393925084146122365750600b80546000908152600a602081815260408084208054600160a060020a039081168652600984528286208a90558986529390925280842082548154600160a060020a03199081169190951617815560018084015482820155600280850154928101805460ff909416151560ff199485161790559654865291852080549094168455908301939093559201805490911690555b600b805460001901905561224a85846127d8565b60065461226090600160a060020a0316836127d8565b84600160a060020a03167f3026a12843449d7e7377f8932a40bdb5d1b1125efbfbe147132016f8beac0f348460405190815260200160405180910390a26122f3565b6007805474ff0000000000000000000000000000000000000000191660a060020a1790557f52e578ad17dc8fe0ff456fdf1f81516f7d29eb85fff301475a3a29d0e84bb31a60405160405180910390a15b5b600b54600590111561136457fe5b5b5050505050565b60008054600160a060020a03161580612335575060005461233390600160a060020a0316612fed565b155b15612346576123446000612ff5565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561238f57600080fd5b6102c65a03f115156123a057600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063c281d19e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561240557600080fd5b6102c65a03f1151561241657600080fd5b50505060405180519150505b5b90565b61242e613a58565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124c45780601f10612499576101008083540402835291602001916124c4565b820191906000526020600020905b8154815290600101906020018083116124a757829003601f168201915b505050505090505b90565b600082815260136020526040812060010154819081908190819081805b82600202821015612676576201000089836001018151811061250a57fe5b016020015160f860020a900460f860020a0260f860020a90048a848151811061252f57fe5b016020015160f860020a900460f860020a0260f860020a900461010002016127100281151561255a57fe5b0494506000935060009550600090505b6014548110156125ef57601480548290811061258257fe5b906000526020600020900160005b505484019350838510156125e657826015828154811015156125ae57fe5b906000526020600020900160005b505460008c815260136020526040902060020154028115156125da57fe5b049687019695506125ef565b5b60010161256a565b60008a8152601360205260409020547f405cae3bae941220d231f4d221b4ff6bb7f6ee66de2fd6181104259128a593ff908b90600160a060020a03166002855b04888a604051948552600160a060020a0390931660208501526040808501929092526060840152608083019190915260a0909101905180910390a15b6002820191506124ec565b8697505b5050505050505092915050565b600080808061271060c886025b049350612710603286025b0492506126b56126af8686613334565b84613334565b91506126c18284613348565b6000878152601360205260409020600201549091508110612707576000868152601360205260409020600201546126f9908290613334565b600e8054909101905561272d565b6000868152601360205260409020600201546127239082613334565b600d805490910190555b60008681526013602052604090819020547fb1de74d6528a1c53509c4031af62848bc1575ee110b7001025e9736fca97ccf6918891600160a060020a031690859051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a16000868152601360205260409020546127b990600160a060020a0316836127d8565b600654610ae190600160a060020a0316846127d8565b5b505050505050565b801515612810577f4763e3feef50167ae1957a20ba2b75b5f4093062392e81d5e351b709b1d8261f60405160405180910390a1610ef2565b8030600160a060020a0316311015612853577f504b0ae89b95779262e99243870eb936180a8c33b444f17f01807c40a20c7aa760405160405180910390a1610ef2565b81600160a060020a031660085482604051600060405180830381858888f193505050501515612954577f949201d78c50a6b453f7068ed19a5c7d74aaa07c12cadfd3855357a0b0f474058282604051600160a060020a03909216825260208201526040908101905180910390a1600654600160a060020a0383811691161461295457600654600854600160a060020a039091169082604051600060405180830381858888f193505050501515612954576006547f949201d78c50a6b453f7068ed19a5c7d74aaa07c12cadfd3855357a0b0f4740590600160a060020a031682604051600160a060020a03909216825260208201526040908101905180910390a15b5b5b7fc7e416c5685d8971558840f05c5e63e02575b29997d8da6b9ba44dc10da6a3708282604051600160a060020a03909216825260208201526040908101905180910390a15b5050565b600f54600090819081908190819060ff16156129ba57611364565b600193505b600b548411612b09576000848152600a6020526040902054600160a060020a031692506129eb83610cee565b91506129f683610d39565b6000858152600a602052604090206001015490915082810110801590612a3057506000848152600a60205260409020600101548201819010155b15612a95576000848152600a6020526040908190206001018054838503908101909155600160a060020a038516917f8ff49347da9034aab52b79ac6b2ba8cf17d221516834af5e5fa04bef1df4d7cd91905190815260200160405180910390a2612ae6565b6007805474ff0000000000000000000000000000000000000000191660a060020a1790557f52e578ad17dc8fe0ff456fdf1f81516f7d29eb85fff301475a3a29d0e84bb31a60405160405180910390a15b6000848152600a602052604090206001015494909401935b6001909301926129bf565b6000600d819055600e55600c859055600f805460ff191660011790555b5050505050565b600054600160a060020a03161580612b575750600054612b5590600160a060020a0316612fed565b155b15612b6857612b666000612ff5565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612bb157600080fd5b6102c65a03f11515612bc257600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063688dcfd78260405160e060020a63ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b1515612c4857600080fd5b6102c65a03f1151561136657600080fd5b5050505b5b50565b600160a060020a0333166000818152600960209081526040808320859055848352600a909152908190208054600160a060020a03191683178155346001909101819055600c8054820190557fa4a46f45c9996c78320ae470714f930acba653b022fddec1735c1400209780e4915190815260200160405180910390a25b50565b60008054600160a060020a03161580612d0c5750600054612d0a90600160a060020a0316612fed565b155b15612d1d57612d1b6000612ff5565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612d6657600080fd5b6102c65a03f11515612d7757600080fd5b505050604051805160018054600160a060020a031916600160a060020a03928316179081905516905063abaa5f3e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561240557600080fd5b6102c65a03f1151561241657600080fd5b50505060405180519150505b5b90565b6000612e07613a58565b600054600160a060020a03161580612e315750600054612e2f90600160a060020a0316612fed565b155b15612e4257612e406000612ff5565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612e8b57600080fd5b6102c65a03f11515612e9c57600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055506003604051805910612ed45750595b908082528060200260200182016040528015612f0a57816020015b612ef7613a58565b815260200190600190039081612eef5790505b5090508360005b602002015181600081518110612f2357fe5b602090810290910101528360015b602002015181600181518110612f4357fe5b602090810290910101528360025b602002015181600281518110612f6357fe5b60209081029091010152612f798686838661335c565b91505b5b50949350505050565b601754600160a060020a03166396fe6e74838360405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b1515612fd457600080fd5b6102c65a03f1151561136457600080fd5b5050505b5050565b803b5b919050565b600080613015731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed612fed565b11156130855760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905561307d60408051908101604052600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152613676565b506001610d2e565b60006130a473c03a2615d5efaf5f49f60b7bb6583eaec212fdf1612fed565b11156131145760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905561307d60408051908101604052600c81527f6574685f726f707374656e3300000000000000000000000000000000000000006020820152613676565b506001610d2e565b600061313373b7a07bcf2ba2f2703b24c0691b5278999c59ac7e612fed565b11156131a35760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905561307d60408051908101604052600981527f6574685f6b6f76616e00000000000000000000000000000000000000000000006020820152613676565b506001610d2e565b60006131c273146500cfd35b22e4a392fe0adc06de1a1368ed48612fed565b11156132325760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905561307d60408051908101604052600b81527f6574685f72696e6b6562790000000000000000000000000000000000000000006020820152613676565b506001610d2e565b6000613251736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475612fed565b1115613285575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001610d2e565b60006132a47320e12a1f859b3feae5fb2a0a32c18f5a65555bbf612fed565b11156132d8575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001610d2e565b60006132f77351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa612fed565b111561332b575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001610d2e565b5060005b919050565b8082038281111561334157fe5b5b92915050565b8082018281101561334157fe5b5b92915050565b600080613367613a58565b600054600160a060020a03161580613391575060005461338f90600160a060020a0316612fed565b155b156133a2576133a06000612ff5565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156133eb57600080fd5b6102c65a03f115156133fc57600080fd5b505050604051805160018054600160a060020a031916600160a060020a039283161790819055169050632ef3accc87866000604051602001526040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561348b5780820151818401525b602001613472565b50505050905090810190601f1680156134b85780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15156134d757600080fd5b6102c65a03f115156134e857600080fd5b5050506040518051925050670de0b6b3a76400003a850201821115613510576000925061366b565b6135198561368e565b600154909150600160a060020a031663c55c1cb683898985896000604051602001526040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561359b5780820151818401525b602001613582565b50505050905090810190601f1680156135c85780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156135ff5780820151818401525b6020016135e6565b50505050905090810190601f16801561362c5780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b151561364d57600080fd5b6125ee5a03f1151561365e57600080fd5b5050505060405180519350505b5b5050949350505050565b6002818051610ef2929160200190613acd565b505b50565b613696613a58565b6000806136a1613a58565b60008060006136ae613a58565b60008060008b51995060009850896040518059106136c95750595b9080825280602002602001820160405280156136ff57816020015b6136ec613a58565b8152602001906001900390816136e45790505b509750600096505b8987101561378c578b878151811061371b57fe5b9060200190602002015188888151811061373157fe5b602090810290910101526017600189898151811061374b57fe5b90602001906020020151510381151561376057fe5b0488888151811061376d57fe5b906020019060200201515101600301890198505b600190960195613707565b600198909801976000955060808a019450886040518059106137ab5750595b908082528060200260200182016040525b5093505b6001869011156138125760f860020a850286600181106137dc57fe5b1a60f860020a028487815181106137ef57fe5b906020010190600160f860020a031916908160001a9053506001909501946137c0565b600096505b898710156139f9577f5f0000000000000000000000000000000000000000000000000000000000000084878151811061384c57fe5b906020010190600160f860020a031916908160001a905350600190950194600092505b87878151811061387b57fe5b90602001906020020151518310156139a2576017835b061515613938576018838989815181106138a757fe5b90602001906020020151510310156138d757828888815181106138c657fe5b9060200190602002015151036138da565b60175b60400191508590505b808603600111156139385760f860020a82028187036001811061390257fe5b1a60f860020a0284878151811061391557fe5b906020010190600160f860020a031916908160001a9053506001909501946138e3565b5b87878151811061394557fe5b90602001906020020151838151811061395a57fe5b016020015160f860020a900460f860020a0284878151811061397857fe5b906020010190600160f860020a031916908160001a9053506001909501945b60019092019161386f565b7fff000000000000000000000000000000000000000000000000000000000000008487815181106139cf57fe5b906020010190600160f860020a031916908160001a9053506001909501945b600190960195613817565b839a505b50505050505050505050919050565b5080546000825590600052602060002090810190610e349190613b4c565b5b50565b815481835581811511611b7957600083815260209020611b79918101908301613b4c565b5b505050565b60206040519081016040526000815290565b60606040519081016040526003815b613a81613a58565b815260200190600190039081613a795790505090565b60206040519081016040526000815290565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613b0e57805160ff1916838001178555613b3b565b82800160010185558215613b3b579182015b82811115613b3b578251825591602001919060010190613b20565b5b506115ba929150613b4c565b5090565b610b6491905b808211156115ba5760008155600101613b52565b5090565b905600a165627a7a7230582004b351faf9227fddda70702bba1a8b658da02b17da04eefcf9bb4563687528cf0029000000000000000000000000aa8786eecd289fa7dd48a35ea31493bb67626623

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

-----Decoded View---------------
Found 1 constructor arguments :
Arg [0] : 000000000000000000000000aa8786eecd289fa7dd48a35ea31493bb67626623


   Swarm Source:
bzzr://04b351faf9227fddda70702bba1a8b658da02b17da04eefcf9bb4563687528cf

 

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.