How it works ?
.png?alt=media&token=6bad452f-f4f2-4c4b-b80e-bfd4337484af)
Diagram of the flow
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.
Player can also join an already open room and becomes Opponent.
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.
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.
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 source is a smart contract that provides randomness for games.
- RNGApi(0xE16c65bD0E1cB1ed9D5ED7BD6e9dF80b36250af5), random number generated on a non-chain app. keccak256(creatorseed+opponentseed+secretseed) is the generated seed for calculating the game winner.
ChainlinkVRF and block hash based rng sources will be added in the future.
Last modified 1yr ago