Skip to content

Instantly share code, notes, and snippets.

@Vitali8
Created February 13, 2019 17:20
Show Gist options
  • Save Vitali8/04d0eb2a971ce18f45bc9356be1aff39 to your computer and use it in GitHub Desktop.
Save Vitali8/04d0eb2a971ce18f45bc9356be1aff39 to your computer and use it in GitHub Desktop.
TicTacToeTon's contract for Titanium labs BA
pragma solidity 0.5.0;
import "./TicTacToe.sol";
contract Player{
uint256 public wins;
uint256 loses;
string name;
address owner;
address latestGame;
address _gm;
constructor(address user, address gm, string memory nickName) public {
owner = user;
_gm = gm;
name = nickName;
wins = 0;
loses = 0;
}
modifier onlyGame() {
require(msg.sender == latestGame, "Only game can use that");
_;
}
modifier onlyGameManager() {
require(msg.sender == _gm, "Only game manager can use that");
_;
}
function incWins() public onlyGame{
wins++;
}
function incLoses() public onlyGame{
loses++;
}
function setLatestGame(address gameAddress) public onlyGameManager{
latestGame = gameAddress;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment