Contract 0xC95D227a1CF92b6FD156265AA8A3cA7c7DE0F28e 2

 
 
Txn Hash
Method
Block
From
To
Value
0x43f85b5b70718621b8cb18c7077a4098f3b6dbe76673c16c283573aca03f6b96Create Game56988002018-05-29 20:10:531703 days 12 hrs ago0x3b4772a5e2befc37efea27e7043bd19de1417554 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.04 Ether0.0004067815
0x9761ea4e56f2f7b2c1d6c217f7014dda58790bf077ef5742d6de39aeaa70b1b7Withdraw House S...56979912018-05-29 16:45:401703 days 16 hrs ago0x324ec9421c051d1ec1855ef6fe49263c02b35c77 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003124413
0xcb02229ab2d15aacd724bcf186b962602ccc23bd2da1134d427273cc0b0aba97Withdraw House S...56979722018-05-29 16:41:061703 days 16 hrs ago0x324ec9421c051d1ec1855ef6fe49263c02b35c77 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0005066113
0xc7224ae09df5cfd1fad8e5866390619b0e104945a4c2a5eebef929cd9a07fda4Transfer Profit ...56979472018-05-29 16:32:371703 days 16 hrs ago0x324ec9421c051d1ec1855ef6fe49263c02b35c77 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003798312
0x64f1dfa8610567ee13fbf3dea6c0ca934dc532751908d0415081091f45a4f332Pause56978662018-05-29 16:12:351703 days 16 hrs ago0x324ec9421c051d1ec1855ef6fe49263c02b35c77 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0005834612
0x0fb6dc69bc2f52be8114288beda5346508fa9bd3c6f792af7314e4b86077a7e8Server Force Gam...56950002018-05-29 4:01:041704 days 5 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0006851812
0x671942c189133878836ad1c4d17bbeeede120e552b6cb86f58a01e3ff162fb0fServer End Game ...56933582018-05-28 21:01:051704 days 12 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.002120611
0xaad723691f5c769d5781290eb9948e756ba5ed7d14c324cc76c2d45650e806f9Accept Game56917682018-05-28 14:18:261704 days 18 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0005139715
0x69b5791c30b1c3167393465bc77e5886ff75147a3653c35611c70a24dadae36dCreate Game56917572018-05-28 14:14:581704 days 18 hrs ago0x389c8319cc34057c20f44cbcef2be64b810e4ad3 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.08 Ether0.0013447511.57
0x7dfb849cd237350f62e33c104508c3f834d1880ac769acd0a964bd17414ea34fServer Force Gam...56694922018-05-24 16:01:061708 days 17 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0007422813
0xfb4956598b625cd56b0b77dfaf740b47e67578ff660449f93bc79eebabc1492fServer End Game ...56678972018-05-24 9:02:271709 days 1 min ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0026962614
0x61e3bcaf70ef81dbc10fd9806efdcf0b4cb6449918b7604dabb9571575e9cdb1Server End Game56678312018-05-24 8:44:261709 days 19 mins ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0014420414
0x9e717fe20ec383ba9923af1fc624579b1dae79cbd5449a9b60c0e1b79e284992Accept Game56661492018-05-24 1:29:011709 days 7 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003762111
0xf28c4d97121ca7315a40f8aad6edd4c0bcd02c43e90b0e8b7883bc6c4dfbd6b3Create Game56661472018-05-24 1:28:471709 days 7 hrs ago0x96fa4cbb4869efdfec0c97f1178ca02da4cfe084 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.01 Ether0.0008623810
0x15830d9c1437eccf2d88d2a404bb8c1f8afaecd5aeb6a1723a5788dfe82525c6Server End Game56661412018-05-24 1:27:481709 days 7 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0009887911
0xefa1ca96a3cb6adf5a61249025baa9e07b1c26196bb404e1d38ce85b32bf15b1Accept Game56660812018-05-24 1:11:141709 days 7 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003769111
0x511f413c95b3d8a101a6ce751c32ca08819a0651f213a0e3511ff8dd33367e4fCreate Game56660772018-05-24 1:10:141709 days 7 hrs ago0x96fa4cbb4869efdfec0c97f1178ca02da4cfe084 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.05 Ether0.000909999
0xda3c6df5f515f882e42e45c77072fe8f36c0519403504b2bfe5a7e382f4bbe1aAccept Game56653682018-05-23 22:15:001709 days 10 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003769111
0x7d4c6b45e95586290698526aff997a2bf6881806d36d0b480bbc40e89151f0edCreate Game56653652018-05-23 22:12:501709 days 10 hrs ago0x907e272d23b018a947e24aa54ce3ada7c67c5901 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.04 Ether0.000931299.2
0x59d948e13f992c50515cc1feefa4d5e3516abd1e3d34ad3b14a163c8f3e32f60Server End Game56653572018-05-23 22:11:061709 days 10 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.000792029
0x4afcc76c9ec4185b953471d6fc0b4f65e25a09b4adc4c9d07e3c3396848dc0ceAccept Game56652662018-05-23 21:51:451709 days 11 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0003769111
0x26b5e20e44d6ceedd5280d932e5ea9b9e1a3d36aa6ff30c91717d1d88afc36c8Create Game56652642018-05-23 21:51:181709 days 11 hrs ago0x907e272d23b018a947e24aa54ce3ada7c67c5901 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.01 Ether0.0014586914.41
0x41ef5702dd2fe716e55a56c0b3f97f7243407e73b7b3960b5e90b7833abc55a7Server End Game56647572018-05-23 19:44:231709 days 13 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.0009673211
0xf6855cbfe6bd3ed7aeb07a6230076368ca1c6a3c2b6d97819ad395073f15a830Accept Game56645512018-05-23 18:45:291709 days 14 hrs ago0xcef260a5fed7a896bbe07b933b3a5c17aec094d8 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0 Ether0.000283568.29099654
0x4c8ffa15a7d8ae3734ff0131ac2713a44ff6367c382fc4861bab70fb715acf11Create Game56645472018-05-23 18:44:561709 days 14 hrs ago0xfe81103ae134f50d211c17c58746ed00408b7587 IN  0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0.1 Ether0.00094059.29099654
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x9761ea4e56f2f7b2c1d6c217f7014dda58790bf077ef5742d6de39aeaa70b1b756979912018-05-29 16:45:401703 days 16 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x324ec9421c051d1ec1855ef6fe49263c02b35c7710.055 Ether
0xcb02229ab2d15aacd724bcf186b962602ccc23bd2da1134d427273cc0b0aba9756979722018-05-29 16:41:061703 days 16 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x324ec9421c051d1ec1855ef6fe49263c02b35c770.001 Ether
0xc7224ae09df5cfd1fad8e5866390619b0e104945a4c2a5eebef929cd9a07fda456979472018-05-29 16:32:371703 days 16 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x71be1ace87248f3950bdfc4c89b4b3eed059f6f31.13838509 Ether
0x61e3bcaf70ef81dbc10fd9806efdcf0b4cb6449918b7604dabb9571575e9cdb156678312018-05-24 8:44:261709 days 19 mins ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x907e272d23b018a947e24aa54ce3ada7c67c59010.00000403 Ether
0x59d948e13f992c50515cc1feefa4d5e3516abd1e3d34ad3b14a163c8f3e32f6056653572018-05-23 22:11:061709 days 10 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x907e272d23b018a947e24aa54ce3ada7c67c59010.00000983 Ether
0x41ef5702dd2fe716e55a56c0b3f97f7243407e73b7b3960b5e90b7833abc55a756647572018-05-23 19:44:231709 days 13 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.01338875 Ether
0x4565950ae753eb8f72027203dbf386d60fb52553d54283d8bf696514171a401956637902018-05-23 15:37:421709 days 17 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.12431561 Ether
0xa8891edcfce042160f466f08d60edc2be970f1e090a27c2b26a860fd643538f256605742018-05-23 1:41:471710 days 7 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x907e272d23b018a947e24aa54ce3ada7c67c59010.5 Ether
0x1bba86dfd6069f7d71b863ea5bdc4d5710bf02c00676b889a331489aa3e9e76456601902018-05-23 0:09:381710 days 8 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.13311959 Ether
0xacaa470021e4164cd2806b2c947bd2201c01faefcc6a1035d170e7353f56fe9c56592122018-05-22 20:00:241710 days 13 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.12624028 Ether
0x11205947663c177c571589278f1a30ca25d1fd251396ebc00850fc78a8e4685d56590062018-05-22 19:07:001710 days 13 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.11333696 Ether
0x1976f4bdc2d1c38b333426a9c7d8ab29abdcf422f8e6ba9ff13f320e3086e6cd56540892018-05-21 22:00:211711 days 11 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x9ff888624282e70d303c0a9f493116c56d3561520.0387 Ether
0x49e96b584e537639b760d1fa997e54c01d9394c044b63692eb5e93d7f7c374ef56536412018-05-21 20:07:081711 days 12 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x3e186ef6395e1ad9edd1429b158475194d05fcc30.000027 Ether
0x6329980d4f9d0638db31d4182e0d3c11fb5b8a60aa30cd8682b63b54d7d35c4356534172018-05-21 19:11:051711 days 13 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.00660714 Ether
0x3fbc802d3c4eee520f75854c2659f320f2ff5def13772b8a6405a63bf83aa5b056527102018-05-21 16:11:321711 days 16 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x363de2940e24e0d462aa784cfbbad35271e8c29a0.0044 Ether
0x87fa7d7c4d729d426c6e3ef276041b82e2455d71bbebe7f2034139516393272e56465162018-05-20 14:00:131712 days 19 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x9b52c2ef58c36a7e123189773441a96103e1f5b40.009 Ether
0xc281db4803754ee9ed944a8a0ca6b6dc81a1ec9a4c3dc4107967fb065e70986456450202018-05-20 7:43:481713 days 1 hr ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x363de2940e24e0d462aa784cfbbad35271e8c29a0.0191 Ether
0xa41d9426bac46c2c27d9a12c2f7aaaebdaf88ab9feda52bc854e33a69803f84c56309142018-05-17 19:29:511715 days 13 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x9ff888624282e70d303c0a9f493116c56d3561520.04585 Ether
0xcd9c5a91f9adb9ac9a4aec931e5cb07cae2d2f343de55017d931be7756f7e96756262752018-05-16 23:59:441716 days 9 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0x7c5babf48ef0828b1a51a15389e009ce0dcba1260.02982808 Ether
0xa351ab340186101e6fc2ee830d6e8125d907a6b1ea7dbd11cc79240bf1d0129156246862018-05-16 17:27:491716 days 15 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xdade02f2d7a20ee3cad4c181f32408332a90d6e30.000008 Ether
0xf00a379bc7dbdd93647c134fa72d1e76723e69390de223688af683a3532b851656218252018-05-16 5:10:401717 days 3 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xc4924d577a64747ad4c44a34321bb3284d1270150.00000438 Ether
0xa94dd1b0e752fcae8af0c93194d665d891e841189b9ba0b50c046a8b5826d97556215532018-05-16 4:01:181717 days 5 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xc4924d577a64747ad4c44a34321bb3284d1270150.01679889 Ether
0x536044eb7fa0975bad13df177b37e049afd180571270a3a52b81fc943458413356206872018-05-16 0:14:561717 days 8 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.06083848 Ether
0x4d417ad7647b87e09999a18bb34a19971c920d4e1d4cc29fd1b35d5a46b11bbe56197462018-05-15 20:32:291717 days 12 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xdade02f2d7a20ee3cad4c181f32408332a90d6e30.051375 Ether
0x5a5870c0a958f9f067aaf7f448ed6a8735c0debf0d98c1cdaec00728673fa07956188182018-05-15 16:28:591717 days 16 hrs ago 0xc95d227a1cf92b6fd156265aa8a3ca7c7de0f28e0xfe81103ae134f50d211c17c58746ed00408b75870.00124284 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GameChannel

