Curve Initialization
Last updated
Last updated
Any user is able to generate an IBC curve by providing an initial amount of an ERC20 token as the selected reserve asset. An IBC is created per reserve asset type, and only one IBC can exist per reserve asset type.
An IBC using ETH as the reserve asset is created at protocol genesis, with ibETH (the minted ibAsset) marking the first history of assets that follow inversed market dynamics. Other types of ibAssets can be generated by any user providing ERC20 reserve assets.
The provided initial parameter values of initial liquidity reserves () is used to compute the initial minted supply (), and the starting spot price ().
The curve initializes to contain the provided amount of liquidity reserves. The generated IBC starts off with a price curve equation of:
Where the price starts as ibAsset = reserve asset at a minted ibAsset supply of .
The initial minted supply and price values are then calculated as:
The IBC also starts with an initial minted supply of LP tokens, later used to calculate the LP token mint amounts to those providing liquidity to the initialized curve. The initial LP token amount is calculated as:
Which is equal to the initial price, times the specified amount of virtual reserves minus the amount of virtual reserves that would be needed to fully back the initial virtual minted supply at the initial price.
The LP token amount minted for a small deduction of the minimum initial reserve is also made non-removable, preventing potential rounding errors and total drainage of the reserve.
The curve is then defined as the below:
The invariant is used extensively in the IBC's implementation.
A minimum amount of initial reserves is enforced, preventing rounding errors during further interactions. The minimum initial reserve is set as reserve assets for all initializing IBCs. Furthermore, a small reserve amount from the minimum initial reserve is deducted away and made non-withdrawable and is locked in the IBC eternally in order to prevent further rounding errors and disallow the reserve being drained to zero.
Following from a generic IBC of , the initialized curve must show a spot price of at a minted virtual supply of :
The curve should also contain a liquidity reserve of at a minted supply of :
Whereby combining the two yields the values for and :
Where is the amount of ibAssets being minted by further interactions post-initialization.
The generated IBC is observed to have the below invariant () as mints and burns occur. does not update during mints and burns, but updates with LP additions and withdraws.
represents the utilization of provided liquidity vs. liquidity used to back minted ibAssets at the current spot price. is defined at curve initialization and is made to never update. is defined as:
For all initialized IBCs, is always set to have a value of .
With initialized values of , , , the values and are set as:
The newly added values of and allow the price curve to also be written as: