Liquidity Provider Fundamentals: Formulas Summary (Part 10)

You are currently viewing Liquidity Provider Fundamentals: Formulas Summary (Part 10)

This guide summarizes key formulas for managing eGHST-DAI liquidity positions in ghostDAO. All equations account for dynamic fee (DF) parameters and are categorized for easy reference.

LP Position Valuation

Total LP Position

\displaystyle \text{Value}(LP)_{\text{total}} = 2 \times Q_D(\text{DAI})

ghostDAO Treasury LP Position

\displaystyle \text{Value}(LP)_{\text{treasury}} = \text{Value}(LP)_{\text{total}} \times \frac{Q_T(LP)}{\text{Total}(LP)}

Optimal Contribution Weights

Exact Calculation (With Swap)

\displaystyle Q(\text{DAI})_{\text{swap}} = \frac{-Q_D(\text{DAI}) \times (2-DF) + \sqrt{\big(Q_D(\text{DAI}) \times (2-DF)\big)^2 + 4 \times Q(\text{DAI})}}{2 \times (1-DF)}

\displaystyle Q(\text{eGHST})_{\text{swap}} = \frac{Q(\text{DAI})_{\text{swap}} \times (1-DF) \times Q_D(\text{eGHST})}{Q_D(\text{DAI}) + (1-DF) \times Q(\text{DAI})_{\text{swap}}}

\displaystyle Q(\text{DAI})_{\text{no swap}} = Q(\text{DAI}) - Q(\text{DAI})_{\text{swap}}

Approximation

\displaystyle Q(\text{DAI})_{\text{swap,approx}} \approx Q(\text{DAI}) \times \frac{1}{2-DF}

\displaystyle Q(\text{eGHST})_{\text{swap,approx}} \approx \frac{Q(\text{DAI})_{\text{swap,approx}} \times (1-DF) \times Q_D(\text{eGHST})}{Q_D(\text{DAI}) + (1-DF) \times Q(\text{DAI})_{\text{swap,approx}}}

\displaystyle Q(\text{DAI})_{\text{no swap,approx}} \approx Q(\text{DAI}) - Q(\text{DAI})_{\text{swap,approx}}

Price Impact Analysis

Exact Price Impact

\displaystyle \frac{P(\text{eGHST})_{\text{after contribution}}}{P(\text{eGHST})_{\text{before contribution}}} - 1 = \frac{Q(\text{DAI})}{Q_D(\text{DAI})}

Approximate Price Impact

\displaystyle \frac{P(\text{eGHST})_{\text{after contribution}}}{P(\text{eGHST})_{\text{before contribution}}} - 1 \approx \left(\frac{Q(\text{DAI})}{Q_D(\text{DAI})}\right)^2 \times \frac{1-DF}{(2-DF)^2} + \frac{Q(\text{DAI})}{Q_D(\text{DAI})}

Constant Product (k)

\displaystyle k_{\text{init}} = Q_D(\text{DAI}) \times Q_D(\text{eGHST})

\displaystyle k_{\text{after adding liquidity}} = \big(Q_D(\text{DAI}) + Q(\text{DAI})\big) \times \big(Q_D(\text{eGHST}) + Q(\text{eGHST})\big)

\displaystyle k_{\text{after removing liquidity}} = \big(Q_D(\text{DAI}) - Q(\text{DAI})\big) \times \big(Q_D(\text{eGHST}) - Q(\text{eGHST})\big)

\displaystyle k_{\text{after swap}} = \big(Q_D(\text{DAI}) + Q(\text{DAI})\big) \times \left(Q_D(\text{eGHST}) - \frac{(1-DF) \times Q(\text{DAI}) \times Q_D(\text{eGHST})}{Q_D(\text{DAI}) + (1-DF) \times Q(\text{DAI})}\right)

Impermanent Loss (IL)

Relative IL

\displaystyle \text{IL}(\% \text{ of Value(LP)}_{\text{HODL}}) = \sqrt{\frac{k_{\text{after swap}}}{k_{\text{init}}}} \times \frac{2\sqrt{d}}{d + 1} - 1

Where:

\displaystyle d = \frac{P(\text{eGHST})_{\text{after swap}}}{P(\text{eGHST})_{\text{init}}}

Absolute IL Value

\displaystyle IL = \left(\sqrt{\frac{k_{\text{after swap}}}{k_{\text{init}}}} \times \frac{2\sqrt{d}}{d+1} - 1\right) \times Value(LP)_{HODL}

Where:

\displaystyle Value(LP)_{HODL} = Q_D(\text{DAI}) + Q_D(\text{eGHST}) \times P(\text{eGHST})_{\text{after swap}}

DEX Fees 

Relative DEX Fees

\displaystyle \text{DEX Fees}_{\text{Total}} (\% \text{ of Value(LP)}_{\text{after swap}}) = 1 - \sqrt{\frac{k_{\text{init}}}{k_{\text{after swap}}}}

Absolute DEX Fees

\displaystyle \text{DEX Fees}_{\text{Total}} = 2 \times Q(\text{DAI})_{\text{after swap}} \times \left(1 - \sqrt{\frac{k_{\text{init}}}{k_{\text{after swap}}}}\right)

What is ghostDAO?

ghostDAO is the future of interoperability and governance in web3 by allowing anyone to transfer assets from one chain to another all while being chain and DApp agnostic.

ghostAirdrop | ghostAirdrop Bot | Litepaper | Medium | Telegram | Twitter | Website