Compiler Version
v0.4.18+commit.9cf6e910

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

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

pragma solidity ^0.4.18;

interface ConflictResolutionInterface {
    function minHouseStake(uint activeGames) public pure returns(uint);

    function maxBalance() public pure returns(int);

    function isValidBet(uint8 _gameType, uint _betNum, uint _betValue) public pure returns(bool);

    function endGameConflict(
        uint8 _gameType,
        uint _betNum,
        uint _betValue,
        int _balance,
        uint _stake,
        bytes32 _serverSeed,
        bytes32 _playerSeed
    )
        public
        view
        returns(int);

    function serverForceGameEnd(
        uint8 gameType,
        uint _betNum,
        uint _betValue,
        int _balance,
        uint _stake,
        uint _endInitiatedTime
    )
        public
        view
        returns(int);

    function playerForceGameEnd(
        uint8 _gameType,
        uint _betNum,
        uint _betValue,
        int _balance,
        uint _stake,
        uint _endInitiatedTime
    )
        public
        view
        returns(int);
}

library MathUtil {
    /**
     * @dev Returns the absolute value of _val.
     * @param _val value
     * @return The absolute value of _val.
     */
    function abs(int _val) internal pure returns(uint) {
        if (_val < 0) {
            return uint(-_val);
        } else {
            return uint(_val);
        }
    }

    /**
     * @dev Calculate maximum.
     */
    function max(uint _val1, uint _val2) internal pure returns(uint) {
        return _val1 >= _val2 ? _val1 : _val2;
    }

    /**
     * @dev Calculate minimum.
     */
    function min(uint _val1, uint _val2) internal pure returns(uint) {
        return _val1 <= _val2 ? _val1 : _val2;
    }
}

