@continuumdao/ctm-mpc-defi 0.2.33 → 0.2.34

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.
@@ -2288,9 +2288,10 @@ function vaultCashAndBorrows(r) {
2288
2288
  }
2289
2289
  return { cash, borrows };
2290
2290
  }
2291
- function v3ApyDecimalToRayString(apy) {
2292
- if (apy == null || !Number.isFinite(apy) || apy <= 0) return "0";
2293
- const ray = BigInt(Math.round(apy * 1e9)) * 10n ** 18n;
2291
+ function v3ApyPercentToRayString(apyPercent) {
2292
+ if (apyPercent == null || !Number.isFinite(apyPercent) || apyPercent <= 0) return "0";
2293
+ const fraction = apyPercent / 100;
2294
+ const ray = BigInt(Math.round(fraction * 1e9)) * 10n ** 18n;
2294
2295
  return ray.toString();
2295
2296
  }
2296
2297
  function v3VaultToGqlRow(v) {
@@ -2315,8 +2316,8 @@ function v3VaultToGqlRow(v) {
2315
2316
  state: {
2316
2317
  cash: cash.toString(),
2317
2318
  totalBorrows: borrows.toString(),
2318
- supplyApy: v3ApyDecimalToRayString(v.supplyApy),
2319
- borrowApy: v3ApyDecimalToRayString(v.borrowApy)
2319
+ supplyApy: v3ApyPercentToRayString(v.supplyApy),
2320
+ borrowApy: v3ApyPercentToRayString(v.borrowApy)
2320
2321
  }
2321
2322
  };
2322
2323
  }
@@ -2330,7 +2331,12 @@ async function fetchCollateralVaultMeta(chainId, collateralIds) {
2330
2331
  const chunkSize = 400;
2331
2332
  for (let i = 0; i < uniq.length; i += chunkSize) {
2332
2333
  const chunk = uniq.slice(i, i + chunkSize);
2333
- const d = await eulerV2QueryGraphQl(chainId, COLLATERAL_META, { first: chunk.length, ids: chunk });
2334
+ let d;
2335
+ try {
2336
+ d = await eulerV2QueryGraphQl(chainId, COLLATERAL_META, { first: chunk.length, ids: chunk });
2337
+ } catch {
2338
+ continue;
2339
+ }
2334
2340
  for (const r of d.eulerVaults ?? []) {
2335
2341
  const id = normId(r.id ?? void 0);
2336
2342
  if (!id) continue;