@strkfarm/sdk 2.0.0-dev.22 → 2.0.0-dev.23

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.
@@ -28726,6 +28726,7 @@ ${r2}}` : "}", l2;
28726
28726
  calculateBTCPriceDelta: () => calculateBTCPriceDelta,
28727
28727
  calculateDebtAmount: () => calculateDebtAmount,
28728
28728
  calculateDebtReductionAmountForWithdrawal: () => calculateDebtReductionAmountForWithdrawal,
28729
+ calculateDeltaDebtAmount: () => calculateDeltaDebtAmount,
28729
28730
  calculateExposureDelta: () => calculateExposureDelta,
28730
28731
  calculateExtendedLevergae: () => calculateExtendedLevergae,
28731
28732
  calculateVesUPositionSizeGivenExtended: () => calculateVesUPositionSizeGivenExtended,
@@ -68192,10 +68193,10 @@ ${JSON.stringify(data, null, 2)}`;
68192
68193
  return old;
68193
68194
  }
68194
68195
 
68195
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/version.js
68196
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/version.js
68196
68197
  var version4 = "3.11.8";
68197
68198
 
68198
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/globals/maybe.js
68199
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/globals/maybe.js
68199
68200
  function maybe(thunk) {
68200
68201
  try {
68201
68202
  return thunk();
@@ -68203,7 +68204,7 @@ ${JSON.stringify(data, null, 2)}`;
68203
68204
  }
68204
68205
  }
68205
68206
 
68206
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/globals/global.js
68207
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/globals/global.js
68207
68208
  var global_default = maybe(function() {
68208
68209
  return globalThis;
68209
68210
  }) || maybe(function() {
@@ -68222,7 +68223,7 @@ ${JSON.stringify(data, null, 2)}`;
68222
68223
  return maybe.constructor("return this")();
68223
68224
  });
68224
68225
 
68225
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/makeUniqueId.js
68226
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/makeUniqueId.js
68226
68227
  var prefixCounts = /* @__PURE__ */ new Map();
68227
68228
  function makeUniqueId(prefix) {
68228
68229
  var count = prefixCounts.get(prefix) || 1;
@@ -68230,7 +68231,7 @@ ${JSON.stringify(data, null, 2)}`;
68230
68231
  return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
68231
68232
  }
68232
68233
 
68233
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js
68234
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js
68234
68235
  function stringifyForDisplay(value, space) {
68235
68236
  if (space === void 0) {
68236
68237
  space = 0;
@@ -68241,7 +68242,7 @@ ${JSON.stringify(data, null, 2)}`;
68241
68242
  }, space).split(JSON.stringify(undefId)).join("<undefined>");
68242
68243
  }
68243
68244
 
68244
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/globals/invariantWrappers.js
68245
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/globals/invariantWrappers.js
68245
68246
  function wrap(fn) {
68246
68247
  return function(message) {
68247
68248
  var args = [];
@@ -68312,7 +68313,7 @@ ${JSON.stringify(data, null, 2)}`;
68312
68313
  })));
68313
68314
  }
68314
68315
 
68315
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/globals/index.js
68316
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/globals/index.js
68316
68317
  var DEV = globalThis.__DEV__ !== false;
68317
68318
 
68318
68319
  // node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/devAssert.mjs
@@ -71387,7 +71388,7 @@ spurious results.`);
71387
71388
  return node.kind === Kind.FIELD || node.kind === Kind.FRAGMENT_SPREAD || node.kind === Kind.INLINE_FRAGMENT;
71388
71389
  }
71389
71390
 
71390
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/directives.js
71391
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/directives.js
71391
71392
  function shouldInclude(_a21, variables) {
71392
71393
  var directives = _a21.directives;
71393
71394
  if (!directives || !directives.length) {
@@ -71515,7 +71516,7 @@ spurious results.`);
71515
71516
  return false;
71516
71517
  }
71517
71518
 
71518
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/canUse.js
71519
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/canUse.js
71519
71520
  var isReactNative = maybe(function() {
71520
71521
  return navigator.product;
71521
71522
  }) == "ReactNative";
@@ -71540,12 +71541,12 @@ spurious results.`);
71540
71541
  }) || false
71541
71542
  );
71542
71543
 
71543
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/objects.js
71544
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/objects.js
71544
71545
  function isNonNullObject(obj) {
71545
71546
  return obj !== null && typeof obj === "object";
71546
71547
  }
71547
71548
 
71548
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/fragments.js
71549
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/fragments.js
71549
71550
  function getFragmentQueryDocument(document2, fragmentName) {
71550
71551
  var actualFragmentName = fragmentName;
71551
71552
  var fragments = [];
@@ -71841,7 +71842,7 @@ spurious results.`);
71841
71842
  }
71842
71843
  };
71843
71844
 
71844
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/caching/caches.js
71845
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/caching/caches.js
71845
71846
  var scheduledCleanup = /* @__PURE__ */ new WeakSet();
71846
71847
  function schedule(cache) {
71847
71848
  if (cache.size <= (cache.max || -1)) {
@@ -71874,11 +71875,11 @@ spurious results.`);
71874
71875
  return cache;
71875
71876
  };
71876
71877
 
71877
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/caching/sizes.js
71878
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/caching/sizes.js
71878
71879
  var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
71879
71880
  var cacheSizes = __assign({}, global_default[cacheSizeSymbol]);
71880
71881
 
71881
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js
71882
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js
71882
71883
  var globalCaches = {};
71883
71884
  function registerGlobalCache(name, getSize) {
71884
71885
  globalCaches[name] = getSize;
@@ -71968,7 +71969,7 @@ spurious results.`);
71968
71969
  ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined) : [];
71969
71970
  }
71970
71971
 
71971
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/canonicalStringify.js
71972
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/canonicalStringify.js
71972
71973
  var canonicalStringify = Object.assign(function canonicalStringify2(value) {
71973
71974
  return JSON.stringify(value, stableObjectReplacer);
71974
71975
  }, {
@@ -72015,7 +72016,7 @@ spurious results.`);
72015
72016
  return i === 0 || keys[i - 1] <= key;
72016
72017
  }
72017
72018
 
72018
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/storeUtils.js
72019
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/storeUtils.js
72019
72020
  function makeReference(id) {
72020
72021
  return { __ref: String(id) };
72021
72022
  }
@@ -72200,7 +72201,7 @@ spurious results.`);
72200
72201
  return selection.kind === "InlineFragment";
72201
72202
  }
72202
72203
 
72203
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/getFromAST.js
72204
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/getFromAST.js
72204
72205
  function checkDocument(doc) {
72205
72206
  invariant2(doc && doc.kind === "Document", 77);
72206
72207
  var operations = doc.definitions.filter(function(d) {
@@ -72759,7 +72760,7 @@ spurious results.`);
72759
72760
  return Object.freeze(optimistic);
72760
72761
  }
72761
72762
 
72762
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js
72763
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js
72763
72764
  function identity(document2) {
72764
72765
  return document2;
72765
72766
  }
@@ -72843,7 +72844,7 @@ spurious results.`);
72843
72844
  })()
72844
72845
  );
72845
72846
 
72846
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/print.js
72847
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/print.js
72847
72848
  var printCache;
72848
72849
  var print2 = Object.assign(function(ast) {
72849
72850
  var result2 = printCache.get(ast);
@@ -72867,13 +72868,13 @@ spurious results.`);
72867
72868
  });
72868
72869
  }
72869
72870
 
72870
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/arrays.js
72871
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/arrays.js
72871
72872
  var isArray2 = Array.isArray;
72872
72873
  function isNonEmptyArray(value) {
72873
72874
  return Array.isArray(value) && value.length > 0;
72874
72875
  }
72875
72876
 
72876
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/graphql/transform.js
72877
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/graphql/transform.js
72877
72878
  var TYPENAME_FIELD = {
72878
72879
  kind: Kind.FIELD,
72879
72880
  name: {
@@ -73165,7 +73166,7 @@ spurious results.`);
73165
73166
  return modifiedDoc;
73166
73167
  }
73167
73168
 
73168
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/mergeDeep.js
73169
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/mergeDeep.js
73169
73170
  var hasOwnProperty4 = Object.prototype.hasOwnProperty;
73170
73171
  function mergeDeep() {
73171
73172
  var sources = [];
@@ -73801,7 +73802,7 @@ spurious results.`);
73801
73802
  }
73802
73803
  var result = symbolObservablePonyfill(root);
73803
73804
 
73804
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/observables/Observable.js
73805
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/observables/Observable.js
73805
73806
  var prototype2 = Observable.prototype;
73806
73807
  var fakeObsSymbol = "@@observable";
73807
73808
  if (!prototype2[fakeObsSymbol]) {
@@ -73810,7 +73811,7 @@ spurious results.`);
73810
73811
  };
73811
73812
  }
73812
73813
 
73813
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/cloneDeep.js
73814
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/cloneDeep.js
73814
73815
  var toString4 = Object.prototype.toString;
73815
73816
  function cloneDeep(value) {
73816
73817
  return cloneDeepHelper(value);
@@ -73844,7 +73845,7 @@ spurious results.`);
73844
73845
  }
73845
73846
  }
73846
73847
 
73847
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js
73848
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js
73848
73849
  function deepFreeze(value) {
73849
73850
  var workSet = /* @__PURE__ */ new Set([value]);
73850
73851
  workSet.forEach(function(obj) {
@@ -73876,7 +73877,7 @@ spurious results.`);
73876
73877
  return obj;
73877
73878
  }
73878
73879
 
73879
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/observables/iteration.js
73880
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/observables/iteration.js
73880
73881
  function iterateObserversSafely(observers, method, argument) {
73881
73882
  var observersWithMethod = [];
73882
73883
  observers.forEach(function(obs) {
@@ -73887,7 +73888,7 @@ spurious results.`);
73887
73888
  });
73888
73889
  }
73889
73890
 
73890
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/observables/asyncMap.js
73891
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/observables/asyncMap.js
73891
73892
  function asyncMap(observable, mapFn, catchFn) {
73892
73893
  return new Observable(function(observer) {
73893
73894
  var promiseQueue = {
@@ -73935,7 +73936,7 @@ spurious results.`);
73935
73936
  });
73936
73937
  }
73937
73938
 
73938
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/observables/subclassing.js
73939
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/observables/subclassing.js
73939
73940
  function fixObservableSubclass(subclass) {
73940
73941
  function set(key) {
73941
73942
  Object.defineProperty(subclass, key, { value: Observable });
@@ -73947,7 +73948,7 @@ spurious results.`);
73947
73948
  return subclass;
73948
73949
  }
73949
73950
 
73950
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/observables/Concast.js
73951
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/observables/Concast.js
73951
73952
  function isPromiseLike(value) {
73952
73953
  return value && typeof value.then === "function";
73953
73954
  }
@@ -74088,7 +74089,7 @@ spurious results.`);
74088
74089
  );
74089
74090
  fixObservableSubclass(Concast);
74090
74091
 
74091
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/incrementalResult.js
74092
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/incrementalResult.js
74092
74093
  function isExecutionPatchIncrementalResult(value) {
74093
74094
  return "incremental" in value;
74094
74095
  }
@@ -74120,7 +74121,7 @@ spurious results.`);
74120
74121
  return mergedData;
74121
74122
  }
74122
74123
 
74123
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/errorHandling.js
74124
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/errorHandling.js
74124
74125
  function graphQLResultHasError(result2) {
74125
74126
  var errors2 = getGraphQLErrorsFromResult(result2);
74126
74127
  return isNonEmptyArray(errors2);
@@ -74137,7 +74138,7 @@ spurious results.`);
74137
74138
  return graphQLErrors;
74138
74139
  }
74139
74140
 
74140
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/compact.js
74141
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/compact.js
74141
74142
  function compact() {
74142
74143
  var objects = [];
74143
74144
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -74157,21 +74158,21 @@ spurious results.`);
74157
74158
  return result2;
74158
74159
  }
74159
74160
 
74160
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/utilities/common/mergeOptions.js
74161
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/utilities/common/mergeOptions.js
74161
74162
  function mergeOptions(defaults2, options) {
74162
74163
  return compact(defaults2, options, options.variables && {
74163
74164
  variables: compact(__assign(__assign({}, defaults2 && defaults2.variables), options.variables))
74164
74165
  });
74165
74166
  }
74166
74167
 
74167
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/fromError.js
74168
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/fromError.js
74168
74169
  function fromError(errorValue) {
74169
74170
  return new Observable(function(observer) {
74170
74171
  observer.error(errorValue);
74171
74172
  });
74172
74173
  }
74173
74174
 
