@haven-fi/solauto-sdk 1.0.131 → 1.0.132
Sign up to get free protection for your applications and to get access to all the features.
@@ -74,7 +74,7 @@ function getSolautoFeesBps(isReferred, targetLiqUtilizationRateBps, positionNetW
|
|
74
74
|
const k = 1.5;
|
75
75
|
let feeBps = 0;
|
76
76
|
if (targetLiqUtilizationRateBps !== undefined) {
|
77
|
-
feeBps =
|
77
|
+
feeBps = 10;
|
78
78
|
}
|
79
79
|
else if (positionNetWorthUsd <= minSize) {
|
80
80
|
feeBps = maxFeeBps;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rebalanceUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/rebalanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,aAAa,EAEb,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAkJjD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,yBAAyB,GAAG,SAAS,EAC/C,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,
|
1
|
+
{"version":3,"file":"rebalanceUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/rebalanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,aAAa,EAEb,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAkJjD,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,yBAAyB,GAAG,SAAS,EAC/C,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,CA0EjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,aAAa,GACtB,gBAAgB,GAAG,SAAS,CAmE9B;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,eAAe,EACvB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAkChB"}
|
@@ -80,6 +80,11 @@ function getTargetRateAndDcaAmount(state, settings, dca, currentUnixTime, target
|
|
80
80
|
}
|
81
81
|
}
|
82
82
|
function getRebalanceValues(state, settings, dca, currentUnixTime, supplyPrice, debtPrice, targetLiqUtilizationRateBps, limitGapBps) {
|
83
|
+
if (state === undefined ||
|
84
|
+
state.lastUpdated <
|
85
|
+
BigInt(Math.round((0, generalUtils_2.currentUnixSeconds)() - solautoConstants_1.MIN_POSITION_STATE_FRESHNESS_SECS))) {
|
86
|
+
console.warn("Requires a fresh position state to get rebalance details");
|
87
|
+
}
|
83
88
|
const { targetRateBps, amountToDcaIn } = getTargetRateAndDcaAmount(state, settings, dca, currentUnixTime, targetLiqUtilizationRateBps);
|
84
89
|
const amountUsdToDcaIn = (0, numberUtils_1.fromBaseUnit)(BigInt(Math.round(amountToDcaIn ?? 0)), state.debt.decimals) *
|
85
90
|
debtPrice;
|
package/package.json
CHANGED
package/src/utils/numberUtils.ts
CHANGED
@@ -104,7 +104,7 @@ export function getSolautoFeesBps(
|
|
104
104
|
let feeBps: number = 0;
|
105
105
|
|
106
106
|
if (targetLiqUtilizationRateBps !== undefined) {
|
107
|
-
feeBps =
|
107
|
+
feeBps = 10;
|
108
108
|
} else if (positionNetWorthUsd <= minSize) {
|
109
109
|
feeBps = maxFeeBps;
|
110
110
|
} else if (positionNetWorthUsd >= maxSize) {
|
@@ -176,6 +176,16 @@ export function getRebalanceValues(
|
|
176
176
|
targetLiqUtilizationRateBps?: number,
|
177
177
|
limitGapBps?: number
|
178
178
|
): RebalanceValues {
|
179
|
+
if (
|
180
|
+
state === undefined ||
|
181
|
+
state.lastUpdated <
|
182
|
+
BigInt(
|
183
|
+
Math.round(currentUnixSeconds() - MIN_POSITION_STATE_FRESHNESS_SECS)
|
184
|
+
)
|
185
|
+
) {
|
186
|
+
console.warn("Requires a fresh position state to get rebalance details");
|
187
|
+
}
|
188
|
+
|
179
189
|
const { targetRateBps, amountToDcaIn } = getTargetRateAndDcaAmount(
|
180
190
|
state,
|
181
191
|
settings,
|