🖥️Parlay AMM and Market Contracts
Last updated
Last updated
The final contracts that are crucial to Overtime's Architecture is the Parlay AMM Smart Contract and Parlay Market Smart Contract.
These contracts work with the SportsAMM and individual Game Market Smart Contracts to allow traders to string together positions from multiple individual markets into one combined-quote ticket.
This contract is designed to work on top of the SportsAMM Contract to provide Parlay positioning features to traders.
Parlays are a common feature in centralized sports markets that allow traders to leverage their positions to multiple markets in one potential payout. The potential winning payout of a parlay is calculated by multiplying odds of each position in a Parlay with the odds of other positions in the same Parlay. All individual positions in the parlay must win for the whole parlay to be a winner.
Aa user that wants to create a Parlay must pass the following data points to the Parlay AMM Smart Contract:
SportsMarkets (address[]): An array of addresses pointing at the individual Game Market Smart Contracts that the Parlay ticket is composed of
Positions (uint256[]: An array of indexes pointing to the individual positions of each Game Market Smart Contract that the Parlay ticket is composed of
sUSDPaid (uint256): The user's buy-in amount in sUSD
ExpectedPayout (uint256): The amount of collateral that can be claimed for winning position
AdditionalSlippage (uint256): The amount of slippage to include in the transaction as a risk management measure
DifferentRecipient (address): Optional address input if the user wants another address to be the recipient of the Parlay position
The ParlayAMM then calculates the total payout amount using the executed inputs as well as the individual odds from each position included in the Parlay. It then works with the SportsAMM to execute a capital-efficiency-focused partial hedging collateralization strategy.
To do this, the ParlayAMM contract utilizes it's personal collateral pool, which is equal to the calculated total payout amount for that specific collection of positions, to purchase Outcome Tokens for the inverse default implied probability of these positions. For example, if I create a parlay with HOME win Outcome Tokens for the Astros vs. Dodgers game, as well as AWAY Outcome Tokens for the Bayern Munich vs. FC Augsburg match, then the ParlayAMM will purchase AWAY tokens for the Astros/Dodgers game, as well as DRAW and HOME tokens (since soccer matches can include DRAW outcomes) for the Bayern/Augsburg match.
The ParlayAMM contract calculates the amount of individual ERC-20 Outcome Tokens to buy from the Sports AMM using the following formulas integrated into the smart contract architecture:
After all the calculations are done, the ParlayAMM contract buys the relevant ERC-20 Outcome Tokens from the SportsAMM in the amounts calculated during the previous phase.
Finally there's the Parlay Market Smart Contract. This contract come into play once all the positions are purchased by the ParlayAMM. The ParlayAMM can then create a Parlay Market Smart Contract that represents the specific parlay created by the user.
If the user's parlay is successful (each individual position is a winner), then the user is allowed to initiate an exercise of their Parlay ticket. This transfers the amount of USD calculated as the expected payout from the Parlay Market Smart Contract to the user's wallet. This USD is available from the Parlay Market contract once it exercises each winning position it purchased from the individual Game Market Smart Contracts that were included in the Parlay.
If the user's parlay is unsuccessful (one or more positions lost), all USD (if any) left from the Parlay Market contract is transferred to the ParlayAMM contract. This USD was acquired by the Parlay Market contract by exercising the winning positions it purchased as the inverse default implied probability of the positions in the Parlay.
The ParlayAMM has certain mechanics implemented that act as risk management tools. These include the following parameters:
MinUSDAmount: The minimum user deposit amount per parlay that can be accepted
MaxSupportedAmount: The maximum payout amount per parlay
MaxSupportedOdds: The maximum total quote per parlay
MaxAllowedRiskPerCombination: The maximum allowed risk for the same set/combination of games in a parlay
ParlaySize: The maximum number of games that can be included in a parlay
ParlayAMMFee: A parlay fee for each parlay
SafeBoxFee: A fee to add to the SafeBox for each parlay
ReferrerFee: A referral fee for each parlay