74174
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/throwServerError.js
74175
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/throwServerError.js
74175
74176
  var throwServerError = function(response, result2, message) {
74176
74177
  var error2 = new Error(message);
74177
74178
  error2.name = "ServerError";
@@ -74181,7 +74182,7 @@ spurious results.`);
74181
74182
  throw error2;
74182
74183
  };
74183
74184
 
74184
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/validateOperation.js
74185
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/validateOperation.js
74185
74186
  function validateOperation(operation) {
74186
74187
  var OPERATION_FIELDS = [
74187
74188
  "query",
@@ -74199,7 +74200,7 @@ spurious results.`);
74199
74200
  return operation;
74200
74201
  }
74201
74202
 
74202
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/createOperation.js
74203
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/createOperation.js
74203
74204
  function createOperation(starting, operation) {
74204
74205
  var context = __assign({}, starting);
74205
74206
  var setContext = function(next) {
@@ -74223,7 +74224,7 @@ spurious results.`);
74223
74224
  return operation;
74224
74225
  }
74225
74226
 
74226
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/transformOperation.js
74227
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/transformOperation.js
74227
74228
  function transformOperation(operation) {
74228
74229
  var transformedOperation = {
74229
74230
  variables: operation.variables || {},
@@ -74237,7 +74238,7 @@ spurious results.`);
74237
74238
  return transformedOperation;
74238
74239
  }
74239
74240
 
74240
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/utils/filterOperationVariables.js
74241
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/utils/filterOperationVariables.js
74241
74242
  function filterOperationVariables(variables, query) {
74242
74243
  var result2 = __assign({}, variables);
74243
74244
  var unusedNames = new Set(Object.keys(variables));
@@ -74254,7 +74255,7 @@ spurious results.`);
74254
74255
  return result2;
74255
74256
  }
74256
74257
 
74257
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/core/ApolloLink.js
74258
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/core/ApolloLink.js
74258
74259
  function passthrough(op, forward) {
74259
74260
  return forward ? forward(op) : Observable.of();
74260
74261
  }
@@ -74348,10 +74349,10 @@ spurious results.`);
74348
74349
  })()
74349
74350
  );
74350
74351
 
74351
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/core/execute.js
74352
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/core/execute.js
74352
74353
  var execute = ApolloLink.execute;
74353
74354
 
74354
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/iterators/async.js
74355
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/iterators/async.js
74355
74356
  function asyncIterator(source) {
74356
74357
  var _a21;
74357
74358
  var iterator2 = source[Symbol.asyncIterator]();
@@ -74364,7 +74365,7 @@ spurious results.`);
74364
74365
  }, _a21;
74365
74366
  }
74366
74367
 
74367
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/iterators/nodeStream.js
74368
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/iterators/nodeStream.js
74368
74369
  function nodeStreamIterator(stream) {
74369
74370
  var cleanup = null;
74370
74371
  var error2 = null;
@@ -74435,7 +74436,7 @@ spurious results.`);
74435
74436
  return iterator2;
74436
74437
  }
74437
74438
 
74438
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/iterators/promise.js
74439
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/iterators/promise.js
74439
74440
  function promiseIterator(promise) {
74440
74441
  var resolved = false;
74441
74442
  var iterator2 = {
@@ -74461,7 +74462,7 @@ spurious results.`);
74461
74462
  return iterator2;
74462
74463
  }
74463
74464
 
74464
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/iterators/reader.js
74465
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/iterators/reader.js
74465
74466
  function readerIterator(reader) {
74466
74467
  var iterator2 = {
74467
74468
  next: function() {
@@ -74476,7 +74477,7 @@ spurious results.`);
74476
74477
  return iterator2;
74477
74478
  }
74478
74479
 
74479
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/responseIterator.js
74480
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/responseIterator.js
74480
74481
  function isNodeResponse(value) {
74481
74482
  return !!value.body;
74482
74483
  }
@@ -74513,7 +74514,7 @@ spurious results.`);
74513
74514
  throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
74514
74515
  }
74515
74516
 
74516
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/errors/index.js
74517
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/errors/index.js
74517
74518
  var PROTOCOL_ERRORS_SYMBOL = Symbol();
74518
74519
  function graphQLResultHasProtocolErrors(result2) {
74519
74520
  if (result2.extensions) {
@@ -74558,7 +74559,7 @@ spurious results.`);
74558
74559
  })(Error)
74559
74560
  );
74560
74561
 
74561
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js
74562
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js
74562
74563
  var hasOwnProperty5 = Object.prototype.hasOwnProperty;
74563
74564
  function readMultipartBody(response, nextValue) {
74564
74565
  return __awaiter(this, void 0, void 0, function() {
@@ -74702,7 +74703,7 @@ spurious results.`);
74702
74703
  };
74703
74704
  }
74704
74705
 
74705
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/serializeFetchParameter.js
74706
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/serializeFetchParameter.js
74706
74707
  var serializeFetchParameter = function(p, label) {
74707
74708
  var serialized;
74708
74709
  try {
@@ -74715,7 +74716,7 @@ spurious results.`);
74715
74716
  return serialized;
74716
74717
  };
74717
74718
 
74718
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
74719
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
74719
74720
  var defaultHttpOptions = {
74720
74721
  includeQuery: true,
74721
74722
  includeExtensions: false,
@@ -74799,14 +74800,14 @@ spurious results.`);
74799
74800
  return normalizedHeaders;
74800
74801
  }
74801
74802
 
74802
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/checkFetcher.js
74803
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/checkFetcher.js
74803
74804
  var checkFetcher = function(fetcher) {
74804
74805
  if (!fetcher && typeof fetch === "undefined") {
74805
74806
  throw newInvariantError(38);
74806
74807
  }
74807
74808
  };
74808
74809
 
74809
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/selectURI.js
74810
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/selectURI.js
74810
74811
  var selectURI = function(operation, fallbackURI) {
74811
74812
  var context = operation.getContext();
74812
74813
  var contextURI = context.uri;
@@ -74819,7 +74820,7 @@ spurious results.`);
74819
74820
  }
74820
74821
  };
74821
74822
 
74822
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/rewriteURIForGET.js
74823
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/rewriteURIForGET.js
74823
74824
  function rewriteURIForGET(chosenURI, body) {
74824
74825
  var queryParams = [];
74825
74826
  var addQueryParam = function(key, value) {
@@ -74860,7 +74861,7 @@ spurious results.`);
74860
74861
  return { newURI };
74861
74862
  }
74862
74863
 
74863
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/createHttpLink.js
74864
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/createHttpLink.js
74864
74865
  var backupFetch = maybe(function() {
74865
74866
  return fetch;
74866
74867
  });
@@ -74980,7 +74981,7 @@ spurious results.`);
74980
74981
  });
74981
74982
  };
74982
74983
 
74983
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/link/http/HttpLink.js
74984
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/link/http/HttpLink.js
74984
74985
  var HttpLink = (
74985
74986
  /** @class */
74986
74987
  (function(_super) {
@@ -75133,7 +75134,7 @@ spurious results.`);
75133
75134
  return false;
75134
75135
  }
75135
75136
 
75136
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/equalByQuery.js
75137
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/equalByQuery.js
75137
75138
  function equalByQuery(query, _a21, _b, variables) {
75138
75139
  var aData = _a21.data, aRest = __rest(_a21, ["data"]);
75139
75140
  var bData = _b.data, bRest = __rest(_b, ["data"]);
@@ -75206,7 +75207,7 @@ spurious results.`);
75206
75207
  return dir.name.value === "nonreactive";
75207
75208
  }
75208
75209
 
75209
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/core/cache.js
75210
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/core/cache.js
75210
75211
  var ApolloCache = (
75211
75212
  /** @class */
75212
75213
  (function() {
@@ -75338,7 +75339,7 @@ spurious results.`);
75338
75339
  ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;
75339
75340
  }
75340
75341
 
75341
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/core/types/common.js
75342
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/core/types/common.js
75342
75343
  var MissingFieldError = (
75343
75344
  /** @class */
75344
75345
  (function(_super) {
@@ -75365,7 +75366,7 @@ spurious results.`);
75365
75366
  })(Error)
75366
75367
  );
75367
75368
 
75368
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/helpers.js
75369
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/helpers.js
75369
75370
  var hasOwn = Object.prototype.hasOwnProperty;
75370
75371
  function isNullish(value) {
75371
75372
  return value === null || value === void 0;
@@ -75441,7 +75442,7 @@ spurious results.`);
75441
75442
  };
75442
75443
  }
75443
75444
 
75444
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/entityStore.js
75445
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/entityStore.js
75445
75446
  var DELETE = /* @__PURE__ */ Object.create(null);
75446
75447
  var delModifier = function() {
75447
75448
  return DELETE;
@@ -75958,7 +75959,7 @@ spurious results.`);
75958
75959
  return !!(store instanceof EntityStore && store.group.caching);
75959
75960
  }
75960
75961
 
75961
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/object-canon.js
75962
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/object-canon.js
75962
75963
  function shallowCopy(value) {
75963
75964
  if (isNonNullObject(value)) {
75964
75965
  return isArray2(value) ? value.slice(0) : __assign({ __proto__: Object.getPrototypeOf(value) }, value);
@@ -76052,7 +76053,7 @@ spurious results.`);
76052
76053
  })()
76053
76054
  );
76054
76055
 
76055
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/readFromStore.js
76056
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/readFromStore.js
76056
76057
  function execSelectionSetKeyArgs(options) {
76057
76058
  return [
76058
76059
  options.selectionSet,
@@ -76321,7 +76322,7 @@ spurious results.`);
76321
76322
  }
76322
76323
  }
76323
76324
 
76324
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/reactiveVars.js
76325
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/reactiveVars.js
76325
76326
  var cacheSlot = new Slot();
76326
76327
  var cacheInfoMap = /* @__PURE__ */ new WeakMap();
76327
76328
  function getCacheInfo(cache) {
@@ -76392,7 +76393,7 @@ spurious results.`);
76392
76393
  }
76393
76394
  }
76394
76395
 
76395
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/key-extractor.js
76396
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/key-extractor.js
76396
76397
  var specifierInfoCache = /* @__PURE__ */ Object.create(null);
76397
76398
  function lookupSpecifierInfo(spec) {
76398
76399
  var cacheKey = JSON.stringify(spec);
@@ -76525,7 +76526,7 @@ spurious results.`);
76525
76526
  return value;
76526
76527
  }
76527
76528
 
76528
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/policies.js
76529
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/policies.js
76529
76530
  function argsFromFieldSpecifier(spec) {
76530
76531
  return spec.args !== void 0 ? spec.args : spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;
76531
76532
  }
@@ -76960,7 +76961,7 @@ spurious results.`);
76960
76961
  };
76961
76962
  }
76962
76963
 
76963
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/writeToStore.js
76964
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/writeToStore.js
76964
76965
  function getContextFlavor(context, clientOnly, deferred) {
76965
76966
  var key = "".concat(clientOnly).concat(deferred);
76966
76967
  var flavored = context.flavors.get(key);
@@ -77365,7 +77366,7 @@ spurious results.`);
77365
77366
  globalThis.__DEV__ !== false && invariant2.warn(14, fieldName, parentType, childTypenames.length ? "either ensure all objects of type " + childTypenames.join(" and ") + " have an ID or a custom merge function, or " : "", typeDotName, __assign({}, existing), __assign({}, incoming));
77366
77367
  }
77367
77368
 
77368
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js
77369
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js
77369
77370
  var InMemoryCache = (
77370
77371
  /** @class */
77371
77372
  (function(_super) {
@@ -77674,7 +77675,7 @@ spurious results.`);
77674
77675
  InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;
77675
77676
  }
77676
77677
 
77677
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/networkStatus.js
77678
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/networkStatus.js
77678
77679
  var NetworkStatus;
77679
77680
  (function(NetworkStatus2) {
77680
77681
  NetworkStatus2[NetworkStatus2["loading"] = 1] = "loading";
@@ -77689,7 +77690,7 @@ spurious results.`);
77689
77690
  return networkStatus ? networkStatus < 7 : false;
77690
77691
  }
77691
77692
 
77692
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/ObservableQuery.js
77693
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/ObservableQuery.js
77693
77694
  var assign2 = Object.assign;
77694
77695
  var hasOwnProperty7 = Object.hasOwnProperty;
77695
77696
  var ObservableQuery = (
@@ -78297,7 +78298,7 @@ spurious results.`);
78297
78298
  return fetchPolicy === "network-only" || fetchPolicy === "no-cache" || fetchPolicy === "standby";
78298
78299
  }
78299
78300
 
78300
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/QueryInfo.js
78301
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/QueryInfo.js
78301
78302
  var destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)();
78302
78303
  function wrapDestructiveCacheMethod(cache, methodName) {
78303
78304
  var original = cache[methodName];
@@ -78589,7 +78590,7 @@ spurious results.`);
78589
78590
  return writeWithErrors;
78590
78591
  }
