Skip to content

Latest commit

 

History

History
87 lines (49 loc) · 9.55 KB

TIP-203.md

File metadata and controls

87 lines (49 loc) · 9.55 KB
id Title Status Author Description Discussions to Created
TIP-203 Sports Markets V2 Draft Cvija (@scvija), Danijel (@danthales) Sports Markets V2 implementation https://discord.gg/thales 2024-05-17

Simple Summary

Implement and release a new contract architecture for Sports Markets

Abstract

This TIP proposes to develop and release a new set of smart contracts handing the Thales Sports Markets.

The architecture of the contracts themselves is notably different from existing one with some reused aspects. It uses merkle trees to store data and push odds changes, allowing for a much cheaper and more efficient operation and maintenance of the contracts.

Motivation

When Sports Markets were first started in July 2022, together with Overtime, it was a platform deployed on 1 chain, offering two sports and only moneyline markets, with a couple od daily traders. Almost 2 years later, after numerous improvements and additions to the the platform, the numbers look like this: Thales Sports Markets are now deployed to 3 chain - Optimism , Arbitrum and Base. They offer markets for around 15 different sports - from the most popular ones, like soccer, football and basketball, but also some more exotic ones, for example fighting sports, e-sports like Dota2 and Counter Strike, with more to come.

Offering per sports has significantly increased also, so aside from the moneyline markets, Overtime now offers spreads, totals, SGPs, but also player props markets covering the number of points, rebounds, triple doubles, number of hits, rushing yards and many more.

The markets themselves were not the only thing that was being developed. Overtime has added support for parlays, social logins, multicollateral usage and most importantly, it allowed users to be the house by adding their own liquidity.

Regarding the actual usage of the platform, Overtime is a mature platform, with more than 10k unique users, and around 500k USD buy-ins and 1.5M USD of notional volume. At the time of writing, the total volume numbers look like this - the combined notional volume of Overtime, including both SportsAMM and ParlayAMM, is a whooping 72.624.755 USD, and it is growing daily.

With all of this in mind, there are some challenges Overtime is facing. Due to the completely unique onchain architecture, where every markets is a smart contract on its own, and each market needs their odds updated frequently with an onchain transaction, scalling with the current architecture might be a bit more challenging in the future.

In times of high gas fees, creating markets and updating odds turned out to be pretty costly, and this is before the plans to expand our offering to be on par with web2 sportsbook. As an example, a single soccer or basketball game easily contains more than 100 different markets with web2 books. The recent Dencun update made this challenge significantly easier for Overtime to handle, but we anticipate a significant uptick in Overtime and (crypto) usage and a decision has been made to tackle these scaling challenges upfront and be ready for the next 1000x users.

In addition, the architecture of the contract imposed a challenge in adding new market types, as every market type was handled with dedicated logic in smart contracts. V2 proposes a more generic system for market types to enable easier adding of new markets without contract changes.

Therefore, may we introduce Sports Markets V2

Specification

The biggest change to Thales Sports Markets in V2 will be the introduction of merkle trees. A Merkle tree is a data structure that organizes data into a tree format, allowing quick and secure verification of data integrity using hashes. The top node, called the root, summarizes the entire dataset, which makes such a data structure ideal for blockchain use cases where efficiency is crucial. This will allow Overtime to support even more sports, to support many more markets and market types, therefore expanding the potential user base and therefore the volume driven many times over.

In the case of Overtime, V2 will use Merkle trees to create markets and push odds to the chain, drastically cutting gas costs by storing only the tree root onchain while submitting other data and proofs as calldata.

An example tree can be found here

Merkle trees will be stored on S3 buckets initially, but could move to decentralized hosting down the line. The exact storing location does no affect frontends and integrators, as they will solely use Thales Sports v2 API to interact with the system.

Another significant difference is that there will not be a strict difference between singles and parlays, so we could say that a single will basically be a parlay with 1 leg. Both singles and parlays will of course still be fully collateralized, and the mechanism behind it will be very similar to the rework of parlays we recently had, where the odds are multiplied and the full amount of USD is locked in a new ticket clone contract.

The skew mechanism is another thing that web2 books users were not familiar with. Basically, if you were to place a trade larger than a certain threshold or a trade where the team is already heavily favored by users, the system would gradually decrease the odds it is offering. This was easily noticablle with matches where the favorite to win is very clear. In V2 this will not be happening anymore, the odds you see on the markets page are the ones you will be getting all the way. The odds might change, but for the next user. However, as we continue scaling offering, pdao retains the right to introduce thresholds upon which the odds will change to allow large sized bets.

The odds will be pushed via Merkle Trees, as mentioned above. This has multiple advantages, like the pushing of a merkle tree onchain being very cheap, but also the possibilty of pushing multiples odds at the same time.

The safety of the contracts Overtime uses remains a top priority, therefore Chainlink nodes will still be used for market resolution, ensuring that even if some keys for any reason end up in the wrong hands, any kind of massive attack will not be possible.

Multiple collateral pools: V2 merges singles and parlays into a single pool, but will allow multiple native collateral pools. Initially there will be an USDC, ETH and THALES pools, which are further expanded upon in dedicated TIPs. Risk management still works using USDC denomination, where the price for ETH and THALES will be served via PriceFeed contracts. This means that if an user wants to bet using ETH, his payout is denominated in ETH as well.
Multicollateral onramp and offramp will still be supported to allow users to use collateral such as USDT, DAI and similar, but those bets will be collaterized using the default USDC pool internally.

V2 also tackles a few other features that were frequently requested:

Refunds: With the current architecture, after each buy, a part of the buy-in, namely the fees, were directly sent to a couple of addresses, like the safebox or the referrer address. This indeed is a very elegant solution in comparison to some platform where you have to wait for the whole month to receive you referral amount. However it proved to be a bit problematic with canceled markets and refunds. First of all, the fees were distributed imediatelly and there is no returning them to the trader now.The second issue was that the money spent was converted to ERC-20 tokens, whose value changes as the odds change, so it was possible to buy in for lets say 100 USD and after the cancelation to receive 95 USD, or even 105 USD if the price moves in that direction. in V2, the funds are only reserved, so if a game is actually canceled, all the traders will be made whole 100%.

Cashout: A very typical feature of web2 sportsbooks, especially with parlays, is the possibility of cashing out early if you parlay is doing good. To give an example, if you have created a 5 game parlay, and you have guessed correctly 4 games already with one yet to start, the system can offer you to discard the last game and take your money now for a certain fee. This feature won't be availabe on initial release, but will be implemented at a later point.

The last thing, but one of the more requested features is the Live betting or in-game betting. The way this works is allowing the user to place trades on games that are ongoing, making the whole process much more exicing and interactive. Live betting has its own TIP, so we will not go deep into it here.

Risk management mechanics will be inherited from V1. There will be a cap per sport and market type. Risk is measured as an exposure to buyin * odds per game on a ticket. Risk is rebalanced as users bet on each side of an exclusive outcome.

Implementation

https://github.com/thales-markets/contracts-v2

Rollout

V2 will be released in beta for EURO 2024 (unless there are blocking audit issues, which is currently in progress and going well).
V1 and V2 will run in parallel while V2 matures, giving integrators and liquidity providers time to transition from v1 to v2. Once V2 is ready to exit out of beta, V1 will be deprecated.

Copyright

Copyright and related rights waived via CC0.