Sponsored:   [Largest VC Funded] TEMCO, millions sold out in seconds. Join TEMCO's last presale at CoinBene!
Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 1392 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0xab58d311c31231444224cae5b2f335b061817d7fat txn 0xb32d5b2dc249971ed348bb909df49078ae64aa9d7a6afd900fff00222d6904c0
Token Balance:
 Latest 25 transactions from a total of 1392 transactions

TxHash Age From To Value [TxFee]
0x7fbe070cf25695f76c81c48376a576e1b7eb213fb6bb7b15a40071fe088f1565105 days 16 hrs ago0xa66bd8a5729e9277ddf79c5ca149d8eac421f138  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00023441
0x15bf8f74ead9f4813cc1f4cf4de545026cc1aed2020e3b5ea5ee6b16a3eda410145 days 14 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00066422
0x192c3b3a4dc2e889fb699f532386c03706f9965d34a5965b6509e2f69aa53e92150 days 16 hrs ago0xab58d311c31231444224cae5b2f335b061817d7f  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.000110884
0xc85a6be6e5994ac7fe2c56e3519041453260303d7bfd220238bca3bdb39cb0c9154 days 5 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.0220416
0x3d7579c85275c0947afd31af131d3fb21ffa3baf76b66fe4ca2c23c57405f1d8154 days 5 hrs ago0xab58d311c31231444224cae5b2f335b061817d7f  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.54 Ether0.00314458
0xc2bb63d2ca99c39d933b2dbabdad7ba988113ea80bf476c6cd6786e5d30c31fe154 days 5 hrs ago0xab58d311c31231444224cae5b2f335b061817d7f  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00039429
0xfe1264e4acb35925cbbb348f6d9d9b35724393a317da4f169fbbba701c30ef1a154 days 5 hrs ago0xab58d311c31231444224cae5b2f335b061817d7f  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00031413
0x537de30e59431d5da0281851d27012e24353de772ba1aefca73cb86f1ebdd770154 days 9 hrs ago0xab58d311c31231444224cae5b2f335b061817d7f  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.6 Ether0.00314458
0x7aaaef165568d8356eb1be97bbd2eb55f8986c3a4312fc87c638f88886810ab7155 days 5 hrs ago0x092d4abc4fe283ae85202b713af07efa843c9ad4  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.027 Ether0.00023469
0x0347ac35399635b02bf8879c78857a6d91711912d856832717ce22da5f1fa1f7155 days 5 hrs ago0x092d4abc4fe283ae85202b713af07efa843c9ad4  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0275 Ether0.00023469
0x5d454b6e7453fc7386d32420f0c623732fc59757a97c7999dde3e57bd16b9036155 days 8 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00231079
0xf273a0867e48ce2dbdbdd322cd8450ef781d35feddd269690ae764637f5fc5d6155 days 10 hrs ago0x2c06b5596c1f29b9a7b147e99bd065ffe6cda8ec  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.18 Ether0.00314522
0x7dcab3d68dc0d722251eded6d9d6f5b4fdb5e84f8b09f02ab8beda3a784d8d7b155 days 11 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00827617
0x1c5855a4129bd0797e95bc02578cb55acf86a0053316d271aa5f3d8c90b91c4b155 days 11 hrs ago0x2c06b5596c1f29b9a7b147e99bd065ffe6cda8ec  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.45 Ether0.00314522
0x958a8fa2bc19707aa1ca8ff32d3a2b2640baba4bbab4970a1bb0825e359edf36156 days 23 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00034132
0xde73f333ad2a80fe17426769a705df6c3a93fdb565abdaaa259cd1013827c2da157 days 1 min agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00133405
0x6ec07ac8802933d52681ef509fbc169f6f219c95bc10b6e08281553e9329c6ff157 days 1 min agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00142783
0xde60b7ab1406951a0fab2ae1653c72ef062f1d81b363c8d5d00fa6aab65870fb157 days 4 mins agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00066288
0x1dc7f360bcee5850558d3f62ff4420915091493de90c7ec6d009027a6e9865a5157 days 5 mins agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.00148706
0x973b88c605af465d755db509828762987fbfeee118a86523bc8ce7c281c27c65157 days 10 mins agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.0018701
0xbc83037e6f88bdeef57e56d975156cfa245703865210bf68ec7770644068d335157 days 10 mins agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.0018902
0xd09db9aece66b4cea7ec2a8e013494e6c78013427324235757eca38d69afdcce157 days 1 hr ago0xd3b7ee3a78e0d6b29a4ec8d05892ad44c253b2a4  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.1 Ether0.00300587
0x5ee1059a512fc80dc4dad8b1a75f32c17271190d179eb3ae71dc80b32c047247157 days 1 hr ago0xd3b7ee3a78e0d6b29a4ec8d05892ad44c253b2a4  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.03 Ether0.002404184
0xcdff169a902c4784dac3a693d662c7718dd01c99b413d67c5be65da62674a354157 days 5 hrs agoOraclize  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630 Ether0.0019505
0xca1afd213ce23b10b887916ac13d9e0c229a9ed5b4bc0e5bdd411de91542f8fe157 days 12 hrs ago0xd05f4f3ac5f3ca39b1765fe19e2146d6d99ee8cf  IN   0xb533ff572f5e33d04d02b149e7dcfe980e424c630.035939746255223 Ether0.00315651
[ 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
0x53dd9ab140224d308c14f718f759e7b0168858a82459249c28f039d4fd50fb736093994130 days 16 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630xab58d311c31231444224cae5b2f335b061817d7f0.031968 Ether
0xc85a6be6e5994ac7fe2c56e3519041453260303d7bfd220238bca3bdb39cb0c95954818154 days 5 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.508032 Ether
0x3d7579c85275c0947afd31af131d3fb21ffa3baf76b66fe4ca2c23c57405f1d85954809154 days 5 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0365369871366144 Ether
0x3d7579c85275c0947afd31af131d3fb21ffa3baf76b66fe4ca2c23c57405f1d85954809154 days 5 hrs ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0365369871366144 Ether
0xfe1264e4acb35925cbbb348f6d9d9b35724393a317da4f169fbbba701c30ef1a5954802154 days 5 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630xab58d311c31231444224cae5b2f335b061817d7f0.6 Ether
0x537de30e59431d5da0281851d27012e24353de772ba1aefca73cb86f1ebdd7705953777154 days 9 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0122545871366144 Ether
0x537de30e59431d5da0281851d27012e24353de772ba1aefca73cb86f1ebdd7705953777154 days 9 hrs ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0122545871366144 Ether
0x4b60d28653c1c5e35a402de39927626916c4fe89ab01520dea7f873148bd0ded5953504154 days 10 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630xab58d311c31231444224cae5b2f335b061817d7f0.083034510782025072 Ether
0x5d454b6e7453fc7386d32420f0c623732fc59757a97c7999dde3e57bd16b90365948009155 days 8 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.17424 Ether
0xf273a0867e48ce2dbdbdd322cd8450ef781d35feddd269690ae764637f5fc5d65947415155 days 10 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0070083587345408 Ether
0xf273a0867e48ce2dbdbdd322cd8450ef781d35feddd269690ae764637f5fc5d65947415155 days 10 hrs ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0070083587345408 Ether
0x7dcab3d68dc0d722251eded6d9d6f5b4fdb5e84f8b09f02ab8beda3a784d8d7b5947404155 days 11 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.4116 Ether
0x1c5855a4129bd0797e95bc02578cb55acf86a0053316d271aa5f3d8c90b91c4b5947400155 days 11 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0100233587345408 Ether
0x1c5855a4129bd0797e95bc02578cb55acf86a0053316d271aa5f3d8c90b91c4b5947400155 days 11 hrs ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0100233587345408 Ether
0xde73f333ad2a80fe17426769a705df6c3a93fdb565abdaaa259cd1013827c2da5938377157 days 1 min ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.09968 Ether
0x6ec07ac8802933d52681ef509fbc169f6f219c95bc10b6e08281553e9329c6ff5938374157 days 1 min ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.029952 Ether
0x1dc7f360bcee5850558d3f62ff4420915091493de90c7ec6d009027a6e9865a55938357157 days 5 mins ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.035767235473198358 Ether
0xd09db9aece66b4cea7ec2a8e013494e6c78013427324235757eca38d69afdcce5937966157 days 1 hr ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0020034587345408 Ether
0xd09db9aece66b4cea7ec2a8e013494e6c78013427324235757eca38d69afdcce5937966157 days 1 hr ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0020034587345408 Ether
0x5ee1059a512fc80dc4dad8b1a75f32c17271190d179eb3ae71dc80b32c0472475937966157 days 1 hr ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0020235587345408 Ether
0x5ee1059a512fc80dc4dad8b1a75f32c17271190d179eb3ae71dc80b32c0472475937966157 days 1 hr ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0020235587345408 Ether
0xca1afd213ce23b10b887916ac13d9e0c229a9ed5b4bc0e5bdd411de91542f8fe5935329157 days 12 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0020838587345408 Ether
0xca1afd213ce23b10b887916ac13d9e0c229a9ed5b4bc0e5bdd411de91542f8fe5935329157 days 12 hrs ago0x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0xb533ff572f5e33d04d02b149e7dcfe980e424c630.0020838587345408 Ether
0xa7faed640bd8011cf74b02054035c203c68d577659d399b284f82ea1245f5f6a5873703168 days 2 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x06adba5ad6c494e536cad8afa1129ab9f7cb99bf0.059904 Ether
0x4d9002301671d93001b8d93e4ac353b047dff904133c611a072bf1a390a701625873700168 days 2 hrs ago0xb533ff572f5e33d04d02b149e7dcfe980e424c630x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.0012674787345408 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: EOSBetDice
Compiler Text: v0.4.21+commit.dfe3193c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.21;

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) external payable returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) external payable returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) public payable returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) external payable returns (bytes32 _id);
    function queryN(uint _timestamp, string _datasource, bytes _argN) public payable returns (bytes32 _id);
    function queryN_withGasLimit(uint _timestamp, string _datasource, bytes _argN, uint _gaslimit) external payable returns (bytes32 _id);
    function getPrice(string _datasource) public returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) public returns (uint _dsprice);
    function setProofType(byte _proofType) external;
    function setCustomGasPrice(uint _gasPrice) external;
    function randomDS_getSessionPubKeyHash() external constant returns(bytes32);
}
contract OraclizeAddrResolverI {
    function getAddress() public returns (address _addr);
}
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);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function stra2cbor(string[] arr) internal pure 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 pure 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 view returns (string) {
        return oraclize_network_name;
    }

    function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
        require((_nbytes > 0) && (_nbytes <= 32));
        // Convert from seconds to ledger timer ticks
        _delay *= 10; 
        bytes memory nbytes = new bytes(1);
        nbytes[0] = byte(_nbytes);
        bytes memory unonce = new bytes(32);
        bytes memory sessionKeyHash = new bytes(32);
        bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
        assembly {
            mstore(unonce, 0x20)
            mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
            mstore(sessionKeyHash, 0x20)
            mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
        }
        bytes memory delay = new bytes(32);
        assembly { 
            mstore(add(delay, 0x20), _delay) 
        }
        
        bytes memory delay_bytes8 = new bytes(8);
        copyBytes(delay, 24, 8, delay_bytes8, 0);

        bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay];
        bytes32 queryId = oraclize_query("random", args, _customGasLimit);
        
        bytes memory delay_bytes8_left = new bytes(8);
        
        assembly {
            let x := mload(add(delay_bytes8, 0x20))
            mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000))
            mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000))

        }
        
        oraclize_randomDS_setCommitment(queryId, keccak256(delay_bytes8_left, args[1], sha256(args[0]), args[2]));
        return queryId;
    }
    
    function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal {
        oraclize_randomDS_args[queryId] = commitment;
    }

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

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

        bytes32 sigr;
        bytes32 sigs;

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

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


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

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

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

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

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

        if (sigok == false) return false;


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

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

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

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

        return sigok;
    }

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

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

        _;
    }

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

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

        return 0;
    }

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

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

        return match_;
    }

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

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

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

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

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

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

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


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

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

        return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash];
    }

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

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

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

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

        return to;
    }

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

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

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

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

        return (ret, addr);
    }

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

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

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

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

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

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

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

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

}
// </ORACLIZE_API>

