> 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/predict-contract.md).

# Predict Contract

The `Predict.sol` contract is one of Betfin [Games](broken://pages/aKsdvd4ShPBzesPkK1Nd) that facilitates prediction games. It is designed to work with other contracts, including [`PredictGame`](broken://pages/DSYdzKnBqeIpPNpVueEd) for individual prediction games and [`ConservativeStaking`](broken://pages/AK1FvVYNuJbyF2rraf0t) for staking mechanisms. This documentation outlines the key functionalities and components of the `Predict` contract.

### Key Components

#### State Variables

* `core`: An `immutable` reference to the [`Core`](broken://pages/1Qngro7f28fSq5sUYJak) contract, central to the ecosystem.
* `staking`: An `immutable` reference to the [`ConservativeStaking`](broken://pages/AK1FvVYNuJbyF2rraf0t) contract, for staking functionalities.
* [`games`](broken://pages/DSYdzKnBqeIpPNpVueEd): An `address[]` private array holding addresses of all prediction game contracts.

#### Events

* `GameCreated(address indexed game)`: Emitted when a new prediction game contract is created.
* `GameDeactivated(address indexed game)`: Emitted when a prediction game contract is deactivated.
* `GameActivated(address indexed game)`: Emitted when a prediction game contract is activated.
* **placeBet (internal)**: Transfers the bet amount to the game contract and calls `placeBet` on the specified `PredictGame`. This is used by the public `placeBet` function after validations.

### Functions

* **addGame**: Creates a new `PredictGame` contract with specified parameters, activates it, and emits `GameCreated`. It performs several checks to ensure valid parameters.
* **deactivate**: Deactivates a specified prediction game contract by calling its `deactivate` function and emits `GameDeactivated`.
* **activate**: Activates a specified prediction game contract by calling its `activate` function and emits `GameActivated`.
* **placeBet**: Places a bet on a specified prediction game. It transfers the bet amount (minus a fee) to the game contract and calls `placeBet` on the specified `PredictGame`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://betfin.gitbook.io/betfin-public/smartcontracts-description/predict-contract.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
