@gearbox-protocol/sdk 3.0.0-prevfour.1 → 3.0.0-prevfour.11

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.
Files changed (44) hide show
  1. package/contracts/index.sol +4 -0
  2. package/lib/apy/defiLamaAPY.js +5 -0
  3. package/lib/apy/index.d.ts +3 -2
  4. package/lib/apy/index.js +12 -0
  5. package/lib/apy/skyAPY.d.ts +6 -0
  6. package/lib/apy/skyAPY.js +31 -0
  7. package/lib/apy/yearnAPY.js +4 -1
  8. package/lib/core/creditAccount.d.ts +8 -4
  9. package/lib/core/creditAccount.js +21 -26
  10. package/lib/core/creditAccount.spec.js +72 -31
  11. package/lib/core/rewardClaimer/index.d.ts +2 -1
  12. package/lib/core/rewardClaimer/index.js +2 -2
  13. package/lib/core/rewardClaimer/stakingRewards.d.ts +3 -2
  14. package/lib/core/rewardClaimer/stakingRewards.js +7 -5
  15. package/lib/core/strategy.d.ts +3 -17
  16. package/lib/core/strategy.js +4 -16
  17. package/lib/gearboxRewards/api.d.ts +5 -2
  18. package/lib/gearboxRewards/api.js +11 -10
  19. package/lib/index.d.ts +0 -5
  20. package/lib/index.js +0 -5
  21. package/lib/tokens/tokenData.js +6 -0
  22. package/lib/types/IPendleMarket.d.ts +43 -0
  23. package/lib/types/IPendleMarket.js +35 -0
  24. package/lib/types/IPendleSY.d.ts +11 -0
  25. package/lib/types/IPendleSY.js +15 -0
  26. package/lib/types/IPendleYT.d.ts +31 -0
  27. package/lib/types/IPendleYT.js +29 -0
  28. package/lib/types/PendleTWAPPTPriceFeed.d.ts +201 -0
  29. package/lib/types/PendleTWAPPTPriceFeed.js +131 -0
  30. package/lib/types/index.d.ts +4 -0
  31. package/lib/types/index.js +4 -0
  32. package/package.json +3 -3
  33. package/lib/core/bot.d.ts +0 -12
  34. package/lib/core/bot.js +0 -23
  35. package/lib/core/gauge.d.ts +0 -40
  36. package/lib/core/gauge.js +0 -64
  37. package/lib/core/gaugeMath.d.ts +0 -41
  38. package/lib/core/gaugeMath.js +0 -105
  39. package/lib/core/gaugeMath.spec.d.ts +0 -1
  40. package/lib/core/gaugeMath.spec.js +0 -388
  41. package/lib/payload/bot.d.ts +0 -13
  42. package/lib/payload/bot.js +0 -2
  43. package/lib/payload/gauge.d.ts +0 -40
  44. package/lib/payload/gauge.js +0 -2
@@ -62,6 +62,8 @@ import {IPriceFeed} from "@gearbox-protocol/core-v2/contracts/interfaces/IPriceF
62
62
  import {ILPPriceFeed} from "@gearbox-protocol/oracles-v3/contracts/interfaces/ILPPriceFeed.sol";
63
63
  import {RedstonePriceFeed} from "@gearbox-protocol/oracles-v3/contracts/oracles/updatable/RedstonePriceFeed.sol";
64
64
  import {CompositePriceFeed} from "@gearbox-protocol/oracles-v3/contracts/oracles/CompositePriceFeed.sol";
65
+ // import {PendleTWAPPTPriceFeed} from "@gearbox-protocol/oracles-v3/contracts/oracles/pendle/PendleTWAPPTPriceFeed.sol";
66
+
65
67
 
66
68
  import {ICurveV1_2AssetsAdapter} from
67
69
  "@gearbox-protocol/integrations-v3/contracts/interfaces/curve/ICurveV1_2AssetsAdapter.sol";
@@ -74,6 +76,8 @@ import {ICurveV1_4AssetsAdapter} from
74
76
 
75
77
  import {IStakingRewardsAdapter} from
76
78
  "@gearbox-protocol/integrations-v3/contracts/interfaces/sky/IStakingRewardsAdapter.sol";