contract Ownable {
    address public owner;

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

    /**
     * @dev Modifier, which throws if called by other account than owner.
     */
    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    /**
     * @dev Set contract creator as initial owner
     */
    function Ownable() public {
        owner = msg.sender;
    }

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

contract ConflictResolutionManager is Ownable {
    /// @dev Conflict resolution contract.
    ConflictResolutionInterface public conflictRes;

    /// @dev New Conflict resolution contract.
    address public newConflictRes = 0;

    /// @dev Time update of new conflict resolution contract was initiated.
    uint public updateTime = 0;

    /// @dev Min time before new conflict res contract can be activated after initiating update.
    uint public constant MIN_TIMEOUT = 3 days;

    /// @dev Min time before new conflict res contract can be activated after initiating update.
    uint public constant MAX_TIMEOUT = 6 days;

    /// @dev Update of conflict resolution contract was initiated.
    event LogUpdatingConflictResolution(address newConflictResolutionAddress);

    /// @dev New conflict resolution contract is active.
    event LogUpdatedConflictResolution(address newConflictResolutionAddress);

    /**
     * @dev Constructor
     * @param _conflictResAddress conflict resolution contract address.
     */
    function ConflictResolutionManager(address _conflictResAddress) public {
        conflictRes = ConflictResolutionInterface(_conflictResAddress);
    }

    /**
     * @dev Initiate conflict resolution contract update.
     * @param _newConflictResAddress New conflict resolution contract address.
     */
    function updateConflictResolution(address _newConflictResAddress) public onlyOwner {
        newConflictRes = _newConflictResAddress;
        updateTime = block.timestamp;

        LogUpdatingConflictResolution(_newConflictResAddress);
    }

    /**
     * @dev Active new conflict resolution contract.
     */
    function activateConflictResolution() public onlyOwner {
        require(newConflictRes != 0);
        require(updateTime != 0);
        require(updateTime + MIN_TIMEOUT <= block.timestamp && block.timestamp <= updateTime + MAX_TIMEOUT);

        conflictRes = ConflictResolutionInterface(newConflictRes);
        newConflictRes = 0;
        updateTime = 0;

        LogUpdatedConflictResolution(newConflictRes);
    }
}

contract Pausable is Ownable {
    /// @dev Is contract paused.
    bool public paused = false;

    /// @dev Time pause was called
    uint public timePaused = 0;

    /// @dev Modifier, which only allows function execution if not paused.
    modifier onlyNotPaused() {
        require(!paused);
        _;
    }

    /// @dev Modifier, which only allows function execution if paused.
    modifier onlyPaused() {
        require(paused);
        _;
    }

    /// @dev Modifier, which only allows function execution if paused longer than timeSpan.
    modifier onlyPausedSince(uint timeSpan) {
        require(paused && timePaused + timeSpan <= block.timestamp);
        _;
    }

    /// @dev Event is fired if paused.
    event LogPause();

    /// @dev Event is fired if pause is ended.
    event LogUnpause();

    /**
     * @dev Pause contract. No new game sessions can be created.
     */
    function pause() public onlyOwner onlyNotPaused {
        paused = true;
        timePaused = block.timestamp;
        LogPause();
    }

    /**
     * @dev Unpause contract.
     */
    function unpause() public onlyOwner onlyPaused {
        paused = false;
        timePaused = 0;
        LogUnpause();
    }
}

contract Destroyable is Pausable {
    /// @dev After pausing the contract for 20 days owner can selfdestruct it.
    uint public constant TIMEOUT_DESTROY = 20 days;

    /**
     * @dev Destroy contract and transfer ether to address _targetAddress.
     */
    function destroy() public onlyOwner onlyPausedSince(TIMEOUT_DESTROY) {
        selfdestruct(owner);
    }
}

contract GameChannelBase is Destroyable, ConflictResolutionManager {
    /// @dev Different game session states.
    enum GameStatus {
        ENDED, ///< @dev Game session is ended.
        ACTIVE, ///< @dev Game session is active.
        WAITING_FOR_SERVER, ///< @dev Waiting for server to accept game session.
        PLAYER_INITIATED_END, ///< @dev Player initiated non regular end.
        SERVER_INITIATED_END ///< @dev Server initiated non regular end.
    }

    /// @dev Reason game session ended.
    enum ReasonEnded {
        REGULAR_ENDED, ///< @dev Game session is regularly ended.
        END_FORCED_BY_SERVER, ///< @dev Player did not respond. Server forced end.
        END_FORCED_BY_PLAYER, ///< @dev Server did not respond. Player forced end.
        REJECTED_BY_SERVER, ///< @dev Server rejected game session.
        CANCELLED_BY_PLAYER ///< @dev Player canceled game session before server accepted it.
    }

    struct Game {
        /// @dev Game session status.
        GameStatus status;

        /// @dev Reason game session ended.
        ReasonEnded reasonEnded;

        /// @dev Player's stake.
        uint stake;

        /// @dev Last game round info if not regularly ended.
        /// If game session is ended normally this data is not used.
        uint8 gameType;
        uint32 roundId;
        uint16 betNum;
        uint betValue;
        int balance;
        bytes32 playerSeed;
        bytes32 serverSeed;
        uint endInitiatedTime;
    }

    /// @dev Minimal time span between profit transfer.
    uint public constant MIN_TRANSFER_TIMESPAN = 1 days;

    /// @dev Maximal time span between profit transfer.
    uint public constant MAX_TRANSFER_TIMSPAN = 6 * 30 days;

    /// @dev Current active game sessions.
    uint public activeGames = 0;

    /// @dev Game session id counter. Points to next free game session slot. So gameIdCntr -1 is the
    // number of game sessions created.
    uint public gameIdCntr;

    /// @dev Only this address can accept and end games.
    address public serverAddress;

    /// @dev Address to transfer profit to.
    address public houseAddress;

    /// @dev Current house stake.
    uint public houseStake = 0;

    /// @dev House profit since last profit transfer.
    int public houseProfit = 0;

    /// @dev Min value player needs to deposit for creating game session.
    uint public minStake;

    /// @dev Max value player can deposit for creating game session.
    uint public maxStake;

    /// @dev Timeout until next profit transfer is allowed.
    uint public profitTransferTimeSpan = 14 days;

    /// @dev Last time profit transferred to house.
    uint public lastProfitTransferTimestamp;

    bytes32 public typeHash;

    /// @dev Maps gameId to game struct.
    mapping (uint => Game) public gameIdGame;

    /// @dev Maps player address to current player game id.
    mapping (address => uint) public playerGameId;

    /// @dev Maps player address to pending returns.
    mapping (address => uint) public pendingReturns;

    /// @dev Modifier, which only allows to execute if house stake is high enough.
    modifier onlyValidHouseStake(uint _activeGames) {
        uint minHouseStake = conflictRes.minHouseStake(_activeGames);
        require(houseStake >= minHouseStake);
        _;
    }

    /// @dev Modifier to check if value send fulfills player stake requirements.
    modifier onlyValidValue() {
        require(minStake <= msg.value && msg.value <= maxStake);
        _;
    }

    /// @dev Modifier, which only allows server to call function.
    modifier onlyServer() {
        require(msg.sender == serverAddress);
        _;
    }

    /// @dev Modifier, which only allows to set valid transfer timeouts.
    modifier onlyValidTransferTimeSpan(uint transferTimeout) {
        require(transferTimeout >= MIN_TRANSFER_TIMESPAN
                && transferTimeout <= MAX_TRANSFER_TIMSPAN);
        _;
    }

    /// @dev This event is fired when player creates game session.
    event LogGameCreated(address indexed player, uint indexed gameId, uint stake, bytes32 endHash);

    /// @dev This event is fired when server rejects player's game.
    event LogGameRejected(address indexed player, uint indexed gameId);

    /// @dev This event is fired when server accepts player's game.
    event LogGameAccepted(address indexed player, uint indexed gameId, bytes32 endHash);

    /// @dev This event is fired when player requests conflict end.
    event LogPlayerRequestedEnd(address indexed player, uint indexed gameId);

    /// @dev This event is fired when server requests conflict end.
    event LogServerRequestedEnd(address indexed player, uint indexed gameId);

    /// @dev This event is fired when game session is ended.
    event LogGameEnded(address indexed player, uint indexed gameId, ReasonEnded reason);

    /// @dev this event is fired when owner modifies player's stake limits.
    event LogStakeLimitsModified(uint minStake, uint maxStake);

    /**
     * @dev Contract constructor.
     * @param _serverAddress Server address.
     * @param _minStake Min value player needs to deposit to create game session.
     * @param _maxStake Max value player can deposit to create game session.
     * @param _conflictResAddress Conflict resolution contract address.
     * @param _houseAddress House address to move profit to.
     */
    function GameChannelBase(
        address _serverAddress,
        uint _minStake,
        uint _maxStake,
        address _conflictResAddress,
        address _houseAddress,
        uint _gameIdCntr
    )
        public
        ConflictResolutionManager(_conflictResAddress)
    {
        require(_minStake > 0 && _minStake <= _maxStake);
        require(_gameIdCntr > 0);

        gameIdCntr = _gameIdCntr;
        serverAddress = _serverAddress;
        houseAddress = _houseAddress;
        lastProfitTransferTimestamp = block.timestamp;
        minStake = _minStake;
        maxStake = _maxStake;

        typeHash = keccak256(
            "uint32 Round Id",
            "uint8 Game Type",
            "uint16 Number",
            "uint Value (Wei)",
            "int Current Balance (Wei)",
            "bytes32 Server Hash",
            "bytes32 Player Hash",
            "uint Game Id",
            "address Contract Address"
        );
    }

    /**
     * @notice Withdraw pending returns.
     */
    function withdraw() public {
        uint toTransfer = pendingReturns[msg.sender];
        require(toTransfer > 0);

        pendingReturns[msg.sender] = 0;
        msg.sender.transfer(toTransfer);
    }

    /**
     * @notice Transfer house profit to houseAddress.
     */
    function transferProfitToHouse() public {
        require(lastProfitTransferTimestamp + profitTransferTimeSpan <= block.timestamp);

        if (houseProfit <= 0) {
            // update last transfer timestamp
            lastProfitTransferTimestamp = block.timestamp;
            return;
        }

        // houseProfit is gt 0 => safe to cast
        uint toTransfer = uint(houseProfit);
        assert(houseStake >= toTransfer);

        houseProfit = 0;
        lastProfitTransferTimestamp = block.timestamp;
        houseStake = houseStake - toTransfer;

        houseAddress.transfer(toTransfer);
    }

    /**
     * @dev Set profit transfer time span.
     */
    function setProfitTransferTimeSpan(uint _profitTransferTimeSpan)
        public
        onlyOwner
        onlyValidTransferTimeSpan(_profitTransferTimeSpan)
    {
        profitTransferTimeSpan = _profitTransferTimeSpan;
    }

    /**
     * @dev Increase house stake by msg.value
     */
    function addHouseStake() public payable onlyOwner {
        houseStake += msg.value;
    }

    /**
     * @dev Withdraw house stake.
     */
    function withdrawHouseStake(uint value) public onlyOwner {
        uint minHouseStake = conflictRes.minHouseStake(activeGames);

        require(value <= houseStake && houseStake - value >= minHouseStake);
        require(houseProfit <= 0 || uint(houseProfit) <= houseStake - value);

        houseStake = houseStake - value;
        owner.transfer(value);
    }

    /**
     * @dev Withdraw house stake and profit.
     */
    function withdrawAll() public onlyOwner onlyPausedSince(3 days) {
        houseProfit = 0;
        uint toTransfer = houseStake;
        houseStake = 0;
        owner.transfer(toTransfer);
    }

    /**
     * @dev Set new house address.
     * @param _houseAddress New house address.
     */
    function setHouseAddress(address _houseAddress) public onlyOwner {
        houseAddress = _houseAddress;
    }

    /**
     * @dev Set stake min and max value.
     * @param _minStake Min stake.
     * @param _maxStake Max stake.
     */
    function setStakeRequirements(uint _minStake, uint _maxStake) public onlyOwner {
        require(_minStake > 0 && _minStake <= _maxStake);
        minStake = _minStake;
        maxStake = _maxStake;
        LogStakeLimitsModified(minStake, maxStake);
    }

    /**
     * @dev Close game session.
     * @param _game Game session data.
     * @param _gameId Id of game session.
     * @param _playerAddress Player's address of game session.
     * @param _reason Reason for closing game session.
     * @param _balance Game session balance.
     */
    function closeGame(
        Game storage _game,
        uint _gameId,
        address _playerAddress,
        ReasonEnded _reason,
        int _balance
    )
        internal
    {
        _game.status = GameStatus.ENDED;
        _game.reasonEnded = _reason;
        _game.balance = _balance;

        assert(activeGames > 0);
        activeGames = activeGames - 1;

        LogGameEnded(_playerAddress, _gameId, _reason);
    }

    /**
     * @dev End game by paying out player and server.
     * @param _game Game session to payout.
     * @param _playerAddress Player's address.
     */
    function payOut(Game storage _game, address _playerAddress) internal {
        assert(_game.balance <= conflictRes.maxBalance());
        assert(_game.status == GameStatus.ENDED);
        assert(_game.stake <= maxStake);
        assert((int(_game.stake) + _game.balance) >= 0);

        uint valuePlayer = uint(int(_game.stake) + _game.balance);

        if (_game.balance > 0 && int(houseStake) < _game.balance) {
            // Should never happen!
            // House is bankrupt.
            // Payout left money.
            valuePlayer = houseStake;
        }

        houseProfit = houseProfit - _game.balance;

        int newHouseStake = int(houseStake) - _game.balance;
        assert(newHouseStake >= 0);
        houseStake = uint(newHouseStake);

        pendingReturns[_playerAddress] += valuePlayer;
        if (pendingReturns[_playerAddress] > 0) {
            safeSend(_playerAddress);
        }
    }

    /**
     * @dev Send value of pendingReturns[_address] to _address.
     * @param _address Address to send value to.
     */
    function safeSend(address _address) internal {
        uint valueToSend = pendingReturns[_address];
        assert(valueToSend > 0);

        pendingReturns[_address] = 0;
        if (_address.send(valueToSend) == false) {
            pendingReturns[_address] = valueToSend;
        }
    }

    /**
     * @dev Verify signature of given data. Throws on verification failure.
     * @param _sig Signature of given data in the form of rsv.
     * @param _address Address of signature signer.
     */
    function verifySig(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress,
        bytes _sig,
        address _address
    )
        internal
        view
    {
        // check if this is the correct contract
        address contractAddress = this;
        require(_contractAddress == contractAddress);

        bytes32 roundHash = calcHash(
                _roundId,
                _gameType,
                _num,
                _value,
                _balance,
                _serverHash,
                _playerHash,
                _gameId,
                _contractAddress
        );

        verify(
                roundHash,
                _sig,
                _address
        );
    }

    /**
     * @dev Calculate typed hash of given data (compare eth_signTypedData).
     * @return Hash of given data.
     */
    function calcHash(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress
    )
        private
        view
        returns(bytes32)
    {
        bytes32 dataHash = keccak256(
            _roundId,
            _gameType,
            _num,
            _value,
            _balance,
            _serverHash,
            _playerHash,
            _gameId,
            _contractAddress
        );

        return keccak256(typeHash, dataHash);
    }

     /**
     * @dev Check if _sig is valid signature of _hash. Throws if invalid signature.
     * @param _hash Hash to check signature of.
     * @param _sig Signature of _hash.
     * @param _address Address of signer.
     */
    function verify(
        bytes32 _hash,
        bytes _sig,
        address _address
    )
        private
        pure
    {
        var (r, s, v) = signatureSplit(_sig);
        address addressRecover = ecrecover(_hash, v, r, s);
        require(addressRecover == _address);
    }

    /**
     * @dev Split the given signature of the form rsv in r s v. v is incremented with 27 if
     * it is below 2.
     * @param _signature Signature to split.
     * @return r s v
     */
    function signatureSplit(bytes _signature)
        private
        pure
        returns (bytes32 r, bytes32 s, uint8 v)
    {
        require(_signature.length == 65);

        assembly {
            r := mload(add(_signature, 32))
            s := mload(add(_signature, 64))
            v := and(mload(add(_signature, 65)), 0xff)
        }
        if (v < 2) {
            v = v + 27;
        }
    }
}

contract GameChannelConflict is GameChannelBase {
    /**
     * @dev Contract constructor.
     * @param _serverAddress Server address.
     * @param _minStake Min value player needs to deposit to create game session.
     * @param _maxStake Max value player can deposit to create game session.
     * @param _conflictResAddress Conflict resolution contract address
     * @param _houseAddress House address to move profit to
     */
    function GameChannelConflict(
        address _serverAddress,
        uint _minStake,
        uint _maxStake,
        address _conflictResAddress,
        address _houseAddress,
        uint _gameIdCtr
    )
        public
        GameChannelBase(_serverAddress, _minStake, _maxStake, _conflictResAddress, _houseAddress, _gameIdCtr)
    {
        // nothing to do
    }

    /**
     * @dev Used by server if player does not end game session.
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Balance before this bet.
     * @param _serverHash Hash of server seed for this bet.
     * @param _playerHash Hash of player seed for this bet.
     * @param _gameId Game session id.
     * @param _contractAddress Address of this contract.
     * @param _playerSig Player signature of this bet.
     * @param _playerAddress Address of player.
     * @param _serverSeed Server seed for this bet.
     * @param _playerSeed Player seed for this bet.
     */
    function serverEndGameConflict(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress,
        bytes _playerSig,
        address _playerAddress,
        bytes32 _serverSeed,
        bytes32 _playerSeed
    )
        public
        onlyServer
    {
        verifySig(
                _roundId,
                _gameType,
                _num,
                _value,
                _balance,
                _serverHash,
                _playerHash,
                _gameId,
                _contractAddress,
                _playerSig,
                _playerAddress
        );

        serverEndGameConflictImpl(
                _roundId,
                _gameType,
                _num,
                _value,
                _balance,
                _serverHash,
                _playerHash,
                _serverSeed,
                _playerSeed,
                _gameId,
                _playerAddress
        );
    }

    /**
     * @notice Can be used by player if server does not answer to the end game session request.
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Balance before this bet.
     * @param _serverHash Hash of server seed for this bet.
     * @param _playerHash Hash of player seed for this bet.
     * @param _gameId Game session id.
     * @param _contractAddress Address of this contract.
     * @param _serverSig Server signature of this bet.
     * @param _playerSeed Player seed for this bet.
     */
    function playerEndGameConflict(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress,
        bytes _serverSig,
        bytes32 _playerSeed
    )
        public
    {
        verifySig(
            _roundId,
            _gameType,
            _num,
            _value,
            _balance,
            _serverHash,
            _playerHash,
            _gameId,
            _contractAddress,
            _serverSig,
            serverAddress
        );

        playerEndGameConflictImpl(
            _roundId,
            _gameType,
            _num,
            _value,
            _balance,
            _playerHash,
            _playerSeed,
            _gameId,
            msg.sender
        );
    }

    /**
     * @notice Cancel active game without playing. Useful if server stops responding before
     * one game is played.
     * @param _gameId Game session id.
     */
    function playerCancelActiveGame(uint _gameId) public {
        address playerAddress = msg.sender;
        uint gameId = playerGameId[playerAddress];
        Game storage game = gameIdGame[gameId];

        require(gameId == _gameId);

        if (game.status == GameStatus.ACTIVE) {
            game.endInitiatedTime = block.timestamp;
            game.status = GameStatus.PLAYER_INITIATED_END;

            LogPlayerRequestedEnd(msg.sender, gameId);
        } else if (game.status == GameStatus.SERVER_INITIATED_END && game.roundId == 0) {
            closeGame(game, gameId, playerAddress, ReasonEnded.REGULAR_ENDED, 0);
            payOut(game, playerAddress);
        } else {
            revert();
        }
    }

    /**
     * @dev Cancel active game without playing. Useful if player starts game session and
     * does not play.
     * @param _playerAddress Players' address.
     * @param _gameId Game session id.
     */
    function serverCancelActiveGame(address _playerAddress, uint _gameId) public onlyServer {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];

        require(gameId == _gameId);

        if (game.status == GameStatus.ACTIVE) {
            game.endInitiatedTime = block.timestamp;
            game.status = GameStatus.SERVER_INITIATED_END;

            LogServerRequestedEnd(msg.sender, gameId);
        } else if (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId == 0) {
            closeGame(game, gameId, _playerAddress, ReasonEnded.REGULAR_ENDED, 0);
            payOut(game, _playerAddress);
        } else {
            revert();
        }
    }

    /**
    * @dev Force end of game if player does not respond. Only possible after a certain period of time
    * to give the player a chance to respond.
    * @param _playerAddress Player's address.
    */
    function serverForceGameEnd(address _playerAddress, uint _gameId) public onlyServer {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];

        require(gameId == _gameId);
        require(game.status == GameStatus.SERVER_INITIATED_END);

        // theoretically we have enough data to calculate winner
        // but as player did not respond assume he has lost.
        int newBalance = conflictRes.serverForceGameEnd(
            game.gameType,
            game.betNum,
            game.betValue,
            game.balance,
            game.stake,
            game.endInitiatedTime
        );

        closeGame(game, gameId, _playerAddress, ReasonEnded.END_FORCED_BY_SERVER, newBalance);
        payOut(game, _playerAddress);
    }

    /**
    * @notice Force end of game if server does not respond. Only possible after a certain period of time
    * to give the server a chance to respond.
    */
    function playerForceGameEnd(uint _gameId) public {
        address playerAddress = msg.sender;
        uint gameId = playerGameId[playerAddress];
        Game storage game = gameIdGame[gameId];

        require(gameId == _gameId);
        require(game.status == GameStatus.PLAYER_INITIATED_END);

        int newBalance = conflictRes.playerForceGameEnd(
            game.gameType,
            game.betNum,
            game.betValue,
            game.balance,
            game.stake,
            game.endInitiatedTime
        );

        closeGame(game, gameId, playerAddress, ReasonEnded.END_FORCED_BY_PLAYER, newBalance);
        payOut(game, playerAddress);
    }

    /**
     * @dev Conflict handling implementation. Stores game data and timestamp if game
     * is active. If server has already marked conflict for game session the conflict
     * resolution contract is used (compare conflictRes).
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Balance before this bet.
     * @param _playerHash Hash of player's seed for this bet.
     * @param _playerSeed Player's seed for this bet.
     * @param _gameId game Game session id.
     * @param _playerAddress Player's address.
     */
    function playerEndGameConflictImpl(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _playerHash,
        bytes32 _playerSeed,
        uint _gameId,
        address _playerAddress
    )
        private
    {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];
        int maxBalance = conflictRes.maxBalance();

        require(gameId == _gameId);
        require(_roundId > 0);
        require(keccak256(_playerSeed) == _playerHash);
        require(_value <= game.stake);
        require(-int(game.stake) <= _balance && _balance <= maxBalance); // save to cast as ranges are fixed
        require(int(game.stake) + _balance - int(_value) >= 0); // save to cast as ranges are fixed
        require(conflictRes.isValidBet(_gameType, _num, _value));

        if (game.status == GameStatus.SERVER_INITIATED_END && game.roundId == _roundId) {
            game.playerSeed = _playerSeed;
            endGameConflict(game, gameId, _playerAddress);
        } else if (game.status == GameStatus.ACTIVE
                || (game.status == GameStatus.SERVER_INITIATED_END && game.roundId < _roundId)) {
            game.status = GameStatus.PLAYER_INITIATED_END;
            game.endInitiatedTime = block.timestamp;
            game.roundId = _roundId;
            game.gameType = _gameType;
            game.betNum = _num;
            game.betValue = _value;
            game.balance = _balance;
            game.playerSeed = _playerSeed;
            game.serverSeed = bytes32(0);

            LogPlayerRequestedEnd(msg.sender, gameId);
        } else {
            revert();
        }
    }

    /**
     * @dev Conflict handling implementation. Stores game data and timestamp if game
     * is active. If player has already marked conflict for game session the conflict
     * resolution contract is used (compare conflictRes).
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Balance before this bet.
     * @param _serverHash Hash of server's seed for this bet.
     * @param _playerHash Hash of player's seed for this bet.
     * @param _serverSeed Server's seed for this bet.
     * @param _playerSeed Player's seed for this bet.
     * @param _playerAddress Player's address.
     */
    function serverEndGameConflictImpl(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        bytes32 _serverSeed,
        bytes32 _playerSeed,
        uint _gameId,
        address _playerAddress
    )
        private
    {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];
        int maxBalance = conflictRes.maxBalance();

        require(gameId == _gameId);
        require(_roundId > 0);
        require(keccak256(_serverSeed) == _serverHash);
        require(keccak256(_playerSeed) == _playerHash);
        require(_value <= game.stake);
        require(-int(game.stake) <= _balance && _balance <= maxBalance); // save to cast as ranges are fixed
        require(int(game.stake) + _balance - int(_value) >= 0); // save to cast as ranges are fixed
        require(conflictRes.isValidBet(_gameType, _num, _value));


        if (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId == _roundId) {
            game.serverSeed = _serverSeed;
            endGameConflict(game, gameId, _playerAddress);
        } else if (game.status == GameStatus.ACTIVE
                || (game.status == GameStatus.PLAYER_INITIATED_END && game.roundId < _roundId)) {
            game.status = GameStatus.SERVER_INITIATED_END;
            game.endInitiatedTime = block.timestamp;
            game.roundId = _roundId;
            game.gameType = _gameType;
            game.betNum = _num;
            game.betValue = _value;
            game.balance = _balance;
            game.serverSeed = _serverSeed;
            game.playerSeed = _playerSeed;

            LogServerRequestedEnd(_playerAddress, gameId);
        } else {
            revert();
        }
    }

    /**
     * @dev End conflicting game.
     * @param _game Game session data.
     * @param _gameId Game session id.
     * @param _playerAddress Player's address.
     */
    function endGameConflict(Game storage _game, uint _gameId, address _playerAddress) private {
        int newBalance = conflictRes.endGameConflict(
            _game.gameType,
            _game.betNum,
            _game.betValue,
            _game.balance,
            _game.stake,
            _game.serverSeed,
            _game.playerSeed
        );

        closeGame(_game, _gameId, _playerAddress, ReasonEnded.REGULAR_ENDED, newBalance);
        payOut(_game, _playerAddress);
    }
}

