@haven-fi/solauto-sdk 1.0.69 → 1.0.70

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Account, Context, Pda, PublicKey, RpcAccount, RpcGetAccountOptions, RpcGetAccountsOptions } from '@metaplex-foundation/umi';
9
9
  import { Serializer } from '@metaplex-foundation/umi/serializers';
10
- import { PodBool, PodBoolArgs, PositionData, PositionDataArgs, PositionState, PositionStateArgs, RebalanceData, RebalanceDataArgs } from '../types';
10
+ import { FeeType, FeeTypeArgs, PodBool, PodBoolArgs, PositionData, PositionDataArgs, PositionState, PositionStateArgs, RebalanceData, RebalanceDataArgs } from '../types';
11
11
  export type SolautoPosition = Account<SolautoPositionAccountData>;
12
12
  export type SolautoPositionAccountData = {
13
13
  bump: Array<number>;
@@ -18,6 +18,8 @@ export type SolautoPositionAccountData = {
18
18
  position: PositionData;
19
19
  state: PositionState;
20
20
  rebalance: RebalanceData;
21
+ feeType: FeeType;
22
+ padding2: Array<number>;
21
23
  padding: Array<number>;
22
24
  };
23
25
  export type SolautoPositionAccountDataArgs = {
@@ -29,6 +31,8 @@ export type SolautoPositionAccountDataArgs = {
29
31
  position: PositionDataArgs;
30
32
  state: PositionStateArgs;
31
33
  rebalance: RebalanceDataArgs;
34
+ feeType: FeeTypeArgs;
35
+ padding2: Array<number>;
32
36
  padding: Array<number>;
33
37
  };
34
38
  export declare function getSolautoPositionAccountDataSerializer(): Serializer<SolautoPositionAccountDataArgs, SolautoPositionAccountData>;
@@ -46,6 +50,8 @@ export declare function getSolautoPositionGpaBuilder(context: Pick<Context, 'rpc
46
50
  position: PositionDataArgs;
47
51
  state: PositionStateArgs;
48
52
  rebalance: RebalanceDataArgs;
53
+ feeType: FeeTypeArgs;
54
+ padding2: Array<number>;
49
55
  padding: Array<number>;
50
56
  }>;
51
57
  export declare function getSolautoPositionSize(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"solautoPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/solautoPosition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E/C"}
1
+ {"version":3,"file":"solautoPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/solautoPosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EAKtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EAMlB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAElE,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAA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AE,KAAK,GAAG,UAAU,CAAC;UAQhC,KAAK,CAAC,MAAM,CAAC;gBACP,KAAK,CAAC,MAAM,CAAC;iBACZ,WAAW;cACd,KAAK,CAAC,MAAM,CAAC;eACZ,SAAS;cACV,gBAAgB;WACnB,iBAAiB;eACb,iBAAiB;aACnB,WAAW;cACV,KAAK,CAAC,MAAM,CAAC;aACd,KAAK,CAAC,MAAM,CAAC;GAiB3B;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
@@ -28,7 +28,9 @@ function getSolautoPositionAccountDataSerializer() {
28
28
  ['position', (0, types_1.getPositionDataSerializer)()],
29
29
  ['state', (0, types_1.getPositionStateSerializer)()],
30
30
  ['rebalance', (0, types_1.getRebalanceDataSerializer)()],
31
- ['padding', (0, serializers_1.array)((0, serializers_1.u32)(), { size: 32 })],
31
+ ['feeType', (0, types_1.getFeeTypeSerializer)()],
32
+ ['padding2', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 7 })],
33
+ ['padding', (0, serializers_1.array)((0, serializers_1.u32)(), { size: 30 })],
32
34
  ], { description: 'SolautoPositionAccountData' });
33
35
  }