contract EOSBetGameInterface {
	uint256 public DEVELOPERSFUND;
	uint256 public LIABILITIES;
	function payDevelopersFund(address developer) public;
	function receivePaymentForOraclize() payable public;
	function getMaxWin() public view returns(uint256);
}

contract EOSBetBankrollInterface {
	function payEtherToWinner(uint256 amtEther, address winner) public;
	function receiveEtherFromGameAddress() payable public;
	function payOraclize(uint256 amountToPay) public;
	function getBankroll() public view returns(uint256);
}

contract ERC20 {
	function totalSupply() constant public returns (uint supply);
	function balanceOf(address _owner) constant public returns (uint balance);
	function transfer(address _to, uint _value) public returns (bool success);
	function transferFrom(address _from, address _to, uint _value) public returns (bool success);
	function approve(address _spender, uint _value) public returns (bool success);
	function allowance(address _owner, address _spender) constant public returns (uint remaining);
	event Transfer(address indexed _from, address indexed _to, uint _value);
	event Approval(address indexed _owner, address indexed _spender, uint _value);
}

contract EOSBetBankroll is ERC20, EOSBetBankrollInterface {

	using SafeMath for *;

	// constants for EOSBet Bankroll

	address public OWNER;
	uint256 public MAXIMUMINVESTMENTSALLOWED;
	uint256 public WAITTIMEUNTILWITHDRAWORTRANSFER;
	uint256 public DEVELOPERSFUND;

	// this will be initialized as the trusted game addresses which will forward their ether
	// to the bankroll contract, and when players win, they will request the bankroll contract 
	// to send these players their winnings.
	// Feel free to audit these contracts on etherscan...
	mapping(address => bool) public TRUSTEDADDRESSES;

	address public DICE;
	address public SLOTS;

	// mapping to log the last time a user contributed to the bankroll 
	mapping(address => uint256) contributionTime;

	// constants for ERC20 standard
	string public constant name = "EOSBet Stake Tokens";
	string public constant symbol = "EOSBETST";
	uint8 public constant decimals = 18;
	// variable total supply
	uint256 public totalSupply;

	// mapping to store tokens
	mapping(address => uint256) public balances;
	mapping(address => mapping(address => uint256)) public allowed;

	// events
	event FundBankroll(address contributor, uint256 etherContributed, uint256 tokensReceived);
	event CashOut(address contributor, uint256 etherWithdrawn, uint256 tokensCashedIn);
	event FailedSend(address sendTo, uint256 amt);

	// checks that an address is a "trusted address of a legitimate EOSBet game"
	modifier addressInTrustedAddresses(address thisAddress){

		require(TRUSTEDADDRESSES[thisAddress]);
		_;
	}

	// initialization function 
	function EOSBetBankroll(address dice, address slots) public payable {
		// function is payable, owner of contract MUST "seed" contract with some ether, 
		// so that the ratios are correct when tokens are being minted
		require (msg.value > 0);

		OWNER = msg.sender;

		// 100 tokens/ether is the inital seed amount, so:
		uint256 initialTokens = msg.value * 100;
		balances[msg.sender] = initialTokens;
		totalSupply = initialTokens;

		// log a mint tokens event
		emit Transfer(0x0, msg.sender, initialTokens);

		// insert given game addresses into the TRUSTEDADDRESSES mapping, and save the addresses as global variables
		TRUSTEDADDRESSES[dice] = true;
		TRUSTEDADDRESSES[slots] = true;

		DICE = dice;
		SLOTS = slots;

		WAITTIMEUNTILWITHDRAWORTRANSFER = 6 hours;
		MAXIMUMINVESTMENTSALLOWED = 500 ether;
	}

	///////////////////////////////////////////////
	// VIEW FUNCTIONS
	/////////////////////////////////////////////// 

	function checkWhenContributorCanTransferOrWithdraw(address bankrollerAddress) view public returns(uint256){
		return contributionTime[bankrollerAddress];
	}

	function getBankroll() view public returns(uint256){
		// returns the total balance minus the developers fund, as the amount of active bankroll
		return SafeMath.sub(address(this).balance, DEVELOPERSFUND);
	}

	///////////////////////////////////////////////
	// BANKROLL CONTRACT <-> GAME CONTRACTS functions
	/////////////////////////////////////////////// 

	function payEtherToWinner(uint256 amtEther, address winner) public addressInTrustedAddresses(msg.sender){
		// this function will get called by a game contract when someone wins a game
		// try to send, if it fails, then send the amount to the owner
		// note, this will only happen if someone is calling the betting functions with
		// a contract. They are clearly up to no good, so they can contact us to retreive 
		// their ether
		// if the ether cannot be sent to us, the OWNER, that means we are up to no good, 
		// and the ether will just be given to the bankrollers as if the player/owner lost 

		if (! winner.send(amtEther)){

			emit FailedSend(winner, amtEther);

			if (! OWNER.send(amtEther)){

				emit FailedSend(OWNER, amtEther);
			}
		}
	}

	function receiveEtherFromGameAddress() payable public addressInTrustedAddresses(msg.sender){
		// this function will get called from the game contracts when someone starts a game.
	}

	function payOraclize(uint256 amountToPay) public addressInTrustedAddresses(msg.sender){
		// this function will get called when a game contract must pay payOraclize
		EOSBetGameInterface(msg.sender).receivePaymentForOraclize.value(amountToPay)();
	}

	///////////////////////////////////////////////
	// BANKROLL CONTRACT MAIN FUNCTIONS
	///////////////////////////////////////////////


	// this function ADDS to the bankroll of EOSBet, and credits the bankroller a proportional
	// amount of tokens so they may withdraw their tokens later
	// also if there is only a limited amount of space left in the bankroll, a user can just send as much 
	// ether as they want, because they will be able to contribute up to the maximum, and then get refunded the rest.
	function () public payable {

		// save in memory for cheap access.
		// this represents the total bankroll balance before the function was called.
		uint256 currentTotalBankroll = SafeMath.sub(getBankroll(), msg.value);
		uint256 maxInvestmentsAllowed = MAXIMUMINVESTMENTSALLOWED;

		require(currentTotalBankroll < maxInvestmentsAllowed && msg.value != 0);

		uint256 currentSupplyOfTokens = totalSupply;
		uint256 contributedEther;

		bool contributionTakesBankrollOverLimit;
		uint256 ifContributionTakesBankrollOverLimit_Refund;

		uint256 creditedTokens;

		if (SafeMath.add(currentTotalBankroll, msg.value) > maxInvestmentsAllowed){
			// allow the bankroller to contribute up to the allowed amount of ether, and refund the rest.
			contributionTakesBankrollOverLimit = true;
			// set contributed ether as (MAXIMUMINVESTMENTSALLOWED - BANKROLL)
			contributedEther = SafeMath.sub(maxInvestmentsAllowed, currentTotalBankroll);
			// refund the rest of the ether, which is (original amount sent - (maximum amount allowed - bankroll))
			ifContributionTakesBankrollOverLimit_Refund = SafeMath.sub(msg.value, contributedEther);
		}
		else {
			contributedEther = msg.value;
		}
        
		if (currentSupplyOfTokens != 0){
			// determine the ratio of contribution versus total BANKROLL.
			creditedTokens = SafeMath.mul(contributedEther, currentSupplyOfTokens) / currentTotalBankroll;
		}
		else {
			// edge case where ALL money was cashed out from bankroll
			// so currentSupplyOfTokens == 0
			// currentTotalBankroll can == 0 or not, if someone mines/selfdestruct's to the contract
			// but either way, give all the bankroll to person who deposits ether
			creditedTokens = SafeMath.mul(contributedEther, 100);
		}
		
		// now update the total supply of tokens and bankroll amount
		totalSupply = SafeMath.add(currentSupplyOfTokens, creditedTokens);

		// now credit the user with his amount of contributed tokens 
		balances[msg.sender] = SafeMath.add(balances[msg.sender], creditedTokens);

		// update his contribution time for stake time locking
		contributionTime[msg.sender] = block.timestamp;

		// now look if the attempted contribution would have taken the BANKROLL over the limit, 
		// and if true, refund the excess ether.
		if (contributionTakesBankrollOverLimit){
			msg.sender.transfer(ifContributionTakesBankrollOverLimit_Refund);
		}

		// log an event about funding bankroll
		emit FundBankroll(msg.sender, contributedEther, creditedTokens);

		// log a mint tokens event
		emit Transfer(0x0, msg.sender, creditedTokens);
	}

	function cashoutEOSBetStakeTokens(uint256 _amountTokens) public {
		// In effect, this function is the OPPOSITE of the un-named payable function above^^^
		// this allows bankrollers to "cash out" at any time, and receive the ether that they contributed, PLUS
		// a proportion of any ether that was earned by the smart contact when their ether was "staking", However
		// this works in reverse as well. Any net losses of the smart contract will be absorbed by the player in like manner.
		// Of course, due to the constant house edge, a bankroller that leaves their ether in the contract long enough
		// is effectively guaranteed to withdraw more ether than they originally "staked"

		// save in memory for cheap access.
		uint256 tokenBalance = balances[msg.sender];
		// verify that the contributor has enough tokens to cash out this many, and has waited the required time.
		require(_amountTokens <= tokenBalance 
			&& contributionTime[msg.sender] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
			&& _amountTokens > 0);

		// save in memory for cheap access.
		// again, represents the total balance of the contract before the function was called.
		uint256 currentTotalBankroll = getBankroll();
		uint256 currentSupplyOfTokens = totalSupply;

		// calculate the token withdraw ratio based on current supply 
		uint256 withdrawEther = SafeMath.mul(_amountTokens, currentTotalBankroll) / currentSupplyOfTokens;

		// developers take 1% of withdrawls 
		uint256 developersCut = withdrawEther / 100;
		uint256 contributorAmount = SafeMath.sub(withdrawEther, developersCut);

		// now update the total supply of tokens by subtracting the tokens that are being "cashed in"
		totalSupply = SafeMath.sub(currentSupplyOfTokens, _amountTokens);

		// and update the users supply of tokens 
		balances[msg.sender] = SafeMath.sub(tokenBalance, _amountTokens);

		// update the developers fund based on this calculated amount 
		DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);

		// lastly, transfer the ether back to the bankroller. Thanks for your contribution!
		msg.sender.transfer(contributorAmount);

		// log an event about cashout
		emit CashOut(msg.sender, contributorAmount, _amountTokens);

		// log a destroy tokens event
		emit Transfer(msg.sender, 0x0, _amountTokens);
	}

	// TO CALL THIS FUNCTION EASILY, SEND A 0 ETHER TRANSACTION TO THIS CONTRACT WITH EXTRA DATA: 0x7a09588b
	function cashoutEOSBetStakeTokens_ALL() public {

		// just forward to cashoutEOSBetStakeTokens with input as the senders entire balance
		cashoutEOSBetStakeTokens(balances[msg.sender]);
	}

	////////////////////
	// OWNER FUNCTIONS:
	////////////////////
	// Please, be aware that the owner ONLY can change:
		// 1. The owner can increase or decrease the target amount for a game. They can then call the updater function to give/receive the ether from the game.
		// 1. The wait time until a user can withdraw or transfer their tokens after purchase through the default function above ^^^
		// 2. The owner can change the maximum amount of investments allowed. This allows for early contributors to guarantee
		// 		a certain percentage of the bankroll so that their stake cannot be diluted immediately. However, be aware that the 
		//		maximum amount of investments allowed will be raised over time. This will allow for higher bets by gamblers, resulting
		// 		in higher dividends for the bankrollers
		// 3. The owner can freeze payouts to bettors. This will be used in case of an emergency, and the contract will reject all
		//		new bets as well. This does not mean that bettors will lose their money without recompense. They will be allowed to call the 
		// 		"refund" function in the respective game smart contract once payouts are un-frozen.
		// 4. Finally, the owner can modify and withdraw the developers reward, which will fund future development, including new games, a sexier frontend,
		// 		and TRUE DAO governance so that onlyOwner functions don't have to exist anymore ;) and in order to effectively react to changes 
		// 		in the market (lower the percentage because of increased competition in the blockchain casino space, etc.)

	function transferOwnership(address newOwner) public {
		require(msg.sender == OWNER);

		OWNER = newOwner;
	}

	function changeWaitTimeUntilWithdrawOrTransfer(uint256 waitTime) public {
		// waitTime MUST be less than or equal to 10 weeks
		require (msg.sender == OWNER && waitTime <= 6048000);

		WAITTIMEUNTILWITHDRAWORTRANSFER = waitTime;
	}

	function changeMaximumInvestmentsAllowed(uint256 maxAmount) public {
		require(msg.sender == OWNER);

		MAXIMUMINVESTMENTSALLOWED = maxAmount;
	}


	function withdrawDevelopersFund(address receiver) public {
		require(msg.sender == OWNER);

		// first get developers fund from each game 
        EOSBetGameInterface(DICE).payDevelopersFund(receiver);
		EOSBetGameInterface(SLOTS).payDevelopersFund(receiver);

		// now send the developers fund from the main contract.
		uint256 developersFund = DEVELOPERSFUND;

		// set developers fund to zero
		DEVELOPERSFUND = 0;

		// transfer this amount to the owner!
		receiver.transfer(developersFund);
	}

	// rescue tokens inadvertently sent to the contract address 
	function ERC20Rescue(address tokenAddress, uint256 amtTokens) public {
		require (msg.sender == OWNER);

		ERC20(tokenAddress).transfer(msg.sender, amtTokens);
	}

	///////////////////////////////
	// BASIC ERC20 TOKEN OPERATIONS
	///////////////////////////////

	function totalSupply() constant public returns(uint){
		return totalSupply;
	}

	function balanceOf(address _owner) constant public returns(uint){
		return balances[_owner];
	}

	// don't allow transfers before the required wait-time
	// and don't allow transfers to this contract addr, it'll just kill tokens
	function transfer(address _to, uint256 _value) public returns (bool success){
		require(balances[msg.sender] >= _value 
			&& contributionTime[msg.sender] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
			&& _to != address(this)
			&& _to != address(0));

		// safely subtract
		balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
		balances[_to] = SafeMath.add(balances[_to], _value);

		// log event 
		emit Transfer(msg.sender, _to, _value);
		return true;
	}

	// don't allow transfers before the required wait-time
	// and don't allow transfers to the contract addr, it'll just kill tokens
	function transferFrom(address _from, address _to, uint _value) public returns(bool){
		require(allowed[_from][msg.sender] >= _value 
			&& balances[_from] >= _value 
			&& contributionTime[_from] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
			&& _to != address(this)
			&& _to != address(0));

		// safely add to _to and subtract from _from, and subtract from allowed balances.
		balances[_to] = SafeMath.add(balances[_to], _value);
   		balances[_from] = SafeMath.sub(balances[_from], _value);
  		allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);

  		// log event
		emit Transfer(_from, _to, _value);
		return true;
   		
	}
	
	function approve(address _spender, uint _value) public returns(bool){

		allowed[msg.sender][_spender] = _value;
		emit Approval(msg.sender, _spender, _value);
		// log event
		return true;
	}
	
	function allowance(address _owner, address _spender) constant public returns(uint){
		return allowed[_owner][_spender];
	}
}