79
+
80
+
77
81
 
78
82
 
79
83
 
@@ -39,6 +39,11 @@ const NORMAL_TO_LAMA = {
39
39
  stkcvxcrvUSDTWBTCWETH: "3be97c90-d4a8-42b3-a0d0-2906ae4e9d27",
40
40
  stkcvxcrvUSDUSDC: "755fcec6-f4fd-4150-9184-60f099206694",
41
41
  stkcvxcrvUSDUSDT: "a3ffd3fe-b21c-44eb-94d5-22c80057a600",
42
+ PT_sUSDe_26DEC2024: "992d00f3-d43f-44fe-8b62-987e8610c9a8",
43
+ PT_ezETH_26DEC2024: "76953dd9-3132-49ad-ae88-b551c5b5c774",
44
+ PT_eETH_26DEC2024: "7bafc0e5-3789-4920-944f-d734d3ef0cef",
45
+ PT_LBTC_27MAR2025: "b1b3b3b4-1b3b-4b3b-8b3b-1b3b3b3b3b3b",
46
+ PT_eBTC_26DEC2024: "e093fa52-1f6a-4256-9e3e-a58490468c0e",
42
47
  },
43
48
  Optimism: { rETH: "d4b3c522-6127-4b89-bedf-83641cdcd2eb" },
