@haven-fi/solauto-sdk 1.0.639 → 1.0.640
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.
@@ -120,11 +120,11 @@ function getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, offsetFromMaxLt
|
|
120
120
|
1); // -1 to account for any rounding issues
|
121
121
|
}
|
122
122
|
function maxRepayFromBps(maxLtvBps, liqThresholdBps) {
|
123
|
-
return Math.min(
|
123
|
+
return Math.min(9000, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps - 1000, 0.005));
|
124
124
|
}
|
125
125
|
function maxRepayToBps(maxLtvBps, liqThresholdBps) {
|
126
|
-
return Math.min(maxRepayFromBps(maxLtvBps, liqThresholdBps) - constants_1.MIN_REPAY_GAP_BPS, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.
|
126
|
+
return Math.min(maxRepayFromBps(maxLtvBps, liqThresholdBps) - constants_1.MIN_REPAY_GAP_BPS, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005));
|
127
127
|
}
|
128
128
|
function maxBoostToBps(maxLtvBps, liqThresholdBps) {
|
129
|
-
return Math.min(maxRepayToBps(maxLtvBps, liqThresholdBps), getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.
|
129
|
+
return Math.min(maxRepayToBps(maxLtvBps, liqThresholdBps), getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005));
|
130
130
|
}
|
package/local/logPositions.ts
CHANGED
@@ -97,7 +97,7 @@ async function main(filterWhitelist: boolean) {
|
|
97
97
|
umi,
|
98
98
|
positions.map((x) => new PublicKey(x.publicKey!))
|
99
99
|
)
|
100
|
-
).sort((a, b) => a.netWorthUsd - b.netWorthUsd);
|
100
|
+
).sort((a, b) => a.netWorthUsd() - b.netWorthUsd());
|
101
101
|
|
102
102
|
const tokensUsed = Array.from(
|
103
103
|
new Set(
|
@@ -115,11 +115,6 @@ async function main(filterWhitelist: boolean) {
|
|
115
115
|
let awaitingBoostPositions = 0;
|
116
116
|
|
117
117
|
for (const pos of positionsEx) {
|
118
|
-
await pos.updateWithLatestPrices({
|
119
|
-
supplyPrice: safeGetPrice(pos.supplyMint),
|
120
|
-
debtPrice: safeGetPrice(pos.debtMint),
|
121
|
-
});
|
122
|
-
|
123
118
|
const actionToTake = pos.eligibleForRebalance(0);
|
124
119
|
|
125
120
|
const repayFrom = pos.settings!.repayToBps + pos.settings!.repayGap;
|
@@ -142,7 +137,7 @@ async function main(filterWhitelist: boolean) {
|
|
142
137
|
`(${pos.authority.toString()} ${pos.positionId})`
|
143
138
|
);
|
144
139
|
console.log(
|
145
|
-
`${pos.strategyName}: $${formatNumber(pos.netWorthUsd, 2, 10000, 2)} ${healthText} ${boostText}`
|
140
|
+
`${pos.strategyName}: $${formatNumber(pos.netWorthUsd(), 2, 10000, 2)} ${healthText} ${boostText}`
|
146
141
|
);
|
147
142
|
}
|
148
143
|
|
@@ -161,7 +156,7 @@ async function main(filterWhitelist: boolean) {
|
|
161
156
|
.map((x) => x.supplyUsd())
|
162
157
|
.reduce((acc, curr) => acc + curr, 0);
|
163
158
|
const netWorth = positionsEx
|
164
|
-
.map((x) => x.netWorthUsd)
|
159
|
+
.map((x) => x.netWorthUsd())
|
165
160
|
.reduce((acc, curr) => acc + curr, 0);
|
166
161
|
|
167
162
|
console.log(`TVL: $${formatNumber(tvl, 2, 10000, 2)}`);
|
package/package.json
CHANGED
package/src/utils/numberUtils.ts
CHANGED
@@ -168,21 +168,21 @@ export function getMaxLiqUtilizationRateBps(
|
|
168
168
|
|
169
169
|
export function maxRepayFromBps(maxLtvBps: number, liqThresholdBps: number) {
|
170
170
|
return Math.min(
|
171
|
-
|
172
|
-
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps - 1000, 0.
|
171
|
+
9000,
|
172
|
+
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps - 1000, 0.005)
|
173
173
|
);
|
174
174
|
}
|
175
175
|
|
176
176
|
export function maxRepayToBps(maxLtvBps: number, liqThresholdBps: number) {
|
177
177
|
return Math.min(
|
178
178
|
maxRepayFromBps(maxLtvBps, liqThresholdBps) - MIN_REPAY_GAP_BPS,
|
179
|
-
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.
|
179
|
+
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005)
|
180
180
|
);
|
181
181
|
}
|
182
182
|
|
183
183
|
export function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number) {
|
184
184
|
return Math.min(
|
185
185
|
maxRepayToBps(maxLtvBps, liqThresholdBps),
|
186
|
-
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.
|
186
|
+
getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005)
|
187
187
|
);
|
188
188
|
}
|