impermax-sdk 2.1.339 → 2.1.341
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/lib/config/subgraphs.js
CHANGED
|
@@ -84,9 +84,9 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
84
84
|
],
|
|
85
85
|
},
|
|
86
86
|
[types_1.Networks.Canto]: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
//[Factory.SOLV2]: [
|
|
88
|
+
// "https://api.impermax.finance/subgraphs/name/impermax-finance/impermax-canto-solv2",
|
|
89
|
+
//],
|
|
90
90
|
},
|
|
91
91
|
[types_1.Networks.ZksyncEra]: {
|
|
92
92
|
[types_1.Factory.SOLV2]: [
|
|
@@ -48,7 +48,13 @@ async function fetchBorrowersList() {
|
|
|
48
48
|
if (!borrowPositions)
|
|
49
49
|
return;
|
|
50
50
|
// Borrower addresses for this factory
|
|
51
|
-
borrowers[factory] = borrowPositions.map((i) =>
|
|
51
|
+
borrowers[factory] = borrowPositions.map((i) => {
|
|
52
|
+
if (!i.user) {
|
|
53
|
+
console.log("i.user is null for", factory, this.network);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return i.user.id;
|
|
57
|
+
}).filter(a => a);
|
|
52
58
|
});
|
|
53
59
|
return borrowers;
|
|
54
60
|
}
|
|
@@ -39,5 +39,6 @@ export default class OffchainNftlpUniswapV3 extends OffchainNftlp {
|
|
|
39
39
|
getFullRangeRateAccurate(fee: number): Promise<number>;
|
|
40
40
|
getFullRangeRate(fee: number): Promise<number>;
|
|
41
41
|
getWeightedAvgFullRangeRate(): Promise<number>;
|
|
42
|
+
getBestFullRangeRate(): Promise<number>;
|
|
42
43
|
getTotalAPR(): Promise<number>;
|
|
43
44
|
}
|
|
@@ -178,10 +178,18 @@ class OffchainNftlpUniswapV3 extends offchainNftlp_1.default {
|
|
|
178
178
|
}
|
|
179
179
|
return totalTvl > 0 ? totalCompoundedRate / totalTvl : 0;
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
async getBestFullRangeRate() {
|
|
182
|
+
let bestRate = 0;
|
|
183
|
+
for (const fee of uniswapV3General_1.FEES) {
|
|
184
|
+
const rate = await this.getFullRangeRateAccurate(fee);
|
|
185
|
+
bestRate = Math.max(bestRate, rate);
|
|
186
|
+
}
|
|
187
|
+
return bestRate;
|
|
188
|
+
}
|
|
189
|
+
// calculate the pair APR assuming a +-15% price range
|
|
182
190
|
async getTotalAPR() {
|
|
183
|
-
const fullRangeAPR = await this.
|
|
184
|
-
return fullRangeAPR * (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / 1.
|
|
191
|
+
const fullRangeAPR = await this.getBestFullRangeRate() * utils_1.SECONDS_IN_YEAR;
|
|
192
|
+
return fullRangeAPR * (0, uniswapV3General_1.uniV3ConcentrationFactor)(1 / 1.15, 1.15);
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
exports.default = OffchainNftlpUniswapV3;
|