@reserve-protocol/dtf-rebalance-lib 0.2.12 → 0.2.14
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.js +5 -2
- package/package.json +1 -1
package/dist/open-auction.js
CHANGED
@@ -27,6 +27,9 @@ const getTargetBasket = (_initialWeights, _prices, _decimals) => {
|
|
27
27
|
throw new Error("length mismatch");
|
28
28
|
}
|
29
29
|
const vals = _initialWeights.map((initialWeight, i) => {
|
30
|
+
if (_prices[i] <= 0) {
|
31
|
+
throw new Error(`missing price for token index ${i}`);
|
32
|
+
}
|
30
33
|
const price = new utils_1.Decimal(_prices[i]);
|
31
34
|
const decimalScale = new utils_1.Decimal(`1e${_decimals[i]}`);
|
32
35
|
// {USD/wholeBU} = D27{tok/BU} * {BU/wholeBU} / {tok/wholeTok} / D27 * {USD/wholeTok}
|
@@ -77,7 +80,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
77
80
|
// {USD/wholeTok}
|
78
81
|
const prices = _prices.map((a) => new utils_1.Decimal(a));
|
79
82
|
for (let i = 0; i < prices.length; i++) {
|
80
|
-
if (prices[i].
|
83
|
+
if (prices[i].lte(numbers_1.ZERO)) {
|
81
84
|
throw new Error(`missing price for token ${rebalance.tokens[i]}`);
|
82
85
|
}
|
83
86
|
}
|
@@ -198,7 +201,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
198
201
|
if (progression.lt(0.99) && relativeProgression.lt(finalStageAt.sub(0.02))) {
|
199
202
|
round = AuctionRound.PROGRESS;
|
200
203
|
rebalanceTarget = initialProgression.add(numbers_1.ONE.sub(initialProgression).mul(finalStageAt));
|
201
|
-
if (rebalanceTarget.gte(0.
|
204
|
+
if (rebalanceTarget.gte(0.997)) {
|
202
205
|
rebalanceTarget = numbers_1.ONE;
|
203
206
|
}
|
204
207
|
if (rebalanceTarget.eq(numbers_1.ONE)) {
|