Inherits: IGameFactory, Ownable, Pausable
Facilitates the creation of new games
State Variables
MAXIMUM_GAME_CREATION_FEE
This uses 6 decimals because the contract uses USDC as the fee token
uint256 public constant MAXIMUM_GAME_CREATION_FEE = 100e6;
Address of the USDC token
IERC20 public immutable usdc;
Address of the Vault contract
Vault public immutable vault;
Address of the Revealer contract
Duration of newly created games
Duration at which the revealer can reveal the cards of newly created games
Maximum amount of free reveals for newly created games
gameCreationFee
Fee of game creation in USDC
ID of the next Game
Number of games a user has created
Referrals program
referrerInvites
Number of players a referrer has invited
Initializes the GameFactory contract with specified parameters
Parameters
The address of the USDC token
The address of the vault that will call the createGame function
A trusted address used to initialize games and reveal player guesses
The duration of each game, after which games expire
The duration which the user can claim their win if revealer does not reveal
The maximum amount of free reveals a player can request
The fee required for players to create games
Pauses the GameFactory from creating new games
Emits Paused event
Unpauses the GameFactory from creating new games
Emits Unpaused event
setGameCreationFee
Changes the fee required to create a new game
Emits GameFeeChanged event
Parameters
The new fee amount in USDC
setGameDuration
Changes the duration of future games
Emits GameDurationChanged event
Parameters
The new duration in seconds
setClaimableAfter
Changes the claimable duration of future games
Emits ClaimableAfterChanged event
Parameters
The new duration in seconds
setMaxFreeReveals
Changes the maximum amount of free reveals a player can request for future games
Emits MaxFreeRevealsChanged event
Parameters
The amount of free reveals a player can request
Changes the manager address for creating new games
Emits RevealerChanged event
Parameters
Creates a new game using the GameFactory contract and stores related data
The caller must pay at least the gameCreationFee amount to create a game
Emits GameCreated event
Parameters
The referrer of the player. Could be the 0x00 address if already set or if the player does not want to set one
Returns
The ID of the newly created game
The address of the newly created game
Retrieves the details of a specific game
Parameters
Returns
Details of the specified game