if (typeof web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); var contrAdress = '0x80dd7334a28579a9e96601573555db15b7fe523a'; var contrInterface = [ { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" }, { "indexed": false, "name": "score1", "type": "uint8" }, { "indexed": false, "name": "score2", "type": "uint8" } ], "name": "ScoreChanged", "type": "event" }, { "constant": false, "inputs": [], "name": "deleteContract", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "exitRoom", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "fixResults", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "fixTimerResults", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "joinRoom", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" }, { "name": "count", "type": "uint8" }, { "name": "privat", "type": "bool" } ], "name": "newRoom", "outputs": [ { "name": "", "type": "uint256" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" }, { "name": "bet", "type": "bytes32" } ], "name": "setBet", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" } ], "name": "OneMoreGame", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "player", "type": "address" }, { "indexed": false, "name": "r", "type": "uint8" }, { "indexed": true, "name": "room", "type": "uint256" } ], "name": "Result", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" } ], "name": "SeedOpened", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "win", "type": "address" }, { "indexed": true, "name": "room", "type": "uint256" } ], "name": "Winner", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" }, { "indexed": false, "name": "res1", "type": "uint8" }, { "indexed": false, "name": "res2", "type": "uint8" } ], "name": "RoundFinished", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "win", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": true, "name": "room", "type": "uint256" } ], "name": "Revard", "type": "event" }, { "constant": false, "inputs": [ { "name": "mreic", "type": "uint256" } ], "name": "setMaxReic", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" } ], "name": "BetsFinished", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" }, { "indexed": true, "name": "player2", "type": "address" }, { "indexed": false, "name": "countdownTime", "type": "uint256" } ], "name": "JoinPlayer2", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" } ], "name": "RevertRoom", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" }, { "indexed": true, "name": "player1", "type": "address" } ], "name": "JoinPlayer1", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" } ], "name": "RoomClosed", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "room", "type": "uint256" }, { "indexed": true, "name": "player1", "type": "address" }, { "indexed": false, "name": "bet", "type": "uint256" }, { "indexed": false, "name": "counter", "type": "uint8" }, { "indexed": false, "name": "openedTime", "type": "uint256" }, { "indexed": true, "name": "privat", "type": "bool" } ], "name": "RoomOpened", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "room", "type": "uint256" } ], "name": "BetsAdd", "type": "event" }, { "constant": false, "inputs": [ { "name": "id", "type": "uint256" }, { "name": "seed", "type": "uint256" } ], "name": "setSeed", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "transferOutAll", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomBet", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomBet1", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomBet2", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomCounter", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" }, { "name": "player", "type": "address" } ], "name": "checkRoomIsBet", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomNotClosed", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomOpened", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomPlayer1", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomPlayer2", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomRes1", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomRes2", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomScore1", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomScore2", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkRoomStartTime", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "id", "type": "uint256" } ], "name": "checkSenderBet", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "owner", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" } ]; var contr = web3.eth.contract(contrInterface); var contractInstance = contr.at(contrAdress); var address = web3.eth.defaultAccount; var block = 0; web3.eth.getBlockNumber( function(er, res){ if(res) block = res }); }