impermax-sdk 2.1.531 → 2.1.533
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
|
@@ -166,7 +166,7 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
166
166
|
},
|
|
167
167
|
[types_1.Networks.HyperEVM]: {
|
|
168
168
|
[types_1.Factory.V3]: [
|
|
169
|
-
|
|
169
|
+
'https://hyperevm-factoryv3-production.up.railway.app/',
|
|
170
170
|
'https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-v3-hyperevm/0.0.1/gn'
|
|
171
171
|
]
|
|
172
172
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const offchainNftlp_1 = __importDefault(require("./offchainNftlp"));
|
|
7
7
|
const CLGeneral_1 = require("../../../utils/nftlpMath/CLGeneral");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
|
+
const CLGeneral_2 = require("../../../utils/nftlpMath/CLGeneral");
|
|
9
10
|
class OffchainNftlpGenericCL extends offchainNftlp_1.default {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
@@ -128,13 +129,22 @@ class OffchainNftlpGenericCL extends offchainNftlp_1.default {
|
|
|
128
129
|
}
|
|
129
130
|
return cumulativeRate / cumulativeTVL;
|
|
130
131
|
}
|
|
131
|
-
//
|
|
132
|
+
// Calculate the pair APR assuming a +-8% price range
|
|
133
|
+
// Uses pool with highest tvl
|
|
132
134
|
async getTotalAPR() {
|
|
133
|
-
const fullRangeAPR = await this.getBestFullRangeRate() * utils_1.SECONDS_IN_YEAR;
|
|
134
|
-
const isStable = await this.getLendingPool().isStablePair();
|
|
135
135
|
const tickSpacings = await this.tickSpacings();
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
let maxTvl = 0;
|
|
137
|
+
let bestTickSpacing = tickSpacings[0];
|
|
138
|
+
for (const tickSpacing of tickSpacings) {
|
|
139
|
+
const tvl = await this.getGlobalTvl(tickSpacing);
|
|
140
|
+
if (tvl > maxTvl) {
|
|
141
|
+
maxTvl = tvl;
|
|
142
|
+
bestTickSpacing = tickSpacing;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const fullRangeAPR = await this.getFullRangeRateAccurate(bestTickSpacing) * utils_1.SECONDS_IN_YEAR;
|
|
146
|
+
const isStable = await this.getLendingPool().isStablePair();
|
|
147
|
+
const adjustment = isStable ? (1 + (0, CLGeneral_2.tickSpacingPercentageRanges)(bestTickSpacing)[2]) : 1.08;
|
|
138
148
|
return fullRangeAPR * (0, CLGeneral_1.clConcentrationFactor)(1 / adjustment, adjustment);
|
|
139
149
|
}
|
|
140
150
|
}
|