@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/src/eulerV2/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
3
3
|
import { Client } from 'viem';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
EthAddress, EthereumProvider, IncentiveKind, NetworkNumber,
|
|
6
|
+
} from '../types/common';
|
|
5
7
|
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
6
8
|
import {
|
|
7
9
|
compareAddresses, getEthAmountForDecimals, isMaxuint, wethToEth, wethToEthByAddress,
|
|
@@ -87,12 +89,18 @@ export const _getEulerV2MarketsData = async (provider: Client, network: NetworkN
|
|
|
87
89
|
supplyRate,
|
|
88
90
|
utilization: new Dec(utilizationRate).mul(100).toString(),
|
|
89
91
|
governorAdmin: collateral.governorAdmin,
|
|
92
|
+
supplyIncentives: [],
|
|
93
|
+
borrowIncentives: [],
|
|
90
94
|
});
|
|
91
95
|
});
|
|
92
96
|
for (const coll of colls) {
|
|
93
97
|
if (STAKING_ASSETS.includes(coll.symbol)) {
|
|
94
|
-
coll.
|
|
95
|
-
|
|
98
|
+
coll.supplyIncentives.push({
|
|
99
|
+
apy: await getStakingApy(coll.symbol),
|
|
100
|
+
token: coll.symbol,
|
|
101
|
+
incentiveKind: IncentiveKind.Staking,
|
|
102
|
+
description: `Native ${coll.symbol} yield.`,
|
|
103
|
+
});
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
const isEscrow = data.collaterals.length === 0;
|
|
@@ -134,6 +142,8 @@ export const _getEulerV2MarketsData = async (provider: Client, network: NetworkN
|
|
|
134
142
|
governorAdmin: data.governorAdmin,
|
|
135
143
|
vaultType,
|
|
136
144
|
name: data.name,
|
|
145
|
+
supplyIncentives: [],
|
|
146
|
+
borrowIncentives: [],
|
|
137
147
|
};
|
|
138
148
|
|
|
139
149
|
const assetsData: EulerV2AssetsData = {
|
package/src/fluid/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
AssetData, getAssetInfo, getAssetInfoByAddress,
|
|
5
5
|
} from '@defisaver/tokens';
|
|
6
6
|
import { Client, PublicClient } from 'viem';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
EthAddress, EthereumProvider, IncentiveKind, NetworkNumber,
|
|
9
|
+
} from '../types/common';
|
|
8
10
|
import {
|
|
9
11
|
FluidAggregatedVaultData,
|
|
10
12
|
FluidAssetData, FluidAssetsData,
|
|
@@ -298,15 +300,19 @@ const parseT1MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
298
300
|
canBeBorrowed: false,
|
|
299
301
|
supplyRate,
|
|
300
302
|
borrowRate: '0',
|
|
303
|
+
supplyIncentives: [],
|
|
304
|
+
borrowIncentives: [],
|
|
301
305
|
};
|
|
302
306
|
|
|
303
307
|
if (STAKING_ASSETS.includes(collAsset.symbol)) {
|
|
304
|
-
collAssetData.
|
|
305
|
-
|
|
308
|
+
collAssetData.supplyIncentives.push({
|
|
309
|
+
apy: await getStakingApy(collAsset.symbol),
|
|
310
|
+
token: collAssetData.symbol,
|
|
311
|
+
incentiveKind: IncentiveKind.Staking,
|
|
312
|
+
description: `Native ${collAssetData.symbol} yield.`,
|
|
313
|
+
});
|
|
306
314
|
}
|
|
307
315
|
|
|
308
|
-
const incentiveSupplyRate = collAssetData.incentiveSupplyApy;
|
|
309
|
-
|
|
310
316
|
const debtAssetData: FluidAssetData = {
|
|
311
317
|
symbol: debtAsset.symbol,
|
|
312
318
|
address: debtAsset.address,
|
|
@@ -317,14 +323,18 @@ const parseT1MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
317
323
|
canBeBorrowed: true,
|
|
318
324
|
supplyRate: '0',
|
|
319
325
|
borrowRate,
|
|
326
|
+
supplyIncentives: [],
|
|
327
|
+
borrowIncentives: [],
|
|
320
328
|
};
|
|
321
329
|
if (STAKING_ASSETS.includes(debtAssetData.symbol)) {
|
|
322
|
-
debtAssetData.
|
|
323
|
-
|
|
330
|
+
debtAssetData.borrowIncentives.push({
|
|
331
|
+
apy: new Dec(await getStakingApy(debtAsset.symbol)).mul(-1).toString(),
|
|
332
|
+
token: debtAssetData.symbol,
|
|
333
|
+
incentiveKind: IncentiveKind.Reward,
|
|
334
|
+
description: `Due to the native yield of ${debtAssetData.symbol}, the value of the debt would increase over time.`,
|
|
335
|
+
});
|
|
324
336
|
}
|
|
325
337
|
|
|
326
|
-
const incentiveBorrowRate = debtAssetData.incentiveBorrowApy;
|
|
327
|
-
|
|
328
338
|
const assetsData = {
|
|
329
339
|
[collAsset.symbol]: collAssetData,
|
|
330
340
|
[debtAsset.symbol]: debtAssetData,
|
|
@@ -370,9 +380,9 @@ const parseT1MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
370
380
|
liquidationMaxLimit,
|
|
371
381
|
borrowRate,
|
|
372
382
|
supplyRate,
|
|
373
|
-
incentiveSupplyRate,
|
|
374
|
-
incentiveBorrowRate,
|
|
375
383
|
oraclePrice,
|
|
384
|
+
incentiveSupplyRate: collAssetData.supplyIncentives[0]?.apy || '0',
|
|
385
|
+
incentiveBorrowRate: debtAssetData.borrowIncentives[0]?.apy || '0',
|
|
376
386
|
};
|
|
377
387
|
|
|
378
388
|
return {
|
|
@@ -430,10 +440,16 @@ const parseT2MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
430
440
|
withdrawable: withdrawable0,
|
|
431
441
|
tokenPerSupplyShare: token0PerSupplyShare,
|
|
432
442
|
supplyReserves: reservesSupplyToken0,
|
|
443
|
+
supplyIncentives: [],
|
|
444
|
+
borrowIncentives: [],
|
|
433
445
|
};
|
|
434
446
|
if (STAKING_ASSETS.includes(collFirstAssetData.symbol!)) {
|
|
435
|
-
collFirstAssetData.
|
|
436
|
-
|
|
447
|
+
collFirstAssetData.supplyIncentives!.push({
|
|
448
|
+
apy: await getStakingApy(collAsset0.symbol),
|
|
449
|
+
token: collAsset0.symbol,
|
|
450
|
+
incentiveKind: IncentiveKind.Staking,
|
|
451
|
+
description: `Native ${collAsset0.symbol} yield.`,
|
|
452
|
+
});
|
|
437
453
|
}
|
|
438
454
|
|
|
439
455
|
const collSecondAssetData: Partial<FluidAssetData> = {
|
|
@@ -447,14 +463,20 @@ const parseT2MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
447
463
|
utilization: utilizationSupply1,
|
|
448
464
|
tokenPerSupplyShare: token1PerSupplyShare,
|
|
449
465
|
supplyReserves: reservesSupplyToken1,
|
|
466
|
+
supplyIncentives: [],
|
|
467
|
+
borrowIncentives: [],
|
|
450
468
|
};
|
|
451
469
|
if (STAKING_ASSETS.includes(collSecondAssetData.symbol!)) {
|
|
452
|
-
collSecondAssetData.
|
|
453
|
-
|
|
470
|
+
collSecondAssetData.supplyIncentives!.push({
|
|
471
|
+
apy: await getStakingApy(collAsset1.symbol),
|
|
472
|
+
token: collAsset1.symbol,
|
|
473
|
+
incentiveKind: IncentiveKind.Staking,
|
|
474
|
+
description: `Native ${collAsset1.symbol} yield.`,
|
|
475
|
+
});
|
|
454
476
|
}
|
|
455
477
|
|
|
456
478
|
const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1, collFirstAssetData.price!, collSecondAssetData.price!);
|
|
457
|
-
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collFirstAssetData.
|
|
479
|
+
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collFirstAssetData.supplyIncentives![0]?.apy || '0', collSecondAssetData.supplyIncentives![0]?.apy || '0', collFirstAssetData.price!, collSecondAssetData.price!);
|
|
458
480
|
const tradingSupplyRate = await getTradingApy(data.dexSupplyData.dexPool as EthAddress);
|
|
459
481
|
|
|
460
482
|
const borrowRate = new Dec(data.borrowRateVault).div(100).toString();
|
|
@@ -465,13 +487,19 @@ const parseT2MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
465
487
|
totalBorrow: data.totalBorrowVault.toString(),
|
|
466
488
|
canBeBorrowed: true,
|
|
467
489
|
borrowRate,
|
|
490
|
+
supplyIncentives: [],
|
|
491
|
+
borrowIncentives: [],
|
|
468
492
|
};
|
|
469
493
|
if (STAKING_ASSETS.includes(debtAssetData.symbol!)) {
|
|
470
|
-
debtAssetData.
|
|
471
|
-
|
|
494
|
+
debtAssetData.borrowIncentives!.push({
|
|
495
|
+
apy: new Dec(await getStakingApy(debtAsset.symbol)).mul(-1).toString(),
|
|
496
|
+
token: debtAsset.symbol,
|
|
497
|
+
incentiveKind: IncentiveKind.Reward,
|
|
498
|
+
description: `Due to the native yield of ${debtAsset.symbol}, the value of the debt would increase over time.`,
|
|
499
|
+
});
|
|
472
500
|
}
|
|
473
501
|
|
|
474
|
-
const incentiveBorrowRate = debtAssetData.
|
|
502
|
+
const incentiveBorrowRate = new Dec(debtAssetData.borrowIncentives![0]?.apy || '0').mul(-1).toString();
|
|
475
503
|
|
|
476
504
|
const assetsData: FluidAssetsData = ([
|
|
477
505
|
[collAsset0.symbol, collFirstAssetData],
|
|
@@ -599,13 +627,19 @@ const parseT3MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
599
627
|
totalSupply: data.totalSupplyVault.toString(),
|
|
600
628
|
canBeSupplied: true,
|
|
601
629
|
supplyRate,
|
|
630
|
+
supplyIncentives: [],
|
|
631
|
+
borrowIncentives: [],
|
|
602
632
|
};
|
|
603
633
|
if (STAKING_ASSETS.includes(collAssetData.symbol!)) {
|
|
604
|
-
collAssetData.
|
|
605
|
-
|
|
634
|
+
collAssetData.supplyIncentives!.push({
|
|
635
|
+
apy: await getStakingApy(collAsset.symbol),
|
|
636
|
+
token: collAsset.symbol,
|
|
637
|
+
incentiveKind: IncentiveKind.Staking,
|
|
638
|
+
description: `Native ${collAsset.symbol} yield.`,
|
|
639
|
+
});
|
|
606
640
|
}
|
|
607
641
|
|
|
608
|
-
const incentiveSupplyRate = collAssetData.
|
|
642
|
+
const incentiveSupplyRate = collAssetData.supplyIncentives?.[0]?.apy || '0';
|
|
609
643
|
|
|
610
644
|
const debtAsset0Data: Partial<FluidAssetData> = {
|
|
611
645
|
symbol: debtAsset0.symbol,
|
|
@@ -618,10 +652,16 @@ const parseT3MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
618
652
|
utilization: utilizationBorrow0,
|
|
619
653
|
tokenPerBorrowShare: token0PerBorrowShare,
|
|
620
654
|
borrowReserves: reservesBorrowToken0,
|
|
655
|
+
supplyIncentives: [],
|
|
656
|
+
borrowIncentives: [],
|
|
621
657
|
};
|
|
622
658
|
if (STAKING_ASSETS.includes(debtAsset0Data.symbol!)) {
|
|
623
|
-
debtAsset0Data.
|
|
624
|
-
|
|
659
|
+
debtAsset0Data.borrowIncentives!.push({
|
|
660
|
+
apy: new Dec(await getStakingApy(debtAsset0.symbol)).mul(-1).toString(),
|
|
661
|
+
token: debtAsset0.symbol,
|
|
662
|
+
incentiveKind: IncentiveKind.Reward,
|
|
663
|
+
description: `Due to the native yield of ${debtAsset0.symbol}, the value of the debt would increase over time.`,
|
|
664
|
+
});
|
|
625
665
|
}
|
|
626
666
|
|
|
627
667
|
const debtAsset1Data: Partial<FluidAssetData> = {
|
|
@@ -635,13 +675,19 @@ const parseT3MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
635
675
|
utilization: utilizationBorrow1,
|
|
636
676
|
tokenPerBorrowShare: token1PerBorrowShare,
|
|
637
677
|
borrowReserves: reservesBorrowToken1,
|
|
678
|
+
supplyIncentives: [],
|
|
679
|
+
borrowIncentives: [],
|
|
638
680
|
};
|
|
639
681
|
if (STAKING_ASSETS.includes(debtAsset1Data.symbol!)) {
|
|
640
|
-
debtAsset1Data.
|
|
641
|
-
|
|
682
|
+
debtAsset1Data.borrowIncentives!.push({
|
|
683
|
+
apy: new Dec(await getStakingApy(debtAsset1.symbol)).mul(-1).toString(),
|
|
684
|
+
token: debtAsset1.symbol,
|
|
685
|
+
incentiveKind: IncentiveKind.Reward,
|
|
686
|
+
description: `Due to the native yield of ${debtAsset1.symbol}, the value of the debt would increase over time.`,
|
|
687
|
+
});
|
|
642
688
|
}
|
|
643
689
|
const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1, debtAsset0Data.price!, debtAsset1Data.price!);
|
|
644
|
-
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.
|
|
690
|
+
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, new Dec(debtAsset0Data.borrowIncentives![0]?.apy || '0').mul(-1).toString(), new Dec(debtAsset1Data.borrowIncentives![0]?.apy || '0').mul(-1).toString(), debtAsset0Data.price!, debtAsset1Data.price!);
|
|
645
691
|
const tradingBorrowRate = await getTradingApy(data.dexBorrowData.dexPool as EthAddress);
|
|
646
692
|
|
|
647
693
|
const assetsData: FluidAssetsData = ([
|
|
@@ -797,10 +843,16 @@ const parseT4MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
797
843
|
withdrawable: withdrawable0,
|
|
798
844
|
tokenPerSupplyShare: token0PerSupplyShare,
|
|
799
845
|
supplyReserves: reservesSupplyToken0,
|
|
846
|
+
supplyIncentives: [],
|
|
847
|
+
borrowIncentives: [],
|
|
800
848
|
};
|
|
801
849
|
if (STAKING_ASSETS.includes(collAsset0Data.symbol!)) {
|
|
802
|
-
collAsset0Data.
|
|
803
|
-
|
|
850
|
+
collAsset0Data.supplyIncentives!.push({
|
|
851
|
+
apy: await getStakingApy(collAsset0.symbol),
|
|
852
|
+
token: collAsset0.symbol,
|
|
853
|
+
incentiveKind: IncentiveKind.Staking,
|
|
854
|
+
description: `Native ${collAsset0.symbol} yield.`,
|
|
855
|
+
});
|
|
804
856
|
}
|
|
805
857
|
|
|
806
858
|
const collAsset1Data: Partial<FluidAssetData> = {
|
|
@@ -814,10 +866,16 @@ const parseT4MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
814
866
|
utilization: utilizationSupply1,
|
|
815
867
|
tokenPerSupplyShare: token1PerSupplyShare,
|
|
816
868
|
supplyReserves: reservesSupplyToken1,
|
|
869
|
+
supplyIncentives: [],
|
|
870
|
+
borrowIncentives: [],
|
|
817
871
|
};
|
|
818
872
|
if (STAKING_ASSETS.includes(collAsset1Data.symbol!)) {
|
|
819
|
-
collAsset1Data.
|
|
820
|
-
|
|
873
|
+
collAsset1Data.supplyIncentives!.push({
|
|
874
|
+
apy: await getStakingApy(collAsset1.symbol),
|
|
875
|
+
token: collAsset1.symbol,
|
|
876
|
+
incentiveKind: IncentiveKind.Staking,
|
|
877
|
+
description: `Native ${collAsset1.symbol} yield.`,
|
|
878
|
+
});
|
|
821
879
|
}
|
|
822
880
|
|
|
823
881
|
const debtAsset0Data: Partial<FluidAssetData> = {
|
|
@@ -831,10 +889,16 @@ const parseT4MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
831
889
|
utilization: utilizationBorrow0,
|
|
832
890
|
tokenPerBorrowShare: token0PerBorrowShare,
|
|
833
891
|
borrowReserves: reservesBorrowToken0,
|
|
892
|
+
supplyIncentives: [],
|
|
893
|
+
borrowIncentives: [],
|
|
834
894
|
};
|
|
835
895
|
if (STAKING_ASSETS.includes(debtAsset0Data.symbol!)) {
|
|
836
|
-
debtAsset0Data.
|
|
837
|
-
|
|
896
|
+
debtAsset0Data.borrowIncentives!.push({
|
|
897
|
+
apy: new Dec(await getStakingApy(debtAsset0.symbol)).mul(-1).toString(),
|
|
898
|
+
token: debtAsset0.symbol,
|
|
899
|
+
incentiveKind: IncentiveKind.Reward,
|
|
900
|
+
description: `Due to the native yield of ${debtAsset0.symbol}, the value of the debt would increase over time.`,
|
|
901
|
+
});
|
|
838
902
|
}
|
|
839
903
|
|
|
840
904
|
const debtAsset1Data: Partial<FluidAssetData> = {
|
|
@@ -848,19 +912,25 @@ const parseT4MarketData = async (provider: PublicClient, data: FluidVaultDataStr
|
|
|
848
912
|
utilization: utilizationBorrow1,
|
|
849
913
|
tokenPerBorrowShare: token1PerBorrowShare,
|
|
850
914
|
borrowReserves: reservesBorrowToken1,
|
|
915
|
+
supplyIncentives: [],
|
|
916
|
+
borrowIncentives: [],
|
|
851
917
|
};
|
|
852
918
|
if (STAKING_ASSETS.includes(debtAsset1Data.symbol!)) {
|
|
853
|
-
debtAsset1Data.
|
|
854
|
-
|
|
919
|
+
debtAsset1Data.borrowIncentives!.push({
|
|
920
|
+
apy: new Dec(await getStakingApy(debtAsset1.symbol)).mul(-1).toString(),
|
|
921
|
+
token: debtAsset1.symbol,
|
|
922
|
+
incentiveKind: IncentiveKind.Reward,
|
|
923
|
+
description: `Due to the native yield of ${debtAsset1.symbol}, the value of the debt would increase over time.`,
|
|
924
|
+
});
|
|
855
925
|
}
|
|
856
926
|
const marketInfo = getFluidMarketInfoById(+(data.vaultId.toString()), network);
|
|
857
927
|
|
|
858
928
|
const marketBorrowRate = getMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, borrowRate0, borrowRate1, debtAsset0Data.price!, debtAsset1Data.price!);
|
|
859
|
-
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, debtAsset0Data.
|
|
929
|
+
const incentiveBorrowRate = getAdditionalMarketRateForDex(token1PerBorrowShare, token0PerBorrowShare, new Dec(debtAsset0Data.borrowIncentives![0]?.apy || '0').mul(-1).toString(), new Dec(debtAsset1Data.borrowIncentives![0]?.apy || '0').mul(-1).toString(), debtAsset0Data.price!, debtAsset1Data.price!);
|
|
860
930
|
const tradingBorrowRate = await getTradingApy(data.dexBorrowData.dexPool as EthAddress);
|
|
861
931
|
|
|
862
932
|
const marketSupplyRate = getMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, supplyRate0, supplyRate1, collAsset0Data.price!, collAsset1Data.price!);
|
|
863
|
-
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collAsset0Data.
|
|
933
|
+
const incentiveSupplyRate = getAdditionalMarketRateForDex(token1PerSupplyShare, token0PerSupplyShare, collAsset0Data.supplyIncentives![0]?.apy || '0', collAsset1Data.supplyIncentives![0]?.apy || '0', collAsset0Data.price!, collAsset1Data.price!);
|
|
864
934
|
const tradingSupplyRate = await getTradingApy(data.dexSupplyData.dexPool as EthAddress);
|
|
865
935
|
|
|
866
936
|
const assetsData: FluidAssetsData = ([
|
|
@@ -3,13 +3,17 @@ import { assetAmountInWei, getAssetInfo, getAssetInfoByAddress } from '@defisave
|
|
|
3
3
|
import {
|
|
4
4
|
BaseAdditionalAssetData, CompoundAggregatedPositionData, CompoundMarketData, CompoundV2AssetsData, CompoundV2UsedAssets, CompoundV3AssetData, CompoundV3AssetsData, CompoundV3UsedAssets, CompoundVersions,
|
|
5
5
|
} from '../../types';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
addToArrayIf, getEthAmountForDecimals, handleWbtcLegacy, wethToEth,
|
|
8
|
+
} from '../../services/utils';
|
|
7
9
|
import { BLOCKS_IN_A_YEAR, borrowOperations, SECONDS_PER_YEAR } from '../../constants';
|
|
8
10
|
import {
|
|
9
11
|
aprToApy, calcLeverageLiqPrice, calculateBorrowingAssetLimit, getAssetsTotal, isLeveragedPos,
|
|
10
12
|
} from '../../moneymarket';
|
|
11
|
-
import { calculateNetApy } from '../../staking';
|
|
12
|
-
import {
|
|
13
|
+
import { calculateNetApy, getStakingApy, STAKING_ASSETS } from '../../staking';
|
|
14
|
+
import {
|
|
15
|
+
EthAddress, EthereumProvider, IncentiveData, IncentiveKind, NetworkNumber,
|
|
16
|
+
} from '../../types/common';
|
|
13
17
|
import { CompoundLoanInfoContractViem, CompV3ViewContractViem } from '../../contracts';
|
|
14
18
|
import { getViemProvider } from '../../services/viem';
|
|
15
19
|
|
|
@@ -34,6 +38,8 @@ export const formatMarketData = (data: any, network: NetworkNumber, baseAssetPri
|
|
|
34
38
|
borrowRate: '0',
|
|
35
39
|
canBeBorrowed: false,
|
|
36
40
|
canBeSupplied: true,
|
|
41
|
+
supplyIncentives: [],
|
|
42
|
+
borrowIncentives: [],
|
|
37
43
|
});
|
|
38
44
|
};
|
|
39
45
|
|
|
@@ -74,24 +80,40 @@ export const formatBaseData = (data: any, network: NetworkNumber, baseAssetPrice
|
|
|
74
80
|
});
|
|
75
81
|
};
|
|
76
82
|
|
|
77
|
-
export const getIncentiveApys = (
|
|
83
|
+
export const getIncentiveApys = async (
|
|
78
84
|
baseData: CompoundV3AssetData & BaseAdditionalAssetData,
|
|
79
85
|
compPrice: string,
|
|
80
|
-
): {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
86
|
+
): Promise<{
|
|
87
|
+
supplyIncentives: IncentiveData[],
|
|
88
|
+
borrowIncentives: IncentiveData[],
|
|
89
|
+
}> => ({
|
|
90
|
+
supplyIncentives: [{
|
|
91
|
+
token: 'COMP',
|
|
92
|
+
apy: aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardSupplySpeed * +compPrice) / +baseData.price / +baseData.totalSupply).toString(),
|
|
93
|
+
incentiveKind: IncentiveKind.Reward,
|
|
94
|
+
description: 'Eligible for protocol-level COMP incentives.',
|
|
95
|
+
},
|
|
96
|
+
...addToArrayIf(STAKING_ASSETS.includes(baseData.symbol), {
|
|
97
|
+
apy: await getStakingApy(baseData.symbol),
|
|
98
|
+
token: baseData.symbol,
|
|
99
|
+
incentiveKind: IncentiveKind.Staking,
|
|
100
|
+
description: `Native ${baseData.symbol} yield.`,
|
|
101
|
+
}),
|
|
102
|
+
],
|
|
103
|
+
borrowIncentives: [{
|
|
104
|
+
token: 'COMP',
|
|
105
|
+
apy: aprToApy((100 * SECONDS_PER_YEAR * +baseData.rewardBorrowSpeed * +compPrice) / +baseData.price / +baseData.totalBorrow).toString(),
|
|
106
|
+
incentiveKind: IncentiveKind.Reward,
|
|
107
|
+
description: 'Eligible for protocol-level COMP incentives.',
|
|
108
|
+
},
|
|
109
|
+
...addToArrayIf(STAKING_ASSETS.includes(baseData.symbol), {
|
|
110
|
+
apy: new Dec(await getStakingApy(baseData.symbol)).mul(-1).toString(),
|
|
111
|
+
token: baseData.symbol,
|
|
112
|
+
incentiveKind: IncentiveKind.Staking,
|
|
113
|
+
description: `Due to the native yield of ${baseData.symbol}, the value of the debt would increase over time.`,
|
|
114
|
+
}),
|
|
115
|
+
],
|
|
116
|
+
});
|
|
95
117
|
|
|
96
118
|
export const getCompoundV2AggregatedData = ({
|
|
97
119
|
usedAssets, assetsData, ...rest
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { assetAmountInWei } from '@defisaver/tokens';
|
|
3
3
|
import {
|
|
4
|
-
EthAddress, EthereumProvider, NetworkNumber,
|
|
4
|
+
EthAddress, EthereumProvider, MMAssetsData, NetworkNumber,
|
|
5
5
|
} from '../../types/common';
|
|
6
6
|
import {
|
|
7
7
|
calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS,
|
|
8
8
|
} from '../../moneymarket';
|
|
9
|
-
import {
|
|
9
|
+
import { calculateNetApy } from '../../staking';
|
|
10
10
|
import {
|
|
11
11
|
EulerV2AggregatedPositionData,
|
|
12
12
|
EulerV2AssetsData,
|
|
@@ -74,43 +74,6 @@ export const isLeveragedPos = (usedAssets: EulerV2UsedAssets, dustLimit = 5) =>
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
export const calculateNetApy = (usedAssets: EulerV2UsedAssets, assetsData: EulerV2AssetsData) => {
|
|
78
|
-
const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
|
|
79
|
-
const acc = { ..._acc };
|
|
80
|
-
const assetData = assetsData[usedAsset.vaultAddress.toLowerCase()];
|
|
81
|
-
|
|
82
|
-
if (usedAsset.isSupplied) {
|
|
83
|
-
const amount = usedAsset.suppliedUsd;
|
|
84
|
-
acc.suppliedUsd = new Dec(acc.suppliedUsd).add(amount).toString();
|
|
85
|
-
const rate = assetData.supplyRate;
|
|
86
|
-
const supplyInterest = calculateInterestEarned(amount, rate as string, 'year', true);
|
|
87
|
-
acc.supplyInterest = new Dec(acc.supplyInterest).add(supplyInterest.toString()).toString();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (usedAsset.isBorrowed) {
|
|
91
|
-
const amount = usedAsset.borrowedUsd;
|
|
92
|
-
acc.borrowedUsd = new Dec(acc.borrowedUsd).add(amount).toString();
|
|
93
|
-
const rate = assetData.borrowRate;
|
|
94
|
-
const borrowInterest = calculateInterestEarned(amount, rate as string, 'year', true);
|
|
95
|
-
acc.borrowInterest = new Dec(acc.borrowInterest).sub(borrowInterest.toString()).toString();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return acc;
|
|
99
|
-
}, {
|
|
100
|
-
borrowInterest: '0', supplyInterest: '0', incentiveUsd: '0', borrowedUsd: '0', suppliedUsd: '0',
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const {
|
|
104
|
-
borrowedUsd, suppliedUsd, borrowInterest, supplyInterest, incentiveUsd,
|
|
105
|
-
} = sumValues;
|
|
106
|
-
|
|
107
|
-
const totalInterestUsd = new Dec(borrowInterest).add(supplyInterest).add(incentiveUsd).toString();
|
|
108
|
-
const balance = new Dec(suppliedUsd).sub(borrowedUsd);
|
|
109
|
-
const netApy = new Dec(totalInterestUsd).div(balance).times(100).toString();
|
|
110
|
-
|
|
111
|
-
return { netApy, totalInterestUsd, incentiveUsd };
|
|
112
|
-
};
|
|
113
|
-
|
|
114
77
|
export const getEulerV2AggregatedData = ({
|
|
115
78
|
usedAssets, assetsData, network, ...rest
|
|
116
79
|
}: { usedAssets: EulerV2UsedAssets, assetsData: EulerV2AssetsData, network: NetworkNumber }) => {
|
|
@@ -124,7 +87,7 @@ export const getEulerV2AggregatedData = ({
|
|
|
124
87
|
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
125
88
|
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
126
89
|
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
127
|
-
const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy(usedAssets, assetsData);
|
|
90
|
+
const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({ usedAssets, assetsData: assetsData as unknown as MMAssetsData });
|
|
128
91
|
payload.netApy = netApy;
|
|
129
92
|
payload.incentiveUsd = incentiveUsd;
|
|
130
93
|
payload.totalInterestUsd = totalInterestUsd;
|
|
@@ -299,6 +299,8 @@ const EMPTY_ASSET_DATA = {
|
|
|
299
299
|
canBeBorrowed: false,
|
|
300
300
|
supplyRate: '0',
|
|
301
301
|
borrowRate: '0',
|
|
302
|
+
supplyIncentives: [],
|
|
303
|
+
borrowIncentives: [],
|
|
302
304
|
};
|
|
303
305
|
|
|
304
306
|
export const mergeAssetData = (existing: Partial<FluidAssetData> = {}, additional: Partial<FluidAssetData>): FluidAssetData => ({
|
|
@@ -13,8 +13,10 @@ export const calculateNetApyLiquityV2 = (usedAssets: LiquityV2UsedAssets, assets
|
|
|
13
13
|
if (usedAsset.suppliedUsd) {
|
|
14
14
|
const amount = usedAsset.suppliedUsd;
|
|
15
15
|
acc.suppliedUsd = new Dec(acc.suppliedUsd).add(amount).toString();
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
for (const supplyIncentive of assetData.supplyIncentives) {
|
|
18
|
+
const { apy } = supplyIncentive;
|
|
19
|
+
const incentiveInterest = calculateInterestEarned(amount, apy, 'year', true);
|
|
18
20
|
acc.incentiveUsd = new Dec(acc.incentiveUsd).add(incentiveInterest).toString();
|
|
19
21
|
}
|
|
20
22
|
}
|
package/src/liquityV2/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { Client, PublicClient } from 'viem';
|
|
|
4
4
|
import {
|
|
5
5
|
createViemContractFromConfigFunc, LiquityV2LegacyViewContractViem, LiquityV2ViewContractViem,
|
|
6
6
|
} from '../contracts';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
EthAddress, EthereumProvider, IncentiveKind, NetworkNumber,
|
|
9
|
+
} from '../types/common';
|
|
8
10
|
import {
|
|
9
11
|
LIQUITY_V2_TROVE_STATUS_ENUM,
|
|
10
12
|
LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2UsedAssets,
|
|
@@ -63,6 +65,8 @@ export const _getLiquityV2MarketData = async (provider: Client, network: Network
|
|
|
63
65
|
canBeBorrowed: true,
|
|
64
66
|
leftToBorrowGlobal,
|
|
65
67
|
leftToWithdrawGlobal: '0',
|
|
68
|
+
supplyIncentives: [],
|
|
69
|
+
borrowIncentives: [],
|
|
66
70
|
};
|
|
67
71
|
assetsData[collateralToken] = {
|
|
68
72
|
symbol: collateralToken,
|
|
@@ -74,10 +78,16 @@ export const _getLiquityV2MarketData = async (provider: Client, network: Network
|
|
|
74
78
|
canBeBorrowed: false,
|
|
75
79
|
leftToBorrowGlobal: '0',
|
|
76
80
|
leftToWithdrawGlobal,
|
|
81
|
+
supplyIncentives: [],
|
|
82
|
+
borrowIncentives: [],
|
|
77
83
|
};
|
|
78
84
|
if (STAKING_ASSETS.includes(collateralToken)) {
|
|
79
|
-
assetsData[collateralToken].
|
|
80
|
-
|
|
85
|
+
assetsData[collateralToken].supplyIncentives.push({
|
|
86
|
+
apy: await getStakingApy(collateralToken),
|
|
87
|
+
token: collateralToken,
|
|
88
|
+
incentiveKind: IncentiveKind.Staking,
|
|
89
|
+
description: `Native ${collateralToken} yield.`,
|
|
90
|
+
});
|
|
81
91
|
}
|
|
82
92
|
|
|
83
93
|
return {
|
package/src/llamaLend/index.ts
CHANGED
|
@@ -2,10 +2,11 @@ import Dec from 'decimal.js';
|
|
|
2
2
|
import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
|
|
3
3
|
import { Client } from 'viem';
|
|
4
4
|
import {
|
|
5
|
+
LlamaLendAssetsData,
|
|
5
6
|
LlamaLendGlobalMarketData, LlamaLendMarketData, LlamaLendStatus, LlamaLendUsedAssets, LlamaLendUserData,
|
|
6
7
|
} from '../types';
|
|
7
8
|
import {
|
|
8
|
-
Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances,
|
|
9
|
+
Blockish, EthAddress, EthereumProvider, IncentiveKind, NetworkNumber, PositionBalances,
|
|
9
10
|
} from '../types/common';
|
|
10
11
|
import { LlamaLendViewContractViem } from '../contracts';
|
|
11
12
|
import { getLlamaLendAggregatedData } from '../helpers/llamaLendHelpers';
|
|
@@ -88,7 +89,7 @@ export const _getLlamaLendGlobalData = async (provider: Client, network: Network
|
|
|
88
89
|
const debtInAYearBN = new Dec(totalDebt).mul(new Dec(2.718281828459).pow(exponentRate).toNumber());
|
|
89
90
|
const lendRate = debtInAYearBN.minus(totalDebt).div(cap).mul(100).toString();
|
|
90
91
|
|
|
91
|
-
const assetsData:
|
|
92
|
+
const assetsData: LlamaLendAssetsData = {};
|
|
92
93
|
assetsData[debtAsset] = {
|
|
93
94
|
symbol: debtAsset,
|
|
94
95
|
address: data.debtToken,
|
|
@@ -97,6 +98,8 @@ export const _getLlamaLendGlobalData = async (provider: Client, network: Network
|
|
|
97
98
|
borrowRate,
|
|
98
99
|
canBeSupplied: true,
|
|
99
100
|
canBeBorrowed: true,
|
|
101
|
+
supplyIncentives: [],
|
|
102
|
+
borrowIncentives: [],
|
|
100
103
|
};
|
|
101
104
|
|
|
102
105
|
assetsData[collAsset] = {
|
|
@@ -107,11 +110,17 @@ export const _getLlamaLendGlobalData = async (provider: Client, network: Network
|
|
|
107
110
|
borrowRate: '0',
|
|
108
111
|
canBeSupplied: true,
|
|
109
112
|
canBeBorrowed: false,
|
|
113
|
+
supplyIncentives: [],
|
|
114
|
+
borrowIncentives: [],
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
if (STAKING_ASSETS.includes(collAsset)) {
|
|
113
|
-
assetsData[collAsset].
|
|
114
|
-
|
|
118
|
+
assetsData[collAsset].supplyIncentives.push({
|
|
119
|
+
apy: await getStakingApy(collAsset),
|
|
120
|
+
token: collAsset,
|
|
121
|
+
incentiveKind: IncentiveKind.Staking,
|
|
122
|
+
description: `Native ${collAsset} yield.`,
|
|
123
|
+
});
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
return {
|
package/src/morphoBlue/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Dec from 'decimal.js';
|
|
|
2
2
|
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
3
3
|
import { Client } from 'viem';
|
|
4
4
|
import {
|
|
5
|
-
Blockish, EthAddress, EthereumProvider, MMUsedAssets, NetworkNumber, PositionBalances,
|
|
5
|
+
Blockish, EthAddress, EthereumProvider, IncentiveKind, MMUsedAssets, NetworkNumber, PositionBalances,
|
|
6
6
|
} from '../types/common';
|
|
7
7
|
import {
|
|
8
8
|
DFSFeedRegistryContractViem, FeedRegistryContractViem, MorphoBlueViewContractViem,
|
|
@@ -88,10 +88,18 @@ export async function _getMorphoBlueMarketData(provider: Client, network: Networ
|
|
|
88
88
|
totalBorrow: new Dec(marketInfo.totalBorrowAssets.toString()).div(scale).toString(),
|
|
89
89
|
canBeSupplied: true,
|
|
90
90
|
canBeBorrowed: true,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
supplyIncentives: [{
|
|
92
|
+
token: 'MORPHO',
|
|
93
|
+
apy: morphoSupplyApy,
|
|
94
|
+
incentiveKind: IncentiveKind.Reward,
|
|
95
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
96
|
+
}],
|
|
97
|
+
borrowIncentives: [{
|
|
98
|
+
token: 'MORPHO',
|
|
99
|
+
apy: morphoBorrowApy,
|
|
100
|
+
incentiveKind: IncentiveKind.Reward,
|
|
101
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
102
|
+
}],
|
|
95
103
|
};
|
|
96
104
|
|
|
97
105
|
assetsData[wethToEth(collateralTokenInfo.symbol)] = {
|
|
@@ -102,10 +110,16 @@ export async function _getMorphoBlueMarketData(provider: Client, network: Networ
|
|
|
102
110
|
borrowRate: '0',
|
|
103
111
|
canBeSupplied: true,
|
|
104
112
|
canBeBorrowed: false,
|
|
113
|
+
supplyIncentives: [],
|
|
114
|
+
borrowIncentives: [],
|
|
105
115
|
};
|
|
106
116
|
if (STAKING_ASSETS.includes(collateralTokenInfo.symbol)) {
|
|
107
|
-
assetsData[collateralTokenInfo.symbol].
|
|
108
|
-
|
|
117
|
+
assetsData[collateralTokenInfo.symbol].supplyIncentives = [{
|
|
118
|
+
apy: await getStakingApy(collateralTokenInfo.symbol),
|
|
119
|
+
token: collateralTokenInfo.symbol,
|
|
120
|
+
incentiveKind: IncentiveKind.Staking,
|
|
121
|
+
description: `Native ${collateralTokenInfo.symbol} yield.`,
|
|
122
|
+
}];
|
|
109
123
|
}
|
|
110
124
|
|
|
111
125
|
return {
|