@reserve-protocol/dtf-rebalance-lib 2.5.1 → 2.6.0
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 -11
- package/package.json +1 -1
package/dist/open-auction.js
CHANGED
|
@@ -159,12 +159,9 @@ const getOpenAuction = (rebalance, _supply, _initialSupply, _initialAssets = [],
|
|
|
159
159
|
const expectedBalances = weightRanges.map((weightRange) => weightRange.spot.mul(idealSpotLimit));
|
|
160
160
|
// absoluteProgression
|
|
161
161
|
// {1} = {USD/wholeShare} / {USD/wholeShare}
|
|
162
|
-
|
|
162
|
+
const progression = folio
|
|
163
163
|
.map((actualBalance, i) => {
|
|
164
|
-
if (!rebalance.inRebalance[i]) {
|
|
165
|
-
return numbers_1.ZERO;
|
|
166
|
-
}
|
|
167
|
-
if (expectedBalances[i].eq(numbers_1.ZERO)) {
|
|
164
|
+
if (!rebalance.inRebalance[i] || expectedBalances[i].eq(numbers_1.ZERO)) {
|
|
168
165
|
return numbers_1.ONE;
|
|
169
166
|
}
|
|
170
167
|
// {wholeTok/wholeShare}
|
|
@@ -175,12 +172,9 @@ const getOpenAuction = (rebalance, _supply, _initialSupply, _initialAssets = [],
|
|
|
175
172
|
.reduce((a, b) => (a.lt(b) ? a : b));
|
|
176
173
|
// absolute
|
|
177
174
|
// {1} = {USD/wholeShare} / {USD/wholeShare}
|
|
178
|
-
|
|
175
|
+
let initialProgression = initialFolio
|
|
179
176
|
.map((initialBalance, i) => {
|
|
180
|
-
if (!rebalance.inRebalance[i]) {
|
|
181
|
-
return numbers_1.ZERO;
|
|
182
|
-
}
|
|
183
|
-
if (expectedBalances[i].eq(numbers_1.ZERO)) {
|
|
177
|
+
if (!rebalance.inRebalance[i] || expectedBalances[i].eq(numbers_1.ZERO)) {
|
|
184
178
|
return numbers_1.ONE;
|
|
185
179
|
}
|
|
186
180
|
// {wholeTok/wholeShare}
|
|
@@ -193,7 +187,7 @@ const getOpenAuction = (rebalance, _supply, _initialSupply, _initialAssets = [],
|
|
|
193
187
|
if (debug) {
|
|
194
188
|
console.log("progression < initialProgression", progression.toString(), initialProgression.toString());
|
|
195
189
|
}
|
|
196
|
-
|
|
190
|
+
initialProgression = progression; // don't go backwards, should only happen due to negligible rounding errors
|
|
197
191
|
}
|
|
198
192
|
// {1} = {1} / {1}
|
|
199
193
|
let relativeProgression = initialProgression.eq(numbers_1.ONE)
|