@defisaver/positions-sdk 2.1.9-dev-spark-2 → 2.1.9-fluid-plasma1
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/CLAUDE.md +32 -0
- package/README.md +64 -64
- package/cjs/config/contracts.d.ts +12 -0
- package/cjs/config/contracts.js +7 -3
- package/cjs/fluid/index.js +44 -23
- 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/fluid/index.d.ts +46 -0
- package/cjs/markets/fluid/index.js +436 -1
- package/cjs/portfolio/index.js +1 -1
- package/cjs/services/priceService.js +1 -1
- package/cjs/spark/index.d.ts +1 -3
- package/cjs/spark/index.js +24 -24
- package/cjs/types/fluid.d.ts +30 -1
- package/cjs/types/fluid.js +31 -1
- package/cjs/types/spark.d.ts +4 -3
- package/esm/config/contracts.d.ts +12 -0
- package/esm/config/contracts.js +7 -3
- package/esm/fluid/index.js +45 -24
- 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/fluid/index.d.ts +46 -0
- package/esm/markets/fluid/index.js +415 -1
- package/esm/portfolio/index.js +1 -1
- package/esm/services/priceService.js +2 -2
- package/esm/spark/index.d.ts +1 -3
- package/esm/spark/index.js +25 -25
- package/esm/types/fluid.d.ts +30 -1
- package/esm/types/fluid.js +30 -0
- package/esm/types/spark.d.ts +4 -3
- 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 -97
- 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 +1255 -1251
- 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 +1693 -1668
- package/src/helpers/aaveHelpers/index.ts +187 -187
- 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 +155 -158
- 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 -54
- package/src/markets/compound/index.ts +238 -238
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2460
- 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 -12
- 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 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +445 -456
- package/src/staking/eligibility.ts +53 -53
- 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 -107
- 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 +483 -452
- 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 +135 -133
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
package/cjs/spark/index.js
CHANGED
|
@@ -28,6 +28,7 @@ const sparkEmodeCategoriesMapping = (extractedState, usedAssets) => {
|
|
|
28
28
|
const usedAssetsValues = Object.values(usedAssets);
|
|
29
29
|
const categoriesMapping = {};
|
|
30
30
|
Object.values(assetsData).forEach((a) => {
|
|
31
|
+
var _a;
|
|
31
32
|
const borrowingOnlyFromCategory = a.eModeCategory === 0
|
|
32
33
|
? true
|
|
33
34
|
: !usedAssetsValues.filter(u => u.isBorrowed && u.eModeCategory !== a.eModeCategory).length;
|
|
@@ -38,6 +39,8 @@ const sparkEmodeCategoriesMapping = (extractedState, usedAssets) => {
|
|
|
38
39
|
enteringTerms,
|
|
39
40
|
canEnterCategory: !enteringTerms.includes(false),
|
|
40
41
|
id: a.eModeCategory,
|
|
42
|
+
data: a.eModeCategoryData,
|
|
43
|
+
assets: a.eModeCategory === 0 ? [] : [...(((_a = categoriesMapping[a.eModeCategory]) === null || _a === void 0 ? void 0 : _a.assets) || []), a.symbol],
|
|
41
44
|
enabledData: {
|
|
42
45
|
ratio: afterEnteringCategory.ratio,
|
|
43
46
|
liqRatio: afterEnteringCategory.liqRatio,
|
|
@@ -53,17 +56,18 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
53
56
|
const marketAddress = selectedMarket.providerAddress;
|
|
54
57
|
const loanInfoContract = (0, contracts_1.SparkViewContractViem)(provider, network);
|
|
55
58
|
const sparkIncentivesContract = (0, contracts_1.SparkIncentiveDataProviderContractViem)(provider, network);
|
|
56
|
-
|
|
57
|
-
let [loanInfo, rewardInfo] = yield Promise.all([
|
|
59
|
+
const [loanInfo, _rewardInfo] = yield Promise.all([
|
|
58
60
|
loanInfoContract.read.getFullTokensInfo([marketAddress, selectedMarket.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(a)).address)]),
|
|
59
|
-
sparkIncentivesContract.read.getReservesIncentivesData([marketAddress]),
|
|
61
|
+
network === common_1.NetworkNumber.Opt ? sparkIncentivesContract.read.getReservesIncentivesData([marketAddress]) : [],
|
|
60
62
|
]);
|
|
61
|
-
rewardInfo =
|
|
62
|
-
|
|
63
|
-
all
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
let rewardInfo = [];
|
|
64
|
+
if (network === common_1.NetworkNumber.Opt) {
|
|
65
|
+
rewardInfo = rewardInfo.reduce((all, market) => {
|
|
66
|
+
// eslint-disable-next-line no-param-reassign
|
|
67
|
+
all[market.underlyingAsset] = market;
|
|
68
|
+
return all;
|
|
69
|
+
}, {});
|
|
70
|
+
}
|
|
67
71
|
const assetsData = yield Promise.all(loanInfo
|
|
68
72
|
.map((market, i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
73
|
const symbol = selectedMarket.assets[i];
|
|
@@ -78,15 +82,6 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
78
82
|
if (new decimal_js_1.default(marketLiquidity).lt(0)) {
|
|
79
83
|
marketLiquidity = '0';
|
|
80
84
|
}
|
|
81
|
-
eModeCategoriesData[+market.emodeCategory.toString()] = {
|
|
82
|
-
id: +market.emodeCategory.toString(),
|
|
83
|
-
label: market.label,
|
|
84
|
-
liquidationBonus: new decimal_js_1.default(market.liquidationBonus).div(10000).toString(),
|
|
85
|
-
liquidationRatio: new decimal_js_1.default(market.liquidationThreshold).div(10000).toString(),
|
|
86
|
-
collateralFactor: new decimal_js_1.default(market.ltv).div(10000).toString(),
|
|
87
|
-
collateralAssets: eModeCategoriesData[+market.emodeCategory.toString()] ? [...eModeCategoriesData[+market.emodeCategory.toString()].collateralAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
88
|
-
borrowAssets: eModeCategoriesData[+market.emodeCategory.toString()] ? [...eModeCategoriesData[+market.emodeCategory.toString()].borrowAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
89
|
-
};
|
|
90
85
|
return ({
|
|
91
86
|
symbol: selectedMarket.assets[i],
|
|
92
87
|
isIsolated: new decimal_js_1.default(market.debtCeilingForIsolationMode.toString()).gt(0),
|
|
@@ -121,6 +116,13 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
121
116
|
isolationModeBorrowingEnabled: market.isolationModeBorrowingEnabled,
|
|
122
117
|
isFlashLoanEnabled: market.isFlashLoanEnabled,
|
|
123
118
|
aTokenAddress: market.aTokenAddress,
|
|
119
|
+
eModeCategoryData: {
|
|
120
|
+
label: market.label,
|
|
121
|
+
liquidationBonus: new decimal_js_1.default(market.liquidationBonus).div(10000).toString(),
|
|
122
|
+
liquidationRatio: new decimal_js_1.default(market.liquidationThreshold).div(10000).toString(),
|
|
123
|
+
collateralFactor: new decimal_js_1.default(market.ltv).div(10000).toString(),
|
|
124
|
+
priceSource: market.priceSource,
|
|
125
|
+
},
|
|
124
126
|
supplyIncentives: [],
|
|
125
127
|
borrowIncentives: [],
|
|
126
128
|
});
|
|
@@ -152,7 +154,7 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
152
154
|
return;
|
|
153
155
|
rewardForMarket.aIncentiveData.rewardsTokenInformation.forEach(supplyRewardData => {
|
|
154
156
|
if (supplyRewardData) {
|
|
155
|
-
if (
|
|
157
|
+
if (supplyRewardData.emissionEndTimestamp * 1000 < Date.now())
|
|
156
158
|
return;
|
|
157
159
|
const supplyEmissionPerSecond = supplyRewardData.emissionPerSecond;
|
|
158
160
|
const supplyRewardPrice = new decimal_js_1.default(supplyRewardData.rewardPriceFeed).div(Math.pow(10, supplyRewardData.priceFeedDecimals))
|
|
@@ -173,7 +175,7 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
173
175
|
});
|
|
174
176
|
rewardForMarket.vIncentiveData.rewardsTokenInformation.forEach(borrowRewardData => {
|
|
175
177
|
if (borrowRewardData) {
|
|
176
|
-
if (
|
|
178
|
+
if (borrowRewardData.emissionEndTimestamp * 1000 < Date.now())
|
|
177
179
|
return;
|
|
178
180
|
const supplyEmissionPerSecond = borrowRewardData.emissionPerSecond;
|
|
179
181
|
const supplyRewardPrice = new decimal_js_1.default(borrowRewardData.rewardPriceFeed).div(Math.pow(10, borrowRewardData.priceFeedDecimals))
|
|
@@ -205,9 +207,7 @@ const _getSparkMarketsData = (provider, network, selectedMarket) => __awaiter(vo
|
|
|
205
207
|
.forEach((assetData, i) => {
|
|
206
208
|
payload[assetData.symbol] = Object.assign(Object.assign({}, assetData), { sortIndex: i });
|
|
207
209
|
});
|
|
208
|
-
|
|
209
|
-
eModeCategoriesData[0].borrowAssets = Object.values(payload).map(a => a.symbol);
|
|
210
|
-
return { assetsData: payload, eModeCategoriesData };
|
|
210
|
+
return { assetsData: payload };
|
|
211
211
|
});
|
|
212
212
|
exports._getSparkMarketsData = _getSparkMarketsData;
|
|
213
213
|
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 +349,7 @@ const getSparkAccountData = (provider, network, address, extractedState) => __aw
|
|
|
349
349
|
exports.getSparkAccountData = getSparkAccountData;
|
|
350
350
|
const getSparkFullPositionData = (provider, network, address, market) => __awaiter(void 0, void 0, void 0, function* () {
|
|
351
351
|
const marketData = yield (0, exports.getSparkMarketsData)(provider, network, market);
|
|
352
|
-
const positionData = yield (0, exports.getSparkAccountData)(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market
|
|
352
|
+
const positionData = yield (0, exports.getSparkAccountData)(provider, network, address, { assetsData: marketData.assetsData, selectedMarket: market });
|
|
353
353
|
return positionData;
|
|
354
354
|
});
|
|
355
355
|
exports.getSparkFullPositionData = getSparkFullPositionData;
|
package/cjs/types/fluid.d.ts
CHANGED
|
@@ -142,7 +142,30 @@ export declare enum FluidBaseVersions {
|
|
|
142
142
|
FLUID_LBTC_USDC_21_BASE = "FLUID_LBTC_USDC_21_BASE",
|
|
143
143
|
FLUID_LBTC_SUSDS_22_BASE = "FLUID_LBTC_SUSDS_22_BASE"
|
|
144
144
|
}
|
|
145
|
-
export
|
|
145
|
+
export declare enum FluidPlasmaVersions {
|
|
146
|
+
FLUID_ETH_USDT_1_PLASMA = "FLUID_ETH_USDT_1_PLASMA",
|
|
147
|
+
FLUID_ETH_USDE_2_PLASMA = "FLUID_ETH_USDE_2_PLASMA",
|
|
148
|
+
FLUID_WEETH_ETH_3_PLASMA = "FLUID_WEETH_ETH_3_PLASMA",
|
|
149
|
+
FLUID_SUSDE_USDT_4_PLASMA = "FLUID_SUSDE_USDT_4_PLASMA",
|
|
150
|
+
FLUID_WEETH_USDT_5_PLASMA = "FLUID_WEETH_USDT_5_PLASMA",
|
|
151
|
+
FLUID_WEETH_USDE_6_PLASMA = "FLUID_WEETH_USDE_6_PLASMA",
|
|
152
|
+
FLUID_XAUT_USDT_7_PLASMA = "FLUID_XAUT_USDT_7_PLASMA",
|
|
153
|
+
FLUID_XAUT_USDE_8_PLASMA = "FLUID_XAUT_USDE_8_PLASMA",
|
|
154
|
+
FLUID_USDE_USDT_9_PLASMA = "FLUID_USDE_USDT_9_PLASMA",
|
|
155
|
+
FLUID_USDE_USDT_10_PLASMA = "FLUID_USDE_USDT_10_PLASMA",
|
|
156
|
+
FLUID_WEETH_ETH_ETH_11_PLASMA = "FLUID_WEETH_ETH_ETH_11_PLASMA",
|
|
157
|
+
FLUID_SUSDE_USDT_USDT_12_PLASMA = "FLUID_SUSDE_USDT_USDT_12_PLASMA",
|
|
158
|
+
FLUID_USDE_USDT_USDT_13_PLASMA = "FLUID_USDE_USDT_USDT_13_PLASMA",
|
|
159
|
+
FLUID_USDAI_USDT_USDT_14_PLASMA = "FLUID_USDAI_USDT_USDT_14_PLASMA",
|
|
160
|
+
FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA = "FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA",
|
|
161
|
+
FLUID_XPL_USDT_16_PLASMA = "FLUID_XPL_USDT_16_PLASMA",
|
|
162
|
+
FLUID_XPL_USDE_17_PLASMA = "FLUID_XPL_USDE_17_PLASMA",
|
|
163
|
+
FLUID_WSTUSR_USDT_18_PLASMA = "FLUID_WSTUSR_USDT_18_PLASMA",
|
|
164
|
+
FLUID_WSTUSR_USDT_USDT_19_PLASMA = "FLUID_WSTUSR_USDT_USDT_19_PLASMA",
|
|
165
|
+
FLUID_SYRUPUSDT_USDT_20_PLASMA = "FLUID_SYRUPUSDT_USDT_20_PLASMA",
|
|
166
|
+
FLUID_ETH_WRSETH_ETH_21_PLASMA = "FLUID_ETH_WRSETH_ETH_21_PLASMA"
|
|
167
|
+
}
|
|
168
|
+
export type FluidVersions = FluidArbitrumVersion | FluidBaseVersions | FluidMainnetVersion | FluidPlasmaVersions;
|
|
146
169
|
export declare enum FluidMainnetDepositToken {
|
|
147
170
|
ETH = "ETH",
|
|
148
171
|
wstETH = "wstETH",
|
|
@@ -169,10 +192,16 @@ export declare enum FluidBaseDepositToken {
|
|
|
169
192
|
sUSDS = "sUSDS",
|
|
170
193
|
GHO = "GHO"
|
|
171
194
|
}
|
|
195
|
+
export declare enum FluidPlasmaDepositToken {
|
|
196
|
+
USDe = "USDe",
|
|
197
|
+
USDT = "USDT",
|
|
198
|
+
ETH = "ETH"
|
|
199
|
+
}
|
|
172
200
|
export type FluidDepositTokenByNetwork = {
|
|
173
201
|
[NetworkNumber.Eth]: FluidMainnetDepositToken;
|
|
174
202
|
[NetworkNumber.Arb]: FluidArbitrumDepositToken;
|
|
175
203
|
[NetworkNumber.Base]: FluidBaseDepositToken;
|
|
204
|
+
[NetworkNumber.Plasma]: FluidPlasmaDepositToken;
|
|
176
205
|
};
|
|
177
206
|
export declare enum FluidVaultType {
|
|
178
207
|
T1 = "T1",
|
package/cjs/types/fluid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FluidVaultType = exports.FluidBaseDepositToken = exports.FluidArbitrumDepositToken = exports.FluidMainnetDepositToken = exports.FluidBaseVersions = exports.FluidArbitrumVersion = exports.FluidMainnetVersion = void 0;
|
|
3
|
+
exports.FluidVaultType = exports.FluidPlasmaDepositToken = exports.FluidBaseDepositToken = exports.FluidArbitrumDepositToken = exports.FluidMainnetDepositToken = exports.FluidPlasmaVersions = exports.FluidBaseVersions = exports.FluidArbitrumVersion = exports.FluidMainnetVersion = void 0;
|
|
4
4
|
const common_1 = require("./common");
|
|
5
5
|
var FluidMainnetVersion;
|
|
6
6
|
(function (FluidMainnetVersion) {
|
|
@@ -128,6 +128,30 @@ var FluidBaseVersions;
|
|
|
128
128
|
FluidBaseVersions["FLUID_LBTC_USDC_21_BASE"] = "FLUID_LBTC_USDC_21_BASE";
|
|
129
129
|
FluidBaseVersions["FLUID_LBTC_SUSDS_22_BASE"] = "FLUID_LBTC_SUSDS_22_BASE";
|
|
130
130
|
})(FluidBaseVersions || (exports.FluidBaseVersions = FluidBaseVersions = {}));
|
|
131
|
+
var FluidPlasmaVersions;
|
|
132
|
+
(function (FluidPlasmaVersions) {
|
|
133
|
+
FluidPlasmaVersions["FLUID_ETH_USDT_1_PLASMA"] = "FLUID_ETH_USDT_1_PLASMA";
|
|
134
|
+
FluidPlasmaVersions["FLUID_ETH_USDE_2_PLASMA"] = "FLUID_ETH_USDE_2_PLASMA";
|
|
135
|
+
FluidPlasmaVersions["FLUID_WEETH_ETH_3_PLASMA"] = "FLUID_WEETH_ETH_3_PLASMA";
|
|
136
|
+
FluidPlasmaVersions["FLUID_SUSDE_USDT_4_PLASMA"] = "FLUID_SUSDE_USDT_4_PLASMA";
|
|
137
|
+
FluidPlasmaVersions["FLUID_WEETH_USDT_5_PLASMA"] = "FLUID_WEETH_USDT_5_PLASMA";
|
|
138
|
+
FluidPlasmaVersions["FLUID_WEETH_USDE_6_PLASMA"] = "FLUID_WEETH_USDE_6_PLASMA";
|
|
139
|
+
FluidPlasmaVersions["FLUID_XAUT_USDT_7_PLASMA"] = "FLUID_XAUT_USDT_7_PLASMA";
|
|
140
|
+
FluidPlasmaVersions["FLUID_XAUT_USDE_8_PLASMA"] = "FLUID_XAUT_USDE_8_PLASMA";
|
|
141
|
+
FluidPlasmaVersions["FLUID_USDE_USDT_9_PLASMA"] = "FLUID_USDE_USDT_9_PLASMA";
|
|
142
|
+
FluidPlasmaVersions["FLUID_USDE_USDT_10_PLASMA"] = "FLUID_USDE_USDT_10_PLASMA";
|
|
143
|
+
FluidPlasmaVersions["FLUID_WEETH_ETH_ETH_11_PLASMA"] = "FLUID_WEETH_ETH_ETH_11_PLASMA";
|
|
144
|
+
FluidPlasmaVersions["FLUID_SUSDE_USDT_USDT_12_PLASMA"] = "FLUID_SUSDE_USDT_USDT_12_PLASMA";
|
|
145
|
+
FluidPlasmaVersions["FLUID_USDE_USDT_USDT_13_PLASMA"] = "FLUID_USDE_USDT_USDT_13_PLASMA";
|
|
146
|
+
FluidPlasmaVersions["FLUID_USDAI_USDT_USDT_14_PLASMA"] = "FLUID_USDAI_USDT_USDT_14_PLASMA";
|
|
147
|
+
FluidPlasmaVersions["FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA"] = "FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA";
|
|
148
|
+
FluidPlasmaVersions["FLUID_XPL_USDT_16_PLASMA"] = "FLUID_XPL_USDT_16_PLASMA";
|
|
149
|
+
FluidPlasmaVersions["FLUID_XPL_USDE_17_PLASMA"] = "FLUID_XPL_USDE_17_PLASMA";
|
|
150
|
+
FluidPlasmaVersions["FLUID_WSTUSR_USDT_18_PLASMA"] = "FLUID_WSTUSR_USDT_18_PLASMA";
|
|
151
|
+
FluidPlasmaVersions["FLUID_WSTUSR_USDT_USDT_19_PLASMA"] = "FLUID_WSTUSR_USDT_USDT_19_PLASMA";
|
|
152
|
+
FluidPlasmaVersions["FLUID_SYRUPUSDT_USDT_20_PLASMA"] = "FLUID_SYRUPUSDT_USDT_20_PLASMA";
|
|
153
|
+
FluidPlasmaVersions["FLUID_ETH_WRSETH_ETH_21_PLASMA"] = "FLUID_ETH_WRSETH_ETH_21_PLASMA";
|
|
154
|
+
})(FluidPlasmaVersions || (exports.FluidPlasmaVersions = FluidPlasmaVersions = {}));
|
|
131
155
|
var FluidMainnetDepositToken;
|
|
132
156
|
(function (FluidMainnetDepositToken) {
|
|
133
157
|
FluidMainnetDepositToken["ETH"] = "ETH";
|
|
@@ -157,6 +181,12 @@ var FluidBaseDepositToken;
|
|
|
157
181
|
FluidBaseDepositToken["sUSDS"] = "sUSDS";
|
|
158
182
|
FluidBaseDepositToken["GHO"] = "GHO";
|
|
159
183
|
})(FluidBaseDepositToken || (exports.FluidBaseDepositToken = FluidBaseDepositToken = {}));
|
|
184
|
+
var FluidPlasmaDepositToken;
|
|
185
|
+
(function (FluidPlasmaDepositToken) {
|
|
186
|
+
FluidPlasmaDepositToken["USDe"] = "USDe";
|
|
187
|
+
FluidPlasmaDepositToken["USDT"] = "USDT";
|
|
188
|
+
FluidPlasmaDepositToken["ETH"] = "ETH";
|
|
189
|
+
})(FluidPlasmaDepositToken || (exports.FluidPlasmaDepositToken = FluidPlasmaDepositToken = {}));
|
|
160
190
|
var FluidVaultType;
|
|
161
191
|
(function (FluidVaultType) {
|
|
162
192
|
FluidVaultType["T1"] = "T1";
|
package/cjs/types/spark.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EModeCategoriesData } from './aave';
|
|
2
1
|
import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
3
2
|
export declare enum SparkVersions {
|
|
4
3
|
SparkV1 = "v1default"
|
|
@@ -14,6 +13,8 @@ export interface SparkEModeCategoryDataMapping {
|
|
|
14
13
|
enteringTerms: boolean[];
|
|
15
14
|
canEnterCategory: boolean;
|
|
16
15
|
id: number;
|
|
16
|
+
data: SparkEModeCategoryData;
|
|
17
|
+
assets: string[];
|
|
17
18
|
enabledData: {
|
|
18
19
|
ratio: string;
|
|
19
20
|
liqRatio: string;
|
|
@@ -44,6 +45,7 @@ export interface SparkAssetData extends MMAssetData {
|
|
|
44
45
|
usageAsCollateralEnabled: boolean;
|
|
45
46
|
isIsolated: boolean;
|
|
46
47
|
eModeCategory: number;
|
|
48
|
+
eModeCategoryData: SparkEModeCategoryData;
|
|
47
49
|
liquidationRatio: string;
|
|
48
50
|
}
|
|
49
51
|
export interface SparkAssetsData {
|
|
@@ -51,7 +53,6 @@ export interface SparkAssetsData {
|
|
|
51
53
|
}
|
|
52
54
|
export type SparkMarketsData = {
|
|
53
55
|
assetsData: SparkAssetsData;
|
|
54
|
-
eModeCategoriesData: EModeCategoriesData;
|
|
55
56
|
};
|
|
56
57
|
export interface SparkUsedAsset extends MMUsedAsset {
|
|
57
58
|
stableBorrowRate: string;
|
|
@@ -70,7 +71,7 @@ export interface SparkUsedAssets {
|
|
|
70
71
|
export interface SparkHelperCommon {
|
|
71
72
|
usedAssets: SparkUsedAssets;
|
|
72
73
|
eModeCategory: number;
|
|
73
|
-
|
|
74
|
+
eModeCategories?: object;
|
|
74
75
|
assetsData: SparkAssetsData;
|
|
75
76
|
selectedMarket?: SparkMarketData;
|
|
76
77
|
network?: NetworkNumber;
|
|
@@ -71006,6 +71006,9 @@ export declare const ETHPriceFeed: {
|
|
|
71006
71006
|
readonly "42161": {
|
|
71007
71007
|
readonly address: "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612";
|
|
71008
71008
|
};
|
|
71009
|
+
readonly "9745": {
|
|
71010
|
+
readonly address: "0x43A7dd2125266c5c4c26EB86cd61241132426Fe7";
|
|
71011
|
+
};
|
|
71009
71012
|
};
|
|
71010
71013
|
};
|
|
71011
71014
|
export declare const BTCPriceFeed: {
|
|
@@ -71415,6 +71418,9 @@ export declare const BTCPriceFeed: {
|
|
|
71415
71418
|
readonly "42161": {
|
|
71416
71419
|
readonly address: "0x6ce185860a4963106506C203335A2910413708e9";
|
|
71417
71420
|
};
|
|
71421
|
+
readonly "9745": {
|
|
71422
|
+
readonly address: "0x3Bc5434dd1Fc6a1B68625e0269B9818cDd9E21B5";
|
|
71423
|
+
};
|
|
71418
71424
|
};
|
|
71419
71425
|
};
|
|
71420
71426
|
export declare const USDCPriceFeed: {
|
|
@@ -75037,6 +75043,9 @@ export declare const DFSFeedRegistry: {
|
|
|
75037
75043
|
readonly "42161": {
|
|
75038
75044
|
readonly address: "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd";
|
|
75039
75045
|
};
|
|
75046
|
+
readonly "9745": {
|
|
75047
|
+
readonly address: "0x2226836ec16FF5974dFD8DF740CD461B42FAffD5";
|
|
75048
|
+
};
|
|
75040
75049
|
};
|
|
75041
75050
|
};
|
|
75042
75051
|
export declare const LlamaLendView: {
|
|
@@ -81995,6 +82004,9 @@ export declare const FluidView: {
|
|
|
81995
82004
|
readonly "8453": {
|
|
81996
82005
|
readonly address: "0x6cd4D6af4F292817eA2A2311F099dF26cd015028";
|
|
81997
82006
|
};
|
|
82007
|
+
readonly "9745": {
|
|
82008
|
+
readonly address: "0x27C0BAe2338cE28097122393faF90375B9395dd1";
|
|
82009
|
+
};
|
|
81998
82010
|
readonly "42161": {
|
|
81999
82011
|
readonly address: "0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71";
|
|
82000
82012
|
};
|
package/esm/config/contracts.js
CHANGED
|
@@ -985,7 +985,8 @@ export const ETHPriceFeed = {
|
|
|
985
985
|
"1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" },
|
|
986
986
|
"10": { "address": "0x13e3Ee699D1909E989722E753853AE30b17e08c5" },
|
|
987
987
|
"8453": { "address": "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70" },
|
|
988
|
-
"42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" }
|
|
988
|
+
"42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" },
|
|
989
|
+
"9745": { "address": "0x43A7dd2125266c5c4c26EB86cd61241132426Fe7" },
|
|
989
990
|
},
|
|
990
991
|
};
|
|
991
992
|
export const BTCPriceFeed = {
|
|
@@ -994,7 +995,8 @@ export const BTCPriceFeed = {
|
|
|
994
995
|
"1": { "address": "0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c" },
|
|
995
996
|
"10": { "address": "0xD702DD976Fb76Fffc2D3963D037dfDae5b04E593" },
|
|
996
997
|
"8453": { "address": "0x64c911996D3c6aC71f9b455B1E8E7266BcbD848F" },
|
|
997
|
-
"42161": { "address": "0x6ce185860a4963106506C203335A2910413708e9" }
|
|
998
|
+
"42161": { "address": "0x6ce185860a4963106506C203335A2910413708e9" },
|
|
999
|
+
"9745": { "address": "0x3Bc5434dd1Fc6a1B68625e0269B9818cDd9E21B5" }
|
|
998
1000
|
},
|
|
999
1001
|
};
|
|
1000
1002
|
export const USDCPriceFeed = {
|
|
@@ -1062,7 +1064,8 @@ export const DFSFeedRegistry = {
|
|
|
1062
1064
|
"abi": [{ "inputs": [], "name": "NonContractCall", "type": "error" }, { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, { "inputs": [], "name": "SenderNotOwner", "type": "error" }, { "inputs": [], "name": "adminVault", "outputs": [{ "internalType": "contract AdminVault", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "aggregators", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "getFeed", "outputs": [{ "internalType": "address", "name": "aggregator", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "kill", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }, { "internalType": "address", "name": "aggregator", "type": "address" }], "name": "setFeed", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address[]", "name": "bases", "type": "address[]" }, { "internalType": "address[]", "name": "quotes", "type": "address[]" }, { "internalType": "address[]", "name": "aggregator", "type": "address[]" }], "name": "setFeeds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_token", "type": "address" }, { "internalType": "address", "name": "_receiver", "type": "address" }, { "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "withdrawStuckFunds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
|
|
1063
1065
|
"networks": {
|
|
1064
1066
|
"8453": { "address": "0x7dFF34190d0307fC234fc7E8C152C9715083eB02" },
|
|
1065
|
-
"42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" }
|
|
1067
|
+
"42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" },
|
|
1068
|
+
"9745": { "address": "0x2226836ec16FF5974dFD8DF740CD461B42FAffD5" }
|
|
1066
1069
|
}
|
|
1067
1070
|
};
|
|
1068
1071
|
export const LlamaLendView = {
|
|
@@ -1122,6 +1125,7 @@ export const FluidView = {
|
|
|
1122
1125
|
"networks": {
|
|
1123
1126
|
"1": { "address": "0xc8df052bD7A8d76a34c09e758Dff3c6298C0115c" },
|
|
1124
1127
|
"8453": { "address": "0x6cd4D6af4F292817eA2A2311F099dF26cd015028" },
|
|
1128
|
+
"9745": { "address": "0x27C0BAe2338cE28097122393faF90375B9395dd1" },
|
|
1125
1129
|
"42161": { "address": "0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71" }
|
|
1126
1130
|
}
|
|
1127
1131
|
};
|
package/esm/fluid/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { assetAmountInEth, getAssetInfo, getAssetInfoByAddress, } from '@defisav
|
|
|
12
12
|
import { IncentiveKind, NetworkNumber, } from '../types/common';
|
|
13
13
|
import { FluidVaultType, } from '../types';
|
|
14
14
|
import { BTCPriceFeedContractViem, DFSFeedRegistryContractViem, ETHPriceFeedContractViem, FeedRegistryContractViem, FluidViewContractViem, } from '../contracts';
|
|
15
|
-
import { compareAddresses, DEFAULT_TIMEOUT, getEthAmountForDecimals, isMainnetNetwork, } from '../services/utils';
|
|
15
|
+
import { compareAddresses, DEFAULT_TIMEOUT, getEthAmountForDecimals, getNativeAssetFromWrapped, isMainnetNetwork, } from '../services/utils';
|
|
16
16
|
import { getFluidAggregatedData, mergeAssetData, mergeUsedAssets, parseDexBorrowData, parseDexSupplyData, } from '../helpers/fluidHelpers';
|
|
17
17
|
import { getFluidMarketInfoById, getFluidVersionsDataForNetwork, getFTokenAddress } from '../markets';
|
|
18
18
|
import { USD_QUOTE, ZERO_ADDRESS } from '../constants';
|
|
@@ -66,7 +66,7 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
66
66
|
const chainLinkFeedAddress = getChainlinkAssetAddress(assetInfo.symbol, network);
|
|
67
67
|
if (assetInfo.symbol === 'wstETH')
|
|
68
68
|
return getWstETHChainLinkPriceCalls(client, network);
|
|
69
|
-
if (assetInfo.symbol === 'weETH')
|
|
69
|
+
if (assetInfo.symbol === 'weETH' && network !== NetworkNumber.Plasma)
|
|
70
70
|
return getWeETHChainLinkPriceCalls(client, network);
|
|
71
71
|
if (isMainnet) {
|
|
72
72
|
const feedRegistryContract = FeedRegistryContractViem(client, NetworkNumber.Eth);
|
|
@@ -92,7 +92,7 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
92
92
|
const btcPriceChainlink = new Dec(results[1].result).div(1e8).toString();
|
|
93
93
|
let offset = 2; // wstETH and weETH has 3 calls, while others have only 1, so we need to keep track. First 2 are static calls for eth and btc prices
|
|
94
94
|
return noDuplicateTokens.reduce((acc, token, i) => {
|
|
95
|
-
var _a;
|
|
95
|
+
var _a, _b;
|
|
96
96
|
const assetInfo = getAssetInfoByAddress(token, network);
|
|
97
97
|
switch (assetInfo.symbol) {
|
|
98
98
|
case 'USDA':
|
|
@@ -128,16 +128,31 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
130
|
case 'weETH': {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
if (network !== NetworkNumber.Plasma) {
|
|
132
|
+
const { ethPrice, weETHRate, } = parseWeETHPriceCalls(results[i + offset].result.toString(),
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
results[i + offset + 1].result[1].toString(), results[i + offset + 2].result.toString());
|
|
135
|
+
offset += 2;
|
|
136
|
+
acc[token] = new Dec(ethPrice).mul(weETHRate).toString();
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
}
|
|
139
|
+
else if ((_a = results[i + offset].result) === null || _a === void 0 ? void 0 : _a[1]) {
|
|
140
|
+
// For Plasma, use default chainlink feed (latestRoundData format)
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
acc[token] = new Dec(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
143
|
+
}
|
|
144
|
+
else if (results[i + offset].result) {
|
|
145
|
+
// For Plasma, use default chainlink feed (latestAnswer format)
|
|
146
|
+
acc[token] = new Dec(results[i + offset].result.toString()).div(1e8).toString();
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
acc[token] = '0';
|
|
150
|
+
}
|
|
136
151
|
break;
|
|
137
152
|
}
|
|
138
153
|
default:
|
|
139
154
|
// @ts-ignore
|
|
140
|
-
if ((
|
|
155
|
+
if ((_b = results[i + offset].result) === null || _b === void 0 ? void 0 : _b[1]) {
|
|
141
156
|
// @ts-ignore
|
|
142
157
|
acc[token] = new Dec(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
143
158
|
}
|
|
@@ -170,8 +185,14 @@ const getTokenPriceFromChainlink = (asset, network, provider) => __awaiter(void
|
|
|
170
185
|
else {
|
|
171
186
|
// Currently only base network is supported
|
|
172
187
|
const feedRegistryContract = DFSFeedRegistryContractViem(provider, network);
|
|
173
|
-
|
|
174
|
-
|
|
188
|
+
try {
|
|
189
|
+
const roundPriceData = isTokenUSDA ? [0, '100000000'] : yield feedRegistryContract.read.latestRoundData([loanTokenFeedAddress, USD_QUOTE]);
|
|
190
|
+
loanTokenPrice = roundPriceData[1].toString();
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
console.error(`Error fetching price for ${asset.symbol} on ${network}: ${err}`);
|
|
194
|
+
loanTokenPrice = '0';
|
|
195
|
+
}
|
|
175
196
|
}
|
|
176
197
|
return new Dec(loanTokenPrice).div(1e8).toString();
|
|
177
198
|
});
|
|
@@ -208,8 +229,8 @@ const getTradingApy = (poolAddress) => __awaiter(void 0, void 0, void 0, functio
|
|
|
208
229
|
});
|
|
209
230
|
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) {
|
|
210
231
|
var _a, _b;
|
|
211
|
-
const collAsset = getAssetInfoByAddress(data.supplyToken0, network);
|
|
212
|
-
const debtAsset = getAssetInfoByAddress(data.borrowToken0, network);
|
|
232
|
+
const collAsset = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken0, network).symbol), network);
|
|
233
|
+
const debtAsset = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken0, network).symbol), network);
|
|
213
234
|
const supplyRate = new Dec(data.supplyRateVault).div(100).toString();
|
|
214
235
|
const borrowRate = new Dec(data.borrowRateVault).div(100).toString();
|
|
215
236
|
const oracleScaleFactor = new Dec(27).add(debtAsset.decimals).sub(collAsset.decimals).toString();
|
|
@@ -318,9 +339,9 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
318
339
|
});
|
|
319
340
|
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) {
|
|
320
341
|
var _a, _b, _c;
|
|
321
|
-
const collAsset0 = getAssetInfoByAddress(data.supplyToken0, network);
|
|
322
|
-
const collAsset1 = getAssetInfoByAddress(data.supplyToken1, network);
|
|
323
|
-
const debtAsset = getAssetInfoByAddress(data.borrowToken0, network);
|
|
342
|
+
const collAsset0 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken0, network).symbol), network);
|
|
343
|
+
const collAsset1 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken1, network).symbol), network);
|
|
344
|
+
const debtAsset = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken0, network).symbol), network);
|
|
324
345
|
// 18 because collateral is represented in shares for which they use 18 decimals
|
|
325
346
|
const oracleScaleFactor = new Dec(27).add(debtAsset.decimals).sub(18).toString();
|
|
326
347
|
const oracleScale = new Dec(10).pow(oracleScaleFactor).toString();
|
|
@@ -471,9 +492,9 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
471
492
|
});
|
|
472
493
|
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) {
|
|
473
494
|
var _a, _b, _c, _d;
|
|
474
|
-
const collAsset = getAssetInfoByAddress(data.supplyToken0, network);
|
|
475
|
-
const debtAsset0 = getAssetInfoByAddress(data.borrowToken0, network);
|
|
476
|
-
const debtAsset1 = getAssetInfoByAddress(data.borrowToken1, network);
|
|
495
|
+
const collAsset = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken0, network).symbol), network);
|
|
496
|
+
const debtAsset0 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken0, network).symbol), network);
|
|
497
|
+
const debtAsset1 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken1, network).symbol), network);
|
|
477
498
|
const { borrowableShares, maxBorrowShares, borrowDexFee, utilizationBorrow0, utilizationBorrow1, borrowable0, borrowable1, borrowRate0, borrowRate1, totalBorrowShares, token0PerBorrowShare, token1PerBorrowShare, borrowableToken0, borrowableToken1, totalBorrowToken0, totalBorrowToken1, reservesBorrowToken0, reservesBorrowToken1, } = parseDexBorrowData(data.dexBorrowData, debtAsset0.symbol, debtAsset1.symbol);
|
|
478
499
|
// 18 because debt is represented in shares for which they use 18 decimals
|
|
479
500
|
const oracleScaleFactor = new Dec(27).add(18).sub(collAsset.decimals).toString();
|
|
@@ -620,10 +641,10 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
620
641
|
});
|
|
621
642
|
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) {
|
|
622
643
|
var _a, _b, _c, _d;
|
|
623
|
-
const collAsset0 = getAssetInfoByAddress(data.supplyToken0, network);
|
|
624
|
-
const collAsset1 = getAssetInfoByAddress(data.supplyToken1, network);
|
|
625
|
-
const debtAsset0 = getAssetInfoByAddress(data.borrowToken0, network);
|
|
626
|
-
const debtAsset1 = getAssetInfoByAddress(data.borrowToken1, network);
|
|
644
|
+
const collAsset0 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken0, network).symbol), network);
|
|
645
|
+
const collAsset1 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.supplyToken1, network).symbol), network);
|
|
646
|
+
const debtAsset0 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken0, network).symbol), network);
|
|
647
|
+
const debtAsset1 = getAssetInfo(getNativeAssetFromWrapped(getAssetInfoByAddress(data.borrowToken1, network).symbol), network);
|
|
627
648
|
const quoteToken = getAssetInfoByAddress(data.dexBorrowData.quoteToken, network);
|
|
628
649
|
// 27 - 18 + 18
|
|
629
650
|
const oracleScaleFactor = new Dec(27).toString();
|
|
@@ -1170,7 +1191,7 @@ const getTokenPricePortfolio = (token, provider, network) => __awaiter(void 0, v
|
|
|
1170
1191
|
if (token === 'wstETH') {
|
|
1171
1192
|
return getWstETHPrice(provider, network);
|
|
1172
1193
|
}
|
|
1173
|
-
if (token === 'weETH') {
|
|
1194
|
+
if (token === 'weETH' && network !== NetworkNumber.Plasma) {
|
|
1174
1195
|
return getWeETHPrice(provider, network);
|
|
1175
1196
|
}
|
|
1176
1197
|
const isMainnet = isMainnetNetwork(network);
|
|
@@ -118,73 +118,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
|
|
|
118
118
|
return { borrowRate, supplyRate };
|
|
119
119
|
});
|
|
120
120
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
121
|
-
const MARKET_QUERY = `
|
|
122
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
-
reallocatableLiquidityAssets
|
|
125
|
-
targetBorrowUtilization
|
|
126
|
-
loanAsset {
|
|
127
|
-
address
|
|
128
|
-
decimals
|
|
129
|
-
priceUsd
|
|
130
|
-
}
|
|
131
|
-
state {
|
|
132
|
-
liquidityAssets
|
|
133
|
-
borrowAssets
|
|
134
|
-
supplyAssets
|
|
135
|
-
}
|
|
136
|
-
publicAllocatorSharedLiquidity {
|
|
137
|
-
assets
|
|
138
|
-
vault {
|
|
139
|
-
address
|
|
140
|
-
name
|
|
141
|
-
}
|
|
142
|
-
allocationMarket {
|
|
143
|
-
uniqueKey
|
|
144
|
-
loanAsset {
|
|
145
|
-
address
|
|
146
|
-
}
|
|
147
|
-
collateralAsset {
|
|
148
|
-
address
|
|
149
|
-
}
|
|
150
|
-
irmAddress
|
|
151
|
-
oracle {
|
|
152
|
-
address
|
|
153
|
-
}
|
|
154
|
-
lltv
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
loanAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
collateralAsset {
|
|
161
|
-
address
|
|
162
|
-
}
|
|
163
|
-
oracle {
|
|
164
|
-
address
|
|
165
|
-
}
|
|
166
|
-
irmAddress
|
|
167
|
-
lltv
|
|
168
|
-
}
|
|
169
|
-
}
|
|
121
|
+
const MARKET_QUERY = `
|
|
122
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
+
reallocatableLiquidityAssets
|
|
125
|
+
targetBorrowUtilization
|
|
126
|
+
loanAsset {
|
|
127
|
+
address
|
|
128
|
+
decimals
|
|
129
|
+
priceUsd
|
|
130
|
+
}
|
|
131
|
+
state {
|
|
132
|
+
liquidityAssets
|
|
133
|
+
borrowAssets
|
|
134
|
+
supplyAssets
|
|
135
|
+
}
|
|
136
|
+
publicAllocatorSharedLiquidity {
|
|
137
|
+
assets
|
|
138
|
+
vault {
|
|
139
|
+
address
|
|
140
|
+
name
|
|
141
|
+
}
|
|
142
|
+
allocationMarket {
|
|
143
|
+
uniqueKey
|
|
144
|
+
loanAsset {
|
|
145
|
+
address
|
|
146
|
+
}
|
|
147
|
+
collateralAsset {
|
|
148
|
+
address
|
|
149
|
+
}
|
|
150
|
+
irmAddress
|
|
151
|
+
oracle {
|
|
152
|
+
address
|
|
153
|
+
}
|
|
154
|
+
lltv
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
loanAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
collateralAsset {
|
|
161
|
+
address
|
|
162
|
+
}
|
|
163
|
+
oracle {
|
|
164
|
+
address
|
|
165
|
+
}
|
|
166
|
+
irmAddress
|
|
167
|
+
lltv
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
170
|
`;
|
|
171
|
-
const REWARDS_QUERY = `
|
|
172
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
-
uniqueKey
|
|
175
|
-
state {
|
|
176
|
-
rewards {
|
|
177
|
-
amountPerSuppliedToken
|
|
178
|
-
supplyApr
|
|
179
|
-
amountPerBorrowedToken
|
|
180
|
-
borrowApr
|
|
181
|
-
asset {
|
|
182
|
-
address
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
171
|
+
const REWARDS_QUERY = `
|
|
172
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
+
uniqueKey
|
|
175
|
+
state {
|
|
176
|
+
rewards {
|
|
177
|
+
amountPerSuppliedToken
|
|
178
|
+
supplyApr
|
|
179
|
+
amountPerBorrowedToken
|
|
180
|
+
borrowApr
|
|
181
|
+
asset {
|
|
182
|
+
address
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
188
|
`;
|
|
189
189
|
/**
|
|
190
190
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -7,19 +7,19 @@ export declare const sparkIsInIsolationMode: ({ usedAssets, assetsData }: {
|
|
|
7
7
|
export declare const sparkGetCollSuppliedAssets: ({ usedAssets }: {
|
|
8
8
|
usedAssets: SparkUsedAssets;
|
|
9
9
|
}) => import("../../types").SparkUsedAsset[];
|
|
10
|
-
export declare const sparkGetSuppliableAssets: ({ usedAssets, eModeCategory, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
10
|
+
export declare const sparkGetSuppliableAssets: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
11
11
|
symbol: string;
|
|
12
12
|
canBeCollateral: boolean;
|
|
13
13
|
}[];
|
|
14
|
-
export declare const sparkGetSuppliableAsCollAssets: ({ usedAssets, eModeCategory, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
14
|
+
export declare const sparkGetSuppliableAsCollAssets: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
15
15
|
symbol: string;
|
|
16
16
|
canBeCollateral: boolean;
|
|
17
17
|
}[];
|
|
18
|
-
export declare const sparkGetEmodeMutableProps: ({ eModeCategory,
|
|
18
|
+
export declare const sparkGetEmodeMutableProps: ({ eModeCategory, assetsData, }: SparkHelperCommon, _asset: string) => {
|
|
19
19
|
liquidationRatio: string;
|
|
20
20
|
collateralFactor: string;
|
|
21
21
|
};
|
|
22
|
-
export declare const sparkGetAggregatedPositionData: ({ usedAssets, eModeCategory,
|
|
22
|
+
export declare const sparkGetAggregatedPositionData: ({ usedAssets, eModeCategory, eModeCategories, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => SparkAggregatedPositionData;
|
|
23
23
|
export declare const getApyAfterValuesEstimation: (selectedMarket: SparkMarketData, actions: [{
|
|
24
24
|
action: string;
|
|
25
25
|
amount: string;
|