How is the number of LPs obtained from creating a liquidity pool calculated?

Jack 0

After I created a liquidity pool on PandaTool, I received some LP tokens. Why doesn’t the number of LPs match the amount of tokens I added? How is it calculated?

Comments

1 comment Add comment
  • pandatool's avatar
    pandatool Reply

    When you are the first person to create a pool for a trading pair (e.g., ETH/USDC), the protocol needs to set an initial “anchor ratio.” At this point, the calculation rule for the number of LPs is very simple:

    The number of LPs you receive = the geometric mean of the amounts of the two assets you deposited

    The formula is:
    LP_Received = √(x * y)

    x: The amount of the first asset you deposited (e.g., 10 ETH).
    y: The amount of the second asset you deposited (e.g., 20,000 USDC).
    LP_Received: The number of LP tokens you will receive.

    Example:
    Suppose you are the first to add liquidity to the ETH/USDC pool, depositing x = 10 ETH and y = 20,000 USDC.
    Then, the number of LPs you receive = √(10 * 20,000) = √(200,000) ≈ 447.21 LP tokens.

    1 year ago No comments