34
36
  function deserializeSolautoPosition(rawAccount) {
@@ -68,7 +70,9 @@ function getSolautoPositionGpaBuilder(context) {
68
70
  position: [40, (0, types_1.getPositionDataSerializer)()],
69
71
  state: [360, (0, types_1.getPositionStateSerializer)()],
70
72
  rebalance: [648, (0, types_1.getRebalanceDataSerializer)()],
71
- padding: [704, (0, serializers_1.array)((0, serializers_1.u32)(), { size: 32 })],
73
+ feeType: [704, (0, types_1.getFeeTypeSerializer)()],
74
+ padding2: [705, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 7 })],
75
+ padding: [712, (0, serializers_1.array)((0, serializers_1.u32)(), { size: 30 })],
72
76
  })
73
77
  .deserializeUsing((account) => deserializeSolautoPosition(account));
74
78
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the kinobi library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun kinobi to update it.
5
+ *
6
+ * @see https://github.com/metaplex-foundation/kinobi
7
+ */
8
+ import { Serializer } from '@metaplex-foundation/umi/serializers';
9
+ export declare enum FeeType {
10
+ Small = 0,
11
+ Default = 1
12
+ }
13
+ export type FeeTypeArgs = FeeType;
14
+ export declare function getFeeTypeSerializer(): Serializer<FeeTypeArgs, FeeType>;
15
+ //# sourceMappingURL=feeType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feeType.d.ts","sourceRoot":"","sources":["../../../src/generated/types/feeType.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,OAAO;IACjB,KAAK,IAAA;IACL,OAAO,IAAA;CACR;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,IAAI,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAKvE"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the kinobi library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun kinobi to update it.
6
+ *
7
+ * @see https://github.com/metaplex-foundation/kinobi
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.FeeType = void 0;
11
+ exports.getFeeTypeSerializer = getFeeTypeSerializer;
12
+ const serializers_1 = require("@metaplex-foundation/umi/serializers");
13
+ var FeeType;
14
+ (function (FeeType) {
15
+ FeeType[FeeType["Small"] = 0] = "Small";
16
+ FeeType[FeeType["Default"] = 1] = "Default";
17
+ })(FeeType || (exports.FeeType = FeeType = {}));
18
+ function getFeeTypeSerializer() {
19
+ return (0, serializers_1.scalarEnum)(FeeType, { description: 'FeeType' });
20
+ }
@@ -9,6 +9,7 @@ export * from './automationSettings';
9
9
  export * from './automationSettingsInp';
10
10
  export * from './dCASettings';
11
11
  export * from './dCASettingsInp';
12
+ export * from './feeType';
12
13
  export * from './lendingPlatform';
13
14
  export * from './podBool';
14
15
  export * from './positionData';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -25,6 +25,7 @@ __exportStar(require("./automationSettings"), exports);
25
25
  __exportStar(require("./automationSettingsInp"), exports);
26
26
  __exportStar(require("./dCASettings"), exports);
27
27
  __exportStar(require("./dCASettingsInp"), exports);
28
+ __exportStar(require("./feeType"), exports);
28
29
  __exportStar(require("./lendingPlatform"), exports);
29
30
  __exportStar(require("./podBool"), exports);
