impermax-sdk 1.2.7 → 1.2.8
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.
|
@@ -86,12 +86,28 @@ class OffchainAccount {
|
|
|
86
86
|
}
|
|
87
87
|
getLendingVaultsSuppliedUSD() {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
|
|
89
|
+
let suppliedUSD = 0;
|
|
90
|
+
const lendingVaultUserData = yield this.getLendingVaultsUserData();
|
|
91
|
+
if (lendingVaultUserData === null)
|
|
92
|
+
return 0;
|
|
93
|
+
for (const address in lendingVaultUserData) {
|
|
94
|
+
const lendingVault = yield this.getLendingVault(address);
|
|
95
|
+
suppliedUSD += yield lendingVault.getValue();
|
|
96
|
+
}
|
|
97
|
+
return suppliedUSD;
|
|
90
98
|
});
|
|
91
99
|
}
|
|
92
100
|
getLendingVaultsEarningsUSD() {
|
|
93
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
|
|
102
|
+
let earningsUSD = 0;
|
|
103
|
+
const lendingVaultUserData = yield this.getLendingVaultsUserData();
|
|
104
|
+
if (lendingVaultUserData === null)
|
|
105
|
+
return 0;
|
|
106
|
+
for (const address in lendingVaultUserData) {
|
|
107
|
+
const lendingVault = yield this.getLendingVault(address);
|
|
108
|
+
earningsUSD += yield lendingVault.getEarningsUSD();
|
|
109
|
+
}
|
|
110
|
+
return earningsUSD;
|
|
95
111
|
});
|
|
96
112
|
}
|
|
97
113
|
}
|
|
@@ -9,6 +9,7 @@ export default class OffchainLendingVault extends OffchainPoolToken {
|
|
|
9
9
|
getOffchain: () => Offchain;
|
|
10
10
|
getVaultAddress: () => string;
|
|
11
11
|
getPoolTokenData(): Promise<PoolTokenData>;
|
|
12
|
+
private getTotalSupply;
|
|
12
13
|
private getLastUpdate;
|
|
13
14
|
private getAccrueFactor;
|
|
14
15
|
getCurrentExchangeRate(): Promise<number>;
|
|
@@ -27,6 +27,11 @@ class OffchainLendingVault extends offchainPoolToken_1.default {
|
|
|
27
27
|
return this.offchain.getLendingVaultData(this.vaultAddress);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
getTotalSupply() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return this.getPoolTokenParamFloat("totalSupply");
|
|
33
|
+
});
|
|
34
|
+
}
|
|
30
35
|
getLastUpdate() {
|
|
31
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
37
|
return this.getPoolTokenParamInt("lastUpdate");
|
|
@@ -50,9 +55,9 @@ class OffchainLendingVault extends offchainPoolToken_1.default {
|
|
|
50
55
|
// Vault Supply
|
|
51
56
|
getVaultSupply() {
|
|
52
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
return
|
|
58
|
+
const totalSupply = yield this.getTotalSupply();
|
|
59
|
+
const exchageRate = yield this.getCurrentExchangeRate();
|
|
60
|
+
return totalSupply * exchageRate;
|
|
56
61
|
});
|
|
57
62
|
}
|
|
58
63
|
getVaultSupplyUSD() {
|
package/lib/offchain/query.js
CHANGED