Contract 0xa1E70923902524FaF901A3978F499908f689D114

 
 
Txn Hash
Method
Block
From
To
Value
0xbfa1469e5982cd8d1455eeb407c9b6d34e28216490b14c3fc93537e225b2abccDestroy And Send53931962018-04-06 20:56:471595 days 1 hr ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0003027521
0x7c5461fde2fa28fde17dcd1bf831c5c62e6ca684e4980e01cc8ea9be90cfb3a4Begin Game53926642018-04-06 18:42:121595 days 3 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍05 Ether0.‍005164125
0x58a49d47af7236506e8f2ce852ac977b47f968e4e9ca9f1859da28f5b70c3c5cBegin Game53926592018-04-06 18:41:161595 days 3 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍05 Ether0.‍0061969230
0x663d573c9472699b53066fbb1a1b09f57deb4f24d89aa0fe97fe04865f42c2cfBegin Game53926502018-04-06 18:39:481595 days 3 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍05 Ether0.‍0041312820
0x013fb9f9e0202502f188bbb7c59e28a95fd99cc28c60ed9384167e13c1845ba1Begin Game53925702018-04-06 18:19:561595 days 3 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍05 Ether0.‍0041312820
0x722f31c423f2f144ed0f1b4463479fd6c0033e7ed7836f11ca95f9275e8c991fSet Min Bet53925572018-04-06 18:16:331595 days 4 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0005768221
0x6c4389f04e65e83610ef5b7b7295c889e5bbb6fb3c80c6465239c1205a485b73Set Max Bet Thre...53925512018-04-06 18:15:401595 days 4 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0005705221
0xccfe18ec4c6e6cebc55b0800988032bdb81f2e22663f1771a093d67df6aa7431Set RNG Callback...53925502018-04-06 18:15:191595 days 4 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0008372721
0x848ca0a0a80260ea6ce97b643bb3697add4be79fbabfb1ef2df9f2a353bdb88dSet Min Bet53925382018-04-06 18:13:371595 days 4 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0005768221
0x840aa112536ede710b385154238692766a3085f52deda6be5d61459c7e735f52Begin Game53863952018-04-05 18:03:451596 days 4 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍08 Ether0.‍0041312820
0xb717e15a1144b6c0615c9d355a516614db91cd1470de5c8d2270158b67834265Begin Game53861792018-04-05 17:14:381596 days 5 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0041312820
0x2ee3af23615c595db37dd1f0b5a94a1345656da62f54901900f551fd2e3ef82bBegin Game53830352018-04-05 4:21:431596 days 17 hrs ago0x94f8b95796f5de8be150402b5b6bb7e8fe905f36 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0050220620
0xb35214fde753dd5afe95e2471d8d3c31a35e6d20cd46cf711cd43c7bbdebe12eBegin Game53806082018-04-04 18:41:301597 days 3 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0041312820
0x3cabc8b711577c1d2ac258ff9104866befa9aa875ffc4e51b7a08dc62d38ca2bBegin Game53776452018-04-04 6:47:411597 days 15 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0041312820
0x9c97ae831757efda43248995b2b26ec8643172e01f45a38853433531851c8765Begin Game53702272018-04-03 1:15:041598 days 21 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍01 Ether0.‍0041312820
0xabe6e0ade15789771e695ab14b86388a7ad11e3609778c7e4619acb8cbbc7e3cSet RNG Callback...53701732018-04-03 1:01:001598 days 21 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0008372721
0xe4200ca0836d604431db36f32de926d4434cc2eb77c61efc4548531f5c961999Begin Game53701592018-04-03 0:57:411598 days 21 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍01 Ether0.‍0041312820
0x5657f4f2a8e48c41319ae02f14bb4ab0d693ae75624601380f539d2bcba0833bSet RNG Callback...53701362018-04-03 0:51:461598 days 21 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍0008359221
0x65bc1c453cad3711a94a1a916263662b99fa81b4131fdeb363f0441834ffd6cdBegin Game53701152018-04-03 0:46:271598 days 21 hrs ago0x978a1bc9925a58efb90f38bb3d19758f840b8b63 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍005 Ether0.‍0041312820
0xe55409ce043dc2027e7b4e14ad2746963058da9ea68d803e597dd4b17311417bBegin Game53663782018-04-02 9:58:541599 days 12 hrs ago0x537b8adcb07e9353d05149b42c84eada3c49dcc5 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0050220620
0x96679f3a16100651c06950d48a62370f8ccfa052dd3b496c80539a0b8b30442fBegin Game53642982018-04-02 1:50:061599 days 20 hrs ago0x4ffe17a2a72bc7422cb176bc71c04ee6d87ce329 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0050220620
0x995a9c3a5fcffa3b037a22f82be1a7302f09d301369ff0514b68b730f3847e00Begin Game53632652018-04-01 21:41:241600 days 37 mins ago0xf8e2867d1ac32f02f2e42ee0f1602e34d6bc3187 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍01 Ether0.‍001255515
0x29d2ae2407dc276fc1efe37ff14f1ea749ed530378d5813480b0b91225470c91Begin Game53609882018-04-01 12:43:101600 days 9 hrs ago0x5d9b5ea89481aa4aed4af663845b55730cd79721 IN  0xa1e70923902524faf901a3978f499908f689d1140.‍001 Ether0.‍0050220620
0x4602a606df58347c3bb23e3e7e95ae3de38c676e772b7748abb8f18614b10f10Begin Game53603182018-04-01 10:00:401600 days 12 hrs ago0xa4e942b62752c94809d76c7d1fbc86ed389a050f IN  0xa1e70923902524faf901a3978f499908f689d1140.‍02 Ether0.‍0025110310
0x201b11f5a4f0428d895a0f650ab42ee85df863c2b74af4ad265eb07f8ac6c0dfFinish Game53596552018-04-01 7:27:081600 days 14 hrs ago0x4f0d861281161f39c62b790995fb1e7a0b81b07b IN  0xa1e70923902524faf901a3978f499908f689d1140 Ether0.‍00047392.‍1
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xbfa1469e5982cd8d1455eeb407c9b6d34e28216490b14c3fc93537e225b2abcc53931962018-04-06 20:56:471595 days 1 hr ago 0xa1e70923902524faf901a3978f499908f689d114 0x5cee173ee3a9568a4d66d882d78fdf5724251e822.‍02425179 Ether
0x7c5461fde2fa28fde17dcd1bf831c5c62e6ca684e4980e01cc8ea9be90cfb3a453926642018-04-06 18:42:121595 days 3 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍01513335 Ether
0x58a49d47af7236506e8f2ce852ac977b47f968e4e9ca9f1859da28f5b70c3c5c53926592018-04-06 18:41:161595 days 3 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍01513335 Ether
0x663d573c9472699b53066fbb1a1b09f57deb4f24d89aa0fe97fe04865f42c2cf53926502018-04-06 18:39:481595 days 3 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍01513335 Ether
0x013fb9f9e0202502f188bbb7c59e28a95fd99cc28c60ed9384167e13c1845ba153925702018-04-06 18:19:561595 days 3 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍01513335 Ether
0x840aa112536ede710b385154238692766a3085f52deda6be5d61459c7e735f5253863952018-04-05 18:03:451596 days 4 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0xb717e15a1144b6c0615c9d355a516614db91cd1470de5c8d2270158b6783426553861792018-04-05 17:14:381596 days 5 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0x2ee3af23615c595db37dd1f0b5a94a1345656da62f54901900f551fd2e3ef82b53830352018-04-05 4:21:431596 days 17 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0xb35214fde753dd5afe95e2471d8d3c31a35e6d20cd46cf711cd43c7bbdebe12e53806082018-04-04 18:41:301597 days 3 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0x3cabc8b711577c1d2ac258ff9104866befa9aa875ffc4e51b7a08dc62d38ca2b53776452018-04-04 6:47:411597 days 15 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0x9c97ae831757efda43248995b2b26ec8643172e01f45a38853433531851c876553702272018-04-03 1:15:041598 days 21 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00713335 Ether
0xe4200ca0836d604431db36f32de926d4434cc2eb77c61efc4548531f5c96199953701592018-04-03 0:57:411598 days 21 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00413335 Ether
0x65bc1c453cad3711a94a1a916263662b99fa81b4131fdeb363f0441834ffd6cd53701152018-04-03 0:46:271598 days 21 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0xe55409ce043dc2027e7b4e14ad2746963058da9ea68d803e597dd4b17311417b53663782018-04-02 9:58:541599 days 12 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x96679f3a16100651c06950d48a62370f8ccfa052dd3b496c80539a0b8b30442f53642982018-04-02 1:50:061599 days 20 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x995a9c3a5fcffa3b037a22f82be1a7302f09d301369ff0514b68b730f3847e0053632652018-04-01 21:41:241600 days 37 mins ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x29d2ae2407dc276fc1efe37ff14f1ea749ed530378d5813480b0b91225470c9153609882018-04-01 12:43:101600 days 9 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x4602a606df58347c3bb23e3e7e95ae3de38c676e772b7748abb8f18614b10f1053603182018-04-01 10:00:401600 days 12 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x201b11f5a4f0428d895a0f650ab42ee85df863c2b74af4ad265eb07f8ac6c0df53596552018-04-01 7:27:081600 days 14 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0xc03033bf6533153e7f5f4943bc07225d5df04958d6116cd9996f7b3e4c5c4cac53570442018-03-31 21:06:501601 days 1 hr ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0xf5b79c386cb50c0e79cbf1cc82ce0fd68b15159e121bef7dbf09c9797c0df19853568852018-03-31 20:30:201601 days 1 hr ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x807abdccd537cdd77745b11c08cdb93257915e19bcb2b2303d5cac305f6da7f753566412018-03-31 19:28:371601 days 2 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0xa5b59f4b7555e4371bc0b528c06b0ac9bf1d0db1ac76eb6e510a6d9cd8cb41eb53530512018-03-31 5:23:251601 days 16 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x05fdfb42da1306fb559e9df087c3f649315d449d8e5b13457d3193df80479faa53526462018-03-31 3:53:011601 days 18 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
0x620309439e044cc2b942ba497cace041407c6db05751f160c432e408599705f053525672018-03-31 3:32:291601 days 18 hrs ago 0xa1e70923902524faf901a3978f499908f689d114 0x3dbdc81a6edc94c720b0b88fb65dbd7e395fdcf60.‍00373335 Ether
[ Download CSV Export 
Loading
Contract Self Destruct called at Txn Hash 0xbfa1469e5982cd8d1455eeb407c9b6d34e28216490b14c3fc93537e225b2abcc


Contract Source Code Verified (Exact Match)

Contract Name:
EtherHiLo

Compiler Version
v0.4.19+commit.c4cbbb05

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-03-25
*/

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 Substracts 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;
    }
}
pragma solidity ^0.4.18;


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;


    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    function Ownable() public {
        owner = msg.sender;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0));
        OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

}
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD



Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.



THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

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

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>

pragma solidity ^0.4.19;

/// @title EtherHiLo
/// @dev the contract than handles the EtherHiLo app
contract EtherHiLo is usingOraclize, Ownable {

    uint8 constant NUM_DICE_SIDES = 13;

    // settings
    uint public rngCallbackGas;
    uint public minBet;
    uint public maxBetThresholdPct;
    bool public gameRunning;

    // state
    uint public balanceInPlay;

    mapping(address => Game) private gamesInProgress;
    mapping(uint => address) private rollIdToGameAddress;
    mapping(uint => uint) private failedRolls;

    event GameFinished(address indexed player, uint indexed playerGameNumber, uint bet, uint8 firstRoll, uint8 finalRoll, uint winnings, uint payout);
    event GameError(address indexed player, uint indexed playerGameNumber, uint rollId);

    enum BetDirection {
        None,
        Low,
        High
    }

    enum GameState {
        None,
        WaitingForFirstCard,
        WaitingForDirection,
        WaitingForFinalCard,
        Finished
    }

    // the game object
    struct Game {
        address player;
        GameState state;
        uint id;
        BetDirection direction;
        uint bet;
        uint8 firstRoll;
        uint8 finalRoll;
        uint winnings;
    }

    // the constructor
    function EtherHiLo() public {
        oraclize_setProof(proofType_Ledger);
        setRNGCallbackGasConfig(1000000, 4000000000 wei);
        setMinBet(1 finney);
        setGameRunning(true);
        setMaxBetThresholdPct(50);
    }

    /// Default function
    function() external payable {

    }


    /// =======================
    /// EXTERNAL GAME RELATED FUNCTIONS

    // begins a game
    function beginGame() public payable {
        address player = msg.sender;
        uint bet = msg.value;

        require(player != address(0));
        require(gamesInProgress[player].state == GameState.None || gamesInProgress[player].state == GameState.Finished);
        require(gameRunning);
        require(bet >= minBet && bet <= getMaxBet());

        Game memory game = Game({
                id:         uint(keccak256(block.number, player, bet)),
                player:     player,
                state:      GameState.WaitingForFirstCard,
                bet:        bet,
                firstRoll:  0,
                finalRoll:  0,
                winnings:   0,
                direction:  BetDirection.None
            });

        balanceInPlay = balanceInPlay + game.bet;
        gamesInProgress[player] = game;
        rollDie(player);
    }

    // finishes a game that is in progress
    function finishGame(BetDirection direction) {
        address player = msg.sender;

        require(player != address(0));
        require(gamesInProgress[player].state != GameState.None && gamesInProgress[player].state != GameState.Finished);

        Game storage game = gamesInProgress[player];
        game.direction = direction;
        game.state = GameState.WaitingForFinalCard;
        gamesInProgress[player] = game;

        rollDie(player);
    }

    // returns current game state
    function getGameState(address player) public view returns
            (GameState, uint, BetDirection, uint, uint8, uint8, uint) {
        return (
            gamesInProgress[player].state,
            gamesInProgress[player].id,
            gamesInProgress[player].direction,
            gamesInProgress[player].bet,
            gamesInProgress[player].firstRoll,
            gamesInProgress[player].finalRoll,
            gamesInProgress[player].winnings
        );
    }

    // Returns the minimum bet
    function getMinBet() public view returns (uint) {
        return minBet;
    }

    // Returns the maximum bet
    function getMaxBet() public view returns (uint) {
        return SafeMath.div(SafeMath.div(SafeMath.mul(this.balance - balanceInPlay, maxBetThresholdPct), 100), 12);
    }

    // calculates winnings for the given bet and percent
    function calculateWinnings(uint bet, uint percent) public pure returns (uint) {
        return SafeMath.div(SafeMath.mul(bet, percent), 100);
    }

    // Returns the win percent when going low on the given number
    function getLowWinPercent(uint number) public pure returns (uint) {
        require(number >= 2 && number <= NUM_DICE_SIDES);
        if (number == 2) {
            return 1200;
        } else if (number == 3) {
            return 500;
        } else if (number == 4) {
            return 300;
        } else if (number == 5) {
            return 300;
        } else if (number == 6) {
            return 200;
        } else if (number == 7) {
            return 180;
        } else if (number == 8) {
            return 150;
        } else if (number == 9) {
            return 140;
        } else if (number == 10) {
            return 130;
        } else if (number == 11) {
            return 120;
        } else if (number == 12) {
            return 110;
        } else if (number == 13) {
            return 100;
        }
    }

    // Returns the win percent when going high on the given number
    function getHighWinPercent(uint number) public pure returns (uint) {
        require(number >= 1 && number < NUM_DICE_SIDES);
        if (number == 1) {
            return 100;
        } else if (number == 2) {
            return 110;
        } else if (number == 3) {
            return 120;
        } else if (number == 4) {
            return 130;
        } else if (number == 5) {
            return 140;
        } else if (number == 6) {
            return 150;
        } else if (number == 7) {
            return 180;
        } else if (number == 8) {
            return 200;
        } else if (number == 9) {
            return 300;
        } else if (number == 10) {
            return 300;
        } else if (number == 11) {
            return 500;
        } else if (number == 12) {
            return 1200;
        }
    }


    /// =======================
    /// INTERNAL GAME RELATED FUNCTIONS

    // process a successful roll
    function processDiceRoll(address player, uint8 roll) private {

        Game storage game = gamesInProgress[player];

        if (game.firstRoll == 0) {

            game.firstRoll = roll;
            game.state = GameState.WaitingForDirection;
            gamesInProgress[player] = game;

            return;
        }

        uint8 finalRoll = roll;
        uint winnings = 0;

        if (game.direction == BetDirection.High && finalRoll > game.firstRoll) {
            winnings = calculateWinnings(game.bet, getHighWinPercent(game.firstRoll));
        } else if (game.direction == BetDirection.Low && finalRoll < game.firstRoll) {
            winnings = calculateWinnings(game.bet, getLowWinPercent(game.firstRoll));
        }

        // this should never happen according to the odds,
        // and the fact that we don't allow people to bet
        // so large that they can take the whole pot in one
        // fell swoop - however, a number of people could
        // theoretically all win simultaneously and cause
        // this scenario.  This will try to at a minimum
        // send them back what they bet and then since it
        // is recorded on the blockchain we can verify that
        // the winnings sent don't match what they should be
        // and we can manually send the rest to the player.
        uint transferAmount = winnings;
        if (transferAmount > this.balance) {
            if (game.bet < this.balance) {
                transferAmount = game.bet;
            } else {
                transferAmount = SafeMath.div(SafeMath.mul(this.balance, 90), 100);
            }
        }

        balanceInPlay = balanceInPlay - game.bet;

        if (transferAmount > 0) {
            game.player.transfer(transferAmount);
        }

        game.finalRoll = finalRoll;
        game.winnings = winnings;
        game.state = GameState.Finished;
        gamesInProgress[player] = game;

        GameFinished(player, game.id, game.bet, game.firstRoll, finalRoll, winnings, transferAmount);
    }

    // roll the dice for a player
    function rollDie(address player) private {
        uint N = 7;
        uint delay = 0;
        bytes32 _queryId = oraclize_newRandomDSQuery(delay, N, rngCallbackGas);
        uint rollId = uint(keccak256(_queryId));
        require(failedRolls[rollId] != rollId);
        rollIdToGameAddress[rollId] = player;
    }


    /// =======================
    /// ORACLIZE RELATED FUNCTIONS

    // the callback function is called by Oraclize when the result is ready
    // the oraclize_randomDS_proofVerify modifier prevents an invalid proof to execute this function code:
    // the proof validity is fully verified on-chain
    function __callback(bytes32 _queryId, string _result, bytes _proof) public {
        uint rollId = uint(keccak256(_queryId));
        address player = rollIdToGameAddress[rollId];
        require(msg.sender == oraclize_cbAddress());

        // avoid reorgs
        if (player == address(0)) {
            failedRolls[rollId] = rollId;
            return;
        }

        if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {

            Game storage game = gamesInProgress[player];
            if (game.bet > 0) {
                game.player.transfer(game.bet);
            }

            delete gamesInProgress[player];
            delete rollIdToGameAddress[rollId];
            delete failedRolls[rollId];
            GameError(player, game.id, rollId);

        } else {
            uint8 randomNumber = uint8((uint(keccak256(_result)) % NUM_DICE_SIDES) + 1);
            processDiceRoll(player, randomNumber);

        }

        delete rollIdToGameAddress[rollId];
    }


    /// OWNER / MANAGEMENT RELATED FUNCTIONS

    // fail safe for balance transfer
    function transferBalance(address to, uint amount) public onlyOwner {
        to.transfer(amount);
    }

    // cleans up a player abandoned game, but only if it's
    // greater than 24 hours old.
    function cleanupAbandonedGame(address player) public onlyOwner {
        require(player != address(0));

        Game storage game = gamesInProgress[player];
        require(game.player != address(0));

        game.player.transfer(game.bet);
        delete gamesInProgress[game.player];
    }

    // set RNG callback gas
    function setRNGCallbackGasConfig(uint gas, uint price) public onlyOwner {
        rngCallbackGas = gas;
        oraclize_setCustomGasPrice(price);
    }

    // set the minimum bet
    function setMinBet(uint bet) public onlyOwner {
        minBet = bet;
    }

    // set whether or not the game is running
    function setGameRunning(bool v) public onlyOwner {
        gameRunning = v;
    }

    // set the max bet threshold percent
    function setMaxBetThresholdPct(uint v) public onlyOwner {
        maxBetThresholdPct = v;
    }

    // Transfers the current balance to the recepient and terminates the contract.
    function destroyAndSend(address _recipient) public onlyOwner {
        selfdestruct(_recipient);
    }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"number","type":"uint256"}],"name":"getHighWinPercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"bet","type":"uint256"},{"name":"percent","type":"uint256"}],"name":"calculateWinnings","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"player","type":"address"}],"name":"cleanupAbandonedGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMinBet","outputs":[{"name":"","type":"uint256"}],"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":"_queryId","type":"bytes32"},{"name":"_result","type":"string"},{"name":"_proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"balanceInPlay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"amount","type":"uint256"}],"name":"transferBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMaxBet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"v","type":"uint256"}],"name":"setMaxBetThresholdPct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gameRunning","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"bet","type":"uint256"}],"name":"setMinBet","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":"minBet","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"number","type":"uint256"}],"name":"getLowWinPercent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"rngCallbackGas","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxBetThresholdPct","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"v","type":"bool"}],"name":"setGameRunning","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"player","type":"address"}],"name":"getGameState","outputs":[{"name":"","type":"uint8"},{"name":"","type":"uint256"},{"name":"","type":"uint8"},{"name":"","type":"uint256"},{"name":"","type":"uint8"},{"name":"","type":"uint8"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"beginGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"direction","type":"uint8"}],"name":"finishGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"gas","type":"uint256"},{"name":"price","type":"uint256"}],"name":"setRNGCallbackGasConfig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_recipient","type":"address"}],"name":"destroyAndSend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"playerGameNumber","type":"uint256"},{"indexed":false,"name":"bet","type":"uint256"},{"indexed":false,"name":"firstRoll","type":"uint8"},{"indexed":false,"name":"finalRoll","type":"uint8"},{"indexed":false,"name":"winnings","type":"uint256"},{"indexed":false,"name":"payout","type":"uint256"}],"name":"GameFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"playerGameNumber","type":"uint256"},{"indexed":false,"name":"rollId","type":"uint256"}],"name":"GameError","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