78591
78592
 
78592
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/QueryManager.js
78593
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/QueryManager.js
78593
78594
  var hasOwnProperty8 = Object.prototype.hasOwnProperty;
78594
78595
  var IGNORE = /* @__PURE__ */ Object.create(null);
78595
78596
  var QueryManager = (
@@ -79575,7 +79576,7 @@ spurious results.`);
79575
79576
  })()
79576
79577
  );
79577
79578
 
79578
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/LocalState.js
79579
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/LocalState.js
79579
79580
  var LocalState = (
79580
79581
  /** @class */
79581
79582
  (function() {
@@ -79925,7 +79926,7 @@ spurious results.`);
79925
79926
  })()
79926
79927
  );
79927
79928
 
79928
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/ApolloClient.js
79929
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/ApolloClient.js
79929
79930
  var hasSuggestedDevtools = false;
79930
79931
  var ApolloClient = (
79931
79932
  /** @class */
@@ -80327,7 +80328,7 @@ spurious results.`);
80327
80328
  })(gql || (gql = {}));
80328
80329
  gql["default"] = gql;
80329
80330
 
80330
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/core/index.js
80331
+ // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0_react@19.1.0/node_modules/@apollo/client/core/index.js
80331
80332
  setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
80332
80333
 
80333
80334
  // src/modules/apollo-client.ts
@@ -92609,14 +92610,14 @@ spurious results.`);
92609
92610
  var calculateBTCPriceDelta = (btcPrice, lastBtcPrice) => {
92610
92611
  return (btcPrice - lastBtcPrice) / lastBtcPrice * 100;
92611
92612
  };
92612
- var calculateVesUPositionSizeGivenExtended = (extendedPositonValue, extendedHoldingAmount, collateralAmount, collateralPrice) => {
92613
+ var calculateVesUPositionSizeGivenExtended = (extendedPositonValue, extendedHoldingAmount, collateralAmount, collateralPrice, vesuDebtAmountToBeRepaid) => {
92613
92614
  const extendedLeverage = calculateExtendedLevergae();
92614
92615
  const vesuLeverage = calculateVesuLeverage();
92615
92616
  const extendedAmount = extendedHoldingAmount;
92616
92617
  const extendedAmountInBTC = extendedAmount.dividedBy(collateralPrice);
92617
92618
  const numerator1 = extendedAmount.multipliedBy(extendedLeverage).plus(extendedPositonValue);
92618
92619
  const numerator2 = collateralAmount.multipliedBy(collateralPrice).multipliedBy(-1);
92619
- const vesuAmountInUsd = numerator1.plus(numerator2).dividedBy(vesuLeverage);
92620
+ const vesuAmountInUsd = numerator1.plus(numerator2).dividedBy(vesuLeverage).plus(vesuDebtAmountToBeRepaid);
92620
92621
  const vesuAmountInBTC = vesuAmountInUsd.dividedBy(collateralPrice).toFixed(WBTC_TOKEN_DECIMALS);
92621
92622
  return {
92622
92623
  vesuAmountInUsd: vesuAmountInUsd.toFixed(2),
@@ -92624,6 +92625,17 @@ spurious results.`);
92624
92625
  extendedAmountInBTC
92625
92626
  };
92626
92627
  };
92628
+ var calculateDeltaDebtAmount = (maxLtv = MAX_LTV_BTC_USDC, existingVesuCollateral, existingVesuDebt, collateralPrice, debtPrice, targetHf = TARGET_HF) => {
92629
+ try {
92630
+ const term1 = existingVesuCollateral.multipliedBy(collateralPrice).multipliedBy(maxLtv).dividedBy(targetHf);
92631
+ const term2 = existingVesuDebt.multipliedBy(debtPrice).multipliedBy(targetHf).multipliedBy(-1);
92632
+ const debtAmountToBeRepaid = term1.plus(term2).dividedBy(targetHf);
92633
+ return debtAmountToBeRepaid;
92634
+ } catch (err2) {
92635
+ logger2.error(`error calculating delta position: ${err2}`);
92636
+ return null;
92637
+ }
92638
+ };
92627
92639
 
92628
92640
  // src/utils/health-factor-math.ts
92629
92641
  var HealthFactorMath = class {
@@ -94687,6 +94699,8 @@ spurious results.`);
94687
94699
  quote,
94688
94700
  vaultAllocator.address
94689
94701
  );
94702
+ const dataObject = quote;
94703
+ logger2.info(`${_AvnuAdapter.name}::getQuotesAvnu finalAmountOfWbtcOut : ${dataObject.avnuFees} ${parseInt(dataObject.buyAmount.toString(), 16)} ${parseInt(dataObject.sellAmount.toString(), 16)} ${parseInt(dataObject.sellAmount.toString(), 16)}`);
94690
94704
  const swapCallData = getCalldata[0];
94691
94705
  const amount = uint256_exports.bnToUint256(quote.sellAmountInUsd * 10 ** 7);
94692
94706
  return [
@@ -98430,11 +98444,17 @@ spurious results.`);
98430
98444
  WALLET_ADDRESS,
98431
98445
  usdceToken.decimals
98432
98446
  );
98433
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator walletBalance: ${walletBalance}`);
98447
+ logger2.info(
98448
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator walletBalance: ${walletBalance}`
98449
+ );
98434
98450
  const amountToBeTransferred = amount.minimum(walletBalance);
98435
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred: ${amountToBeTransferred.toNumber()}`);
98451
+ logger2.info(
98452
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred: ${amountToBeTransferred.toNumber()}`
98453
+ );
98436
98454
  if (amountToBeTransferred.lessThan(0)) {
98437
- logger2.error(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred is less than 0: ${amountToBeTransferred.toNumber()}`);
98455
+ logger2.error(
98456
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred is less than 0: ${amountToBeTransferred.toNumber()}`
98457
+ );
98438
98458
  return {
98439
98459
  calls: [],
98440
98460
  status: false
@@ -98472,10 +98492,14 @@ spurious results.`);
98472
98492
  }
98473
98493
  async shouldInvest() {
98474
98494
  try {
98475
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest starting`);
98495
+ logger2.info(
98496
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest starting`
98497
+ );
98476
98498
  const vesuAdapter = await this.getVesuAdapter();
98477
98499
  const extendedAdapter = await this.getExtendedAdapter();
98478
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest adapters fetched: vesuAdapter=${!!vesuAdapter}, extendedAdapter=${!!extendedAdapter}, extendedAdapter.client=${!!extendedAdapter?.client}`);
98500
+ logger2.info(
98501
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest adapters fetched: vesuAdapter=${!!vesuAdapter}, extendedAdapter=${!!extendedAdapter}, extendedAdapter.client=${!!extendedAdapter?.client}`
98502
+ );
98479
98503
  if (!vesuAdapter) {
98480
98504
  logger2.error(
98481
98505
  `Vesu adapter not configured in metadata. This is a configuration issue, not a temporary failure.`
@@ -98487,7 +98511,8 @@ spurious results.`);
98487
98511
  extendedLeverage: 0,
98488
98512
  collateralPrice: 0,
98489
98513
  debtPrice: 0,
98490
- vesuLeverage: 0
98514
+ vesuLeverage: 0,
98515
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98491
98516
  };
98492
98517
  }
98493
98518
  if (!extendedAdapter) {
@@ -98501,7 +98526,8 @@ spurious results.`);
98501
98526
  extendedLeverage: 0,
98502
98527
  collateralPrice: 0,
98503
98528
  debtPrice: 0,
98504
- vesuLeverage: 0
98529
+ vesuLeverage: 0,
98530
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98505
98531
  };
98506
98532
  }
98507
98533
  if (!extendedAdapter.client) {
@@ -98515,10 +98541,13 @@ spurious results.`);
98515
98541
  extendedLeverage: 0,
98516
98542
  collateralPrice: 0,
98517
98543
  debtPrice: 0,
98518
- vesuLeverage: 0
98544
+ vesuLeverage: 0,
98545
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98519
98546
  };
98520
98547
  }
98521
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest calling getUnusedBalance`);
98548
+ logger2.info(
98549
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest calling getUnusedBalance`
98550
+ );
98522
98551
  const balance = await this.getUnusedBalance();
98523
98552
  if (!Number.isFinite(balance.usdValue) || balance.usdValue < 0) {
98524
98553
  logger2.error(
@@ -98531,13 +98560,18 @@ spurious results.`);
98531
98560
  extendedLeverage: 0,
98532
98561
  collateralPrice: 0,
98533
98562
  debtPrice: 0,
98534
- vesuLeverage: 0
98563
+ vesuLeverage: 0,
98564
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98535
98565
  };
98536
98566
  }
98537
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest balance: ${balance.usdValue}`);
98567
+ logger2.info(
98568
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest balance: ${balance.usdValue}`
98569
+ );
98538
98570
  const usdcBalanceOnExtended = await extendedAdapter.getExtendedDepositAmount();
98539
98571
  if (usdcBalanceOnExtended) {
98540
- const availableForWithdrawal = parseFloat(usdcBalanceOnExtended.availableForWithdrawal);
98572
+ const availableForWithdrawal = parseFloat(
98573
+ usdcBalanceOnExtended.availableForWithdrawal
98574
+ );
98541
98575
  if (!Number.isFinite(availableForWithdrawal) || availableForWithdrawal < 0) {
98542
98576
  logger2.error(
98543
98577
  `Invalid usdcBalanceOnExtended.availableForWithdrawal: ${usdcBalanceOnExtended.availableForWithdrawal}. Expected a finite, non-negative number.`
@@ -98549,11 +98583,15 @@ spurious results.`);
98549
98583
  extendedLeverage: 0,
98550
98584
  collateralPrice: 0,
98551
98585
  debtPrice: 0,
98552
- vesuLeverage: 0
98586
+ vesuLeverage: 0,
98587
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98553
98588
  };
98554
98589
  }
98555
98590
  }
98556
- const amountToInvest = new Web3Number(balance.usdValue, USDC_TOKEN_DECIMALS).plus(usdcBalanceOnExtended?.availableForTrade ?? 0).multipliedBy(1 - LIMIT_BALANCE);
98591
+ const amountToInvest = new Web3Number(
98592
+ balance.usdValue,
98593
+ USDC_TOKEN_DECIMALS
98594
+ ).plus(usdcBalanceOnExtended?.availableForTrade ?? 0).multipliedBy(1 - LIMIT_BALANCE);
98557
98595
  const amountToInvestNumber = amountToInvest.toNumber();
98558
98596
  if (!Number.isFinite(amountToInvestNumber)) {
98559
98597
  logger2.error(
@@ -98566,10 +98604,13 @@ spurious results.`);
98566
98604
  extendedLeverage: 0,
98567
98605
  collateralPrice: 0,
98568
98606
  debtPrice: 0,
98569
- vesuLeverage: 0
98607
+ vesuLeverage: 0,
98608
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98570
98609
  };
98571
98610
  }
98572
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest amountToInvest: ${amountToInvestNumber}`);
98611
+ logger2.info(
98612
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest amountToInvest: ${amountToInvestNumber}`
98613
+ );
98573
98614
  if (amountToInvest.lessThan(LIMIT_BALANCE_VALUE)) {
98574
98615
  return {
98575
98616
  shouldInvest: false,
@@ -98578,7 +98619,8 @@ spurious results.`);
98578
98619
  extendedLeverage: 0,
98579
98620
  collateralPrice: 0,
98580
98621
  debtPrice: 0,
98581
- vesuLeverage: 0
98622
+ vesuLeverage: 0,
98623
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98582
98624
  };
98583
98625
  }
98584
98626
  const extendedPositon = await extendedAdapter.getAllOpenPositions();
@@ -98591,14 +98633,12 @@ spurious results.`);
98591
98633
  extendedLeverage: 0,
98592
98634
  collateralPrice: 0,
98593
98635
  debtPrice: 0,
98594
- vesuLeverage: 0
98636
+ vesuLeverage: 0,
98637
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98595
98638
  };
98596
98639
  }