contract GameChannel is GameChannelConflict {
    /**
     * @dev contract constructor
     * @param _serverAddress Server address.
     * @param _minStake Min value player needs to deposit to create game session.
     * @param _maxStake Max value player can deposit to create game session.
     * @param _conflictResAddress Conflict resolution contract address.
     * @param _houseAddress House address to move profit to.
     */
    function GameChannel(
        address _serverAddress,
        uint _minStake,
        uint _maxStake,
        address _conflictResAddress,
        address _houseAddress,
        uint _gameIdCntr
    )
        public
        GameChannelConflict(_serverAddress, _minStake, _maxStake, _conflictResAddress, _houseAddress, _gameIdCntr)
    {
        // nothing to do
    }

    /**
     * @notice Create games session request. msg.value needs to be valid stake value.
     * @param _endHash Last hash of the hash chain generated by the player.
     */
    function createGame(bytes32 _endHash)
        public
        payable
        onlyValidValue
        onlyValidHouseStake(activeGames + 1)
        onlyNotPaused
    {
        address playerAddress = msg.sender;
        uint previousGameId = playerGameId[playerAddress];
        Game storage game = gameIdGame[previousGameId];

        require(game.status == GameStatus.ENDED);

        uint gameId = gameIdCntr++;
        playerGameId[playerAddress] = gameId;
        Game storage newGame = gameIdGame[gameId];

        newGame.stake = msg.value;
        newGame.status = GameStatus.WAITING_FOR_SERVER;

        activeGames = activeGames + 1;

        LogGameCreated(playerAddress, gameId, msg.value, _endHash);
    }

    /**
     * @notice Cancel game session waiting for server acceptance.
     * @param _gameId Game session id.
     */
    function cancelGame(uint _gameId) public {
        address playerAddress = msg.sender;
        uint gameId = playerGameId[playerAddress];
        Game storage game = gameIdGame[gameId];

        require(gameId == _gameId);
        require(game.status == GameStatus.WAITING_FOR_SERVER);

        closeGame(game, gameId, playerAddress, ReasonEnded.CANCELLED_BY_PLAYER, 0);
        payOut(game, playerAddress);
    }

    /**
     * @dev Called by the server to reject game session created by player with address
     * _playerAddress.
     * @param _playerAddress Players's address who created the game session.
     * @param _gameId Game session id.
     */
    function rejectGame(address _playerAddress, uint _gameId) public onlyServer {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];

        require(_gameId == gameId);
        require(game.status == GameStatus.WAITING_FOR_SERVER);

        closeGame(game, gameId, _playerAddress, ReasonEnded.REJECTED_BY_SERVER, 0);
        payOut(game, _playerAddress);

        LogGameRejected(_playerAddress, gameId);
    }

    /**
     * @dev Called by server to accept game session created by player with
     * address _playerAddress.
     * @param _playerAddress Player's address who created the game.
     * @param _gameId Game id of game session.
     * @param _endHash Last hash of the hash chain generated by the server.
     */
    function acceptGame(address _playerAddress, uint _gameId, bytes32 _endHash)
        public
        onlyServer
    {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];

        require(_gameId == gameId);
        require(game.status == GameStatus.WAITING_FOR_SERVER);

        game.status = GameStatus.ACTIVE;

        LogGameAccepted(_playerAddress, gameId, _endHash);
    }

    /**
     * @dev Regular end game session. Used if player and house have both
     * accepted current game session state.
     * The game session with gameId _gameId is closed
     * and the player paid out. This functions is called by the server after
     * the player requested the termination of the current game session.
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Current balance.
     * @param _serverHash Hash of server's seed for this bet.
     * @param _playerHash Hash of player's seed for this bet.
     * @param _gameId Game session id.
     * @param _contractAddress Address of this contract.
     * @param _playerAddress Address of player.
     * @param _playerSig Player's signature of this bet.
     */
    function serverEndGame(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress,
        address _playerAddress,
        bytes _playerSig
    )
        public
        onlyServer
    {
        verifySig(
                _roundId,
                _gameType,
                _num,
                _value,
                _balance,
                _serverHash,
                _playerHash,
                _gameId,
                _contractAddress,
                _playerSig,
                _playerAddress
        );

        regularEndGame(_playerAddress, _roundId, _gameType, _num, _value, _balance, _gameId, _contractAddress);
    }

    /**
     * @notice Regular end game session. Normally not needed as server ends game (@see serverEndGame).
     * Can be used by player if server does not end game session.
     * @param _roundId Round id of bet.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Current balance.
     * @param _serverHash Hash of server's seed for this bet.
     * @param _playerHash Hash of player's seed for this bet.
     * @param _gameId Game session id.
     * @param _contractAddress Address of this contract.
     * @param _serverSig Server's signature of this bet.
     */
    function playerEndGame(
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        bytes32 _serverHash,
        bytes32 _playerHash,
        uint _gameId,
        address _contractAddress,
        bytes _serverSig
    )
        public
    {
        verifySig(
                _roundId,
                _gameType,
                _num,
                _value,
                _balance,
                _serverHash,
                _playerHash,
                _gameId,
                _contractAddress,
                _serverSig,
                serverAddress
        );

        regularEndGame(msg.sender, _roundId, _gameType, _num, _value, _balance, _gameId, _contractAddress);
    }

    /**
     * @dev Regular end game session implementation. Used if player and house have both
     * accepted current game session state. The game session with gameId _gameId is closed
     * and the player paid out.
     * @param _playerAddress Address of player.
     * @param _gameType Game type of bet.
     * @param _num Number of bet.
     * @param _value Value of bet.
     * @param _balance Current balance.
     * @param _gameId Game session id.
     * @param _contractAddress Address of this contract.
     */
    function regularEndGame(
        address _playerAddress,
        uint32 _roundId,
        uint8 _gameType,
        uint16 _num,
        uint _value,
        int _balance,
        uint _gameId,
        address _contractAddress
    )
        private
    {
        uint gameId = playerGameId[_playerAddress];
        Game storage game = gameIdGame[gameId];
        address contractAddress = this;
        int maxBalance = conflictRes.maxBalance();

        require(_gameId == gameId);
        require(_roundId > 0);
        // save to cast as game.stake hash fixed range
        require(-int(game.stake) <= _balance && _balance <= maxBalance);
        require((_gameType == 0) && (_num == 0) && (_value == 0));
        require(_contractAddress == contractAddress);
        require(game.status == GameStatus.ACTIVE);

        closeGame(game, gameId, _playerAddress, ReasonEnded.REGULAR_ENDED, _balance);
        payOut(game, _playerAddress);
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_roundId","type":"uint32"},{"name":"_gameType","type":"uint8"},{"name":"_num","type":"uint16"},{"name":"_value","type":"uint256"},{"name":"_balance","type":"int256"},{"name":"_serverHash","type":"bytes32"},{"name":"_playerHash","type":"bytes32"},{"name":"_gameId","type":"uint256"},{"name":"_contractAddress","type":"address"},{"name":"_serverSig","type":"bytes"},{"name":"_playerSeed","type":"bytes32"}],"name":"playerEndGameConflict","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MIN_TRANSFER_TIMESPAN","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"playerGameId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"pendingReturns","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"profitTransferTimeSpan","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minStake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lastProfitTransferTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_endHash","type":"bytes32"}],"name":"createGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"typeHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"addHouseStake","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"MIN_TIMEOUT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"timePaused","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conflictRes","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_gameId","type":"uint256"}],"name":"playerForceGameEnd","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gameId","type":"uint256"}],"name":"cancelGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"withdrawHouseStake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"gameIdGame","outputs":[{"name":"status","type":"uint8"},{"name":"reasonEnded","type":"uint8"},{"name":"stake","type":"uint256"},{"name":"gameType","type":"uint8"},{"name":"roundId","type":"uint32"},{"name":"betNum","type":"uint16"},{"name":"betValue","type":"uint256"},{"name":"balance","type":"int256"},{"name":"playerSeed","type":"bytes32"},{"name":"serverSeed","type":"bytes32"},{"name":"endInitiatedTime","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"houseProfit","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_minStake","type":"uint256"},{"name":"_maxStake","type":"uint256"}],"name":"setStakeRequirements","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAX_TRANSFER_TIMSPAN","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_profitTransferTimeSpan","type":"uint256"}],"name":"setProfitTransferTimeSpan","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"activateConflictResolution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newConflictRes","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_playerAddress","type":"address"},{"name":"_gameId","type":"uint256"}],"name":"serverCancelActiveGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_roundId","type":"uint32"},{"name":"_gameType","type":"uint8"},{"name":"_num","type":"uint16"},{"name":"_value","type":"uint256"},{"name":"_balance","type":"int256"},{"name":"_serverHash","type":"bytes32"},{"name":"_playerHash","type":"bytes32"},{"name":"_gameId","type":"uint256"},{"name":"_contractAddress","type":"address"},{"name":"_serverSig","type":"bytes"}],"name":"playerEndGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_gameId","type":"uint256"}],"name":"playerCancelActiveGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_roundId","type":"uint32"},{"name":"_gameType","type":"uint8"},{"name":"_num","type":"uint16"},{"name":"_value","type":"uint256"},{"name":"_balance","type":"int256"},{"name":"_serverHash","type":"bytes32"},{"name":"_playerHash","type":"bytes32"},{"name":"_gameId","type":"uint256"},{"name":"_contractAddress","type":"address"},{"name":"_playerSig","type":"bytes"},{"name":"_playerAddress","type":"address"},{"name":"_serverSeed","type":"bytes32"},{"name":"_playerSeed","type":"bytes32"}],"name":"serverEndGameConflict","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"TIMEOUT_DESTROY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_playerAddress","type":"address"},{"name":"_gameId","type":"uint256"},{"name":"_endHash","type":"bytes32"}],"name":"acceptGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"houseStake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newConflictResAddress","type":"address"}],"name":"updateConflictResolution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_playerAddress","type":"address"},{"name":"_gameId","type":"uint256"}],"name":"serverForceGameEnd","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_roundId","type":"uint32"},{"name":"_gameType","type":"uint8"},{"name":"_num","type":"uint16"},{"name":"_value","type":"uint256"},{"name":"_balance","type":"int256"},{"name":"_serverHash","type":"bytes32"},{"name":"_playerHash","type":"bytes32"},{"name":"_gameId","type":"uint256"},{"name":"_contractAddress","type":"address"},{"name":"_playerAddress","type":"address"},{"name":"_playerSig","type":"bytes"}],"name":"serverEndGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"houseAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"serverAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"updateTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_TIMEOUT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"activeGames","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxStake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_houseAddress","type":"address"}],"name":"setHouseAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gameIdCntr","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_playerAddress","type":"address"},{"name":"_gameId","type":"uint256"}],"name":"rejectGame","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"transferProfitToHouse","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_serverAddress","type":"address"},{"name":"_minStake","type":"uint256"},{"name":"_maxStake","type":"uint256"},{"name":"_conflictResAddress","type":"address"},{"name":"_houseAddress","type":"address"},{"name":"_gameIdCntr","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"},{"indexed":false,"name":"stake","type":"uint256"},{"indexed":false,"name":"endHash","type":"bytes32"}],"name":"LogGameCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"}],"name":"LogGameRejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"},{"indexed":false,"name":"endHash","type":"bytes32"}],"name":"LogGameAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"}],"name":"LogPlayerRequestedEnd","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"}],"name":"LogServerRequestedEnd","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"player","type":"address"},{"indexed":true,"name":"gameId","type":"uint256"},{"indexed":false,"name":"reason","type":"uint8"}],"name":"LogGameEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"minStake","type":"uint256"},{"indexed":false,"name":"maxStake","type":"uint256"}],"name":"LogStakeLimitsModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newConflictResolutionAddress","type":"address"}],"name":"LogUpdatingConflictResolution","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newConflictResolutionAddress","type":"address"}],"name":"LogUpdatedConflictResolution","type":"event"},{"anonymous":false,"inputs":[],"name":"LogPause","type":"event"},{"anonymous":false,"inputs":[],"name":"LogUnpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"LogOwnerShipTransferred","type":"event"}]

