@reserve-protocol/dtf-rebalance-lib 0.0.17 → 0.0.18

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.
@@ -223,10 +223,10 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
223
223
  high: (0, numbers_1.bn)(spotLimit.add(spotLimit.mul(delta)).mul(numbers_1.D18d)),
224
224
  };
225
225
  if (round == AuctionRound.EJECT && rebalanceTarget.eq(numbers_1.ONE)) {
226
- // if ejecting to completion, aim 10% higher (if possible)
227
- newLimits.low = (0, numbers_1.bn)(spotLimit.mul(1.1).mul(numbers_1.D18d));
228
- newLimits.spot = (0, numbers_1.bn)(spotLimit.mul(1.1).mul(numbers_1.D18d));
229
- newLimits.high = (0, numbers_1.bn)(spotLimit.mul(1.1).mul(numbers_1.D18d));
226
+ // aim 1% higher if executed permissonlessly
227
+ newLimits.spot += newLimits.spot * 1n / 100n;
228
+ // leave 10% room to increase low in the future if ejection leaves dust behind
229
+ newLimits.high += newLimits.high * 10n / 100n;
230
230
  }
231
231
  // low
232
232
  if (newLimits.low < rebalance.limits.low) {
@@ -282,10 +282,10 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
282
282
  .div(numbers_1.D18d)),
283
283
  };
284
284
  if (round == AuctionRound.EJECT && rebalanceTarget.eq(numbers_1.ONE)) {
285
- // if ejecting to completion, aim 10% higher
286
- newWeightsD27.low = newWeightsD27.low * 11n / 10n;
287
- newWeightsD27.spot = newWeightsD27.spot * 11n / 10n;
288
- newWeightsD27.high = newWeightsD27.high * 11n / 10n;
285
+ // aim 1% higher if executed permissonlessly
286
+ newWeightsD27.spot += newWeightsD27.spot * 1n / 100n;
287
+ // leave 10% room to increase low in the future if ejection leaves dust behind
288
+ newWeightsD27.high += newWeightsD27.high * 10n / 100n;
289
289
  }
290
290
  if (newWeightsD27.low < weightRange.low) {
291
291
  newWeightsD27.low = weightRange.low;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -330,10 +330,11 @@ export const getOpenAuction = (
330
330
  }
331
331
 
332
332
  if (round == AuctionRound.EJECT && rebalanceTarget.eq(ONE)) {
333
- // if ejecting to completion, aim 10% higher (if possible)
334
- newLimits.low = bn(spotLimit.mul(1.1).mul(D18d))
335
- newLimits.spot = bn(spotLimit.mul(1.1).mul(D18d))
336
- newLimits.high = bn(spotLimit.mul(1.1).mul(D18d))
333
+ // aim 1% higher if executed permissonlessly
334
+ newLimits.spot += newLimits.spot * 1n / 100n
335
+
336
+ // leave 10% room to increase low in the future if ejection leaves dust behind
337
+ newLimits.high += newLimits.high * 10n / 100n
337
338
  }
338
339
 
339
340
  // low
@@ -403,10 +404,11 @@ export const getOpenAuction = (
403
404
  }
404
405
 
405
406
  if (round == AuctionRound.EJECT && rebalanceTarget.eq(ONE)) {
406
- // if ejecting to completion, aim 10% higher
407
- newWeightsD27.low = newWeightsD27.low * 11n / 10n
408
- newWeightsD27.spot = newWeightsD27.spot * 11n / 10n
409
- newWeightsD27.high = newWeightsD27.high * 11n / 10n
407
+ // aim 1% higher if executed permissonlessly
408
+ newWeightsD27.spot += newWeightsD27.spot * 1n / 100n
409
+
410
+ // leave 10% room to increase low in the future if ejection leaves dust behind
411
+ newWeightsD27.high += newWeightsD27.high * 10n / 100n
410
412
  }
411
413
 
412
414
  if (newWeightsD27.low < weightRange.low) {