How it works ?

Diagram of the flow

Match Making

When a player wants to play a game, player sends room amount and RNG contract address. If there is no room with this RNG and room amount new room has been created. And player becomes Creator.
If there is an open room already playerjoins to that room and becomes Opponent and randomness will be requested from the desired RNG Source.

Join A Specific Room

Player can also join an already open room and becomes Opponent.

Cancelling A Room

If player is creator and there is no opponent in the game, player can cancel the game. Cancelling the game results in a %100 refund of the tokens.
Also if a game not results in a while, deployer can cancel that room. This operation also results in a %100 refund of the tokens to the players.

Calculate Winner

When randomness request resulted, triggerer or keeper will call this function to calculate the winner and forward the bet amounts. Calculation and forwarding the funds executes on-chain contracts.

Keeping And Moving Bet Amounts

When a game starts, player's bet amounts will held in a vault contract. When a game resulted (cancellation or finished) vault move the bet amounts to the corresponding players.

RNG Sources

RNG source is a smart contract that provides randomness for games.
ChainlinkVRF and block hash based rng sources will be added in the future.