> For the complete documentation index, see [llms.txt](https://betfin.gitbook.io/betfin-public/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://betfin.gitbook.io/betfin-public/smartcontracts-description/game-interface.md).

# Game Interface

The `GameInterface` is an integral part of a BetFin gaming ecosystem, designed to standardize how games interact within the rest system. This interface ensures that any game implementing it will adhere to a specific structure, making it easier to integrate with wallets, other games, or platforms that need to interact with various games without knowing their internal implementations.

The interface now supports House, PvP, Lottery, and Mirror Game templates to ensure deterministic payouts.

### Game Category Logic

* **House Games:** Players play against the LP; funds are reserved at the time of the bet.
* **PvP Games**: Players compete against each other; fees are deducted upfront.
* **Lottery**: Feature LP-backed progressive jackpots with two-phase settlement.

### Key Functions 🔑🔧 <a href="#key-functions" id="key-functions"></a>

The interface consists of several crucial functions, each serving a specific purpose within the gaming ecosystem:

<table><thead><tr><th width="173">Function</th><th width="144">Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>getAddress()</code></td><td><code>address</code></td><td>Returns the address of the game contract. Useful for identification and transactions.</td></tr><tr><td><code>getVersion()</code></td><td><code>uint256</code></td><td>Provides the version of the game. This could be used for compatibility checks.</td></tr><tr><td><code>getFeeType()</code></td><td><code>uint256</code></td><td>Indicates the type of fee mechanism the game uses. <code>0</code> means the fee is taken from the player's bet ,generally for <a href="/spaces/U0E13A9atLq425EtFUQU/pages/Y9NvzLKbW72geYc2fEeF">Shared Games</a>, while <code>1</code> indicates the fee comes from the game's core balance, generally for <a href="/spaces/U0E13A9atLq425EtFUQU/pages/Y9NvzLKbW72geYc2fEeF">Lotto Games</a></td></tr><tr><td><code>getStaking()</code></td><td><code>address</code></td><td>Returns the address of the staking contract associated with the game, if any. Staking to be used for rewards or other in-game mechanics.</td></tr><tr><td><code>placeBet()</code></td><td><code>address</code></td><td>A function to place a bet or initiate a game action. It requires the player's address, the amount, and any relevant game data.</td></tr></tbody></table>
