@drift-labs/sdk-browser 2.132.0-beta.4 → 2.132.0-beta.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.132.0-beta.4
1
+ 2.132.0-beta.5
@@ -371,10 +371,10 @@ function calculateWithdrawLimit(spotMarket, now) {
371
371
  const lesserDepositAmount = anchor_1.BN.min(marketDepositTokenAmount, depositTokenTwapLive);
372
372
  let maxBorrowTokensTwap;
373
373
  if (spotMarket.poolId == 0) {
374
- maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(3)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(7)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(8))))); // main pool between ~15-80% utilization with 10% friction on twap
374
+ maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(3)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(7)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(8))))); // main pool between ~30-92.5% utilization with friction on twap in 20% increments
375
375
  }
376
376
  else {
377
- maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(2)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(3)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(10))))); // isolated pool between ~50-90% utilization with 33% friction on twap
377
+ maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(2)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(3)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(20))))); // isolated pools between 50-95% utilization with friction on twap in 33% increments
378
378
  }
379
379
  const minDepositTokensTwap = depositTokenTwapLive.sub(anchor_1.BN.max(depositTokenTwapLive.div(new anchor_1.BN(4)), anchor_1.BN.min(spotMarket.withdrawGuardThreshold, depositTokenTwapLive)));
380
380
  const { minDepositTokensForUtilization, maxBorrowTokensForUtilization } = calculateTokenUtilizationLimits(marketDepositTokenAmount, marketBorrowTokenAmount, spotMarket);
@@ -371,10 +371,10 @@ function calculateWithdrawLimit(spotMarket, now) {
371
371
  const lesserDepositAmount = anchor_1.BN.min(marketDepositTokenAmount, depositTokenTwapLive);
372
372
  let maxBorrowTokensTwap;
373
373
  if (spotMarket.poolId == 0) {
374
- maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(3)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(7)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(8))))); // main pool between ~15-80% utilization with 10% friction on twap
374
+ maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(3)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(7)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(8))))); // main pool between ~30-92.5% utilization with friction on twap in 20% increments
375
375
  }
376
376
  else {
377
- maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(2)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(3)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(10))))); // isolated pool between ~50-90% utilization with 33% friction on twap
377
+ maxBorrowTokensTwap = anchor_1.BN.max(spotMarket.withdrawGuardThreshold, anchor_1.BN.min(anchor_1.BN.max(marketDepositTokenAmount.div(new anchor_1.BN(2)), borrowTokenTwapLive.add(lesserDepositAmount.div(new anchor_1.BN(3)))), lesserDepositAmount.sub(lesserDepositAmount.div(new anchor_1.BN(20))))); // isolated pools between 50-95% utilization with friction on twap in 33% increments
378
378
  }
379
379
  const minDepositTokensTwap = depositTokenTwapLive.sub(anchor_1.BN.max(depositTokenTwapLive.div(new anchor_1.BN(4)), anchor_1.BN.min(spotMarket.withdrawGuardThreshold, depositTokenTwapLive)));
380
380
  const { minDepositTokensForUtilization, maxBorrowTokensForUtilization } = calculateTokenUtilizationLimits(marketDepositTokenAmount, marketBorrowTokenAmount, spotMarket);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk-browser",
3
- "version": "2.132.0-beta.4",
3
+ "version": "2.132.0-beta.5",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -593,7 +593,7 @@ export function calculateWithdrawLimit(
593
593
  ),
594
594
  lesserDepositAmount.sub(lesserDepositAmount.div(new BN(8)))
595
595
  )
596
- ); // main pool between ~15-80% utilization with 10% friction on twap
596
+ ); // main pool between ~30-92.5% utilization with friction on twap in 20% increments
597
597
  } else {
598
598
  maxBorrowTokensTwap = BN.max(
599
599
  spotMarket.withdrawGuardThreshold,
@@ -602,9 +602,9 @@ export function calculateWithdrawLimit(
602
602
  marketDepositTokenAmount.div(new BN(2)),
603
603
  borrowTokenTwapLive.add(lesserDepositAmount.div(new BN(3)))
604
604
  ),
605
- lesserDepositAmount.sub(lesserDepositAmount.div(new BN(10)))
605
+ lesserDepositAmount.sub(lesserDepositAmount.div(new BN(20)))
606
606
  )
607
- ); // isolated pool between ~50-90% utilization with 33% friction on twap
607
+ ); // isolated pools between 50-95% utilization with friction on twap in 33% increments
608
608
  }
609
609
 
610
610
  const minDepositTokensTwap = depositTokenTwapLive.sub(