@defisaver/positions-sdk 2.1.7 → 2.1.9-dev-spark-1
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/aaveV3/index.js +3 -3
- package/cjs/aaveV3/merit.js +3 -0
- package/cjs/aaveV3/merkl.d.ts +1 -1
- package/cjs/config/contracts.d.ts +20 -0
- package/cjs/config/contracts.js +20 -0
- package/cjs/fluid/index.js +40 -12
- package/cjs/helpers/aaveHelpers/index.d.ts +1 -1
- package/cjs/helpers/aaveHelpers/index.js +6 -4
- package/cjs/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/helpers/sparkHelpers/index.d.ts +4 -4
- package/cjs/helpers/sparkHelpers/index.js +12 -12
- package/cjs/markets/aave/index.js +1 -1
- package/cjs/markets/aave/marketAssets.d.ts +4 -0
- package/cjs/markets/aave/marketAssets.js +5 -1
- package/cjs/markets/compound/index.js +11 -0
- package/cjs/markets/compound/marketsAssets.d.ts +7 -0
- package/cjs/markets/compound/marketsAssets.js +7 -0
- package/cjs/markets/fluid/index.d.ts +4 -0
- package/cjs/markets/fluid/index.js +4 -0
- package/cjs/markets/spark/marketAssets.d.ts +1 -0
- package/cjs/markets/spark/marketAssets.js +1 -0
- package/cjs/portfolio/index.js +1 -1
- package/cjs/services/utils.d.ts +8 -4
- package/cjs/services/utils.js +30 -10
- package/cjs/services/viem.d.ts +54 -15
- package/cjs/services/viem.js +2 -0
- package/cjs/spark/index.d.ts +3 -1
- package/cjs/spark/index.js +24 -14
- package/cjs/staking/eligibility.js +1 -6
- package/cjs/types/common.d.ts +4 -2
- package/cjs/types/common.js +2 -0
- package/cjs/types/fluid.d.ts +7 -3
- package/cjs/types/fluid.js +4 -0
- package/cjs/types/spark.d.ts +3 -1
- package/esm/aaveV3/index.js +4 -4
- package/esm/aaveV3/merit.js +3 -0
- package/esm/aaveV3/merkl.d.ts +1 -1
- package/esm/config/contracts.d.ts +20 -0
- package/esm/config/contracts.js +20 -0
- package/esm/fluid/index.js +40 -12
- package/esm/helpers/aaveHelpers/index.d.ts +1 -1
- package/esm/helpers/aaveHelpers/index.js +7 -5
- package/esm/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/helpers/sparkHelpers/index.d.ts +4 -4
- package/esm/helpers/sparkHelpers/index.js +13 -13
- package/esm/markets/aave/index.js +1 -1
- package/esm/markets/aave/marketAssets.d.ts +4 -0
- package/esm/markets/aave/marketAssets.js +4 -0
- package/esm/markets/compound/index.js +11 -0
- package/esm/markets/compound/marketsAssets.d.ts +7 -0
- package/esm/markets/compound/marketsAssets.js +7 -0
- package/esm/markets/fluid/index.d.ts +4 -0
- package/esm/markets/fluid/index.js +4 -0
- package/esm/markets/spark/marketAssets.d.ts +1 -0
- package/esm/markets/spark/marketAssets.js +1 -0
- package/esm/portfolio/index.js +1 -1
- package/esm/services/utils.d.ts +8 -4
- package/esm/services/utils.js +21 -5
- package/esm/services/viem.d.ts +54 -15
- package/esm/services/viem.js +3 -1
- package/esm/spark/index.d.ts +3 -1
- package/esm/spark/index.js +25 -15
- package/esm/staking/eligibility.js +1 -6
- package/esm/types/common.d.ts +4 -2
- package/esm/types/common.js +2 -0
- package/esm/types/fluid.d.ts +7 -3
- package/esm/types/fluid.js +4 -0
- package/esm/types/spark.d.ts +3 -1
- package/package.json +47 -47
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +614 -614
- package/src/aaveV3/merit.ts +97 -94
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1251 -1231
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +120 -120
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1668 -1638
- package/src/helpers/aaveHelpers/index.ts +187 -185
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +158 -155
- package/src/index.ts +47 -47
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +657 -657
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +116 -116
- package/src/markets/aave/marketAssets.ts +54 -49
- package/src/markets/compound/index.ts +238 -227
- package/src/markets/compound/marketsAssets.ts +97 -90
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2460 -2456
- package/src/markets/index.ts +25 -25
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -11
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +570 -570
- package/src/services/priceService.ts +159 -159
- package/src/services/utils.ts +115 -99
- package/src/services/viem.ts +34 -32
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +465 -445
- package/src/staking/eligibility.ts +53 -59
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +170 -170
- package/src/types/aave.ts +189 -189
- package/src/types/claiming.ts +109 -109
- package/src/types/common.ts +107 -105
- package/src/types/compound.ts +136 -136
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +452 -448
- package/src/types/index.ts +13 -13
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +194 -194
- package/src/types/portfolio.ts +60 -60
- package/src/types/spark.ts +136 -135
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
- package/CLAUDE.md +0 -32
package/cjs/spark/index.js
CHANGED
|
@@ -56,18 +56,17 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
56
56
|
const marketAddress = selectedMarket.providerAddress;
|
|
57
57
|
const loanInfoContract = (0, contracts_1.SparkViewContractViem)(provider, network);
|
|
58
58
|
const sparkIncentivesContract = (0, contracts_1.SparkIncentiveDataProviderContractViem)(provider, network);
|
|
59
|
-
|
|
59
|
+
// eslint-disable-next-line prefer-const
|
|
60
|
+
let [loanInfo, rewardInfo] = yield Promise.all([
|
|
60
61
|
loanInfoContract.read.getFullTokensInfo([marketAddress, selectedMarket.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(a)).address)]),
|
|
61
|
-
|
|
62
|
+
sparkIncentivesContract.read.getReservesIncentivesData([marketAddress]),
|
|
62
63
|
]);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, {});
|
|
70
|
-
}
|
|
64
|
+
rewardInfo = rewardInfo.reduce((all, market) => {
|
|
65
|
+
// eslint-disable-next-line no-param-reassign
|
|
66
|
+
all[market.underlyingAsset] = market;
|
|
67
|
+
return all;
|
|
68
|
+
}, {});
|
|
69
|
+
const eModeCategoriesData = {};
|
|
71
70
|
const assetsData = yield Promise.all(loanInfo
|
|
72
71
|
.map((market, i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
72
|
const symbol = selectedMarket.assets[i];
|
|
@@ -82,6 +81,15 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
82
81
|
if (new decimal_js_1.default(marketLiquidity).lt(0)) {
|
|
83
82
|
marketLiquidity = '0';
|
|
84
83
|
}
|
|
84
|
+
eModeCategoriesData[+market.emodeCategory.toString()] = {
|
|
85
|
+
id: +market.emodeCategory.toString(),
|
|
86
|
+
label: market.label,
|
|
87
|
+
liquidationBonus: new decimal_js_1.default(market.liquidationBonus).div(10000).toString(),
|
|
88
|
+
liquidationRatio: new decimal_js_1.default(market.liquidationThreshold).div(10000).toString(),
|
|
89
|
+
collateralFactor: new decimal_js_1.default(market.ltv).div(10000).toString(),
|
|
90
|
+
collateralAssets: eModeCategoriesData[+market.emodeCategory.toString()] ? [...eModeCategoriesData[+market.emodeCategory.toString()].collateralAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
91
|
+
borrowAssets: eModeCategoriesData[+market.emodeCategory.toString()] ? [...eModeCategoriesData[+market.emodeCategory.toString()].borrowAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
92
|
+
};
|
|
85
93
|
return ({
|
|
86
94
|
symbol: selectedMarket.assets[i],
|
|
87
95
|
isIsolated: new decimal_js_1.default(market.debtCeilingForIsolationMode.toString()).gt(0),
|
|
@@ -154,7 +162,7 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
154
162
|
return;
|
|
155
163
|
rewardForMarket.aIncentiveData.rewardsTokenInformation.forEach(supplyRewardData => {
|
|
156
164
|
if (supplyRewardData) {
|
|
157
|
-
if (supplyRewardData.emissionEndTimestamp * 1000 < Date.now())
|
|
165
|
+
if (+(supplyRewardData.emissionEndTimestamp.toString()) * 1000 < Date.now())
|
|
158
166
|
return;
|
|
159
167
|
const supplyEmissionPerSecond = supplyRewardData.emissionPerSecond;
|
|
160
168
|
const supplyRewardPrice = new decimal_js_1.default(supplyRewardData.rewardPriceFeed).div(Math.pow(10, supplyRewardData.priceFeedDecimals))
|
|
@@ -175,7 +183,7 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
175
183
|
});
|
|
176
184
|
rewardForMarket.vIncentiveData.rewardsTokenInformation.forEach(borrowRewardData => {
|
|
177
185
|
if (borrowRewardData) {
|
|
178
|
-
if (borrowRewardData.emissionEndTimestamp * 1000 < Date.now())
|
|
186
|
+
if (+(borrowRewardData.emissionEndTimestamp.toString()) * 1000 < Date.now())
|
|
179
187
|
return;
|
|
180
188
|
const supplyEmissionPerSecond = borrowRewardData.emissionPerSecond;
|
|
181
189
|
const supplyRewardPrice = new decimal_js_1.default(borrowRewardData.rewardPriceFeed).div(Math.pow(10, borrowRewardData.priceFeedDecimals))
|
|
@@ -207,7 +215,9 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
207
215
|
.forEach((assetData, i) => {
|
|
208
216
|
payload[assetData.symbol] = Object.assign(Object.assign({}, assetData), { sortIndex: i });
|
|
209
217
|
});
|
|
210
|
-
|
|
218
|
+
eModeCategoriesData[0].collateralAssets = Object.values(payload).map(a => a.symbol);
|
|
219
|
+
eModeCategoriesData[0].borrowAssets = Object.values(payload).map(a => a.symbol);
|
|
220
|
+
return { assetsData: payload, eModeCategoriesData };
|
|
211
221
|
});
|
|
212
222
|
exports._getSparkMarketsData = _getSparkMarketsData;
|
|
213
223
|
const getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getSparkMarketsData)((0, viem_1.getViemProvider)(provider, network), network, selectedMarket); });
|
|
@@ -349,7 +359,7 @@ const getSparkAccountData = (provider, network, address, extractedState) => __aw
|
|
|
349
359
|
exports.getSparkAccountData = getSparkAccountData;
|
|
350
360
|
const getSparkFullPositionData = (provider, network, address, market) => __awaiter(void 0, void 0, void 0, function* () {
|
|
351
361
|
const marketData = yield (0, exports.getSparkMarketsData)(provider, network, market);
|
|
352
|
-
const positionData = yield (0, exports.getSparkAccountData)(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market });
|
|
362
|
+
const positionData = yield (0, exports.getSparkAccountData)(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market, eModeCategoriesData: marketData.eModeCategoriesData });
|
|
353
363
|
return positionData;
|
|
354
364
|
});
|
|
355
365
|
exports.getSparkFullPositionData = getSparkFullPositionData;
|
|
@@ -24,12 +24,6 @@ const isEligibleForEthenaUSDeRewards = (usedAssets, { healthRatio }) => {
|
|
|
24
24
|
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
25
25
|
if (anythingBorrowedNotAllowed)
|
|
26
26
|
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
27
|
-
const totalAmountBorrowed = Object.values(usedAssets).reduce((acc, asset) => {
|
|
28
|
-
if (asset.isBorrowed) {
|
|
29
|
-
return acc.add(asset.borrowedUsd);
|
|
30
|
-
}
|
|
31
|
-
return acc;
|
|
32
|
-
}, new decimal_js_1.default(0)).toString();
|
|
33
27
|
if (new decimal_js_1.default(healthRatio).gte(2.5))
|
|
34
28
|
return { isEligible: false, eligibleUSDAmount: '0' }; // health ratio must be below 2.5
|
|
35
29
|
const halfAmountSupplied = new decimal_js_1.default(totalAmountSupplied).div(2).toString();
|
|
@@ -63,4 +57,5 @@ exports.EligibilityMapping = {
|
|
|
63
57
|
[common_1.IncentiveEligibilityId.AaveV3EthenaLiquidLeverage]: exports.isEligibleForEthenaUSDeRewards,
|
|
64
58
|
[common_1.IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: exports.isEligibleForAaveV3ArbitrumEthSupply,
|
|
65
59
|
[common_1.IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: exports.isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
60
|
+
[common_1.IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasma]: exports.isEligibleForEthenaUSDeRewards,
|
|
66
61
|
};
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare enum IncentiveKind {
|
|
|
5
5
|
export declare enum IncentiveEligibilityId {
|
|
6
6
|
AaveV3EthenaLiquidLeverage = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL",
|
|
7
7
|
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
|
-
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351"
|
|
8
|
+
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351",
|
|
9
|
+
AaveV3EthenaLiquidLeveragePlasma = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL"
|
|
9
10
|
}
|
|
10
11
|
export interface IncentiveData {
|
|
11
12
|
token: string;
|
|
@@ -23,7 +24,8 @@ export declare enum NetworkNumber {
|
|
|
23
24
|
Opt = 10,
|
|
24
25
|
Arb = 42161,
|
|
25
26
|
Base = 8453,
|
|
26
|
-
Linea = 59144
|
|
27
|
+
Linea = 59144,
|
|
28
|
+
Plasma = 9745
|
|
27
29
|
}
|
|
28
30
|
export type Networkish = string | NetworkNumber;
|
|
29
31
|
export interface MMAssetData {
|
package/cjs/types/common.js
CHANGED
|
@@ -11,6 +11,7 @@ var IncentiveEligibilityId;
|
|
|
11
11
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL";
|
|
12
12
|
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
13
13
|
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
14
|
+
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL";
|
|
14
15
|
})(IncentiveEligibilityId || (exports.IncentiveEligibilityId = IncentiveEligibilityId = {}));
|
|
15
16
|
var NetworkNumber;
|
|
16
17
|
(function (NetworkNumber) {
|
|
@@ -19,4 +20,5 @@ var NetworkNumber;
|
|
|
19
20
|
NetworkNumber[NetworkNumber["Arb"] = 42161] = "Arb";
|
|
20
21
|
NetworkNumber[NetworkNumber["Base"] = 8453] = "Base";
|
|
21
22
|
NetworkNumber[NetworkNumber["Linea"] = 59144] = "Linea";
|
|
23
|
+
NetworkNumber[NetworkNumber["Plasma"] = 9745] = "Plasma";
|
|
22
24
|
})(NetworkNumber || (exports.NetworkNumber = NetworkNumber = {}));
|
package/cjs/types/fluid.d.ts
CHANGED
|
@@ -149,21 +149,25 @@ export declare enum FluidMainnetDepositToken {
|
|
|
149
149
|
USDC = "USDC",
|
|
150
150
|
USDT = "USDT",
|
|
151
151
|
GHO = "GHO",
|
|
152
|
-
sUSDS = "sUSDS"
|
|
152
|
+
sUSDS = "sUSDS",
|
|
153
|
+
USDtb = "USDtb"
|
|
153
154
|
}
|
|
154
155
|
export declare enum FluidArbitrumDepositToken {
|
|
155
156
|
ETH = "ETH",
|
|
156
157
|
wstETH = "wstETH",
|
|
157
158
|
USDC = "USDC",
|
|
158
159
|
USDT = "USDT",
|
|
159
|
-
ARB = "ARB"
|
|
160
|
+
ARB = "ARB",
|
|
161
|
+
GHO = "GHO",
|
|
162
|
+
sUSDS = "sUSDS"
|
|
160
163
|
}
|
|
161
164
|
export declare enum FluidBaseDepositToken {
|
|
162
165
|
ETH = "ETH",
|
|
163
166
|
USDC = "USDC",
|
|
164
167
|
wstETH = "wstETH",
|
|
165
168
|
EURC = "EURC",
|
|
166
|
-
sUSDS = "sUSDS"
|
|
169
|
+
sUSDS = "sUSDS",
|
|
170
|
+
GHO = "GHO"
|
|
167
171
|
}
|
|
168
172
|
export type FluidDepositTokenByNetwork = {
|
|
169
173
|
[NetworkNumber.Eth]: FluidMainnetDepositToken;
|
package/cjs/types/fluid.js
CHANGED
|
@@ -136,6 +136,7 @@ var FluidMainnetDepositToken;
|
|
|
136
136
|
FluidMainnetDepositToken["USDT"] = "USDT";
|
|
137
137
|
FluidMainnetDepositToken["GHO"] = "GHO";
|
|
138
138
|
FluidMainnetDepositToken["sUSDS"] = "sUSDS";
|
|
139
|
+
FluidMainnetDepositToken["USDtb"] = "USDtb";
|
|
139
140
|
})(FluidMainnetDepositToken || (exports.FluidMainnetDepositToken = FluidMainnetDepositToken = {}));
|
|
140
141
|
var FluidArbitrumDepositToken;
|
|
141
142
|
(function (FluidArbitrumDepositToken) {
|
|
@@ -144,6 +145,8 @@ var FluidArbitrumDepositToken;
|
|
|
144
145
|
FluidArbitrumDepositToken["USDC"] = "USDC";
|
|
145
146
|
FluidArbitrumDepositToken["USDT"] = "USDT";
|
|
146
147
|
FluidArbitrumDepositToken["ARB"] = "ARB";
|
|
148
|
+
FluidArbitrumDepositToken["GHO"] = "GHO";
|
|
149
|
+
FluidArbitrumDepositToken["sUSDS"] = "sUSDS";
|
|
147
150
|
})(FluidArbitrumDepositToken || (exports.FluidArbitrumDepositToken = FluidArbitrumDepositToken = {}));
|
|
148
151
|
var FluidBaseDepositToken;
|
|
149
152
|
(function (FluidBaseDepositToken) {
|
|
@@ -152,6 +155,7 @@ var FluidBaseDepositToken;
|
|
|
152
155
|
FluidBaseDepositToken["wstETH"] = "wstETH";
|
|
153
156
|
FluidBaseDepositToken["EURC"] = "EURC";
|
|
154
157
|
FluidBaseDepositToken["sUSDS"] = "sUSDS";
|
|
158
|
+
FluidBaseDepositToken["GHO"] = "GHO";
|
|
155
159
|
})(FluidBaseDepositToken || (exports.FluidBaseDepositToken = FluidBaseDepositToken = {}));
|
|
156
160
|
var FluidVaultType;
|
|
157
161
|
(function (FluidVaultType) {
|
package/cjs/types/spark.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EModeCategoriesData } from './aave';
|
|
1
2
|
import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
2
3
|
export declare enum SparkVersions {
|
|
3
4
|
SparkV1 = "v1default"
|
|
@@ -53,6 +54,7 @@ export interface SparkAssetsData {
|
|
|
53
54
|
}
|
|
54
55
|
export type SparkMarketsData = {
|
|
55
56
|
assetsData: SparkAssetsData;
|
|
57
|
+
eModeCategoriesData: EModeCategoriesData;
|
|
56
58
|
};
|
|
57
59
|
export interface SparkUsedAsset extends MMUsedAsset {
|
|
58
60
|
stableBorrowRate: string;
|
|
@@ -71,7 +73,7 @@ export interface SparkUsedAssets {
|
|
|
71
73
|
export interface SparkHelperCommon {
|
|
72
74
|
usedAssets: SparkUsedAssets;
|
|
73
75
|
eModeCategory: number;
|
|
74
|
-
|
|
76
|
+
eModeCategoriesData?: EModeCategoriesData;
|
|
75
77
|
assetsData: SparkAssetsData;
|
|
76
78
|
selectedMarket?: SparkMarketData;
|
|
77
79
|
network?: NetworkNumber;
|
package/esm/aaveV3/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { AaveIncentiveDataProviderV3ContractViem, AaveIncentivesControllerViem,
|
|
|
13
13
|
import { aaveAnyGetAggregatedPositionData, aaveV3IsInIsolationMode, aaveV3IsInSiloedMode } from '../helpers/aaveHelpers';
|
|
14
14
|
import { AAVE_V3 } from '../markets/aave';
|
|
15
15
|
import { aprToApy, calculateBorrowingAssetLimit } from '../moneymarket';
|
|
16
|
-
import {
|
|
16
|
+
import { getWrappedNativeAssetFromUnwrapped, isEnabledOnBitmap, isLayer2Network, wethToEth, wethToEthByAddress, } from '../services/utils';
|
|
17
17
|
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
18
18
|
import { IncentiveKind, NetworkNumber, } from '../types/common';
|
|
19
19
|
import { getViemProvider, setViemBlockNumber } from '../services/viem';
|
|
@@ -47,12 +47,12 @@ export const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
|
|
|
47
47
|
};
|
|
48
48
|
export function _getAaveV3MarketData(provider_1, network_1, market_1) {
|
|
49
49
|
return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
|
|
50
|
-
const _addresses = market.assets.map(a => getAssetInfo(
|
|
50
|
+
const _addresses = market.assets.map(a => getAssetInfo(getWrappedNativeAssetFromUnwrapped(a), network).address);
|
|
51
51
|
const isL2 = isLayer2Network(network);
|
|
52
52
|
const loanInfoContract = AaveV3ViewContractViem(provider, network);
|
|
53
53
|
const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
54
54
|
const marketAddress = market.providerAddress;
|
|
55
|
-
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea];
|
|
55
|
+
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea, NetworkNumber.Plasma];
|
|
56
56
|
// eslint-disable-next-line prefer-const
|
|
57
57
|
let [loanInfo, eModesInfo, isBorrowAllowed, rewardInfo, merkleRewardsMap, meritRewardsMap] = yield Promise.all([
|
|
58
58
|
loanInfoContract.read.getFullTokensInfo([marketAddress, _addresses], setViemBlockNumber(blockNumber)),
|
|
@@ -353,7 +353,7 @@ export const _getAaveV3AccountData = (provider_1, network_1, address_1, extracte
|
|
|
353
353
|
const loanInfoContract = AaveV3ViewContractViem(provider, network);
|
|
354
354
|
const lendingPoolContract = createViemContractFromConfigFunc(market.lendingPool, market.lendingPoolAddress)(provider, network);
|
|
355
355
|
const marketAddress = market.providerAddress;
|
|
356
|
-
const _addresses = market.assets.map((a) => getAssetInfo(
|
|
356
|
+
const _addresses = market.assets.map((a) => getAssetInfo(getWrappedNativeAssetFromUnwrapped(a), network).address);
|
|
357
357
|
const middleAddressIndex = Math.floor(_addresses.length / 2); // split addresses in half to avoid gas limit by multicall
|
|
358
358
|
const [eModeCategory, tokenBalances1, tokenBalances2] = yield Promise.all([
|
|
359
359
|
lendingPoolContract.read.getUserEMode([address], setViemBlockNumber(blockNumber)),
|
package/esm/aaveV3/merit.js
CHANGED
package/esm/aaveV3/merkl.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MerkleRewardMap } from '../types';
|
|
2
2
|
import { NetworkNumber } from '../types/common';
|
|
3
|
-
export declare const getAaveUnderlyingSymbol: (_symbol?: string) =>
|
|
3
|
+
export declare const getAaveUnderlyingSymbol: (_symbol?: string) => string;
|
|
4
4
|
/**
|
|
5
5
|
* aEthLidoUSDC -> aUSDC
|
|
6
6
|
* USDC -> USDC
|
|
@@ -28303,6 +28303,11 @@ export declare const AaveV3View: {
|
|
|
28303
28303
|
};
|
|
28304
28304
|
};
|
|
28305
28305
|
};
|
|
28306
|
+
readonly "9745": {
|
|
28307
|
+
readonly address: "0xD8E67968d8a0df4beCf2D50daE1e34d4d80C701C";
|
|
28308
|
+
readonly createdBlock: 1880799;
|
|
28309
|
+
readonly oldVersions: {};
|
|
28310
|
+
};
|
|
28306
28311
|
};
|
|
28307
28312
|
};
|
|
28308
28313
|
export declare const AaveV3PoolAddressesProvider: {
|
|
@@ -28763,6 +28768,9 @@ export declare const AaveV3PoolAddressesProvider: {
|
|
|
28763
28768
|
readonly "59144": {
|
|
28764
28769
|
readonly address: "0x89502c3731F69DDC95B65753708A07F8Cd0373F4";
|
|
28765
28770
|
};
|
|
28771
|
+
readonly "9745": {
|
|
28772
|
+
readonly address: "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9";
|
|
28773
|
+
};
|
|
28766
28774
|
};
|
|
28767
28775
|
};
|
|
28768
28776
|
export declare const AaveV3LidoPoolAddressesProvider: {
|
|
@@ -31133,6 +31141,9 @@ export declare const AaveV3LendingPool: {
|
|
|
31133
31141
|
readonly "59144": {
|
|
31134
31142
|
readonly address: "0xc47b8C00b0f69a36fa203Ffeac0334874574a8Ac";
|
|
31135
31143
|
};
|
|
31144
|
+
readonly "9745": {
|
|
31145
|
+
readonly address: "0x925a2A7214Ed92428B5b1B090F80b25700095e12";
|
|
31146
|
+
};
|
|
31136
31147
|
};
|
|
31137
31148
|
};
|
|
31138
31149
|
export declare const AaveV3LidoLendingPool: {
|
|
@@ -34467,6 +34478,9 @@ export declare const AaveV3ProtocolDataProvider: {
|
|
|
34467
34478
|
readonly "59144": {
|
|
34468
34479
|
readonly address: "0x47cd4b507B81cB831669c71c7077f4daF6762FF4";
|
|
34469
34480
|
};
|
|
34481
|
+
readonly "9745": {
|
|
34482
|
+
readonly address: "0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F";
|
|
34483
|
+
};
|
|
34470
34484
|
};
|
|
34471
34485
|
};
|
|
34472
34486
|
export declare const AaveV3LidoProtocolDataProvider: {
|
|
@@ -35805,6 +35819,9 @@ export declare const AaveUiIncentiveDataProviderV3: {
|
|
|
35805
35819
|
readonly "59144": {
|
|
35806
35820
|
readonly address: "0x117684358D990E42Eb1649E7e8C4691951dc1E71";
|
|
35807
35821
|
};
|
|
35822
|
+
readonly "9745": {
|
|
35823
|
+
readonly address: "0xcb85C501B3A5e9851850d66648d69B26A4c90942";
|
|
35824
|
+
};
|
|
35808
35825
|
};
|
|
35809
35826
|
};
|
|
35810
35827
|
export declare const cUSDCv3: {
|
|
@@ -84964,6 +84981,9 @@ export declare const AaveRewardsController: {
|
|
|
84964
84981
|
readonly "59144": {
|
|
84965
84982
|
readonly address: "0xc67bb8F2314fA0df50cBa314c6509A7bdAD500C0";
|
|
84966
84983
|
};
|
|
84984
|
+
readonly "9745": {
|
|
84985
|
+
readonly address: "0x3A57eAa3Ca3794D66977326af7991eB3F6dD5a5A";
|
|
84986
|
+
};
|
|
84967
84987
|
};
|
|
84968
84988
|
};
|
|
84969
84989
|
export declare const LiquityV2ActivePool: {
|
package/esm/config/contracts.js
CHANGED
|
@@ -227,6 +227,11 @@ export const AaveV3View = {
|
|
|
227
227
|
"address": "0xc9D6EfA6e08B66a5Cdc516Bcd5807c2fa69E0f2A"
|
|
228
228
|
}
|
|
229
229
|
},
|
|
230
|
+
},
|
|
231
|
+
"9745": {
|
|
232
|
+
"address": "0xD8E67968d8a0df4beCf2D50daE1e34d4d80C701C",
|
|
233
|
+
"createdBlock": 1880799,
|
|
234
|
+
"oldVersions": {},
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
};
|
|
@@ -247,6 +252,9 @@ export const AaveV3PoolAddressesProvider = {
|
|
|
247
252
|
},
|
|
248
253
|
"59144": {
|
|
249
254
|
"address": "0x89502c3731F69DDC95B65753708A07F8Cd0373F4"
|
|
255
|
+
},
|
|
256
|
+
"9745": {
|
|
257
|
+
"address": "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9"
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
260
|
};
|
|
@@ -283,6 +291,9 @@ export const AaveV3LendingPool = {
|
|
|
283
291
|
},
|
|
284
292
|
"59144": {
|
|
285
293
|
"address": "0xc47b8C00b0f69a36fa203Ffeac0334874574a8Ac"
|
|
294
|
+
},
|
|
295
|
+
"9745": {
|
|
296
|
+
"address": "0x925a2A7214Ed92428B5b1B090F80b25700095e12"
|
|
286
297
|
}
|
|
287
298
|
}
|
|
288
299
|
};
|
|
@@ -319,6 +330,9 @@ export const AaveV3ProtocolDataProvider = {
|
|
|
319
330
|
},
|
|
320
331
|
"59144": {
|
|
321
332
|
"address": "0x47cd4b507B81cB831669c71c7077f4daF6762FF4"
|
|
333
|
+
},
|
|
334
|
+
"9745": {
|
|
335
|
+
"address": "0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F"
|
|
322
336
|
}
|
|
323
337
|
}
|
|
324
338
|
};
|
|
@@ -355,6 +369,9 @@ export const AaveUiIncentiveDataProviderV3 = {
|
|
|
355
369
|
},
|
|
356
370
|
"59144": {
|
|
357
371
|
"address": "0x117684358D990E42Eb1649E7e8C4691951dc1E71"
|
|
372
|
+
},
|
|
373
|
+
"9745": {
|
|
374
|
+
"address": "0xcb85C501B3A5e9851850d66648d69B26A4c90942"
|
|
358
375
|
}
|
|
359
376
|
}
|
|
360
377
|
};
|
|
@@ -1205,6 +1222,9 @@ export const AaveRewardsController = {
|
|
|
1205
1222
|
},
|
|
1206
1223
|
"59144": {
|
|
1207
1224
|
"address": "0xc67bb8F2314fA0df50cBa314c6509A7bdAD500C0"
|
|
1225
|
+
},
|
|
1226
|
+
"9745": {
|
|
1227
|
+
"address": "0x3A57eAa3Ca3794D66977326af7991eB3F6dD5a5A"
|
|
1208
1228
|
}
|
|
1209
1229
|
}
|
|
1210
1230
|
};
|
package/esm/fluid/index.js
CHANGED
|
@@ -1081,19 +1081,21 @@ export const _getFluidTokenData = (provider, network, token) => __awaiter(void 0
|
|
|
1081
1081
|
};
|
|
1082
1082
|
});
|
|
1083
1083
|
export const getFluidTokenData = (provider, network, token) => __awaiter(void 0, void 0, void 0, function* () { return _getFluidTokenData(getViemProvider(provider, network), network, token); });
|
|
1084
|
-
const parseFDepositTokenData = (fTokenData, userPosition, fTokenAddress) => {
|
|
1085
|
-
|
|
1086
|
-
const rewardsRate = new Dec(fTokenData.rewardsRate).div(1e12).toString();
|
|
1084
|
+
const parseFDepositTokenData = (fTokenData, userPosition, apiData, fTokenAddress) => {
|
|
1085
|
+
var _a, _b;
|
|
1087
1086
|
const decimals = fTokenData.decimals.toString();
|
|
1088
1087
|
const depositRate = new Dec(getEthAmountForDecimals(fTokenData.convertToShares.toString(), decimals)).toString();
|
|
1089
1088
|
const withdrawRate = new Dec(getEthAmountForDecimals(fTokenData.convertToAssets.toString(), decimals)).toString();
|
|
1089
|
+
const supplyRate = new Dec((apiData === null || apiData === void 0 ? void 0 : apiData.supplyRate) || '0').div(100).toString();
|
|
1090
|
+
const rewardRates = ((_a = apiData === null || apiData === void 0 ? void 0 : apiData.rewards) === null || _a === void 0 ? void 0 : _a.reduce((acc, item) => acc.add(new Dec(item.rate || '0').div(100)), new Dec(0))) || '0';
|
|
1091
|
+
const stakeRate = new Dec(((_b = apiData === null || apiData === void 0 ? void 0 : apiData.asset) === null || _b === void 0 ? void 0 : _b.stakingApr) || '0').div(100).toString();
|
|
1090
1092
|
return {
|
|
1091
1093
|
fTokenAddress,
|
|
1092
1094
|
fTokenSymbol: fTokenData.symbol,
|
|
1093
1095
|
decimals,
|
|
1094
1096
|
totalDeposited: getEthAmountForDecimals(fTokenData.totalAssets.toString(), decimals),
|
|
1095
1097
|
withdrawable: getEthAmountForDecimals(fTokenData.withdrawable.toString(), decimals),
|
|
1096
|
-
apy: new Dec(supplyRate).
|
|
1098
|
+
apy: new Dec(supplyRate).plus(rewardRates).plus(stakeRate).toString(),
|
|
1097
1099
|
depositRate,
|
|
1098
1100
|
withdrawRate,
|
|
1099
1101
|
deposited: getEthAmountForDecimals(userPosition.underlyingAssets.toString(), decimals),
|
|
@@ -1103,19 +1105,42 @@ const parseFDepositTokenData = (fTokenData, userPosition, fTokenAddress) => {
|
|
|
1103
1105
|
export const _getFluidDepositData = (provider, network, token, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1104
1106
|
const view = FluidViewContractViem(provider, network);
|
|
1105
1107
|
const fTokenAddress = getFTokenAddress(token, network);
|
|
1106
|
-
const [userPosition, fTokenData] = yield
|
|
1107
|
-
|
|
1108
|
+
const [[userPosition, fTokenData], rewardsApiResponse,] = yield Promise.all([
|
|
1109
|
+
view.read.getUserEarnPositionWithFToken([fTokenAddress, address]),
|
|
1110
|
+
fetch(`https://api.fluid.instadapp.io/v2/lending/${network}/tokens/${fTokenAddress}`),
|
|
1111
|
+
]);
|
|
1112
|
+
let rewardsData = { rewards: [] };
|
|
1113
|
+
if (!rewardsApiResponse.ok) {
|
|
1114
|
+
console.log('External API Failure: Failed to fetch fluid rewards APY');
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
rewardsData = yield rewardsApiResponse.json();
|
|
1118
|
+
}
|
|
1119
|
+
return parseFDepositTokenData(fTokenData, userPosition, rewardsData, fTokenAddress);
|
|
1108
1120
|
});
|
|
1109
1121
|
export const getFluidDepositData = (provider, network, token, address) => __awaiter(void 0, void 0, void 0, function* () { return _getFluidDepositData(getViemProvider(provider, network), network, token, address); });
|
|
1110
1122
|
export const _getAllUserEarnPositionsWithFTokens = (provider, network, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1111
1123
|
const view = FluidViewContractViem(provider, network);
|
|
1112
|
-
const [userPositions, fTokensData] = yield
|
|
1124
|
+
const [[userPositions, fTokensData], rewardsApiResponse,] = yield Promise.all([
|
|
1125
|
+
view.read.getAllUserEarnPositionsWithFTokens([user]),
|
|
1126
|
+
fetch(`https://api.fluid.instadapp.io/v2/lending/${network}/tokens`),
|
|
1127
|
+
]);
|
|
1128
|
+
let rewardsData = {
|
|
1129
|
+
data: [{ address: ZERO_ADDRESS, rewards: [] }],
|
|
1130
|
+
};
|
|
1131
|
+
if (!rewardsApiResponse.ok) {
|
|
1132
|
+
console.log('External API Failure: Failed to fetch fluid rewards APY');
|
|
1133
|
+
}
|
|
1134
|
+
else {
|
|
1135
|
+
rewardsData = yield rewardsApiResponse.json();
|
|
1136
|
+
}
|
|
1113
1137
|
const parsedRes = fTokensData.reduce((acc, fTokenData, i) => {
|
|
1114
1138
|
const userPosition = userPositions[i];
|
|
1115
1139
|
const deposited = userPosition === null || userPosition === void 0 ? void 0 : userPosition.underlyingAssets;
|
|
1116
1140
|
if (Number(deposited) > 0) {
|
|
1117
1141
|
const fTokenAddress = fTokenData.tokenAddress;
|
|
1118
|
-
|
|
1142
|
+
const apiData = rewardsData.data.find((item) => compareAddresses(item.address, fTokenAddress));
|
|
1143
|
+
acc.push(parseFDepositTokenData(fTokenData, userPosition, apiData, fTokenAddress));
|
|
1119
1144
|
}
|
|
1120
1145
|
return acc;
|
|
1121
1146
|
}, []);
|
|
@@ -1160,19 +1185,22 @@ const getTokenPricePortfolio = (token, provider, network) => __awaiter(void 0, v
|
|
|
1160
1185
|
const tokensWithoutChainlinkPrices = ['sUSDS', 'USDA', 'ezETH', 'rsETH', 'weETHs', 'LBTC'];
|
|
1161
1186
|
const handleTokenWithoutChainlinkPrice = (token, prices) => {
|
|
1162
1187
|
if (token === 'sUSDS') {
|
|
1163
|
-
return new Dec('
|
|
1188
|
+
return new Dec('107057929').div(1e8).toString();
|
|
1164
1189
|
}
|
|
1165
1190
|
if (token === 'USDA') {
|
|
1166
1191
|
return new Dec('100000000').div(1e8).toString();
|
|
1167
1192
|
}
|
|
1193
|
+
if (token === 'wstUSR') {
|
|
1194
|
+
return new Dec('111280000').div(1e8).toString();
|
|
1195
|
+
}
|
|
1168
1196
|
if (token === 'ezETH') {
|
|
1169
|
-
return new Dec(prices.ETH).mul(1.
|
|
1197
|
+
return new Dec(prices.ETH).mul(1.06).toString();
|
|
1170
1198
|
}
|
|
1171
1199
|
if (token === 'rsETH') {
|
|
1172
|
-
return new Dec(prices.wstETH).mul(1.
|
|
1200
|
+
return new Dec(prices.wstETH).mul(1.0557).toString();
|
|
1173
1201
|
}
|
|
1174
1202
|
if (token === 'weETHs') {
|
|
1175
|
-
return new Dec(prices.wstETH).mul(1.
|
|
1203
|
+
return new Dec(prices.wstETH).mul(1.032).toString();
|
|
1176
1204
|
}
|
|
1177
1205
|
if (token === 'LBTC') {
|
|
1178
1206
|
return prices.WBTC;
|
|
@@ -44,4 +44,4 @@ export declare const getApyAfterValuesEstimation: (selectedMarket: AaveMarketInf
|
|
|
44
44
|
/**
|
|
45
45
|
* won't cover all cases
|
|
46
46
|
*/
|
|
47
|
-
export declare const getAaveUnderlyingSymbol: (_symbol?: string) =>
|
|
47
|
+
export declare const getAaveUnderlyingSymbol: (_symbol?: string) => string;
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
import Dec from 'decimal.js';
|
|
22
22
|
import { assetAmountInWei, getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
23
23
|
import { AaveVersions, } from '../../types';
|
|
24
|
-
import {
|
|
24
|
+
import { getNativeAssetFromWrapped, getWrappedNativeAssetFromUnwrapped } from '../../services/utils';
|
|
25
25
|
import { aprToApy, calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos, } from '../../moneymarket';
|
|
26
26
|
import { calculateNetApy } from '../../staking';
|
|
27
27
|
import { borrowOperations } from '../../constants';
|
|
@@ -52,7 +52,7 @@ export const aaveAnyGetSuppliableAsCollAssets = (_a) => {
|
|
|
52
52
|
return aaveAnyGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest)).filter(({ canBeCollateral }) => canBeCollateral);
|
|
53
53
|
};
|
|
54
54
|
export const aaveAnyGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, assetsData, }, _asset) => {
|
|
55
|
-
const asset =
|
|
55
|
+
const asset = getNativeAssetFromWrapped(_asset);
|
|
56
56
|
const assetData = assetsData[asset];
|
|
57
57
|
const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || { collateralAssets: [], collateralFactor: '0', liquidationRatio: '0' };
|
|
58
58
|
if (eModeCategory === 0
|
|
@@ -110,7 +110,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
|
|
|
110
110
|
const params = actions.map(({ action, asset, amount }) => {
|
|
111
111
|
const isDebtAsset = borrowOperations.includes(action);
|
|
112
112
|
const amountInWei = assetAmountInWei(amount, asset);
|
|
113
|
-
const assetInfo = getAssetInfo(
|
|
113
|
+
const assetInfo = getAssetInfo(getWrappedNativeAssetFromUnwrapped(asset), network);
|
|
114
114
|
let liquidityAdded;
|
|
115
115
|
let liquidityTaken;
|
|
116
116
|
if (isDebtAsset) {
|
|
@@ -132,7 +132,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
|
|
|
132
132
|
const data = yield viewContract.read.getApyAfterValuesEstimation([selectedMarket.providerAddress, params]);
|
|
133
133
|
const rates = {};
|
|
134
134
|
data.forEach((d) => {
|
|
135
|
-
const asset =
|
|
135
|
+
const asset = getNativeAssetFromWrapped(getAssetInfoByAddress(d.reserveAddress, network).symbol);
|
|
136
136
|
rates[asset] = {
|
|
137
137
|
supplyRate: aprToApy(new Dec(d.supplyRate.toString()).div(1e25).toString()),
|
|
138
138
|
borrowRate: aprToApy(new Dec(d.variableBorrowRate.toString()).div(1e25).toString()),
|
|
@@ -151,8 +151,10 @@ export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
|
151
151
|
.replace(/^aEth/, '')
|
|
152
152
|
.replace(/^aArb/, '')
|
|
153
153
|
.replace(/^aOpt/, '')
|
|
154
|
+
.replace(/^aLin/, '')
|
|
155
|
+
.replace(/^aPla/, '')
|
|
154
156
|
.replace(/^aBas/, '');
|
|
155
157
|
if (symbol.startsWith('a'))
|
|
156
158
|
symbol = symbol.slice(1);
|
|
157
|
-
return
|
|
159
|
+
return getNativeAssetFromWrapped(symbol);
|
|
158
160
|
};
|
|
@@ -56,4 +56,4 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
|
|
|
56
56
|
supplyApy: string;
|
|
57
57
|
borrowApy: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare const getMorphoUnderlyingSymbol: (_symbol: string) =>
|
|
59
|
+
export declare const getMorphoUnderlyingSymbol: (_symbol: string) => string;
|