60606040526000805460a060020a60ff0219168155600181905560038054600160a060020a0319169055600481905560058190556009819055600a5562127500600d55341561004d57600080fd5b60405160c080612b1783398101604052808051919060200180519190602001805191906020018051919060200180519190602001805160008054600160a060020a03338116600160a060020a0319928316178355600280549189169190921617905590925087915086908690869086908690869086908690869086908690851180156100d95750838511155b15156100e457600080fd5b600081116100f157600080fd5b600681905560078054600160a060020a03808916600160a060020a031992831617909255600880549285169290911691909117905542600e55600b859055600c8490556040517f75696e74333220526f756e64204964000000000000000000000000000000000081527f75696e74382047616d6520547970650000000000000000000000000000000000600f8201527f75696e743136204e756d62657200000000000000000000000000000000000000601e8201527f75696e742056616c756520285765692900000000000000000000000000000000602b8201527f696e742043757272656e742042616c616e636520285765692900000000000000603b8201527f627974657333322053657276657220486173680000000000000000000000000060548201527f6279746573333220506c6179657220486173680000000000000000000000000060678201527f75696e742047616d652049640000000000000000000000000000000000000000607a8201527f6164647265737320436f6e7472616374204164647265737300000000000000006086820152609e01604051908190039020600f5550505050505050505050505050505050505061285d806102ba6000396000f30060606040526004361061024d5763ffffffff60e060020a6000350416630b305c62811461025257806313af4035146102e657806319fc36ed1461030557806325b05c881461032a57806326b387bb146103495780632c94a23514610368578063375b3c0a1461037b5780633ccfd60b1461038e5780633f4ba83a146103a157806341b80184146103b4578063457391e5146103c757806349926028146103d25780634f739ff0146103e5578063543ad1df146103ed578063563c23a0146104005780635ba2dd22146104135780635c975abb14610442578063665eba291461046957806369958ab91461047f57806381efc01d1461049557806383197ef0146104ab57806383e256dc146104be5780638456cb591461055f578063853828b61461057257806388fedd04146105855780638da5cb5b146105985780639449a361146105ab578063947bc72d146105c45780639c0051db146105d75780639f34ce14146105ed578063a09f865914610600578063a8182cd314610613578063ae64092314610635578063aff06fbd146106c5578063b5d9f80b146106db578063bd5c4e2414610781578063c3b1ff9314610794578063c861f3a0146107b9578063cbffb1ae146107cc578063d1e9dcbf146107eb578063d6f0b4841461080d578063d7cee31e146108a8578063db420fe3146108bb578063dc555090146108ce578063de38eb3a146108e1578063e475222e146108f4578063ea1b28e014610907578063ef3aaf541461091a578063f87ffb7414610939578063fb1641d61461094c578063fd306ca71461096e575b600080fd5b341561025d57600080fd5b6102e46004803563ffffffff16906024803560ff169160443561ffff1691606435916084359160a4359160c4359160e4359161010435600160a060020a031691610144906101243590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650509335935061098192505050565b005b34156102f157600080fd5b6102e4600160a060020a03600435166109c7565b341561031057600080fd5b610318610a62565b60405190815260200160405180910390f35b341561033557600080fd5b610318600160a060020a0360043516610a69565b341561035457600080fd5b610318600160a060020a0360043516610a7b565b341561037357600080fd5b610318610a8d565b341561038657600080fd5b610318610a93565b341561039957600080fd5b6102e4610a99565b34156103ac57600080fd5b6102e4610b05565b34156103bf57600080fd5b610318610b87565b6102e4600435610b8d565b34156103dd57600080fd5b610318610d46565b6102e4610d4c565b34156103f857600080fd5b610318610d71565b341561040b57600080fd5b610318610d78565b341561041e57600080fd5b610426610d7e565b604051600160a060020a03909116815260200160405180910390f35b341561044d57600080fd5b610455610d8d565b604051901515815260200160405180910390f35b341561047457600080fd5b6102e4600435610d9d565b341561048a57600080fd5b6102e4600435610ed3565b34156104a057600080fd5b6102e4600435610f42565b34156104b657600080fd5b6102e4611056565b34156104c957600080fd5b6104d46004356110ac565b604051808c60048111156104e457fe5b60ff1681526020018b60048111156104f857fe5b60ff9081168252602082019b909b52989099166040808a019190915263ffffffff909716606089015261ffff909516608088015260a087019390935260c086019190915260e085015261010084015261012083015261014090910193509150505180910390f35b341561056a57600080fd5b6102e4611114565b341561057d57600080fd5b6102e461119c565b341561059057600080fd5b610318611229565b34156105a357600080fd5b61042661122f565b34156105b657600080fd5b6102e460043560243561123e565b34156105cf57600080fd5b6103186112bc565b34156105e257600080fd5b6102e46004356112c3565b34156105f857600080fd5b6102e4611306565b341561060b57600080fd5b6104266113e7565b341561061e57600080fd5b6102e4600160a060020a03600435166024356113f6565b341561064057600080fd5b6102e46004803563ffffffff16906024803560ff169160443561ffff1691606435916084359160a4359160c4359160e4359161010435600160a060020a031691610144906101243590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506114fe95505050505050565b34156106d057600080fd5b6102e4600435611542565b34156106e657600080fd5b6102e46004803563ffffffff16906024803560ff169160443561ffff1691606435916084359160a4359160c4359160e4359161010435600160a060020a031691610144906101243590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965050600160a060020a038535169460208101359450604001359250611624915050565b341561078c57600080fd5b610318611674565b341561079f57600080fd5b6102e4600160a060020a036004351660243560443561167b565b34156107c457600080fd5b61031861173c565b34156107d757600080fd5b6102e4600160a060020a0360043516611742565b34156107f657600080fd5b6102e4600160a060020a03600435166024356117c9565b341561081857600080fd5b6102e46004803563ffffffff16906024803560ff169160443561ffff1691606435916084359160a4359160c4359160e4359161010435600160a060020a0390811692610124359091169190610164906101443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061191d95505050505050565b34156108b357600080fd5b61042661195b565b34156108c657600080fd5b61042661196a565b34156108d957600080fd5b610318611979565b34156108ec57600080fd5b61031861197f565b34156108ff57600080fd5b610318611986565b341561091257600080fd5b61031861198c565b341561092557600080fd5b6102e4600160a060020a0360043516611992565b341561094457600080fd5b6103186119dc565b341561095757600080fd5b6102e4600160a060020a03600435166024356119e2565b341561097957600080fd5b6102e4611aa9565b6109a98b8b8b8b8b8b8b8b8b8b600760009054906101000a9004600160a060020a0316611b2a565b6109ba8b8b8b8b8b8a878b33611b63565b5050505050505050505050565b60005433600160a060020a039081169116146109e257600080fd5b600160a060020a03811615156109f757600080fd5b600054600160a060020a0380831691167f897d3c8bbea11029ba3b26eb993fe8edb14c2c4c0d2ecceccce41d1d83d3e35960405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6201518081565b60116020526000908152604090205481565b60126020526000908152604090205481565b600d5481565b600b5481565b600160a060020a033316600090815260126020526040812054908111610abe57600080fd5b600160a060020a0333166000818152601260205260408082209190915582156108fc0290839051600060405180830381858888f193505050501515610b0257600080fd5b50565b60005433600160a060020a03908116911614610b2057600080fd5b60005460a060020a900460ff161515610b3857600080fd5b6000805474ff0000000000000000000000000000000000000000191681556001557f730c1faaa977b67dacf1e2451ef54556e04a07d577785ff79f6d31f73502efc960405160405180910390a1565b600e5481565b600080600080600034600b5411158015610ba95750600c543411155b1515610bb457600080fd5b600554600254600190910190600090600160a060020a03166373c4726b83836040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610c1057600080fd5b6102c65a03f11515610c2157600080fd5b5050506040518051905090508060095410151515610c3e57600080fd5b60005460a060020a900460ff1615610c5557600080fd5b33600160a060020a038116600090815260116020908152604080832054808452601090925282209299509750909550855460ff166004811115610c9457fe5b14610c9e57600080fd5b600680546001808201909255600160a060020a038916600090815260116020908152604080832084905583835260109091529020348184015580549196509450600291859160ff19169083021790555060058054600101905583600160a060020a0388167fbefb1982a5b57971661d96e967311a15f9205fcf5c891bc6d804b5a19c68cb1b348b60405191825260208201526040908101905180910390a35050505050505050565b600f5481565b60005433600160a060020a03908116911614610d6757600080fd5b6009805434019055565b6203f48081565b60015481565b600254600160a060020a031681565b60005460a060020a900460ff1681565b33600160a060020a038116600090815260116020908152604080832054808452601090925282209091848314610dd257600080fd5b6003825460ff166004811115610de457fe5b14610dee57600080fd5b60028054908301546003840154600485015460018601546007870154600160a060020a039095169463ca7140ad9460ff8116946501000000000090910461ffff16939092909160006040516020015260405160e060020a63ffffffff891602815260ff909616600487015261ffff909416602486015260448501929092526064840152608483015260a482015260c401602060405180830381600087803b1515610e9757600080fd5b6102c65a03f11515610ea857600080fd5b505050604051805190509050610ec2828486600285611e8a565b610ecc8285611f25565b5050505050565b33600160a060020a0381166000908152601160209081526040808320548084526010909252909120838214610f0757600080fd5b6002815460ff166004811115610f1957fe5b14610f2357600080fd5b610f3281838560046000611e8a565b610f3c8184611f25565b50505050565b6000805433600160a060020a03908116911614610f5e57600080fd5b600254600554600160a060020a03909116906373c4726b9060006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610fb557600080fd5b6102c65a03f11515610fc657600080fd5b5050506040518051905090506009548211158015610fe8575080826009540310155b1515610ff357600080fd5b6000600a5413158061100b57508160095403600a5411155b151561101657600080fd5b600980548390039055600054600160a060020a031682156108fc0283604051600060405180830381858888f19350505050151561105257600080fd5b5050565b60005433600160a060020a0390811691161461107157600080fd5b600054621a5e009060a060020a900460ff168015611093575042816001540111155b151561109e57600080fd5b600054600160a060020a0316ff5b6010602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015460ff80881698610100988990048216989187169691820463ffffffff16956501000000000090920461ffff1694919391928b565b60005433600160a060020a0390811691161461112f57600080fd5b60005460a060020a900460ff161561114657600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a179055426001557f4b314b34e912fda7f95e7d23e9c8c95f82f0aff1984e4ce592a0b005f905562460405160405180910390a1565b6000805433600160a060020a039081169116146111b857600080fd5b6000546203f4809060a060020a900460ff1680156111da575042816001540111155b15156111e557600080fd5b6000600a81905560098054908290559054909250600160a060020a031682156108fc0283604051600060405180830381858888f19350505050151561105257600080fd5b600a5481565b600054600160a060020a031681565b60005433600160a060020a0390811691161461125957600080fd5b6000821180156112695750808211155b151561127457600080fd5b600b829055600c8190557f1ec948cac143dba0e555a87dd86ae387e2ecd4a8fee80f7dd324d5987cb3e7f8828260405191825260208201526040908101905180910390a15050565b62ed4e0081565b60005433600160a060020a039081169116146112de57600080fd5b806201518081101580156112f5575062ed4e008111155b151561130057600080fd5b50600d55565b60005433600160a060020a0390811691161461132157600080fd5b600354600160a060020a0316151561133857600080fd5b600454151561134657600080fd5b426203f480600454011115801561136457506207e900600454014211155b151561136f57600080fd5b600380546002805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055600060048190557f28de3c2df3d09a8b061f86cd0c78b7d02f1f5caffcd086ff45ee12a4a51056c890604051600160a060020a03909116815260200160405180910390a1565b600354600160a060020a031681565b600754600090819033600160a060020a0390811691161461141657600080fd5b5050600160a060020a038216600090815260116020908152604080832054808452601090925290912082821461144b57600080fd5b6001815460ff16600481111561145d57fe5b14156114b057426007820155805460ff1916600417815581600160a060020a0333167fdbbc392d5391708a9def7f560f8cbdef92e1bb37e5104831e78feda1488b7ab060405160405180910390a3610f3c565b6003815460ff1660048111156114c257fe5b1480156114dc57506002810154610100900463ffffffff16155b1561024d576114ef818386600080611e8a565b6114f98185611f25565b610f3c565b6115268a8a8a8a8a8a8a8a8a8a600760009054906101000a9004600160a060020a0316611b2a565b611536338b8b8b8b8b898961205b565b50505050505050505050565b33600160a060020a038116600090815260116020908152604080832054808452601090925290912083821461157657600080fd5b6001815460ff16600481111561158857fe5b14156115db57426007820155805460ff1916600317815581600160a060020a0333167f15df88512f2c79e9bb3062ae86120f5df5a70ffd25fde294717671ad2932d27860405160405180910390a3610f3c565b6004815460ff1660048111156115ed57fe5b14801561160757506002810154610100900463ffffffff16155b1561024d5761161a818385600080611e8a565b6114f98184611f25565b60075433600160a060020a0390811691161461163f57600080fd5b6116528d8d8d8d8d8d8d8d8d8d8d611b2a565b6116658d8d8d8d8d8d8d89898f8d61219d565b50505050505050505050505050565b621a5e0081565b600754600090819033600160a060020a0390811691161461169b57600080fd5b5050600160a060020a03831660009081526011602090815260408083205480845260109092529091208382146116d057600080fd5b6002815460ff1660048111156116e257fe5b146116ec57600080fd5b805460ff1916600117815581600160a060020a0386167f335dd50169e2c456fcfbd235f9cf48d77702b01e9fce7dda7f233aaa400697178560405190815260200160405180910390a35050505050565b60095481565b60005433600160a060020a0390811691161461175d57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316179055426004557f97044e884f04922f1959ef2de012f4734423df2d4da57fd4c5eaf40cd63b525f81604051600160a060020a03909116815260200160405180910390a150565b6007546000908190819033600160a060020a039081169116146117eb57600080fd5b600160a060020a0385166000908152601160209081526040808320548084526010909252909120909350915083831461182357600080fd5b6004825460ff16600481111561183557fe5b1461183f57600080fd5b60028054908301546003840154600485015460018601546007870154600160a060020a039095169463834d42c69460ff8116946501000000000090910461ffff16939092909160006040516020015260405160e060020a63ffffffff891602815260ff909616600487015261ffff909416602486015260448501929092526064840152608483015260a482015260c401602060405180830381600087803b15156118e857600080fd5b6102c65a03f115156118f957600080fd5b505050604051805190509050611913828487600185611e8a565b610ecc8286611f25565b60075433600160a060020a0390811691161461193857600080fd5b61194b8b8b8b8b8b8b8b8b8b8a8c611b2a565b6109ba828c8c8c8c8c8a8a61205b565b600854600160a060020a031681565b600754600160a060020a031681565b60045481565b6207e90081565b60055481565b600c5481565b60005433600160a060020a039081169116146119ad57600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60065481565b600754600090819033600160a060020a03908116911614611a0257600080fd5b5050600160a060020a0382166000908152601160209081526040808320548084526010909252909120828214611a3757600080fd5b6002815460ff166004811115611a4957fe5b14611a5357600080fd5b611a6281838660036000611e8a565b611a6c8185611f25565b8184600160a060020a03167fd64178ff9bc5c7c251e9f91d154e3f6122fb1cb8c5f0d682da22ba8a35be379960405160405180910390a350505050565b600042600d54600e540111151515611ac057600080fd5b600a5460009013611ad45742600e55610b02565b50600a5460095481901015611ae557fe5b6000600a5542600e55600980548290039055600854600160a060020a031681156108fc0282604051600060405180830381858888f193505050501515610b0257600080fd5b306000600160a060020a0385811690831614611b4557600080fd5b611b568d8d8d8d8d8d8d8d8d6124ee565b90506116658185856125dc565b600160a060020a038082166000908152601160209081526040808320548084526010909252808320600254929490939216906373ad468a90839051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611bd057600080fd5b6102c65a03f11515611be157600080fd5b5050506040518051915050828514611bf857600080fd5b600063ffffffff8d1611611c0b57600080fd5b868660405190815260200160405190819003902014611c2957600080fd5b6001820154891115611c3a57600080fd5b87826001015460000313158015611c515750808813155b1515611c5c57600080fd5b600089898460010154010312151515611c7457600080fd5b600254600160a060020a03166309eecdd78c8c8c60006040516020015260405160e060020a63ffffffff861602815260ff909316600484015261ffff90911660248301526044820152606401602060405180830381600087803b1515611cd957600080fd5b6102c65a03f11515611cea57600080fd5b505050604051805190501515611cff57600080fd5b6004825460ff166004811115611d1157fe5b148015611d2f5750600282015463ffffffff8d811661010090920416145b15611d4b5760058201869055611d46828486612682565b611e7c565b6001825460ff166004811115611d5d57fe5b1480611d9457506004825460ff166004811115611d7657fe5b148015611d945750600282015463ffffffff808e1661010090920416105b1561024d578154600390839060ff191660018302179055504282600701819055508b8260020160016101000a81548163ffffffff021916908363ffffffff1602179055508a8260020160006101000a81548160ff021916908360ff160217905550898260020160056101000a81548161ffff021916908361ffff1602179055508882600301819055508782600401819055508582600501816000191690555060006001028260060181600019169055508233600160a060020a03167f15df88512f2c79e9bb3062ae86120f5df5a70ffd25fde294717671ad2932d27860405160405180910390a35b505050505050505050505050565b845460ff19811686558290869061ffff1916610100836004811115611eab57fe5b02179055506004850181905560055460009011611ec457fe5b6005805460001901905583600160a060020a0384167f4b5277424f280337f39f22b425db644e5c0d8ac428b2121a6adf73acf623d16c8460405180826004811115611f0b57fe5b60ff16815260200191505060405180910390a35050505050565b6002546000908190600160a060020a03166373ad468a82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611f7157600080fd5b6102c65a03f11515611f8257600080fd5b5050506040518051600486015413159050611f9957fe5b6000845460ff166004811115611fab57fe5b14611fb257fe5b600c5460018501541115611fc257fe5b60048401546001850154600091011215611fd857fe5b6004840154600185015481019250600090138015611ffb57508360040154600954125b156120065760095491505b50600483018054600a80549190910390555460095403600081121561202757fe5b6009819055600160a060020a038316600090815260126020526040812080548401908190551115610f3c57610f3c83612770565b600160a060020a03808916600090815260116020908152604080832054808452601090925280832060025492949093309390929116906373ad468a90839051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156120cc57600080fd5b6102c65a03f115156120dd57600080fd5b50505060405180519150508584146120f457600080fd5b600063ffffffff8c161161210757600080fd5b8683600101546000031315801561211e5750808713155b151561212957600080fd5b60ff8a1615801561213c575061ffff8916155b8015612146575087155b151561215157600080fd5b600160a060020a038581169083161461216957600080fd5b6001835460ff16600481111561217b57fe5b1461218557600080fd5b61219383858e60008b611e8a565b611e7c838d611f25565b600160a060020a038082166000908152601160209081526040808320548084526010909252808320600254929490939216906373ad468a90839051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561220a57600080fd5b6102c65a03f1151561221b57600080fd5b505050604051805191505082851461223257600080fd5b600063ffffffff8f161161224557600080fd5b88876040519081526020016040519081900390201461226357600080fd5b87866040519081526020016040519081900390201461228157600080fd5b60018201548b111561229257600080fd5b898260010154600003131580156122a95750808a13155b15156122b457600080fd5b60008b8b84600101540103121515156122cc57600080fd5b600254600160a060020a03166309eecdd78e8e8e60006040516020015260405160e060020a63ffffffff861602815260ff909316600484015261ffff90911660248301526044820152606401602060405180830381600087803b151561233157600080fd5b6102c65a03f1151561234257600080fd5b50505060405180519050151561235757600080fd5b6003825460ff16600481111561236957fe5b1480156123875750600282015463ffffffff8f811661010090920416145b156123a3576006820187905561239e828486612682565b6124de565b6001825460ff1660048111156123b557fe5b14806123fa57506003825460ff1660048111156123ce57fe5b1480156123fa57508d63ffffffff168260020160019054906101000a900463ffffffff1663ffffffff16105b1561024d578154600490839060ff191660018302179055504282600701819055508d8260020160016101000a81548163ffffffff021916908363ffffffff1602179055508c8260020160006101000a81548160ff021916908360ff1602179055508b8260020160056101000a81548161ffff021916908361ffff1602179055508a826003018190555089826004018190555086826006018160001916905550858260050181600019169055508284600160a060020a03167fdbbc392d5391708a9def7f560f8cbdef92e1bb37e5104831e78feda1488b7ab060405160405180910390a35b5050505050505050505050505050565b6000808a8a8a8a8a8a8a8a8a60405163ffffffff9990991660e060020a02895260ff979097167f010000000000000000000000000000000000000000000000000000000000000002600489015261ffff959095167e0100000000000000000000000000000000000000000000000000000000000002600588015260078701939093526027860191909152604785015260678401526087830152600160a060020a03166c010000000000000000000000000260a782015260bb0160405180910390209050600f548160405191825260208201526040908101905180910390209150509998505050505050505050565b6000806000806125eb866127ef565b9350935093506001878386866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f1151561265657600080fd5b5050602060405103519050600160a060020a038082169086161461267957600080fd5b50505050505050565b600280549084015460038501546004860154600187015460068801546005890154600096600160a060020a031695632a0763ce9560ff8216956501000000000090920461ffff169490939192909190896040516020015260405160e060020a63ffffffff8a1602815260ff909716600488015261ffff909516602487015260448601939093526064850191909152608484015260a483015260c482015260e401602060405180830381600087803b151561273b57600080fd5b6102c65a03f1151561274c57600080fd5b505050604051805190509050612766848484600085611e8a565b610f3c8483611f25565b600160a060020a03811660009081526012602052604081205490811161279257fe5b600160a060020a0382166000818152601260205260408082209190915582156108fc0290839051600060405180830381858888f1151593506110529250505057600160a060020a0391909116600090815260126020526040902055565b6000806000835160411461280257600080fd5b602084015192506040840151915060ff604185015116905060028160ff16101561282a57601b015b91939092505600a165627a7a72305820682898e219c188e1a3941dd8f5783501c9a3ad591c994b6aa3936c1180689e320029000000000000000000000000cef260a5fed7a896bbe07b933b3a5c17aec094d8000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000007e4d9a47477ea0ad97971595957d52cc0f58d99100000000000000000000000071be1ace87248f3950bdfc4c89b4b3eed059f6f30000000000000000000000000000000000000000000000000000000000000001

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

