🌀PvP-AMM Protocol

📌 The development of LionDEX PvP-AMM protocol draws on part of the concept proposed by @GMX_IO. This idea was published in this article earlier: https://medium.com/@gmx.io/x4-protocol-controlled-exchange-c931cd9a1ae9

📌 Feasibility analysis and mathematical calculations are carried out by LionDEX. Although the economic models, product functions and characteristics between LionDEX and GMX are not the same, we would still like to thank @GMX_IO.

🔸 PVP-AMM v1.0

📌 A perpetual trading method based on DeFi-AMM innovation, where the price of the trading asset uses a composite index, and regardless of the type of asset being traded, the order is initiated and settled by LP. The margin LP¹ initiates the trade and enters the protocol treasury. Finally: ▪️ Orders that are closed with a profit are allowed to retrieve the LP¹ tokens to mint new LP tokens with the PnL value (profit and loss) as a replacement. ▪️ For orders that are closed with a loss, the LP¹ tokens representing the PnL will be burned, while the remaining LP¹ tokens will be retrieved.

📌 The benefits of PvP-AMM / Peer-to-Pool mechanism👇 ▪️ Instant initiation and settlement of orders in the spot pool without the need for counterparties or order books. ▪️ Quick execution with no trading spreads. ▪️ The allowance for a more flexible trading combination of assets based on the above two points, by utilizing only the support of index prices. ▪️ Margin is only tied to LP: there is no need for spot reserve of underlying assets during the trading process, eliminating borrowing costs. ▪️ Maximum capital utilization with minimal (or no) restriction on unilateral positions. ▪️ LPs with neutral stakings are only needed to provide a buffer for net PnL (only when net PnL is positive). ▪️ The LP value of neutral stakings can be increased when the net PnL is negative.

📌 The percentage of PnL of perpetual trading orders are calculated using the PvP-AMM protocol based only on the index price. LP profit or loss is calculated based on this percentage. For example: ▪️ A long position with 10x leverage is taken using 100 LP when the BTC price is at 10,000. ▪️ When the BTC price reaches 10,100 / 9,900, the profit and loss percentage for the order is +10% or -10%. ▪️ This transaction generates a profit or loss of ±10 LP, which is calculated as 100 LP * ±10%. ▪️ The entire transaction process does not take into account changes in LP prices.

📌 The PvP-AMM protocol allows for a large trading volume to be supported by a very small Protocol Treasury. In the case where long and short positions are equal and share the same cost, the margin (LP) of the losing party will be burned, whereas the LP representing profit of the winning party will minted. The sum of both parties' PnL is equal to zero. Even if the Protocol Treasury has no assets, steady redemption can still be achieved (theoretically).

📌 This is the first factor that determines the LP price: it is inversely proportional to the net PnL of global traders.

🔸 How does it work ?

📌 The PvP-AMM protocol uses index prices (derived from ChainLink and several other centralized exchanges) to calculate the profit and loss percentage of trade orders. The protocol then performs a fixed number of settlement based on this percentage. The most important factor in determining the final profit and loss in the PvP-AMM protocol is the long/short ratio. Here is a clear example:👇

📌 Let's assume that the LP:USDC ratio is 1:1. A places a long order with 100 LP at BTC price of $10,000, while B places a short order with 200 LP at the same BTC price, both with a 10x leverage. Therefore, the initial capital for both is 300 USDC. A holds a long position with 1,000 LP, while B holds a short position with 2,000 LP tokens. Here are four possible outcomes👇 ▪️ Price increases which led to A generating profits and B generating partial losses ▪️ The price increase resulted in profits for A, but B suffered a forced liquidation ▪️ The price decrease resulted in partial losses for A, but B generated profits. ▪️ The price decrease resulted in a forced liquidation for A, but B generated profits

1: If BTC price rises to $10,500

▪️ A's PnL: (10,500 - 10,000) / 10,000 * 1,000 = 50LP as Profits ▪️ B's PnL: (10,500 - 10,000) / 10,000 * 2,000 = 100LP as Losses

📌 At this point, the protocol will execute the below: ▪️ Burn B's Losses LP (-100) ▪️ Mint A's Profits LP (+50)

📌 The present LP price: 300 USDC / (300 LP - 100 LP + 50 LP) = 1.2 USDC ▪️ Value in A's account: (100 + 50) * 1.2 = 180 USDC ▪️ Value in B's account: (200 - 100) * 1.2 = 120 USDC

2: If BTC price rises to $11,000

▪️ A's PnL: (11,000 - 10,000) / 10,000 * 1,000 = 100LP as Profits ▪️ B's PnL: (11,000 - 10,000) / 10,000 * 2,000 = 200LP as Losses

📌 At this point, the protocol will execute the below: ▪️ Burn B's Losses LP (-200) ▪️ Mint A's Profits LP (+100)

📌 The present LP price: 300 USDC / (300 LP - 200 LP + 100 LP) = 1.5 USDC ▪️ Value in A's account: (100 + 100) * 1.5 = 300 USDC ▪️ Value in B's account: (200 - 200) * 1.5 = 0 USDC

3: If BTC price drops to $9,500

