@defisaver/positions-sdk 2.0.15-dev.0 → 2.1.1-dev.0
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/cjs/aaveV2/index.js +9 -5
- package/cjs/aaveV3/index.d.ts +3 -0
- package/cjs/aaveV3/index.js +66 -47
- package/cjs/aaveV3/merit.d.ts +7 -0
- package/cjs/aaveV3/merit.js +95 -0
- package/cjs/aaveV3/merkl.d.ts +9 -0
- package/cjs/aaveV3/merkl.js +88 -0
- package/cjs/compoundV2/index.js +13 -7
- package/cjs/compoundV3/index.js +8 -3
- package/cjs/config/contracts.d.ts +6510 -1851
- package/cjs/config/contracts.js +33 -12
- package/cjs/contracts.d.ts +178 -0
- package/cjs/eulerV2/index.js +11 -2
- package/cjs/fluid/index.js +108 -34
- package/cjs/helpers/aaveHelpers/index.js +0 -1
- package/cjs/helpers/compoundHelpers/index.d.ts +5 -7
- package/cjs/helpers/compoundHelpers/index.js +31 -11
- package/cjs/helpers/eulerHelpers/index.d.ts +0 -5
- package/cjs/helpers/eulerHelpers/index.js +2 -31
- package/cjs/helpers/fluidHelpers/index.js +2 -0
- package/cjs/helpers/liquityV2Helpers/index.js +3 -2
- package/cjs/liquityV2/index.js +10 -2
- package/cjs/llamaLend/index.js +10 -2
- package/cjs/morphoBlue/index.js +20 -6
- package/cjs/spark/index.js +20 -30
- package/cjs/staking/eligibility.d.ts +19 -0
- package/cjs/staking/eligibility.js +67 -0
- package/cjs/staking/index.d.ts +1 -0
- package/cjs/staking/index.js +1 -0
- package/cjs/staking/staking.d.ts +1 -7
- package/cjs/staking/staking.js +29 -55
- package/cjs/types/aave.d.ts +3 -8
- package/cjs/types/common.d.ts +18 -4
- package/cjs/types/common.js +12 -1
- package/cjs/types/euler.d.ts +3 -3
- package/cjs/types/fluid.d.ts +3 -5
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +2 -0
- package/cjs/types/liquityV2.d.ts +3 -3
- package/cjs/types/llamaLend.d.ts +3 -1
- package/cjs/types/merit.d.ts +9 -0
- package/cjs/types/merit.js +2 -0
- package/cjs/types/merkl.d.ts +75 -0
- package/cjs/types/merkl.js +14 -0
- package/cjs/types/morphoBlue.d.ts +3 -5
- package/cjs/types/spark.d.ts +0 -3
- package/esm/aaveV2/index.js +9 -5
- package/esm/aaveV3/index.d.ts +3 -0
- package/esm/aaveV3/index.js +65 -47
- package/esm/aaveV3/merit.d.ts +7 -0
- package/esm/aaveV3/merit.js +90 -0
- package/esm/aaveV3/merkl.d.ts +9 -0
- package/esm/aaveV3/merkl.js +82 -0
- package/esm/compoundV2/index.js +13 -7
- package/esm/compoundV3/index.js +8 -3
- package/esm/config/contracts.d.ts +6510 -1851
- package/esm/config/contracts.js +33 -12
- package/esm/contracts.d.ts +178 -0
- package/esm/eulerV2/index.js +11 -2
- package/esm/fluid/index.js +109 -35
- package/esm/helpers/aaveHelpers/index.js +0 -1
- package/esm/helpers/compoundHelpers/index.d.ts +5 -7
- package/esm/helpers/compoundHelpers/index.js +34 -14
- package/esm/helpers/eulerHelpers/index.d.ts +0 -5
- package/esm/helpers/eulerHelpers/index.js +2 -30
- package/esm/helpers/fluidHelpers/index.js +2 -0
- package/esm/helpers/liquityV2Helpers/index.js +3 -2
- package/esm/liquityV2/index.js +11 -3
- package/esm/llamaLend/index.js +11 -3
- package/esm/morphoBlue/index.js +21 -7
- package/esm/spark/index.js +21 -31
- package/esm/staking/eligibility.d.ts +19 -0
- package/esm/staking/eligibility.js +58 -0
- package/esm/staking/index.d.ts +1 -0
- package/esm/staking/index.js +1 -0
- package/esm/staking/staking.d.ts +1 -7
- package/esm/staking/staking.js +28 -53
- package/esm/types/aave.d.ts +3 -8
- package/esm/types/common.d.ts +18 -4
- package/esm/types/common.js +11 -0
- package/esm/types/euler.d.ts +3 -3
- package/esm/types/fluid.d.ts +3 -5
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +2 -0
- package/esm/types/liquityV2.d.ts +3 -3
- package/esm/types/llamaLend.d.ts +3 -1
- package/esm/types/merit.d.ts +9 -0
- package/esm/types/merit.js +1 -0
- package/esm/types/merkl.d.ts +75 -0
- package/esm/types/merkl.js +11 -0
- package/esm/types/morphoBlue.d.ts +3 -5
- package/esm/types/spark.d.ts +0 -3
- package/package.json +1 -1
- package/src/aaveV2/index.ts +10 -7
- package/src/aaveV3/index.ts +77 -49
- package/src/aaveV3/merit.ts +94 -0
- package/src/aaveV3/merkl.ts +74 -0
- package/src/compoundV2/index.ts +13 -9
- package/src/compoundV3/index.ts +8 -4
- package/src/config/contracts.ts +34 -13
- package/src/eulerV2/index.ts +13 -3
- package/src/fluid/index.ts +107 -37
- package/src/helpers/aaveHelpers/index.ts +0 -1
- package/src/helpers/compoundHelpers/index.ts +41 -19
- package/src/helpers/eulerHelpers/index.ts +3 -40
- package/src/helpers/fluidHelpers/index.ts +2 -0
- package/src/helpers/liquityV2Helpers/index.ts +4 -2
- package/src/liquityV2/index.ts +13 -3
- package/src/llamaLend/index.ts +13 -4
- package/src/morphoBlue/index.ts +21 -7
- package/src/spark/index.ts +21 -33
- package/src/staking/eligibility.ts +61 -0
- package/src/staking/index.ts +2 -1
- package/src/staking/staking.ts +29 -54
- package/src/types/aave.ts +3 -8
- package/src/types/common.ts +21 -4
- package/src/types/euler.ts +3 -2
- package/src/types/fluid.ts +3 -5
- package/src/types/index.ts +3 -1
- package/src/types/liquityV2.ts +3 -3
- package/src/types/llamaLend.ts +3 -1
- package/src/types/merit.ts +2 -0
- package/src/types/merkl.ts +71 -0
- package/src/types/morphoBlue.ts +5 -5
- package/src/types/spark.ts +1 -3
package/cjs/fluid/index.js
CHANGED
|
@@ -212,6 +212,7 @@ const getTradingApy = (poolAddress) => __awaiter(void 0, void 0, void 0, functio
|
|
|
212
212
|
return new decimal_js_1.default(data.tradingApy).div(100).toString();
|
|
213
213
|
});
|
|
214
214
|
const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
215
|
+
var _a, _b;
|
|
215
216
|
const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
216
217
|
const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
217
218
|
const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
|
|
@@ -236,12 +237,17 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
236
237
|
canBeBorrowed: false,
|
|
237
238
|
supplyRate,
|
|
238
239
|
borrowRate: '0',
|
|
240
|
+
supplyIncentives: [],
|
|
241
|
+
borrowIncentives: [],
|
|
239
242
|
};
|
|
240
243
|
if (staking_1.STAKING_ASSETS.includes(collAsset.symbol)) {
|
|
241
|
-
collAssetData.
|
|
242
|
-
|
|
244
|
+
collAssetData.supplyIncentives.push({
|
|
245
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset.symbol),
|
|
246
|
+
token: collAssetData.symbol,
|
|
247
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
248
|
+
description: `Native ${collAssetData.symbol} yield.`,
|
|
249
|
+
});
|
|
243
250
|
}
|
|
244
|
-
const incentiveSupplyRate = collAssetData.incentiveSupplyApy;
|
|
245
251
|
const debtAssetData = {
|
|
246
252
|
symbol: debtAsset.symbol,
|
|
247
253
|
address: debtAsset.address,
|
|
@@ -252,12 +258,17 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
252
258
|
canBeBorrowed: true,
|
|
253
259
|
supplyRate: '0',
|
|
254
260
|
borrowRate,
|
|
261
|
+
supplyIncentives: [],
|
|
262
|
+
borrowIncentives: [],
|
|
255
263
|
};
|
|
256
264
|
if (staking_1.STAKING_ASSETS.includes(debtAssetData.symbol)) {
|
|
257
|
-
debtAssetData.
|
|
258
|
-
|
|
265
|
+
debtAssetData.borrowIncentives.push({
|
|
266
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset.symbol)).mul(-1).toString(),
|
|
267
|
+
token: debtAssetData.symbol,
|
|
268
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
269
|
+
description: `Due to the native yield of ${debtAssetData.symbol}, the value of the debt would increase over time.`,
|
|
270
|
+
});
|
|
259
271
|
}
|
|
260
|
-
const incentiveBorrowRate = debtAssetData.incentiveBorrowApy;
|
|
261
272
|
const assetsData = {
|
|
262
273
|
[collAsset.symbol]: collAssetData,
|
|
263
274
|
[debtAsset.symbol]: debtAssetData,
|
|
@@ -301,9 +312,9 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
301
312
|
liquidationMaxLimit,
|
|
302
313
|
borrowRate,
|
|
303
314
|
supplyRate,
|
|
304
|
-
incentiveSupplyRate,
|
|
305
|
-
incentiveBorrowRate,
|
|
306
315
|
oraclePrice,
|
|
316
|
+
incentiveSupplyRate: ((_a = collAssetData.supplyIncentives[0]) === null || _a === void 0 ? void 0 : _a.apy) || '0',
|
|
317
|
+
incentiveBorrowRate: ((_b = debtAssetData.borrowIncentives[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0',
|
|
307
318
|
};
|
|
308
319
|
return {
|
|
309
320
|
assetsData,
|
|
@@ -311,6 +322,7 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
311
322
|
};
|
|
312
323
|
});
|
|
313
324
|
const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
325
|
+
var _a, _b, _c;
|
|
314
326
|
const collAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
315
327
|
const collAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken1, network);
|
|
316
328
|
const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
@@ -337,10 +349,16 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
337
349
|
withdrawable: withdrawable0,
|
|
338
350
|
tokenPerSupplyShare: token0PerSupplyShare,
|
|
339
351
|
supplyReserves: reservesSupplyToken0,
|
|
352
|
+
supplyIncentives: [],
|
|
353
|
+
borrowIncentives: [],
|
|
340
354
|
};
|
|
341
355
|
if (staking_1.STAKING_ASSETS.includes(collFirstAssetData.symbol)) {
|
|
342
|
-
collFirstAssetData.
|
|
343
|
-
|
|
356
|
+
collFirstAssetData.supplyIncentives.push({
|
|
357
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset0.symbol),
|
|
358
|
+
token: collAsset0.symbol,
|
|
359
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
360
|
+
description: `Native ${collAsset0.symbol} yield.`,
|
|
361
|
+
});
|
|
344
362
|
}
|
|
345
363
|
const collSecondAssetData = {
|
|
346
364
|
symbol: collAsset1.symbol,
|
|
@@ -353,13 +371,19 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
353
371
|
utilization: utilizationSupply1,
|
|
354
372
|
tokenPerSupplyShare: token1PerSupplyShare,
|
|
355
373
|
supplyReserves: reservesSupplyToken1,
|
|
374
|
+
supplyIncentives: [],
|
|
375
|
+
borrowIncentives: [],
|
|
356
376
|
};
|
|
357
377
|
if (staking_1.STAKING_ASSETS.includes(collSecondAssetData.symbol)) {
|
|
358
|
-
collSecondAssetData.
|
|
359
|
-
|
|
378
|
+
collSecondAssetData.supplyIncentives.push({
|
|
379
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset1.symbol),
|
|
380
|
+
token: collAsset1.symbol,
|
|
381
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
382
|
+
description: `Native ${collAsset1.symbol} yield.`,
|
|
383
|
+
});
|
|
360
384
|
}
|
|
361
385
|
const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1, collFirstAssetData.price, collSecondAssetData.price);
|
|
362
|
-
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collFirstAssetData.
|
|
386
|
+
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, ((_a = collFirstAssetData.supplyIncentives[0]) === null || _a === void 0 ? void 0 : _a.apy) || '0', ((_b = collSecondAssetData.supplyIncentives[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0', collFirstAssetData.price, collSecondAssetData.price);
|
|
363
387
|
const tradingSupplyRate = yield getTradingApy(data.dexSupplyData.dexPool);
|
|
364
388
|
const borrowRate = new decimal_js_1.default(data.borrowRateVault).div(100).toString();
|
|
365
389
|
const debtAssetData = {
|
|
@@ -369,12 +393,18 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
369
393
|
totalBorrow: data.totalBorrowVault.toString(),
|
|
370
394
|
canBeBorrowed: true,
|
|
371
395
|
borrowRate,
|
|
396
|
+
supplyIncentives: [],
|
|
397
|
+
borrowIncentives: [],
|
|
372
398
|
};
|
|
373
399
|
if (staking_1.STAKING_ASSETS.includes(debtAssetData.symbol)) {
|
|
374
|
-
debtAssetData.
|
|
375
|
-
|
|
400
|
+
debtAssetData.borrowIncentives.push({
|
|
401
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset.symbol)).mul(-1).toString(),
|
|
402
|
+
token: debtAsset.symbol,
|
|
403
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
404
|
+
description: `Due to the native yield of ${debtAsset.symbol}, the value of the debt would increase over time.`,
|
|
405
|
+
});
|
|
376
406
|
}
|
|
377
|
-
const incentiveBorrowRate = debtAssetData.
|
|
407
|
+
const incentiveBorrowRate = new decimal_js_1.default(((_c = debtAssetData.borrowIncentives[0]) === null || _c === void 0 ? void 0 : _c.apy) || '0').mul(-1).toString();
|
|
378
408
|
const assetsData = [
|
|
379
409
|
[collAsset0.symbol, collFirstAssetData],
|
|
380
410
|
[collAsset1.symbol, collSecondAssetData],
|
|
@@ -445,6 +475,7 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
445
475
|
};
|
|
446
476
|
});
|
|
447
477
|
const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
478
|
+
var _a, _b, _c, _d;
|
|
448
479
|
const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
449
480
|
const debtAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
450
481
|
const debtAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken1, network);
|
|
@@ -468,12 +499,18 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
468
499
|
totalSupply: data.totalSupplyVault.toString(),
|
|
469
500
|
canBeSupplied: true,
|
|
470
501
|
supplyRate,
|
|
502
|
+
supplyIncentives: [],
|
|
503
|
+
borrowIncentives: [],
|
|
471
504
|
};
|
|
472
505
|
if (staking_1.STAKING_ASSETS.includes(collAssetData.symbol)) {
|
|
473
|
-
collAssetData.
|
|
474
|
-
|
|
506
|
+
collAssetData.supplyIncentives.push({
|
|
507
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset.symbol),
|
|
508
|
+
token: collAsset.symbol,
|
|
509
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
510
|
+
description: `Native ${collAsset.symbol} yield.`,
|
|
511
|
+
});
|
|
475
512
|
}
|
|
476
|
-
const incentiveSupplyRate = collAssetData.
|
|
513
|
+
const incentiveSupplyRate = ((_b = (_a = collAssetData.supplyIncentives) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0';
|
|
477
514
|
const debtAsset0Data = {
|
|
478
515
|
symbol: debtAsset0.symbol,
|
|
479
516
|
address: debtAsset0.address,
|
|
@@ -485,10 +522,16 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
485
522
|
utilization: utilizationBorrow0,
|
|
486
523
|
tokenPerBorrowShare: token0PerBorrowShare,
|
|
487
524
|
borrowReserves: reservesBorrowToken0,
|
|
525
|
+
supplyIncentives: [],
|
|
526
|
+
borrowIncentives: [],
|
|
488
527
|
};
|
|
489
528
|
if (staking_1.STAKING_ASSETS.includes(debtAsset0Data.symbol)) {
|
|
490
|
-
debtAsset0Data.
|
|
491
|
-
|
|
529
|
+
debtAsset0Data.borrowIncentives.push({
|
|
530
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset0.symbol)).mul(-1).toString(),
|
|
531
|
+
token: debtAsset0.symbol,
|
|
532
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
533
|
+
description: `Due to the native yield of ${debtAsset0.symbol}, the value of the debt would increase over time.`,
|
|
534
|
+
});
|
|
492
535
|
}
|
|
493
536
|
const debtAsset1Data = {
|
|
494
537
|
symbol: debtAsset1.symbol,
|
|
@@ -501,13 +544,19 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
501
544
|
utilization: utilizationBorrow1,
|
|
502
545
|
tokenPerBorrowShare: token1PerBorrowShare,
|
|
503
546
|
borrowReserves: reservesBorrowToken1,
|
|
547
|
+
supplyIncentives: [],
|
|
548
|
+
borrowIncentives: [],
|
|
504
549
|
};
|
|
505
550
|
if (staking_1.STAKING_ASSETS.includes(debtAsset1Data.symbol)) {
|
|
506
|
-
debtAsset1Data.
|
|
507
|
-
|
|
551
|
+
debtAsset1Data.borrowIncentives.push({
|
|
552
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset1.symbol)).mul(-1).toString(),
|
|
553
|
+
token: debtAsset1.symbol,
|
|
554
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
555
|
+
description: `Due to the native yield of ${debtAsset1.symbol}, the value of the debt would increase over time.`,
|
|
556
|
+
});
|
|
508
557
|
}
|
|
509
558
|
const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1, debtAsset0Data.price, debtAsset1Data.price);
|
|
510
|
-
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.
|
|
559
|
+
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, new decimal_js_1.default(((_c = debtAsset0Data.borrowIncentives[0]) === null || _c === void 0 ? void 0 : _c.apy) || '0').mul(-1).toString(), new decimal_js_1.default(((_d = debtAsset1Data.borrowIncentives[0]) === null || _d === void 0 ? void 0 : _d.apy) || '0').mul(-1).toString(), debtAsset0Data.price, debtAsset1Data.price);
|
|
511
560
|
const tradingBorrowRate = yield getTradingApy(data.dexBorrowData.dexPool);
|
|
512
561
|
const assetsData = [
|
|
513
562
|
[collAsset.symbol, collAssetData],
|
|
@@ -575,6 +624,7 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
575
624
|
};
|
|
576
625
|
});
|
|
577
626
|
const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
627
|
+
var _a, _b, _c, _d;
|
|
578
628
|
const collAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
579
629
|
const collAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken1, network);
|
|
580
630
|
const debtAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
@@ -604,10 +654,16 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
604
654
|
withdrawable: withdrawable0,
|
|
605
655
|
tokenPerSupplyShare: token0PerSupplyShare,
|
|
606
656
|
supplyReserves: reservesSupplyToken0,
|
|
657
|
+
supplyIncentives: [],
|
|
658
|
+
borrowIncentives: [],
|
|
607
659
|
};
|
|
608
660
|
if (staking_1.STAKING_ASSETS.includes(collAsset0Data.symbol)) {
|
|
609
|
-
collAsset0Data.
|
|
610
|
-
|
|
661
|
+
collAsset0Data.supplyIncentives.push({
|
|
662
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset0.symbol),
|
|
663
|
+
token: collAsset0.symbol,
|
|
664
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
665
|
+
description: `Native ${collAsset0.symbol} yield.`,
|
|
666
|
+
});
|
|
611
667
|
}
|
|
612
668
|
const collAsset1Data = {
|
|
613
669
|
symbol: collAsset1.symbol,
|
|
@@ -620,10 +676,16 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
620
676
|
utilization: utilizationSupply1,
|
|
621
677
|
tokenPerSupplyShare: token1PerSupplyShare,
|
|
622
678
|
supplyReserves: reservesSupplyToken1,
|
|
679
|
+
supplyIncentives: [],
|
|
680
|
+
borrowIncentives: [],
|
|
623
681
|
};
|
|
624
682
|
if (staking_1.STAKING_ASSETS.includes(collAsset1Data.symbol)) {
|
|
625
|
-
collAsset1Data.
|
|
626
|
-
|
|
683
|
+
collAsset1Data.supplyIncentives.push({
|
|
684
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset1.symbol),
|
|
685
|
+
token: collAsset1.symbol,
|
|
686
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
687
|
+
description: `Native ${collAsset1.symbol} yield.`,
|
|
688
|
+
});
|
|
627
689
|
}
|
|
628
690
|
const debtAsset0Data = {
|
|
629
691
|
symbol: debtAsset0.symbol,
|
|
@@ -636,10 +698,16 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
636
698
|
utilization: utilizationBorrow0,
|
|
637
699
|
tokenPerBorrowShare: token0PerBorrowShare,
|
|
638
700
|
borrowReserves: reservesBorrowToken0,
|
|
701
|
+
supplyIncentives: [],
|
|
702
|
+
borrowIncentives: [],
|
|
639
703
|
};
|
|
640
704
|
if (staking_1.STAKING_ASSETS.includes(debtAsset0Data.symbol)) {
|
|
641
|
-
debtAsset0Data.
|
|
642
|
-
|
|
705
|
+
debtAsset0Data.borrowIncentives.push({
|
|
706
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset0.symbol)).mul(-1).toString(),
|
|
707
|
+
token: debtAsset0.symbol,
|
|
708
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
709
|
+
description: `Due to the native yield of ${debtAsset0.symbol}, the value of the debt would increase over time.`,
|
|
710
|
+
});
|
|
643
711
|
}
|
|
644
712
|
const debtAsset1Data = {
|
|
645
713
|
symbol: debtAsset1.symbol,
|
|
@@ -652,17 +720,23 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
652
720
|
utilization: utilizationBorrow1,
|
|
653
721
|
tokenPerBorrowShare: token1PerBorrowShare,
|
|
654
722
|
borrowReserves: reservesBorrowToken1,
|
|
723
|
+
supplyIncentives: [],
|
|
724
|
+
borrowIncentives: [],
|
|
655
725
|
};
|
|
656
726
|
if (staking_1.STAKING_ASSETS.includes(debtAsset1Data.symbol)) {
|
|
657
|
-
debtAsset1Data.
|
|
658
|
-
|
|
727
|
+
debtAsset1Data.borrowIncentives.push({
|
|
728
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(debtAsset1.symbol)).mul(-1).toString(),
|
|
729
|
+
token: debtAsset1.symbol,
|
|
730
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
731
|
+
description: `Due to the native yield of ${debtAsset1.symbol}, the value of the debt would increase over time.`,
|
|
732
|
+
});
|
|
659
733
|
}
|
|
660
734
|
const marketInfo = (0, markets_1.getFluidMarketInfoById)(+(data.vaultId.toString()), network);
|
|
661
735
|
const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1, debtAsset0Data.price, debtAsset1Data.price);
|
|
662
|
-
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.
|
|
736
|
+
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, new decimal_js_1.default(((_a = debtAsset0Data.borrowIncentives[0]) === null || _a === void 0 ? void 0 : _a.apy) || '0').mul(-1).toString(), new decimal_js_1.default(((_b = debtAsset1Data.borrowIncentives[0]) === null || _b === void 0 ? void 0 : _b.apy) || '0').mul(-1).toString(), debtAsset0Data.price, debtAsset1Data.price);
|
|
663
737
|
const tradingBorrowRate = yield getTradingApy(data.dexBorrowData.dexPool);
|
|
664
738
|
const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1, collAsset0Data.price, collAsset1Data.price);
|
|
665
|
-
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collAsset0Data.
|
|
739
|
+
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, ((_c = collAsset0Data.supplyIncentives[0]) === null || _c === void 0 ? void 0 : _c.apy) || '0', ((_d = collAsset1Data.supplyIncentives[0]) === null || _d === void 0 ? void 0 : _d.apy) || '0', collAsset0Data.price, collAsset1Data.price);
|
|
666
740
|
const tradingSupplyRate = yield getTradingApy(data.dexSupplyData.dexPool);
|
|
667
741
|
const assetsData = [
|
|
668
742
|
[collAsset0.symbol, collAsset0Data],
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { BaseAdditionalAssetData, CompoundAggregatedPositionData, CompoundMarketData, CompoundV2AssetsData, CompoundV2UsedAssets, CompoundV3AssetData, CompoundV3AssetsData, CompoundV3UsedAssets } from '../../types';
|
|
2
|
-
import { EthAddress, EthereumProvider, NetworkNumber } from '../../types/common';
|
|
2
|
+
import { EthAddress, EthereumProvider, IncentiveData, NetworkNumber } from '../../types/common';
|
|
3
3
|
export declare const formatMarketData: (data: any, network: NetworkNumber, baseAssetPrice: string) => CompoundV3AssetData;
|
|
4
4
|
export declare const formatBaseData: (data: any, network: NetworkNumber, baseAssetPrice: string) => CompoundV3AssetData & BaseAdditionalAssetData;
|
|
5
|
-
export declare const getIncentiveApys: (baseData: CompoundV3AssetData & BaseAdditionalAssetData, compPrice: string) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
incentiveBorrowToken: string;
|
|
10
|
-
};
|
|
5
|
+
export declare const getIncentiveApys: (baseData: CompoundV3AssetData & BaseAdditionalAssetData, compPrice: string) => Promise<{
|
|
6
|
+
supplyIncentives: IncentiveData[];
|
|
7
|
+
borrowIncentives: IncentiveData[];
|
|
8
|
+
}>;
|
|
11
9
|
export declare const getCompoundV2AggregatedData: ({ usedAssets, assetsData, ...rest }: {
|
|
12
10
|
usedAssets: CompoundV2UsedAssets;
|
|
13
11
|
assetsData: CompoundV2AssetsData;
|
|
@@ -38,7 +38,7 @@ const formatMarketData = (data, network, baseAssetPrice) => {
|
|
|
38
38
|
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(data.tokenAddr, network);
|
|
39
39
|
const isWETH = assetInfo.symbol === 'WETH';
|
|
40
40
|
const price = (0, utils_1.getEthAmountForDecimals)(data.price, 8);
|
|
41
|
-
return (Object.assign(Object.assign({}, data), { borrowCollateralFactor: data.borrowCollateralFactor.toString(), liquidateCollateralFactor: data.liquidateCollateralFactor.toString(), liquidationFactor: data.liquidationFactor.toString(), supplyReserved: data.supplyReserved.toString(), priceInBaseAsset: (0, utils_1.getEthAmountForDecimals)(data.price, 8), price: new decimal_js_1.default(price).mul(baseAssetPrice).toString(), collateralFactor: (0, utils_1.getEthAmountForDecimals)(data.borrowCollateralFactor, 18), liquidationRatio: (0, utils_1.getEthAmountForDecimals)(data.liquidateCollateralFactor, 18), supplyCap: (0, utils_1.getEthAmountForDecimals)(data.supplyCap, assetInfo.decimals), totalSupply: (0, utils_1.getEthAmountForDecimals)(data.totalSupply, assetInfo.decimals), symbol: isWETH ? 'ETH' : assetInfo.symbol, supplyRate: '0', borrowRate: '0', canBeBorrowed: false, canBeSupplied: true }));
|
|
41
|
+
return (Object.assign(Object.assign({}, data), { borrowCollateralFactor: data.borrowCollateralFactor.toString(), liquidateCollateralFactor: data.liquidateCollateralFactor.toString(), liquidationFactor: data.liquidationFactor.toString(), supplyReserved: data.supplyReserved.toString(), priceInBaseAsset: (0, utils_1.getEthAmountForDecimals)(data.price, 8), price: new decimal_js_1.default(price).mul(baseAssetPrice).toString(), collateralFactor: (0, utils_1.getEthAmountForDecimals)(data.borrowCollateralFactor, 18), liquidationRatio: (0, utils_1.getEthAmountForDecimals)(data.liquidateCollateralFactor, 18), supplyCap: (0, utils_1.getEthAmountForDecimals)(data.supplyCap, assetInfo.decimals), totalSupply: (0, utils_1.getEthAmountForDecimals)(data.totalSupply, assetInfo.decimals), symbol: isWETH ? 'ETH' : assetInfo.symbol, supplyRate: '0', borrowRate: '0', canBeBorrowed: false, canBeSupplied: true, supplyIncentives: [], borrowIncentives: [] }));
|
|
42
42
|
};
|
|
43
43
|
exports.formatMarketData = formatMarketData;
|
|
44
44
|
// TODO: maybe not hardcode decimals
|
|
@@ -53,16 +53,36 @@ const formatBaseData = (data, network, baseAssetPrice) => {
|
|
|
53
53
|
totalBorrow, marketLiquidity: new decimal_js_1.default(totalSupply).minus(totalBorrow).toString(), symbol: (0, utils_1.wethToEth)(assetInfo.symbol), priceInBaseAsset: (0, utils_1.getEthAmountForDecimals)(data.price, 8), price: baseAssetPrice, collateralFactor: '0', liquidationRatio: '0', canBeBorrowed: true, canBeSupplied: true, supplyCap: '0', rewardSupplySpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingSupplyRewardsSpeed, 15), rewardBorrowSpeed: (0, utils_1.getEthAmountForDecimals)(data.baseTrackingBorrowRewardsSpeed, 15), minDebt: (0, utils_1.getEthAmountForDecimals)(data.baseBorrowMin, assetInfo.decimals), isBase: true }));
|
|
54
54
|
};
|
|
55
55
|
exports.formatBaseData = formatBaseData;
|
|
56
|
-
const getIncentiveApys = (baseData, compPrice) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
const getIncentiveApys = (baseData, compPrice) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
return ({
|
|
58
|
+
supplyIncentives: [{
|
|
59
|
+
token: 'COMP',
|
|
60
|
+
apy: (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.price / +baseData.totalSupply).toString(),
|
|
61
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
62
|
+
description: 'Eligible for protocol-level COMP incentives.',
|
|
63
|
+
},
|
|
64
|
+
...(0, utils_1.addToArrayIf)(staking_1.STAKING_ASSETS.includes(baseData.symbol), {
|
|
65
|
+
apy: yield (0, staking_1.getStakingApy)(baseData.symbol),
|
|
66
|
+
token: baseData.symbol,
|
|
67
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
68
|
+
description: `Native ${baseData.symbol} yield.`,
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
borrowIncentives: [{
|
|
72
|
+
token: 'COMP',
|
|
73
|
+
apy: (0, moneymarket_1.aprToApy)((100 * constants_1.SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.price / +baseData.totalBorrow).toString(),
|
|
74
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
75
|
+
description: 'Eligible for protocol-level COMP incentives.',
|
|
76
|
+
},
|
|
77
|
+
...(0, utils_1.addToArrayIf)(staking_1.STAKING_ASSETS.includes(baseData.symbol), {
|
|
78
|
+
apy: new decimal_js_1.default(yield (0, staking_1.getStakingApy)(baseData.symbol)).mul(-1).toString(),
|
|
79
|
+
token: baseData.symbol,
|
|
80
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
81
|
+
description: `Due to the native yield of ${baseData.symbol}, the value of the debt would increase over time.`,
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
});
|
|
66
86
|
exports.getIncentiveApys = getIncentiveApys;
|
|
67
87
|
const getCompoundV2AggregatedData = (_a) => {
|
|
68
88
|
var { usedAssets, assetsData } = _a, rest = __rest(_a, ["usedAssets", "assetsData"]);
|
|
@@ -5,11 +5,6 @@ export declare const isLeveragedPos: (usedAssets: EulerV2UsedAssets, dustLimit?:
|
|
|
5
5
|
leveragedAsset: string;
|
|
6
6
|
leveragedVault: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const calculateNetApy: (usedAssets: EulerV2UsedAssets, assetsData: EulerV2AssetsData) => {
|
|
9
|
-
netApy: string;
|
|
10
|
-
totalInterestUsd: string;
|
|
11
|
-
incentiveUsd: string;
|
|
12
|
-
};
|
|
13
8
|
export declare const getEulerV2AggregatedData: ({ usedAssets, assetsData, network, ...rest }: {
|
|
14
9
|
usedAssets: EulerV2UsedAssets;
|
|
15
10
|
assetsData: EulerV2AssetsData;
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getEulerV2SubAccounts = exports.getApyAfterValuesEstimationEulerV2 = exports.getEulerV2SupplyRate = exports.getUtilizationRate = exports.getEulerV2BorrowRate = exports.getEulerV2AggregatedData = exports.
|
|
26
|
+
exports.getEulerV2SubAccounts = exports.getApyAfterValuesEstimationEulerV2 = exports.getEulerV2SupplyRate = exports.getUtilizationRate = exports.getEulerV2BorrowRate = exports.getEulerV2AggregatedData = exports.isLeveragedPos = void 0;
|
|
27
27
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
28
28
|
const tokens_1 = require("@defisaver/tokens");
|
|
29
29
|
const moneymarket_1 = require("../../moneymarket");
|
|
@@ -89,35 +89,6 @@ const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
exports.isLeveragedPos = isLeveragedPos;
|
|
92
|
-
const calculateNetApy = (usedAssets, assetsData) => {
|
|
93
|
-
const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
|
|
94
|
-
const acc = Object.assign({}, _acc);
|
|
95
|
-
const assetData = assetsData[usedAsset.vaultAddress.toLowerCase()];
|
|
96
|
-
if (usedAsset.isSupplied) {
|
|
97
|
-
const amount = usedAsset.suppliedUsd;
|
|
98
|
-
acc.suppliedUsd = new decimal_js_1.default(acc.suppliedUsd).add(amount).toString();
|
|
99
|
-
const rate = assetData.supplyRate;
|
|
100
|
-
const supplyInterest = (0, staking_1.calculateInterestEarned)(amount, rate, 'year', true);
|
|
101
|
-
acc.supplyInterest = new decimal_js_1.default(acc.supplyInterest).add(supplyInterest.toString()).toString();
|
|
102
|
-
}
|
|
103
|
-
if (usedAsset.isBorrowed) {
|
|
104
|
-
const amount = usedAsset.borrowedUsd;
|
|
105
|
-
acc.borrowedUsd = new decimal_js_1.default(acc.borrowedUsd).add(amount).toString();
|
|
106
|
-
const rate = assetData.borrowRate;
|
|
107
|
-
const borrowInterest = (0, staking_1.calculateInterestEarned)(amount, rate, 'year', true);
|
|
108
|
-
acc.borrowInterest = new decimal_js_1.default(acc.borrowInterest).sub(borrowInterest.toString()).toString();
|
|
109
|
-
}
|
|
110
|
-
return acc;
|
|
111
|
-
}, {
|
|
112
|
-
borrowInterest: '0', supplyInterest: '0', incentiveUsd: '0', borrowedUsd: '0', suppliedUsd: '0',
|
|
113
|
-
});
|
|
114
|
-
const { borrowedUsd, suppliedUsd, borrowInterest, supplyInterest, incentiveUsd, } = sumValues;
|
|
115
|
-
const totalInterestUsd = new decimal_js_1.default(borrowInterest).add(supplyInterest).add(incentiveUsd).toString();
|
|
116
|
-
const balance = new decimal_js_1.default(suppliedUsd).sub(borrowedUsd);
|
|
117
|
-
const netApy = new decimal_js_1.default(totalInterestUsd).div(balance).times(100).toString();
|
|
118
|
-
return { netApy, totalInterestUsd, incentiveUsd };
|
|
119
|
-
};
|
|
120
|
-
exports.calculateNetApy = calculateNetApy;
|
|
121
92
|
const getEulerV2AggregatedData = (_a) => {
|
|
122
93
|
var { usedAssets, assetsData, network } = _a, rest = __rest(_a, ["usedAssets", "assetsData", "network"]);
|
|
123
94
|
const payload = {};
|
|
@@ -130,7 +101,7 @@ const getEulerV2AggregatedData = (_a) => {
|
|
|
130
101
|
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
131
102
|
payload.ratio = +payload.suppliedUsd ? new decimal_js_1.default(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
132
103
|
payload.collRatio = +payload.suppliedUsd ? new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
133
|
-
const { netApy, incentiveUsd, totalInterestUsd } = (0,
|
|
104
|
+
const { netApy, incentiveUsd, totalInterestUsd } = (0, staking_1.calculateNetApy)({ usedAssets, assetsData: assetsData });
|
|
134
105
|
payload.netApy = netApy;
|
|
135
106
|
payload.incentiveUsd = incentiveUsd;
|
|
136
107
|
payload.totalInterestUsd = totalInterestUsd;
|
|
@@ -183,6 +183,8 @@ const EMPTY_ASSET_DATA = {
|
|
|
183
183
|
canBeBorrowed: false,
|
|
184
184
|
supplyRate: '0',
|
|
185
185
|
borrowRate: '0',
|
|
186
|
+
supplyIncentives: [],
|
|
187
|
+
borrowIncentives: [],
|
|
186
188
|
};
|
|
187
189
|
const mergeAssetData = (existing = {}, additional) => (Object.assign(Object.assign(Object.assign({}, EMPTY_ASSET_DATA), existing), additional));
|
|
188
190
|
exports.mergeAssetData = mergeAssetData;
|
|
@@ -14,8 +14,9 @@ const calculateNetApyLiquityV2 = (usedAssets, assetsData, interestRate) => {
|
|
|
14
14
|
if (usedAsset.suppliedUsd) {
|
|
15
15
|
const amount = usedAsset.suppliedUsd;
|
|
16
16
|
acc.suppliedUsd = new decimal_js_1.default(acc.suppliedUsd).add(amount).toString();
|
|
17
|
-
|
|
18
|
-
const
|
|
17
|
+
for (const supplyIncentive of assetData.supplyIncentives) {
|
|
18
|
+
const { apy } = supplyIncentive;
|
|
19
|
+
const incentiveInterest = (0, staking_1.calculateInterestEarned)(amount, apy, 'year', true);
|
|
19
20
|
acc.incentiveUsd = new decimal_js_1.default(acc.incentiveUsd).add(incentiveInterest).toString();
|
|
20
21
|
}
|
|
21
22
|
}
|
package/cjs/liquityV2/index.js
CHANGED
|
@@ -64,6 +64,8 @@ const _getLiquityV2MarketData = (provider, network, selectedMarket) => __awaiter
|
|
|
64
64
|
canBeBorrowed: true,
|
|
65
65
|
leftToBorrowGlobal,
|
|
66
66
|
leftToWithdrawGlobal: '0',
|
|
67
|
+
supplyIncentives: [],
|
|
68
|
+
borrowIncentives: [],
|
|
67
69
|
};
|
|
68
70
|
assetsData[collateralToken] = {
|
|
69
71
|
symbol: collateralToken,
|
|
@@ -75,10 +77,16 @@ const _getLiquityV2MarketData = (provider, network, selectedMarket) => __awaiter
|
|
|
75
77
|
canBeBorrowed: false,
|
|
76
78
|
leftToBorrowGlobal: '0',
|
|
77
79
|
leftToWithdrawGlobal,
|
|
80
|
+
supplyIncentives: [],
|
|
81
|
+
borrowIncentives: [],
|
|
78
82
|
};
|
|
79
83
|
if (staking_1.STAKING_ASSETS.includes(collateralToken)) {
|
|
80
|
-
assetsData[collateralToken].
|
|
81
|
-
|
|
84
|
+
assetsData[collateralToken].supplyIncentives.push({
|
|
85
|
+
apy: yield (0, staking_1.getStakingApy)(collateralToken),
|
|
86
|
+
token: collateralToken,
|
|
87
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
88
|
+
description: `Native ${collateralToken} yield.`,
|
|
89
|
+
});
|
|
82
90
|
}
|
|
83
91
|
return {
|
|
84
92
|
assetsData,
|
package/cjs/llamaLend/index.js
CHANGED
|
@@ -95,6 +95,8 @@ const _getLlamaLendGlobalData = (provider, network, selectedMarket) => __awaiter
|
|
|
95
95
|
borrowRate,
|
|
96
96
|
canBeSupplied: true,
|
|
97
97
|
canBeBorrowed: true,
|
|
98
|
+
supplyIncentives: [],
|
|
99
|
+
borrowIncentives: [],
|
|
98
100
|
};
|
|
99
101
|
assetsData[collAsset] = {
|
|
100
102
|
symbol: collAsset,
|
|
@@ -104,10 +106,16 @@ const _getLlamaLendGlobalData = (provider, network, selectedMarket) => __awaiter
|
|
|
104
106
|
borrowRate: '0',
|
|
105
107
|
canBeSupplied: true,
|
|
106
108
|
canBeBorrowed: false,
|
|
109
|
+
supplyIncentives: [],
|
|
110
|
+
borrowIncentives: [],
|
|
107
111
|
};
|
|
108
112
|
if (staking_1.STAKING_ASSETS.includes(collAsset)) {
|
|
109
|
-
assetsData[collAsset].
|
|
110
|
-
|
|
113
|
+
assetsData[collAsset].supplyIncentives.push({
|
|
114
|
+
apy: yield (0, staking_1.getStakingApy)(collAsset),
|
|
115
|
+
token: collAsset,
|
|
116
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
117
|
+
description: `Native ${collAsset} yield.`,
|
|
118
|
+
});
|
|
111
119
|
}
|
|
112
120
|
return {
|
|
113
121
|
A: data.A.toString(),
|
package/cjs/morphoBlue/index.js
CHANGED
|
@@ -87,10 +87,18 @@ function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
87
87
|
totalBorrow: new decimal_js_1.default(marketInfo.totalBorrowAssets.toString()).div(scale).toString(),
|
|
88
88
|
canBeSupplied: true,
|
|
89
89
|
canBeBorrowed: true,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
supplyIncentives: [{
|
|
91
|
+
token: 'MORPHO',
|
|
92
|
+
apy: morphoSupplyApy,
|
|
93
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
94
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
95
|
+
}],
|
|
96
|
+
borrowIncentives: [{
|
|
97
|
+
token: 'MORPHO',
|
|
98
|
+
apy: morphoBorrowApy,
|
|
99
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
100
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
101
|
+
}],
|
|
94
102
|
};
|
|
95
103
|
assetsData[(0, utils_1.wethToEth)(collateralTokenInfo.symbol)] = {
|
|
96
104
|
symbol: (0, utils_1.wethToEth)(collateralTokenInfo.symbol),
|
|
@@ -100,10 +108,16 @@ function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
100
108
|
borrowRate: '0',
|
|
101
109
|
canBeSupplied: true,
|
|
102
110
|
canBeBorrowed: false,
|
|
111
|
+
supplyIncentives: [],
|
|
112
|
+
borrowIncentives: [],
|
|
103
113
|
};
|
|
104
114
|
if (staking_1.STAKING_ASSETS.includes(collateralTokenInfo.symbol)) {
|
|
105
|
-
assetsData[collateralTokenInfo.symbol].
|
|
106
|
-
|
|
115
|
+
assetsData[collateralTokenInfo.symbol].supplyIncentives = [{
|
|
116
|
+
apy: yield (0, staking_1.getStakingApy)(collateralTokenInfo.symbol),
|
|
117
|
+
token: collateralTokenInfo.symbol,
|
|
118
|
+
incentiveKind: common_1.IncentiveKind.Staking,
|
|
119
|
+
description: `Native ${collateralTokenInfo.symbol} yield.`,
|
|
120
|
+
}];
|
|
107
121
|
}
|
|
108
122
|
return {
|
|
109
123
|
id: marketInfo.id,
|