#0
nonstandard
0.00004000 BSV
Q!µ,æÇ£>éÜÁõdŬwt æêBß\«Q®Mh{"__cls":"class GameContract{\n constructor(pKeyOwner,playerIdOwner,wagerAmount){\n this.gamePlayState = 0;\n this.pubKeyCreator = pKeyOwner;\n this.pubKeyOpponent = null;\n this.creatorId = playerIdOwner;\n this.opponentId = null;\n this.createdAt = new Date().getTime();\n this.updatedAt = new Date().getTime();\n this._amount = wagerAmount;\n this.moves = [];\n this._owners = [pKeyOwner];\n this.wagerState = 0;\n }\n addOpponent(pKey,playerId){\n if(!this.pubKeyOpponent){\n this.pubKeyOpponent = pKey;\n this.opponentId = playerId;\n this.gamePlayState = 1;\n this._owners.push(pKey);\n this.updatedAt = new Date().getTime();\n }\n \n }\n \n closeWager(amount,playerId){\n if(amount === this._amount && playerId === this.opponentId && this.gamePlayState == 1){\n this.wagerState = 1;\n this.updatedAt = new Date().getTime();\n }\n }\n \n isValidPayloadMove(move){\n return (move && (move['playerId'] == this.creatorId || move['playerId'] == this.opponentId) && move['fen']);\n }\n isValidMove(fen){\n return true;\n }\n addMove(move){\n if(this.isValidPayloadMove(move) && this.isValidMove(move) && this.wagerState == 1 && this.gamePlayState>=1 && this.gamePlayState<6 ){\n if(this.isWiningMove(move['fen'])){\n this.gamePlayState = 6;\n this.updatedAt = new Date().getTime();\n }else{\n let temp = {\n playerId : move['playerId'],\n fen : move['fen'],\n timestamp : new Date().getTime()\n }\n this.moves.push(temp);\n this.updatedAt = new Date().getTime();\n }\n }\n }\n isWiningMove(fen){\n return false;\n }\n \n \n }","__index":{"obj":0},"__func":"constructor","__args":["03b591ad2c91e6c70ba33ee9dcc1f5641a14c5ac93777409e6ea42df9b9f5cab87","6173b6e371668d3532258862283cc11b6736627106e12dddffbc3d56085c126e",0]}u
https://whatsonchain.com/tx/b488cc1b45e59d8fe93fd1dca6d1b1b467259ef5a1e5e9c0eaa25bebb1123906