@haven-fi/solauto-sdk 1.0.322 → 1.0.324
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.
@@ -91,18 +91,20 @@ function eligibleForRebalance(positionState, positionSettings, positionDca, curr
|
|
91
91
|
: positionSettings.boostToBps;
|
92
92
|
const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
|
93
93
|
const boostFrom = boostToBps - positionSettings.boostGap;
|
94
|
-
if (
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
94
|
+
if (positionState.liqUtilizationRateBps - boostFrom <= bpsDistanceThreshold) {
|
95
|
+
if (positionState.liqUtilizationRateBps < boostFrom) {
|
96
|
+
const values = (0, rebalanceUtils_1.getRebalanceValues)(positionState, positionSettings, positionDca, (0, generalUtils_1.currentUnixSeconds)(), supplyMintPrice, debtMintPrice);
|
97
|
+
const sufficientLiquidity = (0, numberUtils_1.fromBaseUnit)(positionState.debt.amountCanBeUsed.baseAmountUsdValue, constants_1.USD_DECIMALS) *
|
98
|
+
0.95 >
|
99
|
+
values.debtAdjustmentUsd;
|
100
|
+
if (!sufficientLiquidity) {
|
101
|
+
console.log("Insufficient debt liquidity to further boost");
|
102
|
+
}
|
103
|
+
return sufficientLiquidity ? "boost" : undefined;
|
102
104
|
}
|
103
|
-
return
|
105
|
+
return "boost";
|
104
106
|
}
|
105
|
-
else if (
|
107
|
+
else if (repayFrom - positionState.liqUtilizationRateBps <=
|
106
108
|
bpsDistanceThreshold) {
|
107
109
|
return "repay";
|
108
110
|
}
|
package/package.json
CHANGED
@@ -166,32 +166,32 @@ export function eligibleForRebalance(
|
|
166
166
|
const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
|
167
167
|
const boostFrom = boostToBps - positionSettings.boostGap;
|
168
168
|
|
169
|
-
if (
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
169
|
+
if (positionState.liqUtilizationRateBps - boostFrom <= bpsDistanceThreshold) {
|
170
|
+
if (positionState.liqUtilizationRateBps < boostFrom) {
|
171
|
+
const values = getRebalanceValues(
|
172
|
+
positionState!,
|
173
|
+
positionSettings,
|
174
|
+
positionDca,
|
175
|
+
currentUnixSeconds(),
|
176
|
+
supplyMintPrice,
|
177
|
+
debtMintPrice
|
178
|
+
);
|
179
|
+
const sufficientLiquidity =
|
180
|
+
fromBaseUnit(
|
181
|
+
positionState.debt.amountCanBeUsed.baseAmountUsdValue,
|
182
|
+
USD_DECIMALS
|
183
|
+
) *
|
184
|
+
0.95 >
|
185
|
+
values.debtAdjustmentUsd;
|
186
|
+
if (!sufficientLiquidity) {
|
187
|
+
console.log("Insufficient debt liquidity to further boost");
|
188
|
+
}
|
189
|
+
return sufficientLiquidity ? "boost" : undefined;
|
190
190
|
}
|
191
191
|
|
192
|
-
return
|
192
|
+
return "boost";
|
193
193
|
} else if (
|
194
|
-
|
194
|
+
repayFrom - positionState.liqUtilizationRateBps <=
|
195
195
|
bpsDistanceThreshold
|
196
196
|
) {
|
197
197
|
return "repay";
|