@drift-labs/sdk 2.132.0-beta.1 → 2.132.0-beta.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/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.132.0-beta.
|
|
1
|
+
2.132.0-beta.2
|
|
@@ -371,7 +371,7 @@ 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(
|
|
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
|
|
375
375
|
}
|
|
376
376
|
else {
|
|
377
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
|
|
@@ -371,7 +371,7 @@ 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(
|
|
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
|
|
375
375
|
}
|
|
376
376
|
else {
|
|
377
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
|
package/package.json
CHANGED
package/src/math/spotBalance.ts
CHANGED
|
@@ -588,10 +588,10 @@ export function calculateWithdrawLimit(
|
|
|
588
588
|
spotMarket.withdrawGuardThreshold,
|
|
589
589
|
BN.min(
|
|
590
590
|
BN.max(
|
|
591
|
-
marketDepositTokenAmount.div(new BN(
|
|
592
|
-
borrowTokenTwapLive.add(lesserDepositAmount.div(new BN(
|
|
591
|
+
marketDepositTokenAmount.div(new BN(3)),
|
|
592
|
+
borrowTokenTwapLive.add(lesserDepositAmount.div(new BN(7)))
|
|
593
593
|
),
|
|
594
|
-
lesserDepositAmount.sub(lesserDepositAmount.div(new BN(
|
|
594
|
+
lesserDepositAmount.sub(lesserDepositAmount.div(new BN(8)))
|
|
595
595
|
)
|
|
596
596
|
); // main pool between ~15-80% utilization with 10% friction on twap
|
|
597
597
|
} else {
|