▪️ A's PnL: (10,000 - 9,500) / 10,000 * 1,000 = 50LP as Losses ▪️ B's PnL: (10,000 - 9,500) / 10,000 * 2,000 = 100LP as Profits

📌 At this point, the protocol will execute the below: ▪️ Burn A's Loses LP (-50) ▪️ Mint B's Profits LP (+100)

📌 The present LP price: 300 USDC / (300 LP - 50 LP + 100 LP) = 0.86 USDC ▪️ Value in A's account: (100 - 50) * 0.86 = 43 USDC ▪️ Value in B's account: (200 + 100) * 0.86 = 258 USDC

4: If BTC price drops to $9,000

▪️ A's PnL: (10,000 - 9,000) / 10,000 * 1,000 = 100LP as Losses ▪️ B's PnL: (10,000 - 9,000) / 10,000 * 2,000 = 200LP as Profits

📌 At this point, the protocol will execute the below: ▪️ Burn A's Losses LP (-100) ▪️ Mint B's Profits LP (+200)

📌 The present LP price: 300 USDC / (300 LP - 100 LP + 200 LP) = 0.75 USDC ▪ Value in A's account: (100 - 100) * 0.75 = 0 USDC ▪️ Value in B's account: (200 + 200) * 0.75 = 300 USDC

📌 This example can easily illustrate the four characteristics of the PvP-AMM protocol. Compared to conventional trading protocols, when the long-short ratio is imbalanced in the PvP-AMM protocol: ▪️ When the price moves towards the minority side, the minority side makes more profits while the majority side suffers less losses. (①) ▪️ When the price moves significantly towards the minority side, the minority side makes more profits while the majority side does not suffer additional losses. (②) ▪️ When the price moves towards the majority side, the majority side's profits decrease while the minority side's losses increase (③) ▪️ When the price moves significantly towards the majority side, the majority side's profits decrease while the minority side's losses do not increase (④)

📌 In this example, the important factor that affects the gains and losses of both sides is their net PnL (positive or negative 100 based on the original value of 300). If the net PnL is negative, it is a favorable outcome for all traders (both gainers and losers).

📌 Case ④ is the worst scenario, but by adding neutral LP depositors, the protocol can minimize this impact. When GMX.IO’s GLP Pool size is $500,000,000, the daily net PnL is usually less than $1,000,000, accounting for 0.2% of the pool; GainsNetwork’s data are $50,000,000 and $20,000, respectively, accounting for 0.04%.

📌 In the ④ scenario of the example, the net PnL for both parties is +100 LP. If we introduce the data ratio of 0.2% from GMX.IO into this result, we can calculate the fees that each party must pay as follows: ▪️ 100/0.2%+300USDC /(100/0.2%+300LP-100LP+200LP)= 0.998 USDC ▪️ Account value of A: (100-100)*0.998=0 USDC ▪️ Account value of B: (200+200)*0.998=399.2 USDC

📌 This result shows that when the size of the neutral staking pool far exceeds the net PnL, the results of partial transactions have extremely limited impact on the overall LP price. Even if the net PnL in the example is enlarged by 10 times, the final LP price remains at 0.98USDC.

🔸 Characteristic of PvP-AMM protocol: Automatic balancing of long and short ratios

📌 The PvP-AMM protocol provides a combination arbitrage opportunity for API and SmartMoney, and realizes the automatic balance of the long-short ratio by attracting new minority orders. In the previous example of A and B, the long-short ratio is set to 1:2. For the long A with a small number of parties, there are two friendly expected profit results ① and ②, and a constant complete loss result ④ , and an unfriendly loss result③.

📌 At this time, C joins the camp of a small number of parties A (long) in the PvP-AMM protocol, and at the same time sells short on Binance or other CEXs of the same scale. Once it appears: ▪️ As a result of ① and ②, C’s profit from PvP-AMM long orders will be greater than the loss of Binance’s short orders ▪️Result ④, C's profit through Binance short orders is completely equal to the loss in the PvP-AMM protocol. ▪️ Result ③, the profit of C through Binance short order cannot cover the loss in the PvP-AMM protocol.

📌 Outcome ③ can eventually be changed to outcomes ①, ②, or ④ by waiting for the market to shift, and this mechanism provides a very safe arbitrage opportunity. In conventional trading platforms, APIs, bots, and SmartMoney are often aggressive towards ordinary traders; in the PvP-AMM protocol, they are completely harmless and always protect the balance of the long-short ratio of the protocol.

🔸 LP Composite Vault

📌 When users mint LP with USDC/BTC/ETH for trading or neutral staking, the original assets that are provided will be deposited in the Protocol Treasury, where 100% will be automatically converted into GMX.IO-GLP to earn ETH through the smart contract, allowing users to continuously receive ETH income provided by GMX.IO.

📌 The Composite vault, as a neutral staker of LionDEX-LP earns both ETH rewards provided by GLP and transaction fee income provided by LionDEX. Furthermore, the composite vault also allows any positions held within it to receive an additional share of ETH income provided by GLP. For more details, please refer to Earn.

📌 This is the second factor that determines the price of LP: ▪️ (GLP) price change with respect to USDC. ▪️ The potential correlation of GMX.IO - GLP treasury with the cryptocurrency market (Only BTC/ETH is used, as the price of USDC usually does not experience drastic fluctuations.).

Last updated