44
49
  Arbitrum: {
@@ -1,7 +1,7 @@
1
1
  import { LPTokens, PartialRecord, SupportedToken } from "@gearbox-protocol/sdk-gov";
2
2
  import { Address } from "viem";
3
- type ExtraFarmTokens = Extract<SupportedToken, "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "weETH" | "ezETH" | "sfrxETH" | "USDe" | "rsETH" | "rswETH" | "pufETH" | "pzETH" | "rstETH" | "steakLRT" | "amphrETH" | "LBTC" | "Re7LRT">;
4
- type ExtraTokensWithAPY = Extract<ExtraFarmTokens, "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "sfrxETH" | "pzETH" | "ezETH" | "Re7LRT" | "rsETH" | "weETH" | "rswETH" | "rstETH" | "steakLRT" | "amphrETH" | "pufETH">;
3
+ type ExtraFarmTokens = Extract<SupportedToken, "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "weETH" | "ezETH" | "sfrxETH" | "USDe" | "rsETH" | "rswETH" | "pufETH" | "pzETH" | "rstETH" | "steakLRT" | "amphrETH" | "LBTC" | "Re7LRT" | "PT_ezETH_26DEC2024" | "PT_eETH_26DEC2024" | "PT_sUSDe_26DEC2024" | "PT_eBTC_26DEC2024" | "PT_LBTC_27MAR2025" | "eBTC">;
4
+ type ExtraTokensWithAPY = Extract<ExtraFarmTokens, "STETH" | "rETH" | "osETH" | "cbETH" | "wstETH" | "sfrxETH" | "pzETH" | "ezETH" | "Re7LRT" | "rsETH" | "weETH" | "rswETH" | "rstETH" | "steakLRT" | "amphrETH" | "pufETH" | "PT_ezETH_26DEC2024" | "PT_eETH_26DEC2024" | "PT_sUSDe_26DEC2024" | "PT_eBTC_26DEC2024" | "PT_LBTC_27MAR2025">;
5
5
  type LRTAndLSTTokens = Exclude<ExtraFarmTokens, "USDe">;
6
6
  export declare const isExtraFarmToken: (t: unknown) => t is ExtraFarmTokens;
7
7
  export declare const isLRT_LSTToken: (t: unknown) => t is LRTAndLSTTokens;
@@ -13,4 +13,5 @@ export declare const isFarmToken: (t: unknown) => t is AllLPTokens;
13
13
  export * from "./curveAPY";
14
14
  export * from "./defiLamaAPY";
15
15
  export * from "./lidoAPY";
16
+ export * from "./skyAPY";
16
17
  export * from "./yearnAPY";
package/lib/apy/index.js CHANGED
@@ -35,6 +35,12 @@ const EXTRA_FARM_TOKENS = {
35
35
  amphrETH: true,
36
36
  LBTC: true,
37
37
  Re7LRT: true,
38
+ PT_ezETH_26DEC2024: true,
39
+ PT_eETH_26DEC2024: true,
40
+ PT_sUSDe_26DEC2024: true,
41
+ PT_eBTC_26DEC2024: true,
42
+ PT_LBTC_27MAR2025: true,
43
+ eBTC: true,
38
44
  };
39
45
  const isExtraFarmToken = (t) => {
40
46
  if (typeof t !== "string")
@@ -59,6 +65,11 @@ const EXTRA_TOKENS_WITH_APY = {
59
65
  steakLRT: true,
60
66
  amphrETH: true,
61
67
  pufETH: true,
68
+ PT_ezETH_26DEC2024: true,
69
+ PT_eETH_26DEC2024: true,
70
+ PT_sUSDe_26DEC2024: true,
71
+ PT_eBTC_26DEC2024: true,
72
+ PT_LBTC_27MAR2025: true,
62
73
  };
63
74
  const isExtraTokenWithAPY = (t) => {
64
75
  if (typeof t !== "string")
@@ -86,4 +97,5 @@ exports.isFarmToken = isFarmToken;
86
97
  __exportStar(require("./curveAPY"), exports);
87
98
  __exportStar(require("./defiLamaAPY"), exports);
88
99
  __exportStar(require("./lidoAPY"), exports);
100
+ __exportStar(require("./skyAPY"), exports);
89
101
  __exportStar(require("./yearnAPY"), exports);
@@ -0,0 +1,6 @@
1
+ import { PartialRecord, SupportedToken } from "@gearbox-protocol/sdk-gov";
2
+ import { Address } from "viem";
3
+ type SkyTokens = Extract<SupportedToken, "sUSDS" | "stkUSDS">;
4
+ export type SkyAPYResult = PartialRecord<SkyTokens, number>;
5
+ export declare function getSkyAPY(currentTokens: Record<SupportedToken, Address>): Promise<SkyAPYResult>;
6
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSkyAPY = void 0;
7
+ const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
8
+ const axios_1 = __importDefault(require("axios"));
9
+ const getSavingsURL = () => `https://info-sky.blockanalitica.com/save/?format=json`;
10
+ const getFarmingURL = () => `https://info-sky.blockanalitica.com/farms/?format=json`;
11
+ async function getSkyAPY(currentTokens) {
12
+ try {
13
+ const [savings, farm] = await Promise.all([
14
+ axios_1.default.get(getSavingsURL()),
15
+ axios_1.default.get(getFarmingURL()),
16
+ ]);
17
+ const savingsRate = savings?.data?.ssr_rate || 0;
18
+ const farmRate = farm?.data?.sky_farm.apy || 0;
19
+ return {
20
+ [currentTokens.sUSDS]: numberToAPY(Number(savingsRate)),
21
+ [currentTokens.stkUSDS]: numberToAPY(Number(farmRate)),
22
+ };
23
+ }
24
+ catch (e) {
25
+ return {};
26
+ }
27
+ }
28
+ exports.getSkyAPY = getSkyAPY;
29
+ function numberToAPY(baseApy) {
30
+ return Math.round(baseApy * Number(sdk_gov_1.PERCENTAGE_FACTOR) * Number(sdk_gov_1.PERCENTAGE_DECIMALS));
31
+ }
@@ -22,7 +22,7 @@ async function getYearnAPY(network, currentTokens) {
22
22
  const { apr: apy } = data || {};
23
23
  const { netAPR } = apy || {};
24
24
  const netApy = netAPR || 0;
25
- const r = Math.round(netApy * Number(sdk_gov_1.PERCENTAGE_FACTOR) * Number(sdk_gov_1.PERCENTAGE_DECIMALS));
25
+ const r = numberToAPY(netApy);
26
26
  acc[address] = r;
27
27
  return acc;
28
28
  }, {});
@@ -33,3 +33,6 @@ async function getYearnAPY(network, currentTokens) {
33
33
  }
34
34
  }
35
35
  exports.getYearnAPY = getYearnAPY;
36
+ function numberToAPY(baseApy) {
37
+ return Math.round(baseApy * Number(sdk_gov_1.PERCENTAGE_FACTOR) * Number(sdk_gov_1.PERCENTAGE_DECIMALS));
38
+ }
@@ -17,12 +17,14 @@ export interface CalcOverallAPYProps {
17
17
  debt: bigint | undefined;
18
18
  baseRateWithFee: number;
19
19
  underlyingToken: Address;
20
+ tokensList: Record<Address, TokenData>;
20
21
  }
21
22
  export interface CalcMaxLendingDebtProps {
22
23
  assets: Array<Asset>;
23
24
  prices: Record<Address, bigint>;
24
25
  liquidationThresholds: Record<Address, bigint>;
25
26
  underlyingToken: Address;
27
+ tokensList: Record<Address, TokenData>;
26
28
  targetHF?: bigint;
27
29
  }
28
30
  export interface CalcHealthFactorProps {
@@ -33,6 +35,7 @@ export interface CalcHealthFactorProps {
33
35
  liquidationThresholds: Record<Address, bigint>;
34
36
  underlyingToken: Address;
35
37
  debt: bigint;
38
+ tokensList: Record<Address, TokenData>;
36
39
  }
37
40
  export interface CalcDefaultQuotaProps {
38
41
  amount: bigint;
@@ -83,6 +86,7 @@ interface LiquidationPriceProps {
83
86
  underlyingToken: Address;
84
87
  targetToken: Address;
85
88
  assets: Record<Address, Asset>;
89
+ tokensList: Record<Address, TokenData>;
86
90
  }
87
91
  export interface TimeToLiquidationProps {
88
92
  totalBorrowRate_debt: bigint;
@@ -126,11 +130,11 @@ export declare class CreditAccountData {
126
130
  isQuoted(token: Address): boolean;
127
131
  isTokenEnabled(token: Address): boolean;
128
132
  static calcMaxDebtIncrease(healthFactor: number, debt: bigint, underlyingLT: number, minHf?: number): bigint;
129
- static calcMaxLendingDebt({ assets, liquidationThresholds, underlyingToken, prices, targetHF, }: CalcMaxLendingDebtProps): bigint;
130
- static calcOverallAPY({ caAssets, lpAPY, prices, quotas, quotaRates, feeInterest, totalValue, debt, baseRateWithFee, underlyingToken, }: CalcOverallAPYProps): bigint | undefined;
133
+ static calcMaxLendingDebt({ assets, liquidationThresholds, underlyingToken, prices, tokensList, targetHF, }: CalcMaxLendingDebtProps): bigint;
134
+ static calcOverallAPY({ caAssets, lpAPY, prices, quotas, quotaRates, feeInterest, totalValue, debt, baseRateWithFee, underlyingToken, tokensList, }: CalcOverallAPYProps): bigint | undefined;
131
135
  hash(): string;
132
136
  static hash(creditManager: Address, borrower: Address): string;
133
- static calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, }: CalcHealthFactorProps): number;
137
+ static calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, tokensList, }: CalcHealthFactorProps): number;
134
138
  static roundUpQuota(quotaChange: bigint): bigint;
135
139
  static calcRecommendedQuota({ amount, debt, lt, quotaReserve, }: CalcRecommendedQuotaProps): bigint;
136
140
  static calcDefaultQuota({ amount, lt, quotaReserve }: CalcDefaultQuotaProps): bigint;
@@ -138,7 +142,7 @@ export declare class CreditAccountData {
138
142
  private static getSingleQuotaChange;
139
143
  static calcQuotaBorrowRate({ quotas, quotaRates }: CalcQuotaBorrowRateProps): bigint;
140
144
  static calcRelativeBaseBorrowRate({ debt, baseRateWithFee, assetAmountInUnderlying, }: CalcRelativeBaseBorrowRateProps): bigint;
141
- static liquidationPrice({ liquidationThresholds, debt, underlyingToken, targetToken, assets, }: LiquidationPriceProps): bigint;
145
+ static liquidationPrice({ liquidationThresholds, debt, underlyingToken, targetToken, assets, tokensList, }: LiquidationPriceProps): bigint;
142
146
  /**
143
147
  * Calculates the time remaining until liquidation for a credit account.
144
148
  * @returns The time remaining until liquidation in milliseconds.
@@ -157,9 +157,9 @@ class CreditAccountData {
157
157
  const result = (debt * BigInt(healthFactor - minHf)) / BigInt(minHf - underlyingLT);
158
158
  return math_1.BigIntMath.max(0n, result);
159
159
  }
160
- static calcMaxLendingDebt({ assets, liquidationThresholds, underlyingToken, prices, targetHF = sdk_gov_1.PERCENTAGE_FACTOR, }) {
160
+ static calcMaxLendingDebt({ assets, liquidationThresholds, underlyingToken, prices, tokensList, targetHF = sdk_gov_1.PERCENTAGE_FACTOR, }) {
161
161
  const assetsLTMoney = assets.reduce((acc, { token: tokenAddress, balance: amount }) => {
162
- const [, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(tokenAddress);
162
+ const tokenDecimals = tokensList[tokenAddress]?.decimals || 18;
163
163
  const lt = liquidationThresholds[tokenAddress] || 0n;
164
164
  const price = prices[tokenAddress] || 0n;
165
165
  const tokenMoney = price_1.PriceUtils.calcTotalPrice(price, amount, tokenDecimals);
@@ -167,7 +167,7 @@ class CreditAccountData {
167
167
  return acc + tokenLtMoney;
168
168
  }, 0n);
169
169
  const underlyingPrice = prices[underlyingToken] || 0n;
170
- const [, underlyingDecimals = 18] = (0, sdk_gov_1.extractTokenData)(underlyingToken);
170
+ const underlyingDecimals = tokensList[underlyingToken]?.decimals || 18;
171
171
  // HF = TWV / D => D = TWV / HF; D = amount * price
172
172
  // Debt_max = sum(LT_i * Asset_i * price_i) / (price_underlying * HF)
173
173
  const max = underlyingPrice > 0
@@ -178,26 +178,23 @@ class CreditAccountData {
178
178
  : 0n;
179
179
  return max;
180
180
  }
181
- static calcOverallAPY({ caAssets, lpAPY, prices, quotas, quotaRates, feeInterest, totalValue, debt, baseRateWithFee, underlyingToken, }) {
181
+ static calcOverallAPY({ caAssets, lpAPY, prices, quotas, quotaRates, feeInterest, totalValue, debt, baseRateWithFee, underlyingToken, tokensList, }) {
182
182
  if (!lpAPY ||
183
183
  !totalValue ||
184
184
  totalValue <= 0n ||
185
185
  !debt ||
186
186
  totalValue <= debt)
187
187
  return undefined;
188
- const underlyingTokenAddressLC = underlyingToken.toLowerCase();
189
- const underlyingTokenSymbol = sdk_gov_1.tokenSymbolByAddress[underlyingTokenAddressLC] || "";
190
- const underlyingTokenDecimals = sdk_gov_1.decimals[underlyingTokenSymbol] || 18;
191
- const underlyingPrice = prices[underlyingTokenAddressLC];
188
+ const underlyingTokenDecimals = tokensList[underlyingToken]?.decimals || 18;
189
+ const underlyingPrice = prices[underlyingToken];
192
190
  const assetAPYMoney = caAssets.reduce((acc, { token: tokenAddress, balance: amount }) => {
193
- const tokenAddressLC = tokenAddress.toLowerCase();
194
- const [_, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(tokenAddressLC);
195
- const apy = lpAPY[tokenAddressLC] || 0;
196
- const price = prices[tokenAddressLC] || 0n;
191
+ const tokenDecimals = tokensList[tokenAddress]?.decimals || 18;
192
+ const apy = lpAPY[tokenAddress] || 0;
193
+ const price = prices[tokenAddress] || 0n;
197
194
  const money = price_1.PriceUtils.calcTotalPrice(price, amount, tokenDecimals);
198
195
  const apyMoney = money * BigInt(apy);
199
- const { rate: quotaAPY = 0n, isActive = false } = quotaRates?.[tokenAddressLC] || {};
200
- const { balance: quotaBalance = 0n } = quotas[tokenAddressLC] || {};
196
+ const { rate: quotaAPY = 0n, isActive = false } = quotaRates?.[tokenAddress] || {};
197
+ const { balance: quotaBalance = 0n } = quotas[tokenAddress] || {};
201
198
  const quotaAmount = isActive ? quotaBalance : 0n;
202
199
  const quotaMoney = price_1.PriceUtils.calcTotalPrice(underlyingPrice || 0n, quotaAmount, underlyingTokenDecimals);
203
200
  const quotaRate = (quotaAPY * (BigInt(feeInterest) + sdk_gov_1.PERCENTAGE_FACTOR)) /
@@ -220,13 +217,13 @@ class CreditAccountData {
220
217
  static hash(creditManager, borrower) {
221
218
  return `${creditManager.toLowerCase()}:${borrower.toLowerCase()}`;
222
219
  }
223
- static calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, }) {
220
+ static calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, tokensList, }) {
224
221
  if (debt === 0n)
225
222
  return MAX_UINT16;
226
- const [, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(underlyingToken);
223
+ const underlyingDecimals = tokensList[underlyingToken]?.decimals || 18;
227
224
  const underlyingPrice = prices[underlyingToken] || 0n;
228
225
  const assetMoney = assets.reduce((acc, { token: tokenAddress, balance: amount }) => {
229
- const [, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(tokenAddress);
226
+ const tokenDecimals = tokensList[tokenAddress]?.decimals || 18;
230
227
  const lt = liquidationThresholds[tokenAddress] || 0n;
231
228
  const price = prices[tokenAddress] || 0n;
232
229
  const tokenMoney = price_1.PriceUtils.calcTotalPrice(price, amount, tokenDecimals);
@@ -371,19 +368,17 @@ class CreditAccountData {
371
368
  static calcRelativeBaseBorrowRate({ debt, baseRateWithFee, assetAmountInUnderlying, }) {
372
369
  return debt * BigInt(baseRateWithFee) * assetAmountInUnderlying;
373
370
  }
374
- static liquidationPrice({ liquidationThresholds, debt, underlyingToken, targetToken, assets, }) {
375
- const underlyingTokenLC = underlyingToken.toLowerCase();
376
- const [, underlyingDecimals = 18] = (0, sdk_gov_1.extractTokenData)(underlyingTokenLC);
377
- const { balance: underlyingBalance = 0n } = assets[underlyingTokenLC] || {};
371
+ static liquidationPrice({ liquidationThresholds, debt, underlyingToken, targetToken, assets, tokensList, }) {
372
+ const underlyingDecimals = tokensList[underlyingToken]?.decimals || 18;
373
+ const { balance: underlyingBalance = 0n } = assets[underlyingToken] || {};
378
374
  // effectiveDebt = Debt - underlyingBalance*LTunderlying
379
- const ltUnderlying = liquidationThresholds[underlyingTokenLC] || 0n;
375
+ const ltUnderlying = liquidationThresholds[underlyingToken] || 0n;
380
376
  const effectiveDebt = ((debt - (underlyingBalance * ltUnderlying) / sdk_gov_1.PERCENTAGE_FACTOR) * sdk_gov_1.WAD) /
381
377
  10n ** BigInt(underlyingDecimals);
382
- const targetTokenLC = targetToken.toLowerCase();
383
- const [, targetDecimals = 18] = (0, sdk_gov_1.extractTokenData)(targetTokenLC);
384
- const { balance: targetBalance = 0n } = assets[targetTokenLC] || {};
378
+ const targetDecimals = tokensList[targetToken]?.decimals || 18;
379
+ const { balance: targetBalance = 0n } = assets[targetToken] || {};
385
380
  const effectiveTargetBalance = (targetBalance * sdk_gov_1.WAD) / 10n ** BigInt(targetDecimals);
386
- const lpLT = liquidationThresholds[targetTokenLC] || 0n;
381
+ const lpLT = liquidationThresholds[targetToken] || 0n;
387
382
  if (targetBalance <= 0n || lpLT <= 0n)
388
383
  return 0n;
389
384
  // priceTarget = effectiveDebt / (lpLT*targetBalance)