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