000000000000000000000000cef260a5fed7a896bbe07b933b3a5c17aec094d8000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000007e4d9a47477ea0ad97971595957d52cc0f58d99100000000000000000000000071be1ace87248f3950bdfc4c89b4b3eed059f6f30000000000000000000000000000000000000000000000000000000000000001

-----Decoded View---------------
Arg [0] : _serverAddress (address): 0xCef260a5Fed7A896BBE07b933B3A5c17aEC094D8
Arg [1] : _minStake (uint256): 10000000000000000
Arg [2] : _maxStake (uint256): 200000000000000000
Arg [3] : _conflictResAddress (address): 0x7e4d9A47477ea0Ad97971595957D52cC0F58d991
Arg [4] : _houseAddress (address): 0x71BE1aCe87248F3950BdFc4c89b4B3EED059f6f3
Arg [5] : _gameIdCntr (uint256): 1

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000cef260a5fed7a896bbe07b933b3a5c17aec094d8
Arg [1] : 000000000000000000000000000000000000000000000000002386f26fc10000
Arg [2] : 00000000000000000000000000000000000000000000000002c68af0bb140000
Arg [3] : 0000000000000000000000007e4d9a47477ea0ad97971595957d52cc0f58d991
Arg [4] : 00000000000000000000000071be1ace87248f3950bdfc4c89b4b3eed059f6f3
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001


Swarm Source

bzzr://682898e219c188e1a3941dd8f5783501c9a3ad591c994b6aa3936c1180689e32
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.