98597
- const { collateralTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
98598
- const {
98599
- collateralPrice,
98600
- debtPrice
98601
- } = await this.getAssetPrices();
98640
+ const { collateralTokenAmount, debtTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
98641
+ const { collateralPrice, debtPrice } = await this.getAssetPrices();
98602
98642
  if (!Number.isFinite(collateralPrice.price) || collateralPrice.price <= 0) {
98603
98643
  logger2.error(
98604
98644
  `Invalid collateralPrice: ${collateralPrice.price}. Expected a finite, positive number.`
@@ -98610,7 +98650,8 @@ spurious results.`);
98610
98650
  extendedLeverage: 0,
98611
98651
  collateralPrice: 0,
98612
98652
  debtPrice: 0,
98613
- vesuLeverage: 0
98653
+ vesuLeverage: 0,
98654
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98614
98655
  };
98615
98656
  }
98616
98657
  if (!Number.isFinite(debtPrice.price) || debtPrice.price <= 0) {
@@ -98624,11 +98665,34 @@ spurious results.`);
98624
98665
  extendedLeverage: 0,
98625
98666
  collateralPrice: 0,
98626
98667
  debtPrice: 0,
98627
- vesuLeverage: 0
98668
+ vesuLeverage: 0,
98669
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98628
98670
  };
98629
98671
  }
98672
+ const debtAmountToBeRepaid = calculateDeltaDebtAmount(
98673
+ MAX_LTV_BTC_USDC,
98674
+ collateralTokenAmount,
98675
+ debtTokenAmount,
98676
+ collateralPrice.price,
98677
+ debtPrice.price,
98678
+ this.metadata.additionalInfo.targetHealthFactor
98679
+ );
98680
+ if (!debtAmountToBeRepaid) {
98681
+ logger2.error("error calculating debt amount to be repaid");
98682
+ return {
98683
+ shouldInvest: false,
98684
+ vesuAmount: new Web3Number(0, 0),
98685
+ extendedAmount: new Web3Number(0, 0),
98686
+ extendedLeverage: 0,
98687
+ collateralPrice: 0,
98688
+ debtPrice: 0,
98689
+ vesuLeverage: 0,
98690
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98691
+ };
98692
+ }
98693
+ const amountToInvestAfterRepayingDebt = amountToInvest.minus(debtAmountToBeRepaid);
98630
98694
  const { vesu_amount, extended_amount, extended_leverage, vesu_leverage } = await calculateAmountDistribution(
98631
- amountToInvest.toNumber(),
98695
+ amountToInvestAfterRepayingDebt.toNumber(),
98632
98696
  extendedAdapter.client,
98633
98697
  extendedAdapter.config.extendedMarketName,
98634
98698
  collateralPrice.price,
@@ -98647,10 +98711,13 @@ spurious results.`);
98647
98711
  extendedLeverage: 0,
98648
98712
  collateralPrice: 0,
98649
98713
  debtPrice: 0,
98650
- vesuLeverage: 0
98714
+ vesuLeverage: 0,
98715
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98651
98716
  };
98652
98717
  }
98653
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest vesu_amount: ${vesu_amount.toNumber()}, extended_amount: ${extended_amount.toNumber()}`);
98718
+ logger2.info(
98719
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest vesu_amount: ${vesu_amount.toNumber()}, extended_amount: ${extended_amount.toNumber()}`
98720
+ );
98654
98721
  return {
98655
98722
  shouldInvest: true,
98656
98723
  vesuAmount: vesu_amount,
@@ -98658,7 +98725,8 @@ spurious results.`);
98658
98725
  extendedLeverage: extended_leverage,
98659
98726
  vesuLeverage: vesu_leverage,
98660
98727
  collateralPrice: collateralPrice.price,
98661
- debtPrice: debtPrice.price
98728
+ debtPrice: debtPrice.price,
98729
+ debtAmountToBeRepaid
98662
98730
  };
98663
98731
  } catch (err2) {
98664
98732
  logger2.error(`error deciding invest: ${err2}`);
@@ -98669,7 +98737,8 @@ spurious results.`);
98669
98737
  extendedLeverage: 0,
98670
98738
  collateralPrice: 0,
98671
98739
  debtPrice: 0,
98672
- vesuLeverage: 0
98740
+ vesuLeverage: 0,
98741
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98673
98742
  };
98674
98743
  }
98675
98744
  }
@@ -98692,33 +98761,49 @@ spurious results.`);
98692
98761
  const usdcAmountOnExtendedAvailableForTrade = parseFloat(
98693
98762
  extendedHoldings.availableForTrade
98694
98763
  );
98695
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculating movements - Extended current: ${usdcAmountOnExtendedAvailableForTrade}, Wallet: ${usdcAmountInWallet.toNumber()}, Target Extended: ${extendedAmount.toNumber()}, Target Vesu: ${vesuAmount.toNumber()}`);
98764
+ logger2.info(
98765
+ `${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculating movements - Extended current: ${usdcAmountOnExtendedAvailableForTrade}, Wallet: ${usdcAmountInWallet.toNumber()}, Target Extended: ${extendedAmount.toNumber()}, Target Vesu: ${vesuAmount.toNumber()}`
98766
+ );
98696
98767
  let totalExtendedWithdrawal = new Web3Number(0, USDC_TOKEN_DECIMALS);
98697
98768
  let totalExtendedDeposit = new Web3Number(0, USDC_TOKEN_DECIMALS);
98698
98769
  if (extendedAmount.isNegative() && extendedAmount.abs().greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98699
- totalExtendedWithdrawal = totalExtendedWithdrawal.plus(extendedAmount.abs());
98770
+ totalExtendedWithdrawal = totalExtendedWithdrawal.plus(
98771
+ extendedAmount.abs()
98772
+ );
98700
98773
  }
98701
98774
  const extendedTargetAmount = extendedAmount.abs();
98702
98775
  let projectedExtendedBalance = usdcAmountOnExtendedAvailableForTrade;
98703
98776
  if (extendedAmount.isNegative()) {
98704
98777
  projectedExtendedBalance = projectedExtendedBalance - extendedAmount.abs().toNumber();
98705
98778
  }
98706
- const extendedAmountDifference = extendedTargetAmount.minus(projectedExtendedBalance);
98779
+ const extendedAmountDifference = extendedTargetAmount.minus(
98780
+ projectedExtendedBalance
98781
+ );
98707
98782
  const extendedAmountDifferenceAbs = extendedAmountDifference.abs();
98708
98783
  if (extendedAmountDifference.lessThan(0)) {
98709
- totalExtendedWithdrawal = totalExtendedWithdrawal.plus(extendedAmountDifferenceAbs);
98784
+ totalExtendedWithdrawal = totalExtendedWithdrawal.plus(
98785
+ extendedAmountDifferenceAbs
98786
+ );
98710
98787
  } else if (extendedAmountDifference.greaterThan(0)) {
98711
- totalExtendedDeposit = totalExtendedDeposit.plus(extendedAmountDifference);
98788
+ totalExtendedDeposit = totalExtendedDeposit.plus(
98789
+ extendedAmountDifference
98790
+ );
98712
98791
  }
98713
98792
  const vesuTargetAmount = vesuAmount.abs();
98714
98793
  const projectedWalletBalance = usdcAmountInWallet.plus(totalExtendedWithdrawal).minus(totalExtendedDeposit);
98715
98794
  let vesuAmountDifference = vesuTargetAmount.minus(projectedWalletBalance);
98716
98795
  const vesuAmountDifferenceAbs = vesuAmountDifference.abs();
98717
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculated movements - Extended withdrawal: ${totalExtendedWithdrawal.toNumber()}, Extended deposit: ${totalExtendedDeposit.toNumber()}, Extended diff: ${extendedAmountDifference.toNumber()}, Projected wallet: ${projectedWalletBalance.toNumber()}, Vesu diff: ${vesuAmountDifference.toNumber()}`);
98796
+ logger2.info(
98797
+ `${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculated movements - Extended withdrawal: ${totalExtendedWithdrawal.toNumber()}, Extended deposit: ${totalExtendedDeposit.toNumber()}, Extended diff: ${extendedAmountDifference.toNumber()}, Projected wallet: ${projectedWalletBalance.toNumber()}, Vesu diff: ${vesuAmountDifference.toNumber()}`
98798
+ );
98718
98799
  let transactionResults = [];
98719
98800
  if (extendedAmount.isNegative() && extendedAmount.abs().greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98720
98801
  try {
98721
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
98802
+ const {
98803
+ calls: extendedCalls,
98804
+ status: extendedStatus,
98805
+ transactionMetadata: extendedTransactionMetadata
98806
+ } = await this.moveAssets(
98722
98807
  {
98723
98808
  to: Protocols.VAULT.name,
98724
98809
  from: Protocols.EXTENDED.name,
@@ -98738,16 +98823,44 @@ spurious results.`);
98738
98823
  }
98739
98824
  });
98740
98825
  } else {
98741
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: extendedAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98826
+ return [
98827
+ this.createTransactionResult(
98828
+ [],
98829
+ false,
98830
+ {
98831
+ from: Protocols.EXTENDED.name,
98832
+ to: Protocols.VAULT.name,
98833
+ amount: extendedAmount.abs()
98834
+ },
98835
+ "NONE",
98836
+ "INVESTMENT" /* INVESTMENT */
98837
+ )
98838
+ ];
98742
98839
  }
98743
98840
  } catch (err2) {
98744
98841
  logger2.error(`Failed moving assets to vault: ${err2}`);
98745
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: extendedAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98842
+ return [
98843
+ this.createTransactionResult(
98844
+ [],
98845
+ false,
98846
+ {
98847
+ from: Protocols.EXTENDED.name,
98848
+ to: Protocols.VAULT.name,
98849
+ amount: extendedAmount.abs()
98850
+ },
98851
+ "NONE",
98852
+ "INVESTMENT" /* INVESTMENT */
98853
+ )
98854
+ ];
98746
98855
  }
98747
98856
  }
98748
98857
  if (vesuAmount.isNegative() && vesuAmount.abs().greaterThan(vesuAdapter.minimumVesuMovementAmount)) {
98749
98858
  try {
98750
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
98859
+ const {
98860
+ calls: vesuCalls,
98861
+ status: vesuStatus,
98862
+ transactionMetadata: vesuTransactionMetadata
98863
+ } = await this.moveAssets(
98751
98864
  {
98752
98865
  to: Protocols.EXTENDED.name,
98753
98866
  from: Protocols.VESU.name,
@@ -98758,7 +98871,19 @@ spurious results.`);
98758
98871
  vesuAdapter
98759
98872
  );
98760
98873
  if (!vesuStatus) {
98761
- return [this.createTransactionResult([], false, { from: Protocols.VESU.name, to: Protocols.EXTENDED.name, amount: vesuAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98874
+ return [
98875
+ this.createTransactionResult(
98876
+ [],
98877
+ false,
98878
+ {
98879
+ from: Protocols.VESU.name,
98880
+ to: Protocols.EXTENDED.name,
98881
+ amount: vesuAmount.abs()
98882
+ },
98883
+ "NONE",
98884
+ "INVESTMENT" /* INVESTMENT */
98885
+ )
98886
+ ];
98762
98887
  }
98763
98888
  transactionResults.push({
98764
98889
  status: vesuStatus,
@@ -98769,14 +98894,34 @@ spurious results.`);
98769
98894
  }
98770
98895
  });
98771
98896
  } catch (err2) {
98772
- logger2.error(`Failed moving assets to extended via vault allocator: ${err2}`);
98773
- return [this.createTransactionResult([], false, { from: Protocols.VESU.name, to: Protocols.EXTENDED.name, amount: vesuAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98897
+ logger2.error(
98898
+ `Failed moving assets to extended via vault allocator: ${err2}`
98899
+ );
98900
+ return [
98901
+ this.createTransactionResult(
98902
+ [],
98903
+ false,
98904
+ {
98905
+ from: Protocols.VESU.name,
98906
+ to: Protocols.EXTENDED.name,
98907
+ amount: vesuAmount.abs()
98908
+ },
98909
+ "NONE",
98910
+ "INVESTMENT" /* INVESTMENT */
98911
+ )
98912
+ ];
98774
98913
  }
98775
98914
  }
98776
- if (extendedAmountDifferenceAbs.greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98915
+ if (extendedAmountDifferenceAbs.greaterThan(
98916
+ extendedAdapter.minimumExtendedMovementAmount
98917
+ )) {
98777
98918
  if (extendedAmountDifference.greaterThan(0)) {
98778
98919
  try {
98779
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
98920
+ const {
98921
+ calls: extendedCalls,
98922
+ status: extendedStatus,
98923
+ transactionMetadata: extendedTransactionMetadata
98924
+ } = await this.moveAssets(
98780
98925
  {
98781
98926
  to: Protocols.EXTENDED.name,
98782
98927
  from: Protocols.VAULT.name,
@@ -98793,16 +98938,46 @@ spurious results.`);
98793
98938
  transactionMetadata: extendedTransactionMetadata
98794
98939
  });
98795
98940
  } else {
98796
- logger2.error(`Failed to move assets to extended - operation returned false status`);
98797
- return [this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.EXTENDED.name, amount: extendedAmountDifference }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98941
+ logger2.error(
98942
+ `Failed to move assets to extended - operation returned false status`
98943
+ );
98944
+ return [
98945
+ this.createTransactionResult(
98946
+ [],
98947
+ false,
98948
+ {
98949
+ from: Protocols.VAULT.name,
98950
+ to: Protocols.EXTENDED.name,
98951
+ amount: extendedAmountDifference
98952
+ },
98953
+ "NONE",
98954
+ "INVESTMENT" /* INVESTMENT */
98955
+ )
98956
+ ];
98798
98957
  }
98799
98958
  } catch (err2) {
98800
98959
  logger2.error(`Failed moving assets to extended: ${err2}`);
98801
- return [this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.EXTENDED.name, amount: extendedAmountDifference }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98960
+ return [
98961
+ this.createTransactionResult(
98962
+ [],
98963
+ false,
98964
+ {
98965
+ from: Protocols.VAULT.name,
98966
+ to: Protocols.EXTENDED.name,
98967
+ amount: extendedAmountDifference
98968
+ },
98969
+ "NONE",
98970
+ "INVESTMENT" /* INVESTMENT */
98971
+ )
98972
+ ];
98802
98973
  }
98803
98974
  } else if (extendedAmountDifference.lessThan(0)) {
98804
98975
  try {
98805
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
98976
+ const {
98977
+ calls: extendedCalls,
98978
+ status: extendedStatus,
98979
+ transactionMetadata: extendedTransactionMetadata
98980
+ } = await this.moveAssets(
98806
98981
  {
98807
98982
  to: Protocols.VAULT.name,
98808
98983
  from: Protocols.EXTENDED.name,
@@ -98822,23 +98997,55 @@ spurious results.`);
98822
98997
  }
98823
98998
  });
98824
98999
  } else {
98825
- logger2.error(`Failed to withdraw from extended - operation returned false status`);
98826
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: extendedAmountDifferenceAbs }, "NONE", "INVESTMENT" /* INVESTMENT */)];
99000
+ logger2.error(
99001
+ `Failed to withdraw from extended - operation returned false status`
99002
+ );
99003
+ return [
99004
+ this.createTransactionResult(
99005
+ [],
99006
+ false,
99007
+ {
99008
+ from: Protocols.EXTENDED.name,
99009
+ to: Protocols.VAULT.name,
99010
+ amount: extendedAmountDifferenceAbs
99011
+ },
99012
+ "NONE",
99013
+ "INVESTMENT" /* INVESTMENT */
99014
+ )
99015
+ ];
98827
99016
  }
98828
99017
  } catch (err2) {
98829
99018
  logger2.error(`Failed moving assets from extended to vault: ${err2}`);
98830
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: extendedAmountDifferenceAbs }, "NONE", "INVESTMENT" /* INVESTMENT */)];
99019
+ return [
99020
+ this.createTransactionResult(
99021
+ [],
99022
+ false,
99023
+ {
99024
+ from: Protocols.EXTENDED.name,
99025
+ to: Protocols.VAULT.name,
99026
+ amount: extendedAmountDifferenceAbs
99027
+ },
99028
+ "NONE",
99029
+ "INVESTMENT" /* INVESTMENT */
99030
+ )
99031
+ ];
98831
99032
  }
98832
99033
  }
98833
99034
  }
98834
- if (vesuAmountDifferenceAbs.greaterThan(vesuAdapter.minimumVesuMovementAmount)) {
99035
+ if (vesuAmountDifferenceAbs.greaterThan(
99036
+ vesuAdapter.minimumVesuMovementAmount
99037
+ )) {
98835
99038
  if (vesuAmountDifference.lessThanOrEqualTo(0)) {
98836
99039
  logger2.warn(
98837
99040
  `Vesu amount difference is negative or zero: ${vesuAmountDifference.toNumber()}. Skipping operation.`
98838
99041
  );
98839
99042
  } else {
98840
99043
  try {
98841
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
99044
+ const {
99045
+ calls: vesuCalls,
99046
+ status: vesuStatus,
99047
+ transactionMetadata: vesuTransactionMetadata
99048
+ } = await this.moveAssets(
98842
99049
  {
98843
99050
  to: Protocols.VAULT.name,
98844
99051
  from: Protocols.EXTENDED.name,
@@ -98849,8 +99056,22 @@ spurious results.`);
98849
99056
  vesuAdapter
98850
99057
  );
98851
99058
  if (!vesuStatus) {
98852
- logger2.error(`Failed to move assets to vesu - operation returned false status`);
98853
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: vesuAmountDifference }, "NONE", "INVESTMENT" /* INVESTMENT */)];
99059
+ logger2.error(
99060
+ `Failed to move assets to vesu - operation returned false status`
99061
+ );
99062
+ return [
99063
+ this.createTransactionResult(
99064
+ [],
99065
+ false,
99066
+ {
99067
+ from: Protocols.EXTENDED.name,
99068
+ to: Protocols.VAULT.name,
99069
+ amount: vesuAmountDifference
99070
+ },
99071
+ "NONE",
99072
+ "INVESTMENT" /* INVESTMENT */
99073
+ )
99074
+ ];
98854
99075
  }
