@1delta/margin-fetcher 0.0.174 → 0.0.176
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.
- package/dist/index.js +15 -44
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/euler/fetcher/normalize.d.ts +17 -17
- package/dist/lending/public-data/euler/fetcher/normalize.d.ts.map +1 -1
- package/dist/lending/public-data/euler/publicCallParse.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -17500,49 +17500,19 @@ function buildReverseLTVIndex(cluster) {
|
|
|
17500
17500
|
}
|
|
17501
17501
|
return index;
|
|
17502
17502
|
}
|
|
17503
|
-
function
|
|
17504
|
-
const index = /* @__PURE__ */ new Map();
|
|
17505
|
-
for (const [addr, info] of cluster.vaultData) {
|
|
17506
|
-
const borrowVault = addr.toLowerCase();
|
|
17507
|
-
const entries = [];
|
|
17508
|
-
for (const ltv of info.collateralLTVInfo) {
|
|
17509
|
-
if (ltv.borrowLTV <= 0n) continue;
|
|
17510
|
-
entries.push({
|
|
17511
|
-
collateralVault: ltv.collateral.toLowerCase(),
|
|
17512
|
-
ltv
|
|
17513
|
-
});
|
|
17514
|
-
}
|
|
17515
|
-
if (entries.length > 0) {
|
|
17516
|
-
index.set(borrowVault, entries);
|
|
17517
|
-
}
|
|
17518
|
-
}
|
|
17519
|
-
return index;
|
|
17520
|
-
}
|
|
17521
|
-
function buildTokenConfig(vaultAddr, reverseLTV, forwardLTV, borrowVaults, clusterVaults) {
|
|
17503
|
+
function buildTokenConfig(vaultAddr, reverseLTV, borrowVaults, vaultData) {
|
|
17522
17504
|
const config = {};
|
|
17523
17505
|
const reverseEntries = reverseLTV.get(vaultAddr) ?? [];
|
|
17524
17506
|
for (const { borrowVault, ltv } of reverseEntries) {
|
|
17525
17507
|
if (!borrowVaults.has(borrowVault)) continue;
|
|
17526
17508
|
config[borrowVault] = {
|
|
17527
17509
|
category: borrowVault,
|
|
17510
|
+
label: findInfo(borrowVault, vaultData)?.vaultName ?? borrowVault,
|
|
17528
17511
|
borrowCollateralFactor: ltvToNumber(ltv.borrowLTV),
|
|
17529
17512
|
collateralFactor: ltvToNumber(ltv.liquidationLTV),
|
|
17530
17513
|
borrowFactor: 1
|
|
17531
17514
|
};
|
|
17532
17515
|
}
|
|
17533
|
-
if (borrowVaults.has(vaultAddr)) {
|
|
17534
|
-
const forwardEntries = forwardLTV.get(vaultAddr) ?? [];
|
|
17535
|
-
for (const { collateralVault } of forwardEntries) {
|
|
17536
|
-
if (!clusterVaults.has(collateralVault)) continue;
|
|
17537
|
-
if (config[collateralVault]) continue;
|
|
17538
|
-
config[collateralVault] = {
|
|
17539
|
-
category: collateralVault,
|
|
17540
|
-
borrowCollateralFactor: 0,
|
|
17541
|
-
collateralFactor: 0,
|
|
17542
|
-
borrowFactor: 1
|
|
17543
|
-
};
|
|
17544
|
-
}
|
|
17545
|
-
}
|
|
17546
17516
|
return config;
|
|
17547
17517
|
}
|
|
17548
17518
|
function buildEModes(borrowVaults, cluster) {
|
|
@@ -17652,10 +17622,6 @@ function findInfo(addr, vaultData) {
|
|
|
17652
17622
|
function normalizeCluster(cluster, opts) {
|
|
17653
17623
|
const borrowVaults = identifyBorrowVaults(cluster);
|
|
17654
17624
|
const reverseLTV = buildReverseLTVIndex(cluster);
|
|
17655
|
-
const forwardLTV = buildForwardLTVIndex(cluster);
|
|
17656
|
-
const clusterVaults = new Set(
|
|
17657
|
-
[...cluster.vaultData.keys()].map((a) => a.toLowerCase())
|
|
17658
|
-
);
|
|
17659
17625
|
const collateralActiveVaults = /* @__PURE__ */ new Set();
|
|
17660
17626
|
for (const [collateral, entries] of reverseLTV) {
|
|
17661
17627
|
if (entries.some((e) => borrowVaults.has(e.borrowVault))) {
|
|
@@ -17669,9 +17635,8 @@ function normalizeCluster(cluster, opts) {
|
|
|
17669
17635
|
const config = buildTokenConfig(
|
|
17670
17636
|
norm,
|
|
17671
17637
|
reverseLTV,
|
|
17672
|
-
forwardLTV,
|
|
17673
17638
|
borrowVaults,
|
|
17674
|
-
|
|
17639
|
+
cluster.vaultData
|
|
17675
17640
|
);
|
|
17676
17641
|
data[norm] = buildTokenEntry(
|
|
17677
17642
|
info,
|
|
@@ -17703,7 +17668,10 @@ var getEulerV2ReservesDataConverter = (lender, chainId, prices, additionalYields
|
|
|
17703
17668
|
for (let i = 0; i < vaultAddresses.length; i++) {
|
|
17704
17669
|
const result = data[i];
|
|
17705
17670
|
if (result) {
|
|
17706
|
-
vaultDataMap.set(
|
|
17671
|
+
vaultDataMap.set(
|
|
17672
|
+
vaultAddresses[i].vault.toLowerCase(),
|
|
17673
|
+
result
|
|
17674
|
+
);
|
|
17707
17675
|
}
|
|
17708
17676
|
}
|
|
17709
17677
|
if (vaultDataMap.size === 0) return void 0;
|
|
@@ -17731,11 +17699,14 @@ var getEulerV2ReservesDataConverter = (lender, chainId, prices, additionalYields
|
|
|
17731
17699
|
poolId: vaultAddr,
|
|
17732
17700
|
underlying: entry.asset.address,
|
|
17733
17701
|
asset: {
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17702
|
+
...{
|
|
17703
|
+
chainId,
|
|
17704
|
+
decimals: entry.asset.decimals,
|
|
17705
|
+
name: entry.asset.name,
|
|
17706
|
+
address: entry.asset.address,
|
|
17707
|
+
symbol: entry.asset.symbol
|
|
17708
|
+
},
|
|
17709
|
+
...assetMeta ?? {}
|
|
17739
17710
|
},
|
|
17740
17711
|
// token amounts
|
|
17741
17712
|
totalDeposits: String(totalDeposits),
|