impermax-sdk 2.1.328 → 2.1.330
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.
|
@@ -29,11 +29,15 @@ exports.getLendingPoolData = getLendingPoolData;
|
|
|
29
29
|
async function initializeLendingPoolsData() {
|
|
30
30
|
const lendingPoolsData = {};
|
|
31
31
|
// Get raw data
|
|
32
|
-
const [lendingPools,
|
|
32
|
+
const [lendingPools,
|
|
33
|
+
//lendingPoolsPast24h,
|
|
34
|
+
//lendingPoolsPast7d,
|
|
35
|
+
//impermaxChefRewardRates,
|
|
36
|
+
] = await Promise.all([
|
|
33
37
|
this.fetchLendingPools(),
|
|
34
|
-
this.fetchLendingPoolsPast(24 * 3600),
|
|
35
|
-
this.fetchLendingPoolsPast(7 * 24 * 3600),
|
|
36
|
-
this.fetchImpermaxChefRewardRates(),
|
|
38
|
+
//this.fetchLendingPoolsPast(24 * 3600),
|
|
39
|
+
//this.fetchLendingPoolsPast(7 * 24 * 3600),
|
|
40
|
+
//this.fetchImpermaxChefRewardRates(),
|
|
37
41
|
]);
|
|
38
42
|
// Get Uniswap APR
|
|
39
43
|
//const lendingPoolsByAmm: { [key in Amms]?: LendingPoolData[] } = {};
|
|
@@ -58,12 +62,12 @@ async function initializeLendingPoolsData() {
|
|
|
58
62
|
if ((0, offchainTypes_1.isV3Factory)(factory))
|
|
59
63
|
lendingPool["pair"] = lendingPool["nftlp"];
|
|
60
64
|
lendingPool.pair.uniswapAPR = 0;
|
|
61
|
-
if (impermaxChefRewardRates) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
65
|
+
/*if (impermaxChefRewardRates) {
|
|
66
|
+
lendingPool.borrowable0.rewards =
|
|
67
|
+
impermaxChefRewardRates[lendingPool.borrowable0.id];
|
|
68
|
+
lendingPool.borrowable1.rewards =
|
|
69
|
+
impermaxChefRewardRates[lendingPool.borrowable1.id];
|
|
70
|
+
}*/
|
|
67
71
|
// If one of the price of the 2 tokens is 0, fix the collateral price by doubling it
|
|
68
72
|
if (parseFloat(lendingPool.borrowable0.underlying.derivedUSD) === 0 ||
|
|
69
73
|
parseFloat(lendingPool.borrowable1.underlying.derivedUSD) === 0) {
|
|
@@ -74,22 +78,22 @@ async function initializeLendingPoolsData() {
|
|
|
74
78
|
lendingPoolsData[factory][lendingPool.id] = lendingPool;
|
|
75
79
|
}
|
|
76
80
|
// Add past data
|
|
77
|
-
if (lendingPoolsPast24h) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
81
|
+
/*if (lendingPoolsPast24h) {
|
|
82
|
+
const lendingPoolsPast24hOfFactory = lendingPoolsPast24h[factory];
|
|
83
|
+
if (lendingPoolsPast24hOfFactory) {
|
|
84
|
+
for (const lendingPool of lendingPoolsPast24hOfFactory) {
|
|
85
|
+
lendingPoolsData[factory][lendingPool.id].past24h = lendingPool;
|
|
83
86
|
}
|
|
87
|
+
}
|
|
84
88
|
}
|
|
85
89
|
if (lendingPoolsPast7d) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
90
|
+
const lendingPoolsPast7dhOfFactory = lendingPoolsPast7d[factory];
|
|
91
|
+
if (lendingPoolsPast7dhOfFactory) {
|
|
92
|
+
for (const lendingPool of lendingPoolsPast7dhOfFactory) {
|
|
93
|
+
lendingPoolsData[factory][lendingPool.id].past7d = lendingPool;
|
|
91
94
|
}
|
|
92
|
-
|
|
95
|
+
}
|
|
96
|
+
}*/
|
|
93
97
|
}
|
|
94
98
|
// Initialize OffchainLendingPool objects
|
|
95
99
|
this.lendingPools = {};
|
|
@@ -40,7 +40,7 @@ class LendingVaultEntity {
|
|
|
40
40
|
for (let position of this.positions) {
|
|
41
41
|
acc += position.amount * position.borrowable.getSupplyRate();
|
|
42
42
|
}
|
|
43
|
-
return acc / this.getTotalSupply();
|
|
43
|
+
return acc / this.getTotalSupply() * (1 - this.reserveFactor);
|
|
44
44
|
}
|
|
45
45
|
getSupplyAPR() {
|
|
46
46
|
return (0, index_1.toAPR)(this.getSupplyRate());
|