Contract 0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c5

 

Contract Overview

Balance:
0.86299874 Ether

EtherValue:
$106.18 (@ $123.04/ETH)
TxHash Block Age From To Value [TxFee]
0x0a9c7f0e2faa869799c2816dc14cd2f3d60a4159176191582225e46d1738495a72169572 days 9 hrs ago0x1c0c0925c5385580e35eb523168699fc40994272  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000331452
0x25e8294c7110c80dc4f447f6d751c2aa141924edcd59e5bf10bfcb6d58f449a472168782 days 9 hrs ago0x1c0c0925c5385580e35eb523168699fc40994272  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000952992
0x149a86cbf5fc78828f854c29c3abf3406d066fdbd0666ea69b7ed29ac59cd5f272049795 days 5 hrs ago0x4cd925321407b9c0182329dcc99e6e76723cd388  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000220968
0xc92ccd7593ade437f7b628248747b82a2620e4d23026025cae7867bc12aa39e872048865 days 5 hrs ago0x4cd925321407b9c0182329dcc99e6e76723cd388  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.01 Ether0.000953376
0x9a93bf6639f9e9fdf886a7b36ef354cb5c747fd0ddec0ed4cd0bc10d8c8aba3b715648515 days 6 hrs ago0x19802e489cd3b5db71abd78417346d6c1d28b5da  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000331452
0x926d514c06d4816f647ef2ce25105a3e8a46cf113248af1ebf9dc22b604c24e9715462715 days 15 hrs ago0x19802e489cd3b5db71abd78417346d6c1d28b5da  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000953376
0xa400c2d21c8a9aef52b1f9f985d966069a1ebfaaddfc6e161a99fdd15701876d711070124 days 10 hrs ago0x5e499fc7980f0dffd3d2e94585d3676e158223c2  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000142986
0xaedbd963c29b19559875fc3c0f0208c99e3f976381ec860d051db6b2f00839c2703551238 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000445482
0x1990a477b75d9a3a9c5bcc6df57431d6ddc9fcedff37cdad6e9f3f92a6941374703550038 days 1 hr ago0x771d93c6e1a2028292eba0fc158d00c3da58608b  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.00058752
0x537763cf5d8f9e1d1c0c4e332a8bee6b89dc1bf919d12a93f65c1d7cb7465836703549538 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000863376
0xbf2baebbe1f74e2fe41da373dd69670adf590112b2055de8fb932a21c85eb47d703549138 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000436056
0x908f6b84ff74ce400b2258d22b4d5f8147c4cda31d9903b4d58e5d92442c5d4c703548938 days 1 hr ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.00058752
0x9e72cb1d4acabbaa468a0fca67ed80a13313a93dd4813fcf4a9246fcd470fbdd703548738 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000863376
0xe393df028680e9d241b9116c1fdf8a7620d649adbbdd2d72fc8adc92497d64ed703548538 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000445482
0x2f7aec2c87c224ff844b9f994133e685160230dc1b67687e5bd832d402e6dac6703548238 days 1 hr ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.00058752
0x881ad9764172896359dfa253087eeb60f0cdad8046fc40f1ef7a04e788347006703547938 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000863376
0xb5abf7ed8ccee0b01a079cbcf6fa2745fb4d811d40bc017220d5aeae573c7c81703546538 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000445482
0x66761e1a6bc410acd1cde38f6eff0db7676041533ad61758070741e507b458dc703546438 days 1 hr ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.00058752
0x027b9986c93f238671bc43e0b4118f087f3427288413389066f6f29ec15c951a703546138 days 1 hr ago0x2059f560b33bf4101a19739cbc789850661e5cdc  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000863376
0x2550fc637ee4722fe23c30c745706d341d7aef2092d07c1a418641d766023859699274345 days 14 hrs ago0xa6b2a58daf19c217cbcbf9d4d5f0446f555400e2  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000435162
0xb155a8d5d92c0db8cd3a7f38c902f312ea7484068e66fc9700f528e154cefbee699270045 days 14 hrs ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000587622
0xe46fdb2cdf5f45428033fbed5a51e3f54fc0a9881c6f89472873b32b3f111b5d699269845 days 15 hrs ago0xa6b2a58daf19c217cbcbf9d4d5f0446f555400e2  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.05 Ether0.000953376
0xf0f0e52985e8af7ac20689eb372b70214f67e5b65380d738bd09f34c39123afb696886649 days 15 hrs ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50 Ether0.000301685
0x7ac24beab4e2d59f82bf8d2f14fae56b9bd27f45f3b905464d6f9d16ef2d412f696865449 days 16 hrs ago0x7d3087bd0fcac6654f5fc07848f467bb0727c2c4  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.1 Ether0.00058752
0xc5bfa861114a38161b0c1b84423087ad8b938c9a081bb92c945d00fa51e0c447696865149 days 16 hrs ago0x5c0e21c97a3b789f6217f57bf84d756553ab9ded  IN   0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50.1 Ether0.000952992
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0x0a9c7f0e2faa869799c2816dc14cd2f3d60a4159176191582225e46d1738495a72169572 days 9 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x1c0c0925c5385580e35eb523168699fc409942720.05 Ether
0x149a86cbf5fc78828f854c29c3abf3406d066fdbd0666ea69b7ed29ac59cd5f272049795 days 5 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x4cd925321407b9c0182329dcc99e6e76723cd3880.01 Ether
0x9a93bf6639f9e9fdf886a7b36ef354cb5c747fd0ddec0ed4cd0bc10d8c8aba3b715648515 days 6 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x19802e489cd3b5db71abd78417346d6c1d28b5da0.05 Ether
0xaedbd963c29b19559875fc3c0f0208c99e3f976381ec860d051db6b2f00839c2703551238 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x771d93c6e1a2028292eba0fc158d00c3da58608b0.05 Ether
0xaedbd963c29b19559875fc3c0f0208c99e3f976381ec860d051db6b2f00839c2703551238 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x2059f560b33bf4101a19739cbc789850661e5cdc0.05 Ether
0xbf2baebbe1f74e2fe41da373dd69670adf590112b2055de8fb932a21c85eb47d703549138 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.099 Ether
0xe393df028680e9d241b9116c1fdf8a7620d649adbbdd2d72fc8adc92497d64ed703548538 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.05 Ether
0xe393df028680e9d241b9116c1fdf8a7620d649adbbdd2d72fc8adc92497d64ed703548538 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x2059f560b33bf4101a19739cbc789850661e5cdc0.05 Ether
0xb5abf7ed8ccee0b01a079cbcf6fa2745fb4d811d40bc017220d5aeae573c7c81703546538 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.05 Ether
0xb5abf7ed8ccee0b01a079cbcf6fa2745fb4d811d40bc017220d5aeae573c7c81703546538 days 1 hr ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x2059f560b33bf4101a19739cbc789850661e5cdc0.05 Ether
0x2550fc637ee4722fe23c30c745706d341d7aef2092d07c1a418641d766023859699274345 days 14 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50xa6b2a58daf19c217cbcbf9d4d5f0446f555400e20.099 Ether
0xf0f0e52985e8af7ac20689eb372b70214f67e5b65380d738bd09f34c39123afb696886649 days 15 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.198 Ether
0x1426b741d89521abfac70c44e27c9ec01977c50baa0ba2176828ea8091d4ae12692882656 days 10 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.00198 Ether
0xd5920550eaa0c3d05e68f851973d615e30a518139ff6b342d192c1a64aa9fae1692877956 days 10 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.00198 Ether
0xb45b26be67c826b33c9b06ee9acb4163bcd43e76176f147654e033c6383ef08a689521262 days 3 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.099 Ether
0x56a47bd7ad423d2b7317b2e75cbe6c7cec5ba4090e9c66d2395f5d5f86c38020688944563 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.03 Ether
0x56a47bd7ad423d2b7317b2e75cbe6c7cec5ba4090e9c66d2395f5d5f86c38020688944563 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x1a99bc2ceafa1710f0d271d6dd4585762dc119bc0.03 Ether
0xfb977e682c81e277d374b8a6074644af54a42be0602c2af0501aca3162970524688941863 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x1a99bc2ceafa1710f0d271d6dd4585762dc119bc0.099 Ether
0xff3da763cca7d94ae13ad31572bdd9731d81f7a34b649db71e872b349f2e3384688939063 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50xbc7eec756eeff6cb7a305e5181b7b66ab38da8d80.0198 Ether
0x9942cbe5cf7137d1dac44be03295beb00049cbbdd838e6cf7246a87f0e7a610c688937463 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50xbc7eec756eeff6cb7a305e5181b7b66ab38da8d80.0198 Ether
0x8c7b19e07447950070127265cedf7cbaeb50f5018a22700c25cf669353098328688934963 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50xbc7eec756eeff6cb7a305e5181b7b66ab38da8d80.0198 Ether
0x80d26f3df4523779ac9481a44c05adf4c995f1e5dccd76abf0f741723b3d6d9f688930963 days 2 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x1a99bc2ceafa1710f0d271d6dd4585762dc119bc0.0198 Ether
0x662994f9837f5bad1f8fd90f02004482b357736a0ce1943d1b23c681d3086ec3688210464 days 7 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.01 Ether
0x662994f9837f5bad1f8fd90f02004482b357736a0ce1943d1b23c681d3086ec3688210464 days 7 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x1a99bc2ceafa1710f0d271d6dd4585762dc119bc0.01 Ether
0x6f74708de709eff11206c2ec841ff218f170953e10149cd2517125ba869667f7688206564 days 7 hrs ago0xa8f9c7ff9f605f401bde6659fd18d9a0d0a802c50x7d3087bd0fcac6654f5fc07848f467bb0727c2c40.0198 Ether
[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: RpsGame
Compiler Version: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.24;

contract SafeMath {
    function safeMul(uint a, uint b) internal returns (uint) {
        uint c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function safeSub(uint a, uint b) internal returns (uint) {
        assert(b <= a);
        return a - b;
    }

    function safeAdd(uint a, uint b) internal returns (uint) {
        uint c = a + b;
        assert(c>=a && c>=b);
        return c;
    }

    function assert(bool assertion) internal {
        if (!assertion) throw;
    }
}

contract AccessControl is SafeMath{

    /// @dev Emited when contract is upgraded - See README.md for updgrade plan
    event ContractUpgrade(address newContract);

    // The addresses of the accounts (or contracts) that can execute actions within each roles.
    address public ceoAddress;
    address public cfoAddress;
    address public cooAddress;

    address newContractAddress;

    uint public tip_total = 0;
    uint public tip_rate = 10000000000000000;

    // @dev Keeps track whether the contract is paused. When that is true, most actions are blocked
    bool public paused = false;

    /// @dev Access modifier for CEO-only functionality
    modifier onlyCEO() {
        require(msg.sender == ceoAddress);
        _;
    }

    /// @dev Access modifier for CFO-only functionality
    modifier onlyCFO() {
        require(msg.sender == cfoAddress);
        _;
    }

    /// @dev Access modifier for COO-only functionality
    modifier onlyCOO() {
        require(msg.sender == cooAddress);
        _;
    }

    modifier onlyCLevel() {
        require(
            msg.sender == cooAddress ||
            msg.sender == ceoAddress ||
            msg.sender == cfoAddress
        );
        _;
    }

    function () public payable{
        tip_total = safeAdd(tip_total, msg.value);
    }

    /// @dev Count amount with tip.
    /// @param amount The totalAmount
    function amountWithTip(uint amount) internal returns(uint){
        uint tip = safeMul(amount, tip_rate) / (1 ether);
        tip_total = safeAdd(tip_total, tip);
        return safeSub(amount, tip);
    }

    /// @dev Withdraw Tip.
    function withdrawTip(uint amount) external onlyCFO {
        require(amount > 0 && amount <= tip_total);
        require(msg.sender.send(amount));
        tip_total = tip_total - amount;
    }

    // updgrade
    function setNewAddress(address newContract) external onlyCEO whenPaused {
        newContractAddress = newContract;
        emit ContractUpgrade(newContract);
    }

    /// @dev Assigns a new address to act as the CEO. Only available to the current CEO.
    /// @param _newCEO The address of the new CEO
    function setCEO(address _newCEO) external onlyCEO {
        require(_newCEO != address(0));

        ceoAddress = _newCEO;
    }

    /// @dev Assigns a new address to act as the CFO. Only available to the current CEO.
    /// @param _newCFO The address of the new CFO
    function setCFO(address _newCFO) external onlyCEO {
        require(_newCFO != address(0));

        cfoAddress = _newCFO;
    }

    /// @dev Assigns a new address to act as the COO. Only available to the current CEO.
    /// @param _newCOO The address of the new COO
    function setCOO(address _newCOO) external onlyCEO {
        require(_newCOO != address(0));

        cooAddress = _newCOO;
    }

    /*** Pausable functionality adapted from OpenZeppelin ***/

    /// @dev Modifier to allow actions only when the contract IS NOT paused
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /// @dev Modifier to allow actions only when the contract IS paused
    modifier whenPaused {
        require(paused);
        _;
    }

    /// @dev Called by any "C-level" role to pause the contract. Used only when
    ///  a bug or exploit is detected and we need to limit damage.
    function pause() external onlyCLevel whenNotPaused {
        paused = true;
    }

    /// @dev Unpauses the smart contract. Can only be called by the CEO, since
    ///  one reason we may pause the contract is when CFO or COO accounts are
    ///  compromised.
    /// @notice This is public rather than external so it can be called by
    ///  derived contracts.
    function unpause() public onlyCEO whenPaused {
        // can't unpause if contract was upgraded
        paused = false;
    }
}


contract RpsGame is SafeMath , AccessControl{

    /// @dev Constant definition
    uint8 constant public NONE = 0;
    uint8 constant public ROCK = 10;
    uint8 constant public PAPER = 20;
    uint8 constant public SCISSORS = 30;
    uint8 constant public DEALERWIN = 201;
    uint8 constant public PLAYERWIN = 102;
    uint8 constant public DRAW = 101;

    /// @dev Emited when contract is upgraded - See README.md for updgrade plan
    event CreateGame(uint gameid, address dealer, uint amount);
    event JoinGame(uint gameid, address player, uint amount);
    event Reveal(uint gameid, address player, uint8 choice);
    event CloseGame(uint gameid,address dealer,address player, uint8 result);

    /// @dev struct of a game
    struct Game {
        uint expireTime;
        address dealer;
        uint dealerValue;
        bytes32 dealerHash;
        uint8 dealerChoice;
        address player;
        uint8 playerChoice;
        uint playerValue;
        uint8 result;
        bool closed;
    }

    /// @dev struct of a game
    mapping (uint => mapping(uint => uint8)) public payoff;
    mapping (uint => Game) public games;
    mapping (address => uint[]) public gameidsOf;

    /// @dev Current game maximum id
    uint public maxgame = 0;
    uint public expireTimeLimit = 30 minutes;

    /// @dev Initialization contract
    function RpsGame() {
        payoff[ROCK][ROCK] = DRAW;
        payoff[ROCK][PAPER] = PLAYERWIN;
        payoff[ROCK][SCISSORS] = DEALERWIN;
        payoff[PAPER][ROCK] = DEALERWIN;
        payoff[PAPER][PAPER] = DRAW;
        payoff[PAPER][SCISSORS] = PLAYERWIN;
        payoff[SCISSORS][ROCK] = PLAYERWIN;
        payoff[SCISSORS][PAPER] = DEALERWIN;
        payoff[SCISSORS][SCISSORS] = DRAW;
        payoff[NONE][NONE] = DRAW;
        payoff[ROCK][NONE] = DEALERWIN;
        payoff[PAPER][NONE] = DEALERWIN;
        payoff[SCISSORS][NONE] = DEALERWIN;
        payoff[NONE][ROCK] = PLAYERWIN;
        payoff[NONE][PAPER] = PLAYERWIN;
        payoff[NONE][SCISSORS] = PLAYERWIN;

        ceoAddress = msg.sender;
        cooAddress = msg.sender;
        cfoAddress = msg.sender;
    }

    /// @dev Create a game
    function createGame(bytes32 dealerHash, address player) public payable whenNotPaused returns (uint){
        require(dealerHash != 0x0);

        maxgame += 1;
        Game storage game = games[maxgame];
        game.dealer = msg.sender;
        game.player = player;
        game.dealerHash = dealerHash;
        game.dealerChoice = NONE;
        game.dealerValue = msg.value;
        game.expireTime = expireTimeLimit + now;

        gameidsOf[msg.sender].push(maxgame);

        emit CreateGame(maxgame, game.dealer, game.dealerValue);

        return maxgame;
    }

    /// @dev Join a game
    function joinGame(uint gameid, uint8 choice) public payable whenNotPaused returns (uint){
        Game storage game = games[gameid];

        require(msg.value == game.dealerValue && game.dealer != address(0) && game.dealer != msg.sender && game.playerChoice==NONE);
        require(game.player == address(0) || game.player == msg.sender);
        require(!game.closed);
        require(now < game.expireTime);
        require(checkChoice(choice));

        game.player = msg.sender;
        game.playerChoice = choice;
        game.playerValue = msg.value;
        game.expireTime = expireTimeLimit + now;

        gameidsOf[msg.sender].push(gameid);

        emit JoinGame(gameid, game.player, game.playerValue);

        return gameid;
    }

    /// @dev Creator reveals game choice
    function reveal(uint gameid, uint8 choice, bytes32 randomSecret) public returns (bool) {
        Game storage game = games[gameid];
        bytes32 proof = getProof(msg.sender, choice, randomSecret);

        require(!game.closed);
        require(now < game.expireTime);
        require(game.dealerHash != 0x0);
        require(checkChoice(choice));
        require(checkChoice(game.playerChoice));
        require(game.dealer == msg.sender && proof == game.dealerHash );

        game.dealerChoice = choice;

        Reveal(gameid, msg.sender, choice);

        close(gameid);

        return true;
    }

    /// @dev Close game settlement rewards
    function close(uint gameid) public returns(bool) {
        Game storage game = games[gameid];

        require(!game.closed);
        require(now > game.expireTime || (game.dealerChoice != NONE && game.playerChoice != NONE));

        uint8 result = payoff[game.dealerChoice][game.playerChoice];

        if(result == DEALERWIN){
            require(game.dealer.send(amountWithTip(safeAdd(game.dealerValue, game.playerValue))));
        }else if(result == PLAYERWIN){
            require(game.player.send(amountWithTip(safeAdd(game.dealerValue, game.playerValue))));
        }else if(result == DRAW){
            require(game.dealer.send(game.dealerValue) && game.player.send(game.playerValue));
        }

        game.closed = true;
        game.result = result;

        emit CloseGame(gameid, game.dealer, game.player, result);

        return game.closed;
    }


    function getProof(address sender, uint8 choice, bytes32 randomSecret) public view returns (bytes32){
        return sha3(sender, choice, randomSecret);
    }

    function gameCountOf(address owner) public view returns (uint){
        return gameidsOf[owner].length;
    }

    function checkChoice(uint8 choice) public view returns (bool){
        return choice==ROCK||choice==PAPER||choice==SCISSORS;
    }

}

Contract ABI
[{"constant":true,"inputs":[],"name":"cfoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ceoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"gameid","type":"uint256"}],"name":"close","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"games","outputs":[{"name":"expireTime","type":"uint256"},{"name":"dealer","type":"address"},{"name":"dealerValue","type":"uint256"},{"name":"dealerHash","type":"bytes32"},{"name":"dealerChoice","type":"uint8"},{"name":"player","type":"address"},{"name":"playerChoice","type":"uint8"},{"name":"playerValue","type":"uint256"},{"name":"result","type":"uint8"},{"name":"closed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"gameCountOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newCEO","type":"address"}],"name":"setCEO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCOO","type":"address"}],"name":"setCOO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"choice","type":"uint8"}],"name":"checkChoice","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawTip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCFO","type":"address"}],"name":"setCFO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"sender","type":"address"},{"name":"choice","type":"uint8"},{"name":"randomSecret","type":"bytes32"}],"name":"getProof","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"expireTimeLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DRAW","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newContract","type":"address"}],"name":"setNewAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"NONE","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tip_rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"payoff","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"gameid","type":"uint256"},{"name":"choice","type":"uint8"},{"name":"randomSecret","type":"bytes32"}],"name":"reveal","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cooAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SCISSORS","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ROCK","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PAPER","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DEALERWIN","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"gameid","type":"uint256"},{"name":"choice","type":"uint8"}],"name":"joinGame","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"gameidsOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PLAYERWIN","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxgame","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tip_total","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dealerHash","type":"bytes32"},{"name":"player","type":"address"}],"name":"createGame","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"gameid","type":"uint256"},{"indexed":false,"name":"dealer","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"CreateGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"gameid","type":"uint256"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"JoinGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"gameid","type":"uint256"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"choice","type":"uint8"}],"name":"Reveal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"gameid","type":"uint256"},{"indexed":false,"name":"dealer","type":"address"},{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"result","type":"uint8"}],"name":"CloseGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newContract","type":"address"}],"name":"ContractUpgrade","type":"event"}]

