šŸ“ˆBBOX AMM

Virtual CLMM

BBOX uses the Concentrated Liquidity Market Maker (CLMM) as the underlying price discovery mechanism. Any pool state in BBOX at a particular time can be modeled as an aggregate of individual Liquidity Provider (LP) positions, each characterized by the coordinate system(p,L,pa,pb)(p,L, p_a, p_b), where:

  • pp is the mark price.

  • LLis the liquidity parameter computed over the Constant Function Market Maker (CFMM) Curve, determined at the time of the LP position creation.

  • pa,pbp_a, p_b are the respective lower bound and upper bound for the designated liquidity position to be actively provided.

At any pool state, one can also compute the real balance of the virtual token (Perp contract) and the numeraire asset via the following re-parameterization:

Liquidity Provision RangeBalance of Virtual Token XBalance of the Numeraire

pā‰¤pap \leq p_a

Lpaāˆ’Lpb\frac{L}{\sqrt{p_a}} - \frac{L}{\sqrt{p_b}}

00

pāˆˆ[pa,pb]p \in [p_a, p_b]

Lpaāˆ’Lpb\frac{L}{\sqrt{p_a}} - \frac{L}{\sqrt{p_b}}

Lpāˆ’LpaL\sqrt{p} - L\sqrt{p_a}

pā‰„pbp \geq p_b

00

Lpbāˆ’LpaL\sqrt{p_b} - L \sqrt{p_a}

Example: LP Alice Supplies (Leveraged) Liquidity in the Market

Suppose that Alice, a market maker, wants to provide leveraged liquidity. Alice will need to determine:

  • The price range [pa,pb][p_a, p_b] in which she wants to concentrate her liquidity.

  • The amount of liquidity LL sheā€™s willing to provide, determined via the re-parameterization rule specified in the table above.

Then Alice is faced with the following three scenarios when trying to provide liquidity:

  1. Place a range order above the current tick price p,i.e.pā‰¤pap, i.e. p \leq p_a , and Alice is willing to sell the asset.

  2. Place a range order around the current tick price p,i.e.pāˆˆ[pa,pb]p, i.e. p \in [p_a, p_b] , and Alice is willing to buy and sell the asset.

  3. Place a range order below the current tick price p,i.e.pā‰„pbp, i.e. p \geq p_b , and Alice is willing to buy the asset.

In cases 1 and 2, Alice will receive the (leveraged) token assets as a loan. These tokens must be paid back when the liquidity position is closed. If the asset price appreciates, the amount of USDC needed to cover the loan also increases, potentially triggering liquidation.

Scenario 1: pā‰¤pap \leq p_a

Suppose that Alice wants to provide 1000 USDC with 2x leverage. Alice will first interact with the Trade Engine, which the engine will:

  1. Places the 1000 USDC collateral into the vault

  2. Mints and loans 1.09 V-ETH and put the loan as Aliceā€™s cost basis

  3. Puts the 1.09 V-ETH in the pre-designated LP range [pa,pb][p_a, p_b], where the liquidity parameter LL gets calculated via 1.09=L(1paāˆ’1pb)āŸŗL=1.09(1paāˆ’1pb)1.09 = L(\frac{1}{\sqrt{p_a}} - \frac{1}{\sqrt{p_b}}) \Longleftrightarrow L = \frac{1.09}{ (\frac{1}{\sqrt{p_a}} - \frac{1}{\sqrt{p_b}}) }

Scenario 2: pāˆˆ[pa,pb]p \in [p_a, p_b]

Similarly, if Alice wants to provide 1000 USDC with 2x leverage around the mark price. The Trade Engine will make the following modifications:

  1. Places the 1000 USDC collateral into the vault

  2. Alice decides to supply 1000 V-USDC, then the vault will compute the amount of V-ETH that needs to be loaned from L=1000pāˆ’paL = \frac{1000}{\sqrt{p} - \sqrt{p_a}}, and the amount of V-ETH to be deployed is equal to L(1pāˆ’1pb)L(\frac{1}{\sqrt{p}} - \frac{1}{\sqrt{p_b}}). Alice can also mark the desired liquidity position by adjusting the leverage.

  3. Puts liquidity into the pre-designated range [pa,pb][p_a, p_b] and records the liquidity parameter LL.

Scenario 3: pā‰„pbp \geq p_b

Last, if Alice wants to provide 1000 USDC with 2x leverage this time in a range below the mark price. The Trade Engine will conduct the following:

  1. Place the 1000 USDC collateral into the vault

  2. Mints 2000 V-USDC and records it as the position cost in Aliceā€™s PnL account

  3. Puts the 2000 V-USDC in the pre-designated LP range [pa,pb][p_a, p_b], where the liquidity parameter LL gets calculated via L=2000(pbāˆ’pa)L = \frac{2000}{(\sqrt{p_b} - \sqrt{p_a})}.

Last updated