@reserve-protocol/dtf-rebalance-lib 0.1.5 → 0.1.6
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 +4 -4
- package/package.json +1 -1
package/dist/open-auction.js
CHANGED
@@ -103,7 +103,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
103
103
|
// {USD/wholeShare} = {wholeTok/wholeShare} * {USD/wholeTok}
|
104
104
|
const shareValue = folio
|
105
105
|
.map((f, i) => {
|
106
|
-
return
|
106
|
+
return f.mul(prices[i]);
|
107
107
|
})
|
108
108
|
.reduce((a, b) => a.add(b));
|
109
109
|
// {USD/wholeBU} = {wholeTok/wholeBU} * {USD/wholeTok}
|
@@ -128,7 +128,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
128
128
|
// {1} = {wholeTok/wholeShare} * {USD/wholeTok} / {USD/wholeShare}
|
129
129
|
const portionBeingEjected = ejectionIndices
|
130
130
|
.map((i) => {
|
131
|
-
return
|
131
|
+
return folio[i].mul(prices[i]);
|
132
132
|
})
|
133
133
|
.reduce((a, b) => a.add(b), numbers_1.ZERO)
|
134
134
|
.div(shareValue);
|
@@ -366,10 +366,10 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
366
366
|
// {wholeTok/wholeShare} = {wholeTok/wholeBU} * {wholeBU/wholeShare}
|
367
367
|
const buyUpTo = weightRanges[i].low.mul(actualLimits.low);
|
368
368
|
const sellDownTo = weightRanges[i].high.mul(actualLimits.high);
|
369
|
-
if (
|
369
|
+
if (folio[i].lt(buyUpTo)) {
|
370
370
|
deficitTokens.push(token);
|
371
371
|
}
|
372
|
-
else if (
|
372
|
+
else if (folio[i].gt(sellDownTo)) {
|
373
373
|
surplusTokens.push(token);
|
374
374
|
}
|
375
375
|
});
|