606060405234156200001057600080fd5b60058054600160a060020a03191633600160a060020a0316179055620000647f3000000000000000000000000000000000000000000000000000000000000000640100000000620000df810262003b231704565b62000085620f424063ee6b280064010000000062000fcd6200030b82021704565b620000a566038d7ea4c68000640100000000620009fa6200034982021704565b620000bf600164010000000062000b2a6200036a82021704565b620000d96032640100000000620009d16200039982021704565b62000a62565b600054600160a060020a031615806200011a57506000546200011890600160a060020a0316640100000000620019ec620003ba82021704565b155b156200013c576200013a6000640100000000620019f0620003be82021704565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200019f57600080fd5b6102c65a03f11515620001b157600080fd5b5050506040518051600154600160a060020a039081169116149050620002705760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200023457600080fd5b6102c65a03f115156200024657600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663688dcfd7826040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b1515620002f357600080fd5b6102c65a03f115156200030557600080fd5b50505050565b60055433600160a060020a039081169116146200032757600080fd5b6006829055620003458164010000000062001855620003de82021704565b5050565b60055433600160a060020a039081169116146200036557600080fd5b600755565b60055433600160a060020a039081169116146200038657600080fd5b6009805460ff1916911515919091179055565b60055433600160a060020a03908116911614620003b557600080fd5b600855565b3b90565b6000620003d8640100000000620024e1620005d182021704565b92915050565b600054600160a060020a031615806200041957506000546200041790600160a060020a0316640100000000620019ec620003ba82021704565b155b156200043b57620004396000640100000000620019f0620003be82021704565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200049e57600080fd5b6102c65a03f11515620004b057600080fd5b5050506040518051600154600160a060020a0390811691161490506200056f5760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156200053357600080fd5b6102c65a03f115156200054557600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663ca6ad1e4826040517c010000000000000000000000000000000000000000000000000000000063ffffffff84160281526004810191909152602401600060405180830381600087803b1515620002f357600080fd5b60008062000601731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed640100000000620019ec620003ba82021704565b1115620006835760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed1790556200067a60408051908101604052600b81527f6574685f6d61696e6e6574000000000000000000000000000000000000000000602082015264010000000062003298620009b182021704565b506001620009ae565b6000620006b273c03a2615d5efaf5f49f60b7bb6583eaec212fdf1640100000000620019ec620003ba82021704565b11156200072b5760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf11790556200067a60408051908101604052600c81527f6574685f726f707374656e330000000000000000000000000000000000000000602082015264010000000062003298620009b182021704565b60006200075a73b7a07bcf2ba2f2703b24c0691b5278999c59ac7e640100000000620019ec620003ba82021704565b1115620007d35760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e1790556200067a60408051908101604052600981527f6574685f6b6f76616e0000000000000000000000000000000000000000000000602082015264010000000062003298620009b182021704565b60006200080273146500cfd35b22e4a392fe0adc06de1a1368ed48640100000000620019ec620003ba82021704565b11156200087b5760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed481790556200067a60408051908101604052600b81527f6574685f72696e6b656279000000000000000000000000000000000000000000602082015264010000000062003298620009b182021704565b6000620008aa736f485c8bf6fc43ea212e93bbf8ce046c7f1cb475640100000000620019ec620003ba82021704565b1115620008e0575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4751790556001620009ae565b60006200090f7320e12a1f859b3feae5fb2a0a32c18f5a65555bbf640100000000620019ec620003ba82021704565b111562000945575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1790556001620009ae565b6000620009747351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa640100000000620019ec620003ba82021704565b1115620009aa575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa1790556001620009ae565b5060005b90565b600281805162000345929160200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1062000a0357805160ff191683800117855562000a33565b8280016001018555821562000a33579182015b8281111562000a3357825182559160200191906001019062000a16565b5062000a4192915062000a45565b5090565b620009ae91905b8082111562000a41576000815560010162000a4c565b613cf08062000a726000396000f3006060604052600436106101245763ffffffff60e060020a6000350416630118251c811461012657806310c129171461014e5780631a64937b1461016757806324c375071461018657806327dc297e1461019957806338bbfa50146101ef5780634586e4ab1461028757806356a6d9ef1461029a578063646668b6146102bc5780636ab872f0146102cf5780636e8c2caf146102e557806388ea41b91461030c5780638da5cb5b146103225780639619367d1461035157806396577caa14610364578063b7970d801461037a578063d1d5824d1461038d578063d5bcf8ef146103a0578063d9d60b52146103b8578063da0b06821461043f578063ead720cb14610447578063eb04df1d14610460578063f2fde38b14610479578063f5074f4114610498575b005b341561013157600080fd5b61013c6004356104b7565b60405190815260200160405180910390f35b341561015957600080fd5b61013c6004356024356105a6565b341561017257600080fd5b610124600160a060020a03600435166105c3565b341561019157600080fd5b61013c6106bc565b34156101a457600080fd5b610124600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506106c395505050505050565b34156101fa57600080fd5b610124600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506106f595505050505050565b341561029257600080fd5b61013c610951565b34156102a557600080fd5b610124600160a060020a0360043516602435610957565b34156102c757600080fd5b61013c6109a3565b34156102da57600080fd5b6101246004356109d1565b34156102f057600080fd5b6102f86109f1565b604051901515815260200160405180910390f35b341561031757600080fd5b6101246004356109fa565b341561032d57600080fd5b610335610a1a565b604051600160a060020a03909116815260200160405180910390f35b341561035c57600080fd5b61013c610a29565b341561036f57600080fd5b61013c600435610a2f565b341561038557600080fd5b61013c610b1e565b341561039857600080fd5b61013c610b24565b34156103ab57600080fd5b6101246004351515610b2a565b34156103c357600080fd5b6103d7600160a060020a0360043516610b58565b604051808860048111156103e757fe5b60ff16815260200187815260200186600281111561040157fe5b60ff1681526020018581526020018460ff1660ff1681526020018360ff1660ff16815260200182815260200197505050505050505060405180910390f35b610124610baf565b341561045257600080fd5b61012460ff60043516610e04565b341561046b57600080fd5b610124600435602435610fcd565b341561048457600080fd5b610124600160a060020a0360043516610ff6565b34156104a357600080fd5b610124600160a060020a0360043516611084565b6000600182101580156104ca5750600d82105b15156104d557600080fd5b81600114156104e6575060646105a1565b81600214156104f75750606e6105a1565b8160031415610508575060786105a1565b8160041415610519575060826105a1565b816005141561052a5750608c6105a1565b816006141561053b575060966105a1565b816007141561054c575060b46105a1565b816008141561055d575060c86105a1565b816009141561056f575061012c6105a1565b81600a1415610581575061012c6105a1565b81600b141561059357506101f46105a1565b81600c14156105a157506104b05b919050565b60006105bc6105b584846110ab565b60646110e1565b9392505050565b60055460009033600160a060020a039081169116146105e157600080fd5b600160a060020a03821615156105f657600080fd5b50600160a060020a038082166000908152600b602052604090208054909116151561062057600080fd5b80546003820154600160a060020a039091169080156108fc0290604051600060405180830381858888f19350505050151561065a57600080fd5b54600160a060020a03166000908152600b60205260408120805474ffffffffffffffffffffffffffffffffffffffffff191681556001810182905560028101805460ff191690556003810182905560048101805461ffff191690556005015550565b6007545b90565b6106f1828260006040518059106106d75750595b818152601f19601f830116810160200160405290506106f5565b5050565b600080600080866040519081526020016040519081900390206000818152600c6020526040902054909450600160a060020a031692506107336110f8565b600160a060020a031633600160a060020a031614151561075257600080fd5b600160a060020a0383161515610778576000848152600d60205260409020849055610948565b610783878787611298565b60ff16156108b357600160a060020a0383166000908152600b60205260408120600381015490935011156107eb5781546003830154600160a060020a039091169080156108fc0290604051600060405180830381858888f1935050505015156107eb57600080fd5b600160a060020a0383166000818152600b60209081526040808320805474ffffffffffffffffffffffffffffffffffffffffff19168155600180820185905560028201805460ff191690556003820185905560048201805461ffff191690556005909101849055888452600c83528184208054600160a060020a0319169055600d9092528083209290925584015491907f4a0ebae378ca3af5628326dcee9b8ab814d702a67bf657f9621cff0af1fcfa1e9087905190815260200160405180910390a361092b565b600d866040518082805190602001908083835b602083106108e55780518252601f1990920191602091820191016108c6565b6001836020036101000a038019825116818451161790925250505091909101925060409150505190819003902081151561091b57fe5b06600101905061092b83826113c2565b6000848152600c602052604090208054600160a060020a03191690555b50505050505050565b600a5481565b60055433600160a060020a0390811691161461097257600080fd5b600160a060020a03821681156108fc0282604051600060405180830381858888f1935050505015156106f157600080fd5b60006109cc6109c56105b5600a5430600160a060020a031631036008546110ab565b600c6110e1565b905090565b60055433600160a060020a039081169116146109ec57600080fd5b600855565b60095460ff1681565b60055433600160a060020a03908116911614610a1557600080fd5b600755565b600554600160a060020a031681565b60075481565b600060028210158015610a435750600d8211155b1515610a4e57600080fd5b8160021415610a6057506104b06105a1565b8160031415610a7257506101f46105a1565b8160041415610a84575061012c6105a1565b8160051415610a96575061012c6105a1565b8160061415610aa7575060c86105a1565b8160071415610ab8575060b46105a1565b8160081415610ac9575060966105a1565b8160091415610ada5750608c6105a1565b81600a1415610aeb575060826105a1565b81600b1415610afc575060786105a1565b81600c1415610b0d5750606e6105a1565b81600d14156105a1575060646105a1565b60065481565b60085481565b60055433600160a060020a03908116911614610b4557600080fd5b6009805460ff1916911515919091179055565b600160a060020a03166000908152600b602052604090208054600182015460028301546003840154600485015460059095015460ff60a060020a909504851696939592851694919382841693610100900490921691565b600080610bba6139fb565b339250349150600160a060020a0383161515610bd557600080fd5b6000600160a060020a0384166000908152600b602052604090205460a060020a900460ff166004811115610c0557fe5b1480610c3e57506004600160a060020a0384166000908152600b602052604090205460a060020a900460ff166004811115610c3c57fe5b145b1515610c4957600080fd5b60095460ff161515610c5a57600080fd5b6007548210158015610c735750610c6f6109a3565b8211155b1515610c7e57600080fd5b610100604051908101604052600160a060020a03841681526020810160018152602001438585604051928352600160a060020a03919091166c0100000000000000000000000002602083015260348201526054016040519081900390208152602001600081526020810184905260006040820181905260608201819052608091820152909150810151600a8054919091019055600160a060020a0383166000908152600b60205260409020819081518154600160a060020a031916600160a060020a039190911617815560208201518154829060a060020a60ff02191660a060020a836004811115610d6c57fe5b02179055506040820151816001015560608201518160020160006101000a81548160ff02191690836002811115610d9f57fe5b02179055506080820151816003015560a082015160048201805460ff191660ff9290921691909117905560c08201518160040160016101000a81548160ff021916908360ff16021790555060e082015160059091015550610dff836117d5565b505050565b336000600160a060020a0382161515610e1c57600080fd5b6000600160a060020a0383166000908152600b602052604090205460a060020a900460ff166004811115610e4c57fe5b14158015610e8857506004600160a060020a0383166000908152600b602052604090205460a060020a900460ff166004811115610e8557fe5b14155b1515610e9357600080fd5b50600160a060020a0381166000908152600b6020526040902060028082018054859260ff19909116906001908490811115610eca57fe5b0217905550805460a060020a60ff02199081167403000000000000000000000000000000000000000017808355600160a060020a038481166000908152600b602052604090208054600160a060020a03191691909216178082558354849360ff60a060020a9283900416928492911690836004811115610f4657fe5b021790555060018281015482820155600280840154818401805460ff90921693909260ff19909216918490811115610f7a57fe5b02179055506003828101549082015560048083018054918301805460ff191660ff9384161780825591546101009081900490931690920261ff0019909116179055600591820154910155610dff826117d5565b60055433600160a060020a03908116911614610fe857600080fd5b60068290556106f181611855565b60055433600160a060020a0390811691161461101157600080fd5b600160a060020a038116151561102657600080fd5b600554600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360058054600160a060020a031916600160a060020a0392909216919091179055565b60055433600160a060020a0390811691161461109f57600080fd5b80600160a060020a0316ff5b6000808315156110be57600091506110da565b508282028284828115156110ce57fe5b04146110d657fe5b8091505b5092915050565b60008082848115156110ef57fe5b04949350505050565b60008054600160a060020a03161580611123575060005461112190600160a060020a03166119ec565b155b156111345761113260006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561117d57600080fd5b6102c65a03f1151561118e57600080fd5b5050506040518051600154600160a060020a0390811691161490506112315760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156111f657600080fd5b6102c65a03f1151561120757600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663c281d19e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561127957600080fd5b6102c65a03f1151561128a57600080fd5b505050604051805191505090565b600080826000815181106112a857fe5b016020015160f860020a900460f860020a02600160f860020a0319167f4c0000000000000000000000000000000000000000000000000000000000000014158061133a5750826001815181106112fa57fe5b016020015160f860020a900460f860020a02600160f860020a0319167f500000000000000000000000000000000000000000000000000000000000000014155b8061138257508260028151811061134d57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000060f860020a9182900482021614155b1561139057600191506113ba565b6113a383868661139e611a00565b611aa8565b90508015156113b557600291506113ba565b600091505b509392505050565b600160a060020a0382166000908152600b6020526040812060048101549091908190819060ff1615156114fa5760048401805460ff191660ff87161790558354600290859060a060020a60ff02191660a060020a830217905550600160a060020a038087166000908152600b6020526040902085548154600160a060020a031916921691909117808255855486929160ff60a060020a928390041691839160a060020a60ff0219169083600481111561147757fe5b021790555060018281015482820155600280840154818401805460ff90921693909260ff199092169184908111156114ab57fe5b02179055506003828101549082015560048083018054918301805460ff191660ff9384161780825591546101009081900490931690920261ff00199091161790556005918201549101556117cd565b6002848101548694506000935060ff168181111561151457fe5b14801561152b5750600484015460ff908116908416115b156115575760038401546004850154611550919061154b9060ff166104b7565b6105a6565b91506115a6565b600160028086015460ff169081111561156c57fe5b1480156115835750600484015460ff908116908416105b156115a657600384015460048501546115a3919061154b9060ff16610a2f565b91505b5080600160a060020a033016318111156115f65730600160a060020a031631846003015410156115db575060038301546115f6565b6115f36105b530600160a060020a031631605a6110ab565b90505b8360030154600a5403600a819055506000811115611640578354600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561164057600080fd5b6004848101805461ff00191661010060ff871602179055600585018390558454859060a060020a60ff02191660a060020a830217905550600160a060020a038087166000908152600b6020526040902085548154600160a060020a031916921691909117808255855486929160ff60a060020a928390041691839160a060020a60ff021916908360048111156116d257fe5b021790555060018281015482820155600280840154818401805460ff90921693909260ff1990921691849081111561170657fe5b02179055506003828101548282015560048084018054828501805460ff191660ff9283161780825592546101009081900483160261ff0019909316929092179091556005948501549490930193909355600187015490870154928701549092600160a060020a038a16927f72c920f9a1fce5ea63cf6a55ceb0a046f7cc454347b4418e9f90ecba4b574f63921687878760405194855260ff9384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a35b505050505050565b60008060008060079350600092506117f08385600654612036565b9150816040519081526020016040519081900390206000818152600d602052604090205490915081141561182357600080fd5b6000908152600c602052604090208054600160a060020a031916600160a060020a039590951694909417909355505050565b600054600160a060020a0316158061187f575060005461187d90600160a060020a03166119ec565b155b156118905761188e60006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156118d957600080fd5b6102c65a03f115156118ea57600080fd5b5050506040518051600154600160a060020a03908116911614905061198d5760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561195257600080fd5b6102c65a03f1151561196357600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663ca6ad1e48260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b15156119d557600080fd5b6102c65a03f115156119e657600080fd5b50505050565b3b90565b60006119fa6124e1565b92915050565b611a08613a4c565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a9e5780601f10611a7357610100808354040283529160200191611a9e565b820191906000526020600020905b815481529060010190602001808311611a8157829003601f168201915b5050505050905090565b600080611ab3613a4c565b611abb613a4c565b611ac3613a4c565b611acb613a4c565b600080611ad6613a4c565b8c604581518110611ae357fe5b016020015160f860020a9081900481020460660197506020604051805910611b085750595b818152601f19601f830116810160200160405290509650611b2e8d8960208a6000612805565b5060028a8d6000604051602001526040518083805190602001908083835b60208310611b6b5780518252601f199092019160209182019101611b4c565b6001836020036101000a0380198251168184511617909252505050919091019283525050602090810191506040518083038160008661646e5a03f11515611bb157600080fd5b505060405180519050604051908152602001604051908190039020876040518082805190602001908083835b60208310611bfc5780518252601f199092019160209182019101611bdd565b6001836020036101000a038019825116818451161790925250505091909101925060409150505190819003902014611c375760009850612026565b8c604a890181518110611c4657fe5b016020015160f860020a900460f860020a0260f860020a9004600201604051805910611c6f5750595b818152601f19601f830116810160200160405290509550611c988d896049018851896000612805565b50611d506002876000604051602001526040518082805190602001908083835b60208310611cd75780518252601f199092019160209182019101611cb8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515611d1957600080fd5b5050604051805190508c8f60288c0181518110611d3257fe5b016020015160f860020a900460f860020a0260f860020a900461285a565b1515611d5f5760009850612026565b6029604051805910611d6e5750595b818152601f19601f830116810160200160405290509450611d978d896020016029886000612805565b5060408051805910611da65750595b818152601f19601f830116810160200160405290509350855188602001602901016041019250611dde8d604085036040876000612805565b506002846000604051602001526040518082805190602001908083835b60208310611e1a5780518252601f199092019160209182019101611dfb565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515611e5c57600080fd5b505060405180519050915084826040518083805190602001908083835b60208310611e985780518252601f199092019160209182019101611e79565b6001836020036101000a0380198251168184511617909252505050919091019283525050602001905060405190819003902060008d8152600360205260409020541415611ef35760008c815260036020526040812055611efc565b60009850612026565b6049604051805910611f0b5750595b818152601f19601f830116810160200160405290509050611f318d896049846000612805565b50611fc26002826000604051602001526040518082805190602001908083835b60208310611f705780518252601f199092019160209182019101611f51565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515611fb257600080fd5b50506040518051905087866128e0565b1515611fd15760009850612026565b60008281526004602052604090205460ff16151561201157611ff38d84612af9565b6000838152600460205260409020805460ff19169115159190911790555b60008281526004602052604090205460ff1698505b5050505050505050949350505050565b6000612040613a4c565b612048613a4c565b612050613a4c565b600061205a613a4c565b612062613a4c565b61206a613a5e565b6000612074613a4c565b60008c118015612085575060208c11155b151561209057600080fd5b600a8d029c5060016040518059106120a55750595b818152601f19601f8301168101602001604052905098508b60f860020a02896000815181106120d057fe5b906020010190600160f860020a031916908160001a90535060206040518059106120f75750595b818152601f19601f830116810160200160405290509750602060405180591061211d5750595b818152601f19601f83011681016020016040529050965061213c612ef5565b95506020885242411860014303401860208901526020875285602088015260206040518059106121695750595b818152601f19601f8301168101602001604052905094508c602086015260086040518059106121955750595b818152601f19601f8301168101602001604052905093506121bc8560186008876000612805565b506080604051908101604052808981526020018a815260200188815260200186815250925061221f60408051908101604052600681527f72616e646f6d00000000000000000000000000000000000000000000000000006020820152848d613076565b915060086040518059106122305750595b8181526020601f909201601f191681018201604052915084015160f860020a810460278301537e01000000000000000000000000000000000000000000000000000000000000810460268301537d0100000000000000000000000000000000000000000000000000000000008104602583015360e060020a810460248301537b01000000000000000000000000000000000000000000000000000000810460238301537a0100000000000000000000000000000000000000000000000000008104602283015379010000000000000000000000000000000000000000000000000081046021830153780100000000000000000000000000000000000000000000000081046020830153506124d182826020860151600287516000604051602001526040518082805190602001908083835b602083106123805780518252601f199092019160209182019101612361565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f115156123c257600080fd5b50506040518051905060408801516040518085805190602001908083835b602083106123ff5780518252601f1990920191602091820191016123e0565b6001836020036101000a038019825116818451161790925250505091909101905084805190602001908083835b6020831061244b5780518252601f19909201916020918201910161242c565b6001836020036101000a038019825116818451161790925250505091909101848152602001905082805190602001908083835b6020831061249d5780518252601f19909201916020918201910161247e565b6001836020036101000a03801982511681845116179092525050509190910195506040945050505050518091039020613286565b509b9a5050505050505050505050565b600080612501731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed6119ec565b11156125715760008054600160a060020a031916731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed17905561256960408051908101604052600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152613298565b5060016106c0565b600061259073c03a2615d5efaf5f49f60b7bb6583eaec212fdf16119ec565b11156125f85760008054600160a060020a03191673c03a2615d5efaf5f49f60b7bb6583eaec212fdf117905561256960408051908101604052600c81527f6574685f726f707374656e3300000000000000000000000000000000000000006020820152613298565b600061261773b7a07bcf2ba2f2703b24c0691b5278999c59ac7e6119ec565b111561267f5760008054600160a060020a03191673b7a07bcf2ba2f2703b24c0691b5278999c59ac7e17905561256960408051908101604052600981527f6574685f6b6f76616e00000000000000000000000000000000000000000000006020820152613298565b600061269e73146500cfd35b22e4a392fe0adc06de1a1368ed486119ec565b11156127065760008054600160a060020a03191673146500cfd35b22e4a392fe0adc06de1a1368ed4817905561256960408051908101604052600b81527f6574685f72696e6b6562790000000000000000000000000000000000000000006020820152613298565b6000612725736f485c8bf6fc43ea212e93bbf8ce046c7f1cb4756119ec565b1115612759575060008054600160a060020a031916736f485c8bf6fc43ea212e93bbf8ce046c7f1cb47517905560016106c0565b60006127787320e12a1f859b3feae5fb2a0a32c18f5a65555bbf6119ec565b11156127ac575060008054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf17905560016106c0565b60006127cb7351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa6119ec565b11156127ff575060008054600160a060020a0319167351efaf4c8b3c9afbd5ab9f4bbc82784ab6ef8faa17905560016106c0565b50600090565b61280d613a4c565b838201600080828651101561282157600080fd5b505060208087019084015b86886020010182101561284d5781890151868201526020918201910161282c565b5093979650505050505050565b60006001818385511461286c57600080fd5b5060005b838110156128d35784818151811061288457fe5b016020015160f860020a900460f860020a02600160f860020a03191686826020811015156128ae57fe5b1a60f860020a02600160f860020a0319161415156128cb57600091505b600101612870565b8192505b50509392505050565b60008060008060006128f0613a4c565b60006128fa613a4c565b60206040518059106129095750595b8181526020601f909201601f19168101820160405293508a60038151811061292d57fe5b016020015160f860020a900460f860020a0260f860020a900403600401915061295b8a836020866000612805565b9250602060405180591061296c5750595b818152601f19601f8301168101602001604052905090506022820191506129c48a60208c600186038151811061299e57fe5b016020015160f860020a900460f860020a0260f860020a90040384016020846000612805565b905060208301519450602081015193506129e18b601b87876132ab565b9097509550600160a060020a038616896040518082805190602001908083835b60208310612a205780518252601f199092019160209182019101612a01565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051908190039020600160a060020a03161415612a655760019750612aeb565b612a728b601c87876132ab565b9097509550600160a060020a038616896040518082805190602001908083835b60208310612ab15780518252601f199092019160209182019101612a92565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051908190039020600160a060020a03161497505b505050505050509392505050565b600080612b04613a4c565b612b0c613a4c565b612b14613a4c565b612b1c613a4c565b612b24613a4c565b612b2c613a4c565b612b34613a4c565b8a8a60010181518110612b4357fe5b016020015160f860020a900460f860020a0260f860020a9004600201604051805910612b6c5750595b818152601f19601f830116810160200160405290509650612b928b8b89518a6000612805565b5060408051805910612ba15750595b818152601f19601f830116810160200160405290509550612bc88b60046040896000612805565b506062604051805910612bd85750595b818152601f19601f83011681016020016040529050945060f860020a85600081518110612c0157fe5b906020010190600160f860020a031916908160001a905350612c2b8b60418c036041886001612805565b506040805190810160405280602081526020017ffd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c8152509350612c748460006020886042612805565b50612d056002866000604051602001526040518082805190602001908083835b60208310612cb35780518252601f199092019160209182019101612c94565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515612cf557600080fd5b50506040518051905088886128e0565b9750871515612d175760009850612ee7565b606060405190810160405280604081526020017f7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e881526020017f537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e481525092506042604051805910612d855750595b818152601f19601f8301168101602001604052905091507ffe0000000000000000000000000000000000000000000000000000000000000082600081518110612dca57fe5b906020010190600160f860020a031916908160001a905350612df28b60036041856001612805565b508a604581518110612e0057fe5b016020015160f860020a900460f860020a0260f860020a9004600201604051805910612e295750595b818152601f19601f830116810160200160405290509050612e508b60448351846000612805565b50612ee16002836000604051602001526040518082805190602001908083835b60208310612e8f5780518252601f199092019160209182019101612e70565b6001836020036101000a03801982511681845116808217855250505050505090500191505060206040518083038160008661646e5a03f11515612ed157600080fd5b50506040518051905082856128e0565b97508798505b505050505050505092915050565b60008054600160a060020a03161580612f205750600054612f1e90600160a060020a03166119ec565b155b15612f3157612f2f60006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612f7a57600080fd5b6102c65a03f11515612f8b57600080fd5b5050506040518051600154600160a060020a03908116911614905061302e5760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515612ff357600080fd5b6102c65a03f1151561300457600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663abaa5f3e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561127957600080fd5b6000613080613a4c565b600054600160a060020a031615806130aa57506000546130a890600160a060020a03166119ec565b155b156130bb576130b960006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561310457600080fd5b6102c65a03f1151561311557600080fd5b5050506040518051600154600160a060020a0390811691161490506131b85760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561317d57600080fd5b6102c65a03f1151561318e57600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b60046040518059106131c75750595b9080825280602002602001820160405280156131fd57816020015b6131ea613a4c565b8152602001906001900390816131e25790505b50905083518160008151811061320f57fe5b6020908102909101015283600160200201518160018151811061322e57fe5b602090810291909101015260408401518160028151811061324b57fe5b602090810291909101015260608401518160038151811061326857fe5b6020908102909101015261327d8582856132eb565b95945050505050565b60009182526003602052604090912055565b60028180516106f1929160200190613a8b565b60008060008060405188815287602082015286604082015285606082015260208160808360006001610bb8f1925080519299929850919650505050505050565b6000806132f6613a4c565b600054600160a060020a03161580613320575060005461331e90600160a060020a03166119ec565b155b156133315761332f60006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561337a57600080fd5b6102c65a03f1151561338b57600080fd5b5050506040518051600154600160a060020a03908116911614905061342e5760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156133f357600080fd5b6102c65a03f1151561340457600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a0316632ef3accc87866000604051602001526040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561349f578082015183820152602001613487565b50505050905090810190601f1680156134cc5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15156134eb57600080fd5b6102c65a03f115156134fc57600080fd5b5050506040518051925050670de0b6b3a76400003a85020182111561352457600092506128d7565b61352d85613684565b600154909150600160a060020a031663c55c1cb683600089858983604051602001526040518663ffffffff1660e060020a028152600401808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156135ae578082015183820152602001613596565b50505050905090810190601f1680156135db5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156136115780820151838201526020016135f9565b50505050905090810190601f16801561363e5780820380516001836020036101000a031916815260200191505b5096505050505050506020604051808303818588803b151561365f57600080fd5b6125ee5a03f1151561367057600080fd5b505050506040518051979650505050505050565b61368c613a4c565b600080613697613a4c565b60008060006136a4613a4c565b60008060008b51995060009850896040518059106136bf5750595b9080825280602002602001820160405280156136f557816020015b6136e2613a4c565b8152602001906001900390816136da5790505b509750600096505b89871015613782578b878151811061371157fe5b9060200190602002015188888151811061372757fe5b602090810290910101526017600189898151811061374157fe5b90602001906020020151510381151561375657fe5b0488888151811061376357fe5b90602001906020020151510198909801600301976001909601956136fd565b600198909801976000955060808a019450886040518059106137a15750595b818152601f19601f8301168101602001604052905093505b60018690111561380b5760f860020a850286600181106137d557fe5b1a60f860020a028487815181106137e857fe5b906020010190600160f860020a031916908160001a9053506001909501946137b9565b600096505b898710156139eb577f5f0000000000000000000000000000000000000000000000000000000000000084878151811061384557fe5b906020010190600160f860020a031916908160001a905350600190950194600092505b87878151811061387457fe5b9060200190602002015151831015613997576017830615156139305760188389898151811061389f57fe5b90602001906020020151510310156138cf57828888815181106138be57fe5b9060200190602002015151036138d2565b60175b60400191508590505b808603600111156139305760f860020a8202818703600181106138fa57fe5b1a60f860020a0284878151811061390d57fe5b906020010190600160f860020a031916908160001a9053506001909501946138db565b87878151811061393c57fe5b90602001906020020151838151811061395157fe5b016020015160f860020a900460f860020a0284878151811061396f57fe5b906020010190600160f860020a031916908160001a9053506001958601959290920191613868565b7fff000000000000000000000000000000000000000000000000000000000000008487815181106139c457fe5b906020010190600160f860020a031916908160001a90535060019687019690950194613810565b50919a9950505050505050505050565b6101006040519081016040526000808252602082019081526020016000815260200160006002811115613a2a57fe5b8152600060208201819052604082018190526060820181905260809091015290565b60206040519081016040526000815290565b60806040519081016040526004815b613a75613a4c565b815260200190600190039081613a6d5790505090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613acc57805160ff1916838001178555613af9565b82800160010185558215613af9579182015b82811115613af9578251825591602001919060010190613ade565b50613b05929150613b09565b5090565b6106c091905b80821115613b055760008155600101613b0f565b600054600160a060020a03161580613b4d5750600054613b4b90600160a060020a03166119ec565b155b15613b5e57613b5c60006119f0565b505b60008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515613ba757600080fd5b6102c65a03f11515613bb857600080fd5b5050506040518051600154600160a060020a039081169116149050613c5b5760008054600160a060020a0316906338cc483190604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515613c2057600080fd5b6102c65a03f11515613c3157600080fd5b505050604051805160018054600160a060020a031916600160a060020a0392909216919091179055505b600154600160a060020a031663688dcfd78260405160e060020a63ffffffff84160281527fff000000000000000000000000000000000000000000000000000000000000009091166004820152602401600060405180830381600087803b15156119d557600080fd00a165627a7a72305820e89b8d9a8fb8edf63b0c7155100798a687f4d67b062b0c0779fa0c2042452ca30029

Swarm Source

bzzr://e89b8d9a8fb8edf63b0c7155100798a687f4d67b062b0c0779fa0c2042452ca3
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.