Skip to content

Latest commit

 

History

History
85 lines (50 loc) · 5.24 KB

TIP-139.md

File metadata and controls

85 lines (50 loc) · 5.24 KB
id Title Status Author Description Discussions to Created
TIP-139 Open up Thales AMM for liquidity providing Draft Cvija(@scvija) Allow anyone to deploy liquidity to the Thales AMM https://discord.gg/rPpPcMXSeU 2023-04-26

Abstract

Implement the architecture to allow liquidity providing into the Thales AMM.

Simple Summary

This TIP proposes to open up the Thales AMM for providing liquidity based on the amount of THALES a wallet has staked. Essentially the TIP proposes to apply the already implemented solution for liquidity providing for Overtime in TIP-99 to the Thales Markets.

This TIP includes the changes proposed for improvements to the UX of withdrawals in the TIP-136

Motivation

So far the liquidity of Thalesmarkets has been fully seeded from Thales DAO treasury. With Thalesmarkets running for more than a year and a half, deployed on multiple chains and generating more than $15,000,000 of volume, we feel it has good potential, especially with Vaults released on top which also serves to somewhat balance the AMM risks. The Thales AMM has proven itself during the course of time and tens of thousands of transactions that it can remain profitable for the side providing the liquidity, and we feel confident to open it up to the public, especially after the success of the Overtime LPs.

Liquidity providing will be gated to only THALES stakers with the amount one can deposit controled by variables based on the THALES staked amount (more details in specification section).

Besides the architecture of how LPing will work I am also proposing some changes in the fee structure as I believe its of utmost impoortance to ensure LPing is profitable when this is released.

Specification

Liquidity providing will be based much on the proven concept established through vaults. Much of the architecture is inheritted from TIP-70 and subsequnetly from the actual implementation for Overtime LPs. Liquidity providing is only enabled for THALES stakers with the amount of sUSD stakers can deposit controlled by a variable stakedThalesMultiplier

Liquidity providing will be done in weekly rounds with deposits allowed until a round starts. The round start times are chosen to fit well with the market creation / resolution. A notable difference to the Overtime LP is the users having the possibily to sell their position for loss or profit.

During round 0 users deposit funds into the AMM. Users always deposit for the next round.

Users that have deposited in a round, can choose to exit at the rounds end by signaling a withdrawal during the round and then withdrawing when all round PnL has been calculated.

A single market can only belong to 1 round, which is defined based on the maturity date of the market. When a round ends, the PnL from all markets in a round is summed up, and allocated correctly to all liquidity providers.

Any round after round 1 will have all of the deposits + profits from previous round plus any new deposits at round start.

If there isnt enough liquidity in a certain round, AMM liquidity pool borrows from a special address called defaultLiquidityProvider, and sets it as one of the depositors for that round. This can only be done if that round hasnt started yet (previous round did not finish). At the end of the round defaultLiquidityProvider always withdraws.

A user can only deposit 1 sUSD per X THALES he stakes. Just like with vaults, all user balance that goes into a round is counted towards gamified staking.

Fee structure

The current setup is as follows:

  • min_spread 1%
  • safe_box fee 2%

I am also proposing that pDAO can change the spread the RangedAMM pays to the ThalesAMM ad hoc, as we monitor the profit distribution between RangedAMM and ThalesAMM.

Examples

Users deposit $100k for round 1 and then the round is started Round 1 starts at 8th of November with $100k. If you provided $1000 your share is 1%.
Round 2 receives $20k of new deposits.
Round 1 ends with a total of 110k in the AMM. Your balance is now $1100 entering round 2.
Total in round 2 at the start is $130k. Your share is 1100*100/130000 = 0.84615%

During round 2 a trade is made on a market that belongs to round 3 for an amount of $100. The defaultLiquidityProvider seeds the $100 and thus becomes a depositor for round 3. Let's assume round 2 had 0 PnL so the whole $130k is carried over. The total deposited into round3 when it starts is $130.1k.

Variables

pDAO will conduct an iterative controlled release and slowly raise the maxAllowedDeposit variable as the need occurs and the product matures. minDepositAmount and maxAllowedUsers can also be changed by pDAO ad hoc.

stakedThalesMultiplier can only be changed via a TIP.

minDepositAmount = 50 sUSD
maxAllowedUsers = 100
maxAllowedDeposit = 200k
stakedThalesMultiplier = 5
roundLength = 7 days (cant be changed without moving liquidity to a new contract)

Implementation

Copyright

Copyright and related rights waived via CC0.