impermax-sdk 2.1.222 → 2.1.223
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.
|
@@ -58,6 +58,7 @@ export default abstract class OffchainLendingPool {
|
|
|
58
58
|
getAmm(): Promise<Amms | null>;
|
|
59
59
|
getFarm(): Promise<Farms | null>;
|
|
60
60
|
getKinkMultiplier(): 2 | 5;
|
|
61
|
+
getTotalAPR(): Promise<number>;
|
|
61
62
|
getTVL(): Promise<number>;
|
|
62
63
|
isDeprecated(): Promise<boolean>;
|
|
63
64
|
isBlacklisted(): Promise<boolean>;
|
|
@@ -121,6 +121,26 @@ class OffchainLendingPool {
|
|
|
121
121
|
return 5;
|
|
122
122
|
return 2;
|
|
123
123
|
}
|
|
124
|
+
async getTotalAPR() {
|
|
125
|
+
const uniswapV2Pair = (await this.getLendingPoolData()).pair
|
|
126
|
+
.uniswapV2PairAddress;
|
|
127
|
+
// If llama fails/apr is 0 we get the uniswapAPR and stakingAPR through subgraph
|
|
128
|
+
const apr = await this.offchain
|
|
129
|
+
.getAPRHelper()
|
|
130
|
+
.getLlamaAPR(uniswapV2Pair, this.offchain.network);
|
|
131
|
+
if (apr > 0)
|
|
132
|
+
return apr;
|
|
133
|
+
// Try shadow on Sonic network
|
|
134
|
+
if (this.offchain.network === types_1.Networks.Sonic) {
|
|
135
|
+
const shadowAPR = await this.offchain
|
|
136
|
+
.getAPRHelper()
|
|
137
|
+
.getShadowAPR(uniswapV2Pair, this.offchain.network);
|
|
138
|
+
if (shadowAPR > 0)
|
|
139
|
+
return shadowAPR;
|
|
140
|
+
}
|
|
141
|
+
// TODO -> fallback for lending pools not supported by defillama
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
124
144
|
async getTVL() {
|
|
125
145
|
const [supply0USD, supply1USD, lpUSD] = await Promise.all([
|
|
126
146
|
this.getBorrowableA().getTotalBalanceUSD(),
|