🏈Game Market Smart Contract

The first component that makes Overtime's Sport Markets possible is the Game Market Smart Contract. This type of smart contract is based on the foundational Thales Positional Market architecture and is similar to an escrow contract. Each game will have it's own Game Market Smart Contract which will temporarily hold collateral in return for newly minted ERC-20 Outcome Tokens unique to that particular game. This means that each game will have it's own smart contract, which will then mint a different ERC-20 token for each possible outcome for that game.

The Game Market Smart Contract as well as each ERC-20 Outcome Token available for that game are dependent on the parameters set for that game's league. Based on the League ID for a particular match, each market can offer HOME WIN, AWAY WIN and DRAW (for sports/events that allow draws) or simply HOME WIN and AWAY WIN. Other types of markets, such as spreads, can include Outcome Tokens for ABOVE and BELOW.

There is only one whitelisted address that is allowed to mint outcome tokens from the Game Market contracts, and that address represents the Sports AMM contract.

The depositor receives one of the available Outcome Tokens for each USD deposited into a Game Market Smart Contract. Since these Outcome Tokens represent all of the possible outcomes for that unique Game Market, only one of the Outcome Tokens for that market will be redeemable for the USD held in the Game Market Smart Contract. This is determined by Market Resolution data sent to the blockchain via Chainlink data feeds informing the smart contract that certain conditions have been met and which Outcome Tokens are redeemable.

Each market will go through the following phases:

  • Market Creation: The Game Market Contract is created with League ID used to determine which Outcome Tokens can be minted

  • Positioning: Traders can exchange collateral for Outcome Tokens, with 1 USD purchasing 1 ERC-20 Outcome token

  • Market Resolution: Winning Traders can exchange Outcome Tokens for the USD held in the Game Market Contract

Market Creation

A new Game Market Contract is created for each sporting event offered by Overtime. This happens when a request for new on-chain data is triggered to the Chainlink Node. The requested on-chain data is stored in a queue and then used to create the individual Game Market Smart Contracts.

Unique game parameters are pulled from the Chainlink data in the following structure:

```
struct GameCreate {
bytes32 gameId;
uint256 startTime;
int24 homeOdds;
int24 awayOdds;
int24 drawOdds;
string homeTeam;
string awayTeam;
}
```

A Game Market Contract can only be created from the oracle data if the following is true:

  • The sporting event has not started yet

  • The sporting event is not finished/cancelled

  • Odds data is included

  • Team names are valid

If these conditions are met then the the `RequestGames` method in `TheRundownConsumerWrapper` contract populates the queue with data for new markets. This contract then calls the `CreateMarketForGame` method in `TheRundownConsumer` contract.

`TheRundownConsumer` contract is whitelisted to use the`SportPositionalMarketManager` contract to finally create the individual Game Market Smart Contract. This contract is capable of accepting USD as collateral and working with the Sports AMM Smart Contract to mint ERC-20 Outcome Tokens in exchange for this collateral.

Positioning

Once a Game Market Contract has been deployed and minting is live traders can purchase Outcome Tokens. This can be done by interacting directly with the contract or via a UI such as https://overtimemarkets.xyz/#/markets.

Market Resolution

A market contract must be resolved for traders to redeem winning Outcome Tokens for USD. This can only happen when a sporting event ends and a request is made to the Chainlink Node for the on-chain data required to resolve a Game Market Smart Contract.

The data for this request is passed in the following structure:

```
struct GameResolve {
bytes32 gameId;
uint8 homeScore;
uint8 awayScore;
uint8 statusId;
uint40 lastUpdated;
}
```

Once a specific Game Market Smart Contract is resolved on chain by the relevant GameResolve structure, exercising is enabled for that Game Market for all holders of winning ERC-20 Outcome Tokens.

Each winning ERC20 Outcome Token can be exercised to redeem one USD from the Game Market Smart Contract. Market contracts are always holding the same amount of USD as there are winning ERC20 Outcome Tokens in circulation. This architecture ensures that all positions are always fully collateralized at any point in time.

Last updated