98855
99076
  transactionResults.push({
98856
99077
  status: vesuStatus,
@@ -98862,14 +99083,38 @@ spurious results.`);
98862
99083
  });
98863
99084
  } catch (err2) {
98864
99085
  logger2.error(`Failed moving assets to vault: ${err2}`);
98865
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: vesuAmountDifference }, "NONE", "INVESTMENT" /* INVESTMENT */)];
99086
+ return [
99087
+ this.createTransactionResult(
99088
+ [],
99089
+ false,
99090
+ {
99091
+ from: Protocols.EXTENDED.name,
99092
+ to: Protocols.VAULT.name,
99093
+ amount: vesuAmountDifference
99094
+ },
99095
+ "NONE",
99096
+ "INVESTMENT" /* INVESTMENT */
99097
+ )
99098
+ ];
98866
99099
  }
98867
99100
  }
98868
99101
  }
98869
99102
  return transactionResults;
98870
99103
  } catch (err2) {
98871
99104
  logger2.error(`Failed moving assets to vesu: ${err2}`);
98872
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: new Web3Number(0, USDC_TOKEN_DECIMALS) }, "NONE", "INVESTMENT" /* INVESTMENT */)];
99105
+ return [
99106
+ this.createTransactionResult(
99107
+ [],
99108
+ false,
99109
+ {
99110
+ from: Protocols.EXTENDED.name,
99111
+ to: Protocols.VAULT.name,
99112
+ amount: new Web3Number(0, USDC_TOKEN_DECIMALS)
99113
+ },
99114
+ "NONE",
99115
+ "INVESTMENT" /* INVESTMENT */
99116
+ )
99117
+ ];
98873
99118
  }
98874
99119
  }
98875
99120
  /**
@@ -98890,7 +99135,18 @@ spurious results.`);
98890
99135
  }
98891
99136
  };
98892
99137
  }
98893
- return { calls: [], status: false, transactionMetadata: { protocolFrom: "", protocolTo: "", transactionType: "DEPOSIT", usdAmount: "0", status: "FAILED", cycleType } };
99138
+ return {
99139
+ calls: [],
99140
+ status: false,
99141
+ transactionMetadata: {
99142
+ protocolFrom: "",
99143
+ protocolTo: "",
99144
+ transactionType: "DEPOSIT",
99145
+ usdAmount: "0",
99146
+ status: "FAILED",
99147
+ cycleType
99148
+ }
99149
+ };
98894
99150
  }
98895
99151
  /**
98896
99152
  * This method is used to move assets between protocols
@@ -98898,7 +99154,7 @@ spurious results.`);
98898
99154
  * @param extendedAdapter - The extended adapter
98899
99155
  * @param vesuAdapter - The vesu adapter
98900
99156
  * @returns The transaction result
98901
- * If Extended amount is greater than amount of withdrawal from extended, then we need to open a long position
99157
+ * If Extended amount is greater than amount of withdrawal from extended, then we need to open a long position
98902
99158
  * so that the amount of withdrawal from extended is fullfilled
98903
99159
  */
98904
99160
  async moveAssets(params, extendedAdapter, vesuAdapter) {
@@ -98907,18 +99163,28 @@ spurious results.`);
98907
99163
  logger2.error(
98908
99164
  `Invalid amount for moveAssets: ${params.amount.toNumber()}. Amount must be positive.`
98909
99165
  );
98910
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99166
+ return this.createTransactionResult(
99167
+ [],
99168
+ false,
99169
+ params,
99170
+ "NONE",
99171
+ params.cycleType
99172
+ );
98911
99173
  }
98912
99174
  const avnuAdapter = await this.getAvnuAdapter();
98913
99175
  if (!avnuAdapter) {
98914
99176
  logger2.error(`avnu adapter not found: ${avnuAdapter}`);
98915
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99177
+ return this.createTransactionResult(
99178
+ [],
99179
+ false,
99180
+ params,
99181
+ "NONE",
99182
+ params.cycleType
99183
+ );
98916
99184
  }
98917
99185
  logger2.info(`moveAssets params, ${JSON.stringify(params)}`);
98918
99186
  const collateralToken = vesuAdapter.config.supportedPositions[0].asset;
98919
- const {
98920
- collateralPrice
98921
- } = await this.getAssetPrices();
99187
+ const { collateralPrice } = await this.getAssetPrices();
98922
99188
  if (params.to === Protocols.EXTENDED.name && params.from === Protocols.VAULT.name) {
98923
99189
  const proofsInfo = extendedAdapter.getProofs(
98924
99190
  true,
@@ -98931,28 +99197,45 @@ spurious results.`);
98931
99197
  await proofsInfo.callConstructor({ amount: params.amount })
98932
99198
  );
98933
99199
  calls.push(call);
98934
- return this.createTransactionResult(calls, true, params, "DEPOSIT", params.cycleType);
99200
+ return this.createTransactionResult(
99201
+ calls,
99202
+ true,
99203
+ params,
99204
+ "DEPOSIT",
99205
+ params.cycleType
99206
+ );
98935
99207
  } else if (params.to === Protocols.VAULT.name && params.from === Protocols.EXTENDED.name) {
98936
99208
  const extendedLeverage = calculateExtendedLevergae();
98937
99209
  const extendedHoldings = await extendedAdapter.getExtendedDepositAmount();
98938
99210
  if (!extendedHoldings) {
98939
99211
  logger2.error(`error getting extended holdings: ${extendedHoldings}`);
98940
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99212
+ return this.createTransactionResult(
99213
+ [],
99214
+ false,
99215
+ params,
99216
+ "NONE",
99217
+ params.cycleType
99218
+ );
98941
99219
  }
98942
99220
  const extendedHoldingAmount = new Web3Number(
98943
99221
  extendedHoldings.availableForWithdrawal,
98944
99222
  USDC_TOKEN_DECIMALS
98945
99223
  );
98946
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssets extendedHoldingAmount: ${extendedHoldingAmount.toNumber()}`);
99224
+ logger2.info(
99225
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssets extendedHoldingAmount: ${extendedHoldingAmount.toNumber()}`
99226
+ );
98947
99227
  if (params.amount.abs().greaterThan(extendedHoldingAmount)) {
98948
- const leftAmountAfterWithdrawalAmountInAccount = new Web3Number(Math.ceil(params.amount.abs().minus(extendedHoldingAmount).toNumber()), USDC_TOKEN_DECIMALS);
98949
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssets leftAmountAfterWithdrawalAmountInAccount: ${leftAmountAfterWithdrawalAmountInAccount.toNumber()}`);
99228
+ const leftAmountAfterWithdrawalAmountInAccount = new Web3Number(
99229
+ Math.ceil(
99230
+ params.amount.abs().minus(extendedHoldingAmount).toNumber()
99231
+ ),
99232
+ USDC_TOKEN_DECIMALS
99233
+ );
99234
+ logger2.info(
99235
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssets leftAmountAfterWithdrawalAmountInAccount: ${leftAmountAfterWithdrawalAmountInAccount.toNumber()}`
99236
+ );
98950
99237
  let priceOfBTC;
98951
- const {
98952
- ask,
98953
- bid,
98954
- status
98955
- } = await extendedAdapter.fetchOrderBookBTCUSDC();
99238
+ const { ask, bid, status } = await extendedAdapter.fetchOrderBookBTCUSDC();
98956
99239
  const price = ask.plus(bid).dividedBy(2);
98957
99240
  if (status) {
98958
99241
  priceOfBTC = price;
@@ -98975,38 +99258,95 @@ spurious results.`);
98975
99258
  logger2.error(`error opening long position: ${openLongPosition}`);
98976
99259
  }
98977
99260
  const updatedHoldings = await extendedAdapter.getExtendedDepositAmount();
98978
- if (!updatedHoldings || new Web3Number(updatedHoldings.availableForWithdrawal, USDC_TOKEN_DECIMALS).lessThan(params.amount.abs())) {
98979
- logger2.error(`Insufficient balance after opening position. Available: ${updatedHoldings?.availableForWithdrawal}, Needed: ${params.amount.abs()}`);
98980
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99261
+ if (!updatedHoldings || new Web3Number(
99262
+ updatedHoldings.availableForWithdrawal,
99263
+ USDC_TOKEN_DECIMALS
99264
+ ).lessThan(params.amount.abs())) {
99265
+ logger2.error(
99266
+ `Insufficient balance after opening position. Available: ${updatedHoldings?.availableForWithdrawal}, Needed: ${params.amount.abs()}`
99267
+ );
99268
+ return this.createTransactionResult(
99269
+ [],
99270
+ false,
99271
+ params,
99272
+ "NONE",
99273
+ params.cycleType
99274
+ );
98981
99275
  }
98982
99276
  }
98983
99277
  const {
98984
99278
  status: withdrawalFromExtendedStatus,
98985
99279
  receivedTxnHash: withdrawalFromExtendedTxnHash
98986
99280
  } = await extendedAdapter.withdrawFromExtended(params.amount);
98987
- logger2.info(`withdrawalFromExtendedStatus: ${withdrawalFromExtendedStatus}, withdrawalFromExtendedTxnHash: ${withdrawalFromExtendedTxnHash}`);
99281
+ logger2.info(
99282
+ `withdrawalFromExtendedStatus: ${withdrawalFromExtendedStatus}, withdrawalFromExtendedTxnHash: ${withdrawalFromExtendedTxnHash}`
99283
+ );
98988
99284
  if (withdrawalFromExtendedStatus && withdrawalFromExtendedTxnHash) {
98989
99285
  const extendedHoldings2 = await extendedAdapter.getExtendedDepositAmount();
98990
- logger2.info(`extendedHoldings after withdrawal ${extendedHoldings2?.availableForWithdrawal}`);
99286
+ logger2.info(
99287
+ `extendedHoldings after withdrawal ${extendedHoldings2?.availableForWithdrawal}`
99288
+ );
98991
99289
  await new Promise((resolve) => setTimeout(resolve, 5e3));
98992
- const { calls, status } = await this.moveAssetsToVaultAllocator(params.amount, extendedAdapter);
99290
+ const { calls, status } = await this.moveAssetsToVaultAllocator(
99291
+ params.amount,
99292
+ extendedAdapter
99293
+ );
98993
99294
  if (calls.length > 0 && status) {
98994
- return this.createTransactionResult(calls, true, params, "WITHDRAWAL", params.cycleType);
99295
+ return this.createTransactionResult(
99296
+ calls,
99297
+ true,
99298
+ params,
99299
+ "WITHDRAWAL",
99300
+ params.cycleType
99301
+ );
98995
99302
  } else {
98996
- return this.createTransactionResult([], true, params, "WITHDRAWAL", params.cycleType);
99303
+ return this.createTransactionResult(
99304
+ [],
99305
+ true,
99306
+ params,
99307
+ "WITHDRAWAL",
99308
+ params.cycleType
99309
+ );
98997
99310
  }
98998
99311
  } else if (withdrawalFromExtendedStatus && !withdrawalFromExtendedTxnHash) {
98999
- logger2.error("withdrawal from extended successful, but funds didn't get transferred to the wallet");
99000
- return this.createTransactionResult([], true, params, "WITHDRAWAL", params.cycleType);
99312
+ logger2.error(
99313
+ "withdrawal from extended successful, but funds didn't get transferred to the wallet"
99314
+ );
99315
+ return this.createTransactionResult(
99316
+ [],
99317
+ true,
99318
+ params,
99319
+ "WITHDRAWAL",
99320
+ params.cycleType
99321
+ );
99001
99322
  } else {
99002
99323
  logger2.error("withdrawal from extended failed");
99003
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99324
+ return this.createTransactionResult(
99325
+ [],
99326
+ false,
99327
+ params,
99328
+ "NONE",
99329
+ params.cycleType
99330
+ );
99004
99331
  }
99005
99332
  } else if (params.to === Protocols.VAULT.name && params.from === Protocols.VESU.name) {
99006
- const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, "close" /* CLOSE */);
99333
+ const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(
99334
+ extendedAdapter,
99335
+ vesuAdapter,
99336
+ avnuAdapter,
99337
+ "close" /* CLOSE */
99338
+ );
99007
99339
  if (!isPriceDifferenceBetweenAvnuAndExtended) {
99008
- logger2.warn(`price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`);
99009
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99340
+ logger2.warn(
99341
+ `price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99342
+ );
99343
+ return this.createTransactionResult(
99344
+ [],
99345
+ false,
99346
+ params,
99347
+ "NONE",
99348
+ params.cycleType
99349
+ );
99010
99350
  }
99011
99351
  const vesuAmountInBTC = new Web3Number(
99012
99352
  params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
@@ -99020,19 +99360,41 @@ spurious results.`);
99020
99360
  await proofsInfo.callConstructor({ amount: vesuAmountInBTC })
99021
99361
  );
99022
99362
  calls.push(call);
99023
- const swapProofsInfo = avnuAdapter.getProofs(false, this.getMerkleTree());
99363
+ const swapProofsInfo = avnuAdapter.getProofs(
99364
+ false,
99365
+ this.getMerkleTree()
99366
+ );
99024
99367
  const swapProofGroups = swapProofsInfo.proofs;
99025
99368
  const swapCall = this.getManageCall(
99026
99369
  swapProofGroups,
99027
99370
  await swapProofsInfo.callConstructor({ amount: vesuAmountInBTC })
99028
99371
  );
99029
99372
  calls.push(swapCall);
99030
- return this.createTransactionResult(calls, true, params, "WITHDRAWAL", params.cycleType);
99373
+ return this.createTransactionResult(
99374
+ calls,
99375
+ true,
99376
+ params,
99377
+ "WITHDRAWAL",
99378
+ params.cycleType
99379
+ );
99031
99380
  } else if (params.to === Protocols.EXTENDED.name && params.from === Protocols.VESU.name) {
99032
- const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, "close" /* CLOSE */);
99381
+ const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(
99382
+ extendedAdapter,
99383
+ vesuAdapter,
99384
+ avnuAdapter,
99385
+ "close" /* CLOSE */
99386
+ );
99033
99387
  if (!isPriceDifferenceBetweenAvnuAndExtended) {
99034
- logger2.warn(`price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`);
99035
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99388
+ logger2.warn(
99389
+ `price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99390
+ );
99391
+ return this.createTransactionResult(
99392
+ [],
99393
+ false,
99394
+ params,
99395
+ "NONE",
99396
+ params.cycleType
99397
+ );
99036
99398
  }
99037
99399
  const vesuAmountInBTC = new Web3Number(
99038
99400
  params.amount.dividedBy(collateralPrice.price).toNumber(),
@@ -99046,7 +99408,10 @@ spurious results.`);
99046
99408
  await proofsInfo.callConstructor({ amount: vesuAmountInBTC })
99047
99409
  );
99048
99410
  calls.push(call);
99049
- const swapProofsInfo = avnuAdapter.getProofs(false, this.getMerkleTree());
99411
+ const swapProofsInfo = avnuAdapter.getProofs(
99412
+ false,
99413
+ this.getMerkleTree()
99414
+ );
99050
99415
  const swapProofGroups = swapProofsInfo.proofs;
99051
99416
  const swapCall = this.getManageCall(
99052
99417
  swapProofGroups,
@@ -99063,21 +99428,61 @@ spurious results.`);
99063
99428
  await proofsInfoDeposit.callConstructor({ amount: params.amount })
99064
99429
  );
99065
99430
  calls.push(callDeposit);
99066
- return this.createTransactionResult(calls, true, params, "DEPOSIT", params.cycleType);
99431
+ return this.createTransactionResult(
99432
+ calls,
99433
+ true,
99434
+ params,
99435
+ "DEPOSIT",
99436
+ params.cycleType
99437
+ );
99067
99438
  }
99068
- logger2.error(`Unsupported assets movement: ${params.from} to ${params.to}`);
99069
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99439
+ logger2.error(
99440
+ `Unsupported assets movement: ${params.from} to ${params.to}`
99441
+ );
99442
+ return this.createTransactionResult(
99443
+ [],
99444
+ false,
99445
+ params,
99446
+ "NONE",
99447
+ params.cycleType
99448
+ );
99070
99449
  } catch (err2) {
99071
99450
  logger2.error(`error moving assets: ${err2}`);
99072
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99451
+ return this.createTransactionResult(
99452
+ [],
99453
+ false,
99454
+ params,
99455
+ "NONE",
99456
+ params.cycleType
99457
+ );
99073
99458
  }
99074
99459
  }
99075
99460
  async handleDeposit() {
99076
99461
  try {
99077
- return this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.VAULT.name, amount: new Web3Number(0, 0) }, "NONE", "INVESTMENT" /* INVESTMENT */);
99462
+ return this.createTransactionResult(
99463
+ [],
99464
+ false,
99465
+ {
99466
+ from: Protocols.VAULT.name,
99467
+ to: Protocols.VAULT.name,
99468
+ amount: new Web3Number(0, 0)
99469
+ },
99470
+ "NONE",
99471
+ "INVESTMENT" /* INVESTMENT */
99472
+ );
99078
99473
  } catch (err2) {
99079
99474
  logger2.error(`error handling deposit: ${err2}`);
99080
- return this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.VAULT.name, amount: new Web3Number(0, 0) }, "NONE", "INVESTMENT" /* INVESTMENT */);
99475
+ return this.createTransactionResult(
99476
+ [],
99477
+ false,
99478
+ {
99479
+ from: Protocols.VAULT.name,
99480
+ to: Protocols.VAULT.name,
99481
+ amount: new Web3Number(0, 0)
99482
+ },
99483
+ "NONE",
99484
+ "INVESTMENT" /* INVESTMENT */
99485
+ );
99081
99486
  }
99082
99487
  }
99083
99488
  /**
@@ -99089,32 +99494,42 @@ spurious results.`);
99089
99494
  * @returns true if the price difference is within the acceptable range, false otherwise
99090
99495
  */
99091
99496
  async checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, positionType) {
99092
- const {
99093
- ask,
99094
- bid
99095
- } = await extendedAdapter.fetchOrderBookBTCUSDC();
99497
+ const { ask, bid } = await extendedAdapter.fetchOrderBookBTCUSDC();
99096
99498
  const price = ask.plus(bid).dividedBy(2);
99097
99499
  const btcToken = vesuAdapter.config.supportedPositions[0].asset;
99098
- const btcPriceAvnu = await avnuAdapter.getPriceOfToken(btcToken.address.toString());
99500
+ const btcPriceAvnu = await avnuAdapter.getPriceOfToken(
99501
+ btcToken.address.toString()
99502
+ );
99099
99503
  if (!btcPriceAvnu) {
99100
99504
  logger2.error(`error getting btc price avnu: ${btcPriceAvnu}`);
99101
99505
  return false;
99102
99506
  }
99103
99507
  logger2.info(`price: ${price}`);
99104
99508
  logger2.info(`btcPriceAvnu: ${btcPriceAvnu}`);
99105
- const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
99509
+ const priceDifference = new Web3Number(
99510
+ price.minus(btcPriceAvnu).toFixed(2),
99511
+ 0
99512
+ );
99106
99513
  logger2.info(`priceDifference: ${priceDifference}`);
99107
99514
  if (priceDifference.isNegative()) {
99108
99515
  return false;
99109
99516
  }
99110
99517
  if (positionType === "open" /* OPEN */) {
99111
- logger2.info(`price difference between avnu and extended for open position: ${priceDifference.toNumber()}, minimumExtendedPriceDifferenceForSwapOpen: ${avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen}`);
99112
- const result2 = priceDifference.greaterThanOrEqualTo(avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen);
99518
+ logger2.info(
99519
+ `price difference between avnu and extended for open position: ${priceDifference.toNumber()}, minimumExtendedPriceDifferenceForSwapOpen: ${avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen}`
99520
+ );
99521
+ const result2 = priceDifference.greaterThanOrEqualTo(
99522
+ avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen
99523
+ );
99113
99524
  logger2.info(`result: ${result2}`);
99114
99525
  return result2;
99115
99526
  } else {
99116
- logger2.info(`price difference between avnu and extended for close position: ${priceDifference.toNumber()}, maximumExtendedPriceDifferenceForSwapClosing: ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`);
99117
- const result2 = priceDifference.lessThanOrEqualTo(avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing);
99527
+ logger2.info(
99528
+ `price difference between avnu and extended for close position: ${priceDifference.toNumber()}, maximumExtendedPriceDifferenceForSwapClosing: ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99529
+ );
99530
+ const result2 = priceDifference.lessThanOrEqualTo(
99531
+ avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing
99532
+ );
99118
99533
  logger2.info(`result: ${result2}`);
99119
99534
  return result2;
99120
99535
  }
@@ -99136,7 +99551,19 @@ spurious results.`);
99136
99551
  amount: usdcBalanceVaultAllocator.amount
99137
99552
  });
99138
99553
  calls.push(withdrawCall2);
99139
- return [this.createTransactionResult(calls, true, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "WITHDRAWAL", "WITHDRAWAL" /* WITHDRAWAL */)];
99554
+ return [
99555
+ this.createTransactionResult(
99556
+ calls,
99557
+ true,
99558
+ {
99559
+ from: Protocols.VAULT.name,
99560
+ to: Protocols.NONE.name,
99561
+ amount
99562
+ },
99563
+ "WITHDRAWAL",
99564
+ "WITHDRAWAL" /* WITHDRAWAL */
99565
+ )
99566
+ ];
99140
99567
  }
99141
99568
  const vesuAdapter = await this.getVesuAdapter();
99142
99569
  const extendedAdapter = await this.getExtendedAdapter();
@@ -99145,18 +99572,40 @@ spurious results.`);
99145
99572
  logger2.error(
99146
99573
  `vesu or extended adapter not found: vesuAdapter=${vesuAdapter}, extendedAdapter=${extendedAdapter}`
99147
99574
  );
99148
- return [this.createTransactionResult(calls, status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99575
+ return [
99576
+ this.createTransactionResult(
99577
+ calls,
99578
+ status,
99579
+ {
99580
+ from: Protocols.VAULT.name,
99581
+ to: Protocols.NONE.name,
99582
+ amount
99583
+ },
99584
+ "NONE",
99585
+ "WITHDRAWAL" /* WITHDRAWAL */
99586
+ )
99587
+ ];
99149
99588
  }
99150
99589
  let transactionResults = [];
99151
99590
  const { collateralTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
99152
- const {
99153
- collateralPrice
99154
- } = await this.getAssetPrices();
99591
+ const { collateralPrice } = await this.getAssetPrices();
99155
99592
  const extendedPositon = await extendedAdapter.getAllOpenPositions();
99156
99593
  if (!extendedPositon) {
99157
99594
  status = false;
99158
99595
  logger2.error("error getting extended position", extendedPositon);
99159
- return [this.createTransactionResult(calls, status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99596
+ return [
99597
+ this.createTransactionResult(
99598
+ calls,
99599
+ status,
99600
+ {
99601
+ from: Protocols.VAULT.name,
99602
+ to: Protocols.NONE.name,
99603
+ amount
99604
+ },
99605
+ "NONE",
99606
+ "WITHDRAWAL" /* WITHDRAWAL */
99607
+ )
99608
+ ];
99160
99609
  }
99161
99610
  const amountDistributionForWithdrawal = await calculateAmountDistributionForWithdrawal(
99162
99611
  usdcBalanceDifference,
@@ -99169,11 +99618,27 @@ spurious results.`);
99169
99618
  logger2.error(
99170
99619
  `error calculating amount distribution for withdrawal: ${amountDistributionForWithdrawal}`
99171
99620
  );
99172
- return [this.createTransactionResult(calls, status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99621
+ return [
99622
+ this.createTransactionResult(
99623
+ calls,
99624
+ status,
99625
+ {
99626
+ from: Protocols.VAULT.name,
99627
+ to: Protocols.NONE.name,
99628
+ amount
99629
+ },
99630
+ "NONE",
99631
+ "WITHDRAWAL" /* WITHDRAWAL */
99632
+ )
99633
+ ];
99173
99634
  }
99174
99635
  const { vesu_amount, extended_amount } = amountDistributionForWithdrawal;
99175
99636
  if (status && vesu_amount.greaterThan(0)) {
99176
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
99637
+ const {
99638
+ calls: vesuCalls,
99639
+ status: vesuStatus,
99640
+ transactionMetadata: vesuTransactionMetadata
99641
+ } = await this.moveAssets(
99177
99642
  {
99178
99643
  amount: vesu_amount,
99179
99644
  from: Protocols.VESU.name,
@@ -99191,7 +99656,11 @@ spurious results.`);
99191
99656
  });
99192
99657
  }
99193
99658
  if (status && extended_amount.greaterThan(0)) {
99194
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
99659
+ const {
99660
+ calls: extendedCalls,
99661
+ status: extendedStatus,
99662
+ transactionMetadata: extendedTransactionMetadata
99663
+ } = await this.moveAssets(
99195
99664
  {
99196
99665
  amount: extended_amount,
99197
99666
  from: Protocols.EXTENDED.name,
@@ -99209,8 +99678,22 @@ spurious results.`);
99209
99678
  transactionMetadata: extendedTransactionMetadata
99210
99679
  });
99211
99680
  } else {
99212
- logger2.error("error moving assets to vault: extendedStatus: ${extendedStatus}");
99213
- return [this.createTransactionResult([], status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99681
+ logger2.error(
99682
+ "error moving assets to vault: extendedStatus: ${extendedStatus}"
99683
+ );
99684
+ return [
99685
+ this.createTransactionResult(
99686
+ [],
99687
+ status,
99688
+ {
99689
+ from: Protocols.VAULT.name,
99690
+ to: Protocols.NONE.name,
99691
+ amount
99692
+ },
99693
+ "NONE",
99694
+ "WITHDRAWAL" /* WITHDRAWAL */
99695
+ )
99696
+ ];
99214
99697
  }
99215
99698
  }
99216
99699
  const withdrawCall = await this.getBringLiquidityCall({
@@ -99232,7 +99715,19 @@ spurious results.`);
99232
99715
  return transactionResults;
99233
99716
  } catch (err2) {
99234
99717
  logger2.error(`error handling withdrawal: ${err2}`);
99235
- return [this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99718
+ return [
99719
+ this.createTransactionResult(
99720
+ [],
99721
+ false,
99722
+ {
99723
+ from: Protocols.VAULT.name,
99724
+ to: Protocols.NONE.name,
99725
+ amount
99726
+ },
99727
+ "NONE",
99728
+ "WITHDRAWAL" /* WITHDRAWAL */
99729
+ )
99730
+ ];
99236
99731
  }
99237
99732
  }
99238
99733
  async getAUM() {
@@ -99284,8 +99779,12 @@ spurious results.`);
99284
99779
  const txnsToBeExecuted = txnData.filter((txn) => {
99285
99780
  return txn.transactionMetadata.transactionType !== "NONE" && txn.transactionMetadata.protocolFrom !== "" && txn.transactionMetadata.protocolTo !== "";
99286
99781
  });
99287
- const callsToBeExecutedFinal = txnsToBeExecuted.flatMap((txn) => txn.calls);
99288
- const txnMetadata = txnsToBeExecuted.map((txn) => txn.transactionMetadata);
99782
+ const callsToBeExecutedFinal = txnsToBeExecuted.flatMap(
99783
+ (txn) => txn.calls
99784
+ );
99785
+ const txnMetadata = txnsToBeExecuted.map(
99786
+ (txn) => txn.transactionMetadata
99787
+ );
99289
99788
  return { callsToBeExecutedFinal, txnMetadata };
99290
99789
  } catch (err2) {
99291
99790
  logger2.error(`error processing transaction data from SDK: ${err2}`);
@@ -99315,23 +99814,42 @@ spurious results.`);
99315
99814
  if (!vesuAdapter || !extendedAdapter) {
99316
99815
  return new Web3Number(0, 0);
99317
99816
  }
99318
- const extendedFundingRate = new Web3Number((await extendedAdapter.getNetAPY()).toFixed(4), 0);
99817
+ const extendedFundingRate = new Web3Number(
99818
+ (await extendedAdapter.getNetAPY()).toFixed(4),
99819
+ 0
99820
+ );
99319
99821
  const extendedPositions = await extendedAdapter.getAllOpenPositions();
99320
99822
  if (!extendedPositions || extendedPositions.length === 0) {
99321
99823
  logger2.info(`no extended positions found`);
99322
99824
  return new Web3Number(0, 0);
99323
99825
  }
99324
- const extendePositionSizeUSD = new Web3Number(extendedPositions[0].value || 0, 0);
99826
+ const extendePositionSizeUSD = new Web3Number(
99827
+ extendedPositions[0].value || 0,
99828
+ 0
99829
+ );
99325
99830
  const vesuPositions = await vesuAdapter.getPositions();
99326
99831
  const vesuSupplyApy = vesuPositions[0].apy.apy;
99327
- const vesuCollateralSizeUSD = new Web3Number(vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS), USDC_TOKEN_DECIMALS);
99328
- const vesuDebtSizeUSD = new Web3Number(vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS), USDC_TOKEN_DECIMALS);
99832
+ const vesuCollateralSizeUSD = new Web3Number(
99833
+ vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99834
+ USDC_TOKEN_DECIMALS
99835
+ );
99836
+ const vesuDebtSizeUSD = new Web3Number(
99837
+ vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99838
+ USDC_TOKEN_DECIMALS
99839
+ );
99329
99840
  const num1 = extendePositionSizeUSD.multipliedBy(extendedFundingRate);
99330
99841
  const num2 = vesuCollateralSizeUSD.multipliedBy(vesuSupplyApy);
99331
99842
  const num3 = vesuDebtSizeUSD.abs();
99332
99843
  const maxBorrowApy = num1.plus(num2).minus(0.1).dividedBy(num3);
99333
- const vesuMaxBorrowableAmount = await vesuAdapter.vesuAdapter.getMaxBorrowableByInterestRate(this.config, vesuAdapter.config.debt, maxBorrowApy.toNumber());
99334
- return new Web3Number(vesuMaxBorrowableAmount.toFixed(USDC_TOKEN_DECIMALS), USDC_TOKEN_DECIMALS);
99844
+ const vesuMaxBorrowableAmount = await vesuAdapter.vesuAdapter.getMaxBorrowableByInterestRate(
99845
+ this.config,
99846
+ vesuAdapter.config.debt,
99847
+ maxBorrowApy.toNumber()
99848
+ );
99849
+ return new Web3Number(
99850
+ vesuMaxBorrowableAmount.toFixed(USDC_TOKEN_DECIMALS),
99851
+ USDC_TOKEN_DECIMALS
99852
+ );
99335
99853
  }
99336
99854
  async getVesuHealthFactors() {
99337
99855
  const vesuAdapter = await this.getVesuAdapter();
@@ -99340,18 +99858,33 @@ spurious results.`);
99340
99858
  return [0, 0];
99341
99859
  }
99342
99860
  const vesuPositions = await vesuAdapter.getPositions();
99343
- const vesuCollateralSizeUSD = new Web3Number(vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS), 0);
99344
- const vesuDebtSizeUSD = new Web3Number(vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS), 0);
99861
+ const vesuCollateralSizeUSD = new Web3Number(
99862
+ vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99863
+ 0
99864
+ );
99865
+ const vesuDebtSizeUSD = new Web3Number(
99866
+ vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99867
+ 0
99868
+ );
99345
99869
  const actualLtv = vesuDebtSizeUSD.dividedBy(vesuCollateralSizeUSD).abs();
99346
99870
  logger2.info(`actualLtv: ${actualLtv.toNumber()}`);
99347
- const maxLtv = new Web3Number(await vesuAdapter.vesuAdapter.getLTVConfig(this.config), 4);
99348
- const healthFactor = new Web3Number(maxLtv.dividedBy(actualLtv).toFixed(4), 4);
99871
+ const maxLtv = new Web3Number(
99872
+ await vesuAdapter.vesuAdapter.getLTVConfig(this.config),
99873
+ 4
99874
+ );
99875
+ const healthFactor = new Web3Number(
99876
+ maxLtv.dividedBy(actualLtv).toFixed(4),
99877
+ 4
99878
+ );
99349
99879
  logger2.info(`healthFactor: ${healthFactor.toNumber()}`);
99350
99880
  const extendedBalance = await extendedAdapter.getExtendedDepositAmount();
99351
99881
  if (!extendedBalance) {
99352
99882
  return [0, 0];
99353
99883
  }
99354
- const extendedLeverage = new Web3Number((Number(extendedBalance.marginRatio) * 100).toFixed(4), 4);
99884
+ const extendedLeverage = new Web3Number(
99885
+ (Number(extendedBalance.marginRatio) * 100).toFixed(4),
99886
+ 4
99887
+ );
99355
99888
  logger2.info(`extendedLeverage: ${extendedLeverage.toNumber()}`);