30
31
  __exportStar(require("./positionData"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,OAAO,IAAI,eAAe,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,aAAa,EASd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAuMzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA8G7B;AAkLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA4BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA0HA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CA8BzC"}
1
+ {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,OAAO,IAAI,eAAe,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,aAAa,EASd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAuMzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA8G7B;AAkLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA4BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA2HA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CA8BzC"}
@@ -329,7 +329,7 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
329
329
  client.log("Not eligible for a rebalance");
330
330
  return undefined;
331
331
  }
332
- const values = (0, rebalanceUtils_1.getRebalanceValues)(client.solautoPositionState, client.solautoPositionSettings(), client.solautoPositionActiveDca(), (0, generalUtils_1.currentUnixSeconds)(), constants_1.PRICES[client.supplyMint.toString()].price, constants_1.PRICES[client.debtMint.toString()].price, targetLiqUtilizationRateBps);
332
+ const values = (0, rebalanceUtils_1.getRebalanceValues)(client.solautoPositionState, client.solautoPositionSettings(), client.solautoPositionActiveDca(), client.solautoPositionData.feeType, (0, generalUtils_1.currentUnixSeconds)(), constants_1.PRICES[client.supplyMint.toString()].price, constants_1.PRICES[client.debtMint.toString()].price, targetLiqUtilizationRateBps);
333
333
  client.log("Rebalance values: ", values);
334
334
  const swapDetails = (0, rebalanceUtils_1.getJupSwapRebalanceDetails)(client, values, targetLiqUtilizationRateBps, attemptNum);
335
335
  const { jupQuote, lookupTableAddresses, setupInstructions, tokenLedgerIx, swapIx, } = await (0, jupiterUtils_1.getJupSwapTransaction)(client.signer, swapDetails, attemptNum);
@@ -1,3 +1,4 @@
1
+ import { FeeType } from "../generated";
1
2
  export declare function getLiqUtilzationRateBps(supplyUsd: number, debtUsd: number, liqThresholdBps: number): number;
2
3
  export declare function toBaseUnit(value: number, decimals: number): bigint;
3
4
  export declare function fromBaseUnit(value: bigint, decimals: number): number;
@@ -6,7 +7,7 @@ export declare function toBps(value: number): number;
6
7
  export declare function bytesToI80F48(bytes: number[]): number;
7
8
  export declare function uint8ArrayToBigInt(uint8Array: Uint8Array): bigint;
8
9
  export declare function getDebtAdjustmentUsd(liqThresholdBps: number, supplyUsd: number, debtUsd: number, targetLiqUtilizationRateBps: number, adjustmentFeeBps?: number): number;
9
- export declare function getSolautoFeesBps(isReferred: boolean, selfManaged: boolean, positionNetWorthUsd: number): {
10
+ export declare function getSolautoFeesBps(isReferred: boolean, feeType: FeeType, positionNetWorthUsd: number): {
10
11
  solauto: number;
11
12
  referrer: number;
12
13
  total: number;
@@ -1 +1 @@
1
- {"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,eAAe,E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zE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE"}
@@ -14,6 +14,7 @@ exports.maxBoostToBps = maxBoostToBps;
14
14
  exports.maxRepayFromBps = maxRepayFromBps;
15
15
  exports.maxRepayToBps = maxRepayToBps;
16
16
  const constants_1 = require("../constants");
17
+ const generated_1 = require("../generated");
17
18
  function getLiqUtilzationRateBps(supplyUsd, debtUsd, liqThresholdBps) {
18
19
  if (supplyUsd === 0) {
19
20
  return 0;
@@ -66,13 +67,13 @@ function getDebtAdjustmentUsd(liqThresholdBps, supplyUsd, debtUsd, targetLiqUtil
66
67
  (1 - targetLiqUtilizationRate * (1 - adjustmentFee) * liqThreshold);
67
68
  return debtAdjustmentUsd;
68
69
  }
69
- function getSolautoFeesBps(isReferred, selfManaged, positionNetWorthUsd) {
70
+ function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
70
71
  const minSize = 10000; // Minimum position size
71
72
  const maxSize = 1000000; // Maximum position size
72
73
  const maxFeeBps = 500; // Fee in basis points for minSize (5%)
73
74
  const minFeeBps = 100; // Fee in basis points for maxSize (1%)
74
75
  let feeBps = 0;
75
- if (selfManaged) {
76
+ if (feeType === generated_1.FeeType.Small) {
76
77
  feeBps = 100;
77
78
  }
78
79
  else if (positionNetWorthUsd <= minSize) {
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { SolautoClient } from "../../clients/solautoClient";
3
- import { DCASettings, PositionState, SolautoSettingsParameters } from "../../generated";
3
+ import { DCASettings, FeeType, PositionState, SolautoSettingsParameters } from "../../generated";
4
4
  import { QuoteResponse } from "@jup-ag/api";
5
5
  import { JupSwapDetails } from "../jupiterUtils";
6
6
  export interface RebalanceValues {
@@ -9,7 +9,7 @@ export interface RebalanceValues {
9
9
  amountToDcaIn: number;
10
10
  amountUsdToDcaIn: number;
11
11
  }
12
- export declare function getRebalanceValues(state: PositionState, settings: SolautoSettingsParameters | undefined, dca: DCASettings | undefined, currentUnixTime: number, supplyPrice: number, debtPrice: number, targetLiqUtilizationRateBps?: number, limitGapBps?: number): RebalanceValues;
12
+ export declare function getRebalanceValues(state: PositionState, settings: SolautoSettingsParameters | undefined, dca: DCASettings | undefined, feeType: FeeType, currentUnixTime: number, supplyPrice: number, debtPrice: number, targetLiqUtilizationRateBps?: number, limitGapBps?: number): RebalanceValues;
13
13
  export interface FlashLoanDetails {
14
14
  baseUnitAmount: bigint;
15
15
  mint: PublicKey;
@@ -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,CA0EjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;C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;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"}
@@ -79,7 +79,7 @@ function getTargetRateAndDcaAmount(state, settings, dca, currentUnixTime, target
79
79
  };
80
80
  }
81
81
  }
82
- function getRebalanceValues(state, settings, dca, currentUnixTime, supplyPrice, debtPrice, targetLiqUtilizationRateBps, limitGapBps) {
82
+ function getRebalanceValues(state, settings, dca, feeType, currentUnixTime, supplyPrice, debtPrice, targetLiqUtilizationRateBps, limitGapBps) {
83
83
  if (state === undefined ||
84
84
  state.lastUpdated <
85
85
  BigInt(Math.round((0, generalUtils_2.currentUnixSeconds)() - solautoConstants_1.MIN_POSITION_STATE_FRESHNESS_SECS))) {
@@ -91,7 +91,7 @@ function getRebalanceValues(state, settings, dca, currentUnixTime, supplyPrice,
91
91
  const increasingLeverage = amountUsdToDcaIn > 0 || state.liqUtilizationRateBps < targetRateBps;
92
92
  let adjustmentFeeBps = 0;
93
93
  if (increasingLeverage) {
94
- adjustmentFeeBps = (0, numberUtils_1.getSolautoFeesBps)(false, settings === undefined, (0, numberUtils_1.fromBaseUnit)(state.netWorth.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS)).total;
94
+ adjustmentFeeBps = (0, numberUtils_1.getSolautoFeesBps)(false, feeType, (0, numberUtils_1.fromBaseUnit)(state.netWorth.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS)).total;
95
95
  }
96
96
  const supplyUsd = (0, numberUtils_1.fromBaseUnit)(state.supply.amountUsed.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS) +
97
97
  amountUsdToDcaIn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
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",
@@ -28,6 +28,8 @@ import {
28
28
  u8,
29
29
  } from '@metaplex-foundation/umi/serializers';
30
30
  import {
31
+ FeeType,
32
+ FeeTypeArgs,
31
33
  PodBool,
32
34
  PodBoolArgs,
33
35
  PositionData,
@@ -36,6 +38,7 @@ import {
36
38
  PositionStateArgs,
37
39
  RebalanceData,
38
40
  RebalanceDataArgs,
41
+ getFeeTypeSerializer,
39
42
  getPodBoolSerializer,
40
43
  getPositionDataSerializer,
41
44
  getPositionStateSerializer,
@@ -53,6 +56,8 @@ export type SolautoPositionAccountData = {
53
56
  position: PositionData;
54
57
  state: PositionState;
55
58
  rebalance: RebalanceData;
59
+ feeType: FeeType;
60
+ padding2: Array<number>;
56
61
  padding: Array<number>;
57
62
  };
58
63
 
@@ -65,6 +70,8 @@ export type SolautoPositionAccountDataArgs = {
65
70
  position: PositionDataArgs;
66
71
  state: PositionStateArgs;
67
72
  rebalance: RebalanceDataArgs;
73
+ feeType: FeeTypeArgs;
74
+ padding2: Array<number>;
68
75
  padding: Array<number>;
69
76
  };
70
77
 
@@ -82,7 +89,9 @@ export function getSolautoPositionAccountDataSerializer(): Serializer<
82
89
  ['position', getPositionDataSerializer()],
83
90
  ['state', getPositionStateSerializer()],
84
91
  ['rebalance', getRebalanceDataSerializer()],
85
- ['padding', array(u32(), { size: 32 })],
92
+ ['feeType', getFeeTypeSerializer()],
93
+ ['padding2', array(u8(), { size: 7 })],
94
+ ['padding', array(u32(), { size: 30 })],
86
95
  ],
87
96
  { description: 'SolautoPositionAccountData' }
88
97
  ) as Serializer<SolautoPositionAccountDataArgs, SolautoPositionAccountData>;
@@ -170,6 +179,8 @@ export function getSolautoPositionGpaBuilder(
170
179
  position: PositionDataArgs;
171
180
  state: PositionStateArgs;
172
181
  rebalance: RebalanceDataArgs;
182
+ feeType: FeeTypeArgs;
183
+ padding2: Array<number>;
173
184
  padding: Array<number>;
174
185
  }>({
175
186
  bump: [0, array(u8(), { size: 1 })],
@@ -180,7 +191,9 @@ export function getSolautoPositionGpaBuilder(
180
191
  position: [40, getPositionDataSerializer()],
181
192
  state: [360, getPositionStateSerializer()],
182
193
  rebalance: [648, getRebalanceDataSerializer()],
183
- padding: [704, array(u32(), { size: 32 })],
194
+ feeType: [704, getFeeTypeSerializer()],
195
+ padding2: [705, array(u8(), { size: 7 })],
196
+ padding: [712, array(u32(), { size: 30 })],
184
197
  })
185
198
  .deserializeUsing<SolautoPosition>((account) =>
186
199
  deserializeSolautoPosition(account)
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the kinobi library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun kinobi to update it.
5
+ *
6
+ * @see https://github.com/metaplex-foundation/kinobi
7
+ */
8
+
9
+ import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';
10
+
11
+ export enum FeeType {
12
+ Small,
13
+ Default,
14
+ }
15
+
16
+ export type FeeTypeArgs = FeeType;
17
+
18
+ export function getFeeTypeSerializer(): Serializer<FeeTypeArgs, FeeType> {
19
+ return scalarEnum<FeeType>(FeeType, { description: 'FeeType' }) as Serializer<
20
+ FeeTypeArgs,
21
+ FeeType
22
+ >;
23
+ }
@@ -10,6 +10,7 @@ export * from './automationSettings';
10
10
  export * from './automationSettingsInp';
11
11
  export * from './dCASettings';
12
12
  export * from './dCASettingsInp';
13
+ export * from './feeType';
13
14
  export * from './lendingPlatform';
14
15
  export * from './podBool';
15
16
  export * from './positionData';
@@ -580,6 +580,7 @@ export async function buildSolautoRebalanceTransaction(
580
580
  client.solautoPositionState!,
581
581
  client.solautoPositionSettings(),
582
582
  client.solautoPositionActiveDca(),
583
+ client.solautoPositionData!.feeType,
583
584
  currentUnixSeconds(),
584
585
  PRICES[client.supplyMint.toString()].price,
585
586
  PRICES[client.debtMint.toString()].price,
@@ -1,4 +1,5 @@
1
1
  import { MAX_REPAY_GAP_BPS } from "../constants";
2
+ import { FeeType } from "../generated";
2
3
 
3
4
  export function getLiqUtilzationRateBps(
4
5
  supplyUsd: number,
@@ -88,7 +89,7 @@ export function getDebtAdjustmentUsd(
88
89
 
89
90
  export function getSolautoFeesBps(
90
91
  isReferred: boolean,
91
- selfManaged: boolean,
92
+ feeType: FeeType,
92
93
  positionNetWorthUsd: number
93
94
  ): {
94
95
  solauto: number;
@@ -101,7 +102,7 @@ export function getSolautoFeesBps(
101
102
  const minFeeBps = 100; // Fee in basis points for maxSize (1%)
102
103
 
103
104
  let feeBps: number = 0;
104
- if (selfManaged) {
105
+ if (feeType === FeeType.Small) {
105
106
  feeBps = 100;
106
107
  } else if (positionNetWorthUsd <= minSize) {
107
108
  feeBps = maxFeeBps;
@@ -2,6 +2,7 @@ import { PublicKey } from "@solana/web3.js";
2
2
  import { SolautoClient } from "../../clients/solautoClient";
3
3
  import {
4
4
  DCASettings,
5
+ FeeType,
5
6
  PositionState,
6
7
  PositionTokenUsage,
7
8
  SolautoSettingsParameters,
@@ -170,6 +171,7 @@ export function getRebalanceValues(
170
171
  state: PositionState,
171
172
  settings: SolautoSettingsParameters | undefined,
172
173
  dca: DCASettings | undefined,
174
+ feeType: FeeType,
173
175
  currentUnixTime: number,
174
176
  supplyPrice: number,
175
177
  debtPrice: number,
@@ -204,7 +206,7 @@ export function getRebalanceValues(
204
206
  if (increasingLeverage) {
205
207
  adjustmentFeeBps = getSolautoFeesBps(
206
208
  false,
207
- settings === undefined,
209
+ feeType,
208
210
  fromBaseUnit(state.netWorth.baseAmountUsdValue, USD_DECIMALS)
209
211
  ).total;
210
212
  }
@@ -5,12 +5,11 @@ import {
5
5
  SolautoMarginfiClient,
6
6
  } from "../../src/clients/solautoMarginfiClient";
7
7
  import {
8
- LendingPlatform,
9
8
  solautoAction,
10
9
  SolautoSettingsParametersInpArgs,
11
10
  } from "../../src/generated";
12
11
  import { buildSolautoRebalanceTransaction } from "../../src/transactions/transactionUtils";
13
- import { getMaxLiqUtilizationRateBps, toBaseUnit } from "../../src/utils/numberUtils";
12
+ import { maxBoostToBps, maxRepayFromBps, maxRepayToBps, toBaseUnit } from "../../src/utils/numberUtils";
14
13
  import { NATIVE_MINT } from "@solana/spl-token";
15
14
  import { getTokenPrices } from "../../src/utils/generalUtils";
16
15
  import {
@@ -21,12 +20,12 @@ import { PublicKey } from "@solana/web3.js";
21
20
  import { USDC_MINT } from "../../src/constants";
22
21
 
23
22
  describe("Solauto Marginfi tests", async () => {
24
- // const signer = setupTest();
25
- const signer = setupTest("solauto-manager");
23
+ const signer = setupTest();
24
+ // const signer = setupTest("solauto-manager");
26
25
 
27
26
  const payForTransactions = false;
28
27
  const useJitoBundle = false;
29
- const positionId = 1;
28
+ const positionId = 2;
30
29
 
31
30
  it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
32
31
  const client = new SolautoMarginfiClient(process.env.HELIUS_API_KEY!, true);
@@ -67,22 +66,26 @@ describe("Solauto Marginfi tests", async () => {
67
66
  // }, "open position")
68
67
  // );
69
68
 
70
- // const initialSupplyUsd = 50;
71
- // transactionItems.push(
72
- // new TransactionItem(async () => {
73
- // const [supplyPrice] = await getTokenPrices([supply]);
74
- // return {
75
- // tx: client.protocolInteraction(
76
- // solautoAction("Deposit", [
77
- // toBaseUnit(initialSupplyUsd / supplyPrice, supplyDecimals),
78
- // ])
79
- // ),
80
- // };
81
- // }, "deposit")
82
- // );
69
+ // const initialSupplyUsd = 150;
70
+ // transactionItems.push(
71
+ // new TransactionItem(async () => {
72
+ // const [supplyPrice] = await getTokenPrices([supply]);
73
+ // return {
74
+ // tx: client.protocolInteraction(
75
+ // solautoAction("Deposit", [
76
+ // toBaseUnit(initialSupplyUsd / supplyPrice, supplyDecimals),
77
+ // ])
78
+ // ),
79
+ // };
80
+ // }, "deposit")
81
+ // );
83
82
  // }
84
83
 
85
- // const maxLiqRate = getMaxLiqUtilizationRateBps(client.solautoPositionState!.maxLtvBps, client.solautoPositionState!.liqThresholdBps);
84
+ // const maxLtvBps = client.solautoPositionState!.maxLtvBps;
85
+ // const liqThresholdBps = client.solautoPositionState!.liqThresholdBps;
86
+ // const maxRepayFrom = maxRepayFromBps(maxLtvBps, liqThresholdBps);
87
+ // const maxRepayTo = maxRepayToBps(maxLtvBps, liqThresholdBps);
88
+ // const maxBoostTo = maxBoostToBps(maxLtvBps, liqThresholdBps);
86
89
  // transactionItems.push(
87
90
  // new TransactionItem(
88
91
  // async () => ({
@@ -90,10 +93,10 @@ describe("Solauto Marginfi tests", async () => {
90
93
  // positionId: client.positionId,
91
94
  // settingParams: some({
92
95
  // ...settingParams,
96
+ // boostToBps: maxBoostTo,
93
97
  // boostGap: 50,
94
- // boostToBps: maxLiqRate,
95
- // repayGap: 100,
96
- // repayToBps: maxLiqRate
98
+ // repayToBps: maxRepayTo,
99
+ // repayGap: maxRepayFrom - maxRepayTo
97
100
  // }),
98
101
  // dca: null,
99
102
  // }),
@@ -9,6 +9,7 @@ import { publicKey } from "@metaplex-foundation/umi";
9
9
  import { SolautoClient } from "../../src/clients/solautoClient";
10
10
  import {
11
11
  DCASettings,
12
+ FeeType,
12
13
  LendingPlatform,
13
14
  SolautoRebalanceType,
14
15
  SolautoSettingsParameters,
@@ -48,6 +49,7 @@ function assertAccurateRebalance(
48
49
  client.solautoPositionState!,
49
50
  client.solautoPositionSettings(),
50
51
  client.solautoPositionActiveDca(),
52
+ client.solautoPositionData!.feeType,
51
53
  currentUnixSeconds(),
52
54
  PRICES[client.supplyMint.toString()].price,
53
55
  PRICES[client.debtMint.toString()].price,
@@ -58,7 +60,7 @@ function assertAccurateRebalance(
58
60
  if (increasingLeverage) {
59
61
  adjustmentFeeBps = getSolautoFeesBps(
60
62
  client.referredByState !== undefined,
61
- client.selfManaged,
63
+ client.solautoPositionData!.feeType,
62
64
  fromBaseUnit(
63
65
  client.solautoPositionState?.netWorth.baseAmountUsdValue ?? BigInt(0),
64
66
  USD_DECIMALS
@@ -178,7 +180,9 @@ async function getFakePosition(
178
180
  padding2: [],
179
181
  padding: new Uint8Array([]),
180
182
  },
183
+ feeType: FeeType.Default,
181
184
  padding1: [],
185
+ padding2: [],
182
186
  padding: [],
183
187
  publicKey: publicKey(PublicKey.default),
184
188
  header: {