Sports Markets Integration
Overtime API
In order to ensure easy integration with third party applications, Overtime API is created. API returns all main data available on Overtime. Using Overtime API endpoints someone can get data about:
Overtime sports
Overtime collaterals
Overtime markets
Overtime market
User Overtime positions
User Overtime transactions
Single quote
Parlay quote
More details about each API endpoint with request/response examples can be found under Postman documentation.
Contract integration
Once all data are fetched from API, the next step is integration with Overtime contracts. Depending on whether someone wants to buy a single or a parlay, integration should be done with Sports AMM Smart Contract or Parlay AMM Smart Contract.
The next sections describe integration with Overtime API and Overtime contracts together with JS code examples.
Buy a single
Let's say someone wants to buy positional tokens on Chelsea for the game Chelsea - Liverpool with a buy-in amount of 100 sUSD.
Integration with Overtime API and Sports AMM contract should include the following steps:
Get a quote for a single market from Overtime API
Get a Sports AMM contract address for a specific network from Thales contracts
Get a Sports AMM contract ABI from Overtime contract repository contract repository
Create Sports AMM contract instance
Call
buyFromAmmmethod on Sports AMM contract with input parameters fetched from Overtime API in step #1
The JS code snippet below implements these steps:
Buy a parlay
Let's say someone wants to buy a 4-game parlay with a buy-in amount of 100 sUSD.
Get a quote for a parlay from Overtime API
Get a Parlay AMM contract address for a specific network from Thales contracts
Get a Parlay AMM contract ABI from Overtime contract repository contract repository
Create Parlay AMM contract instance
Call
buyFromParlaymethod on Parlay AMM contract with input parameters fetched from Overtime API in step #1
The JS code snippet below implements these steps:
Last updated