@reserve-protocol/dtf-rebalance-lib 2.4.2 → 2.4.4

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.
@@ -374,13 +374,15 @@ const getOpenAuction = (rebalance, _supply, _initialSupply, _initialAssets = [],
374
374
  // {tok} = D27{tok/BU} * D18{BU/share} * {share} / D18 / D27
375
375
  const buyUpTo = (newWeights[i].low * newLimits.low * _supply) / numbers_1.D18n / numbers_1.D27n;
376
376
  const sellDownTo = (newWeights[i].high * newLimits.high * _supply + (numbers_1.D18n * numbers_1.D27n - 1n)) / numbers_1.D18n / numbers_1.D27n;
377
+ // {USD}
378
+ const tradeThreshold = round == AuctionRound.EJECT ? numbers_1.ZERO : numbers_1.ONE;
377
379
  if (_assets[i] < buyUpTo) {
378
380
  // {wholeTok} = {tok} / {tok/wholeTok}
379
381
  const deficitAmount = new utils_1.Decimal((buyUpTo - _assets[i]).toString()).div(decimalScale[i]);
380
382
  // {USD} = {wholeTok} * {USD/wholeTok}
381
383
  const tokenDeficitValue = deficitAmount.mul(prices[i]);
382
384
  // $1 minimum
383
- if (round == AuctionRound.EJECT || tokenDeficitValue.gte(numbers_1.ONE)) {
385
+ if (tokenDeficitValue.gt(tradeThreshold)) {
384
386
  deficitTokens.push(token);
385
387
  deficitTokenSizes.push(tokenDeficitValue.toNumber());
386
388
  }
@@ -391,7 +393,7 @@ const getOpenAuction = (rebalance, _supply, _initialSupply, _initialAssets = [],
391
393
  // {USD} = {wholeTok} * {USD/wholeTok}
392
394
  const tokenSurplusValue = surplusAmount.mul(prices[i]);
393
395
  // $1 minimum
394
- if (round == AuctionRound.EJECT || tokenSurplusValue.gte(numbers_1.ONE)) {
396
+ if (tokenSurplusValue.gt(tradeThreshold)) {
395
397
  surplusTokens.push(token);
396
398
  surplusTokenSizes.push(tokenSurplusValue.toNumber());
397
399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",