Author: 0xAA
Development / Design / Coordination: @cosmoburn, @0xAA_Science, @deepe_eth, @steve0xp, TylerS, @beastadon, @OrHalldor, @Thisisnottap
The code is opensourced at:
For the introduction of the v0.1 version, see :
function initGame(uint256[] calldata _creatorTogs, uint256[] calldata _amounts):
function joinPlay(uint256 _gameId, uint256[] calldata _joinTogs, uint256[] calldata _amounts)
There are 3 events related to game play, and 1 event related to withdraw Togs.
event gameInit(uint256 indexed GameId, address indexed Creator, uint256 indexed ExpirationBlock)
: This event is emitted when player 0 create a new game. It carries the information of the gameId (unique game identifier), address of player0, and how long the game will expire.event gameJoin(uint256 indexed GameId, address indexed Creator, address indexed Opponent, bytes32 RequestId)
: This event is emitted when player 1 join a existing game. It carries the information of the GameId, address of player0 and player 1, and the chainlink VRF RequestId.event FlipTogs(uint256 indexed GameId, address indexed Creator, address indexed Opponent, uint256[] FlippedTogs, uint256[] AmountPlayer0, uint256[] AmountPlayer1)
: This event is emited when chainlink VRF is executed in callback function and Togs are sent randomly back to player0 and player1. It carries the information of the gameId, addresses of player0 and player1, list of TogId in this game, list of amount of Togs sent to Player0 and Player1.event WithdrawTogs (uint256 indexed GameId, address indexed Creator)
: this event is emitted when a game created by player0 is not joined by any player within expirationBlock, and player0 choose to withdraw his Togs. It carries the information of GameId, address of player0