pragma solidity ^0.4.18;


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

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

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

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

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

contract EOSBetDice is usingOraclize, EOSBetGameInterface {

	using SafeMath for *;

	// events
	event BuyRolls(bytes32 indexed oraclizeQueryId);
	event LedgerProofFailed(bytes32 indexed oraclizeQueryId);
	event Refund(bytes32 indexed oraclizeQueryId, uint256 amount);
	event DiceSmallBet(uint16 actualRolls, uint256 data1, uint256 data2, uint256 data3, uint256 data4);
	event DiceLargeBet(bytes32 indexed oraclizeQueryId, uint16 actualRolls, uint256 data1, uint256 data2, uint256 data3, uint256 data4);

	// game data structure
	struct DiceGameData {
		address player;
		bool paidOut;
		uint256 start;
		uint256 etherReceived;
		uint256 betPerRoll;
		uint16 rolls;
		uint8 rollUnder;
	}

	mapping (bytes32 => DiceGameData) public diceData;

	// ether in this contract can be in one of two locations:
	uint256 public LIABILITIES;
	uint256 public DEVELOPERSFUND;

	// counters for frontend statistics
	uint256 public AMOUNTWAGERED;
	uint256 public GAMESPLAYED;
	
	// togglable values
	uint256 public ORACLIZEQUERYMAXTIME;
	uint256 public MINBET_perROLL;
	uint256 public MINBET_perTX;
	uint256 public ORACLIZEGASPRICE;
	uint256 public INITIALGASFORORACLIZE;
	uint8 public HOUSEEDGE_inTHOUSANDTHPERCENTS; // 1 thousanthpercent == 1/1000, 
	uint8 public MAXWIN_inTHOUSANDTHPERCENTS; // determines the maximum win a user may receive.

	// togglable functionality of contract
	bool public GAMEPAUSED;
	bool public REFUNDSACTIVE;

	// owner of contract
	address public OWNER;

	// bankroller address
	address public BANKROLLER;

	// constructor
	function EOSBetDice() public {
		// ledger proof is ALWAYS verified on-chain
		oraclize_setProof(proofType_Ledger);

		// gas prices for oraclize call back, can be changed
		oraclize_setCustomGasPrice(8000000000);
		ORACLIZEGASPRICE = 8000000000;
		INITIALGASFORORACLIZE = 300000;

		AMOUNTWAGERED = 0;
		GAMESPLAYED = 0;

		GAMEPAUSED = false;
		REFUNDSACTIVE = true;

		ORACLIZEQUERYMAXTIME = 6 hours;
		MINBET_perROLL = 20 finney;
		MINBET_perTX = 100 finney;
		HOUSEEDGE_inTHOUSANDTHPERCENTS = 5; // 5/1000 == 0.5% house edge
		MAXWIN_inTHOUSANDTHPERCENTS = 20; // 20/1000 == 2.0% of bankroll can be won in a single bet, will be lowered once there is more investors
		OWNER = msg.sender;
	}

	////////////////////////////////////
	// INTERFACE CONTACT FUNCTIONS
	////////////////////////////////////

	function payDevelopersFund(address developer) public {
		require(msg.sender == BANKROLLER);

		uint256 devFund = DEVELOPERSFUND;

		DEVELOPERSFUND = 0;

		developer.transfer(devFund);
	}

	// just a function to receive eth, only allow the bankroll to use this
	function receivePaymentForOraclize() payable public {
		require(msg.sender == BANKROLLER);
	}

	////////////////////////////////////
	// VIEW FUNCTIONS
	////////////////////////////////////

	function getMaxWin() public view returns(uint256){
		return (SafeMath.mul(EOSBetBankrollInterface(BANKROLLER).getBankroll(), MAXWIN_inTHOUSANDTHPERCENTS) / 1000);
	}

	////////////////////////////////////
	// OWNER ONLY FUNCTIONS
	////////////////////////////////////

	// WARNING!!!!! Can only set this function once!
	function setBankrollerContractOnce(address bankrollAddress) public {
		// require that BANKROLLER address == 0 (address not set yet), and coming from owner.
		require(msg.sender == OWNER && BANKROLLER == address(0));

		// check here to make sure that the bankroll contract is legitimate
		// just make sure that calling the bankroll contract getBankroll() returns non-zero

		require(EOSBetBankrollInterface(bankrollAddress).getBankroll() != 0);

		BANKROLLER = bankrollAddress;
	}

	function transferOwnership(address newOwner) public {
		require(msg.sender == OWNER);

		OWNER = newOwner;
	}

	function setOraclizeQueryMaxTime(uint256 newTime) public {
		require(msg.sender == OWNER);

		ORACLIZEQUERYMAXTIME = newTime;
	}

	// store the gas price as a storage variable for easy reference,
	// and then change the gas price using the proper oraclize function
	function setOraclizeQueryGasPrice(uint256 gasPrice) public {
		require(msg.sender == OWNER);

		ORACLIZEGASPRICE = gasPrice;
		oraclize_setCustomGasPrice(gasPrice);
	}

	// should be ~175,000 to save eth
	function setInitialGasForOraclize(uint256 gasAmt) public {
		require(msg.sender == OWNER);

		INITIALGASFORORACLIZE = gasAmt;
	}

	function setGamePaused(bool paused) public {
		require(msg.sender == OWNER);

		GAMEPAUSED = paused;
	}

	function setRefundsActive(bool active) public {
		require(msg.sender == OWNER);

		REFUNDSACTIVE = active;
	}

	function setHouseEdge(uint8 houseEdgeInThousandthPercents) public {
		// house edge cannot be set > 5%, can be set to zero for promotions
		require(msg.sender == OWNER && houseEdgeInThousandthPercents <= 50);

		HOUSEEDGE_inTHOUSANDTHPERCENTS = houseEdgeInThousandthPercents;
	}

	function setMinBetPerRoll(uint256 minBet) public {
		require(msg.sender == OWNER && minBet > 1000);

		MINBET_perROLL = minBet;
	}

	function setMinBetPerTx(uint256 minBet) public {
		require(msg.sender == OWNER && minBet > 1000);

		MINBET_perTX = minBet;
	}

	function setMaxWin(uint8 newMaxWinInThousandthPercents) public {
		// cannot set bet limit greater than 5% of total BANKROLL.
		require(msg.sender == OWNER && newMaxWinInThousandthPercents <= 50);

		MAXWIN_inTHOUSANDTHPERCENTS = newMaxWinInThousandthPercents;
	}

	// rescue tokens inadvertently sent to the contract address 
	function ERC20Rescue(address tokenAddress, uint256 amtTokens) public {
		require (msg.sender == OWNER);

		ERC20(tokenAddress).transfer(msg.sender, amtTokens);
	}

	// require that the query time is too slow, bet has not been paid out, and either contract owner or player is calling this function.
	// this will only be used/can occur on queries that are forwarded to oraclize in the first place. All others will be paid out immediately.
	function refund(bytes32 oraclizeQueryId) public {
		// store data in memory for easy access.
		DiceGameData memory data = diceData[oraclizeQueryId];

		require(block.timestamp - data.start >= ORACLIZEQUERYMAXTIME
			&& (msg.sender == OWNER || msg.sender == data.player)
			&& (!data.paidOut)
			&& LIABILITIES >= data.etherReceived
			&& data.etherReceived > 0
			&& REFUNDSACTIVE);

		// set paidout == true, so users can't request more refunds, and a super delayed oraclize __callback will just get reverted
		diceData[oraclizeQueryId].paidOut = true;

		// subtract etherReceived because the bet is being refunded
		LIABILITIES = SafeMath.sub(LIABILITIES, data.etherReceived);

		// then transfer the original bet to the player.
		data.player.transfer(data.etherReceived);

		// finally, log an event saying that the refund has processed.
		emit Refund(oraclizeQueryId, data.etherReceived);
	}

	function play(uint256 betPerRoll, uint16 rolls, uint8 rollUnder) public payable {

		// store in memory for cheaper access
		uint256 minBetPerTx = MINBET_perTX;

		require(!GAMEPAUSED
				&& betPerRoll * rolls >= minBetPerTx
				&& msg.value >= minBetPerTx
				&& betPerRoll >= MINBET_perROLL
				&& rolls > 0
				&& rolls <= 1024
				&& betPerRoll <= msg.value
				&& rollUnder > 1
				&& rollUnder < 98
				// make sure that the player cannot win more than the max win (forget about house edge here)
				&& (SafeMath.mul(betPerRoll, 100) / (rollUnder - 1)) <= getMaxWin());

		// equation for gas to oraclize is:
		// gas = (some fixed gas amt) + 1005 * rolls

		uint256 gasToSend = INITIALGASFORORACLIZE + (uint256(1005) * rolls);

		EOSBetBankrollInterface(BANKROLLER).payOraclize(oraclize_getPrice('random', gasToSend));

		// oraclize_newRandomDSQuery(delay in seconds, bytes of random data, gas for callback function)
		bytes32 oraclizeQueryId = oraclize_newRandomDSQuery(0, 30, gasToSend);

		diceData[oraclizeQueryId] = DiceGameData({
			player : msg.sender,
			paidOut : false,
			start : block.timestamp,
			etherReceived : msg.value,
			betPerRoll : betPerRoll,
			rolls : rolls,
			rollUnder : rollUnder
		});

		// add the sent value into liabilities. this should NOT go into the bankroll yet
		// and must be quarantined here to prevent timing attacks
		LIABILITIES = SafeMath.add(LIABILITIES, msg.value);

		// log an event
		emit BuyRolls(oraclizeQueryId);
	}

	// oraclize callback.
	// Basically do the instant bet resolution in the play(...) function above, but with the random data 
	// that oraclize returns, instead of getting psuedo-randomness from block.blockhash 
	function __callback(bytes32 _queryId, string _result, bytes _proof) public {

		DiceGameData memory data = diceData[_queryId];
		// only need to check these, as all of the game based checks were already done in the play(...) function 
		require(msg.sender == oraclize_cbAddress() 
			&& !data.paidOut 
			&& data.player != address(0) 
			&& LIABILITIES >= data.etherReceived);

		// if the proof has failed, immediately refund the player his original bet...
		if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0){

			if (REFUNDSACTIVE){
				// set contract data
				diceData[_queryId].paidOut = true;

				// if the call fails, then subtract the original value sent from liabilites and amount wagered, and then send it back
				LIABILITIES = SafeMath.sub(LIABILITIES, data.etherReceived);

				// transfer the original bet
				data.player.transfer(data.etherReceived);

				// log the refund
				emit Refund(_queryId, data.etherReceived);
			}
			// log the ledger proof fail
			emit LedgerProofFailed(_queryId);
			
		}
		// else, resolve the bet as normal with this miner-proof proven-randomness from oraclize.
		else {
			// save these in memory for cheap access
			uint8 houseEdgeInThousandthPercents = HOUSEEDGE_inTHOUSANDTHPERCENTS;

			// set the current balance available to the player as etherReceived
			uint256 etherAvailable = data.etherReceived;

			// logs for the frontend, as before...
			uint256[] memory logsData = new uint256[](4);

			// this loop is highly similar to the one from before. Instead of fully documented, the differences will be pointed out instead.
			uint256 winnings;
			uint16 gamesPlayed;

			// get this value outside of the loop for gas costs sake
			uint256 hypotheticalWinAmount = SafeMath.mul(SafeMath.mul(data.betPerRoll, 100), (1000 - houseEdgeInThousandthPercents)) / (data.rollUnder - 1) / 1000;

			while (gamesPlayed < data.rolls && etherAvailable >= data.betPerRoll){
				
				// now, this roll is keccak256(_result, nonce) + 1 ... this is the main difference from using oraclize.

				if (uint8(uint256(keccak256(_result, gamesPlayed)) % 100) + 1 < data.rollUnder){

					// now, just get the respective fields from data.field unlike before where they were in seperate variables.
					winnings = hypotheticalWinAmount;

					// assemble logs...
					if (gamesPlayed <= 255){
						logsData[0] += uint256(2) ** (255 - gamesPlayed);
					}
					else if (gamesPlayed <= 511){
						logsData[1] += uint256(2) ** (511 - gamesPlayed);
					}
					else if (gamesPlayed <= 767){
						logsData[2] += uint256(2) ** (767 - gamesPlayed);
					}
					else {
						logsData[3] += uint256(2) ** (1023 - gamesPlayed);
					}
				}
				else {
					//  leave 1 wei as a consolation prize :)
					winnings = 1;
				}
				gamesPlayed++;
				
				etherAvailable = SafeMath.sub(SafeMath.add(etherAvailable, winnings), data.betPerRoll);
			}

			// track that these games were played
			GAMESPLAYED += gamesPlayed;

			// and add the amount wagered
			AMOUNTWAGERED = SafeMath.add(AMOUNTWAGERED, SafeMath.mul(data.betPerRoll, gamesPlayed));

			// IMPORTANT: we must change the "paidOut" to TRUE here to prevent reentrancy/other nasty effects.
			// this was not needed with the previous loop/code block, and is used because variables must be written into storage
			diceData[_queryId].paidOut = true;

			// decrease LIABILITIES when the spins are made
			LIABILITIES = SafeMath.sub(LIABILITIES, data.etherReceived);

			// get the developers cut, and send the rest of the ether received to the bankroller contract
			uint256 developersCut = SafeMath.mul(SafeMath.mul(data.betPerRoll, houseEdgeInThousandthPercents), gamesPlayed) / 5000;

			// add the devs cut to the developers fund.
			DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);

			EOSBetBankrollInterface(BANKROLLER).receiveEtherFromGameAddress.value(SafeMath.sub(data.etherReceived, developersCut))();

			// force the bankroller contract to pay out the player
			EOSBetBankrollInterface(BANKROLLER).payEtherToWinner(etherAvailable, data.player);

			// log an event, now with the oraclize query id
			emit DiceLargeBet(_queryId, gamesPlayed, logsData[0], logsData[1], logsData[2], logsData[3]);
		}
	}

// END OF CONTRACT. REPORT ANY BUGS TO [email protected]
// YES! WE _DO_ HAVE A BUG BOUNTY PROGRAM!

// THANK YOU FOR READING THIS CONTRACT, HAVE A NICE DAY :)

}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"newTime","type":"uint256"}],"name":"setOraclizeQueryMaxTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAXWIN_inTHOUSANDTHPERCENTS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"HOUSEEDGE_inTHOUSANDTHPERCENTS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DEVELOPERSFUND","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"LIABILITIES","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"houseEdgeInThousandthPercents","type":"uint8"}],"name":"setHouseEdge","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"OWNER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"AMOUNTWAGERED","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"REFUNDSACTIVE","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"minBet","type":"uint256"}],"name":"setMinBetPerTx","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_queryId","type":"bytes32"},{"name":"_result","type":"string"},{"name":"_proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"diceData","outputs":[{"name":"player","type":"address"},{"name":"paidOut","type":"bool"},{"name":"start","type":"uint256"},{"name":"etherReceived","type":"uint256"},{"name":"betPerRoll","type":"uint256"},{"name":"rolls","type":"uint16"},{"name":"rollUnder","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newMaxWinInThousandthPercents","type":"uint8"}],"name":"setMaxWin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"oraclizeQueryId","type":"bytes32"}],"name":"refund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ORACLIZEQUERYMAXTIME","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"developer","type":"address"}],"name":"payDevelopersFund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"gasPrice","type":"uint256"}],"name":"setOraclizeQueryGasPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMaxWin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"receivePaymentForOraclize","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"betPerRoll","type":"uint256"},{"name":"rolls","type":"uint16"},{"name":"rollUnder","type":"uint8"}],"name":"play","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"BANKROLLER","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"paused","type":"bool"}],"name":"setGamePaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MINBET_perTX","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"bankrollAddress","type":"address"}],"name":"setBankrollerContractOnce","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MINBET_perROLL","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"amtTokens","type":"uint256"}],"name":"ERC20Rescue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ORACLIZEGASPRICE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"minBet","type":"uint256"}],"name":"setMinBetPerRoll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIALGASFORORACLIZE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"GAMEPAUSED","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"GAMESPLAYED","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"active","type":"bool"}],"name":"setRefundsActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"gasAmt","type":"uint256"}],"name":"setInitialGasForOraclize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oraclizeQueryId","type":"bytes32"}],"name":"BuyRolls","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oraclizeQueryId","type":"bytes32"}],"name":"LedgerProofFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oraclizeQueryId","type":"bytes32"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"actualRolls","type":"uint16"},{"indexed":false,"name":"data1","type":"uint256"},{"indexed":false,"name":"data2","type":"uint256"},{"indexed":false,"name":"data3","type":"uint256"},{"indexed":false,"name":"data4","type":"uint256"}],"name":"DiceSmallBet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"oraclizeQueryId","type":"bytes32"},{"indexed":false,"name":"actualRolls","type":"uint16"},{"indexed":false,"name":"data1","type":"uint256"},{"indexed":false,"name":"data2","type":"uint256"},{"indexed":false,"name":"data3","type":"uint256"},{"indexed":false,"name":"data4","type":"uint256"}],"name":"DiceLargeBet","type":"event"}]

  Contract Creation Code Switch To Opcodes View
