Skip to content

Latest commit

 

History

History
70 lines (41 loc) · 4.46 KB

TIP-149.md

File metadata and controls

70 lines (41 loc) · 4.46 KB
id Title Status Author Description Discussions to Created
TIP-149 Speed binaries AMM Draft Danijel description https://discord.gg/thales 2023-06-26

Simple Summary

This TIP proposes to add a new product under Thales markets which would allow users to choose an UP or DOWN positition for markets maturing in less than 24h.

Motivation

Users have often expressed desire to trade on markets with shorter maturities. Thales AMM does not support trading in the last 24h until maturity as the leverage in such cases poses an attack surface and risk for the liquidity providers.
This product aims to allow users to take positions on short timeframes on the next price movement of the asset, and as such it is also an iteration on the Thales Royale product, but in this case the user is positioning against an AMM.

Specification

The product is made feasible by using Pyth offchain and on-demand benchmark oracles which can deliver the price of an asset at any historical time https://docs.pyth.network/benchmarks.

The product with have an AMM contract provisionally named SpeedMarketsAMM. The AMM will have a list of variables that control which markets can be created and maintains a list of all active markets.

The user can choose whether the price of a given supported asset, e.g. ETH will be more or less at the strike date, which again the user can choose. The supported strike dates will be from 1h to 24h from the current time.
In other words, if the price is for example $1900 at the moment, and the user choose an UP market maturing in 1h, his market is basically "ETH will be more than $1900 in 1h".

When submitting the transaction, the user passes the buy-in amount. The payout if the user positioned correctly will be 2x of the buy in amount. On top of the buy-in amount, the user pays an LP fee and the SafeBox fee (provisionally set to 4$ and 1% respectively).

The market is resolved using Pyth off-chain historical price which is validated using Pyth contract on-chain. This ensures that markets resolve exactly with the price at the correct time, and removes frontrunning risk surface. Once the market is resolved, the funds are sent either to the user if he positioned correctly or back to the AMM.

Pyth calldata is rather large so the transaction costs are more expensive then the norm on L2s (as L2 transaction pricing is mostly a factor of calldata size). To alleviate this until EIP-4844 is implemented, there will be an admin method that can only resolve markets where the AMM has won.

To start conservatively, we would only support markets at least 1h from current timestamp, but ultimately want to get this down to 5 minutes.

This product assumes 50-50 odds at any given time for a market to move UP or DOWN from current price. It does not require any "admin" inputs such as implied volatility, and in doing so, its intended to run without any additional overhead.

There is no concept of skew impact. Each position is a dedicated market instance fully collaterized on-chain.

The SpeedMarketsAMM will be funded by treasury initially for POC phase and can move towards external LPing like others AMM once battle tested.

Once protocol DAO deems it ready, this product would be included in gamified staking bonus points system.

This product can be improved in a future iteration to allow users to link up several positions (like parlays on Overtime), and get leveraged payout, e.g. link up 5 correct positions on ETH movements in 1 hour candles for 32x winning.

For the MVP version, but that can be added without an additional TIP once the product is deemed ready for it.

The product can be released on any EVM chain that Thales protocol supports.

Test Cases

Example markets: "ETH DOWN from current price of $1900 in 1h" "BTC UP from current price of $30000 in 24h"

Variables

  • MINIMUM_TIME_TO_MATURITY: 1h (can be changed by pDAO ad hoc)
  • MAXIMUM_TIME_TO_MATURITY: 24h (can be changed by pDAO ad hoc)
  • SUPPORTED_ASSETS: ETH, BTC (pDAO can add new assets ad hoc per this TIP)
  • LPFee: 4%
  • SBFee: 1%
  • MIN_BUY_IN: $5 (can be changed by pDAO ad hoc)
  • MAX_BUY_IN: $100 (can be changed by pDAO ad hoc)
  • MAX_RISK_PER_ASSET: $5000 (can be changed by pDAO ad hoc)

Implementation

https://github.com/thales-markets/contracts/tree/main/contracts/SpeedMarkets

Copyright

Copyright and related rights waived via CC0.