Contract Creation Code
608060405260006004819055662386f26fc100006005556006805460ff19169055600a55610708600b5534801561003557600080fd5b507f741542cd8f25b57b0b9e5febe61424a199c8c746cf747b73eb056bc3b15988ed8054606560ff1991821681179092557f16bba9bde6f0081d94a597097dd9e65d92426023fc5565fa84e934adb6329e278054606690831681179091557f051b6982d5c48debb5d4f481380063fbc6904d233d7e6d3c2b8b61672f2e27e4805460c990841681179091557f6c5942e15257ab7bcb9b9bb9041c45e824b8ce79cae7f957e673c043fd8f455580548416821790557f89764e4724d5b6f4734cb02002996ced9d361f11c01885debd2e3fe0d5f1570180548416851790557fca01adecc13b9a42e1d19659887bb0849449ccc981bcb32fe401ce46b14eb56180548416831790557f6c66d2e35b020654ccc237b963f3925205938faf02503e3c1bfc2f7a3d016e2180548416831790557fe706459878f093bcbf29548d02cefe7e071999b4eaf0f397e129f84becdf51d580548416821790557fff72f25d2d44c50b8c338604e50a89c49f49b37e2ae539bd2993d8cac84c8f2180548416851790557fc65916d663d52b0a18b63681e34ad6e3e8bb58d57f662b8e7e045ab09fab0385805484169094179093557fb7d6e7eda72a6499ac6f7463fe4432d1d4d344daf6aba19537000f7bc79f016280548316841790557ffdc33378a97f40f6da99911196e5660604897295d22000ba672dd761fbecdbd780548316841790557fc1dcbaa2e1e0d7759851e0c47ec29192c90c8b10a1c82fb2795ced2510d574e5805483169093179092557f75f3781c7159604cc37f3697b87982e2a06a22f37a9b56d2e5bed5529088cd2180548216831790557f6908885217db18c3abdd446136634c92ef886652dc29cae881cb7b0346f30fa88054821683179055601e60009081527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df6020527faeca9595c25d880c9de7027d33645b60a917e45f30ff05c2e90a90f2fa1c2a2880549092169092179055805433600160a060020a031991821681178355600280548316821790556001805490921617905561112290819061033d90396000f3006080604052600436106101955763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630519ce7981146101a65780630a0f8168146101d75780630aebeb4e146101ec578063117a5b901461021857806313ffdbfc1461029757806327d7874c146102ca5780632ba73c15146102ed578063366f77b71461030e5780633f4ba83a146103295780634811647c1461033e5780634e0a3379146103565780634f11e07d14610377578063556665db146103a15780635c975abb146103b6578063619d36ef146103cb57806371587988146103f657806383525394146104175780638456cb591461042c57806385df508f14610441578063960be374146104565780639a42f3aa14610471578063b047fb5014610492578063b357a028146104a7578063b93e0e39146104bc578063c44d6f87146104d1578063c89605a2146104e6578063ca6649c5146104fb578063d5a093211461050c578063df5a141714610530578063e38c982514610545578063fc26d5221461055a578063fe1f6a0b1461056f575b6101a160045434610586565b600455005b3480156101b257600080fd5b506101bb6105aa565b60408051600160a060020a039092168252519081900360200190f35b3480156101e357600080fd5b506101bb6105b9565b3480156101f857600080fd5b506102046004356105c8565b604080519115158252519081900360200190f35b34801561022457600080fd5b50610230600435610814565b604080519a8b52600160a060020a03998a1660208c01528a81019890985260608a019690965260ff94851660808a01529290961660a0880152821660c087015260e08601949094529290921661010084015290151561012083015251908190036101400190f35b3480156102a357600080fd5b506102b8600160a060020a036004351661087b565b60408051918252519081900360200190f35b3480156102d657600080fd5b506102eb600160a060020a0360043516610896565b005b3480156102f957600080fd5b506102eb600160a060020a03600435166108f1565b34801561031a57600080fd5b5061020460ff6004351661094c565b34801561033557600080fd5b506102eb610977565b34801561034a57600080fd5b506102eb6004356109ab565b34801561036257600080fd5b506102eb600160a060020a0360043516610a12565b34801561038357600080fd5b506102b8600160a060020a036004351660ff60243516604435610a6d565b3480156103ad57600080fd5b506102b8610ad0565b3480156103c257600080fd5b50610204610ad6565b3480156103d757600080fd5b506103e0610adf565b6040805160ff9092168252519081900360200190f35b34801561040257600080fd5b506102eb600160a060020a0360043516610ae4565b34801561042357600080fd5b506103e0610b6d565b34801561043857600080fd5b506102eb610b72565b34801561044d57600080fd5b506102b8610bd4565b34801561046257600080fd5b506103e0600435602435610bda565b34801561047d57600080fd5b5061020460043560ff60243516604435610bfa565b34801561049e57600080fd5b506101bb610d16565b3480156104b357600080fd5b506103e0610d25565b3480156104c857600080fd5b506103e0610d2a565b3480156104dd57600080fd5b506103e0610d2f565b3480156104f257600080fd5b506103e0610d34565b6102b860043560ff60243516610d39565b34801561051857600080fd5b506102b8600160a060020a0360043516602435610f0a565b34801561053c57600080fd5b506103e0610f3a565b34801561055157600080fd5b506102b8610f3f565b34801561056657600080fd5b506102b8610f45565b6102b8600435600160a060020a0360243516610f4b565b60008282016105a384821080159061059e5750838210155b611073565b9392505050565b600154600160a060020a031681565b600054600160a060020a031681565b600081815260086020526040812060068101548290610100900460ff16156105ef57600080fd5b815442118061061c5750600482015460ff161580159061061c5750600482015460a860020a900460ff1615155b151561062757600080fd5b50600481015460ff808216600090815260076020908152604080832060a860020a9095048416835293905291909120541660c98114156106ba57600182015460028301546005840154600160a060020a03909216916108fc916106939161068e9190610586565b611082565b6040518115909202916000818181858888f1935050505015156106b557600080fd5b610780565b60ff8116606614156106ff578160040160019054906101000a9004600160a060020a0316600160a060020a03166108fc61069361068e85600201548660050154610586565b60ff8116606514156107805760018201546002830154604051600160a060020a039092169181156108fc0291906000818181858888f193505050508015610775575060048201546005830154604051610100909204600160a060020a0316916108fc82150291906000818181858888f193505050505b151561078057600080fd5b60068201805461010061ff0019909116811760ff191660ff84169081179092556001840154600485015460408051898152600160a060020a0393841660208201529390910490911682820152606082019290925290517f1d0c2a9773403f89727475495023df0d7c76f947c60bd5236fbd1c319768a58c916080908290030190a15060060154610100900460ff1692915050565b60086020526000908152604090208054600182015460028301546003840154600485015460058601546006909601549495600160a060020a03948516959394929360ff808416946101008086049091169460a860020a90048216939280831692919004168a565b600160a060020a031660009081526009602052604090205490565b600054600160a060020a031633146108ad57600080fd5b600160a060020a03811615156108c257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461090857600080fd5b600160a060020a038116151561091d57600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600060ff8216600a1480610963575060ff82166014145b80610971575060ff8216601e145b92915050565b600054600160a060020a0316331461098e57600080fd5b60065460ff16151561099f57600080fd5b6006805460ff19169055565b600154600160a060020a031633146109c257600080fd5b6000811180156109d457506004548111155b15156109df57600080fd5b604051339082156108fc029083906000818181858888f193505050501515610a0657600080fd5b60048054919091039055565b600054600160a060020a03163314610a2957600080fd5b600160a060020a0381161515610a3e57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b604080516c01000000000000000000000000600160a060020a0386160281527f010000000000000000000000000000000000000000000000000000000000000060ff85160260148201526015810183905290519081900360350190209392505050565b600b5481565b60065460ff1681565b606581565b600054600160a060020a03163314610afb57600080fd5b60065460ff161515610b0c57600080fd5b60038054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa4461993059181900360200190a150565b600081565b600254600160a060020a0316331480610b955750600054600160a060020a031633145b80610baa5750600154600160a060020a031633145b1515610bb557600080fd5b60065460ff1615610bc557600080fd5b6006805460ff19166001179055565b60055481565b600760209081526000928352604080842090915290825290205460ff1681565b600083815260086020526040812081610c14338686610a6d565b6006830154909150610100900460ff1615610c2e57600080fd5b81544210610c3b57600080fd5b60038201541515610c4b57600080fd5b610c548561094c565b1515610c5f57600080fd5b6004820154610c779060a860020a900460ff1661094c565b1515610c8257600080fd5b6001820154600160a060020a031633148015610ca15750600382015481145b1515610cac57600080fd5b60048201805460ff871660ff1990911681179091556040805188815233602082015280820192909252517fc68416cfb4fec2fce79abcfa27c33ba8c9a63168b3b70d1cd3449b4a973465a89181900360600190a1610d09866105c8565b5060019695505050505050565b600254600160a060020a031681565b601e81565b600a81565b601481565b60c981565b600654600090819060ff1615610d4e57600080fd5b506000838152600860205260409020600281015434148015610d7c57506001810154600160a060020a031615155b8015610d9557506001810154600160a060020a03163314155b8015610dad5750600481015460a860020a900460ff16155b1515610db857600080fd5b60048101546101009004600160a060020a03161580610de8575060048101546101009004600160a060020a031633145b1515610df357600080fd5b6006810154610100900460ff1615610e0a57600080fd5b80544210610e1757600080fd5b610e208361094c565b1515610e2b57600080fd5b60048101805474ffffffffffffffffffffffffffffffffffffffff001916336101008181029290921775ff000000000000000000000000000000000000000000191660a860020a60ff8816021783553460058501908155600b54420185556000918252600960209081526040808420805460018101825590855293829020909301899055935490548251898152600160a060020a0394909204939093169381019390935282810191909152517ff66778a71ad05be3533189f52b3685653815adca5f24272e139571b8e1892f5e916060908290030190a1509192915050565b600960205281600052604060002081815481101515610f2557fe5b90600052602060002001600091509150505481565b606681565b600a5481565b60045481565b600654600090819060ff1615610f6057600080fd5b831515610f6c57600080fd5b50600a805460019081018083556000908152600860209081526040808320808501805473ffffffffffffffffffffffffffffffffffffffff1916339081178255600483018054600385018d905560ff19600160a060020a038d81166101000274ffffffffffffffffffffffffffffffffffffffff001990931692909217169091553460028501908155600b54420185559187526009865284872089548154998a018255908852968690209097019590955595549554935482519687529390941691850191909152838101919091525190917f0ce7f8d8c912a77f9715dfadc24c9fccf69eeb30c5bf53f068a0f9756d2b408a919081900360600190a15050600a5492915050565b80151561107f57600080fd5b50565b600080670de0b6b3a764000061109a846005546110bf565b8115156110a357fe5b0490506110b260045482610586565b6004556105a383826110e2565b60008282026105a384158061059e57508385838115156110db57fe5b0414611073565b60006110f083831115611073565b509003905600a165627a7a72305820d2e8f775f4e0e28bea47a3cac9f7b4b2b1d33ba322b343ae1a9deac811d346fb0029


   Swarm Source:
bzzr://d2e8f775f4e0e28bea47a3cac9f7b4b2b1d33ba322b343ae1a9deac811d346fb
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.