Market
Last updated
Last updated
New Matches are created and settled from the Market contract. Only the provider address can call must of functions in the market contract. A market is started when provider calls startMarket function with appropriate details like start time, match name, match details, series of bets available for the match, and the starting odds. This data is sent in an array, and multiple matches can be sent at the same time. The data is stored inside a map with an index that increases with every new call serving as the match id and the key in the map.
Before the match settles, providers can call the updateOdds function to update the odds for the game.
The match is settled when the provider calls settleMarkets method with the index of the winning team. When a match is settled, this contract unlocks the liquidity the bet contract locked for this match.
Market contract also has many read-only functions that frontend calls to get details of a match. It returns all matches, match details by given id, and so on.