Allan Niemerg
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
1
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# YieldSpace with Yield Bearing Vaults In the original [YieldSpace Paper](https://yieldprotocol.com/YieldSpace.pdf), Yield introduced a new automated market maker for trading between a base asset and "fixed yield" tokens, or "fyTokens", of that base asset. FyTokens are ERC-20 tokens that represent future payment of the base asset after a specfied time. After maturity, a user may redeem a fyToken by burning it to receive the base asset one-for-one. YieldSpace markets must maintain reserves of fyTokens and the base asset as inventory for future trades. However, while held as reserves, the base asset earns no returns. To increase the returns for LPs, we can place all base assets into Yield Bearing Vaults that earn interest and can be withdrawn at any time. Yield Bearing Vaults are ERC-20 tokens representing a desposit of an underlying asset into a protocol that pays interest on that asset over time. Some examples are Yearn Vault tokens (like yvUSDC) or Compound cTokens. Yield Bearing Vaults capitalize interest increasing a conversion rate between the ERC-20 vault and the base asset over time. Yield Bearing Vaults are further described in ERC-4626, an effort to standardize such vaults (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4626.md). The goal of this document is to describe the basic derivation of a YieldSpace market using Yield Bearing Vaults. ## Base Model The original YieldSpace sought to create a market to trade between a base asset $X$ and a fyToken asset $Y$ where the interest rate is the ratio of the fyToken reserves $y$ to the base asset reserves $x$: $$ \tag{1} 1 + r = \frac{y}{x} $$ We want to create a new version of the YieldSpace market the base asset is replaced with a token that represents a yield bearing vault that is earning interest. Yield Bearing vault tokens are sometimes referred to as "shares", and we will represent them here as $Z$, and an amount of share reserves as $z$. $X$ and $Z$ reserves can be related simply as $x = cz$ where $c$ is a conversion rate that grows with compounded interest. $$ x = cz $$ A key insight of the YieldSpace CFMM is to maintain the same marginal interest rate over time while no trades occur and reserves do not change. We can start with the equation in $(1)$ and substitute shares in place of the base assets: $$ 1 + r = \frac{y}{z} $$ This equation will now maintain the same marginal interest rate absent any trades, but it's unclear what that rate will be. For any particular base value, $z$ can have any arbitrary value. To give the interest rate a reasonable relationship with the base value of the shares, we can modify the equation by adding a constant normalizing constant $\mu$: $$ 1 + r = \frac{y}{\mu \cdot z} $$ Because the conversion rate $c$ between $x$ and $z$ varies relatively slowly over time, the normalizing factor can be held constant for the life of the market. A simple choice for $\mu$ is the initial value of the conversion factor at market initialization. ### Derivation We can now derive our market with respect to the base asset. $$ 1 + r = \frac{y}{\mu \cdot z} = \frac{c \cdot y}{\mu \cdot x} $$ Assuming that $y$ is a function of $x$: $$ y = f(x) $$ Then current price of asset $Y$ in terms of asset $X$ offered by the protocol could be found as: $$ p = \frac{-1}{f'(x)} $$ If we consider asset $Y$ as zero-coupon bonds denominated in asset $X$, then the effective interest rate $r$ for a given $p$ for these bonds would be: $$ r = \left(\frac{1}{p}\right)^\frac{1}{t} - 1 $$ Thus the relationship between, $p$ and the interest $r$, becomes: $$ r = \left(\frac{1}{p}\right)^\frac{1}{t} -1 = \left(\frac{1}{\frac{-1}{f'(x)}}\right)^\frac{1}{t} - 1 $$ and plugging into the invariant we get the following equation: $$ 1 + r = \frac{y}{z} = \frac{c \cdot f(x)}{\mu \cdot x} \\ 1 + \left(\frac{1}{\frac{-1}{f'(x)}}\right)^\frac{1}{t} - 1 = \frac{c \cdot f(x)}{\mu \cdot x}\\ -f'(x) = \left(\frac{c \cdot f(x)}{\mu \cdot x}\right)^t $$ And the solution is: $$ f(x) = (C - c^t \cdot \mu^{-t} \cdot x^{1 - t})^\frac{1}{1 - t}\\ $$ Thus, the CFMM invariant looks like this: $$ c^t \cdot \mu^{-t} \cdot x^{1 - t} + y^{1 - t} = C $$ or $$ c^t \cdot \mu^{-t} \cdot (cz)^{1 - t} + y^{1 - t} = C\\ c \cdot \mu^{-t} \cdot z^{1 - t} + y^{1 - t} = C \\ \frac{c}{\mu} \cdot \mu^{1-t} \cdot z^{1 - t} + y^{1 - t} = C \\ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = C $$ ## Swap Formulas We can use the CFMM invariant to determine the amount of fyDai or vyDai received for a given input of vyDai or fyDai, and to determine the needed input of fyDai or vyDai for a desired amount of vyDai or fyDai out. For example, we can calculate the fyDai needed to get a desired amount of vyDai out: $$ \frac{c}{\mu} \cdot (\mu z - \mu \Delta z)^{1 - t} + (y + \Delta y)^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} \\ (y + \Delta y)^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} - \frac{c}{\mu} \cdot (\mu z - \mu \Delta z)^{1 - t} \\ y + \Delta y = \left( \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} - \frac{c}{\mu} \cdot (\mu z - \mu \Delta z)^{1 - t}\right)^\frac{1}{1 - t}\\ $$ Therefore, we have: $$ \Delta y = \left(\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} - \frac{c}{\mu} \cdot (\mu z - \mu \Delta z)^{1 - t}\right)^\frac{1}{1 - t} - y $$ We can likewise derive functions for other desired types of trades: ### fyTokenInForSharesOut $$ \Delta y = \left(\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} - \frac{c}{\mu} \cdot (\mu z - \mu \Delta z)^{1 - t}\right)^\frac{1}{1 - t} - y $$ ### fyTokenOutForSharesIn $$ \Delta y = y - \left(\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} - \frac{c}{\mu} \cdot (\mu z + \mu \Delta z)^{1 - t}\right)^\frac{1}{1 - t}\\ $$ ### sharesInForFYTokenOut $$ \Delta z = \frac{1}{\mu}\left(\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} - (y - \Delta y)^{1 - t}}{\frac{c}{\mu} }\right)^\frac{1}{1-t} - z $$ ### sharesOutForFYTokenIn $$ \Delta z = z- \frac{1}{\mu}\left(\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} - (y + \Delta y)^{1 - t}}{\frac{c}{\mu}}\right)^\frac{1}{1-t} $$ ## Trading Limit Formulas ### MaxfyTokenIn MaxfyTokenIn is the amount of fyTokens that may be sold to the pool to buy all of the shares currently in the pool. $$ \Delta y = \left(\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t}\right)^\frac{1}{1 - t} - y $$ ### MaxfyTokenOut We would like to calculate the maximum amount of fyTokens that can be purchased from the pool. Selling all the fyTokens in the pool is equivalent to selling to a 0% rate in the pool, thus, we have the property that after the trade $y_2$ = $\mu \cdot z_2$: $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = c \cdot \mu^{-t} \cdot z_2^{1 - t} + y_2^{1 - t} $$ $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = c \cdot \mu^{-t} \cdot (\frac{y_2}{\mu})^{1 - t} + y_2^{1 - t} $$ $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = y_2^{1 - t} \cdot (\frac{c}{\mu} + 1) $$ $$ \frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)} = y_2^{1 - t} $$ $$ y_2 = (\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)})^\frac{1}{1 - t} $$ Now that we have $y_2$, we can use this relationship: $$ y_2 = y - \Delta y \\ \Delta y = y_2 - y $$ $$ \Delta y = y - (\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)})^\frac{1}{1 - t} $$ We should be able to put the above equation into "sharesInForFYTokenOut" and get a reasonable value. ### MaxSharesIn We would like to calculate the maximum amount of shares that can be sold to the pool (bringing the pool to a 0% interest rate). As above, after the trade we have the property $y_2 = \mu * z_2$. $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = c \cdot \mu^{-t} \cdot z_2^{1 - t} + y_2^{1 - t} $$ $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + (\mu \cdot z_2)^{1 - t} $$ $$ \frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} = (\mu \cdot z_2)^{1 - t} \cdot (\frac{c}{\mu} + 1) $$ $$ (\mu \cdot z_2)^{1 - t} = \frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} }{(\frac{c}{\mu} + 1)} $$ $$ z_2 = \frac{1}{\mu} \cdot(\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} }{(\frac{c}{\mu} + 1)})^{\frac{1}{1-t}} $$ Now that we have $z_2$, we can use this relationship to find the maximum shares in ($\Delta z$): $$ z_2 = \Delta z + z $$ $$ \Delta z = z_2 - z $$ $$ \Delta z = \frac{1}{\mu} \cdot(\frac{\frac{c}{\mu} \cdot (\mu z)^{1 - t} + y^{1 - t} }{(\frac{c}{\mu} + 1)})^{\frac{1}{1-t}} - z $$ ### MaxSharesOut MaxSharesOut is the maximum amount of shares that can be purchased from the pool. Since the amount of shares that can be purchased is not bounded, MaxSharesOut is equivalent to the toal amount of shares in the pool. ## Trade to Interest Rate Users may wish to make a trade that leaves the AMM pool at a particular interest rate after the trade, $r'$. We can derive an equation giving us that value. We can start with the trade invariant, where $z_2$ and $y_2$ represent the reserves at the new rate 'r': $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + y_2^{1 - t} $$ Let us factor out the $\mu \cdot z_2$ term on the right $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = (\mu \cdot z_2)^{1 - t} \cdot (\frac{c}{\mu} \cdot + \frac{y_2^{1 - t}}{(\mu \cdot z_2)^{1 - t}}) $$ $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = (\mu \cdot z_2)^{1 - t} \cdot (\frac{c}{\mu} + (\frac{y_2}{\mu \cdot z_2})^{1 - t}) $$ Recall that the marginal interest rate is defined by: $$ 1 + r' = \frac{y}{\mu \cdot z} $$ Thus $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = (\mu \cdot z_2)^{1 - t} \cdot (\frac{c}{\mu} + (1 + r')^{1 - t}) $$ $$ (\mu \cdot z_2)^{1 - t} = \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + (1 + r')^{1 - t})} $$ $$ z_2 = \frac{1}{\mu} \cdot (\frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + (1 + r')^{1 - t})})^\frac{1}{1-t} $$ Now since $z_2 = z + \Delta z$: $$ \Delta z = \frac{1}{\mu} \cdot (\frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + (1 + r')^{1 - t})})^\frac{1}{1-t} - z $$ Similarly, we can calculate the change in fyTokens to achieve a particular rate. Starting with the same equation $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + y_2^{1 - t} $$ and factoring out the $y_2$ term: $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = y_2^{1 - t} \cdot (\frac{c}{\mu} \cdot \frac{(\mu \cdot z_2)^{1 - t}}{y_2^{1 - t}} + 1) $$ $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = y_2^{1 - t} \cdot (\frac{c}{\mu} \cdot (\frac{1}{1 + r'})^{1 - t} + 1) $$ $$ y_2 = (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} \cdot (\frac{1}{1 + r'})^{1 - t} + 1)})^\frac{1}{1-t} $$ Finally, $$ \Delta y = (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} \cdot (\frac{1}{1 + r'})^{1 - t} + 1)})^\frac{1}{1-t} -y $$ ## Invariant for Total Supply $$ \frac{ \frac{c}{\mu} \cdot (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)})^{\frac{1}{1 - \frac{t}{g}}}}{s} $$ ### Derivation We want a single formula that represents the value of a pool share so that we can verify that any operation on the pool only increases or keeps that value the same. This lets us be sure that actions on the pool cannot cause losses to LPs. The value of a single pool share is equivalent to the entire base value of the pool divided by the number of LP shares for the pool. We obtain the base value of the pool by performing a theoretical trade that sells all fyTokens for base shares. We start with the standard calculation of a trade of fyTokens for base shares (to simplify we omit the fee exponent): $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + y_2^{1 - t} $$ Since we are trading the pool to zero interest, $y_2 = \mu \cdot z_2$: $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + (\mu \cdot z_2)^{1 - t} $$ $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = (\mu \cdot z_2)^{1 - t} \cdot (\frac{c}{\mu} + 1) $$ $$ (\mu \cdot z_2)^{1 - t} = \frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)} $$ $$ \mu \cdot z_2 = (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)})^{\frac{1}{1 - t}} $$ $$ z_2 = \frac{1}{\mu} \cdot (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t}}{(\frac{c}{\mu} + 1)})^{\frac{1}{1 - t}} $$ $z_2$ is the total amount of shares in the pool after the theoretical trade to zero interest. To calculate the base value per share in the pool, we want to calculate: $$ \frac{c*z_2}{s} $$ Plugging in z_2 and adding in fee terms, we obtain the invariant: $$ \frac{ \frac{c}{\mu} \cdot (\frac{\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)})^{\frac{1}{1 - \frac{t}{g}}}}{s} $$ Any action on the pool should increase the value given by the above invariant. ### Alternate Invariant $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = \frac{c}{\mu} \cdot (\mu \cdot z_2)^{1 - t} + y_2^{1 - t} $$ Final condition is $z_2 = 0$: $$ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t} = y_2^{1 - t} $$ $$ y_2 = (\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t})^\frac{1}{1-t} $$ In this case we are looking to see the fyToken value per share: $$ \frac{y_2}{s} $$ $$ \frac{(\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - t} + y^{1 - t})^\frac{1}{1-t}}{s} $$ ### Initialization When the pool is initialized, $z_{start}$ is an initial amount of shares added to the pool. $y_{start}$ and $s$ are initialized to $\mu \cdot z$. Plugging into the invariant for initial supply shows that the initial value for the invariant is 1 or greater: $$ \frac{\frac{c}{\mu} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{s} $$ $$ \frac{\frac{c}{\mu} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + (\mu \cdot z)^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{\mu \cdot z} $$ $$ \frac{\frac{c}{\mu} \cdot \left( \frac{ (\mu \cdot z)^{1 - \frac{t}{g}} \cdot (\frac{c}{\mu} + 1) }{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{\mu \cdot z} $$ $$ \frac{\frac{c}{\mu} \cdot \left( (\mu \cdot z)^{1 - \frac{t}{g}} \right)^\frac{1}{1-\frac{t}{g}}}{\mu \cdot z} $$ $$ \frac{c}{\mu} \cdot \frac{\mu \cdot z}{\mu \cdot z} $$ $$ \frac{c}{\mu} $$ Since $c$ is always equal or greater than $\mu$, we have shown that the invariant is one or greater at initialization. ### Minting and Burning We can show that minting or burning shares (which causes $z$, $y$, and $s$ to be multiplied by the same proportion, $m$) does not change the invariant (we omit a multiplication by $c/\mu$ which does not alter the result ): $$ \frac{\left( \frac{ \frac{c}{\mu} \cdot (m \cdot \mu \cdot z)^{1 - \frac{t}{g}} + (m \cdot y)^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{m \cdot s} $$ $$ \frac{\left( \frac{ m^{1 - \frac{t}{g}} \cdot (\frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}})}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{m \cdot s} $$ $$ \frac{m \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{m \cdot s} $$ $$ \frac{\left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{ s} $$ ### Interest accumulation As the shares grow in value, $c$ will increase over time. $c$ should never decrease. $$ \frac{\frac{c}{\mu} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right)^\frac{1}{1-\frac{t}{g}}}{s} $$ Since $s$ and $\frac{1}{1-\frac{t}{g}}$ do not change when $c$ increases, we can simplify our analysis to the core expression of the invariant: $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right) $$ Let's first consider the invariant repsonds when $y = \mu \cdot z$: $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} + (\mu \cdot z)^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right) $$ $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ (\mu \cdot z)^{1 - \frac{t}{g}} \cdot (\frac{c}{\mu} + 1) }{(\frac{c}{\mu} + 1)} \right) $$ $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot (\mu \cdot z)^{1 - \frac{t}{g}} $$ In this simplified form we can see that increasing $c$ increases the invariant. However, things are different for the other extreme. Consider how the invariant responds when $z=0$: $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ \frac{c}{\mu} \cdot (\mu \cdot 0)^{1 - \frac{t}{g}} + y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right) $$ $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right) $$ $$ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} \cdot \left( \frac{ y^{1 - \frac{t}{g}}}{(\frac{c}{\mu} + 1)} \right) $$ We can re-arrange as shown: $$ \frac{ \left(\frac{c}{\mu}\right)^{1 - \frac{t}{g}} }{(\frac{c}{\mu} + 1)} \cdot y^{1 - \frac{t}{g}} $$ Let us define a new variable, $a = c/\mu$: $$ \frac{ \left(a\right)^{1 - \frac{t}{g}} }{(a + 1)} \cdot y^{1 - \frac{t}{g}} $$ We can check that this equation only goes up with increasing $a$ by checking that the derivative with respect to $a$ is positive. Taking the derivative: $$ \frac{\partial }{\partial a} \left(\frac{ \left(a\right)^{1 - \frac{t}{g}} }{(a + 1)} \cdot y^{1 - \frac{t}{g}}\right) $$ $$ -\frac{a^{-\frac{t}{g}}*((a + 1)\cdot t - g)}{(a + 1)^2 \cdot g} $$ This equation is positive under the following condition: $$ g > t \cdot (a + 1) $$ Under normal conditions, this equation is easily satisfied. For example, for a one-year to maturity YieldSpace market where $g$ is 0.9, $t$ is configured for 10% interest rates (and 10% rates do occur), the range of values for $t$ would be 0-0.1, and $a$ of 1.0-1.1. $$ 0.9 > 0.1 \cdot (1.1 + 1) $$ Thus, provided we are mindful of and satisify this requirement, we can consider interest accumulation as only increasing the invariant.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully