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

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,8 +28726,10 @@ ${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,
28732
+ calculatePositionToCloseToWithdrawAmount: () => calculatePositionToCloseToWithdrawAmount,
28731
28733
  calculateVesUPositionSizeGivenExtended: () => calculateVesUPositionSizeGivenExtended,
28732
28734
  calculateVesuLeverage: () => calculateVesuLeverage,
28733
28735
  calculateWBTCAmountToMaintainLTV: () => calculateWBTCAmountToMaintainLTV,
@@ -68192,10 +68194,10 @@ ${JSON.stringify(data, null, 2)}`;
68192
68194
  return old;
68193
68195
  }
68194
68196
 
68195
- // node_modules/.pnpm/@apollo+client@3.11.8_@types+react@19.1.11_graphql@16.9.0/node_modules/@apollo/client/version.js
68197
+ // 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
68198
  var version4 = "3.11.8";
68197
68199
 
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
68200
+ // 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
68201
  function maybe(thunk) {
68200
68202
  try {
68201
68203
  return thunk();
@@ -68203,7 +68205,7 @@ ${JSON.stringify(data, null, 2)}`;
68203
68205
  }
68204
68206
  }
68205
68207
 
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
68208
+ // 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
68209
  var global_default = maybe(function() {
68208
68210
  return globalThis;
68209
68211
  }) || maybe(function() {
@@ -68222,7 +68224,7 @@ ${JSON.stringify(data, null, 2)}`;
68222
68224
  return maybe.constructor("return this")();
68223
68225
  });
68224
68226
 
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
68227
+ // 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
68228
  var prefixCounts = /* @__PURE__ */ new Map();
68227
68229
  function makeUniqueId(prefix) {
68228
68230
  var count = prefixCounts.get(prefix) || 1;
@@ -68230,7 +68232,7 @@ ${JSON.stringify(data, null, 2)}`;
68230
68232
  return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
68231
68233
  }
68232
68234
 
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
68235
+ // 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
68236
  function stringifyForDisplay(value, space) {
68235
68237
  if (space === void 0) {
68236
68238
  space = 0;
@@ -68241,7 +68243,7 @@ ${JSON.stringify(data, null, 2)}`;
68241
68243
  }, space).split(JSON.stringify(undefId)).join("<undefined>");
68242
68244
  }
68243
68245
 
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
68246
+ // 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
68247
  function wrap(fn) {
68246
68248
  return function(message) {
68247
68249
  var args = [];
@@ -68312,7 +68314,7 @@ ${JSON.stringify(data, null, 2)}`;
68312
68314
  })));
68313
68315
  }
68314
68316
 
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
68317
+ // 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
68318
  var DEV = globalThis.__DEV__ !== false;
68317
68319
 
68318
68320
  // node_modules/.pnpm/graphql@16.9.0/node_modules/graphql/jsutils/devAssert.mjs
@@ -71387,7 +71389,7 @@ spurious results.`);
71387
71389
  return node.kind === Kind.FIELD || node.kind === Kind.FRAGMENT_SPREAD || node.kind === Kind.INLINE_FRAGMENT;
71388
71390
  }
71389
71391
 
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
71392
+ // 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
71393
  function shouldInclude(_a21, variables) {
71392
71394
  var directives = _a21.directives;
71393
71395
  if (!directives || !directives.length) {
@@ -71515,7 +71517,7 @@ spurious results.`);
71515
71517
  return false;
71516
71518
  }
71517
71519
 
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
71520
+ // 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
71521
  var isReactNative = maybe(function() {
71520
71522
  return navigator.product;
71521
71523
  }) == "ReactNative";
@@ -71540,12 +71542,12 @@ spurious results.`);
71540
71542
  }) || false
71541
71543
  );
71542
71544
 
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
71545
+ // 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
71546
  function isNonNullObject(obj) {
71545
71547
  return obj !== null && typeof obj === "object";
71546
71548
  }
71547
71549
 
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
71550
+ // 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
71551
  function getFragmentQueryDocument(document2, fragmentName) {
71550
71552
  var actualFragmentName = fragmentName;
71551
71553
  var fragments = [];
@@ -71841,7 +71843,7 @@ spurious results.`);
71841
71843
  }
71842
71844
  };
71843
71845
 
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
71846
+ // 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
71847
  var scheduledCleanup = /* @__PURE__ */ new WeakSet();
71846
71848
  function schedule(cache) {
71847
71849
  if (cache.size <= (cache.max || -1)) {
@@ -71874,11 +71876,11 @@ spurious results.`);
71874
71876
  return cache;
71875
71877
  };
71876
71878
 
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
71879
+ // 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
71880
  var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
71879
71881
  var cacheSizes = __assign({}, global_default[cacheSizeSymbol]);
71880
71882
 
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
71883
+ // 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
71884
  var globalCaches = {};
71883
71885
  function registerGlobalCache(name, getSize) {
71884
71886
  globalCaches[name] = getSize;
@@ -71968,7 +71970,7 @@ spurious results.`);
71968
71970
  ], 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
71971
  }
71970
71972
 
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
71973
+ // 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
71974
  var canonicalStringify = Object.assign(function canonicalStringify2(value) {
71973
71975
  return JSON.stringify(value, stableObjectReplacer);
71974
71976
  }, {
@@ -72015,7 +72017,7 @@ spurious results.`);
72015
72017
  return i === 0 || keys[i - 1] <= key;
72016
72018
  }
72017
72019
 
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
72020
+ // 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
72021
  function makeReference(id) {
72020
72022
  return { __ref: String(id) };
72021
72023
  }
@@ -72200,7 +72202,7 @@ spurious results.`);
72200
72202
  return selection.kind === "InlineFragment";
72201
72203
  }
72202
72204
 
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
72205
+ // 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
72206
  function checkDocument(doc) {
72205
72207
  invariant2(doc && doc.kind === "Document", 77);
72206
72208
  var operations = doc.definitions.filter(function(d) {
@@ -72759,7 +72761,7 @@ spurious results.`);
72759
72761
  return Object.freeze(optimistic);
72760
72762
  }
72761
72763
 
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
72764
+ // 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
72765
  function identity(document2) {
72764
72766
  return document2;
72765
72767
  }
@@ -72843,7 +72845,7 @@ spurious results.`);
72843
72845
  })()
72844
72846
  );
72845
72847
 
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
72848
+ // 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
72849
  var printCache;
72848
72850
  var print2 = Object.assign(function(ast) {
72849
72851
  var result2 = printCache.get(ast);
@@ -72867,13 +72869,13 @@ spurious results.`);
72867
72869
  });
72868
72870
  }
72869
72871
 
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
72872
+ // 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
72873
  var isArray2 = Array.isArray;
72872
72874
  function isNonEmptyArray(value) {
72873
72875
  return Array.isArray(value) && value.length > 0;
72874
72876
  }
72875
72877
 
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
72878
+ // 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
72879
  var TYPENAME_FIELD = {
72878
72880
  kind: Kind.FIELD,
72879
72881
  name: {
@@ -73165,7 +73167,7 @@ spurious results.`);
73165
73167
  return modifiedDoc;
73166
73168
  }
73167
73169
 
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
73170
+ // 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
73171
  var hasOwnProperty4 = Object.prototype.hasOwnProperty;
73170
73172
  function mergeDeep() {
73171
73173
  var sources = [];
@@ -73801,7 +73803,7 @@ spurious results.`);
73801
73803
  }
73802
73804
  var result = symbolObservablePonyfill(root);
73803
73805
 
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
73806
+ // 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
73807
  var prototype2 = Observable.prototype;
73806
73808
  var fakeObsSymbol = "@@observable";
73807
73809
  if (!prototype2[fakeObsSymbol]) {
@@ -73810,7 +73812,7 @@ spurious results.`);
73810
73812
  };
73811
73813
  }
73812
73814
 
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
73815
+ // 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
73816
  var toString4 = Object.prototype.toString;
73815
73817
  function cloneDeep(value) {
73816
73818
  return cloneDeepHelper(value);
@@ -73844,7 +73846,7 @@ spurious results.`);
73844
73846
  }
73845
73847
  }
73846
73848
 
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
73849
+ // 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
73850
  function deepFreeze(value) {
73849
73851
  var workSet = /* @__PURE__ */ new Set([value]);
73850
73852
  workSet.forEach(function(obj) {
@@ -73876,7 +73878,7 @@ spurious results.`);
73876
73878
  return obj;
73877
73879
  }
73878
73880
 
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
73881
+ // 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
73882
  function iterateObserversSafely(observers, method, argument) {
73881
73883
  var observersWithMethod = [];
73882
73884
  observers.forEach(function(obs) {
@@ -73887,7 +73889,7 @@ spurious results.`);
73887
73889
  });
73888
73890
  }
73889
73891
 
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
73892
+ // 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
73893
  function asyncMap(observable, mapFn, catchFn) {
73892
73894
  return new Observable(function(observer) {
73893
73895
  var promiseQueue = {
@@ -73935,7 +73937,7 @@ spurious results.`);
73935
73937
  });
73936
73938
  }
73937
73939
 
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
73940
+ // 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
73941
  function fixObservableSubclass(subclass) {
73940
73942
  function set(key) {
73941
73943
  Object.defineProperty(subclass, key, { value: Observable });
@@ -73947,7 +73949,7 @@ spurious results.`);
73947
73949
  return subclass;
73948
73950
  }
73949
73951
 
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
73952
+ // 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
73953
  function isPromiseLike(value) {
73952
73954
  return value && typeof value.then === "function";
73953
73955
  }
@@ -74088,7 +74090,7 @@ spurious results.`);
74088
74090
  );
74089
74091
  fixObservableSubclass(Concast);
74090
74092
 
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
74093
+ // 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
74094
  function isExecutionPatchIncrementalResult(value) {
74093
74095
  return "incremental" in value;
74094
74096
  }
@@ -74120,7 +74122,7 @@ spurious results.`);
74120
74122
  return mergedData;
74121
74123
  }
74122
74124
 
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
74125
+ // 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
74126
  function graphQLResultHasError(result2) {
74125
74127
  var errors2 = getGraphQLErrorsFromResult(result2);
74126
74128
  return isNonEmptyArray(errors2);
@@ -74137,7 +74139,7 @@ spurious results.`);
74137
74139
  return graphQLErrors;
74138
74140
  }
74139
74141
 
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
74142
+ // 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
74143
  function compact() {
74142
74144
  var objects = [];
74143
74145
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -74157,21 +74159,21 @@ spurious results.`);
74157
74159
  return result2;
74158
74160
  }
74159
74161
 
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
74162
+ // 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
74163
  function mergeOptions(defaults2, options) {
74162
74164
  return compact(defaults2, options, options.variables && {
74163
74165
  variables: compact(__assign(__assign({}, defaults2 && defaults2.variables), options.variables))
74164
74166
  });
74165
74167
  }
74166
74168
 
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
74169
+ // 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
74170
  function fromError(errorValue) {
74169
74171
  return new Observable(function(observer) {
74170
74172
  observer.error(errorValue);
74171
74173
  });
74172
74174
  }
74173
74175
 
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
74176
+ // 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
74177
  var throwServerError = function(response, result2, message) {
74176
74178
  var error2 = new Error(message);
74177
74179
  error2.name = "ServerError";
@@ -74181,7 +74183,7 @@ spurious results.`);
74181
74183
  throw error2;
74182
74184
  };
74183
74185
 
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
74186
+ // 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
74187
  function validateOperation(operation) {
74186
74188
  var OPERATION_FIELDS = [
74187
74189
  "query",
@@ -74199,7 +74201,7 @@ spurious results.`);
74199
74201
  return operation;
74200
74202
  }
74201
74203
 
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
74204
+ // 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
74205
  function createOperation(starting, operation) {
74204
74206
  var context = __assign({}, starting);
74205
74207
  var setContext = function(next) {
@@ -74223,7 +74225,7 @@ spurious results.`);
74223
74225
  return operation;
74224
74226
  }
74225
74227
 
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
74228
+ // 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
74229
  function transformOperation(operation) {
74228
74230
  var transformedOperation = {
74229
74231
  variables: operation.variables || {},
@@ -74237,7 +74239,7 @@ spurious results.`);
74237
74239
  return transformedOperation;
74238
74240
  }
74239
74241
 
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
74242
+ // 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
74243
  function filterOperationVariables(variables, query) {
74242
74244
  var result2 = __assign({}, variables);
74243
74245
  var unusedNames = new Set(Object.keys(variables));
@@ -74254,7 +74256,7 @@ spurious results.`);
74254
74256
  return result2;
74255
74257
  }
74256
74258
 
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
74259
+ // 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
74260
  function passthrough(op, forward) {
74259
74261
  return forward ? forward(op) : Observable.of();
74260
74262
  }
@@ -74348,10 +74350,10 @@ spurious results.`);
74348
74350
  })()
74349
74351
  );
74350
74352
 
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
74353
+ // 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
74354
  var execute = ApolloLink.execute;
74353
74355
 
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
74356
+ // 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
74357
  function asyncIterator(source) {
74356
74358
  var _a21;
74357
74359
  var iterator2 = source[Symbol.asyncIterator]();
@@ -74364,7 +74366,7 @@ spurious results.`);
74364
74366
  }, _a21;
74365
74367
  }
74366
74368
 
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
74369
+ // 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
74370
  function nodeStreamIterator(stream) {
74369
74371
  var cleanup = null;
74370
74372
  var error2 = null;
@@ -74435,7 +74437,7 @@ spurious results.`);
74435
74437
  return iterator2;
74436
74438
  }
74437
74439
 
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
74440
+ // 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
74441
  function promiseIterator(promise) {
74440
74442
  var resolved = false;
74441
74443
  var iterator2 = {
@@ -74461,7 +74463,7 @@ spurious results.`);
74461
74463
  return iterator2;
74462
74464
  }
74463
74465
 
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
74466
+ // 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
74467
  function readerIterator(reader) {
74466
74468
  var iterator2 = {
74467
74469
  next: function() {
@@ -74476,7 +74478,7 @@ spurious results.`);
74476
74478
  return iterator2;
74477
74479
  }
74478
74480
 
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
74481
+ // 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
74482
  function isNodeResponse(value) {
74481
74483
  return !!value.body;
74482
74484
  }
@@ -74513,7 +74515,7 @@ spurious results.`);
74513
74515
  throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
74514
74516
  }
74515
74517
 
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
74518
+ // 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
74519
  var PROTOCOL_ERRORS_SYMBOL = Symbol();
74518
74520
  function graphQLResultHasProtocolErrors(result2) {
74519
74521
  if (result2.extensions) {
@@ -74558,7 +74560,7 @@ spurious results.`);
74558
74560
  })(Error)
74559
74561
  );
74560
74562
 
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
74563
+ // 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
74564
  var hasOwnProperty5 = Object.prototype.hasOwnProperty;
74563
74565
  function readMultipartBody(response, nextValue) {
74564
74566
  return __awaiter(this, void 0, void 0, function() {
@@ -74702,7 +74704,7 @@ spurious results.`);
74702
74704
  };
74703
74705
  }
74704
74706
 
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
74707
+ // 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
74708
  var serializeFetchParameter = function(p, label) {
74707
74709
  var serialized;
74708
74710
  try {
@@ -74715,7 +74717,7 @@ spurious results.`);
74715
74717
  return serialized;
74716
74718
  };
74717
74719
 
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
74720
+ // 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
74721
  var defaultHttpOptions = {
74720
74722
  includeQuery: true,
74721
74723
  includeExtensions: false,
@@ -74799,14 +74801,14 @@ spurious results.`);
74799
74801
  return normalizedHeaders;
74800
74802
  }
74801
74803
 
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
74804
+ // 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
74805
  var checkFetcher = function(fetcher) {
74804
74806
  if (!fetcher && typeof fetch === "undefined") {
74805
74807
  throw newInvariantError(38);
74806
74808
  }
74807
74809
  };
74808
74810
 
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
74811
+ // 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
74812
  var selectURI = function(operation, fallbackURI) {
74811
74813
  var context = operation.getContext();
74812
74814
  var contextURI = context.uri;
@@ -74819,7 +74821,7 @@ spurious results.`);
74819
74821
  }
74820
74822
  };
74821
74823
 
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
74824
+ // 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
74825
  function rewriteURIForGET(chosenURI, body) {
74824
74826
  var queryParams = [];
74825
74827
  var addQueryParam = function(key, value) {
@@ -74860,7 +74862,7 @@ spurious results.`);
74860
74862
  return { newURI };
74861
74863
  }
74862
74864
 
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
74865
+ // 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
74866
  var backupFetch = maybe(function() {
74865
74867
  return fetch;
74866
74868
  });
@@ -74980,7 +74982,7 @@ spurious results.`);
74980
74982
  });
74981
74983
  };
74982
74984
 
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
74985
+ // 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
74986
  var HttpLink = (
74985
74987
  /** @class */
74986
74988
  (function(_super) {
@@ -75133,7 +75135,7 @@ spurious results.`);
75133
75135
  return false;
75134
75136
  }
75135
75137
 
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
75138
+ // 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
75139
  function equalByQuery(query, _a21, _b, variables) {
75138
75140
  var aData = _a21.data, aRest = __rest(_a21, ["data"]);
75139
75141
  var bData = _b.data, bRest = __rest(_b, ["data"]);
@@ -75206,7 +75208,7 @@ spurious results.`);
75206
75208
  return dir.name.value === "nonreactive";
75207
75209
  }
75208
75210
 
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
75211
+ // 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
75212
  var ApolloCache = (
75211
75213
  /** @class */
75212
75214
  (function() {
@@ -75338,7 +75340,7 @@ spurious results.`);
75338
75340
  ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;
75339
75341
  }
75340
75342
 
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
75343
+ // 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
75344
  var MissingFieldError = (
75343
75345
  /** @class */
75344
75346
  (function(_super) {
@@ -75365,7 +75367,7 @@ spurious results.`);
75365
75367
  })(Error)
75366
75368
  );
75367
75369
 
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
75370
+ // 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
75371
  var hasOwn = Object.prototype.hasOwnProperty;
75370
75372
  function isNullish(value) {
75371
75373
  return value === null || value === void 0;
@@ -75441,7 +75443,7 @@ spurious results.`);
75441
75443
  };
75442
75444
  }
75443
75445
 
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
75446
+ // 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
75447
  var DELETE = /* @__PURE__ */ Object.create(null);
75446
75448
  var delModifier = function() {
75447
75449
  return DELETE;
@@ -75958,7 +75960,7 @@ spurious results.`);
75958
75960
  return !!(store instanceof EntityStore && store.group.caching);
75959
75961
  }
75960
75962
 
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
75963
+ // 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
75964
  function shallowCopy(value) {
75963
75965
  if (isNonNullObject(value)) {
75964
75966
  return isArray2(value) ? value.slice(0) : __assign({ __proto__: Object.getPrototypeOf(value) }, value);
@@ -76052,7 +76054,7 @@ spurious results.`);
76052
76054
  })()
76053
76055
  );
76054
76056
 
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
76057
+ // 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
76058
  function execSelectionSetKeyArgs(options) {
76057
76059
  return [
76058
76060
  options.selectionSet,
@@ -76321,7 +76323,7 @@ spurious results.`);
76321
76323
  }
76322
76324
  }
76323
76325
 
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
76326
+ // 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
76327
  var cacheSlot = new Slot();
76326
76328
  var cacheInfoMap = /* @__PURE__ */ new WeakMap();
76327
76329
  function getCacheInfo(cache) {
@@ -76392,7 +76394,7 @@ spurious results.`);
76392
76394
  }
76393
76395
  }
76394
76396
 
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
76397
+ // 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
76398
  var specifierInfoCache = /* @__PURE__ */ Object.create(null);
76397
76399
  function lookupSpecifierInfo(spec) {
76398
76400
  var cacheKey = JSON.stringify(spec);
@@ -76525,7 +76527,7 @@ spurious results.`);
76525
76527
  return value;
76526
76528
  }
76527
76529
 
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
76530
+ // 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
76531
  function argsFromFieldSpecifier(spec) {
76530
76532
  return spec.args !== void 0 ? spec.args : spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;
76531
76533
  }
@@ -76960,7 +76962,7 @@ spurious results.`);
76960
76962
  };
76961
76963
  }
76962
76964
 
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
76965
+ // 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
76966
  function getContextFlavor(context, clientOnly, deferred) {
76965
76967
  var key = "".concat(clientOnly).concat(deferred);
76966
76968
  var flavored = context.flavors.get(key);
@@ -77365,7 +77367,7 @@ spurious results.`);
77365
77367
  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
77368
  }
77367
77369
 
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
77370
+ // 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
77371
  var InMemoryCache = (
77370
77372
  /** @class */
77371
77373
  (function(_super) {
@@ -77674,7 +77676,7 @@ spurious results.`);
77674
77676
  InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;
77675
77677
  }
77676
77678
 
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
77679
+ // 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
77680
  var NetworkStatus;
77679
77681
  (function(NetworkStatus2) {
77680
77682
  NetworkStatus2[NetworkStatus2["loading"] = 1] = "loading";
@@ -77689,7 +77691,7 @@ spurious results.`);
77689
77691
  return networkStatus ? networkStatus < 7 : false;
77690
77692
  }
77691
77693
 
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
77694
+ // 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
77695
  var assign2 = Object.assign;
77694
77696
  var hasOwnProperty7 = Object.hasOwnProperty;
77695
77697
  var ObservableQuery = (
@@ -78297,7 +78299,7 @@ spurious results.`);
78297
78299
  return fetchPolicy === "network-only" || fetchPolicy === "no-cache" || fetchPolicy === "standby";
78298
78300
  }
78299
78301
 
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
78302
+ // 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
78303
  var destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)();
78302
78304
  function wrapDestructiveCacheMethod(cache, methodName) {
78303
78305
  var original = cache[methodName];
@@ -78589,7 +78591,7 @@ spurious results.`);
78589
78591
  return writeWithErrors;
78590
78592
  }
78591
78593
 
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
78594
+ // 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
78595
  var hasOwnProperty8 = Object.prototype.hasOwnProperty;
78594
78596
  var IGNORE = /* @__PURE__ */ Object.create(null);
78595
78597
  var QueryManager = (
@@ -79575,7 +79577,7 @@ spurious results.`);
79575
79577
  })()
79576
79578
  );
79577
79579
 
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
79580
+ // 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
79581
  var LocalState = (
79580
79582
  /** @class */
79581
79583
  (function() {
@@ -79925,7 +79927,7 @@ spurious results.`);
79925
79927
  })()
79926
79928
  );
79927
79929
 
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
79930
+ // 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
79931
  var hasSuggestedDevtools = false;
79930
79932
  var ApolloClient = (
79931
79933
  /** @class */
@@ -80327,7 +80329,7 @@ spurious results.`);
80327
80329
  })(gql || (gql = {}));
80328
80330
  gql["default"] = gql;
80329
80331
 
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
80332
+ // 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
80333
  setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
80332
80334
 
80333
80335
  // src/modules/apollo-client.ts
@@ -92522,7 +92524,9 @@ spurious results.`);
92522
92524
  vesu_leverage
92523
92525
  };
92524
92526
  } catch (err2) {
92525
- logger2.error(`error calculating amount distribution for withdrawal: ${err2}`);
92527
+ logger2.error(
92528
+ `error calculating amount distribution for withdrawal: ${err2}`
92529
+ );
92526
92530
  return null;
92527
92531
  }
92528
92532
  };
@@ -92575,15 +92579,22 @@ spurious results.`);
92575
92579
  const extended_leverage = calculateExtendedLevergae();
92576
92580
  const latestPosition = (await client.getPositions()).data.pop();
92577
92581
  if (!extendedHoldings || !latestPosition) {
92578
- logger2.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
92582
+ logger2.error(
92583
+ `error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`
92584
+ );
92579
92585
  return null;
92580
92586
  }
92581
- const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
92587
+ const positionValueInUSD = new Web3Number(
92588
+ latestPosition.value,
92589
+ USDC_TOKEN_DECIMALS
92590
+ );
92582
92591
  const equity = extendedHoldings.data.equity;
92583
92592
  const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
92584
92593
  return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
92585
92594
  } catch (err2) {
92586
- logger2.error(`error calculating amount deposit on extended when incurring losses: ${err2}`);
92595
+ logger2.error(
92596
+ `error calculating amount deposit on extended when incurring losses: ${err2}`
92597
+ );
92587
92598
  return null;
92588
92599
  }
92589
92600
  };
@@ -92609,14 +92620,14 @@ spurious results.`);
92609
92620
  var calculateBTCPriceDelta = (btcPrice, lastBtcPrice) => {
92610
92621
  return (btcPrice - lastBtcPrice) / lastBtcPrice * 100;
92611
92622
  };
92612
- var calculateVesUPositionSizeGivenExtended = (extendedPositonValue, extendedHoldingAmount, collateralAmount, collateralPrice) => {
92623
+ var calculateVesUPositionSizeGivenExtended = (extendedPositonValue, extendedHoldingAmount, collateralAmount, collateralPrice, vesuDebtAmountToBeRepaid) => {
92613
92624
  const extendedLeverage = calculateExtendedLevergae();
92614
92625
  const vesuLeverage = calculateVesuLeverage();
92615
92626
  const extendedAmount = extendedHoldingAmount;
92616
92627
  const extendedAmountInBTC = extendedAmount.dividedBy(collateralPrice);
92617
92628
  const numerator1 = extendedAmount.multipliedBy(extendedLeverage).plus(extendedPositonValue);
92618
92629
  const numerator2 = collateralAmount.multipliedBy(collateralPrice).multipliedBy(-1);
92619
- const vesuAmountInUsd = numerator1.plus(numerator2).dividedBy(vesuLeverage);
92630
+ const vesuAmountInUsd = numerator1.plus(numerator2).dividedBy(vesuLeverage).plus(vesuDebtAmountToBeRepaid);
92620
92631
  const vesuAmountInBTC = vesuAmountInUsd.dividedBy(collateralPrice).toFixed(WBTC_TOKEN_DECIMALS);
92621
92632
  return {
92622
92633
  vesuAmountInUsd: vesuAmountInUsd.toFixed(2),
@@ -92624,6 +92635,41 @@ spurious results.`);
92624
92635
  extendedAmountInBTC
92625
92636
  };
92626
92637
  };
92638
+ var calculateDeltaDebtAmount = (maxLtv = MAX_LTV_BTC_USDC, existingVesuCollateral, existingVesuDebt, collateralPrice, debtPrice, targetHf = TARGET_HF) => {
92639
+ try {
92640
+ const term1 = existingVesuCollateral.multipliedBy(collateralPrice).multipliedBy(maxLtv).dividedBy(targetHf);
92641
+ const term2 = existingVesuDebt.multipliedBy(debtPrice).multipliedBy(targetHf).multipliedBy(-1);
92642
+ const debtAmountToBeRepaid = term1.plus(term2).dividedBy(targetHf);
92643
+ return debtAmountToBeRepaid;
92644
+ } catch (err2) {
92645
+ logger2.error(`error calculating delta position: ${err2}`);
92646
+ return null;
92647
+ }
92648
+ };
92649
+ var calculatePositionToCloseToWithdrawAmount = async (extendedBalance, extendedPositions, amountToWithdraw) => {
92650
+ try {
92651
+ const extendedPosition = extendedPositions.value;
92652
+ const unrealisedPnl = new Web3Number(
92653
+ extendedBalance.unrealisedPnl,
92654
+ USDC_TOKEN_DECIMALS
92655
+ );
92656
+ const availableForWithdrawal = new Web3Number(
92657
+ extendedBalance.availableForWithdrawal,
92658
+ USDC_TOKEN_DECIMALS
92659
+ );
92660
+ const netAmount = amountToWithdraw.minus(availableForWithdrawal);
92661
+ const upnlPercent = unrealisedPnl.dividedBy(extendedPosition);
92662
+ console.log(`upnlPercent: ${upnlPercent}`);
92663
+ const denm = upnlPercent.multipliedBy(3).plus(1);
92664
+ const amountToClose = netAmount.multipliedBy(3).dividedBy(denm);
92665
+ return new Web3Number(Math.ceil(amountToClose.toNumber()), USDC_TOKEN_DECIMALS);
92666
+ } catch (err2) {
92667
+ logger2.error(
92668
+ `error calculating position to close to withdraw amount: ${err2}`
92669
+ );
92670
+ return new Web3Number(0, USDC_TOKEN_DECIMALS);
92671
+ }
92672
+ };
92627
92673
 
92628
92674
  // src/utils/health-factor-math.ts
92629
92675
  var HealthFactorMath = class {
@@ -94687,6 +94733,8 @@ spurious results.`);
94687
94733
  quote,
94688
94734
  vaultAllocator.address
94689
94735
  );
94736
+ const dataObject = quote;
94737
+ logger2.info(`${_AvnuAdapter.name}::getQuotesAvnu finalAmountOfWbtcOut : ${dataObject.avnuFees} ${parseInt(dataObject.buyAmount.toString(), 16)} ${parseInt(dataObject.sellAmount.toString(), 16)} ${parseInt(dataObject.sellAmount.toString(), 16)}`);
94690
94738
  const swapCallData = getCalldata[0];
94691
94739
  const amount = uint256_exports.bnToUint256(quote.sellAmountInUsd * 10 ** 7);
94692
94740
  return [
@@ -98430,11 +98478,17 @@ spurious results.`);
98430
98478
  WALLET_ADDRESS,
98431
98479
  usdceToken.decimals
98432
98480
  );
98433
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator walletBalance: ${walletBalance}`);
98481
+ logger2.info(
98482
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator walletBalance: ${walletBalance}`
98483
+ );
98434
98484
  const amountToBeTransferred = amount.minimum(walletBalance);
98435
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred: ${amountToBeTransferred.toNumber()}`);
98485
+ logger2.info(
98486
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred: ${amountToBeTransferred.toNumber()}`
98487
+ );
98436
98488
  if (amountToBeTransferred.lessThan(0)) {
98437
- logger2.error(`${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred is less than 0: ${amountToBeTransferred.toNumber()}`);
98489
+ logger2.error(
98490
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssetsToVaultAllocator amountToBeTransferred is less than 0: ${amountToBeTransferred.toNumber()}`
98491
+ );
98438
98492
  return {
98439
98493
  calls: [],
98440
98494
  status: false
@@ -98472,10 +98526,14 @@ spurious results.`);
98472
98526
  }
98473
98527
  async shouldInvest() {
98474
98528
  try {
98475
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest starting`);
98529
+ logger2.info(
98530
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest starting`
98531
+ );
98476
98532
  const vesuAdapter = await this.getVesuAdapter();
98477
98533
  const extendedAdapter = await this.getExtendedAdapter();
98478
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest adapters fetched: vesuAdapter=${!!vesuAdapter}, extendedAdapter=${!!extendedAdapter}, extendedAdapter.client=${!!extendedAdapter?.client}`);
98534
+ logger2.info(
98535
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest adapters fetched: vesuAdapter=${!!vesuAdapter}, extendedAdapter=${!!extendedAdapter}, extendedAdapter.client=${!!extendedAdapter?.client}`
98536
+ );
98479
98537
  if (!vesuAdapter) {
98480
98538
  logger2.error(
98481
98539
  `Vesu adapter not configured in metadata. This is a configuration issue, not a temporary failure.`
@@ -98487,7 +98545,8 @@ spurious results.`);
98487
98545
  extendedLeverage: 0,
98488
98546
  collateralPrice: 0,
98489
98547
  debtPrice: 0,
98490
- vesuLeverage: 0
98548
+ vesuLeverage: 0,
98549
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98491
98550
  };
98492
98551
  }
98493
98552
  if (!extendedAdapter) {
@@ -98501,7 +98560,8 @@ spurious results.`);
98501
98560
  extendedLeverage: 0,
98502
98561
  collateralPrice: 0,
98503
98562
  debtPrice: 0,
98504
- vesuLeverage: 0
98563
+ vesuLeverage: 0,
98564
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98505
98565
  };
98506
98566
  }
98507
98567
  if (!extendedAdapter.client) {
@@ -98515,10 +98575,13 @@ spurious results.`);
98515
98575
  extendedLeverage: 0,
98516
98576
  collateralPrice: 0,
98517
98577
  debtPrice: 0,
98518
- vesuLeverage: 0
98578
+ vesuLeverage: 0,
98579
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98519
98580
  };
98520
98581
  }
98521
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest calling getUnusedBalance`);
98582
+ logger2.info(
98583
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest calling getUnusedBalance`
98584
+ );
98522
98585
  const balance = await this.getUnusedBalance();
98523
98586
  if (!Number.isFinite(balance.usdValue) || balance.usdValue < 0) {
98524
98587
  logger2.error(
@@ -98531,13 +98594,18 @@ spurious results.`);
98531
98594
  extendedLeverage: 0,
98532
98595
  collateralPrice: 0,
98533
98596
  debtPrice: 0,
98534
- vesuLeverage: 0
98597
+ vesuLeverage: 0,
98598
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98535
98599
  };
98536
98600
  }
98537
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest balance: ${balance.usdValue}`);
98601
+ logger2.info(
98602
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest balance: ${balance.usdValue}`
98603
+ );
98538
98604
  const usdcBalanceOnExtended = await extendedAdapter.getExtendedDepositAmount();
98539
98605
  if (usdcBalanceOnExtended) {
98540
- const availableForWithdrawal = parseFloat(usdcBalanceOnExtended.availableForWithdrawal);
98606
+ const availableForWithdrawal = parseFloat(
98607
+ usdcBalanceOnExtended.availableForWithdrawal
98608
+ );
98541
98609
  if (!Number.isFinite(availableForWithdrawal) || availableForWithdrawal < 0) {
98542
98610
  logger2.error(
98543
98611
  `Invalid usdcBalanceOnExtended.availableForWithdrawal: ${usdcBalanceOnExtended.availableForWithdrawal}. Expected a finite, non-negative number.`
@@ -98549,11 +98617,15 @@ spurious results.`);
98549
98617
  extendedLeverage: 0,
98550
98618
  collateralPrice: 0,
98551
98619
  debtPrice: 0,
98552
- vesuLeverage: 0
98620
+ vesuLeverage: 0,
98621
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98553
98622
  };
98554
98623
  }
98555
98624
  }
98556
- const amountToInvest = new Web3Number(balance.usdValue, USDC_TOKEN_DECIMALS).plus(usdcBalanceOnExtended?.availableForTrade ?? 0).multipliedBy(1 - LIMIT_BALANCE);
98625
+ const amountToInvest = new Web3Number(
98626
+ balance.usdValue,
98627
+ USDC_TOKEN_DECIMALS
98628
+ ).plus(usdcBalanceOnExtended?.availableForTrade ?? 0).multipliedBy(1 - LIMIT_BALANCE);
98557
98629
  const amountToInvestNumber = amountToInvest.toNumber();
98558
98630
  if (!Number.isFinite(amountToInvestNumber)) {
98559
98631
  logger2.error(
@@ -98566,10 +98638,13 @@ spurious results.`);
98566
98638
  extendedLeverage: 0,
98567
98639
  collateralPrice: 0,
98568
98640
  debtPrice: 0,
98569
- vesuLeverage: 0
98641
+ vesuLeverage: 0,
98642
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98570
98643
  };
98571
98644
  }
98572
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest amountToInvest: ${amountToInvestNumber}`);
98645
+ logger2.info(
98646
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest amountToInvest: ${amountToInvestNumber}`
98647
+ );
98573
98648
  if (amountToInvest.lessThan(LIMIT_BALANCE_VALUE)) {
98574
98649
  return {
98575
98650
  shouldInvest: false,
@@ -98578,7 +98653,8 @@ spurious results.`);
98578
98653
  extendedLeverage: 0,
98579
98654
  collateralPrice: 0,
98580
98655
  debtPrice: 0,
98581
- vesuLeverage: 0
98656
+ vesuLeverage: 0,
98657
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98582
98658
  };
98583
98659
  }
98584
98660
  const extendedPositon = await extendedAdapter.getAllOpenPositions();
@@ -98591,14 +98667,12 @@ spurious results.`);
98591
98667
  extendedLeverage: 0,
98592
98668
  collateralPrice: 0,
98593
98669
  debtPrice: 0,
98594
- vesuLeverage: 0
98670
+ vesuLeverage: 0,
98671
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98595
98672
  };
98596
98673
  }
98597
- const { collateralTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
98598
- const {
98599
- collateralPrice,
98600
- debtPrice
98601
- } = await this.getAssetPrices();
98674
+ const { collateralTokenAmount, debtTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
98675
+ const { collateralPrice, debtPrice } = await this.getAssetPrices();
98602
98676
  if (!Number.isFinite(collateralPrice.price) || collateralPrice.price <= 0) {
98603
98677
  logger2.error(
98604
98678
  `Invalid collateralPrice: ${collateralPrice.price}. Expected a finite, positive number.`
@@ -98610,7 +98684,8 @@ spurious results.`);
98610
98684
  extendedLeverage: 0,
98611
98685
  collateralPrice: 0,
98612
98686
  debtPrice: 0,
98613
- vesuLeverage: 0
98687
+ vesuLeverage: 0,
98688
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98614
98689
  };
98615
98690
  }
98616
98691
  if (!Number.isFinite(debtPrice.price) || debtPrice.price <= 0) {
@@ -98624,11 +98699,34 @@ spurious results.`);
98624
98699
  extendedLeverage: 0,
98625
98700
  collateralPrice: 0,
98626
98701
  debtPrice: 0,
98627
- vesuLeverage: 0
98702
+ vesuLeverage: 0,
98703
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98704
+ };
98705
+ }
98706
+ const debtAmountToBeRepaid = calculateDeltaDebtAmount(
98707
+ MAX_LTV_BTC_USDC,
98708
+ collateralTokenAmount,
98709
+ debtTokenAmount,
98710
+ collateralPrice.price,
98711
+ debtPrice.price,
98712
+ this.metadata.additionalInfo.targetHealthFactor
98713
+ );
98714
+ if (!debtAmountToBeRepaid) {
98715
+ logger2.error("error calculating debt amount to be repaid");
98716
+ return {
98717
+ shouldInvest: false,
98718
+ vesuAmount: new Web3Number(0, 0),
98719
+ extendedAmount: new Web3Number(0, 0),
98720
+ extendedLeverage: 0,
98721
+ collateralPrice: 0,
98722
+ debtPrice: 0,
98723
+ vesuLeverage: 0,
98724
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98628
98725
  };
98629
98726
  }
98727
+ const amountToInvestAfterRepayingDebt = amountToInvest.minus(debtAmountToBeRepaid);
98630
98728
  const { vesu_amount, extended_amount, extended_leverage, vesu_leverage } = await calculateAmountDistribution(
98631
- amountToInvest.toNumber(),
98729
+ amountToInvestAfterRepayingDebt.toNumber(),
98632
98730
  extendedAdapter.client,
98633
98731
  extendedAdapter.config.extendedMarketName,
98634
98732
  collateralPrice.price,
@@ -98647,10 +98745,13 @@ spurious results.`);
98647
98745
  extendedLeverage: 0,
98648
98746
  collateralPrice: 0,
98649
98747
  debtPrice: 0,
98650
- vesuLeverage: 0
98748
+ vesuLeverage: 0,
98749
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98651
98750
  };
98652
98751
  }
98653
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldInvest vesu_amount: ${vesu_amount.toNumber()}, extended_amount: ${extended_amount.toNumber()}`);
98752
+ logger2.info(
98753
+ `${_VesuExtendedMultiplierStrategy.name}::shouldInvest vesu_amount: ${vesu_amount.toNumber()}, extended_amount: ${extended_amount.toNumber()}`
98754
+ );
98654
98755
  return {
98655
98756
  shouldInvest: true,
98656
98757
  vesuAmount: vesu_amount,
@@ -98658,7 +98759,8 @@ spurious results.`);
98658
98759
  extendedLeverage: extended_leverage,
98659
98760
  vesuLeverage: vesu_leverage,
98660
98761
  collateralPrice: collateralPrice.price,
98661
- debtPrice: debtPrice.price
98762
+ debtPrice: debtPrice.price,
98763
+ debtAmountToBeRepaid
98662
98764
  };
98663
98765
  } catch (err2) {
98664
98766
  logger2.error(`error deciding invest: ${err2}`);
@@ -98669,7 +98771,8 @@ spurious results.`);
98669
98771
  extendedLeverage: 0,
98670
98772
  collateralPrice: 0,
98671
98773
  debtPrice: 0,
98672
- vesuLeverage: 0
98774
+ vesuLeverage: 0,
98775
+ debtAmountToBeRepaid: new Web3Number(0, 0)
98673
98776
  };
98674
98777
  }
98675
98778
  }
@@ -98692,33 +98795,49 @@ spurious results.`);
98692
98795
  const usdcAmountOnExtendedAvailableForTrade = parseFloat(
98693
98796
  extendedHoldings.availableForTrade
98694
98797
  );
98695
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculating movements - Extended current: ${usdcAmountOnExtendedAvailableForTrade}, Wallet: ${usdcAmountInWallet.toNumber()}, Target Extended: ${extendedAmount.toNumber()}, Target Vesu: ${vesuAmount.toNumber()}`);
98798
+ logger2.info(
98799
+ `${_VesuExtendedMultiplierStrategy.name}::shouldMoveAssets calculating movements - Extended current: ${usdcAmountOnExtendedAvailableForTrade}, Wallet: ${usdcAmountInWallet.toNumber()}, Target Extended: ${extendedAmount.toNumber()}, Target Vesu: ${vesuAmount.toNumber()}`
98800
+ );
98696
98801
  let totalExtendedWithdrawal = new Web3Number(0, USDC_TOKEN_DECIMALS);
98697
98802
  let totalExtendedDeposit = new Web3Number(0, USDC_TOKEN_DECIMALS);
98698
98803
  if (extendedAmount.isNegative() && extendedAmount.abs().greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98699
- totalExtendedWithdrawal = totalExtendedWithdrawal.plus(extendedAmount.abs());
98804
+ totalExtendedWithdrawal = totalExtendedWithdrawal.plus(
98805
+ extendedAmount.abs()
98806
+ );
98700
98807
  }
98701
98808
  const extendedTargetAmount = extendedAmount.abs();
98702
98809
  let projectedExtendedBalance = usdcAmountOnExtendedAvailableForTrade;
98703
98810
  if (extendedAmount.isNegative()) {
98704
98811
  projectedExtendedBalance = projectedExtendedBalance - extendedAmount.abs().toNumber();
98705
98812
  }
98706
- const extendedAmountDifference = extendedTargetAmount.minus(projectedExtendedBalance);
98813
+ const extendedAmountDifference = extendedTargetAmount.minus(
98814
+ projectedExtendedBalance
98815
+ );
98707
98816
  const extendedAmountDifferenceAbs = extendedAmountDifference.abs();
98708
98817
  if (extendedAmountDifference.lessThan(0)) {
98709
- totalExtendedWithdrawal = totalExtendedWithdrawal.plus(extendedAmountDifferenceAbs);
98818
+ totalExtendedWithdrawal = totalExtendedWithdrawal.plus(
98819
+ extendedAmountDifferenceAbs
98820
+ );
98710
98821
  } else if (extendedAmountDifference.greaterThan(0)) {
98711
- totalExtendedDeposit = totalExtendedDeposit.plus(extendedAmountDifference);
98822
+ totalExtendedDeposit = totalExtendedDeposit.plus(
98823
+ extendedAmountDifference
98824
+ );
98712
98825
  }
98713
98826
  const vesuTargetAmount = vesuAmount.abs();
98714
98827
  const projectedWalletBalance = usdcAmountInWallet.plus(totalExtendedWithdrawal).minus(totalExtendedDeposit);
98715
98828
  let vesuAmountDifference = vesuTargetAmount.minus(projectedWalletBalance);
98716
98829
  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()}`);
98830
+ logger2.info(
98831
+ `${_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()}`
98832
+ );
98718
98833
  let transactionResults = [];
98719
98834
  if (extendedAmount.isNegative() && extendedAmount.abs().greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98720
98835
  try {
98721
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
98836
+ const {
98837
+ calls: extendedCalls,
98838
+ status: extendedStatus,
98839
+ transactionMetadata: extendedTransactionMetadata
98840
+ } = await this.moveAssets(
98722
98841
  {
98723
98842
  to: Protocols.VAULT.name,
98724
98843
  from: Protocols.EXTENDED.name,
@@ -98738,16 +98857,44 @@ spurious results.`);
98738
98857
  }
98739
98858
  });
98740
98859
  } else {
98741
- return [this.createTransactionResult([], false, { from: Protocols.EXTENDED.name, to: Protocols.VAULT.name, amount: extendedAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98860
+ return [
98861
+ this.createTransactionResult(
98862
+ [],
98863
+ false,
98864
+ {
98865
+ from: Protocols.EXTENDED.name,
98866
+ to: Protocols.VAULT.name,
98867
+ amount: extendedAmount.abs()
98868
+ },
98869
+ "NONE",
98870
+ "INVESTMENT" /* INVESTMENT */
98871
+ )
98872
+ ];
98742
98873
  }
98743
98874
  } catch (err2) {
98744
98875
  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 */)];
98876
+ return [
98877
+ this.createTransactionResult(
98878
+ [],
98879
+ false,
98880
+ {
98881
+ from: Protocols.EXTENDED.name,
98882
+ to: Protocols.VAULT.name,
98883
+ amount: extendedAmount.abs()
98884
+ },
98885
+ "NONE",
98886
+ "INVESTMENT" /* INVESTMENT */
98887
+ )
98888
+ ];
98746
98889
  }
98747
98890
  }
98748
98891
  if (vesuAmount.isNegative() && vesuAmount.abs().greaterThan(vesuAdapter.minimumVesuMovementAmount)) {
98749
98892
  try {
98750
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
98893
+ const {
98894
+ calls: vesuCalls,
98895
+ status: vesuStatus,
98896
+ transactionMetadata: vesuTransactionMetadata
98897
+ } = await this.moveAssets(
98751
98898
  {
98752
98899
  to: Protocols.EXTENDED.name,
98753
98900
  from: Protocols.VESU.name,
@@ -98758,7 +98905,19 @@ spurious results.`);
98758
98905
  vesuAdapter
98759
98906
  );
98760
98907
  if (!vesuStatus) {
98761
- return [this.createTransactionResult([], false, { from: Protocols.VESU.name, to: Protocols.EXTENDED.name, amount: vesuAmount.abs() }, "NONE", "INVESTMENT" /* INVESTMENT */)];
98908
+ return [
98909
+ this.createTransactionResult(
98910
+ [],
98911
+ false,
98912
+ {
98913
+ from: Protocols.VESU.name,
98914
+ to: Protocols.EXTENDED.name,
98915
+ amount: vesuAmount.abs()
98916
+ },
98917
+ "NONE",
98918
+ "INVESTMENT" /* INVESTMENT */
98919
+ )
98920
+ ];
98762
98921
  }
98763
98922
  transactionResults.push({
98764
98923
  status: vesuStatus,
@@ -98769,14 +98928,34 @@ spurious results.`);
98769
98928
  }
98770
98929
  });
98771
98930
  } 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 */)];
98931
+ logger2.error(
98932
+ `Failed moving assets to extended via vault allocator: ${err2}`
98933
+ );
98934
+ return [
98935
+ this.createTransactionResult(
98936
+ [],
98937
+ false,
98938
+ {
98939
+ from: Protocols.VESU.name,
98940
+ to: Protocols.EXTENDED.name,
98941
+ amount: vesuAmount.abs()
98942
+ },
98943
+ "NONE",
98944
+ "INVESTMENT" /* INVESTMENT */
98945
+ )
98946
+ ];
98774
98947
  }
98775
98948
  }
98776
- if (extendedAmountDifferenceAbs.greaterThan(extendedAdapter.minimumExtendedMovementAmount)) {
98949
+ if (extendedAmountDifferenceAbs.greaterThan(
98950
+ extendedAdapter.minimumExtendedMovementAmount
98951
+ )) {
98777
98952
  if (extendedAmountDifference.greaterThan(0)) {
98778
98953
  try {
98779
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
98954
+ const {
98955
+ calls: extendedCalls,
98956
+ status: extendedStatus,
98957
+ transactionMetadata: extendedTransactionMetadata
98958
+ } = await this.moveAssets(
98780
98959
  {
98781
98960
  to: Protocols.EXTENDED.name,
98782
98961
  from: Protocols.VAULT.name,
@@ -98793,16 +98972,46 @@ spurious results.`);
98793
98972
  transactionMetadata: extendedTransactionMetadata
98794
98973
  });
98795
98974
  } 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 */)];
98975
+ logger2.error(
98976
+ `Failed to move assets to extended - operation returned false status`
98977
+ );
98978
+ return [
98979
+ this.createTransactionResult(
98980
+ [],
98981
+ false,
98982
+ {
98983
+ from: Protocols.VAULT.name,
98984
+ to: Protocols.EXTENDED.name,
98985
+ amount: extendedAmountDifference
98986
+ },
98987
+ "NONE",
98988
+ "INVESTMENT" /* INVESTMENT */
98989
+ )
98990
+ ];
98798
98991
  }
98799
98992
  } catch (err2) {
98800
98993
  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 */)];
98994
+ return [
98995
+ this.createTransactionResult(
98996
+ [],
98997
+ false,
98998
+ {
98999
+ from: Protocols.VAULT.name,
99000
+ to: Protocols.EXTENDED.name,
99001
+ amount: extendedAmountDifference
99002
+ },
99003
+ "NONE",
99004
+ "INVESTMENT" /* INVESTMENT */
99005
+ )
99006
+ ];
98802
99007
  }
98803
99008
  } else if (extendedAmountDifference.lessThan(0)) {
98804
99009
  try {
98805
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
99010
+ const {
99011
+ calls: extendedCalls,
99012
+ status: extendedStatus,
99013
+ transactionMetadata: extendedTransactionMetadata
99014
+ } = await this.moveAssets(
98806
99015
  {
98807
99016
  to: Protocols.VAULT.name,
98808
99017
  from: Protocols.EXTENDED.name,
@@ -98822,23 +99031,55 @@ spurious results.`);
98822
99031
  }
98823
99032
  });
98824
99033
  } 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 */)];
99034
+ logger2.error(
99035
+ `Failed to withdraw from extended - operation returned false status`
99036
+ );
99037
+ return [
99038
+ this.createTransactionResult(
99039
+ [],
99040
+ false,
99041
+ {
99042
+ from: Protocols.EXTENDED.name,
99043
+ to: Protocols.VAULT.name,
99044
+ amount: extendedAmountDifferenceAbs
99045
+ },
99046
+ "NONE",
99047
+ "INVESTMENT" /* INVESTMENT */
99048
+ )
99049
+ ];
98827
99050
  }
98828
99051
  } catch (err2) {
98829
99052
  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 */)];
99053
+ return [
99054
+ this.createTransactionResult(
99055
+ [],
99056
+ false,
99057
+ {
99058
+ from: Protocols.EXTENDED.name,
99059
+ to: Protocols.VAULT.name,
99060
+ amount: extendedAmountDifferenceAbs
99061
+ },
99062
+ "NONE",
99063
+ "INVESTMENT" /* INVESTMENT */
99064
+ )
99065
+ ];
98831
99066
  }
98832
99067
  }
98833
99068
  }
98834
- if (vesuAmountDifferenceAbs.greaterThan(vesuAdapter.minimumVesuMovementAmount)) {
99069
+ if (vesuAmountDifferenceAbs.greaterThan(
99070
+ vesuAdapter.minimumVesuMovementAmount
99071
+ )) {
98835
99072
  if (vesuAmountDifference.lessThanOrEqualTo(0)) {
98836
99073
  logger2.warn(
98837
99074
  `Vesu amount difference is negative or zero: ${vesuAmountDifference.toNumber()}. Skipping operation.`
98838
99075
  );
98839
99076
  } else {
98840
99077
  try {
98841
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
99078
+ const {
99079
+ calls: vesuCalls,
99080
+ status: vesuStatus,
99081
+ transactionMetadata: vesuTransactionMetadata
99082
+ } = await this.moveAssets(
98842
99083
  {
98843
99084
  to: Protocols.VAULT.name,
98844
99085
  from: Protocols.EXTENDED.name,
@@ -98849,8 +99090,22 @@ spurious results.`);
98849
99090
  vesuAdapter
98850
99091
  );
98851
99092
  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 */)];
99093
+ logger2.error(
99094
+ `Failed to move assets to vesu - operation returned false status`
99095
+ );
99096
+ return [
99097
+ this.createTransactionResult(
99098
+ [],
99099
+ false,
99100
+ {
99101
+ from: Protocols.EXTENDED.name,
99102
+ to: Protocols.VAULT.name,
99103
+ amount: vesuAmountDifference
99104
+ },
99105
+ "NONE",
99106
+ "INVESTMENT" /* INVESTMENT */
99107
+ )
99108
+ ];
98854
99109
  }
98855
99110
  transactionResults.push({
98856
99111
  status: vesuStatus,
@@ -98862,14 +99117,38 @@ spurious results.`);
98862
99117
  });
98863
99118
  } catch (err2) {
98864
99119
  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 */)];
99120
+ return [
99121
+ this.createTransactionResult(
99122
+ [],
99123
+ false,
99124
+ {
99125
+ from: Protocols.EXTENDED.name,
99126
+ to: Protocols.VAULT.name,
99127
+ amount: vesuAmountDifference
99128
+ },
99129
+ "NONE",
99130
+ "INVESTMENT" /* INVESTMENT */
99131
+ )
99132
+ ];
98866
99133
  }
98867
99134
  }
98868
99135
  }
98869
99136
  return transactionResults;
98870
99137
  } catch (err2) {
98871
99138
  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 */)];
99139
+ return [
99140
+ this.createTransactionResult(
99141
+ [],
99142
+ false,
99143
+ {
99144
+ from: Protocols.EXTENDED.name,
99145
+ to: Protocols.VAULT.name,
99146
+ amount: new Web3Number(0, USDC_TOKEN_DECIMALS)
99147
+ },
99148
+ "NONE",
99149
+ "INVESTMENT" /* INVESTMENT */
99150
+ )
99151
+ ];
98873
99152
  }
98874
99153
  }
98875
99154
  /**
@@ -98890,7 +99169,18 @@ spurious results.`);
98890
99169
  }
98891
99170
  };
98892
99171
  }
98893
- return { calls: [], status: false, transactionMetadata: { protocolFrom: "", protocolTo: "", transactionType: "DEPOSIT", usdAmount: "0", status: "FAILED", cycleType } };
99172
+ return {
99173
+ calls: [],
99174
+ status: false,
99175
+ transactionMetadata: {
99176
+ protocolFrom: "",
99177
+ protocolTo: "",
99178
+ transactionType: "DEPOSIT",
99179
+ usdAmount: "0",
99180
+ status: "FAILED",
99181
+ cycleType
99182
+ }
99183
+ };
98894
99184
  }
98895
99185
  /**
98896
99186
  * This method is used to move assets between protocols
@@ -98898,7 +99188,7 @@ spurious results.`);
98898
99188
  * @param extendedAdapter - The extended adapter
98899
99189
  * @param vesuAdapter - The vesu adapter
98900
99190
  * @returns The transaction result
98901
- * If Extended amount is greater than amount of withdrawal from extended, then we need to open a long position
99191
+ * If Extended amount is greater than amount of withdrawal from extended, then we need to open a long position
98902
99192
  * so that the amount of withdrawal from extended is fullfilled
98903
99193
  */
98904
99194
  async moveAssets(params, extendedAdapter, vesuAdapter) {
@@ -98907,18 +99197,28 @@ spurious results.`);
98907
99197
  logger2.error(
98908
99198
  `Invalid amount for moveAssets: ${params.amount.toNumber()}. Amount must be positive.`
98909
99199
  );
98910
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99200
+ return this.createTransactionResult(
99201
+ [],
99202
+ false,
99203
+ params,
99204
+ "NONE",
99205
+ params.cycleType
99206
+ );
98911
99207
  }
98912
99208
  const avnuAdapter = await this.getAvnuAdapter();
98913
99209
  if (!avnuAdapter) {
98914
99210
  logger2.error(`avnu adapter not found: ${avnuAdapter}`);
98915
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99211
+ return this.createTransactionResult(
99212
+ [],
99213
+ false,
99214
+ params,
99215
+ "NONE",
99216
+ params.cycleType
99217
+ );
98916
99218
  }
98917
99219
  logger2.info(`moveAssets params, ${JSON.stringify(params)}`);
98918
99220
  const collateralToken = vesuAdapter.config.supportedPositions[0].asset;
98919
- const {
98920
- collateralPrice
98921
- } = await this.getAssetPrices();
99221
+ const { collateralPrice } = await this.getAssetPrices();
98922
99222
  if (params.to === Protocols.EXTENDED.name && params.from === Protocols.VAULT.name) {
98923
99223
  const proofsInfo = extendedAdapter.getProofs(
98924
99224
  true,
@@ -98931,28 +99231,58 @@ spurious results.`);
98931
99231
  await proofsInfo.callConstructor({ amount: params.amount })
98932
99232
  );
98933
99233
  calls.push(call);
98934
- return this.createTransactionResult(calls, true, params, "DEPOSIT", params.cycleType);
99234
+ return this.createTransactionResult(
99235
+ calls,
99236
+ true,
99237
+ params,
99238
+ "DEPOSIT",
99239
+ params.cycleType
99240
+ );
98935
99241
  } else if (params.to === Protocols.VAULT.name && params.from === Protocols.EXTENDED.name) {
98936
99242
  const extendedLeverage = calculateExtendedLevergae();
98937
99243
  const extendedHoldings = await extendedAdapter.getExtendedDepositAmount();
98938
99244
  if (!extendedHoldings) {
98939
99245
  logger2.error(`error getting extended holdings: ${extendedHoldings}`);
98940
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99246
+ return this.createTransactionResult(
99247
+ [],
99248
+ false,
99249
+ params,
99250
+ "NONE",
99251
+ params.cycleType
99252
+ );
98941
99253
  }
98942
99254
  const extendedHoldingAmount = new Web3Number(
98943
99255
  extendedHoldings.availableForWithdrawal,
98944
99256
  USDC_TOKEN_DECIMALS
98945
99257
  );
98946
- logger2.info(`${_VesuExtendedMultiplierStrategy.name}::moveAssets extendedHoldingAmount: ${extendedHoldingAmount.toNumber()}`);
99258
+ logger2.info(
99259
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssets extendedHoldingAmount: ${extendedHoldingAmount.toNumber()}`
99260
+ );
99261
+ const extendedPositions = await extendedAdapter.getAllOpenPositions();
99262
+ if (!extendedPositions) {
99263
+ logger2.error(`error getting extended positions: ${extendedPositions} while moving assets from extended to vault`);
99264
+ return this.createTransactionResult(
99265
+ [],
99266
+ false,
99267
+ params,
99268
+ "NONE",
99269
+ params.cycleType
99270
+ );
99271
+ }
98947
99272
  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()}`);
99273
+ const leftAmountAfterWithdrawalAmountInAccount = new Web3Number(
99274
+ Math.ceil(
99275
+ params.amount.abs().minus(extendedHoldingAmount).toNumber()
99276
+ ),
99277
+ USDC_TOKEN_DECIMALS
99278
+ );
99279
+ const positionAmountToClose = await calculatePositionToCloseToWithdrawAmount(extendedHoldings, extendedPositions[0], params.amount);
99280
+ logger2.info(`positionAmountToClose: ${positionAmountToClose.toNumber()}`);
99281
+ logger2.info(
99282
+ `${_VesuExtendedMultiplierStrategy.name}::moveAssets leftAmountAfterWithdrawalAmountInAccount: ${leftAmountAfterWithdrawalAmountInAccount.toNumber()}`
99283
+ );
98950
99284
  let priceOfBTC;
98951
- const {
98952
- ask,
98953
- bid,
98954
- status
98955
- } = await extendedAdapter.fetchOrderBookBTCUSDC();
99285
+ const { ask, bid, status } = await extendedAdapter.fetchOrderBookBTCUSDC();
98956
99286
  const price = ask.plus(bid).dividedBy(2);
98957
99287
  if (status) {
98958
99288
  priceOfBTC = price;
@@ -98960,7 +99290,7 @@ spurious results.`);
98960
99290
  logger2.error(`error fetching order book btc usdc: ${status}`);
98961
99291
  priceOfBTC = collateralPrice.price;
98962
99292
  }
98963
- const btcAmount = leftAmountAfterWithdrawalAmountInAccount.dividedBy(priceOfBTC);
99293
+ const btcAmount = positionAmountToClose.dividedBy(priceOfBTC);
98964
99294
  const openLongPosition = btcAmount.multipliedBy(3).greaterThan(MINIMUM_EXTENDED_POSITION_SIZE) ? await extendedAdapter.createOrder(
98965
99295
  extendedLeverage.toString(),
98966
99296
  btcAmount.toNumber(),
@@ -98975,38 +99305,95 @@ spurious results.`);
98975
99305
  logger2.error(`error opening long position: ${openLongPosition}`);
98976
99306
  }
98977
99307
  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);
99308
+ if (!updatedHoldings || new Web3Number(
99309
+ updatedHoldings.availableForWithdrawal,
99310
+ USDC_TOKEN_DECIMALS
99311
+ ).lessThan(params.amount.abs())) {
99312
+ logger2.error(
99313
+ `Insufficient balance after opening position. Available: ${updatedHoldings?.availableForWithdrawal}, Needed: ${params.amount.abs()}`
99314
+ );
99315
+ return this.createTransactionResult(
99316
+ [],
99317
+ false,
99318
+ params,
99319
+ "NONE",
99320
+ params.cycleType
99321
+ );
98981
99322
  }
98982
99323
  }
98983
99324
  const {
98984
99325
  status: withdrawalFromExtendedStatus,
98985
99326
  receivedTxnHash: withdrawalFromExtendedTxnHash
98986
99327
  } = await extendedAdapter.withdrawFromExtended(params.amount);
98987
- logger2.info(`withdrawalFromExtendedStatus: ${withdrawalFromExtendedStatus}, withdrawalFromExtendedTxnHash: ${withdrawalFromExtendedTxnHash}`);
99328
+ logger2.info(
99329
+ `withdrawalFromExtendedStatus: ${withdrawalFromExtendedStatus}, withdrawalFromExtendedTxnHash: ${withdrawalFromExtendedTxnHash}`
99330
+ );
98988
99331
  if (withdrawalFromExtendedStatus && withdrawalFromExtendedTxnHash) {
98989
99332
  const extendedHoldings2 = await extendedAdapter.getExtendedDepositAmount();
98990
- logger2.info(`extendedHoldings after withdrawal ${extendedHoldings2?.availableForWithdrawal}`);
99333
+ logger2.info(
99334
+ `extendedHoldings after withdrawal ${extendedHoldings2?.availableForWithdrawal}`
99335
+ );
98991
99336
  await new Promise((resolve) => setTimeout(resolve, 5e3));
98992
- const { calls, status } = await this.moveAssetsToVaultAllocator(params.amount, extendedAdapter);
99337
+ const { calls, status } = await this.moveAssetsToVaultAllocator(
99338
+ params.amount,
99339
+ extendedAdapter
99340
+ );
98993
99341
  if (calls.length > 0 && status) {
98994
- return this.createTransactionResult(calls, true, params, "WITHDRAWAL", params.cycleType);
99342
+ return this.createTransactionResult(
99343
+ calls,
99344
+ true,
99345
+ params,
99346
+ "WITHDRAWAL",
99347
+ params.cycleType
99348
+ );
98995
99349
  } else {
98996
- return this.createTransactionResult([], true, params, "WITHDRAWAL", params.cycleType);
99350
+ return this.createTransactionResult(
99351
+ [],
99352
+ true,
99353
+ params,
99354
+ "WITHDRAWAL",
99355
+ params.cycleType
99356
+ );
98997
99357
  }
98998
99358
  } 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);
99359
+ logger2.error(
99360
+ "withdrawal from extended successful, but funds didn't get transferred to the wallet"
99361
+ );
99362
+ return this.createTransactionResult(
99363
+ [],
99364
+ true,
99365
+ params,
99366
+ "WITHDRAWAL",
99367
+ params.cycleType
99368
+ );
99001
99369
  } else {
99002
99370
  logger2.error("withdrawal from extended failed");
99003
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99371
+ return this.createTransactionResult(
99372
+ [],
99373
+ false,
99374
+ params,
99375
+ "NONE",
99376
+ params.cycleType
99377
+ );
99004
99378
  }
99005
99379
  } else if (params.to === Protocols.VAULT.name && params.from === Protocols.VESU.name) {
99006
- const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, "close" /* CLOSE */);
99380
+ const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(
99381
+ extendedAdapter,
99382
+ vesuAdapter,
99383
+ avnuAdapter,
99384
+ "close" /* CLOSE */
99385
+ );
99007
99386
  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);
99387
+ logger2.warn(
99388
+ `price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99389
+ );
99390
+ return this.createTransactionResult(
99391
+ [],
99392
+ false,
99393
+ params,
99394
+ "NONE",
99395
+ params.cycleType
99396
+ );
99010
99397
  }
99011
99398
  const vesuAmountInBTC = new Web3Number(
99012
99399
  params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
@@ -99020,19 +99407,41 @@ spurious results.`);
99020
99407
  await proofsInfo.callConstructor({ amount: vesuAmountInBTC })
99021
99408
  );
99022
99409
  calls.push(call);
99023
- const swapProofsInfo = avnuAdapter.getProofs(false, this.getMerkleTree());
99410
+ const swapProofsInfo = avnuAdapter.getProofs(
99411
+ false,
99412
+ this.getMerkleTree()
99413
+ );
99024
99414
  const swapProofGroups = swapProofsInfo.proofs;
99025
99415
  const swapCall = this.getManageCall(
99026
99416
  swapProofGroups,
99027
99417
  await swapProofsInfo.callConstructor({ amount: vesuAmountInBTC })
99028
99418
  );
99029
99419
  calls.push(swapCall);
99030
- return this.createTransactionResult(calls, true, params, "WITHDRAWAL", params.cycleType);
99420
+ return this.createTransactionResult(
99421
+ calls,
99422
+ true,
99423
+ params,
99424
+ "WITHDRAWAL",
99425
+ params.cycleType
99426
+ );
99031
99427
  } else if (params.to === Protocols.EXTENDED.name && params.from === Protocols.VESU.name) {
99032
- const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, "close" /* CLOSE */);
99428
+ const isPriceDifferenceBetweenAvnuAndExtended = await this.checkPriceDifferenceBetweenAvnuAndExtended(
99429
+ extendedAdapter,
99430
+ vesuAdapter,
99431
+ avnuAdapter,
99432
+ "close" /* CLOSE */
99433
+ );
99033
99434
  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);
99435
+ logger2.warn(
99436
+ `price difference between avnu and extended doesn't fit the range for close position, ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99437
+ );
99438
+ return this.createTransactionResult(
99439
+ [],
99440
+ false,
99441
+ params,
99442
+ "NONE",
99443
+ params.cycleType
99444
+ );
99036
99445
  }
99037
99446
  const vesuAmountInBTC = new Web3Number(
99038
99447
  params.amount.dividedBy(collateralPrice.price).toNumber(),
@@ -99046,7 +99455,10 @@ spurious results.`);
99046
99455
  await proofsInfo.callConstructor({ amount: vesuAmountInBTC })
99047
99456
  );
99048
99457
  calls.push(call);
99049
- const swapProofsInfo = avnuAdapter.getProofs(false, this.getMerkleTree());
99458
+ const swapProofsInfo = avnuAdapter.getProofs(
99459
+ false,
99460
+ this.getMerkleTree()
99461
+ );
99050
99462
  const swapProofGroups = swapProofsInfo.proofs;
99051
99463
  const swapCall = this.getManageCall(
99052
99464
  swapProofGroups,
@@ -99063,21 +99475,61 @@ spurious results.`);
99063
99475
  await proofsInfoDeposit.callConstructor({ amount: params.amount })
99064
99476
  );
99065
99477
  calls.push(callDeposit);
99066
- return this.createTransactionResult(calls, true, params, "DEPOSIT", params.cycleType);
99478
+ return this.createTransactionResult(
99479
+ calls,
99480
+ true,
99481
+ params,
99482
+ "DEPOSIT",
99483
+ params.cycleType
99484
+ );
99067
99485
  }
99068
- logger2.error(`Unsupported assets movement: ${params.from} to ${params.to}`);
99069
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99486
+ logger2.error(
99487
+ `Unsupported assets movement: ${params.from} to ${params.to}`
99488
+ );
99489
+ return this.createTransactionResult(
99490
+ [],
99491
+ false,
99492
+ params,
99493
+ "NONE",
99494
+ params.cycleType
99495
+ );
99070
99496
  } catch (err2) {
99071
99497
  logger2.error(`error moving assets: ${err2}`);
99072
- return this.createTransactionResult([], false, params, "NONE", params.cycleType);
99498
+ return this.createTransactionResult(
99499
+ [],
99500
+ false,
99501
+ params,
99502
+ "NONE",
99503
+ params.cycleType
99504
+ );
99073
99505
  }
99074
99506
  }
99075
99507
  async handleDeposit() {
99076
99508
  try {
99077
- return this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.VAULT.name, amount: new Web3Number(0, 0) }, "NONE", "INVESTMENT" /* INVESTMENT */);
99509
+ return this.createTransactionResult(
99510
+ [],
99511
+ false,
99512
+ {
99513
+ from: Protocols.VAULT.name,
99514
+ to: Protocols.VAULT.name,
99515
+ amount: new Web3Number(0, 0)
99516
+ },
99517
+ "NONE",
99518
+ "INVESTMENT" /* INVESTMENT */
99519
+ );
99078
99520
  } catch (err2) {
99079
99521
  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 */);
99522
+ return this.createTransactionResult(
99523
+ [],
99524
+ false,
99525
+ {
99526
+ from: Protocols.VAULT.name,
99527
+ to: Protocols.VAULT.name,
99528
+ amount: new Web3Number(0, 0)
99529
+ },
99530
+ "NONE",
99531
+ "INVESTMENT" /* INVESTMENT */
99532
+ );
99081
99533
  }
99082
99534
  }
99083
99535
  /**
@@ -99089,32 +99541,42 @@ spurious results.`);
99089
99541
  * @returns true if the price difference is within the acceptable range, false otherwise
99090
99542
  */
99091
99543
  async checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter, vesuAdapter, avnuAdapter, positionType) {
99092
- const {
99093
- ask,
99094
- bid
99095
- } = await extendedAdapter.fetchOrderBookBTCUSDC();
99544
+ const { ask, bid } = await extendedAdapter.fetchOrderBookBTCUSDC();
99096
99545
  const price = ask.plus(bid).dividedBy(2);
99097
99546
  const btcToken = vesuAdapter.config.supportedPositions[0].asset;
99098
- const btcPriceAvnu = await avnuAdapter.getPriceOfToken(btcToken.address.toString());
99547
+ const btcPriceAvnu = await avnuAdapter.getPriceOfToken(
99548
+ btcToken.address.toString()
99549
+ );
99099
99550
  if (!btcPriceAvnu) {
99100
99551
  logger2.error(`error getting btc price avnu: ${btcPriceAvnu}`);
99101
99552
  return false;
99102
99553
  }
99103
99554
  logger2.info(`price: ${price}`);
99104
99555
  logger2.info(`btcPriceAvnu: ${btcPriceAvnu}`);
99105
- const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
99556
+ const priceDifference = new Web3Number(
99557
+ price.minus(btcPriceAvnu).toFixed(2),
99558
+ 0
99559
+ );
99106
99560
  logger2.info(`priceDifference: ${priceDifference}`);
99107
99561
  if (priceDifference.isNegative()) {
99108
99562
  return false;
99109
99563
  }
99110
99564
  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);
99565
+ logger2.info(
99566
+ `price difference between avnu and extended for open position: ${priceDifference.toNumber()}, minimumExtendedPriceDifferenceForSwapOpen: ${avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen}`
99567
+ );
99568
+ const result2 = priceDifference.greaterThanOrEqualTo(
99569
+ avnuAdapter.config.minimumExtendedPriceDifferenceForSwapOpen
99570
+ );
99113
99571
  logger2.info(`result: ${result2}`);
99114
99572
  return result2;
99115
99573
  } 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);
99574
+ logger2.info(
99575
+ `price difference between avnu and extended for close position: ${priceDifference.toNumber()}, maximumExtendedPriceDifferenceForSwapClosing: ${avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing}`
99576
+ );
99577
+ const result2 = priceDifference.lessThanOrEqualTo(
99578
+ avnuAdapter.config.maximumExtendedPriceDifferenceForSwapClosing
99579
+ );
99118
99580
  logger2.info(`result: ${result2}`);
99119
99581
  return result2;
99120
99582
  }
@@ -99136,7 +99598,19 @@ spurious results.`);
99136
99598
  amount: usdcBalanceVaultAllocator.amount
99137
99599
  });
99138
99600
  calls.push(withdrawCall2);
99139
- return [this.createTransactionResult(calls, true, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "WITHDRAWAL", "WITHDRAWAL" /* WITHDRAWAL */)];
99601
+ return [
99602
+ this.createTransactionResult(
99603
+ calls,
99604
+ true,
99605
+ {
99606
+ from: Protocols.VAULT.name,
99607
+ to: Protocols.NONE.name,
99608
+ amount
99609
+ },
99610
+ "WITHDRAWAL",
99611
+ "WITHDRAWAL" /* WITHDRAWAL */
99612
+ )
99613
+ ];
99140
99614
  }
99141
99615
  const vesuAdapter = await this.getVesuAdapter();
99142
99616
  const extendedAdapter = await this.getExtendedAdapter();
@@ -99145,18 +99619,40 @@ spurious results.`);
99145
99619
  logger2.error(
99146
99620
  `vesu or extended adapter not found: vesuAdapter=${vesuAdapter}, extendedAdapter=${extendedAdapter}`
99147
99621
  );
99148
- return [this.createTransactionResult(calls, status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99622
+ return [
99623
+ this.createTransactionResult(
99624
+ calls,
99625
+ status,
99626
+ {
99627
+ from: Protocols.VAULT.name,
99628
+ to: Protocols.NONE.name,
99629
+ amount
99630
+ },
99631
+ "NONE",
99632
+ "WITHDRAWAL" /* WITHDRAWAL */
99633
+ )
99634
+ ];
99149
99635
  }
99150
99636
  let transactionResults = [];
99151
99637
  const { collateralTokenAmount } = await vesuAdapter.vesuAdapter.getAssetPrices();
99152
- const {
99153
- collateralPrice
99154
- } = await this.getAssetPrices();
99638
+ const { collateralPrice } = await this.getAssetPrices();
99155
99639
  const extendedPositon = await extendedAdapter.getAllOpenPositions();
99156
99640
  if (!extendedPositon) {
99157
99641
  status = false;
99158
99642
  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 */)];
99643
+ return [
99644
+ this.createTransactionResult(
99645
+ calls,
99646
+ status,
99647
+ {
99648
+ from: Protocols.VAULT.name,
99649
+ to: Protocols.NONE.name,
99650
+ amount
99651
+ },
99652
+ "NONE",
99653
+ "WITHDRAWAL" /* WITHDRAWAL */
99654
+ )
99655
+ ];
99160
99656
  }
99161
99657
  const amountDistributionForWithdrawal = await calculateAmountDistributionForWithdrawal(
99162
99658
  usdcBalanceDifference,
@@ -99169,11 +99665,27 @@ spurious results.`);
99169
99665
  logger2.error(
99170
99666
  `error calculating amount distribution for withdrawal: ${amountDistributionForWithdrawal}`
99171
99667
  );
99172
- return [this.createTransactionResult(calls, status, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99668
+ return [
99669
+ this.createTransactionResult(
99670
+ calls,
99671
+ status,
99672
+ {
99673
+ from: Protocols.VAULT.name,
99674
+ to: Protocols.NONE.name,
99675
+ amount
99676
+ },
99677
+ "NONE",
99678
+ "WITHDRAWAL" /* WITHDRAWAL */
99679
+ )
99680
+ ];
99173
99681
  }
99174
99682
  const { vesu_amount, extended_amount } = amountDistributionForWithdrawal;
99175
99683
  if (status && vesu_amount.greaterThan(0)) {
99176
- const { calls: vesuCalls, status: vesuStatus, transactionMetadata: vesuTransactionMetadata } = await this.moveAssets(
99684
+ const {
99685
+ calls: vesuCalls,
99686
+ status: vesuStatus,
99687
+ transactionMetadata: vesuTransactionMetadata
99688
+ } = await this.moveAssets(
99177
99689
  {
99178
99690
  amount: vesu_amount,
99179
99691
  from: Protocols.VESU.name,
@@ -99191,7 +99703,11 @@ spurious results.`);
99191
99703
  });
99192
99704
  }
99193
99705
  if (status && extended_amount.greaterThan(0)) {
99194
- const { calls: extendedCalls, status: extendedStatus, transactionMetadata: extendedTransactionMetadata } = await this.moveAssets(
99706
+ const {
99707
+ calls: extendedCalls,
99708
+ status: extendedStatus,
99709
+ transactionMetadata: extendedTransactionMetadata
99710
+ } = await this.moveAssets(
99195
99711
  {
99196
99712
  amount: extended_amount,
99197
99713
  from: Protocols.EXTENDED.name,
@@ -99209,8 +99725,22 @@ spurious results.`);
99209
99725
  transactionMetadata: extendedTransactionMetadata
99210
99726
  });
99211
99727
  } 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 */)];
99728
+ logger2.error(
99729
+ "error moving assets to vault: extendedStatus: ${extendedStatus}"
99730
+ );
99731
+ return [
99732
+ this.createTransactionResult(
99733
+ [],
99734
+ status,
99735
+ {
99736
+ from: Protocols.VAULT.name,
99737
+ to: Protocols.NONE.name,
99738
+ amount
99739
+ },
99740
+ "NONE",
99741
+ "WITHDRAWAL" /* WITHDRAWAL */
99742
+ )
99743
+ ];
99214
99744
  }
99215
99745
  }
99216
99746
  const withdrawCall = await this.getBringLiquidityCall({
@@ -99232,7 +99762,19 @@ spurious results.`);
99232
99762
  return transactionResults;
99233
99763
  } catch (err2) {
99234
99764
  logger2.error(`error handling withdrawal: ${err2}`);
99235
- return [this.createTransactionResult([], false, { from: Protocols.VAULT.name, to: Protocols.NONE.name, amount }, "NONE", "WITHDRAWAL" /* WITHDRAWAL */)];
99765
+ return [
99766
+ this.createTransactionResult(
99767
+ [],
99768
+ false,
99769
+ {
99770
+ from: Protocols.VAULT.name,
99771
+ to: Protocols.NONE.name,
99772
+ amount
99773
+ },
99774
+ "NONE",
99775
+ "WITHDRAWAL" /* WITHDRAWAL */
99776
+ )
99777
+ ];
99236
99778
  }
99237
99779
  }
99238
99780
  async getAUM() {
@@ -99284,8 +99826,12 @@ spurious results.`);
99284
99826
  const txnsToBeExecuted = txnData.filter((txn) => {
99285
99827
  return txn.transactionMetadata.transactionType !== "NONE" && txn.transactionMetadata.protocolFrom !== "" && txn.transactionMetadata.protocolTo !== "";
99286
99828
  });
99287
- const callsToBeExecutedFinal = txnsToBeExecuted.flatMap((txn) => txn.calls);
99288
- const txnMetadata = txnsToBeExecuted.map((txn) => txn.transactionMetadata);
99829
+ const callsToBeExecutedFinal = txnsToBeExecuted.flatMap(
99830
+ (txn) => txn.calls
99831
+ );
99832
+ const txnMetadata = txnsToBeExecuted.map(
99833
+ (txn) => txn.transactionMetadata
99834
+ );
99289
99835
  return { callsToBeExecutedFinal, txnMetadata };
99290
99836
  } catch (err2) {
99291
99837
  logger2.error(`error processing transaction data from SDK: ${err2}`);
@@ -99315,23 +99861,42 @@ spurious results.`);
99315
99861
  if (!vesuAdapter || !extendedAdapter) {
99316
99862
  return new Web3Number(0, 0);
99317
99863
  }
99318
- const extendedFundingRate = new Web3Number((await extendedAdapter.getNetAPY()).toFixed(4), 0);
99864
+ const extendedFundingRate = new Web3Number(
99865
+ (await extendedAdapter.getNetAPY()).toFixed(4),
99866
+ 0
99867
+ );
99319
99868
  const extendedPositions = await extendedAdapter.getAllOpenPositions();
99320
99869
  if (!extendedPositions || extendedPositions.length === 0) {
99321
99870
  logger2.info(`no extended positions found`);
99322
99871
  return new Web3Number(0, 0);
99323
99872
  }
99324
- const extendePositionSizeUSD = new Web3Number(extendedPositions[0].value || 0, 0);
99873
+ const extendePositionSizeUSD = new Web3Number(
99874
+ extendedPositions[0].value || 0,
99875
+ 0
99876
+ );
99325
99877
  const vesuPositions = await vesuAdapter.getPositions();
99326
99878
  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);
99879
+ const vesuCollateralSizeUSD = new Web3Number(
99880
+ vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99881
+ USDC_TOKEN_DECIMALS
99882
+ );
99883
+ const vesuDebtSizeUSD = new Web3Number(
99884
+ vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99885
+ USDC_TOKEN_DECIMALS
99886
+ );
99329
99887
  const num1 = extendePositionSizeUSD.multipliedBy(extendedFundingRate);
99330
99888
  const num2 = vesuCollateralSizeUSD.multipliedBy(vesuSupplyApy);
99331
99889
  const num3 = vesuDebtSizeUSD.abs();
99332
99890
  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);
99891
+ const vesuMaxBorrowableAmount = await vesuAdapter.vesuAdapter.getMaxBorrowableByInterestRate(
99892
+ this.config,
99893
+ vesuAdapter.config.debt,
99894
+ maxBorrowApy.toNumber()
99895
+ );
99896
+ return new Web3Number(
99897
+ vesuMaxBorrowableAmount.toFixed(USDC_TOKEN_DECIMALS),
99898
+ USDC_TOKEN_DECIMALS
99899
+ );
99335
99900
  }
99336
99901
  async getVesuHealthFactors() {
99337
99902
  const vesuAdapter = await this.getVesuAdapter();
@@ -99340,18 +99905,33 @@ spurious results.`);
99340
99905
  return [0, 0];
99341
99906
  }
99342
99907
  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);
99908
+ const vesuCollateralSizeUSD = new Web3Number(
99909
+ vesuPositions[0].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99910
+ 0
99911
+ );
99912
+ const vesuDebtSizeUSD = new Web3Number(
99913
+ vesuPositions[1].usdValue.toFixed(USDC_TOKEN_DECIMALS),
99914
+ 0
99915
+ );
99345
99916
  const actualLtv = vesuDebtSizeUSD.dividedBy(vesuCollateralSizeUSD).abs();
99346
99917
  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);
99918
+ const maxLtv = new Web3Number(
99919
+ await vesuAdapter.vesuAdapter.getLTVConfig(this.config),
99920
+ 4
99921
+ );
99922
+ const healthFactor = new Web3Number(
99923
+ maxLtv.dividedBy(actualLtv).toFixed(4),
99924
+ 4
99925
+ );
99349
99926
  logger2.info(`healthFactor: ${healthFactor.toNumber()}`);
99350
99927
  const extendedBalance = await extendedAdapter.getExtendedDepositAmount();
99351
99928
  if (!extendedBalance) {
99352
99929
  return [0, 0];
99353
99930
  }
99354
- const extendedLeverage = new Web3Number((Number(extendedBalance.marginRatio) * 100).toFixed(4), 4);
99931
+ const extendedLeverage = new Web3Number(
99932
+ (Number(extendedBalance.marginRatio) * 100).toFixed(4),
99933
+ 4
99934
+ );
99355
99935
  logger2.info(`extendedLeverage: ${extendedLeverage.toNumber()}`);
99356
99936
  return [healthFactor.toNumber(), extendedLeverage.toNumber()];
99357
99937
  }
@@ -99372,12 +99952,16 @@ spurious results.`);
99372
99952
  splits: []
99373
99953
  };
99374
99954
  }
99375
- let vesuPositions = allPositions.filter((item) => item.protocol === Protocols.VESU);
99955
+ let vesuPositions = allPositions.filter(
99956
+ (item) => item.protocol === Protocols.VESU
99957
+ );
99376
99958
  vesuPositions.map((item) => {
99377
99959
  item.apy.apy = item.apy.apy * 0.1;
99378
99960
  });
99379
99961
  const extendedPositions = await extendedAdapter.getAllOpenPositions();
99380
- const usdcToken = Global.getDefaultTokens().find((token) => token.symbol === "USDC");
99962
+ const usdcToken = Global.getDefaultTokens().find(
99963
+ (token) => token.symbol === "USDC"
99964
+ );
99381
99965
  if (!extendedPositions || !usdcToken) {
99382
99966
  return {
99383
99967
  net: 0,
@@ -99390,7 +99974,10 @@ spurious results.`);
99390
99974
  const totalHoldingsUSDValue = allPositions.reduce((acc, curr) => acc + curr.usdValue, 0) + Number(extendedEquity);
99391
99975
  console.log(totalHoldingsUSDValue);
99392
99976
  const extendedPositionSizeMultipliedByApy = Number(extendedPosition.value) * extendedApy;
99393
- let weightedAPYs = allPositions.reduce((acc, curr) => acc + curr.apy.apy * curr.usdValue, 0) + extendedPositionSizeMultipliedByApy;
99977
+ let weightedAPYs = allPositions.reduce(
99978
+ (acc, curr) => acc + curr.apy.apy * curr.usdValue,
99979
+ 0
99980
+ ) + extendedPositionSizeMultipliedByApy;
99394
99981
  console.log(weightedAPYs);
99395
99982
  const netAPY = weightedAPYs / totalHoldingsUSDValue;
99396
99983
  console.log(netAPY);
@@ -99404,13 +99991,22 @@ spurious results.`);
99404
99991
  });
99405
99992
  return {
99406
99993
  net: netAPY,
99407
- splits: allPositions.map((p) => ({ apy: p.apy.apy, id: p.remarks ?? "" }))
99994
+ splits: allPositions.map((p) => ({
99995
+ apy: p.apy.apy,
99996
+ id: p.remarks ?? ""
99997
+ }))
99408
99998
  };
99409
99999
  }
99410
100000
  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");
100001
+ const usdceToken = Global.getDefaultTokens().find(
100002
+ (token) => token.symbol === "USDCe"
100003
+ );
100004
+ const wbtcToken = Global.getDefaultTokens().find(
100005
+ (token) => token.symbol === "WBTC"
100006
+ );
100007
+ const usdcToken = Global.getDefaultTokens().find(
100008
+ (token) => token.symbol === "USDC"
100009
+ );
99414
100010
  if (!usdceToken || !wbtcToken || !usdcToken) {
99415
100011
  return [];
99416
100012
  }
@@ -99484,9 +100080,7 @@ spurious results.`);
99484
100080
  });
99485
100081
  const extendedAdapter = new ExtendedAdapter({
99486
100082
  ...baseAdapterConfig,
99487
- supportedPositions: [
99488
- { asset: usdcToken, isDebt: true }
99489
- ],
100083
+ supportedPositions: [{ asset: usdcToken, isDebt: true }],
99490
100084
  vaultIdExtended,
99491
100085
  extendedContract: EXTENDED_CONTRACT,
99492
100086
  extendedBackendWriteUrl,
@@ -99543,11 +100137,11 @@ spurious results.`);
99543
100137
  asset: wbtcToken.address
99544
100138
  });
99545
100139
  vaultSettings.leafAdapters.push(() => vesuMultiplyAdapter.getDepositLeaf());
100140
+ vaultSettings.leafAdapters.push(() => vesuMultiplyAdapter.getWithdrawLeaf());
100141
+ vaultSettings.leafAdapters.push(() => extendedAdapter.getDepositLeaf());
99546
100142
  vaultSettings.leafAdapters.push(
99547
- () => vesuMultiplyAdapter.getWithdrawLeaf()
100143
+ () => extendedAdapter.getSwapFromLegacyLeaf()
99548
100144
  );
99549
- vaultSettings.leafAdapters.push(() => extendedAdapter.getDepositLeaf());
99550
- vaultSettings.leafAdapters.push(() => extendedAdapter.getSwapFromLegacyLeaf());
99551
100145
  vaultSettings.leafAdapters.push(() => avnuAdapter.getDepositLeaf());
99552
100146
  vaultSettings.leafAdapters.push(() => avnuAdapter.getWithdrawLeaf());
99553
100147
  vaultSettings.leafAdapters.push(
@@ -99592,29 +100186,70 @@ spurious results.`);
99592
100186
  " to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
99593
100187
  ] }),
99594
100188
  /* @__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" }]),
100189
+ "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
100190
+ " ",
100191
+ highlightTextWithLinks("conversion rate oracle", [
100192
+ {
100193
+ highlight: "conversion rate oracle",
100194
+ link: "https://docs.pragma.build/starknet/development#conversion-rate"
100195
+ }
100196
+ ]),
99597
100197
  " ",
99598
100198
  "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
100199
  ] }),
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
- ] }) })
100200
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
100201
+ "div",
100202
+ {
100203
+ style: {
100204
+ backgroundColor: "#222",
100205
+ padding: "10px",
100206
+ borderRadius: "8px",
100207
+ marginBottom: "20px",
100208
+ border: "1px solid #444"
100209
+ },
100210
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
100211
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
100212
+ " Requests can take up to",
100213
+ " ",
100214
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
100215
+ " to process as the vault unwinds and settles routing."
100216
+ ] })
100217
+ }
100218
+ ),
100219
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
100220
+ "div",
100221
+ {
100222
+ style: {
100223
+ backgroundColor: "#222",
100224
+ padding: "10px",
100225
+ borderRadius: "8px",
100226
+ marginBottom: "20px",
100227
+ border: "1px solid #444"
100228
+ },
100229
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
100230
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
100231
+ " 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."
100232
+ ] })
100233
+ }
100234
+ )
99610
100235
  ] });
99611
100236
  }
99612
100237
  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"),
100238
+ vaultAddress: ContractAddr.from(
100239
+ "0x058905be22d6a81792df79425dc9641cf3e1b77f36748631b7d7e5d713a32b55"
100240
+ ),
100241
+ manager: ContractAddr.from(
100242
+ "0x02648d703783feb2d967cf0520314cb5aa800d69a9426f3e3b317395af44de16"
100243
+ ),
100244
+ vaultAllocator: ContractAddr.from(
100245
+ "0x07d533c838eab6a4d854dd3aea96a55993fccd35821921970d00bde946b63b6f"
100246
+ ),
100247
+ redeemRequestNFT: ContractAddr.from(
100248
+ "0x01ef91f08fb99729c00f82fc6e0ece37917bcc43952596c19996259dc8adbbba"
100249
+ ),
100250
+ aumOracle: ContractAddr.from(
100251
+ "0x030b6acfec162f5d6e72b8a4d2798aedce78fb39de78a8f549f7cd277ae8bc8d"
100252
+ ),
99618
100253
  leafAdapters: [],
99619
100254
  adapters: [],
99620
100255
  targetHealthFactor: 1.4,
@@ -99626,13 +100261,29 @@ spurious results.`);
99626
100261
  "0.001",
99627
100262
  Global.getDefaultTokens().find((token) => token.symbol === "WBTC").decimals
99628
100263
  ),
99629
- borrowable_assets: [Global.getDefaultTokens().find((token) => token.symbol === "WBTC")],
100264
+ borrowable_assets: [
100265
+ Global.getDefaultTokens().find((token) => token.symbol === "WBTC")
100266
+ ],
99630
100267
  minimumWBTCDifferenceForAvnuSwap: MINIMUM_WBTC_DIFFERENCE_FOR_AVNU_SWAP,
99631
100268
  walletAddress: WALLET_ADDRESS
99632
100269
  };
99633
100270
  var VesuExtendedTestStrategies = (extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing) => {
99634
100271
  return [
99635
- getStrategySettingsVesuExtended("WBTC", "USDC", re7UsdcPrimeDevansh, false, false, extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing)
100272
+ getStrategySettingsVesuExtended(
100273
+ "WBTC",
100274
+ "USDC",
100275
+ re7UsdcPrimeDevansh,
100276
+ false,
100277
+ false,
100278
+ extendedBackendReadUrl,
100279
+ extendedBackendWriteUrl,
100280
+ vaultIdExtended,
100281
+ minimumExtendedMovementAmount,
100282
+ minimumVesuMovementAmount,
100283
+ minimumExtendedRetriesDelayForOrderStatus,
100284
+ minimumExtendedPriceDifferenceForSwapOpen,
100285
+ maximumExtendedPriceDifferenceForSwapClosing
100286
+ )
99636
100287
  ];
99637
100288
  };
99638
100289
  function getStrategySettingsVesuExtended(lstSymbol, underlyingSymbol, addresses, isPreview = false, isLST, extendedBackendReadUrl, extendedBackendWriteUrl, vaultIdExtended, minimumExtendedMovementAmount, minimumVesuMovementAmount, minimumExtendedRetriesDelayForOrderStatus, minimumExtendedPriceDifferenceForSwapOpen, maximumExtendedPriceDifferenceForSwapClosing) {
@@ -99642,8 +100293,25 @@ spurious results.`);
99642
100293
  address: addresses.vaultAddress,
99643
100294
  launchBlock: 0,
99644
100295
  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),
100296
+ depositTokens: [
100297
+ Global.getDefaultTokens().find(
100298
+ (token) => token.symbol === underlyingSymbol
100299
+ )
100300
+ ],
100301
+ additionalInfo: getLooperSettings2(
100302
+ lstSymbol,
100303
+ underlyingSymbol,
100304
+ addresses,
100305
+ VesuPools.Re7USDCPrime,
100306
+ extendedBackendReadUrl,
100307
+ extendedBackendWriteUrl,
100308
+ vaultIdExtended,
100309
+ minimumExtendedMovementAmount,
100310
+ minimumVesuMovementAmount,
100311
+ minimumExtendedRetriesDelayForOrderStatus,
100312
+ minimumExtendedPriceDifferenceForSwapOpen,
100313
+ maximumExtendedPriceDifferenceForSwapClosing
100314
+ ),
99647
100315
  risk: {
99648
100316
  riskFactor: _riskFactor3,
99649
100317
  netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),