@haven-fi/solauto-sdk 1.0.67 → 1.0.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,10 +82,10 @@ function eligibleForRebalance(positionState, positionSettings, positionDca, curr
82
82
  : positionSettings.boostToBps;
83
83
  const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
84
84
  const boostFrom = boostToBps - positionSettings.boostGap;
85
- if (positionState.liqUtilizationRateBps <= boostFrom) {
85
+ if (positionState.liqUtilizationRateBps < boostFrom) {
86
86
  return "boost";
87
87
  }
88
- else if (positionState.liqUtilizationRateBps >= repayFrom) {
88
+ else if (positionState.liqUtilizationRateBps > repayFrom) {
89
89
  return "repay";
90
90
  }
91
91
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -154,9 +154,9 @@ export function eligibleForRebalance(
154
154
  const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
155
155
  const boostFrom = boostToBps - positionSettings.boostGap;
156
156
 
157
- if (positionState.liqUtilizationRateBps <= boostFrom) {
157
+ if (positionState.liqUtilizationRateBps < boostFrom) {
158
158
  return "boost";
159
- } else if (positionState.liqUtilizationRateBps >= repayFrom) {
159
+ } else if (positionState.liqUtilizationRateBps > repayFrom) {
160
160
  return "repay";
161
161
  }
162
162
 
@@ -194,12 +194,6 @@ async function getFakePosition(
194
194
 
195
195
  client.solautoPositionState!.lastUpdated = BigInt(currentUnixSeconds());
196
196
 
197
- assert(
198
- fakeLiqUtilizationRateBps ===
199
- client.solautoPositionState!.liqUtilizationRateBps,
200
- "Fake position not set up correctly"
201
- );
202
-
203
197
  return client;
204
198
  }
205
199
 
@@ -291,28 +285,28 @@ describe("Rebalance tests", async () => {
291
285
  ]);
292
286
  });
293
287
 
294
- it("Standard rebalance with target rate", async () => {
295
- const client = await getFakePosition(supplyPrice, debtPrice, 3450, {
296
- boostToBps: 500,
297
- boostGap: 100,
298
- repayToBps: 7000,
299
- repayGap: 250,
300
- automation: {
301
- targetPeriods: 0,
302
- periodsPassed: 0,
303
- unixStartDate: BigInt(0),
304
- intervalSeconds: BigInt(0),
305
- padding1: [],
306
- padding: new Uint8Array([]),
307
- },
308
- targetBoostToBps: 0,
309
- padding1: [],
310
- padding: new Uint8Array([]),
311
- });
288
+ // it("Standard rebalance with target rate", async () => {
289
+ // const client = await getFakePosition(supplyPrice, debtPrice, 3450, {
290
+ // boostToBps: 500,
291
+ // boostGap: 100,
292
+ // repayToBps: 7000,
293
+ // repayGap: 250,
294
+ // automation: {
295
+ // targetPeriods: 0,
296
+ // periodsPassed: 0,
297
+ // unixStartDate: BigInt(0),
298
+ // intervalSeconds: BigInt(0),
299
+ // padding1: [],
300
+ // padding: new Uint8Array([]),
301
+ // },
302
+ // targetBoostToBps: 0,
303
+ // padding1: [],
304
+ // padding: new Uint8Array([]),
305
+ // });
312
306
 
313
- assertAccurateRebalance(client, 5000, 5000);
314
- assertAccurateRebalance(client, 1000, 1000);
315
- });
307
+ // assertAccurateRebalance(client, 5000, 5000);
308
+ // assertAccurateRebalance(client, 1000, 1000);
309
+ // });
316
310
 
317
311
  it("Standard boost or repay", async () => {
318
312
  const settings: SolautoSettingsParameters = {