@drift-labs/sdk 2.1.1 → 2.1.2

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/lib/math/amm.js CHANGED
@@ -324,7 +324,7 @@ function calculateSpreadBN(baseSpread, lastOracleReservePriceSpreadPct, lastOrac
324
324
  spreadTerms.shortSpreadwEL = shortSpread;
325
325
  if (netRevenueSinceLastFunding.lt(numericConstants_1.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT)) {
326
326
  const revenueRetreatAmount = Math.min(maxTargetSpread / 10, Math.floor((baseSpread * netRevenueSinceLastFunding.abs().toNumber()) /
327
- numericConstants_1.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT.toNumber()));
327
+ numericConstants_1.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT.abs().toNumber()));
328
328
  const halfRevenueRetreatAmount = Math.floor(revenueRetreatAmount / 2);
329
329
  spreadTerms.revenueRetreatAmount = revenueRetreatAmount;
330
330
  spreadTerms.halfRevenueRetreatAmount = halfRevenueRetreatAmount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/math/amm.ts CHANGED
@@ -606,7 +606,7 @@ export function calculateSpreadBN(
606
606
  maxTargetSpread / 10,
607
607
  Math.floor(
608
608
  (baseSpread * netRevenueSinceLastFunding.abs().toNumber()) /
609
- DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT.toNumber()
609
+ DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT.abs().toNumber()
610
610
  )
611
611
  );
612
612
  const halfRevenueRetreatAmount = Math.floor(revenueRetreatAmount / 2);