For the complete documentation index, see llms.txt. This page is also available as Markdown.

Adding Liquidity

1. Initial Liquidity Provision (Setting the Price)

When you are the first person to provide liquidity for the BT/ITL pair, you define the initial exchange rate.

  • Variables: Let x be the amount of BT and y be the amount of ITL.

  • Price Discovery: The initial price of BT is determined by the ratio of your deposited

    PBT=ΔyinitΔxinitP_{BT} = \frac{\Delta y_{init}}{\Delta x_{init}}
  • LP Token Calculation: To prevent "inflation attacks" on small pools, the protocol burns the first 1,000 wei of LP tokens (Lmin):

    Linitial=ΔxinitΔyinitLminL_{initial} = \sqrt{\Delta x_{init} \cdot \Delta y_{init}} - L_{min}
Example: If you deposit 100BT(Δx) and 1ITL(Δy), the starting price is 0.01ITL/BT\textbf{Example: } \text{If you deposit } 100 \, BT \, (\Delta x) \text{ and } 1 \, ITL \, (\Delta y), \text{ the starting price is } 0.01 \, ITL/BT

2. Subsequent Liquidity (Maintaining the Ratio)

Once the pool is established, new liquidity providers must deposit tokens in the exact same ratio as the current reserves to avoid changing the market price during the deposit.

  • The Constraint:

    Δxx=Δyy\frac{\Delta x}{x} = \frac{\Delta y}{y}
  • LP Token Issuance: You receive LP tokens proportional to your share of the total reserves:

    Lminted=min(ΔxxLtotal,ΔyyLtotal)L_{minted} = \min \left( \frac{\Delta x}{x} \cdot L_{total}, \frac{\Delta y}{y} \cdot L_{total} \right)
Where x and y are the current reserves of BT and ITL, and Ltotal is the total supply of LP tokens.\text{Where } x \text{ and } y \text{ are the current reserves of BT and ITL, and } L_{total} \text{ is the total supply of LP tokens.}

3. The "K" Invariant (Constant Product)

Adding liquidity increases the depth of the pool by increasing the constant product k.

Pre-deposit:kold=xyPost-deposit:knew=(x+Δx)(y+Δy)Market Impact:knew>kold,the pool becomes more resilient to price swings,meaning future traders will experience less slippage.\begin{aligned} \textbf{Pre-deposit:} \quad & k_{old} = x \cdot y \\ \textbf{Post-deposit:} \quad & k_{new} = (x + \Delta x)(y + \Delta y) \\ \textbf{Market Impact:} \quad & k_{new} > k_{old}, \\ & \text{the pool becomes more resilient to price swings,} \\ & \text{meaning future traders will experience less slippage.} \end{aligned}

4. Mathematical Risk: Impermanent Loss (IL)

LPs face "Impermanent Loss" if the price of BT diverges from its price at the time of deposit. The loss relative to simply holding the tokens is:

IL=2r1+r1IL = \frac{2\sqrt{r}}{1 + r} - 1
where r=PnewPold is the price ratio\text{where } r = \frac{P_{new}}{P_{old}} \text{ is the price ratio}

Note: This loss is called impermanent because it disappears if the price returns to the original ratio. but it must be offset by the 0.3% trading fees to ensure profitavility.

5. Adding Liquidity with Native ITL

Since the core engine operates on two ERC-20 tokens, when providing native ITL, the Router contract automatically wraps it into WITL (Wrapped ITL).

  • Technical Logic: The contract calculates the required BT amount based on the ITL sent:

    Δx=Δyxy\Delta x = \frac{\Delta y \cdot x}{y}

The Router pulls the BT from your wallet, wraps your ITL into WITL, and transfers both to the Pair contract to mint your LP tokens.

PBT=ΔyinitΔxinitP_{BT} = \frac{\Delta y_{init}}{\Delta x_{init}}

Last updated