606060405234156200001057600080fd5b620000497f300000000000000000000000000000000000000000000000000000000000000064010000000062003d67620000fd82021704565b620000676401dcd65000640100000000620019b16200030982021704565b6401dcd65000600f55620493e06010556000600a819055600b5560118054615460600c5566470de4df820000600d5567016345785d8a0000600e55630100000063ffff0000199091161760ff191660051761ff001916611400177fffffffffffffffff0000000000000000000000000000000000000000ffffffff1664010000000033600160a060020a0316021790556200099f565b600054600160a060020a031615806200013857506000546200013690600160a060020a0316640100000000620021b4620004e082021704565b155b156200015a57620001586000640100000000620021b8620004e482021704565b505b600054600160a060020a03166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515620001b357600080fd5b5af11515620001c157600080fd5b5050506040518051600154600160a060020a0390811691161490506200027257600054600160a060020a03166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200023a57600080fd5b5af115156200024857600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663688dcfd7826040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b1515620002f557600080fd5b5af115156200030357600080fd5b50505050565b600054600160a060020a031615806200034457506000546200034290600160a060020a0316640100000000620021b4620004e082021704565b155b156200036657620003646000640100000000620021b8620004e482021704565b505b600054600160a060020a03166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515620003bf57600080fd5b5af11515620003cd57600080fd5b5050506040518051600154600160a060020a0390811691161490506200047e57600054600160a060020a03166338cc48316040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200044657600080fd5b5af115156200045457600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663ca6ad1e4826040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b1515620002f557600080fd5b3b90565b6000620004fe64010000000062002b816200050482021704565b92915050565b60008062000534731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed640100000000620021b4620004e082021704565b1115620005b65760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed179055620005ad60408051908101604052600b81527f6574685f6d61696e6e657400000000000000000000000000000000000000000060208201526401000000006200388a620008e482021704565b506001620008e1565b6000620005e573c03a2615d5efaf5f49f60b7bb6583eaec212fdf1640100000000620021b4620004e082021704565b11156200065e5760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf1179055620005ad60408051908101604052600c81527f6574685f726f707374656e33000000000000000000000000000000000000000060208201526401000000006200388a620008e482021704565b60006200068d73b7a07bcf2ba2f2703b24c0691b5278999c59ac7e640100000000620021b4620004e082021704565b1115620007065760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e179055620005ad60408051908101604052600981527f6574685f6b6f76616e000000000000000000000000000000000000000000000060208201526401000000006200388a620008e482021704565b60006200073573146500cfd35b22e4a392fe0adc06de1a1368ed48640100000000620021b4620004e082021704565b1115620007ae5760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed48179055620005ad60408051908101604052600b81527f6574685f72696e6b65627900000000000000000000000000000000000000000060208201526401000000006200388a620008e482021704565b6000620007dd736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475640100000000620021b4620004e082021704565b111562000813575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001620008e1565b6000620008427320e12a1f859b3feae5fb2a0a32c18f5a65555bbf640100000000620021b4620004e082021704565b111562000878575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001620008e1565b6000620008a77351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa640100000000620021b4620004e082021704565b1115620008dd575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001620008e1565b5060005b90565b6002818051620008f9929160200190620008fd565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200094057805160ff191683800117855562000970565b8280016001018555821562000970579182015b828111156200097057825182559160200191906001019062000953565b506200097e92915062000982565b5090565b620008e191905b808211156200097e576000815560010162000989565b613f1880620009af6000396000f30060606040526004361061019d5763ffffffff60e060020a60003504166301f9a0aa81146101a257806306784b81146101ba578063076a39a0146101e357806307efbf2b146101f657806309b481b01461021b5780630c5597571461022e578063117803e31461024757806313d73a08146102765780631fbd9a0b1461028957806327dc297e146102b05780633119255c1461030657806338bbfa501461031c578063416bc745146103b45780635eeeee22146104185780637249fbb6146104315780637ea17a1d146104475780638579c10e1461045a5780638aa19ef71461047957806391a1f16a1461048f578063a3b9b8d1146104a2578063a73c0ba2146104aa578063aefbbf2a146104c2578063b5c14adb146104d5578063ba2d5c88146104ed578063cc783c5e14610500578063cf4315bb1461051f578063dab7882014610532578063dbfc74cb14610554578063e0a82ea814610567578063ef2e73211461057d578063f2fde38b14610590578063f331020c146105af578063fab2e425146105c2578063fb87eb0b146105d5578063fc0e64de146105ed575b600080fd5b34156101ad57600080fd5b6101b8600435610603565b005b34156101c557600080fd5b6101cd61062b565b60405160ff909116815260200160405180910390f35b34156101ee57600080fd5b6101cd610639565b341561020157600080fd5b610209610642565b60405190815260200160405180910390f35b341561022657600080fd5b610209610648565b341561023957600080fd5b6101b860ff6004351661064e565b341561025257600080fd5b61025a610699565b604051600160a060020a03909116815260200160405180910390f35b341561028157600080fd5b6102096106b0565b341561029457600080fd5b61029c6106b6565b604051901515815260200160405180910390f35b34156102bb57600080fd5b6101b8600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506106c695505050505050565b341561031157600080fd5b6101b86004356106f8565b341561032757600080fd5b6101b8600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061072f95505050505050565b34156103bf57600080fd5b6103ca600435610d94565b604051600160a060020a03909716875294151560208701526040808701949094526060860192909252608085015261ffff1660a084015260ff90911660c083015260e0909101905180910390f35b341561042357600080fd5b6101b860ff60043516610de4565b341561043c57600080fd5b6101b8600435610e35565b341561045257600080fd5b61020961100a565b341561046557600080fd5b6101b8600160a060020a0360043516611010565b341561048457600080fd5b6101b8600435611069565b341561049a57600080fd5b61020961109d565b6101b861111f565b6101b860043561ffff6024351660ff6044351661113c565b34156104cd57600080fd5b61025a6113f3565b34156104e057600080fd5b6101b86004351515611402565b34156104f857600080fd5b610209611441565b341561050b57600080fd5b6101b8600160a060020a0360043516611447565b341561052a57600080fd5b610209611502565b341561053d57600080fd5b6101b8600160a060020a0360043516602435611508565b341561055f57600080fd5b61020961159a565b341561057257600080fd5b6101b86004356115a0565b341561058857600080fd5b6102096115d7565b341561059b57600080fd5b6101b8600160a060020a03600435166115dd565b34156105ba57600080fd5b61029c61163b565b34156105cd57600080fd5b61020961164a565b34156105e057600080fd5b6101b86004351515611650565b34156105f857600080fd5b6101b8600435611691565b60115433600160a060020a03908116640100000000909204161461062657600080fd5b600c55565b601154610100900460ff1681565b60115460ff1681565b60095481565b60085481565b60115433600160a060020a0390811664010000000090920416148015610678575060328160ff1611155b151561068357600080fd5b6011805460ff191660ff92909216919091179055565b6011546401000000009004600160a060020a031681565b600a5481565b6011546301000000900460ff1681565b6106f4828260006040518059106106da5750595b818152601f19601f8301168101602001604052905061072f565b5050565b60115433600160a060020a039081166401000000009092041614801561071f57506103e881115b151561072a57600080fd5b600e55565b610737613c54565b600080610742613c90565b60008781526007602052604080822082918291829160e0905190810160409081528254600160a060020a038116835260ff60a060020a909104811615156020840152600184015491830191909152600283015460608301526003830154608083015260049092015461ffff811660a083015262010000900490911660c082015297506107cc6116b9565b600160a060020a031633600160a060020a03161480156107ee57508760200151155b8015610805575060008851600160a060020a031614155b80156108175750876060015160085410155b151561082257600080fd5b61082d8b8b8b611830565b60ff161561092e576011546301000000900460ff16156108fc5760008b8152600760205260409020805474ff0000000000000000000000000000000000000000191660a060020a1790556008546108889060608a015161195a565b6008558751600160a060020a03166108fc89606001519081150290604051600060405180830381858888f1935050505015156108c357600080fd5b8a7fdda15e30b719d5c232faad22f4c2c1e8994336c026868ed0d3bc4aac71977abb60608a015160405190815260200160405180910390a25b8a7f2576aa524eff2f518901d6458ad267a59debacb7bf8700998dba20313f17dce660405160405180910390a2610d87565b60115460ff16965060608801519550600460405180591061094c5750595b908082528060200260200182016040525094506103e860018960c001510360ff1661099061097f8b60800151606461196c565b8a60ff166103e80361ffff1661196c565b81151561099957fe5b048115156109a357fe5b0491505b8760a0015161ffff168361ffff161080156109c6575087608001518610155b15610b5c578760c0015160ff1660648b856040518083805190602001908083835b60208310610a065780518252601f1990920191602091820191016109e7565b6001836020036101000a0380198251168184511680821785525050505050509050018261ffff1661ffff167e0100000000000000000000000000000000000000000000000000000000000002815260020192505050604051908190039020811515610a6d57fe5b0660010160ff161015610b335781935060ff8361ffff16111515610ab8578260ff0361ffff1660020a85600081518110610aa357fe5b90602001906020020181815101905250610b2e565b6101ff61ffff841611610ade57826101ff0361ffff1660020a85600181518110610aa357fe5b6102ff61ffff841611610b0457826102ff0361ffff1660020a85600281518110610aa357fe5b826103ff0361ffff1660020a85600381518110610b1d57fe5b906020019060200201818151019052505b610b38565b600193505b600190920191610b55610b4b87866119a2565b896080015161195a565b95506109a7565b600b805461ffff8516019055600a54610b8690610b8160808b01518661ffff1661196c565b6119a2565b600a5560008b8152600760205260409020805474ff0000000000000000000000000000000000000000191660a060020a179055600854610bca9060608a015161195a565b600855611388610bee610be460808b01518a60ff1661196c565b8561ffff1661196c565b811515610bf757fe5b049050610c06600954826119a2565b600955601254600160a060020a031663fbe00e8e610c2860608b01518461195a565b6040518263ffffffff1660e060020a0281526004016000604051808303818588803b1515610c5557600080fd5b5af11515610c6257600080fd5b5050601254600160a060020a0316915063becd05809050878a5160405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b1515610cc057600080fd5b5af11515610ccd57600080fd5b508c91507fb9d44d01b9e36e98413c2ed40b61f560e40595343f3cc734c988da4db5dd656390508487600081518110610d0257fe5b9060200190602002015188600181518110610d1957fe5b9060200190602002015189600281518110610d3057fe5b906020019060200201518a600381518110610d4757fe5b9060200190602002015160405161ffff909516855260208501939093526040808501929092526060840152608083019190915260a0909101905180910390a25b5050505050505050505050565b60076020526000908152604090208054600182015460028301546003840154600490940154600160a060020a0384169460ff60a060020a909504851694909161ffff811691620100009091041687565b60115433600160a060020a0390811664010000000090920416148015610e0e575060328160ff1611155b1515610e1957600080fd5b6011805460ff9092166101000261ff0019909216919091179055565b610e3d613c54565b600082815260076020526040908190209060e0905190810160409081528254600160a060020a038116835260ff60a060020a9091048116151560208401526001840154918301918252600284015460608401526003840154608084015260049093015461ffff811660a084015262010000900490921660c0820152600c549092509051420310158015610f02575060115433600160a060020a03908116640100000000909204161480610f0257508051600160a060020a031633600160a060020a0316145b8015610f1057508060200151155b8015610f225750806060015160085410155b8015610f32575060008160600151115b8015610f4757506011546301000000900460ff165b1515610f5257600080fd5b6000828152600760205260409020805474ff0000000000000000000000000000000000000000191660a060020a179055600854610f9390606083015161195a565b6008558051600160a060020a03166108fc82606001519081150290604051600060405180830381858888f193505050501515610fce57600080fd5b817fdda15e30b719d5c232faad22f4c2c1e8994336c026868ed0d3bc4aac71977abb606083015160405190815260200160405180910390a25050565b600c5481565b60125460009033600160a060020a0390811691161461102e57600080fd5b50600980546000909155600160a060020a03821681156108fc0282604051600060405180830381858888f1935050505015156106f457600080fd5b60115433600160a060020a03908116640100000000909204161461108c57600080fd5b600f81905561109a816119b1565b50565b6012546000906103e89061110f90600160a060020a0316630d1fce426040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156110e757600080fd5b5af115156110f457600080fd5b5050506040518051601154909150610100900460ff1661196c565b81151561111857fe5b0490505b90565b60125433600160a060020a0390811691161461113a57600080fd5b565b600e54601154600090819062010000900460ff161580156111635750828561ffff16870210155b801561116f5750823410155b801561117d5750600d548610155b801561118d575060008561ffff16115b801561119f57506104008561ffff1611155b80156111ab5750348611155b80156111ba575060018460ff16115b80156111c9575060628460ff16105b80156111f757506111d861109d565b6001850360ff166111ea88606461196c565b8115156111f357fe5b0411155b151561120257600080fd5b60105460125461ffff87166103ed029091019250600160a060020a03166366479c0861126160408051908101604052600681527f72616e646f6d0000000000000000000000000000000000000000000000000000602082015285611b28565b60405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561129757600080fd5b5af115156112a457600080fd5b5050506112b46000601e84611d16565b905060e06040519081016040908152600160a060020a0333168252600060208084018290524283850152346060850152608084018a905261ffff891660a085015260ff881660c0850152848252600790522081518154600160a060020a031916600160a060020a03919091161781556020820151815490151560a060020a0274ff00000000000000000000000000000000000000001990911617815560408201518160010155606082015181600201556080820151816003015560a082015160048201805461ffff191661ffff9290921691909117905560c08201518160040160026101000a81548160ff021916908360ff1602179055509050506113bb600854346119a2565b600855807f9ae1d678e016291b2e50d8a16a81efa0559e08e5b3e2db4d33def1a0c9d7120260405160405180910390a2505050505050565b601254600160a060020a031681565b60115433600160a060020a03908116640100000000909204161461142557600080fd5b60118054911515620100000262ff000019909216919091179055565b600e5481565b60115433600160a060020a03908116640100000000909204161480156114765750601254600160a060020a0316155b151561148157600080fd5b80600160a060020a0316630d1fce426040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156114be57600080fd5b5af115156114cb57600080fd5b5050506040518051151590506114e057600080fd5b60128054600160a060020a031916600160a060020a0392909216919091179055565b600d5481565b60115433600160a060020a03908116640100000000909204161461152b57600080fd5b81600160a060020a031663a9059cbb338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561157f57600080fd5b5af1151561158c57600080fd5b505050604051805150505050565b600f5481565b60115433600160a060020a03908116640100000000909204161480156115c757506103e881115b15156115d257600080fd5b600d55565b60105481565b60115433600160a060020a03908116640100000000909204161461160057600080fd5b60118054600160a060020a039092166401000000000277ffffffffffffffffffffffffffffffffffffffff0000000019909216919091179055565b60115462010000900460ff1681565b600b5481565b60115433600160a060020a03908116640100000000909204161461167357600080fd5b6011805491151563010000000263ff00000019909216919091179055565b60115433600160a060020a0390811664010000000090920416146116b457600080fd5b601055565b60008054600160a060020a031615806116e457506000546116e290600160a060020a03166121b4565b155b156116f5576116f360006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561173457600080fd5b5af1151561174157600080fd5b5050506040518051600154600160a060020a0390811691161490506117d657600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561179f57600080fd5b5af115156117ac57600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663c281d19e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561181557600080fd5b5af1151561182257600080fd5b505050604051805191505090565b6000808260008151811061184057fe5b016020015160f860020a900460f860020a02600160f860020a0319167f4c000000000000000000000000000000000000000000000000000000000000001415806118d257508260018151811061189257fe5b016020015160f860020a900460f860020a02600160f860020a0319167f500000000000000000000000000000000000000000000000000000000000000014155b8061191a5750826002815181106118e557fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000060f860020a9182900482021614155b156119285760019150611952565b61193b8386866119366121c8565b612270565b905080151561194d5760029150611952565b600091505b509392505050565b60008282111561196657fe5b50900390565b60008083151561197f576000915061199b565b5082820282848281151561198f57fe5b041461199757fe5b8091505b5092915050565b60008282018381101561199757fe5b600054600160a060020a031615806119db57506000546119d990600160a060020a03166121b4565b155b156119ec576119ea60006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611a2b57600080fd5b5af11515611a3857600080fd5b5050506040518051600154600160a060020a039081169116149050611acd57600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611a9657600080fd5b5af11515611aa357600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663ca6ad1e48260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b1515611b1557600080fd5b5af11515611b2257600080fd5b50505050565b60008054600160a060020a03161580611b535750600054611b5190600160a060020a03166121b4565b155b15611b6457611b6260006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611ba357600080fd5b5af11515611bb057600080fd5b5050506040518051600154600160a060020a039081169116149050611c4557600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611c0e57600080fd5b5af11515611c1b57600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a0316632ef3accc84846040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611cad578082015183820152602001611c95565b50505050905090810190601f168015611cda5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1515611cf957600080fd5b5af11515611d0657600080fd5b5050506040518051949350505050565b6000611d20613c90565b611d28613c90565b611d30613c90565b6000611d3a613c90565b611d42613c90565b611d4a613ca2565b6000611d54613c90565b60008c118015611d65575060208c11155b1515611d7057600080fd5b600a8d029c506001604051805910611d855750595b818152601f19601f8301168101602001604052905098508b60f860020a0289600081518110611db057fe5b906020010190600160f860020a031916908160001a9053506020604051805910611dd75750595b818152601f19601f8301168101602001604052905097506020604051805910611dfd5750595b818152601f19601f830116810160200160405290509650611e1c6127ca565b9550602088524241186001430340186020890152602087528560208801526020604051805910611e495750595b818152601f19601f8301168101602001604052905094508c60208601526008604051805910611e755750595b818152601f19601f830116810160200160405290509350611e9c8560186008876000612926565b506080604051908101604052808981526020018a8152602001888152602001868152509250611eff60408051908101604052600681527f72616e646f6d00000000000000000000000000000000000000000000000000006020820152848d61297b565b91506008604051805910611f105750595b8181526020601f909201601f191681018201604052915084015160f860020a810460278301537e01000000000000000000000000000000000000000000000000000000000000810460268301537d0100000000000000000000000000000000000000000000000000000000008104602583015360e060020a810460248301537b01000000000000000000000000000000000000000000000000000000810460238301537a0100000000000000000000000000000000000000000000000000008104602283015379010000000000000000000000000000000000000000000000000081046021830153780100000000000000000000000000000000000000000000000081046020830153506121a482826020860151600287516040518082805190602001908083835b602083106120575780518252601f199092019160209182019101612038565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1151561209557600080fd5b50506040518051905060408801516040518085805190602001908083835b602083106120d25780518252601f1990920191602091820191016120b3565b6001836020036101000a038019825116818451161790925250505091909101905084805190602001908083835b6020831061211e5780518252601f1990920191602091820191016120ff565b6001836020036101000a038019825116818451161790925250505091909101848152602001905082805190602001908083835b602083106121705780518252601f199092019160209182019101612151565b6001836020036101000a03801982511681845116179092525050509190910195506040945050505050518091039020612b6f565b509b9a5050505050505050505050565b3b90565b60006121c2612b81565b92915050565b6121d0613c90565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122665780601f1061223b57610100808354040283529160200191612266565b820191906000526020600020905b81548152906001019060200180831161224957829003601f168201915b5050505050905090565b60008061227b613c90565b612283613c90565b61228b613c90565b612293613c90565b60008061229e613c90565b8c6045815181106122ab57fe5b016020015160f860020a90819004810204606601975060206040518059106122d05750595b818152601f19601f8301168101602001604052905096506122f68d8960208a6000612926565b5060028a8d6040518083805190602001908083835b6020831061232a5780518252601f19909201916020918201910161230b565b6001836020036101000a038019825116818451161790925250505091909101928352505060209081019150604051808303816000865af1151561236c57600080fd5b505060405180519050604051908152602001604051908190039020876040518082805190602001908083835b602083106123b75780518252601f199092019160209182019101612398565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051908190039020146123f257600098506127ba565b8c604a89018151811061240157fe5b016020015160f860020a900460f860020a0260f860020a900460020160405180591061242a5750595b818152601f19601f8301168101602001604052905095506124538d896049018851896000612926565b506124fe6002876040518082805190602001908083835b602083106124895780518252601f19909201916020918201910161246a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af115156124c757600080fd5b5050604051805190508c8f60288c01815181106124e057fe5b016020015160f860020a900460f860020a0260f860020a9004612ea5565b151561250d57600098506127ba565b602960405180591061251c5750595b818152601f19601f8301168101602001604052905094506125458d896020016029886000612926565b50604080518059106125545750595b818152601f19601f83011681016020016040529050935085518860200160290101604101925061258c8d604085036040876000612926565b506002846040518082805190602001908083835b602083106125bf5780518252601f1990920191602091820191016125a0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af115156125fd57600080fd5b505060405180519050915084826040518083805190602001908083835b602083106126395780518252601f19909201916020918201910161261a565b6001836020036101000a0380198251168184511617909252505050919091019283525050602001905060405190819003902060008d81526003602052604090205414156126945760008c81526003602052604081205561269d565b600098506127ba565b60496040518059106126ac5750595b818152601f19601f8301168101602001604052905090506126d28d896049846000612926565b506127566002826040518082805190602001908083835b602083106127085780518252601f1990920191602091820191016126e9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1151561274657600080fd5b5050604051805190508786612f2b565b151561276557600098506127ba565b60008281526004602052604090205460ff1615156127a5576127878d84613144565b6000838152600460205260409020805460ff19169115159190911790555b60008281526004602052604090205460ff1698505b5050505050505050949350505050565b60008054600160a060020a031615806127f557506000546127f390600160a060020a03166121b4565b155b156128065761280460006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561284557600080fd5b5af1151561285257600080fd5b5050506040518051600154600160a060020a0390811691161490506128e757600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156128b057600080fd5b5af115156128bd57600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663abaa5f3e6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561181557600080fd5b61292e613c90565b838201600080828651101561294257600080fd5b505060208087019084015b86886020010182101561296e5781890151868201526020918201910161294d565b5093979650505050505050565b6000612985613c90565b600054600160a060020a031615806129af57506000546129ad90600160a060020a03166121b4565b155b156129c0576129be60006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156129ff57600080fd5b5af11515612a0c57600080fd5b5050506040518051600154600160a060020a039081169116149050612aa157600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612a6a57600080fd5b5af11515612a7757600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b6004604051805910612ab05750595b908082528060200260200182016040528015612ae657816020015b612ad3613c90565b815260200190600190039081612acb5790505b509050835181600081518110612af857fe5b60209081029091010152836001602002015181600181518110612b1757fe5b6020908102919091010152604084015181600281518110612b3457fe5b6020908102919091010152606084015181600381518110612b5157fe5b60209081029091010152612b66858285613526565b95945050505050565b60009182526003602052604090912055565b600080612ba1731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed6121b4565b1115612c115760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed179055612c0960408051908101604052600b81527f6574685f6d61696e6e6574000000000000000000000000000000000000000000602082015261388a565b50600161111c565b6000612c3073c03a2615d5efaf5f49f60b7bb6583eaec212fdf16121b4565b1115612c985760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf1179055612c0960408051908101604052600c81527f6574685f726f707374656e330000000000000000000000000000000000000000602082015261388a565b6000612cb773b7a07bcf2ba2f2703b24c0691b5278999c59ac7e6121b4565b1115612d1f5760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e179055612c0960408051908101604052600981527f6574685f6b6f76616e0000000000000000000000000000000000000000000000602082015261388a565b6000612d3e73146500cfd35b22e4a392fe0adc06de1a1368ed486121b4565b1115612da65760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed48179055612c0960408051908101604052600b81527f6574685f72696e6b656279000000000000000000000000000000000000000000602082015261388a565b6000612dc5736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4756121b4565b1115612df9575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475179055600161111c565b6000612e187320e12a1f859b3feae5fb2a0a32c18f5a65555bbf6121b4565b1115612e4c575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf179055600161111c565b6000612e6b7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa6121b4565b1115612e9f575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa179055600161111c565b50600090565b600060018183855114612eb757600080fd5b5060005b83811015612f1e57848181518110612ecf57fe5b016020015160f860020a900460f860020a02600160f860020a0319168682602081101515612ef957fe5b1a60f860020a02600160f860020a031916141515612f1657600091505b600101612ebb565b8192505b50509392505050565b6000806000806000612f3b613c90565b6000612f45613c90565b6020604051805910612f545750595b8181526020601f909201601f19168101820160405293508a600381518110612f7857fe5b016020015160f860020a900460f860020a0260f860020a9004036004019150612fa68a836020866000612926565b92506020604051805910612fb75750595b818152601f19601f83011681016020016040529050905060228201915061300f8a60208c6001860381518110612fe957fe5b016020015160f860020a900460f860020a0260f860020a90040384016020846000612926565b9050602083015194506020810151935061302c8b601b878761389d565b9097509550600160a060020a038616896040518082805190602001908083835b6020831061306b5780518252601f19909201916020918201910161304c565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051908190039020600160a060020a031614156130b05760019750613136565b6130bd8b601c878761389d565b9097509550600160a060020a038616896040518082805190602001908083835b602083106130fc5780518252601f1990920191602091820191016130dd565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051908190039020600160a060020a03161497505b505050505050509392505050565b60008061314f613c90565b613157613c90565b61315f613c90565b613167613c90565b61316f613c90565b613177613c90565b61317f613c90565b8a8a6001018151811061318e57fe5b016020015160f860020a900460f860020a0260f860020a90046002016040518059106131b75750595b818152601f19601f8301168101602001604052905096506131dd8b8b89518a6000612926565b50604080518059106131ec5750595b818152601f19601f8301168101602001604052905095506132138b60046040896000612926565b5060626040518059106132235750595b818152601f19601f83011681016020016040529050945060f860020a8560008151811061324c57fe5b906020010190600160f860020a031916908160001a9053506132768b60418c036041886001612926565b506040805190810160405280602081526020017ffd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c81525093506132bf8460006020886042612926565b506133436002866040518082805190602001908083835b602083106132f55780518252601f1990920191602091820191016132d6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1151561333357600080fd5b5050604051805190508888612f2b565b97508715156133555760009850613518565b606060405190810160405280604081526020017f7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e881526020017f537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4815250925060426040518059106133c35750595b818152601f19601f8301168101602001604052905091507ffe000000000000000000000000000000000000000000000000000000000000008260008151811061340857fe5b906020010190600160f860020a031916908160001a9053506134308b60036041856001612926565b508a60458151811061343e57fe5b016020015160f860020a900460f860020a0260f860020a90046002016040518059106134675750595b818152601f19601f83011681016020016040529050905061348e8b60448351846000612926565b506135126002836040518082805190602001908083835b602083106134c45780518252601f1990920191602091820191016134a5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1151561350257600080fd5b5050604051805190508285612f2b565b97508798505b505050505050505092915050565b600080613531613c90565b600054600160a060020a0316158061355b575060005461355990600160a060020a03166121b4565b155b1561356c5761356a60006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156135ab57600080fd5b5af115156135b857600080fd5b5050506040518051600154600160a060020a03908116911614905061364d57600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561361657600080fd5b5af1151561362357600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a0316632ef3accc87866040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156136b557808201518382015260200161369d565b50505050905090810190601f1680156136e25780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b151561370157600080fd5b5af1151561370e57600080fd5b5050506040518051925050670de0b6b3a76400003a8502018211156137365760009250612f22565b61373f856138dd565b600154909150600160a060020a031663c55c1cb68360008985896040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156137b85780820151838201526020016137a0565b50505050905090810190601f1680156137e55780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561381b578082015183820152602001613803565b50505050905090810190601f1680156138485780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b151561386957600080fd5b5af1151561387657600080fd5b505050506040518051979650505050505050565b60028180516106f4929160200190613ccf565b60008060008060405188815287602082015286604082015285606082015260208160808360006001610bb8f1925080519299929850919650505050505050565b6138e5613c90565b6000806138f0613c90565b60008060006138fd613c90565b60008060008b51995060009850896040518059106139185750595b90808252806020026020018201604052801561394e57816020015b61393b613c90565b8152602001906001900390816139335790505b509750600096505b898710156139db578b878151811061396a57fe5b9060200190602002015188888151811061398057fe5b602090810290910101526017600189898151811061399a57fe5b9060200190602002015151038115156139af57fe5b048888815181106139bc57fe5b9060200190602002015151019890980160030197600190960195613956565b600198909801976000955060808a019450886040518059106139fa5750595b818152601f19601f8301168101602001604052905093505b600186901115613a645760f860020a85028660018110613a2e57fe5b1a60f860020a02848781518110613a4157fe5b906020010190600160f860020a031916908160001a905350600190950194613a12565b600096505b89871015613c44577f5f00000000000000000000000000000000000000000000000000000000000000848781518110613a9e57fe5b906020010190600160f860020a031916908160001a905350600190950194600092505b878781518110613acd57fe5b9060200190602002015151831015613bf057601783061515613b8957601883898981518110613af857fe5b9060200190602002015151031015613b285782888881518110613b1757fe5b906020019060200201515103613b2b565b60175b60400191508590505b80860360011115613b895760f860020a820281870360018110613b5357fe5b1a60f860020a02848781518110613b6657fe5b906020010190600160f860020a031916908160001a905350600190950194613b34565b878781518110613b9557fe5b906020019060200201518381518110613baa57fe5b016020015160f860020a900460f860020a02848781518110613bc857fe5b906020010190600160f860020a031916908160001a9053506001958601959290920191613ac1565b7fff00000000000000000000000000000000000000000000000000000000000000848781518110613c1d57fe5b906020010190600160f860020a031916908160001a90535060019687019690950194613a69565b50919a9950505050505050505050565b60e06040519081016040908152600080835260208301819052908201819052606082018190526080820181905260a0820181905260c082015290565b60206040519081016040526000815290565b60806040519081016040526004815b613cb9613c90565b815260200190600190039081613cb15790505090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613d1057805160ff1916838001178555613d3d565b82800160010185558215613d3d579182015b82811115613d3d578251825591602001919060010190613d22565b50613d49929150613d4d565b5090565b61111c91905b80821115613d495760008155600101613d53565b600054600160a060020a03161580613d915750600054613d8f90600160a060020a03166121b4565b155b15613da257613da060006121b8565b505b600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515613de157600080fd5b5af11515613dee57600080fd5b5050506040518051600154600160a060020a039081169116149050613e8357600054600160a060020a03166338cc48316040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515613e4c57600080fd5b5af11515613e5957600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663688dcfd78260405160e060020a63ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b1515611b1557600080fd00a165627a7a7230582049aea976b2da02b69bee2f2613b0b46252151312275461bcedae5bb570199dd90029

   Swarm Source:
bzzr://49aea976b2da02b69bee2f2613b0b46252151312275461bcedae5bb570199dd9

 

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