📟Predict Contract
The Predict.sol
contract is one of Betfin Games that facilitates prediction games. It is designed to work with other contracts, including PredictGame
for individual prediction games and ConservativeStaking
for staking mechanisms. This documentation outlines the key functionalities and components of the Predict
contract.
Key Components
State Variables
core
: Animmutable
reference to theCore
contract, central to the ecosystem.staking
: Animmutable
reference to theConservativeStaking
contract, for staking functionalities.games
: Anaddress[]
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 specifiedPredictGame
. This is used by the publicplaceBet
function after validations.
Functions
addGame: Creates a new
PredictGame
contract with specified parameters, activates it, and emitsGameCreated
. It performs several checks to ensure valid parameters.deactivate: Deactivates a specified prediction game contract by calling its
deactivate
function and emitsGameDeactivated
.activate: Activates a specified prediction game contract by calling its
activate
function and emitsGameActivated
.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 specifiedPredictGame
.
Last updated