impermax-sdk 1.2.22 → 1.2.24
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.
|
@@ -57,7 +57,8 @@ class OffchainBorrowable extends offchainPoolToken_1.default {
|
|
|
57
57
|
// Borrow tracker
|
|
58
58
|
getBorrowTracker() {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
|
|
60
|
+
const borrowTracker = yield this.getPoolTokenParam("borrowTracker");
|
|
61
|
+
return borrowTracker !== null && borrowTracker !== void 0 ? borrowTracker : "0x0000000000000000000000000000000000000000";
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
// Borrow Index
|
|
@@ -96,6 +96,8 @@ export default class Offchain {
|
|
|
96
96
|
totalBorrowsUSD: number;
|
|
97
97
|
}[]>;
|
|
98
98
|
getCrossChainTVL(): Promise<number>;
|
|
99
|
+
getCrossChainTotalValueSupplied(): Promise<number>;
|
|
100
|
+
getCrossChainTotalValueBorrowed(): Promise<number>;
|
|
99
101
|
getTotalValueLocked(): Promise<number>;
|
|
100
102
|
getTotalValueSupplied(): Promise<number>;
|
|
101
103
|
getTotalValueBorrowed(): Promise<number>;
|
package/lib/offchain/offchain.js
CHANGED
|
@@ -162,13 +162,26 @@ class Offchain {
|
|
|
162
162
|
return Promise.all(requests);
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
// TVL Data
|
|
165
|
+
// Crosschain TVL Data
|
|
166
166
|
getCrossChainTVL() {
|
|
167
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
168
|
const tvlData = yield this.getTvlData();
|
|
169
169
|
return tvlData.crossChainTVLUSD;
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
+
getCrossChainTotalValueSupplied() {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const tvlData = yield this.getTvlData();
|
|
175
|
+
return tvlData.crossChainSupplyUSD;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
getCrossChainTotalValueBorrowed() {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const tvlData = yield this.getTvlData();
|
|
181
|
+
return tvlData.crossChainBorrowUSD;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// This chain TVL Data
|
|
172
185
|
getTotalValueLocked() {
|
|
173
186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
187
|
const tvlData = yield this.getTvlData();
|
|
@@ -480,21 +480,26 @@ function initializeTvlData() {
|
|
|
480
480
|
console.log("can't initialize TVL data");
|
|
481
481
|
return {
|
|
482
482
|
crossChainTVLUSD: 0,
|
|
483
|
+
crossChainSupplyUSD: 0,
|
|
484
|
+
crossChainBorrowUSD: 0,
|
|
483
485
|
totalBalanceUSD: 0,
|
|
484
486
|
totalSupplyUSD: 0,
|
|
485
487
|
totalBorrowsUSD: 0,
|
|
486
488
|
};
|
|
487
489
|
}
|
|
488
490
|
let crossChainTVLUSD = 0;
|
|
491
|
+
let crossChainSupplyUSD = 0;
|
|
492
|
+
let crossChainBorrowUSD = 0;
|
|
489
493
|
let thisChainTVLUSD = 0;
|
|
490
494
|
let thisChainSupplyUSD = 0;
|
|
491
495
|
let thisChainBorrowUSD = 0;
|
|
492
496
|
let i = 0;
|
|
493
497
|
for (const network of networks) {
|
|
494
|
-
let chainTvlUSD = 0;
|
|
495
498
|
for (const factory in subgraphs_1.IMPERMAX_SUBGRAPH_URL[network]) {
|
|
496
499
|
const data = results[i].data.impermaxFactories[0];
|
|
497
|
-
|
|
500
|
+
crossChainTVLUSD += parseFloat(data.totalBalanceUSD);
|
|
501
|
+
crossChainSupplyUSD += parseFloat(data.totalSupplyUSD);
|
|
502
|
+
crossChainBorrowUSD += parseFloat(data.totalBorrowsUSD);
|
|
498
503
|
if (network === this.network) {
|
|
499
504
|
thisChainTVLUSD += parseFloat(data.totalBalanceUSD);
|
|
500
505
|
thisChainSupplyUSD += parseFloat(data.totalSupplyUSD);
|
|
@@ -502,7 +507,6 @@ function initializeTvlData() {
|
|
|
502
507
|
}
|
|
503
508
|
i++;
|
|
504
509
|
}
|
|
505
|
-
crossChainTVLUSD += chainTvlUSD;
|
|
506
510
|
}
|
|
507
511
|
if (!networks.includes(this.network)) {
|
|
508
512
|
const calls = [];
|
|
@@ -522,6 +526,8 @@ function initializeTvlData() {
|
|
|
522
526
|
}
|
|
523
527
|
return {
|
|
524
528
|
crossChainTVLUSD,
|
|
529
|
+
crossChainSupplyUSD,
|
|
530
|
+
crossChainBorrowUSD,
|
|
525
531
|
totalBalanceUSD: thisChainTVLUSD,
|
|
526
532
|
totalSupplyUSD: thisChainSupplyUSD,
|
|
527
533
|
totalBorrowsUSD: thisChainBorrowUSD,
|
|
@@ -144,6 +144,8 @@ export interface LendingPoolPosition {
|
|
|
144
144
|
}
|
|
145
145
|
export interface TvlData {
|
|
146
146
|
crossChainTVLUSD: number;
|
|
147
|
+
crossChainSupplyUSD: number;
|
|
148
|
+
crossChainBorrowUSD: number;
|
|
147
149
|
totalBalanceUSD: number;
|
|
148
150
|
totalBorrowsUSD: number;
|
|
149
151
|
totalSupplyUSD: number;
|