Readonly
exchangeNote that, in the above formula, x = this.exchangeRate / ONE
See formula (1.1) 1 asset = x PT
So if we have k = assetAmount: k asset = x * k PT
See formula (3.1)
1 asset = x / (x - 1) / YT = (this.exchangeRate / ONE) / (this.exchangeRate / ONE - 1) YT = this.exchangeRate / (this.exchangeRate - ONE) YT
So if we have k = assetAmount k asset = k * this.exchangeRate / (this.exchangeRate - ONE) YT
See formula (1.2) 1 PT = 1/x asset
So if we have k = ptAmount: k PT = k/x asset
See formula (3.2) 1 YT = (1 - 1/x) asset = (x - 1) / x asset = (this.exchangeRate / ONE - 1) / (this.exchangeRate / ONE) asset = (this.exchangeRate - ONE) / this.exchangeRate asset
So if we have k = ytAmount k YT = k * (this.exchangeRate - ONE) / this.exchangeRate asset
Generated using TypeDoc
This class is for convenient conversion between pt <-> asset and yt <-> asset, with a given market's exchange rate.
Market's exchange rate can be obtained from MarketEntity#getMarketInfo().exchangeRate, divided by ONE (10^18)
The exchange rate ($x$) is the rate of converting the underlying asset into pt, that is
From here we can have the formula for converting asset <-> PT
For converting asset <-> YT, we need the following formula from the yield tokenization model
From (1.2) and (2), we have:
<=> 1 asset = x / (x - 1) YT (3.1) and 1 YT = (1 - 1 / x) asset (3.2)