impermax-sdk 1.2.77 → 1.2.78
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.
|
@@ -11,7 +11,6 @@ export default class OffchainLendingPool {
|
|
|
11
11
|
private readonly factory;
|
|
12
12
|
private readonly pairAddress;
|
|
13
13
|
private readonly poolTokens;
|
|
14
|
-
private readonly llamaAPRChains;
|
|
15
14
|
constructor(offchain: Offchain, factory: Factory, pairAddress: Address);
|
|
16
15
|
getOffchain: () => Offchain;
|
|
17
16
|
getFactory: () => Factory;
|
|
@@ -21,13 +21,6 @@ const amms_1 = require("../../config/amms");
|
|
|
21
21
|
const factories_1 = require("../../config/factories");
|
|
22
22
|
class OffchainLendingPool {
|
|
23
23
|
constructor(offchain, factory, pairAddress) {
|
|
24
|
-
// NOTE: We try to get the defillama APRs on these chains only, add more if needed
|
|
25
|
-
this.llamaAPRChains = [
|
|
26
|
-
types_1.Networks.Fantom,
|
|
27
|
-
types_1.Networks.Optimism,
|
|
28
|
-
types_1.Networks.Scroll,
|
|
29
|
-
types_1.Networks.Base
|
|
30
|
-
];
|
|
31
24
|
this.getOffchain = () => this.offchain;
|
|
32
25
|
this.getFactory = () => this.factory;
|
|
33
26
|
this.getPairAddress = () => this.pairAddress;
|
|
@@ -225,12 +218,10 @@ class OffchainLendingPool {
|
|
|
225
218
|
getTotalAPR() {
|
|
226
219
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
220
|
const uniswapV2Pair = (yield this.getLendingPoolData()).pair.uniswapV2PairAddress;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return apr;
|
|
233
|
-
}
|
|
221
|
+
// If llama fails/apr is 0 we get the uniswapAPR and stakingAPR through subgraph
|
|
222
|
+
const apr = yield this.offchain.getAPRHelper().getLlamaAPR(uniswapV2Pair, this.offchain.network);
|
|
223
|
+
if (apr > 0)
|
|
224
|
+
return apr;
|
|
234
225
|
const [uniswapAPR, stakingAPR] = yield Promise.all([this.getUniswapAPR(), this.getStakingAPR()]);
|
|
235
226
|
return uniswapAPR + stakingAPR;
|
|
236
227
|
});
|