vAMM (Virtual AMM)

Overview

The Virtual Automated Market Maker (vAMM) system is the core of Black Market's exchange. vAMM facilitates exchange between sSPL and VALOR tokens to ensure price stability and adequate liquidity.

The below models can be updated due to the balance update

Key Definitions and Variables

  • Volatility Parameter: Parameter to control volatility. Calculated with C and k value

  • k: Constant to give minimum stability to the system

  • SS: Total supply of specific sSPL tokens.

  • SoldS_{old}: Total supply of specific sSPL tokens before the calculation.

  • SnewS_{new}: Total supply of specific sSPL tokens after the calculation.

  • ΔS\Delta S: represents the trade-induced change in supply.

  • PintP_{int}: Price of the sSPL when initialized.

  • PoldP_{old}: Price of the sSPL before calculation.

  • PnewP_{new}: Price of the sSPL after calculation.

  • PavgP_{avg}: The price of the sSPL applies to a specific trade.

Models

The vAMM model dynamically adjusts the token price to provide appropriate stability and volatility while ensuring symmetry in trading.

Symmetric Model

vAMM calculates the price after the trade using the symmetric model.

  • Calculation based on sSPL amount

Pnew=Pold×(1+ΔSk+Sold)P_{new} = P_{old} \times (1 + \frac{\Delta S}{k + S_{old}} )

  • Calculate based on VALOR budget

ΔS=BPold+Pnew2=2BPold+Pnew\Delta S = \frac{B}{\frac{P_{old} + P_{new}}{2}} = \frac{2B}{P_{old} + P_{new}}

Pnew=Pold2+2BPoldk+Sold\therefore P_{new} = \sqrt{P_{old}^2 + \frac{2B \cdot P_{old}}{k + S_{old}}}

Average Price Model

vAMM swap transaction works based on the average price before the trade and the adjusted price after the trade.

Pavg=Pold+Pnew2P_{avg} = \frac{P_{old} + P_{new}}{2}

Price Adjustment Due to External Changes

If the supply of sSPL tokens changes outside of vAMM trades, the system adjusts the price using the following equation:

Pnew={Pint+(PoldPint)(2k+Sold)2k+SnewifPold>PintPint(PintPold)(2k+Sold)2k+SnewifPoldPintP_{\text{new}} = \begin{cases} P_{\text{int}} + \frac{(P_{\text{old}} - P_{\text{int}})(2k + S_{\text{old}})}{2k + S_{\text{new}}} & \text{if} \,\, P_{\text{old}} > P_{\text{int}} \\ P_{\text{int}} - \frac{(P_{\text{int}} - P_{\text{old}})(2k + S_{\text{old}})}{2k + S_{\text{new}}} & \text{if} \,\, P_{\text{old}} \le P_{\text{int}} \end{cases}

k=100000/Pintk = 100000 / P_{int}

Initial price

Token
Initial Price ($VALOR)

Voodoo Doll ($VD)

0.46118

Gold Teeth ($GT)

0.72776

JB Whiskey ($JBW)

0.94118

Canteen ($CT)

1.07882

G Badge ($GB)

1.55294

Holy Water ($HW)

2.32353

Used Engine ($UE)

3.41176

Enhanced Bullet ($EB)

3.43529

Oil Lighter Case ($OLC)

6.82353

Oil ($OIL)

0.00750

MRE ($MRE)

0.00750

Examples

  1. Swap:

    1. Buy: Paying VALOR to buy 1 sSPL

      • Stability constant k=10k = 10 sSPL (after buying)

      • Current supply Sold=0S_{old} = 0 sSPL

      • New supply Snew=1S_{new} = 1 sSPL

      • Current price Pold=10P_{old} = 10 VALOR

      • New price Pnew=10×(1+110+0)=11P_{new} = 10 \times (1 + \frac{1}{10 + 0} ) = 11 VALOR

      • Average price Pavg=10+112=10.5P_{avg} = \frac{10 + 11}{2} = 10.5 VALOR

      • Fee: 10.50.0005=0.052510.5 * 0.0005 = 0.0525 VALOR

      • Result: Paying 10.5525 VALOR to buy 1 sSPL

    2. Sell Transaction: Selling 1 sSPL to get VALOR

      • Stability constant k=10k = 10 sSPL (after buying)

      • Current supply Sold=1S_{old} = 1 sSPL (after buying)

      • New supply Snew=0S_{new} = 0 sSPL

      • Current price Pold=11P_{old} = 11 VALOR (after buying)

      • New price Pnew=11×(1110+1)=10P_{new} = 11 \times ( 1 - \frac{1}{10 + 1} ) = 10 VALOR

      • Average price Pavg=11+102=10.5P_{avg} = \frac{11 + 10}{2} = 10.5 VALOR

      • Fee: 10.50.0005=0.052510.5 * 0.0005 = 0.0525 VALOR

      • Result: Receiving 10.5525 VALOR for selling 1 sSPL

  2. Price Adjustment:

    1. On Mint:

      • Stability constant k=10k = 10 sSPL (after buying)

        • Current supply Sold=1S_{old} = 1 sSPL

        • Supply after mint Snew=5S_{new} = 5 sSPL

        • Initial price Pint=10P_{int} = 10 VALOR

        • Current price Pold=11P_{old} = 11 VALOR

        • Adjusted price Pnew=1110(1+2×10)5+2×10+10=10.84P_{new} = \frac{|11 - 10|(1 + 2 \times 10)}{5 + 2 \times 10} + 10 = 10.84 VALOR

    2. On Burn:

      • Stability constant k=10k = 10 sSPL (after buying)

        • Existing supply Sold=5S_{old} = 5 sSPL

        • Supply after burn Snew=1S_{new} = 1 sSPL

        • Initial price Pint=10P_{int} = 10 VALOR

        • Current price Pold=10.84P_{old} = 10.84 VALOR

        • Adjusted price Pnew=10.8410(5+2×10)1+2×10+10=11P_{new} = \frac{|10.84 - 10|(5 + 2 \times 10)}{1 + 2 \times 10} + 10 = 11 VALOR

Last updated