@reserve-protocol/dtf-rebalance-lib 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/open-auction.d.ts +3 -3
- package/dist/open-auction.js +7 -7
- package/package.json +1 -1
package/dist/open-auction.d.ts
CHANGED
@@ -51,13 +51,13 @@ export declare const getTargetBasket: (_initialWeights: WeightRange[], _prices:
|
|
51
51
|
*
|
52
52
|
* Non-AUCTION_LAUNCHERs should use `folio.openAuctionUnrestricted()`
|
53
53
|
*
|
54
|
-
* @param rebalance The result of calling folio.getRebalance()
|
54
|
+
* @param rebalance The result of calling folio.getRebalance(), today
|
55
55
|
* @param _supply {share} The totalSupply() of the basket, today
|
56
56
|
* @param _initialFolio D18{tok/share} Initial balances per share, e.g result of folio.toAssets(1e18, 0) at time rebalance was first proposed
|
57
57
|
* @param _targetBasket D18{1} Result of calling `getTargetBasket()`
|
58
|
-
* @param _folio D18{tok/share} Current ratio of token per share, e.g result of folio.toAssets(1e18, 0)
|
58
|
+
* @param _folio D18{tok/share} Current ratio of token per share, e.g result of folio.toAssets(1e18, 0), today
|
59
59
|
* @param _decimals Decimals of each token
|
60
|
-
* @param _prices {USD/wholeTok} USD prices for each *whole* token
|
60
|
+
* @param _prices {USD/wholeTok} USD prices for each *whole* token, today
|
61
61
|
* @param _priceError {1} Price error to use for each token during auction pricing; should be smaller than price error during startRebalance
|
62
62
|
* @param _finalStageAt {1} The % rebalanced from the initial Folio to determine when is the final stage of the rebalance
|
63
63
|
*/
|
package/dist/open-auction.js
CHANGED
@@ -23,6 +23,7 @@ var AuctionRound;
|
|
23
23
|
* @returns D18{1} The target basket
|
24
24
|
*/
|
25
25
|
const getTargetBasket = (_initialWeights, _prices, _decimals) => {
|
26
|
+
console.log("getTargetBasket", _initialWeights, _prices, _decimals);
|
26
27
|
if (_initialWeights.length != _prices.length) {
|
27
28
|
throw new Error("length mismatch");
|
28
29
|
}
|
@@ -45,13 +46,13 @@ exports.getTargetBasket = getTargetBasket;
|
|
45
46
|
*
|
46
47
|
* Non-AUCTION_LAUNCHERs should use `folio.openAuctionUnrestricted()`
|
47
48
|
*
|
48
|
-
* @param rebalance The result of calling folio.getRebalance()
|
49
|
+
* @param rebalance The result of calling folio.getRebalance(), today
|
49
50
|
* @param _supply {share} The totalSupply() of the basket, today
|
50
51
|
* @param _initialFolio D18{tok/share} Initial balances per share, e.g result of folio.toAssets(1e18, 0) at time rebalance was first proposed
|
51
52
|
* @param _targetBasket D18{1} Result of calling `getTargetBasket()`
|
52
|
-
* @param _folio D18{tok/share} Current ratio of token per share, e.g result of folio.toAssets(1e18, 0)
|
53
|
+
* @param _folio D18{tok/share} Current ratio of token per share, e.g result of folio.toAssets(1e18, 0), today
|
53
54
|
* @param _decimals Decimals of each token
|
54
|
-
* @param _prices {USD/wholeTok} USD prices for each *whole* token
|
55
|
+
* @param _prices {USD/wholeTok} USD prices for each *whole* token, today
|
55
56
|
* @param _priceError {1} Price error to use for each token during auction pricing; should be smaller than price error during startRebalance
|
56
57
|
* @param _finalStageAt {1} The % rebalanced from the initial Folio to determine when is the final stage of the rebalance
|
57
58
|
*/
|
@@ -149,7 +150,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
149
150
|
// calculate progressions
|
150
151
|
// {wholeBU/wholeShare} = D18{BU/share} / D18
|
151
152
|
const prevSpotLimit = new utils_1.Decimal(rebalance.limits.spot.toString()).div(numbers_1.D18d);
|
152
|
-
// {wholeTok/
|
153
|
+
// {wholeTok/wholeShare} = {wholeTok/wholeBU} * {wholeBU/wholeShare}
|
153
154
|
const expectedBalances = weightRanges.map((weightRange) => weightRange.spot.mul(prevSpotLimit));
|
154
155
|
// {1} = {USD/wholeShare} / {USD/wholeShare}
|
155
156
|
let progression = folio
|
@@ -167,8 +168,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
167
168
|
// {1} = {USD/wholeShare} / {USD/wholeShare}
|
168
169
|
const initialProgression = initialFolio
|
169
170
|
.map((initialBalance, i) => {
|
170
|
-
|
171
|
-
if (!rebalance.inRebalance[i] && rebalance.weights[i].spot > 0n) {
|
171
|
+
if (!rebalance.inRebalance[i]) {
|
172
172
|
return numbers_1.ZERO;
|
173
173
|
}
|
174
174
|
// {wholeTok/wholeShare}
|
@@ -182,7 +182,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
182
182
|
if (debug) {
|
183
183
|
console.log("progression < initialProgression", progression.toString(), initialProgression.toString());
|
184
184
|
}
|
185
|
-
progression = initialProgression; // don't go backwards
|
185
|
+
progression = initialProgression; // don't go backwards, should only happen due to negligible rounding errors
|
186
186
|
}
|
187
187
|
// {1} = {1} / {1}
|
188
188
|
let relativeProgression = initialProgression.eq(numbers_1.ONE)
|