| id | Title | Status | Author | Description | Discussions to | Created |
|---|---|---|---|---|---|---|
| TIP-72 | Parlay AMM | draft | Kiril, Danijel (@danijelthales) | Implement a Parlay AMM | https://discord.gg/8bzFdpGTrp | 2022-07-28 |
This TIP proposes an implementation for Parlay AMM for sport markets
Spec out and implement a Parlay AMM
While individual markets are popular with some Sport Markets users, the majority of web2 sport books users are usually combining multiple games into a single position.
This TIP proposes how Thales can build such a mechanism on top of its existing Sport Markets AMM by composing multiple tokenized positions into a single ERC20 position with an automated market maker initially only for buys.
A user can choose up to 4 positions on different markets to create a Parlay ticket.
The Parlay AMM calculates the price of such a ticket by multiplying the individual prices of all single positions by getting quotes from the underlying Sport Markets AMM and adding a ParlayAMMFee and the SafeBoxFee.
The calculation is done in two phases:
Maximum return of a Parlay is capped at maxSupportedAmount price with initial value of 20x or maxSupportedOdds = 0.05.
When a Parlay AMM market is resolved, in that same method all individual positions are exercized from underlying Sport Markets AMM and all sUSD is moved to the ParlayAMM contract (similar implementation to RangedMarketsAMM).
A user can then exercize his winnings from the ParlayAMMContract.
For this to be economically feasible, the underlying Sport Markets AMM will not be charging SafeBox fee when the buyer is the ParlayAMM. The ParlayAMM will have its own SafeBoxFee variable.
The Parlay AMM has to keep track of how much it can risk in total and make sure its solvent at any given time (it can not mint a new Parlay if it doesnt have enough sUSD to collaterize it). To lower the exposure, there is a maxAllowedRiskPerCombination variable that prevents the Parlay AMM to be over-exposed for a same set of games in a parlay. This caps the sum of all the user deposits per parlay combination up until the maxAllowedRiskPerCombination (for example parlay with games combination [A, B, C, D], [A, D, C, B] or [B, D, C, A]).
On cancelled games:
If one or more markets in a parlay result in cancellation, usual approach in centralized books is to ignore that market, but multiplu the odds for other winning markets in the parlay.
The current implementation implements this logic. The cancelled game is included with odd 1 in the total odds calculation. If the parlay has four games with odds [ 0.6, 0.5, 0.3, 0.7] with total product of 0.063 and the third game is cancelled, the parlay will result in the [ 0.6, 0.5, 1, 0.7] with total product of 0.21.
In the case of winning parlay with cancelled positions, the user obtains, as expected, less than the total winnning amount while the Parlay AMM is refunded for the cancelled positions.
Ristricted combinations:
A user choses to place 10 sUSD on parlay with games:
First step is to calculate all the initial values:
total quote = 0.3 x 0.55 x 0.5 x 0.65 = 0.053625
sUSD after fees = placedAmount - (parlayFee + safeBoxFee) = 10 - 6% = 9.4
expected payout = 9.4/0.053625 = 175.291
Second step is to calculate the positions to be bought from SportsAMM per game. The strategy is to use inverse distribution of the buying amount:
Due to the skewImpact in the SportsAMM, the values are adjusted accordingly for:
The last step is buying the position amounts using the ParlayMarketsAMM contract, with additional slippage.
All the positions are transferred to the newly created ParlayMarket.
In case all the positions are winning, the user can exercise and claim = 175.28 sUSD
minUSDAmount = 20 sUSD - minimum user deposit amount per parlaymaxSupportedAmount = 5000 sUSD - maximum payout amount per parlaymaxSupportedOdds = 0.05 - maximum total quote per parlaymaxAllowedRiskPerCombination = 5000 sUSD - maximum allowed risk for same set/combination of games in parlay.parlaySize = 4 - max number of games per parlayparlayAMMFee = 3% - a parlay fee for each parlaysafeBoxFee = 3% - a safe box fee for each parlayreferrerFee = 0.5% - a referral fee for each parlayMain contract used for quoting and buying ParlayMarket.
Each quote/buy requires a set of sportMarkets and positions plus a sUSDamount.
The size set can not be higher than the parlaySize.
On buy, the totalAmount of sport positions are bought from SportsAMM and transferred to the newly created ParlayMarket.
Contract holding the user positions for a parlay.
The sum of all positions is equal to the expectedPayout for a parlay.
On exercise, if parlay poses only winning positions, the winning sUSD amount is transferred to the user.
In other cases, winning positions are exercised and transferred to ParlayMarketsAMM.
Used for monitoring on-chain Parlay data.
Copyright and related rights waived via CC0.