99356
99889
  return [healthFactor.toNumber(), extendedLeverage.toNumber()];
99357
99890
  }
@@ -99372,12 +99905,16 @@ spurious results.`);
99372
99905
  splits: []
99373
99906
  };
99374
99907
  }
99375
- let vesuPositions = allPositions.filter((item) => item.protocol === Protocols.VESU);
99908
+ let vesuPositions = allPositions.filter(
99909
+ (item) => item.protocol === Protocols.VESU
99910
+ );
99376
99911
  vesuPositions.map((item) => {
99377
99912
  item.apy.apy = item.apy.apy * 0.1;
99378
99913
  });
99379
99914
  const extendedPositions = await extendedAdapter.getAllOpenPositions();
99380
- const usdcToken = Global.getDefaultTokens().find((token) => token.symbol === "USDC");
99915
+ const usdcToken = Global.getDefaultTokens().find(
99916
+ (token) => token.symbol === "USDC"
99917
+ );
99381
99918
  if (!extendedPositions || !usdcToken) {
99382
99919
  return {
99383
99920
  net: 0,
@@ -99390,7 +99927,10 @@ spurious results.`);
99390
99927
  const totalHoldingsUSDValue = allPositions.reduce((acc, curr) => acc + curr.usdValue, 0) + Number(extendedEquity);
99391
99928
  console.log(totalHoldingsUSDValue);
99392
99929
  const extendedPositionSizeMultipliedByApy = Number(extendedPosition.value) * extendedApy;
99393
- let weightedAPYs = allPositions.reduce((acc, curr) => acc + curr.apy.apy * curr.usdValue, 0) + extendedPositionSizeMultipliedByApy;
99930
+ let weightedAPYs = allPositions.reduce(
99931
+ (acc, curr) => acc + curr.apy.apy * curr.usdValue,
99932
+ 0
99933
+ ) + extendedPositionSizeMultipliedByApy;
99394
99934
  console.log(weightedAPYs);
99395
99935
  const netAPY = weightedAPYs / totalHoldingsUSDValue;
99396
99936
  console.log(netAPY);
@@ -99404,13 +99944,22 @@ spurious results.`);
99404
99944
  });
99405
99945
  return {
99406
99946
  net: netAPY,
99407
- splits: allPositions.map((p) => ({ apy: p.apy.apy, id: p.remarks ?? "" }))
99947
+ splits: allPositions.map((p) => ({
99948
+ apy: p.apy.apy,
99949
+ id: p.remarks ?? ""
99950
+ }))
99408
99951
  };
99409
99952
  }
99410
99953
  async getWalletHoldings() {
99411
- const usdceToken = Global.getDefaultTokens().find((token) => token.symbol === "USDCe");
99412
- const wbtcToken = Global.getDefaultTokens().find((token) => token.symbol === "WBTC");
99413
- const usdcToken = Global.getDefaultTokens().find((token) => token.symbol === "USDC");
99954
+ const usdceToken = Global.getDefaultTokens().find(
99955
+ (token) => token.symbol === "USDCe"
99956
+ );
99957
+ const wbtcToken = Global.getDefaultTokens().find(
99958
+ (token) => token.symbol === "WBTC"
99959
+ );
99960
+ const usdcToken = Global.getDefaultTokens().find(
99961
+ (token) => token.symbol === "USDC"
99962
+ );
99414
99963
  if (!usdceToken || !wbtcToken || !usdcToken) {
99415
99964
  return [];
99416
99965
  }
@@ -99484,9 +100033,7 @@ spurious results.`);
99484
100033
  });
99485
100034
  const extendedAdapter = new ExtendedAdapter({
99486
100035
  ...baseAdapterConfig,
99487
- supportedPositions: [
99488
- { asset: usdcToken, isDebt: true }
99489
- ],
100036
+ supportedPositions: [{ asset: usdcToken, isDebt: true }],
99490
100037
  vaultIdExtended,
99491
100038
  extendedContract: EXTENDED_CONTRACT,
99492
100039
  extendedBackendWriteUrl,
@@ -99543,11 +100090,11 @@ spurious results.`);
99543
100090
  asset: wbtcToken.address
99544
100091
  });
99545
100092
  vaultSettings.leafAdapters.push(() => vesuMultiplyAdapter.getDepositLeaf());
100093
+ vaultSettings.leafAdapters.push(() => vesuMultiplyAdapter.getWithdrawLeaf());
100094
+ vaultSettings.leafAdapters.push(() => extendedAdapter.getDepositLeaf());
99546
100095
  vaultSettings.leafAdapters.push(
99547
- () => vesuMultiplyAdapter.getWithdrawLeaf()
100096
+ () => extendedAdapter.getSwapFromLegacyLeaf()
99548
100097
  );
99549
- vaultSettings.leafAdapters.push(() => extendedAdapter.getDepositLeaf());
99550
- vaultSettings.leafAdapters.push(() => extendedAdapter.getSwapFromLegacyLeaf());
99551
100098
  vaultSettings.leafAdapters.push(() => avnuAdapter.getDepositLeaf());
99552
100099
  vaultSettings.leafAdapters.push(() => avnuAdapter.getWithdrawLeaf());
99553
100100
  vaultSettings.leafAdapters.push(
@@ -99592,29 +100139,70 @@ spurious results.`);
99592
100139
  " to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
99593
100140
  ] }),
99594
100141
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
99595
- "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a ",
99596
- highlightTextWithLinks("conversion rate oracle", [{ highlight: "conversion rate oracle", link: "https://docs.pragma.build/starknet/development#conversion-rate" }]),
100142
+ "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
100143
+ " ",
100144
+ highlightTextWithLinks("conversion rate oracle", [
100145
+ {
100146
+ highlight: "conversion rate oracle",
100147
+ link: "https://docs.pragma.build/starknet/development#conversion-rate"
100148
+ }
100149
+ ]),
99597
100150
  " ",
99598
100151
  "which is resilient to liquidity issues and price volatility, hence reducing the risk of liquidation. However, overtime, if left un-monitored, debt can increase enough to trigger a liquidation. But no worries, our continuous monitoring systems look for situations with reduced health factor and balance collateral/debt to bring it back to safe levels. With Troves, you can have a peaceful sleep."
99599
100152
  ] }),
99600
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
99601
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
99602
- " Requests can take up to ",
99603
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
99604
- " to process as the vault unwinds and settles routing."
99605
- ] }) }),
99606
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
99607
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
99608
- " Pools on Vesu have debt caps that are gradually increased over time. Until caps are raised, deposited Tokens remain in the vault, generating a shared net return for all depositors. There is no additional fee taken by Troves on Yield token's APY, its only on added gain."
99609
- ] }) })
100153
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
100154
+ "div",
100155
+ {
100156
+ style: {
100157
+ backgroundColor: "#222",
100158
+ padding: "10px",
100159
+ borderRadius: "8px",
100160
+ marginBottom: "20px",
100161
+ border: "1px solid #444"
100162
+ },
100163
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
100164
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
100165
+ " Requests can take up to",
100166
+ " ",
100167
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
100168
+ " to process as the vault unwinds and settles routing."
100169
+ ] })
100170
+ }
100171
+ ),
100172
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
100173
+ "div",
100174
+ {
100175
+ style: {
100176
+ backgroundColor: "#222",
100177
+ padding: "10px",
100178
+ borderRadius: "8px",
100179
+ marginBottom: "20px",
100180
+ border: "1px solid #444"
100181
+ },
100182
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
100183
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
100184
+ " Pools on Vesu have debt caps that are gradually increased over time. Until caps are raised, deposited Tokens remain in the vault, generating a shared net return for all depositors. There is no additional fee taken by Troves on Yield token's APY, its only on added gain."
100185
+ ] })
100186
+ }
100187
+ )
99610
100188
  ] });
99611
100189
  }
99612
100190
  var re7UsdcPrimeDevansh = {
99613
- vaultAddress: ContractAddr.from("0x058905be22d6a81792df79425dc9641cf3e1b77f36748631b7d7e5d713a32b55"),
99614
- manager: ContractAddr.from("0x02648d703783feb2d967cf0520314cb5aa800d69a9426f3e3b317395af44de16"),
99615
- vaultAllocator: ContractAddr.from("0x07d533c838eab6a4d854dd3aea96a55993fccd35821921970d00bde946b63b6f"),
99616
- redeemRequestNFT: ContractAddr.from("0x01ef91f08fb99729c00f82fc6e0ece37917bcc43952596c19996259dc8adbbba"),
99617
- aumOracle: ContractAddr.from("0x030b6acfec162f5d6e72b8a4d2798aedce78fb39de78a8f549f7cd277ae8bc8d"),
100191
+ vaultAddress: ContractAddr.from(
100192
+ "0x058905be22d6a81792df79425dc9641cf3e1b77f36748631b7d7e5d713a32b55"
100193
+ ),
100194
+ manager: ContractAddr.from(
100195
+ "0x02648d703783feb2d967cf0520314cb5aa800d69a9426f3e3b317395af44de16"
100196
+ ),
100197
+ vaultAllocator: ContractAddr.from(
100198
+ "0x07d533c838eab6a4d854dd3aea96a55993fccd35821921970d00bde946b63b6f"
100199
+ ),
100200
+ redeemRequestNFT: ContractAddr.from(
100201
+ "0x01ef91f08fb99729c00f82fc6e0ece37917bcc43952596c19996259dc8adbbba"
100202
+ ),
100203
+ aumOracle: ContractAddr.from(
100204
+ "0x030b6acfec162f5d6e72b8a4d2798aedce78fb39de78a8f549f7cd277ae8bc8d"
100205
+ ),
99618
100206
  leafAdapters: [],
99619
100207
  adapters: [],
99620
100208
  targetHealthFactor: 1.4,
@@ -99626,13 +100214,29 @@ spurious results.`);
99626
100214
  "0.001",
99627
100215
  Global.getDefaultTokens().find((token) => token.symbol === "WBTC").decimals
99628
100216
  ),
99629
- borrowable_assets: [Global.getDefaultTokens().find((token) => token.symbol === "WBTC")],
100217
+ borrowable_assets: [
100218
+ Global.getDefaultTokens().find((token) => token.symbol === "WBTC")
100219
+ ],
99630
100220
  minimumWBTCDifferenceForAvnuSwap: MINIMUM_WBTC_DIFFERENCE_FOR_AVNU_SWAP,
99631
100221
  walletAddress: WALLET_ADDRESS
99632
100222
  };
99633
100223
  var VesuExtendedTestStrategies = (extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing) => {
99634
100224
  return [
99635
- getStrategySettingsVesuExtended("WBTC", "USDC", re7UsdcPrimeDevansh, false, false, extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing)
100225
+ getStrategySettingsVesuExtended(
100226
+ "WBTC",
100227
+ "USDC",
100228
+ re7UsdcPrimeDevansh,
100229
+ false,
100230
+ false,
100231
+ extendedBackendReadUrl,
100232
+ extendedBackendWriteUrl,
100233
+ vaultIdExtended,
100234
+ minimumExtendedMovementAmount,
100235
+ minimumVesuMovementAmount,
100236
+ minimumExtendedRetriesDelayForOrderStatus,
100237
+ minimumExtendedPriceDifferenceForSwapOpen,
100238
+ maximumExtendedPriceDifferenceForSwapClosing
100239
+ )
99636
100240
  ];
99637
100241
  };
99638
100242
  function getStrategySettingsVesuExtended(lstSymbol, underlyingSymbol, addresses, isPreview = false, isLST, extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing) {
@@ -99642,8 +100246,25 @@ spurious results.`);
99642
100246
  address: addresses.vaultAddress,
99643
100247
  launchBlock: 0,
99644
100248
  type: "Other",
99645
- depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol)],
99646
- additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7USDCPrime, extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing),
100249
+ depositTokens: [
100250
+ Global.getDefaultTokens().find(
100251
+ (token) => token.symbol === underlyingSymbol
100252
+ )
100253
+ ],
100254
+ additionalInfo: getLooperSettings2(
100255
+ lstSymbol,
100256
+ underlyingSymbol,
100257
+ addresses,
100258
+ VesuPools.Re7USDCPrime,
100259
+ extendedBackendReadUrl,
100260
+ extendedBackendWriteUrl,
100261
+ vaultIdExtended,
100262
+ minimumExtendedMovementAmount,
100263
+ minimumVesuMovementAmount,
100264
+ minimumExtendedRetriesDelayForOrderStatus,
100265
+ minimumExtendedPriceDifferenceForSwapOpen,
100266
+ maximumExtendedPriceDifferenceForSwapClosing
100267
+ ),
99647
100268
  risk: {
99648
100269
  riskFactor: _riskFactor3,
99649
100270
  netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),