@1delta/margin-fetcher 5.0.55 → 5.0.57

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/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { parseAbi, keccak256, encodeAbiParameters, formatEther, BaseError, erc20Abi, stringToHex, isAddress, pad, encodeFunctionData, formatUnits, getAddress, decodeFunctionResult, decodeAbiParameters, concat, AbiEncodingLengthMismatchError, concatHex, toBytes, slice, hexToString, InvalidAddressError, boolToHex, integerRegex, numberToHex, bytesRegex, BytesSizeMismatchError, arrayRegex, UnsupportedPackedAbiType } from './chunk-YILYOOYB.js';
2
2
  import './chunk-BYTNVMX7.js';
3
3
  import './chunk-PR4QN5HX.js';
4
- import { Lender, isExactly, isMidnight, isTerm, isTermMax, isTeller, isListaDao, isLiquityFamily, isRiver, isInverse, isDssType, isCompoundV3Type, isFluid, isGearboxV3, isLlamaLend, isFrankencoin, isResupply, isCurvance, isTwyne, isFraxlend, LIQUITY_FAMILY_LENDERS, isAaveType, isCompoundV3, isMultiMarket, isSiloV2Type, isSiloV3Type, isDolomite, hasCrossMarginRisk, isEulerType, isAaveV4Type, isInit, isMorphoType, isCompoundV2Type, isVenusType, isSumerType, AAVE_V3_LENDERS, AAVE_V2_LENDERS, isMorphoBlue, isAaveV2Type, isAaveV32Type, isAaveV3Type, isUsdd, isSky, isYLDR, isLista, hasSubAccounts, isTectonicType, isKineticType, isBenqiType } from '@1delta/lender-registry';
4
+ import { Lender, isExactly, isMidnight, isTerm, isTermMax, isTeller, isListaDao, isLiquityFamily, isRiver, isInverse, isCooler, isDssType, isCompoundV3Type, isFluid, isGearboxV3, isLlamaLend, isFrankencoin, isResupply, isCurvance, isTwyne, isFraxlend, LIQUITY_FAMILY_LENDERS, isAaveType, isCompoundV3, isMultiMarket, isSiloV2Type, isSiloV3Type, isDolomite, hasCrossMarginRisk, isEulerType, isAaveV4Type, isInit, isMorphoType, isCompoundV2Type, isVenusType, isSumerType, AAVE_V3_LENDERS, AAVE_V2_LENDERS, isMorphoBlue, isAaveV2Type, isAaveV32Type, isAaveV3Type, isUsdd, isSky, isYLDR, isLista, hasSubAccounts, isTectonicType, isKineticType, isBenqiType } from '@1delta/lender-registry';
5
5
  export { hasCrossMarginRisk, isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR } from '@1delta/lender-registry';
6
- import { fetchTokenLists, fetchTokenList, aavePools, compoundV3Pools, initConfig, morphoPools, compoundV2Pools, eulerVaults, siloMarkets, siloV2LenderKey, siloMarketsV3, siloV3LenderKey, aaveV4Spokes, aaveV4SpokeLenderKey, fluidResolvers, gearboxResolvers, dolomiteConfigs, midnightConfig, termConfig, termMarketsByChain, exactlyConfig, liquityLendersByChain, riverLendersByChain, inverseLendersByChain, llamaLendLendersByChain, usddLendersByChain, skyLendersByChain, frankencoinLendersByChain, resupplyLendersByChain, curvanceLendersByChain, fraxlendLendersByChain, twyneLendersByChain, tellerConfigByChain, tellerPoolsByChain, termMaxConfigByChain, aaveReserves, compoundV3Reserves, liquityConfigFor, liquityBranchesByChain, riverConfigFor, riverChainData, termMaxApiBaseUrl, termMaxLenderKey, inverseConfigFor, inverseChainData, llamaLendConfigFor, llamaLendChainData, llamaLendApiBaseUrl, resupplyConfigFor, fraxlendConfigFor, dssConfigFor, dssChainData, dssDebtToken, dssDebtJoin, frankencoinConfigFor, frankencoinChainData, aaveOracles, morphoTypeMarkets, resolveMidnightApiBase, resolveTermApiBase, llamaLendMarketByVault, getSiloV2MarketEntry, getSiloV3MarketEntry, dolomiteEmode, curvanceConfigFor, aaveTokens, morphoTypeVaults, listaCollateralProvider, eulerConfigs, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxV3LenderKey, midnightMarketsByChain, twyneConfigFor, twyneChainData, parseAaveV4SpokeLenderKey, fraxlendPairsFor, gearboxAccountCompressor, compoundV2Tokens, exactlyMarketsByChain, aaveOraclesConfig, compoundV2Oracles, compoundV2TokenArray, compoundV2OraclesConfig, compoundV3OraclesData, compoundV3BaseData, compoundV2Reserves, aaveV4Oracles } from '@1delta/data-sdk';
6
+ import { fetchTokenLists, fetchTokenList, aavePools, compoundV3Pools, initConfig, morphoPools, compoundV2Pools, eulerVaults, siloMarkets, siloV2LenderKey, siloMarketsV3, siloV3LenderKey, aaveV4Spokes, aaveV4SpokeLenderKey, fluidResolvers, gearboxResolvers, dolomiteConfigs, midnightConfig, termConfig, termMarketsByChain, exactlyConfig, liquityLendersByChain, riverLendersByChain, inverseLendersByChain, coolerLendersByChain, llamaLendLendersByChain, usddLendersByChain, skyLendersByChain, frankencoinLendersByChain, resupplyLendersByChain, curvanceLendersByChain, fraxlendLendersByChain, twyneLendersByChain, tellerConfigByChain, tellerPoolsByChain, termMaxConfigByChain, aaveReserves, compoundV3Reserves, liquityConfigFor, liquityBranchesByChain, riverConfigFor, riverChainData, termMaxApiBaseUrl, termMaxLenderKey, inverseConfigFor, inverseChainData, coolerConfigFor, llamaLendConfigFor, llamaLendChainData, llamaLendApiBaseUrl, resupplyConfigFor, fraxlendConfigFor, dssConfigFor, dssChainData, dssDebtToken, dssDebtJoin, frankencoinConfigFor, frankencoinChainData, aaveOracles, morphoTypeMarkets, resolveMidnightApiBase, resolveTermApiBase, llamaLendMarketByVault, getSiloV2MarketEntry, getSiloV3MarketEntry, dolomiteEmode, curvanceConfigFor, aaveTokens, morphoTypeVaults, listaCollateralProvider, eulerConfigs, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxV3LenderKey, midnightMarketsByChain, twyneConfigFor, twyneChainData, parseAaveV4SpokeLenderKey, fraxlendPairsFor, gearboxAccountCompressor, compoundV2Tokens, exactlyMarketsByChain, aaveOraclesConfig, compoundV2Oracles, compoundV2TokenArray, compoundV2OraclesConfig, compoundV3OraclesData, compoundV3BaseData, compoundV2Reserves, aaveV4Oracles, morphoTypeOracles } from '@1delta/data-sdk';
7
7
  import lodash from 'lodash';
8
8
  import { Chain } from '@1delta/chain-registry';
9
9
  import { multicallRetryUniversal, getEvmClient, getEvmChain, getEvmClientUniversal } from '@1delta/providers';
10
- import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, MetaMorphoAbi, FluidDexResolverAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, TwyneCollateralVaultAbi, GearboxCreditAccountCompressorV310Abi, TwyneVaultManagerAbi, TwyneCollateralVaultFactoryAbi, AaveV2V3Abi, TwyneATokenWrapperAbi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
10
+ import { LiquityTroveManagerAbi, LiquityActivePoolAbi, LiquityStabilityPoolAbi, LiquityPriceFeedAbi, LiquitySortedTrovesAbi, RiverTroveManagerAbi, RiverStabilityPoolAbi, TellerMarketRegistryAbi, TellerV2Abi, InverseMarketAbi, InverseOracleAbi, InverseDbrAbi, Erc20Abi, CoolerMonoAbi, CoolerLtvOracleAbi, LlamaLendControllerAbi, LlamaLendControllerV1Abi, LlamaLendControllerV2Abi, LlamaLendVaultAbi, LlamaLendAmmAbi, TwyneCollateralVaultAbi, MetaMorphoAbi, FluidDexResolverAbi, ExactlyPreviewerAbi, ExactlyAuditorAbi, LenderCommitmentGroupAbi, ResupplyRegistryAbi, ResupplyPairAbi, ResupplyUtilitiesAbi, ResupplyRewardHandlerAbi, ResupplyPairEmissionsAbi, ConvexPoolUtilAbi, FraxlendPairAbi, FraxlendLeverAbi, FrankencoinPositionAbi, FluidLendingResolverAbi, FluidVaultResolverAbi, FluidLiquidityResolverAbi, MoolahVaultAbi, UsddVatAbi, UsddJugAbi, UsddSpotAbi, MorphoLensAbi, AaveV4SpokeAbi, AaveV4OracleAbi, AaveV4HubAbi, DolomiteMarginAbi, GearboxMarketCompressorV310Abi, MorphoBlueAbi, MidnightAbi, TermRepoTokenAbi, TermRepoServicerAbi, TermRepoCollateralManagerAbi, LiquityTroveNFTAbi, LiquityCollSurplusPoolAbi, TellerCollateralManagerAbi, TermMaxViewerAbi, InverseEscrowAbi, CurvanceMarketManagerAbi, CurvanceCTokenAbi, GearboxCreditAccountCompressorV310Abi, TwyneVaultManagerAbi, TwyneCollateralVaultFactoryAbi, AaveV2V3Abi, TwyneATokenWrapperAbi, UsddCdpManagerAbi, UsddProxyRegistryAbi, CurvanceProtocolReaderAbi, CurvanceCentralRegistryAbi, TermPriceConsumerAbi, CurvanceOracleManagerAbi, TermMaxOracleAggregatorV2Abi } from '@1delta/abis';
11
11
  export { MorphoLensAbi } from '@1delta/abis';
12
12
  import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses } from '@1delta/calldata-sdk';
13
13
  import { proxyNativeFetch } from '@1delta/proxy-fetch';
@@ -6418,6 +6418,9 @@ var getLendersForChain = (c) => {
6418
6418
  for (const l of inverseLendersByChain(c)) {
6419
6419
  lenders.push(l);
6420
6420
  }
6421
+ for (const l of coolerLendersByChain(c)) {
6422
+ lenders.push(l);
6423
+ }
6421
6424
  for (const l of llamaLendLendersByChain(c)) {
6422
6425
  lenders.push(l);
6423
6426
  }
@@ -22379,7 +22382,7 @@ async function fetchTellerMarkets(chainId) {
22379
22382
  } catch {
22380
22383
  return { chainId, pools: [] };
22381
22384
  }
22382
- const big20 = (i) => {
22385
+ const big22 = (i) => {
22383
22386
  const r = results[i];
22384
22387
  if (typeof r === "bigint") return r;
22385
22388
  if (typeof r === "number") return BigInt(r);
@@ -22393,20 +22396,20 @@ async function fetchTellerMarkets(chainId) {
22393
22396
  return null;
22394
22397
  };
22395
22398
  const num18 = (i) => {
22396
- const b = big20(i);
22399
+ const b = big22(i);
22397
22400
  return b === null ? null : Number(b);
22398
22401
  };
22399
22402
  const pool0 = pools.map((config, i) => {
22400
22403
  const base = i * READS_PER_POOL;
22401
22404
  return {
22402
22405
  config,
22403
- available: big20(base),
22404
- committed: big20(base + 1),
22406
+ available: big22(base),
22407
+ committed: big22(base + 1),
22405
22408
  minRateBps: num18(base + 2),
22406
- collateralPerPrincipal: big20(base + 3),
22409
+ collateralPerPrincipal: big22(base + 3),
22407
22410
  maxLoanDuration: num18(base + 4),
22408
- marketId: big20(base + 5),
22409
- totalAssets: big20(base + 6)
22411
+ marketId: big22(base + 5),
22412
+ totalAssets: big22(base + 6)
22410
22413
  };
22411
22414
  });
22412
22415
  const attByMarket = /* @__PURE__ */ new Map();
@@ -23479,6 +23482,107 @@ function num(api, key3) {
23479
23482
  const v = api?.[key3];
23480
23483
  return typeof v === "number" && Number.isFinite(v) ? v : null;
23481
23484
  }
23485
+ var SUSDS_MAX_WITHDRAW_ABI = [
23486
+ {
23487
+ name: "maxWithdraw",
23488
+ type: "function",
23489
+ stateMutability: "view",
23490
+ inputs: [{ name: "owner", type: "address" }],
23491
+ outputs: [{ type: "uint256" }]
23492
+ }
23493
+ ];
23494
+ var COOLER_PUBLIC_READ_ABI = [
23495
+ ...CoolerMonoAbi,
23496
+ ...CoolerLtvOracleAbi,
23497
+ ...SUSDS_MAX_WITHDRAW_ABI
23498
+ ];
23499
+ var big = (v) => {
23500
+ try {
23501
+ if (typeof v === "bigint") return v;
23502
+ if (typeof v === "number") return BigInt(v);
23503
+ if (typeof v === "string" && /^(0x[0-9a-fA-F]+|\d+)$/.test(v))
23504
+ return BigInt(v);
23505
+ } catch {
23506
+ }
23507
+ return null;
23508
+ };
23509
+ async function fetchCoolerMarkets(lender, chainId) {
23510
+ const config = coolerConfigFor(lender, chainId);
23511
+ const empty = {
23512
+ lender,
23513
+ config,
23514
+ totalCollateral: null,
23515
+ totalDebt: null,
23516
+ interestRateWad: null,
23517
+ oltvPrice: null,
23518
+ lltvPrice: null,
23519
+ minDebtRequired: null,
23520
+ borrowsPaused: null,
23521
+ liquidationsPaused: null,
23522
+ debtToken: null,
23523
+ collateralToken: null,
23524
+ drip: null,
23525
+ liquidationLtvPremiumBps: null,
23526
+ susdsHeadroom: null,
23527
+ source: "none"
23528
+ };
23529
+ if (!config?.monoCooler) return empty;
23530
+ const mc = config.monoCooler;
23531
+ const calls = [
23532
+ { address: mc, name: "totalCollateral", params: [] },
23533
+ { address: mc, name: "totalDebt", params: [] },
23534
+ { address: mc, name: "interestRateWad", params: [] },
23535
+ { address: mc, name: "loanToValues", params: [] },
23536
+ { address: mc, name: "minDebtRequired", params: [] },
23537
+ { address: mc, name: "borrowsPaused", params: [] },
23538
+ { address: mc, name: "liquidationsPaused", params: [] },
23539
+ { address: mc, name: "debtToken", params: [] },
23540
+ { address: mc, name: "collateralToken", params: [] },
23541
+ { address: config.ltvOracle, name: "originationLtvData", params: [] },
23542
+ { address: config.ltvOracle, name: "liquidationLtvPremiumBps", params: [] },
23543
+ { address: config.susds, name: "maxWithdraw", params: [config.treasury] }
23544
+ ];
23545
+ try {
23546
+ const results = await multicallRetryUniversal({
23547
+ chain: chainId,
23548
+ calls,
23549
+ abi: COOLER_PUBLIC_READ_ABI,
23550
+ allowFailure: true
23551
+ });
23552
+ const ltvs = results[3];
23553
+ const oltvPrice = Array.isArray(ltvs) ? big(ltvs[0]) : null;
23554
+ const lltvPrice = Array.isArray(ltvs) ? big(ltvs[1]) : null;
23555
+ const dripRaw = results[9];
23556
+ let drip = null;
23557
+ if (Array.isArray(dripRaw) && dripRaw.length >= 5) {
23558
+ const [startingValue, startTime, targetValue, targetTime, slope] = dripRaw.map(big);
23559
+ if (startingValue !== null && startTime !== null && targetValue !== null && targetTime !== null && slope !== null) {
23560
+ drip = { startingValue, startTime, targetValue, targetTime, slope };
23561
+ }
23562
+ }
23563
+ const premium = big(results[10]);
23564
+ return {
23565
+ lender,
23566
+ config,
23567
+ totalCollateral: big(results[0]),
23568
+ totalDebt: big(results[1]),
23569
+ interestRateWad: big(results[2]),
23570
+ oltvPrice,
23571
+ lltvPrice,
23572
+ minDebtRequired: big(results[4]),
23573
+ borrowsPaused: typeof results[5] === "boolean" ? results[5] : null,
23574
+ liquidationsPaused: typeof results[6] === "boolean" ? results[6] : null,
23575
+ debtToken: typeof results[7] === "string" && results[7].startsWith("0x") ? results[7] : null,
23576
+ collateralToken: typeof results[8] === "string" && results[8].startsWith("0x") ? results[8] : null,
23577
+ drip,
23578
+ liquidationLtvPremiumBps: premium !== null ? Number(premium) : null,
23579
+ susdsHeadroom: big(results[11]),
23580
+ source: "chain"
23581
+ };
23582
+ } catch {
23583
+ return empty;
23584
+ }
23585
+ }
23482
23586
  var DEFAULT_BANDS = 10;
23483
23587
  var LLAMALEND_READ_ABI = [
23484
23588
  ...LlamaLendControllerAbi,
@@ -23772,7 +23876,7 @@ var STATE_READS = 14;
23772
23876
  var ONE = 10n ** 18n;
23773
23877
  var identityCache = /* @__PURE__ */ new Map();
23774
23878
  var identityKey = (chainId, pair) => `${chainId}:${pair.toLowerCase()}`;
23775
- var big = (v) => {
23879
+ var big2 = (v) => {
23776
23880
  if (typeof v === "bigint") return v;
23777
23881
  if (typeof v === "number") return BigInt(v);
23778
23882
  return null;
@@ -23981,28 +24085,28 @@ async function fetchResupplyMarkets(lender, chainId) {
23981
24085
  const accounting = results[base + 5];
23982
24086
  const rateInfo = results[base + 6];
23983
24087
  const exchangeInfo = results[base + 7];
23984
- const tuple = (v, idx) => Array.isArray(v) ? big(v[idx]) : null;
24088
+ const tuple = (v, idx) => Array.isArray(v) ? big2(v[idx]) : null;
23985
24089
  return {
23986
24090
  identity,
23987
- maxLTV: big(results[base]),
23988
- borrowLimit: big(results[base + 1]),
23989
- liquidationFee: big(results[base + 2]),
23990
- mintFee: big(results[base + 3]),
23991
- minimumBorrowAmount: big(results[base + 4]),
24091
+ maxLTV: big2(results[base]),
24092
+ borrowLimit: big2(results[base + 1]),
24093
+ liquidationFee: big2(results[base + 2]),
24094
+ mintFee: big2(results[base + 3]),
24095
+ minimumBorrowAmount: big2(results[base + 4]),
23992
24096
  totalBorrowAmount: tuple(accounting, 1),
23993
24097
  totalBorrowShares: tuple(accounting, 2),
23994
24098
  totalCollateral: tuple(accounting, 3),
23995
24099
  ratePerSec: tuple(rateInfo, 1),
23996
24100
  exchangeRate: tuple(exchangeInfo, 2),
23997
- collateralPrice: big(results[base + 8]),
24101
+ collateralPrice: big2(results[base + 8]),
23998
24102
  // Indices follow the PUSH ORDER above exactly: the two reward reads sit
23999
24103
  // at +9/+10, BEFORE the lens block, so the lens reads are +11/+12.
24000
24104
  // (Getting this wrong is silent — it produced a 3-billion-percent APR
24001
24105
  // before the numbers were checked against a hand computation.)
24002
- convexPid: big(results[base + 9]),
24003
- rsupWeight: pairEmissions ? big(results[base + 10]) : null,
24004
- liveRatePerSec: utilities ? big(results[base + 11]) : null,
24005
- underlyingSupplyRatePerSec: utilities ? big(results[base + 12]) : null,
24106
+ convexPid: big2(results[base + 9]),
24107
+ rsupWeight: pairEmissions ? big2(results[base + 10]) : null,
24108
+ liveRatePerSec: utilities ? big2(results[base + 11]) : null,
24109
+ underlyingSupplyRatePerSec: utilities ? big2(results[base + 12]) : null,
24006
24110
  collateralRewards: []
24007
24111
  };
24008
24112
  });
@@ -24060,9 +24164,9 @@ async function readRewardContext(chainId, registry, utilities) {
24060
24164
  ],
24061
24165
  allowFailure: true
24062
24166
  });
24063
- const periodFinish = big(stream[0]);
24064
- const rewardRate = big(stream[1]);
24065
- const totalWeight = big(stream[2]);
24167
+ const periodFinish = big2(stream[0]);
24168
+ const rewardRate = big2(stream[1]);
24169
+ const totalWeight = big2(stream[2]);
24066
24170
  if (periodFinish === null || rewardRate === null || totalWeight === null || totalWeight === 0n) {
24067
24171
  return { pairEmissions, convexPoolUtil };
24068
24172
  }
@@ -24131,7 +24235,7 @@ function getCurvanceAssetRoster(chainId, lender) {
24131
24235
  // src/lending/public-data/curvance/fetchPublic.ts
24132
24236
  var FALLBACK_TOKEN_READS = 12;
24133
24237
  var zero = "0x0000000000000000000000000000000000000000";
24134
- var big2 = (v) => {
24238
+ var big3 = (v) => {
24135
24239
  if (typeof v === "bigint") return v;
24136
24240
  if (typeof v === "number") return BigInt(v);
24137
24241
  if (typeof v === "string" && v !== "0x") {
@@ -24246,41 +24350,41 @@ async function fetchViaReader(lender, chainId, config) {
24246
24350
  assetSymbol: str(t?.asset?.symbol, "?"),
24247
24351
  assetName: str(t?.asset?.name, "?"),
24248
24352
  assetDecimals: num3(t?.asset?.decimals, 18),
24249
- collRatio: big2(t?.collRatio),
24250
- collReqSoft: big2(t?.collReqSoft),
24251
- collReqHard: big2(t?.collReqHard),
24252
- liqIncBase: big2(t?.liqIncBase),
24253
- liqIncCurve: big2(t?.liqIncCurve),
24254
- closeFactorBase: big2(t?.closeFactorBase),
24255
- maxLeverage: big2(t?.maxLeverage),
24256
- collateralCap: big2(t?.collateralCap),
24257
- debtCap: big2(t?.debtCap),
24353
+ collRatio: big3(t?.collRatio),
24354
+ collReqSoft: big3(t?.collReqSoft),
24355
+ collReqHard: big3(t?.collReqHard),
24356
+ liqIncBase: big3(t?.liqIncBase),
24357
+ liqIncCurve: big3(t?.liqIncCurve),
24358
+ closeFactorBase: big3(t?.closeFactorBase),
24359
+ maxLeverage: big3(t?.maxLeverage),
24360
+ collateralCap: big3(t?.collateralCap),
24361
+ debtCap: big3(t?.debtCap),
24258
24362
  mintPaused: !!t?.mintPaused,
24259
24363
  collateralizationPaused: !!t?.collateralizationPaused,
24260
24364
  borrowPaused: !!t?.borrowPaused,
24261
24365
  redeemPaused: !!t?.redeemPaused,
24262
- totalAssets: big2(d?.totalAssets),
24263
- totalSupply: big2(d?.totalSupply),
24264
- exchangeRate: big2(d?.exchangeRate),
24265
- collateral: big2(d?.collateral),
24266
- debt: big2(d?.debt),
24267
- liquidity: big2(d?.liquidity),
24268
- assetPrice: big2(d?.assetPrice),
24269
- assetPriceLower: big2(d?.assetPriceLower),
24270
- borrowRate: big2(d?.borrowRate),
24271
- predictedBorrowRate: big2(d?.predictedBorrowRate),
24272
- supplyRate: big2(d?.supplyRate),
24273
- utilizationRate: big2(d?.utilizationRate),
24274
- interestFee: big2(t?.interestFee),
24275
- irmTargetRate: big2(t?.irmTargetRate),
24276
- irmMaxRate: big2(t?.irmMaxRate),
24277
- irmTargetUtilization: big2(t?.irmTargetUtilization)
24366
+ totalAssets: big3(d?.totalAssets),
24367
+ totalSupply: big3(d?.totalSupply),
24368
+ exchangeRate: big3(d?.exchangeRate),
24369
+ collateral: big3(d?.collateral),
24370
+ debt: big3(d?.debt),
24371
+ liquidity: big3(d?.liquidity),
24372
+ assetPrice: big3(d?.assetPrice),
24373
+ assetPriceLower: big3(d?.assetPriceLower),
24374
+ borrowRate: big3(d?.borrowRate),
24375
+ predictedBorrowRate: big3(d?.predictedBorrowRate),
24376
+ supplyRate: big3(d?.supplyRate),
24377
+ utilizationRate: big3(d?.utilizationRate),
24378
+ interestFee: big3(t?.interestFee),
24379
+ irmTargetRate: big3(t?.irmTargetRate),
24380
+ irmMaxRate: big3(t?.irmMaxRate),
24381
+ irmTargetUtilization: big3(t?.irmTargetUtilization)
24278
24382
  });
24279
24383
  }
24280
24384
  if (tokens.length === 0) continue;
24281
24385
  markets.push({
24282
24386
  marketManager,
24283
- cooldownLength: big2(m?.cooldownLength),
24387
+ cooldownLength: big3(m?.cooldownLength),
24284
24388
  // Filled in below — one batched round for every market at once.
24285
24389
  minLoanSizeUsdWad: 0n,
24286
24390
  tokens
@@ -24341,7 +24445,7 @@ async function fetchViaMulticall(lender, chainId, config) {
24341
24445
  const pairs = [];
24342
24446
  managers.forEach((mm, i) => {
24343
24447
  const toks = listed[i * 2];
24344
- const redeemPaused = big2(listed[i * 2 + 1]) === 2n;
24448
+ const redeemPaused = big3(listed[i * 2 + 1]) === 2n;
24345
24449
  if (!Array.isArray(toks)) return;
24346
24450
  for (const t of toks) {
24347
24451
  if (typeof t === "string" && t.startsWith("0x")) {
@@ -24427,9 +24531,9 @@ async function fetchViaMulticall(lender, chainId, config) {
24427
24531
  const paused = results[base + 4];
24428
24532
  const asset = results[base + 7];
24429
24533
  if (!Array.isArray(coll) || typeof asset !== "string") return;
24430
- const tuple = (v, idx) => Array.isArray(v) ? big2(v[idx]) : 0n;
24431
- const held = big2(results[base + 10]);
24432
- const debt = big2(results[base + 9]);
24534
+ const tuple = (v, idx) => Array.isArray(v) ? big3(v[idx]) : 0n;
24535
+ const held = big3(results[base + 10]);
24536
+ const debt = big3(results[base + 9]);
24433
24537
  const token = {
24434
24538
  cToken: p.cToken,
24435
24539
  symbol: str(results[base + 5], "c?"),
@@ -24446,13 +24550,13 @@ async function fetchViaMulticall(lender, chainId, config) {
24446
24550
  liqIncCurve: tuple(liq, 1),
24447
24551
  closeFactorBase: tuple(liq, 4),
24448
24552
  maxLeverage: 0n,
24449
- collateralCap: big2(results[base + 2]),
24450
- debtCap: big2(results[base + 3]),
24553
+ collateralCap: big3(results[base + 2]),
24554
+ debtCap: big3(results[base + 3]),
24451
24555
  mintPaused: Array.isArray(paused) ? !!paused[0] : false,
24452
24556
  collateralizationPaused: Array.isArray(paused) ? !!paused[1] : false,
24453
24557
  borrowPaused: Array.isArray(paused) ? !!paused[2] : false,
24454
24558
  redeemPaused: p.redeemPaused,
24455
- totalAssets: big2(results[base + 8]),
24559
+ totalAssets: big3(results[base + 8]),
24456
24560
  totalSupply: 0n,
24457
24561
  exchangeRate: 0n,
24458
24562
  collateral: 0n,
@@ -24466,7 +24570,7 @@ async function fetchViaMulticall(lender, chainId, config) {
24466
24570
  predictedBorrowRate: 0n,
24467
24571
  supplyRate: 0n,
24468
24572
  utilizationRate: held + debt > 0n ? debt * 10n ** 18n / (held + debt) : 0n,
24469
- interestFee: big2(results[base + 11]),
24573
+ interestFee: big3(results[base + 11]),
24470
24574
  irmTargetRate: 0n,
24471
24575
  irmMaxRate: 0n,
24472
24576
  irmTargetUtilization: 0n
@@ -24553,7 +24657,7 @@ var ERC20_ABI = [
24553
24657
  ];
24554
24658
  var RAY4 = 1e27;
24555
24659
  var ok = (v) => v !== void 0 && v !== null && v !== "0x";
24556
- var big3 = (v) => {
24660
+ var big4 = (v) => {
24557
24661
  if (typeof v === "bigint") return v;
24558
24662
  if (typeof v === "number") return BigInt(v);
24559
24663
  if (typeof v === "string" && /^(0x[0-9a-fA-F]+|\d+)$/.test(v)) return BigInt(v);
@@ -24661,10 +24765,10 @@ async function fetchTwyneMarkets(lender, chainId) {
24661
24765
  const pendingDebtBalances = [];
24662
24766
  markets.forEach((m, i) => {
24663
24767
  const c = i * 8;
24664
- const creditTotalAssets = big3(creditReads[c]);
24665
- const creditTotalBorrows = big3(creditReads[c + 1]);
24666
- const creditCash = big3(creditReads[c + 2]);
24667
- const creditRateSpy = big3(creditReads[c + 3]);
24768
+ const creditTotalAssets = big4(creditReads[c]);
24769
+ const creditTotalBorrows = big4(creditReads[c + 1]);
24770
+ const creditCash = big4(creditReads[c + 2]);
24771
+ const creditRateSpy = big4(creditReads[c + 3]);
24668
24772
  if (creditTotalAssets === void 0 || creditCash === void 0 || creditRateSpy === void 0) return;
24669
24773
  const aaveIdx = aaveMarkets.indexOf(m);
24670
24774
  const eulerIdx = eulerMarkets.indexOf(m);
@@ -24683,21 +24787,21 @@ async function fetchTwyneMarkets(lender, chainId) {
24683
24787
  if (ok(debtReserve) && debtReserve?.currentVariableBorrowRate !== void 0)
24684
24788
  externalBorrowRate = Number(debtReserve.currentVariableBorrowRate) / RAY4;
24685
24789
  if (ok(debtReserve)) {
24686
- const virtual = big3(debtReserve.virtualUnderlyingBalance);
24790
+ const virtual = big4(debtReserve.virtualUnderlyingBalance);
24687
24791
  if (virtual !== void 0 && virtual > 0n) externalBorrowLiquidity = virtual;
24688
24792
  else if (typeof debtReserve.aTokenAddress === "string")
24689
24793
  debtAToken = debtReserve.aTokenAddress;
24690
24794
  }
24691
24795
  } else if (eulerIdx >= 0) {
24692
24796
  const e = eulerIdx * 7;
24693
- externalLiqLtv = big3(eulerReads[e]);
24694
- const spy = big3(eulerReads[e + 1]);
24797
+ externalLiqLtv = big4(eulerReads[e]);
24798
+ const spy = big4(eulerReads[e + 1]);
24695
24799
  if (spy !== void 0) externalBorrowRate = Number(spy) / RAY4 * 31536e3;
24696
- externalBorrowLiquidity = big3(eulerReads[e + 2]);
24697
- const collSpy = big3(eulerReads[e + 3]);
24698
- const collAssets = big3(eulerReads[e + 4]);
24699
- const collBorrows = big3(eulerReads[e + 5]);
24700
- const collFeeBps = big3(eulerReads[e + 6]) ?? 0n;
24800
+ externalBorrowLiquidity = big4(eulerReads[e + 2]);
24801
+ const collSpy = big4(eulerReads[e + 3]);
24802
+ const collAssets = big4(eulerReads[e + 4]);
24803
+ const collBorrows = big4(eulerReads[e + 5]);
24804
+ const collFeeBps = big4(eulerReads[e + 6]) ?? 0n;
24701
24805
  if (collSpy !== void 0 && collAssets && collAssets > 0n) {
24702
24806
  const util = Number(collBorrows ?? 0n) / Number(collAssets);
24703
24807
  externalSupplyRate = Number(collSpy) / RAY4 * 31536e3 * util * (1 - Number(collFeeBps) / 1e4);
@@ -24705,7 +24809,7 @@ async function fetchTwyneMarkets(lender, chainId) {
24705
24809
  }
24706
24810
  const s = i * 3;
24707
24811
  if (externalBorrowLiquidity === void 0 && !debtAToken) {
24708
- externalBorrowLiquidity = big3(scaleReads[s + 2]);
24812
+ externalBorrowLiquidity = big4(scaleReads[s + 2]);
24709
24813
  }
24710
24814
  if (debtAToken) pendingDebtBalances.push({ index: out.length, token: m.targetAsset, holder: debtAToken });
24711
24815
  out.push({
@@ -24714,19 +24818,19 @@ async function fetchTwyneMarkets(lender, chainId) {
24714
24818
  creditTotalBorrows: creditTotalBorrows ?? 0n,
24715
24819
  creditCash,
24716
24820
  creditRateSpy,
24717
- creditDepositCapacity: big3(creditReads[c + 7]),
24821
+ creditDepositCapacity: big4(creditReads[c + 7]),
24718
24822
  creditDecimals: Number(creditReads[c + 4] ?? 18),
24719
24823
  creditSymbol: typeof creditReads[c + 5] === "string" ? creditReads[c + 5] : void 0,
24720
24824
  creditIrm: typeof creditReads[c + 6] === "string" ? creditReads[c + 6].toLowerCase() : m.creditIrm,
24721
24825
  externalLiqLtv,
24722
- maxTwyneLiqLtv: big3(bounds[i * 2]) ?? (m.maxTwyneLiqLTV !== void 0 ? BigInt(m.maxTwyneLiqLTV) : void 0),
24723
- externalLiqBuffer: big3(bounds[i * 2 + 1]) ?? (m.externalLiqBuffer !== void 0 ? BigInt(m.externalLiqBuffer) : void 0),
24826
+ maxTwyneLiqLtv: big4(bounds[i * 2]) ?? (m.maxTwyneLiqLTV !== void 0 ? BigInt(m.maxTwyneLiqLTV) : void 0),
24827
+ externalLiqBuffer: big4(bounds[i * 2 + 1]) ?? (m.externalLiqBuffer !== void 0 ? BigInt(m.externalLiqBuffer) : void 0),
24724
24828
  externalSupplyRate,
24725
24829
  externalBorrowRate,
24726
24830
  externalBorrowLiquidity,
24727
24831
  collateralDecimals: Number(scaleReads[s] ?? 18),
24728
24832
  targetDecimals: Number(scaleReads[s + 1] ?? 18),
24729
- collateralToUnderlying: big3(wrapperReads[i]),
24833
+ collateralToUnderlying: big4(wrapperReads[i]),
24730
24834
  // Computed HERE, never read from the roster: a stored flag goes stale,
24731
24835
  // and two of the three live PT markets have already matured.
24732
24836
  collateralMatured: !!m.collateralMaturity && m.collateralMaturity <= nowSec9,
@@ -24745,7 +24849,7 @@ async function fetchTwyneMarkets(lender, chainId) {
24745
24849
  allowFailure: true
24746
24850
  });
24747
24851
  pendingDebtBalances.forEach((p, i) => {
24748
- const v = big3(balances[i]);
24852
+ const v = big4(balances[i]);
24749
24853
  if (v !== void 0 && out[p.index]) out[p.index].externalBorrowLiquidity = v;
24750
24854
  });
24751
24855
  }
@@ -24753,7 +24857,7 @@ async function fetchTwyneMarkets(lender, chainId) {
24753
24857
  return { lender, chainId, config, markets: out };
24754
24858
  }
24755
24859
  var PAIR_READS = 15;
24756
- var big4 = (v) => {
24860
+ var big5 = (v) => {
24757
24861
  if (typeof v === "bigint") return v;
24758
24862
  if (typeof v === "number") return BigInt(v);
24759
24863
  if (typeof v === "string" && v !== "0x") {
@@ -24860,41 +24964,41 @@ async function fetchFraxlendPairs(lender, chainId) {
24860
24964
  decimals: dec(decimals),
24861
24965
  asset: asset.toLowerCase(),
24862
24966
  collateral: collateral.toLowerCase(),
24863
- maxLtv: big4(maxLtv),
24864
- ltvPrecision: big4(ltvPrec) || 100000n,
24865
- exchangePrecision: big4(exPrec) || 10n ** 18n,
24866
- liqPrecision: big4(liqPrec) || 100000n,
24967
+ maxLtv: big5(maxLtv),
24968
+ ltvPrecision: big5(ltvPrec) || 100000n,
24969
+ exchangePrecision: big5(exPrec) || 10n ** 18n,
24970
+ liqPrecision: big5(liqPrec) || 100000n,
24867
24971
  cleanLiquidationFee: 0n,
24868
24972
  dirtyLiquidationFee: 0n,
24869
24973
  protocolLiquidationFee: 0n,
24870
- depositLimit: big4(depositLimit),
24871
- borrowLimit: big4(borrowLimit),
24872
- totalAssetAmount: big4(
24974
+ depositLimit: big5(depositLimit),
24975
+ borrowLimit: big5(borrowLimit),
24976
+ totalAssetAmount: big5(
24873
24977
  totalAsset.amount ?? totalAsset[0]
24874
24978
  ),
24875
- totalAssetShares: big4(
24979
+ totalAssetShares: big5(
24876
24980
  totalAsset.shares ?? totalAsset[1]
24877
24981
  ),
24878
- totalBorrowAmount: big4(
24982
+ totalBorrowAmount: big5(
24879
24983
  totalBorrow.amount ?? totalBorrow[0]
24880
24984
  ),
24881
- totalBorrowShares: big4(
24985
+ totalBorrowShares: big5(
24882
24986
  totalBorrow.shares ?? totalBorrow[1]
24883
24987
  ),
24884
- totalCollateral: big4(totalCollateral),
24988
+ totalCollateral: big5(totalCollateral),
24885
24989
  oracle: str2(xrInfo[0], "").toLowerCase(),
24886
24990
  maxOracleDeviation: Number(xrInfo[1] ?? 0),
24887
- exchangeRateLastTimestamp: big4(xrInfo[2]),
24888
- lowExchangeRate: big4(xrInfo[3]),
24889
- highExchangeRate: big4(xrInfo[4]),
24890
- ratePerSec: big4(rateInfo.ratePerSec ?? rateInfo[3]),
24891
- fullUtilizationRate: big4(
24991
+ exchangeRateLastTimestamp: big5(xrInfo[2]),
24992
+ lowExchangeRate: big5(xrInfo[3]),
24993
+ highExchangeRate: big5(xrInfo[4]),
24994
+ ratePerSec: big5(rateInfo.ratePerSec ?? rateInfo[3]),
24995
+ fullUtilizationRate: big5(
24892
24996
  rateInfo.fullUtilizationRate ?? rateInfo[4]
24893
24997
  ),
24894
24998
  feeToProtocolRate: Number(
24895
24999
  rateInfo.feeToProtocolRate ?? rateInfo[1] ?? 0
24896
25000
  ),
24897
- rateLastTimestamp: big4(
25001
+ rateLastTimestamp: big5(
24898
25002
  rateInfo.lastTimestamp ?? rateInfo[2]
24899
25003
  ),
24900
25004
  rateContract: str2(rateContract, "").toLowerCase(),
@@ -25138,6 +25242,197 @@ function convertInverseMarketsToResponse(raw, chainId, prices = {}, _additionalY
25138
25242
  return out;
25139
25243
  }
25140
25244
 
25245
+ // src/lending/public-data/cooler/convertPublic.ts
25246
+ var WAD9 = 1e18;
25247
+ var clamp01 = (v) => Math.max(0, Math.min(1, v));
25248
+ var wadToNumber = (v) => v !== null ? Number(v) / WAD9 : 0;
25249
+ function currencyFor9(address, decimals, symbol, tokens) {
25250
+ const lower4 = address.toLowerCase();
25251
+ return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
25252
+ }
25253
+ function convertCoolerMarketsToResponse(raw, chainId, prices = {}, _additionalYields = {
25254
+ intrinsicYields: {},
25255
+ lenderRewards: {},
25256
+ loaded: true
25257
+ }, tokens = {}) {
25258
+ const out = {};
25259
+ const cfg = raw?.config;
25260
+ if (!cfg || raw.source === "none") return out;
25261
+ const lenderKey = raw.lender;
25262
+ const collAddr = (raw.collateralToken ?? cfg.gohm).toLowerCase();
25263
+ const debtAddr = (raw.debtToken ?? cfg.usds).toLowerCase();
25264
+ const collToken = tokens[collAddr];
25265
+ const debtToken = tokens[debtAddr];
25266
+ const collSymbol = collToken?.symbol ?? "gOHM";
25267
+ const debtSymbol = debtToken?.symbol ?? "USDS";
25268
+ const collDecimals = collToken?.decimals ?? 18;
25269
+ const debtDecimals = debtToken?.decimals ?? cfg.debtDecimals ?? 18;
25270
+ const collPriceKey = toOracleKey(collToken?.assetGroup) || toGenericPriceKey(collAddr, chainId);
25271
+ const collPrice = prices[collPriceKey] ?? 0;
25272
+ const debtPriceKey = toOracleKey(debtToken?.assetGroup) || toGenericPriceKey(debtAddr, chainId);
25273
+ const debtPrice = prices[debtPriceKey] || 1;
25274
+ const borrowAprPct = wadToNumber(raw.interestRateWad) * 100;
25275
+ const totalCollateral = wadToNumber(raw.totalCollateral);
25276
+ const totalDebt = wadToNumber(raw.totalDebt);
25277
+ const oltvPrice = wadToNumber(raw.oltvPrice);
25278
+ const lltvPrice = wadToNumber(raw.lltvPrice);
25279
+ const minDebt = wadToNumber(raw.minDebtRequired);
25280
+ const borrowsPaused = raw.borrowsPaused ?? false;
25281
+ const liquidationsPaused = raw.liquidationsPaused ?? false;
25282
+ const borrowCollateralFactor = collPrice > 0 ? clamp01(oltvPrice / collPrice) : 0;
25283
+ const collateralFactor = collPrice > 0 ? clamp01(lltvPrice / collPrice) : 0;
25284
+ let borrowLiquidity = wadToNumber(raw.susdsHeadroom);
25285
+ if (borrowsPaused) borrowLiquidity = 0;
25286
+ const entry = { data: {} };
25287
+ const collUid = createMarketUid(chainId, lenderKey, collAddr);
25288
+ entry.data[collUid] = {
25289
+ marketUid: collUid,
25290
+ name: "Collateral " + collSymbol,
25291
+ poolId: cfg.monoCooler.toLowerCase(),
25292
+ underlying: collAddr,
25293
+ asset: currencyFor9(collAddr, collDecimals, collSymbol, tokens),
25294
+ totalDeposits: totalCollateral,
25295
+ totalDebtStable: 0,
25296
+ totalDebt: 0,
25297
+ totalLiquidity: totalCollateral,
25298
+ borrowLiquidity: 0,
25299
+ totalLiquidityUSD: totalCollateral * collPrice,
25300
+ borrowLiquidityUSD: 0,
25301
+ totalDepositsUSD: totalCollateral * collPrice,
25302
+ totalDebtStableUSD: 0,
25303
+ totalDebtUSD: 0,
25304
+ utilization: 0,
25305
+ depositRate: 0,
25306
+ variableBorrowRate: 0,
25307
+ stableBorrowRate: 0,
25308
+ // gOHM staking emissions are ZERO today — never hardcode a carry here.
25309
+ intrinsicYield: _additionalYields?.intrinsicYields?.[collToken?.assetGroup] ?? 0,
25310
+ rewards: void 0,
25311
+ decimals: collDecimals,
25312
+ config: {
25313
+ 0: {
25314
+ category: 0,
25315
+ borrowCollateralFactor,
25316
+ collateralFactor,
25317
+ borrowFactor: 1,
25318
+ // Seized collateral is unstaked and BURNED — no liquidator bonus.
25319
+ liquidationPenalty: 0,
25320
+ closeFactor: 1,
25321
+ collateralDisabled: false,
25322
+ debtDisabled: true
25323
+ }
25324
+ },
25325
+ closeFactor: 1,
25326
+ collateralActive: true,
25327
+ borrowingEnabled: false,
25328
+ depositsEnabled: true,
25329
+ hasStable: false,
25330
+ isActive: true,
25331
+ isFrozen: false
25332
+ };
25333
+ const loanUid = createMarketUid(chainId, lenderKey, debtAddr);
25334
+ entry.data[loanUid] = {
25335
+ marketUid: loanUid,
25336
+ name: debtSymbol,
25337
+ poolId: cfg.monoCooler.toLowerCase(),
25338
+ underlying: debtAddr,
25339
+ asset: currencyFor9(debtAddr, debtDecimals, debtSymbol, tokens),
25340
+ totalDeposits: 0,
25341
+ totalDebtStable: 0,
25342
+ totalDebt,
25343
+ totalLiquidity: borrowLiquidity,
25344
+ borrowLiquidity,
25345
+ totalLiquidityUSD: borrowLiquidity * debtPrice,
25346
+ borrowLiquidityUSD: borrowLiquidity * debtPrice,
25347
+ totalDepositsUSD: 0,
25348
+ totalDebtStableUSD: 0,
25349
+ totalDebtUSD: totalDebt * debtPrice,
25350
+ utilization: 0,
25351
+ depositRate: 0,
25352
+ // Protocol-set, continuously compounded on-chain; reported nominally.
25353
+ variableBorrowRate: borrowAprPct,
25354
+ stableBorrowRate: 0,
25355
+ rateModel: "protocolSet",
25356
+ intrinsicYield: 0,
25357
+ rewards: void 0,
25358
+ decimals: debtDecimals,
25359
+ config: {
25360
+ 0: {
25361
+ category: 0,
25362
+ borrowCollateralFactor: 0,
25363
+ collateralFactor: 0,
25364
+ borrowFactor: 1,
25365
+ liquidationPenalty: 0,
25366
+ closeFactor: 1,
25367
+ collateralDisabled: true,
25368
+ debtDisabled: borrowsPaused
25369
+ }
25370
+ },
25371
+ closeFactor: 1,
25372
+ collateralActive: false,
25373
+ borrowingEnabled: !borrowsPaused,
25374
+ depositsEnabled: false,
25375
+ hasStable: false,
25376
+ variableBorrowDisabled: borrowsPaused,
25377
+ isActive: true,
25378
+ isFrozen: false
25379
+ };
25380
+ entry.params = {
25381
+ market: {
25382
+ lender: lenderKey,
25383
+ name: `${debtSymbol} / ${collSymbol}`,
25384
+ loanDecimals: debtDecimals,
25385
+ collateralDecimals: collDecimals,
25386
+ // The MonoCooler contract doubles as the market id.
25387
+ id: cfg.monoCooler.toLowerCase(),
25388
+ lltv: String(collateralFactor),
25389
+ oracle: cfg.ltvOracle,
25390
+ irm: zeroAddress,
25391
+ collateralAddress: collAddr,
25392
+ loanAddress: debtAddr,
25393
+ // --- Cooler descriptor (live snapshot; consumed by calldata builders
25394
+ // + worker-api resolvers + the term-sheet adapter) ---
25395
+ cooler: {
25396
+ monoCooler: cfg.monoCooler,
25397
+ /** Debt-token units, human string. Gates borrows AND partial repays:
25398
+ * any action leaving 0 < debt < minDebt reverts (full repay fine). */
25399
+ minDebt: String(minDebt),
25400
+ /** THE PROTOCOL TRUTH: LTVs are PRICES (debt per gOHM token), not
25401
+ * ratios — the fractional factors above are display-only. */
25402
+ oltvPrice: String(oltvPrice),
25403
+ lltvPrice: String(lltvPrice),
25404
+ /** Per-year continuously-compounded rate, raw wad string. */
25405
+ interestRateWad: raw.interestRateWad !== null ? raw.interestRateWad.toString() : void 0,
25406
+ /** The oracle's OLTV drip schedule — future OLTV in closed form. */
25407
+ drip: raw.drip ? {
25408
+ startingValue: raw.drip.startingValue.toString(),
25409
+ startTime: raw.drip.startTime.toString(),
25410
+ targetValue: raw.drip.targetValue.toString(),
25411
+ targetTime: raw.drip.targetTime.toString(),
25412
+ slope: raw.drip.slope.toString()
25413
+ } : void 0,
25414
+ /** LLTV = OLTV × (1 + premiumBps / 1e4); raisable to at most 333. */
25415
+ liquidationLtvPremiumBps: raw.liquidationLtvPremiumBps ?? void 0,
25416
+ borrowsPaused,
25417
+ liquidationsPaused,
25418
+ addresses: {
25419
+ monoCooler: cfg.monoCooler,
25420
+ ltvOracle: cfg.ltvOracle,
25421
+ treasuryBorrower: cfg.treasuryBorrower,
25422
+ treasury: cfg.treasury,
25423
+ susds: cfg.susds,
25424
+ gohm: cfg.gohm,
25425
+ /** The LIVE debt token — governance-swappable, never pin USDS. */
25426
+ debtToken: debtAddr
25427
+ }
25428
+ }
25429
+ }
25430
+ };
25431
+ entry.chainId = chainId;
25432
+ out[lenderKey] = entry;
25433
+ return out;
25434
+ }
25435
+
25141
25436
  // src/lending/public-data/llamalend/convertPublic.ts
25142
25437
  function llamaLendLenderKey(lender, controller) {
25143
25438
  return `${lender}_${controller.replace(/^0x/i, "").toUpperCase()}`;
@@ -25148,7 +25443,7 @@ function llamaLendKeyParts(key3) {
25148
25443
  if (!/^[0-9A-F]{40}$/.test(suffix)) return void 0;
25149
25444
  return { lender: "LLAMALEND", controller: "0x" + suffix.toLowerCase() };
25150
25445
  }
25151
- function currencyFor9(address, decimals, symbol, tokens) {
25446
+ function currencyFor10(address, decimals, symbol, tokens) {
25152
25447
  const lower4 = address.toLowerCase();
25153
25448
  return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
25154
25449
  }
@@ -25211,7 +25506,7 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
25211
25506
  name: "Collateral " + collSymbol,
25212
25507
  poolId: market.controller.toLowerCase(),
25213
25508
  underlying: collAddr,
25214
- asset: currencyFor9(collAddr, collDecimals, collSymbol, tokens),
25509
+ asset: currencyFor10(collAddr, collDecimals, collSymbol, tokens),
25215
25510
  // Collateral lives inside the LLAMMA spread over bands; there is no
25216
25511
  // single market-level balance worth reporting, and the number the UI
25217
25512
  // needs is the borrowed side anyway.
@@ -25259,7 +25554,7 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
25259
25554
  name: loanSymbol,
25260
25555
  poolId: market.controller.toLowerCase(),
25261
25556
  underlying: loanAddr,
25262
- asset: currencyFor9(loanAddr, loanDecimals, loanSymbol, tokens),
25557
+ asset: currencyFor10(loanAddr, loanDecimals, loanSymbol, tokens),
25263
25558
  totalDeposits,
25264
25559
  totalDebtStable: 0,
25265
25560
  totalDebt,
@@ -25497,7 +25792,7 @@ function resupplyKeyParts(key3) {
25497
25792
  var SECONDS_PER_YEAR9 = 31536e3;
25498
25793
  var LTV_PRECISION = 1e5;
25499
25794
  var ONE2 = 10n ** 18n;
25500
- function currencyFor10(address, decimals, symbol, tokens) {
25795
+ function currencyFor11(address, decimals, symbol, tokens) {
25501
25796
  const lower4 = address.toLowerCase();
25502
25797
  return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
25503
25798
  }
@@ -25608,7 +25903,7 @@ function convertResupplyMarketsToResponse(raw, chainId, prices = {}, _additional
25608
25903
  name: "Collateral " + collSymbol,
25609
25904
  poolId: id.pair.toLowerCase(),
25610
25905
  underlying: collAddr,
25611
- asset: currencyFor10(collAddr, collDecimals, collSymbol, tokens),
25906
+ asset: currencyFor11(collAddr, collDecimals, collSymbol, tokens),
25612
25907
  totalDeposits: totalColl,
25613
25908
  totalDebtStable: 0,
25614
25909
  totalDebt: 0,
@@ -25661,7 +25956,7 @@ function convertResupplyMarketsToResponse(raw, chainId, prices = {}, _additional
25661
25956
  name: debtSymbol,
25662
25957
  poolId: id.pair.toLowerCase(),
25663
25958
  underlying: debtAddr,
25664
- asset: currencyFor10(debtAddr, debtDecimals, debtSymbol, tokens),
25959
+ asset: currencyFor11(debtAddr, debtDecimals, debtSymbol, tokens),
25665
25960
  totalDeposits: 0,
25666
25961
  totalDebtStable: 0,
25667
25962
  totalDebt,
@@ -25790,7 +26085,7 @@ var BPS2 = 1e4;
25790
26085
  function ratePerSecToApr2(rate) {
25791
26086
  return Number(rate) / 1e18 * SECONDS_PER_YEAR10 * 100;
25792
26087
  }
25793
- function currencyFor11(address, decimals, symbol, name, tokens) {
26088
+ function currencyFor12(address, decimals, symbol, name, tokens) {
25794
26089
  const lower4 = address.toLowerCase();
25795
26090
  return tokens[lower4] ?? { address: lower4, symbol, name, decimals };
25796
26091
  }
@@ -25845,7 +26140,7 @@ function convertCurvanceMarketsToResponse(raw, chainId, prices = {}, _additional
25845
26140
  name: t.assetSymbol,
25846
26141
  poolId: market.marketManager.toLowerCase(),
25847
26142
  underlying: assetAddr,
25848
- asset: currencyFor11(assetAddr, dec2, t.assetSymbol, t.assetName, tokens),
26143
+ asset: currencyFor12(assetAddr, dec2, t.assetSymbol, t.assetName, tokens),
25849
26144
  totalDeposits,
25850
26145
  totalDebtStable: 0,
25851
26146
  totalDebt,
@@ -26017,7 +26312,19 @@ function resolvePositionManagers(cfg, marketManager) {
26017
26312
 
26018
26313
  // src/lending/public-data/twyne/convertPublic.ts
26019
26314
  function twyneLenderKey(lender, chainId, intermediateVault, targetAsset) {
26020
- return `${lender}_${chainId}_${intermediateVault.replace(/^0x/i, "").toUpperCase()}_${targetAsset.replace(/^0x/i, "").toUpperCase()}`;
26315
+ const family = String(lender).toUpperCase().split("_")[0];
26316
+ return `${family}_${chainId}_${intermediateVault.replace(/^0x/i, "").toUpperCase()}_${targetAsset.replace(/^0x/i, "").toUpperCase()}`;
26317
+ }
26318
+ function twyneKeyParts(key3) {
26319
+ if (!key3?.startsWith("TWYNE_")) return void 0;
26320
+ const m = key3.slice("TWYNE_".length).match(/^(\d+)_([0-9A-Fa-f]{40})_([0-9A-Fa-f]{40})$/);
26321
+ if (!m) return void 0;
26322
+ return {
26323
+ lender: "TWYNE",
26324
+ chainId: m[1],
26325
+ intermediateVault: `0x${m[2].toLowerCase()}`,
26326
+ targetAsset: `0x${m[3].toLowerCase()}`
26327
+ };
26021
26328
  }
26022
26329
  var SECONDS_PER_YEAR11 = 31536e3;
26023
26330
  var BPS3 = 1e4;
@@ -26026,7 +26333,7 @@ var toFloat2 = (v, dec2) => v === void 0 ? 0 : Number(v) / 10 ** dec2;
26026
26333
  function spyToApr(spy) {
26027
26334
  return Number(spy) / RAY5 * SECONDS_PER_YEAR11 * 100;
26028
26335
  }
26029
- function currencyFor12(address, decimals, symbol, tokens) {
26336
+ function currencyFor13(address, decimals, symbol, tokens) {
26030
26337
  const lower4 = address.toLowerCase();
26031
26338
  return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
26032
26339
  }
@@ -26060,7 +26367,7 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
26060
26367
  name: m.symbol ?? collToken?.symbol ?? "collateral",
26061
26368
  poolId: m.intermediateVault.toLowerCase(),
26062
26369
  underlying: collAddr,
26063
- asset: currencyFor12(collAddr, row.collateralDecimals, m.symbol ?? "", tokens),
26370
+ asset: currencyFor13(collAddr, row.collateralDecimals, m.symbol ?? "", tokens),
26064
26371
  totalDeposits: creditTotal,
26065
26372
  totalDebtStable: 0,
26066
26373
  totalDebt: 0,
@@ -26144,7 +26451,7 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
26144
26451
  name: debtToken?.symbol ?? "debt",
26145
26452
  poolId: m.intermediateVault.toLowerCase(),
26146
26453
  underlying: debtAddr,
26147
- asset: currencyFor12(debtAddr, row.targetDecimals, debtToken?.symbol ?? "", tokens),
26454
+ asset: currencyFor13(debtAddr, row.targetDecimals, debtToken?.symbol ?? "", tokens),
26148
26455
  // Borrower aggregates are NOT readable without an event replay — see the
26149
26456
  // header. Zero here means "not measured", and the descriptor says so.
26150
26457
  totalDeposits: 0,
@@ -26192,7 +26499,13 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
26192
26499
  entry.params = {
26193
26500
  market: {
26194
26501
  lender: lenderKey,
26195
- name: m.name ?? `${m.symbol ?? "?"} / ${m.vaultType === "AAVE_V3" ? "Aave V3" : "Euler V2"}`,
26502
+ // COLLATERAL / DEBT, then the venue a Twyne market is a PAIR, and the
26503
+ // collateral alone does not name one: the Euler eWETH credit vault backs
26504
+ // three markets (USDC, USDT, WBTC), which a collateral-only label
26505
+ // renders as three identical rows. The roster carries this string; the
26506
+ // fallback exists for a roster row published before the label did, and
26507
+ // must not silently degrade to the ambiguous form.
26508
+ name: m.name ?? `${m.symbol ?? "?"} / ${debtToken?.symbol ?? "?"} \xB7 ${m.vaultType === "AAVE_V3" ? "Aave V3" : "Euler V2"}`,
26196
26509
  loanDecimals: row.targetDecimals,
26197
26510
  collateralDecimals: row.collateralDecimals,
26198
26511
  id: m.intermediateVault.toLowerCase(),
@@ -26277,7 +26590,7 @@ var SECONDS_PER_YEAR12 = 31536e3;
26277
26590
  var ratePerSecToApr3 = (rate) => Number(rate) / 1e18 * SECONDS_PER_YEAR12 * 100;
26278
26591
  var toFloat3 = (raw, decimals) => Number(raw) / 10 ** decimals;
26279
26592
  var MAX_UINT = (1n << 256n) - 1n;
26280
- function currencyFor13(address, decimals, symbol, name, tokens) {
26593
+ function currencyFor14(address, decimals, symbol, name, tokens) {
26281
26594
  const lower4 = address.toLowerCase();
26282
26595
  return tokens[lower4] ?? { address: lower4, symbol, name, decimals };
26283
26596
  }
@@ -26326,7 +26639,7 @@ function convertFraxlendPairsToResponse(raw, chainId, prices = {}, _additionalYi
26326
26639
  name: p.assetSymbol,
26327
26640
  poolId: p.pair.toLowerCase(),
26328
26641
  underlying: p.asset,
26329
- asset: currencyFor13(
26642
+ asset: currencyFor14(
26330
26643
  p.asset,
26331
26644
  p.assetDecimals,
26332
26645
  p.assetSymbol,
@@ -26379,7 +26692,7 @@ function convertFraxlendPairsToResponse(raw, chainId, prices = {}, _additionalYi
26379
26692
  name: p.collateralSymbol,
26380
26693
  poolId: p.pair.toLowerCase(),
26381
26694
  underlying: p.collateral,
26382
- asset: currencyFor13(
26695
+ asset: currencyFor14(
26383
26696
  p.collateral,
26384
26697
  p.collateralDecimals,
26385
26698
  p.collateralSymbol,
@@ -26549,12 +26862,12 @@ async function fetchDssMarkets(lender, chainId) {
26549
26862
  } catch {
26550
26863
  return { lender, config, chainData, markets: [] };
26551
26864
  }
26552
- const big20 = (v) => {
26865
+ const big22 = (v) => {
26553
26866
  if (typeof v === "bigint") return v;
26554
26867
  if (typeof v === "number") return BigInt(v);
26555
26868
  return null;
26556
26869
  };
26557
- const field13 = (res, name, idx) => big20(res?.[name] ?? res?.[idx]);
26870
+ const field13 = (res, name, idx) => big22(res?.[name] ?? res?.[idx]);
26558
26871
  let cursor = 0;
26559
26872
  const out = markets.map((market, i) => {
26560
26873
  const base = cursor;
@@ -26571,7 +26884,7 @@ async function fetchDssMarkets(lender, chainId) {
26571
26884
  dust: field13(vatIlk, "dust", 4),
26572
26885
  duty: field13(jugIlk, "duty", 0),
26573
26886
  mat: field13(spotIlk, "mat", 1),
26574
- joinBalance: joinReadIndex[i] >= 0 ? big20(results[joinReadIndex[i]]) : null
26887
+ joinBalance: joinReadIndex[i] >= 0 ? big22(results[joinReadIndex[i]]) : null
26575
26888
  };
26576
26889
  });
26577
26890
  return { lender, config, chainData, markets: out };
@@ -26592,14 +26905,14 @@ function dssKeyParts(key3) {
26592
26905
  if (!m) return void 0;
26593
26906
  return { lender: m[1], chainId: m[2], ilk: keySegmentToIlk(m[3]) };
26594
26907
  }
26595
- var WAD10 = 1e18;
26908
+ var WAD11 = 1e18;
26596
26909
  var RAY6 = 1e27;
26597
26910
  var RAD = 1e45;
26598
26911
  var YEAR_SECONDS2 = 31536e3;
26599
26912
  function toHuman4(raw, decimals) {
26600
26913
  return Number(raw) / 10 ** decimals;
26601
26914
  }
26602
- function currencyFor14(address, decimals, symbol, tokens) {
26915
+ function currencyFor15(address, decimals, symbol, tokens) {
26603
26916
  const lower4 = address.toLowerCase();
26604
26917
  return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
26605
26918
  }
@@ -26636,7 +26949,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
26636
26949
  const totalColl = m.joinBalance !== null ? toHuman4(m.joinBalance, collDecimals) : 0;
26637
26950
  const mat = m.mat !== null ? Number(m.mat) / RAY6 : Number(market.mat) / RAY6 || 1.5;
26638
26951
  const ltv = mat > 0 ? 1 / mat : 0;
26639
- const chop = market.chop ? Number(market.chop) / WAD10 : 0;
26952
+ const chop = market.chop ? Number(market.chop) / WAD11 : 0;
26640
26953
  const liqPenalty = chop > 1 ? chop - 1 : 0;
26641
26954
  const duty = m.duty !== null ? m.duty : BigInt(market.duty ?? 0);
26642
26955
  const borrowApr = duty > BigInt(1e27) ? Number(duty - BigInt(10) ** BigInt(27)) / RAY6 * YEAR_SECONDS2 * 100 : 0;
@@ -26651,7 +26964,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
26651
26964
  name: "Collateral " + collSymbol,
26652
26965
  poolId: market.gemJoin?.toLowerCase(),
26653
26966
  underlying: collAddr,
26654
- asset: currencyFor14(collAddr, collDecimals, collSymbol, tokens),
26967
+ asset: currencyFor15(collAddr, collDecimals, collSymbol, tokens),
26655
26968
  totalDeposits: totalColl,
26656
26969
  totalDebtStable: 0,
26657
26970
  totalDebt: 0,
@@ -26695,7 +27008,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
26695
27008
  name: debtSymbol,
26696
27009
  poolId: cfg.vat.toLowerCase(),
26697
27010
  underlying: debtAddr,
26698
- asset: currencyFor14(debtAddr, debtDecimals, debtSymbol, tokens),
27011
+ asset: currencyFor15(debtAddr, debtDecimals, debtSymbol, tokens),
26699
27012
  totalDeposits: 0,
26700
27013
  totalDebtStable: 0,
26701
27014
  totalDebt,
@@ -26845,26 +27158,26 @@ async function fetchFrankencoinMarkets(lender, chainId) {
26845
27158
  } catch {
26846
27159
  return { lender, config, chainData, markets: [] };
26847
27160
  }
26848
- const big20 = (v) => {
27161
+ const big22 = (v) => {
26849
27162
  if (typeof v === "bigint") return v;
26850
27163
  if (typeof v === "number") return BigInt(v);
26851
27164
  return null;
26852
27165
  };
26853
27166
  const out = markets.map((market, i) => {
26854
27167
  const base = i * READS_PER_MARKET3;
26855
- const expiration = big20(results[base + 7]);
27168
+ const expiration = big22(results[base + 7]);
26856
27169
  return {
26857
27170
  market,
26858
- price: big20(results[base]),
26859
- minted: big20(results[base + 1]),
26860
- availableForClones: big20(results[base + 2]),
26861
- annualInterestPPM: big20(results[base + 3]),
26862
- currentFeePPM: big20(results[base + 4]),
26863
- reserveContribution: big20(results[base + 5]),
26864
- challengedAmount: big20(results[base + 6]),
27171
+ price: big22(results[base]),
27172
+ minted: big22(results[base + 1]),
27173
+ availableForClones: big22(results[base + 2]),
27174
+ annualInterestPPM: big22(results[base + 3]),
27175
+ currentFeePPM: big22(results[base + 4]),
27176
+ reserveContribution: big22(results[base + 5]),
27177
+ challengedAmount: big22(results[base + 6]),
26865
27178
  expiration,
26866
27179
  isClosed: typeof results[base + 8] === "boolean" ? results[base + 8] : null,
26867
- collateralBalance: big20(results[base + 9])
27180
+ collateralBalance: big22(results[base + 9])
26868
27181
  };
26869
27182
  });
26870
27183
  return { lender, config, chainData, markets: out };
@@ -26886,7 +27199,7 @@ function frankencoinKeyParts(key3) {
26886
27199
  };
26887
27200
  }
26888
27201
  var PPM = 1e6;
26889
- function currencyFor15(address, decimals, symbol, tokens) {
27202
+ function currencyFor16(address, decimals, symbol, tokens) {
26890
27203
  const lower4 = address.toLowerCase();
26891
27204
  return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
26892
27205
  }
@@ -26937,7 +27250,7 @@ function convertFrankencoinMarketsToResponse(raw, chainId, prices = {}, _additio
26937
27250
  name: "Collateral " + collSymbol,
26938
27251
  poolId: market.position.toLowerCase(),
26939
27252
  underlying: collAddr,
26940
- asset: currencyFor15(collAddr, collDecimals, collSymbol, tokens),
27253
+ asset: currencyFor16(collAddr, collDecimals, collSymbol, tokens),
26941
27254
  totalDeposits: totalColl,
26942
27255
  totalDebtStable: 0,
26943
27256
  totalDebt: 0,
@@ -26984,7 +27297,7 @@ function convertFrankencoinMarketsToResponse(raw, chainId, prices = {}, _additio
26984
27297
  name: debtSymbol,
26985
27298
  poolId: cfg.mintingHub.toLowerCase(),
26986
27299
  underlying: debtAddr,
26987
- asset: currencyFor15(debtAddr, debtDecimals, debtSymbol, tokens),
27300
+ asset: currencyFor16(debtAddr, debtDecimals, debtSymbol, tokens),
26988
27301
  totalDeposits: 0,
26989
27302
  totalDebtStable: 0,
26990
27303
  totalDebt,
@@ -27705,6 +28018,7 @@ async function getLenderDataFromApi(lender, chainId, prices, additionalYields, i
27705
28018
  if (isRiver(lender)) return await fetchRiverMarkets(lender, chainId);
27706
28019
  if (isTeller(lender)) return await fetchTellerMarkets(chainId);
27707
28020
  if (isInverse(lender)) return await fetchInverseMarkets(lender, chainId);
28021
+ if (isCooler(lender)) return await fetchCoolerMarkets(lender, chainId);
27708
28022
  if (isLlamaLend(lender)) return await fetchLlamaLendMarkets(lender, chainId);
27709
28023
  if (isResupply(lender)) return await fetchResupplyMarkets(lender, chainId);
27710
28024
  if (isCurvance(lender)) return await fetchCurvanceMarkets(lender, chainId);
@@ -27775,6 +28089,14 @@ function convertLenderDataFromApi(lender, chainId, data, prices, additionalYield
27775
28089
  additionalYields,
27776
28090
  list
27777
28091
  );
28092
+ if (isCooler(lender))
28093
+ return convertCoolerMarketsToResponse(
28094
+ data,
28095
+ chainId,
28096
+ prices,
28097
+ additionalYields,
28098
+ list
28099
+ )[lender] ?? {};
27778
28100
  if (isLlamaLend(lender))
27779
28101
  return convertLlamaLendMarketsToResponse(
27780
28102
  data,
@@ -28003,6 +28325,99 @@ var getLenderPublicDataViaApi = async (chainId, lenders, prices, additionalYield
28003
28325
  }
28004
28326
  return lenderData;
28005
28327
  };
28328
+ var ERC20_BALANCE_OF_ABI2 = [
28329
+ {
28330
+ inputs: [{ name: "account", type: "address" }],
28331
+ name: "balanceOf",
28332
+ outputs: [{ name: "", type: "uint256" }],
28333
+ stateMutability: "view",
28334
+ type: "function"
28335
+ }
28336
+ ];
28337
+ var MORPHO_BLUE_BUCKET_PREFIX = "MORPHO_BLUE_";
28338
+ function formatBalance(raw, decimals) {
28339
+ if (raw === void 0 || raw === null || raw === "0x") return void 0;
28340
+ let value;
28341
+ try {
28342
+ value = BigInt(raw);
28343
+ } catch {
28344
+ return void 0;
28345
+ }
28346
+ return Number(value) / 10 ** decimals;
28347
+ }
28348
+ async function enrichMorphoCollateralTotals(chainId, result, prices, multicallRetry) {
28349
+ const morpho = morphoPools()?.MORPHO_BLUE?.[chainId];
28350
+ if (!morpho) return result;
28351
+ const markets = [];
28352
+ for (const [bucket, entry] of Object.entries(result)) {
28353
+ if (!bucket.startsWith(MORPHO_BLUE_BUCKET_PREFIX)) continue;
28354
+ const market = entry?.params?.market;
28355
+ const rows = entry?.data;
28356
+ if (!market || !rows) continue;
28357
+ const collateral = String(market.collateralAddress ?? "").toLowerCase();
28358
+ const loan = String(market.loanAddress ?? "").toLowerCase();
28359
+ if (!collateral || !loan) continue;
28360
+ const loanRow = rows[createMarketUid(chainId, bucket, loan)];
28361
+ const supply = Number(loanRow?.totalDeposits ?? 0);
28362
+ const borrow = Number(loanRow?.totalDebt ?? 0);
28363
+ const loanIdle = Number.isFinite(supply) && Number.isFinite(borrow) ? supply - borrow : 0;
28364
+ markets.push({
28365
+ bucket,
28366
+ collateralUid: createMarketUid(chainId, bucket, collateral),
28367
+ collateral,
28368
+ loan,
28369
+ collateralDecimals: Number(market.collateralDecimals ?? 18),
28370
+ loanIdle
28371
+ });
28372
+ }
28373
+ if (markets.length === 0) return result;
28374
+ const marketsByCollateral = /* @__PURE__ */ new Map();
28375
+ for (const m of markets) {
28376
+ const list = marketsByCollateral.get(m.collateral);
28377
+ if (list) list.push(m);
28378
+ else marketsByCollateral.set(m.collateral, [m]);
28379
+ }
28380
+ const soleCollateralTokens = [...marketsByCollateral.entries()].filter(([, list]) => list.length === 1).map(([token]) => token);
28381
+ if (soleCollateralTokens.length === 0) return result;
28382
+ let balances;
28383
+ try {
28384
+ balances = await multicallRetry({
28385
+ chain: chainId,
28386
+ calls: soleCollateralTokens.map((token) => ({
28387
+ address: token,
28388
+ functionName: "balanceOf",
28389
+ args: [morpho]
28390
+ })),
28391
+ abi: soleCollateralTokens.map(() => ERC20_BALANCE_OF_ABI2),
28392
+ allowFailure: true
28393
+ });
28394
+ } catch {
28395
+ return result;
28396
+ }
28397
+ const idleByToken = /* @__PURE__ */ new Map();
28398
+ for (const m of markets) {
28399
+ idleByToken.set(m.loan, (idleByToken.get(m.loan) ?? 0) + m.loanIdle);
28400
+ }
28401
+ soleCollateralTokens.forEach((token, i) => {
28402
+ const m = marketsByCollateral.get(token)[0];
28403
+ const balance = formatBalance(balances?.[i], m.collateralDecimals);
28404
+ if (balance === void 0) return;
28405
+ const total = balance - (idleByToken.get(token) ?? 0);
28406
+ if (!Number.isFinite(total) || total < 0) return;
28407
+ const row = result[m.bucket]?.data?.[m.collateralUid];
28408
+ if (!row) return;
28409
+ const priceKey = toOracleKey(row.asset?.assetGroup ?? null) || toGenericPriceKey(token, chainId);
28410
+ const price2 = prices[priceKey] ?? 0;
28411
+ const usd = total * price2;
28412
+ row.totalDeposits = total;
28413
+ row.totalLiquidity = total;
28414
+ row.borrowLiquidity = total;
28415
+ row.totalDepositsUSD = usd;
28416
+ row.totalLiquidityUSD = usd;
28417
+ row.borrowLiquidityUSD = usd;
28418
+ });
28419
+ return result;
28420
+ }
28006
28421
  var warn5 = (...args) => {
28007
28422
  };
28008
28423
  function lenderApiOnly(lender, chainId) {
@@ -28039,6 +28454,7 @@ function lenderApiOnly(lender, chainId) {
28039
28454
  if (isRiver(lender)) return true;
28040
28455
  if (isTeller(lender)) return true;
28041
28456
  if (isInverse(lender)) return true;
28457
+ if (isCooler(lender)) return true;
28042
28458
  if (isTermMax(lender)) return true;
28043
28459
  if (isResupply(lender)) return true;
28044
28460
  if (isCurvance(lender)) return true;
@@ -28102,6 +28518,21 @@ var getLenderPublicDataAll = async (chainId, lenders, prices, additionalYields,
28102
28518
  e?.message ?? e
28103
28519
  );
28104
28520
  }
28521
+ if (lendersOnChain.some((l) => l === Lender.MORPHO_BLUE)) {
28522
+ try {
28523
+ onChainRes = await enrichMorphoCollateralTotals(
28524
+ chainId,
28525
+ onChainRes,
28526
+ prices,
28527
+ multicallRetry
28528
+ );
28529
+ } catch (e) {
28530
+ warn5(
28531
+ `[lending] morpho collateral enrichment failed for chain ${chainId}:`,
28532
+ e?.message ?? e
28533
+ );
28534
+ }
28535
+ }
28105
28536
  }
28106
28537
  return { ...onChainRes, ...apiRes };
28107
28538
  };
@@ -29571,6 +30002,14 @@ var buildInverseUserCall = (chainId, lender, account) => {
29571
30002
  );
29572
30003
  return calls;
29573
30004
  };
30005
+ var COOLER_USER_CALLS = 1;
30006
+ var buildCoolerUserCall = (chainId, lender, account) => {
30007
+ const cfg = coolerConfigFor(lender, chainId);
30008
+ if (!cfg?.monoCooler) return [];
30009
+ return [
30010
+ { address: cfg.monoCooler, name: "accountPosition", params: [account] }
30011
+ ];
30012
+ };
29574
30013
  var RESUPPLY_CALLS_PER_PAIR = 2;
29575
30014
  var ONE3 = 10n ** 18n;
29576
30015
  var ROSTER_TTL_MS = 5 * 6e4;
@@ -29864,7 +30303,7 @@ var buildCurvanceUserCall = async (chainId, lender, account) => {
29864
30303
  ]);
29865
30304
  };
29866
30305
  var DISCOVERY_TTL_MS3 = 6e4;
29867
- var TWYNE_READS_PER_VAULT = 9;
30306
+ var TWYNE_READS_PER_VAULT = 7;
29868
30307
  var discoveryCache4 = /* @__PURE__ */ new Map();
29869
30308
  var discoveryKey3 = (chainId, lender, account) => `${chainId}:${lender}:${account.toLowerCase()}`;
29870
30309
  function getCachedTwyneDiscovery(chainId, lender, account) {
@@ -29906,9 +30345,15 @@ async function discover(chainId, lender, account) {
29906
30345
  abi: TwyneCollateralVaultAbi,
29907
30346
  allowFailure: true
29908
30347
  });
29909
- const known = new Set(
29910
- (twyneChainData(lender, chainId)?.markets ?? []).map(
29911
- (m) => `${lower2(m.intermediateVault)}|${lower2(m.targetAsset)}`
30348
+ const queried = twyneKeyParts(lender);
30349
+ const known = new Map(
30350
+ (twyneChainData(lender, chainId)?.markets ?? []).filter(
30351
+ (m) => !queried || lower2(m.intermediateVault) === lower2(queried.intermediateVault) && lower2(m.targetAsset) === lower2(queried.targetAsset)
30352
+ ).map(
30353
+ (m) => [
30354
+ `${lower2(m.intermediateVault)}|${lower2(m.targetAsset)}`,
30355
+ m.collateralAsset
30356
+ ]
29912
30357
  )
29913
30358
  );
29914
30359
  const vaults = [];
@@ -29918,9 +30363,40 @@ async function discover(chainId, lender, account) {
29918
30363
  const owner = refs[i * 3 + 2];
29919
30364
  if (!isAddress2(iv) || !isAddress2(target)) return;
29920
30365
  if (isAddress2(owner) && lower2(owner) !== lower2(account)) return;
29921
- if (!known.has(`${lower2(iv)}|${lower2(target)}`)) return;
29922
- vaults.push({ vault, intermediateVault: lower2(iv), targetAsset: lower2(target) });
30366
+ const marketKey2 = `${lower2(iv)}|${lower2(target)}`;
30367
+ if (!known.has(marketKey2)) return;
30368
+ vaults.push({
30369
+ vault,
30370
+ intermediateVault: lower2(iv),
30371
+ targetAsset: lower2(target),
30372
+ collateralAsset: known.get(marketKey2)
30373
+ });
29923
30374
  });
30375
+ const receipts = [
30376
+ ...new Set(vaults.map((v) => v.collateralAsset).filter((a) => !!a))
30377
+ ];
30378
+ if (receipts.length > 0) {
30379
+ const scales = await multicallRetryUniversal({
30380
+ chain: chainId,
30381
+ calls: receipts.map((address) => ({
30382
+ address,
30383
+ name: "convertToAssets",
30384
+ args: [10n ** 18n]
30385
+ })),
30386
+ abi: TwyneATokenWrapperAbi,
30387
+ allowFailure: true
30388
+ });
30389
+ const byReceipt = /* @__PURE__ */ new Map();
30390
+ receipts.forEach((address, i) => {
30391
+ const v = scales[i];
30392
+ const scale3 = typeof v === "bigint" ? v : typeof v === "string" && /^\d+$/.test(v) ? BigInt(v) : void 0;
30393
+ if (scale3 && scale3 > 0n) byReceipt.set(lower2(address), scale3);
30394
+ });
30395
+ for (const v of vaults) {
30396
+ const scale3 = v.collateralAsset ? byReceipt.get(lower2(v.collateralAsset)) : void 0;
30397
+ if (scale3) v.collateralToUnderlying = scale3;
30398
+ }
30399
+ }
29924
30400
  const result = { vaults, at: Date.now() };
29925
30401
  discoveryCache4.set(key3, result);
29926
30402
  return result;
@@ -29935,9 +30411,7 @@ async function buildTwyneUserCall(chainId, lender, account) {
29935
30411
  { address: vault, name: "twyneLiqLTV", args: [] },
29936
30412
  { address: vault, name: "canLiquidate", args: [] },
29937
30413
  { address: vault, name: "isExternallyLiquidated", args: [] },
29938
- { address: vault, name: "canRebalance", args: [] },
29939
- { address: vault, name: "asset", args: [] },
29940
- { address: vault, name: "convertToAssets", args: [10n ** 18n] }
30414
+ { address: vault, name: "canRebalance", args: [] }
29941
30415
  ]);
29942
30416
  }
29943
30417
  var DSS_CALLS_PER_CDP = 1;
@@ -29950,7 +30424,7 @@ var getCachedDssCdps = (lender, chainId, account) => {
29950
30424
  if (!hit || Date.now() - hit.at > CACHE_TTL_MS2) return void 0;
29951
30425
  return hit;
29952
30426
  };
29953
- var big5 = (v) => {
30427
+ var big6 = (v) => {
29954
30428
  try {
29955
30429
  if (typeof v === "bigint") return v;
29956
30430
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -29981,7 +30455,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
29981
30455
  ],
29982
30456
  allowFailure: false
29983
30457
  });
29984
- owners.push({ owner: account, count: big5(rawCount), cursor: big5(rawFirst) });
30458
+ owners.push({ owner: account, count: big6(rawCount), cursor: big6(rawFirst) });
29985
30459
  const proxy = String(rawProxy ?? zero2);
29986
30460
  if (proxy.toLowerCase() !== zero2) {
29987
30461
  const [pCount, pFirst] = await multicallRetryUniversal({
@@ -29993,7 +30467,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
29993
30467
  ],
29994
30468
  allowFailure: false
29995
30469
  });
29996
- owners.push({ owner: proxy, count: big5(pCount), cursor: big5(pFirst) });
30470
+ owners.push({ owner: proxy, count: big6(pCount), cursor: big6(pFirst) });
29997
30471
  }
29998
30472
  } catch {
29999
30473
  return [];
@@ -30034,7 +30508,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
30034
30508
  if (curated.has(ilk)) {
30035
30509
  cdps.push({ cdpId: cursor.toString(), urn: String(urn), ilk });
30036
30510
  }
30037
- cursor = big5(field6(link, "next", 1));
30511
+ cursor = big6(field6(link, "next", 1));
30038
30512
  }
30039
30513
  }
30040
30514
  } catch {
@@ -30283,6 +30757,7 @@ async function buildUserCall(chainId, lender, account, params, getClient) {
30283
30757
  if (isTeller(lender)) return buildTellerUserCall(chainId, lender, account);
30284
30758
  if (isTermMax(lender)) return buildTermMaxUserCall(chainId, lender, account);
30285
30759
  if (isInverse(lender)) return buildInverseUserCall(chainId, lender, account);
30760
+ if (isCooler(lender)) return buildCoolerUserCall(chainId, lender, account);
30286
30761
  if (isLlamaLend(lender))
30287
30762
  return buildLlamaLendUserCall(chainId, lender, account);
30288
30763
  if (isResupply(lender)) return buildResupplyUserCall(chainId, lender, account);
@@ -32837,7 +33312,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
32837
33312
  totalCalls
32838
33313
  ];
32839
33314
  };
32840
- var WAD11 = 1000000000000000000n;
33315
+ var WAD12 = 1000000000000000000n;
32841
33316
  function toBigInt12(v) {
32842
33317
  if (v === void 0 || v === null || v === "0x") return 0n;
32843
33318
  if (typeof v === "bigint") return v;
@@ -32879,8 +33354,8 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
32879
33354
  const debtStr = parseRawAmount(debtUnits.toString(), market.loanDecimals);
32880
33355
  const debtNum = Number(debtStr);
32881
33356
  const repoBalance = toBigInt12(balanceResult);
32882
- const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD11;
32883
- const lentUnits = repoBalance * redemptionValue / WAD11;
33357
+ const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD12;
33358
+ const lentUnits = repoBalance * redemptionValue / WAD12;
32884
33359
  const depositsStr = parseRawAmount(lentUnits.toString(), market.loanDecimals);
32885
33360
  const depositsNum = Number(depositsStr);
32886
33361
  const posData = {};
@@ -32958,7 +33433,7 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
32958
33433
  };
32959
33434
  var nowSec6 = () => Math.floor(Date.now() / 1e3);
32960
33435
  var DAY_SECONDS = 86400n;
32961
- var WAD12 = 10n ** 18n;
33436
+ var WAD13 = 10n ** 18n;
32962
33437
  function sumPreview(positions) {
32963
33438
  return positions.reduce((acc, p) => acc + p.previewValue, 0n);
32964
33439
  }
@@ -32982,7 +33457,7 @@ function toDetail(positions, kind, now, penaltyRate, penaltyApr) {
32982
33457
  ...kind === "borrow" ? {
32983
33458
  ...overdue ? { latePenalty: excess.toString() } : { earlyRepayDiscount: gap.toString() },
32984
33459
  // face × penaltyRate × 1 day — what another day of being late adds.
32985
- latePenaltyPerDay: (face * penaltyRate * DAY_SECONDS / WAD12).toString(),
33460
+ latePenaltyPerDay: (face * penaltyRate * DAY_SECONDS / WAD13).toString(),
32986
33461
  latePenaltyApr: penaltyApr
32987
33462
  } : {
32988
33463
  ...overdue ? {} : { earlyExitCost: gap.toString() },
@@ -33111,7 +33586,7 @@ var getExactlyUserDataConverter = (_lender, chainId, account, meta) => {
33111
33586
  latePenalty: penalty,
33112
33587
  /** further penalty per day overdue — linear on face */
33113
33588
  latePenaltyPerDay: parseRawAmount(
33114
- (face * m.penaltyRate * DAY_SECONDS / WAD12).toString(),
33589
+ (face * m.penaltyRate * DAY_SECONDS / WAD13).toString(),
33115
33590
  decimals
33116
33591
  ),
33117
33592
  latePenaltyApr: penaltyApr,
@@ -33142,7 +33617,7 @@ var getExactlyUserDataConverter = (_lender, chainId, account, meta) => {
33142
33617
  expected
33143
33618
  ];
33144
33619
  };
33145
- var big6 = (v) => {
33620
+ var big7 = (v) => {
33146
33621
  try {
33147
33622
  if (typeof v === "bigint") return v;
33148
33623
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33150,7 +33625,7 @@ var big6 = (v) => {
33150
33625
  }
33151
33626
  return 0n;
33152
33627
  };
33153
- var field7 = (res, name, idx) => big6(res?.[name] ?? res?.[idx]);
33628
+ var field7 = (res, name, idx) => big7(res?.[name] ?? res?.[idx]);
33154
33629
  var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
33155
33630
  const cfg = liquityConfigFor(lender, chainId);
33156
33631
  const branches = liquityBranchesByChain(lender, chainId);
@@ -33271,11 +33746,11 @@ var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
33271
33746
  };
33272
33747
  });
33273
33748
  const spBase = troves.length * 2;
33274
- const spDeposit = big6(slice2[spBase]);
33275
- const spYield = big6(slice2[spBase + 1]);
33276
- const spCollGain = big6(slice2[spBase + 2]);
33277
- const spStashed = big6(slice2[spBase + 3]);
33278
- const collSurplus = branch.collSurplusPool ? big6(slice2[spBase + 4]) : 0n;
33749
+ const spDeposit = big7(slice2[spBase]);
33750
+ const spYield = big7(slice2[spBase + 1]);
33751
+ const spCollGain = big7(slice2[spBase + 2]);
33752
+ const spStashed = big7(slice2[spBase + 3]);
33753
+ const collSurplus = branch.collSurplusPool ? big7(slice2[spBase + 4]) : 0n;
33279
33754
  const spStable = spDeposit + spYield;
33280
33755
  const spColl = spCollGain + spStashed + collSurplus;
33281
33756
  if (spStable > 0n || spColl > 0n) {
@@ -33354,7 +33829,7 @@ var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
33354
33829
  expected
33355
33830
  ];
33356
33831
  };
33357
- var big7 = (v) => {
33832
+ var big8 = (v) => {
33358
33833
  try {
33359
33834
  if (typeof v === "bigint") return v;
33360
33835
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33362,7 +33837,7 @@ var big7 = (v) => {
33362
33837
  }
33363
33838
  return 0n;
33364
33839
  };
33365
- var field8 = (res, name, idx) => big7(res?.[name] ?? res?.[idx]);
33840
+ var field8 = (res, name, idx) => big8(res?.[name] ?? res?.[idx]);
33366
33841
  var getRiverUserDataConverter = (lender, chainId, account, meta) => {
33367
33842
  const cfg = riverConfigFor(lender, chainId);
33368
33843
  const markets = riverChainData(lender, chainId)?.markets ?? [];
@@ -33374,13 +33849,13 @@ var getRiverUserDataConverter = (lender, chainId, account, meta) => {
33374
33849
  const debtAddr = cfg.debtToken.toLowerCase();
33375
33850
  const debtDecimals = cfg.debtDecimals ?? 18;
33376
33851
  const out = {};
33377
- const spDeposit = big7(data[markets.length * RIVER_CALLS_PER_MARKET]);
33852
+ const spDeposit = big8(data[markets.length * RIVER_CALLS_PER_MARKET]);
33378
33853
  markets.forEach((market, i) => {
33379
33854
  const base = i * RIVER_CALLS_PER_MARKET;
33380
33855
  const entire = data[base];
33381
33856
  if (isFailedCall(entire) || isFailedCall(data[base + 1])) return;
33382
- const status = Number(big7(data[base + 1]));
33383
- const surplus = big7(data[base + 2]);
33857
+ const status = Number(big8(data[base + 1]));
33858
+ const surplus = big8(data[base + 2]);
33384
33859
  const lenderKey = riverLenderKey(lender, chainId, market.index);
33385
33860
  const metaMap = meta?.[lenderKey];
33386
33861
  if (!metaMap) return;
@@ -33488,7 +33963,7 @@ var getRiverUserDataConverter = (lender, chainId, account, meta) => {
33488
33963
  expected
33489
33964
  ];
33490
33965
  };
33491
- var big8 = (v) => {
33966
+ var big9 = (v) => {
33492
33967
  try {
33493
33968
  if (typeof v === "bigint") return v;
33494
33969
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33507,24 +33982,24 @@ var getInverseUserDataConverter = (lender, chainId, account, meta) => {
33507
33982
  const dolaAddr = cfg.dola.toLowerCase();
33508
33983
  const debtDecimals = cfg.debtDecimals ?? 18;
33509
33984
  const tailBase = markets.length * INVERSE_CALLS_PER_MARKET;
33510
- const dbrBalance = big8(data[tailBase]);
33511
- const dbrDeficit = big8(data[tailBase + 1]);
33985
+ const dbrBalance = big9(data[tailBase]);
33986
+ const dbrDeficit = big9(data[tailBase + 1]);
33512
33987
  const dbrSignedRaw = data[tailBase + 2];
33513
- const dbrSigned = isFailedCall(dbrSignedRaw) ? 0n : big8(dbrSignedRaw);
33988
+ const dbrSigned = isFailedCall(dbrSignedRaw) ? 0n : big9(dbrSignedRaw);
33514
33989
  const dbrTotalDebtRaw = data[tailBase + 3];
33515
- const dbrTotalDebt = isFailedCall(dbrTotalDebtRaw) ? 0n : big8(dbrTotalDebtRaw);
33990
+ const dbrTotalDebt = isFailedCall(dbrTotalDebtRaw) ? 0n : big9(dbrTotalDebtRaw);
33516
33991
  const dbrRunway = dbrTotalDebt > 0n ? dbrBalance * 31536000n / dbrTotalDebt : 0n;
33517
33992
  const nowSec9 = BigInt(Math.floor(Date.now() / 1e3));
33518
33993
  const out = {};
33519
33994
  markets.forEach((market, i) => {
33520
33995
  const base = i * INVERSE_CALLS_PER_MARKET;
33521
- const escrowBal = isFailedCall(data[base]) ? 0n : big8(data[base]);
33996
+ const escrowBal = isFailedCall(data[base]) ? 0n : big9(data[base]);
33522
33997
  const debtRaw = data[base + 1];
33523
33998
  if (isFailedCall(debtRaw)) return;
33524
- const debt = big8(debtRaw);
33999
+ const debt = big9(debtRaw);
33525
34000
  if (escrowBal === 0n && debt === 0n) return;
33526
- const creditLimit = isFailedCall(data[base + 2]) ? 0n : big8(data[base + 2]);
33527
- const withdrawalLimit = isFailedCall(data[base + 3]) ? 0n : big8(data[base + 3]);
34001
+ const creditLimit = isFailedCall(data[base + 2]) ? 0n : big9(data[base + 2]);
34002
+ const withdrawalLimit = isFailedCall(data[base + 3]) ? 0n : big9(data[base + 3]);
33528
34003
  const lenderKey = inverseLenderKey(lender, market.address);
33529
34004
  const metaMap = meta?.[lenderKey];
33530
34005
  if (!metaMap) return;
@@ -33610,7 +34085,118 @@ var getInverseUserDataConverter = (lender, chainId, account, meta) => {
33610
34085
  expected
33611
34086
  ];
33612
34087
  };
33613
- var big9 = (v) => {
34088
+ var big10 = (v) => {
34089
+ try {
34090
+ if (typeof v === "bigint") return v;
34091
+ if (typeof v === "number" || typeof v === "string") return BigInt(v);
34092
+ } catch {
34093
+ }
34094
+ return 0n;
34095
+ };
34096
+ var getCoolerUserDataConverter = (lender, chainId, account, meta) => {
34097
+ const cfg = coolerConfigFor(lender, chainId);
34098
+ const expected = cfg?.monoCooler ? COOLER_USER_CALLS : 0;
34099
+ return [
34100
+ (data) => {
34101
+ if (!cfg || expected === 0 || !meta) return void 0;
34102
+ if (!data || data.length < expected) return void 0;
34103
+ const raw = data[0];
34104
+ if (isFailedCall(raw)) return void 0;
34105
+ const pos = Array.isArray(raw) ? {
34106
+ collateral: raw[0],
34107
+ currentDebt: raw[1],
34108
+ maxOriginationDebtAmount: raw[2],
34109
+ liquidationDebtAmount: raw[3],
34110
+ healthFactor: raw[4],
34111
+ currentLtv: raw[5],
34112
+ totalDelegated: raw[6]
34113
+ } : raw;
34114
+ if (pos === null || typeof pos !== "object") return void 0;
34115
+ const collateral = big10(pos.collateral);
34116
+ const debt = big10(pos.currentDebt);
34117
+ if (collateral === 0n && debt === 0n) return void 0;
34118
+ const collAddr = cfg.gohm.toLowerCase();
34119
+ const collUid = createMarketUid(chainId, lender, collAddr);
34120
+ let loanUid = createMarketUid(chainId, lender, cfg.usds.toLowerCase());
34121
+ if (!meta[loanUid]) {
34122
+ const other = Object.keys(meta).find((k) => k !== collUid);
34123
+ if (other) loanUid = other;
34124
+ }
34125
+ const collMeta = meta[collUid];
34126
+ const loanMeta = meta[loanUid];
34127
+ const collDisplay = collMeta ? getDisplayPrice(collMeta) : 0;
34128
+ const collOracle = collMeta ? getOraclePrice(collMeta) : 0;
34129
+ const collHist = collMeta?.price?.priceUsd24h ?? collDisplay;
34130
+ const loanDisplay = loanMeta ? getDisplayPrice(loanMeta) : 0;
34131
+ const loanOracle = loanMeta ? getOraclePrice(loanMeta) : 0;
34132
+ const loanHist = loanMeta?.price?.priceUsd24h ?? loanDisplay;
34133
+ const coolerInfo = {
34134
+ healthFactor: big10(pos.healthFactor).toString(),
34135
+ currentLtv: big10(pos.currentLtv).toString(),
34136
+ totalDelegated: big10(pos.totalDelegated).toString(),
34137
+ maxOriginationDebtAmount: big10(pos.maxOriginationDebtAmount).toString(),
34138
+ liquidationDebtAmount: big10(pos.liquidationDebtAmount).toString()
34139
+ };
34140
+ const collStr = parseRawAmount(collateral.toString(), 18);
34141
+ const collNum = Number(collStr);
34142
+ const debtStr = parseRawAmount(debt.toString(), 18);
34143
+ const debtNum = Number(debtStr);
34144
+ const loanUnderlying = loanMeta?.asset?.address ?? cfg.usds.toLowerCase();
34145
+ const lendingPositions = {
34146
+ "0": {
34147
+ [collUid]: {
34148
+ marketUid: collUid,
34149
+ underlying: collAddr,
34150
+ deposits: collStr,
34151
+ debt: "0",
34152
+ debtStable: "0",
34153
+ depositsUSD: collNum * collDisplay,
34154
+ debtUSD: 0,
34155
+ debtStableUSD: 0,
34156
+ depositsUSDOracle: collNum * collOracle,
34157
+ debtUSDOracle: 0,
34158
+ debtStableUSDOracle: 0,
34159
+ stableBorrowRate: "0",
34160
+ collateralEnabled: true,
34161
+ claimableRewards: 0
34162
+ },
34163
+ [loanUid]: {
34164
+ marketUid: loanUid,
34165
+ underlying: loanUnderlying,
34166
+ deposits: "0",
34167
+ debt: debtStr,
34168
+ debtStable: "0",
34169
+ depositsUSD: 0,
34170
+ debtUSD: debtNum * loanDisplay,
34171
+ debtStableUSD: 0,
34172
+ depositsUSDOracle: 0,
34173
+ debtUSDOracle: debtNum * loanOracle,
34174
+ debtStableUSDOracle: 0,
34175
+ stableBorrowRate: "0",
34176
+ collateralEnabled: false,
34177
+ claimableRewards: 0,
34178
+ coolerInfo
34179
+ }
34180
+ }
34181
+ };
34182
+ const modes = { "0": 0 };
34183
+ const hist = {
34184
+ "0": {
34185
+ totalDeposits24h: collNum * collHist,
34186
+ totalDebt24h: debtNum * loanHist
34187
+ }
34188
+ };
34189
+ const userData = createMultiAccountTypeUserState(
34190
+ { chainId, account, lendingPositions, modes },
34191
+ meta,
34192
+ hist
34193
+ );
34194
+ return userData && userData.data.length > 0 ? userData : void 0;
34195
+ },
34196
+ expected
34197
+ ];
34198
+ };
34199
+ var big11 = (v) => {
33614
34200
  try {
33615
34201
  if (typeof v === "bigint") return v;
33616
34202
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33620,7 +34206,7 @@ var big9 = (v) => {
33620
34206
  };
33621
34207
  var arrAt = (v, i) => {
33622
34208
  if (isFailedCall(v) || !Array.isArray(v)) return 0n;
33623
- return big9(v[i]);
34209
+ return big11(v[i]);
33624
34210
  };
33625
34211
  var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
33626
34212
  const cfg = llamaLendConfigFor(lender, chainId);
@@ -33635,24 +34221,24 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
33635
34221
  const base = i * LLAMALEND_CALLS_PER_MARKET;
33636
34222
  const stateRaw = data[base];
33637
34223
  if (isFailedCall(stateRaw) || !Array.isArray(stateRaw)) return;
33638
- const collateral = big9(stateRaw[0]);
33639
- const bandBorrowed = big9(stateRaw[1]);
33640
- const debt = big9(stateRaw[2]);
33641
- const bandCount = Number(big9(stateRaw[3]));
34224
+ const collateral = big11(stateRaw[0]);
34225
+ const bandBorrowed = big11(stateRaw[1]);
34226
+ const debt = big11(stateRaw[2]);
34227
+ const bandCount = Number(big11(stateRaw[3]));
33642
34228
  const vaultSharesRaw = data[base + 5];
33643
34229
  const gaugeSharesRaw = data[base + 6];
33644
- const vaultShares = isFailedCall(vaultSharesRaw) ? 0n : big9(vaultSharesRaw);
33645
- const gaugeShares = isFailedCall(gaugeSharesRaw) ? 0n : big9(gaugeSharesRaw);
34230
+ const vaultShares = isFailedCall(vaultSharesRaw) ? 0n : big11(vaultSharesRaw);
34231
+ const gaugeShares = isFailedCall(gaugeSharesRaw) ? 0n : big11(gaugeSharesRaw);
33646
34232
  const lendShares = vaultShares + gaugeShares;
33647
34233
  if (collateral === 0n && debt === 0n && bandBorrowed === 0n && lendShares === 0n)
33648
34234
  return;
33649
34235
  const healthRaw = data[base + 1];
33650
- const health = isFailedCall(healthRaw) ? 0n : big9(healthRaw);
34236
+ const health = isFailedCall(healthRaw) ? 0n : big11(healthRaw);
33651
34237
  const pricesRaw = data[base + 2];
33652
34238
  const priceUpper = arrAt(pricesRaw, 0);
33653
34239
  const priceLower = arrAt(pricesRaw, 1);
33654
34240
  const ticksRaw = data[base + 3];
33655
- const bands = isFailedCall(ticksRaw) || !Array.isArray(ticksRaw) ? void 0 : [Number(big9(ticksRaw[0])), Number(big9(ticksRaw[1]))];
34241
+ const bands = isFailedCall(ticksRaw) || !Array.isArray(ticksRaw) ? void 0 : [Number(big11(ticksRaw[0])), Number(big11(ticksRaw[1]))];
33656
34242
  const approvalRaw = data[base + 4];
33657
34243
  const delegated = isFailedCall(approvalRaw) ? false : approvalRaw === true;
33658
34244
  const lenderKey = llamaLendLenderKey(lender, market.controller);
@@ -33673,7 +34259,7 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
33673
34259
  const loanOracle = loanMeta ? getOraclePrice(loanMeta) : 0;
33674
34260
  const loanHist = loanMeta?.price?.priceUsd24h ?? loanDisplay;
33675
34261
  const shareToAssetRaw = data[base + 7];
33676
- const shareToAsset = isFailedCall(shareToAssetRaw) ? 0n : big9(shareToAssetRaw);
34262
+ const shareToAsset = isFailedCall(shareToAssetRaw) ? 0n : big11(shareToAssetRaw);
33677
34263
  const lendAssets = shareToAsset === 0n ? 0n : lendShares * shareToAsset / 10n ** 18n;
33678
34264
  const lendStr = parseRawAmount(lendAssets.toString(), loanDecimals);
33679
34265
  const depositStr = parseRawAmount(
@@ -33762,7 +34348,7 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
33762
34348
  expected
33763
34349
  ];
33764
34350
  };
33765
- var big10 = (v) => {
34351
+ var big12 = (v) => {
33766
34352
  try {
33767
34353
  if (typeof v === "bigint") return v;
33768
34354
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33770,7 +34356,7 @@ var big10 = (v) => {
33770
34356
  }
33771
34357
  return 0n;
33772
34358
  };
33773
- var tupleAt = (v, i) => Array.isArray(v) ? big10(v[i]) : 0n;
34359
+ var tupleAt = (v, i) => Array.isArray(v) ? big12(v[i]) : 0n;
33774
34360
  var ONE4 = 10n ** 18n;
33775
34361
  function sharesToAmount(shares, totalAmount, totalShares) {
33776
34362
  if (totalShares === 0n || shares === 0n) return 0n;
@@ -33796,7 +34382,7 @@ var getResupplyUserDataConverter = (lender, chainId, account, meta) => {
33796
34382
  if (isFailedCall(accounting) || !Array.isArray(accounting)) return;
33797
34383
  const totalBorrowAmount = tupleAt(accounting, 1);
33798
34384
  const totalBorrowShares = tupleAt(accounting, 2);
33799
- const sharePrice = isFailedCall(data[base + 1]) ? 0n : big10(data[base + 1]);
34385
+ const sharePrice = isFailedCall(data[base + 1]) ? 0n : big12(data[base + 1]);
33800
34386
  const lenderKey = resupplyLenderKey(lender, chainId, pair);
33801
34387
  const metaMap = meta?.[lenderKey];
33802
34388
  if (!metaMap) return;
@@ -33894,7 +34480,7 @@ var getResupplyUserDataConverter = (lender, chainId, account, meta) => {
33894
34480
  expected
33895
34481
  ];
33896
34482
  };
33897
- var big11 = (v) => {
34483
+ var big13 = (v) => {
33898
34484
  try {
33899
34485
  if (typeof v === "bigint") return v;
33900
34486
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -33925,9 +34511,9 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
33925
34511
  const fTokenRaw = data[base + 2];
33926
34512
  const previewRaw = data[base + 3];
33927
34513
  if (isFailedCall(collRaw) || isFailedCall(sharesRaw)) return;
33928
- const collateral = big11(collRaw);
33929
- const borrowShares = big11(sharesRaw);
33930
- const fTokenShares = isFailedCall(fTokenRaw) ? 0n : big11(fTokenRaw);
34514
+ const collateral = big13(collRaw);
34515
+ const borrowShares = big13(sharesRaw);
34516
+ const fTokenShares = isFailedCall(fTokenRaw) ? 0n : big13(fTokenRaw);
33931
34517
  if (collateral === 0n && borrowShares === 0n && fTokenShares === 0n)
33932
34518
  return;
33933
34519
  let totalBorrowAmount = 0n;
@@ -33937,10 +34523,10 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
33937
34523
  if (!isFailedCall(previewRaw) && previewRaw) {
33938
34524
  const ta = previewRaw[4];
33939
34525
  const tb = previewRaw[5];
33940
- totalAssetAmount = big11(ta?.amount ?? ta?.[0]);
33941
- totalAssetShares = big11(ta?.shares ?? ta?.[1]);
33942
- totalBorrowAmount = big11(tb?.amount ?? tb?.[0]);
33943
- totalBorrowShares = big11(tb?.shares ?? tb?.[1]);
34526
+ totalAssetAmount = big13(ta?.amount ?? ta?.[0]);
34527
+ totalAssetShares = big13(ta?.shares ?? ta?.[1]);
34528
+ totalBorrowAmount = big13(tb?.amount ?? tb?.[0]);
34529
+ totalBorrowShares = big13(tb?.shares ?? tb?.[1]);
33944
34530
  }
33945
34531
  const debt = fraxlendToAmount(
33946
34532
  borrowShares,
@@ -34047,8 +34633,8 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
34047
34633
  expected
34048
34634
  ];
34049
34635
  };
34050
- var WAD13 = 10n ** 18n;
34051
- var big12 = (v) => {
34636
+ var WAD14 = 10n ** 18n;
34637
+ var big14 = (v) => {
34052
34638
  try {
34053
34639
  if (typeof v === "bigint") return v;
34054
34640
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -34056,7 +34642,7 @@ var big12 = (v) => {
34056
34642
  }
34057
34643
  return 0n;
34058
34644
  };
34059
- var tupleAt2 = (v, i) => Array.isArray(v) ? big12(v[i]) : 0n;
34645
+ var tupleAt2 = (v, i) => Array.isArray(v) ? big14(v[i]) : 0n;
34060
34646
  var HOLD_PERIOD_SECONDS = 1200n;
34061
34647
  var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
34062
34648
  const cfg = curvanceConfigFor(lender, chainId);
@@ -34079,7 +34665,7 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
34079
34665
  const cooldownRaw = data[base];
34080
34666
  const status = data[base + 1];
34081
34667
  if (isFailedCall(status) || !Array.isArray(status)) continue;
34082
- const cooldownTimestamp = isFailedCall(cooldownRaw) ? 0n : big12(cooldownRaw);
34668
+ const cooldownTimestamp = isFailedCall(cooldownRaw) ? 0n : big14(cooldownRaw);
34083
34669
  const holdPeriodEndsAt = cooldownTimestamp > 0n ? cooldownTimestamp + HOLD_PERIOD_SECONDS : 0n;
34084
34670
  const holdPeriodActive = holdPeriodEndsAt > nowSeconds;
34085
34671
  const lenderKey = curvanceLenderKey(lender, chainId, p.marketManager);
@@ -34101,10 +34687,10 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
34101
34687
  let rows = 0;
34102
34688
  p.activeTokens.forEach(({ cToken, asset }, i) => {
34103
34689
  const tokenBase = base + CURVANCE_MARKET_READS + i * CURVANCE_READS_PER_TOKEN;
34104
- const shares = isFailedCall(data[tokenBase]) ? 0n : big12(data[tokenBase]);
34105
- const collateralShares = isFailedCall(data[tokenBase + 1]) ? 0n : big12(data[tokenBase + 1]);
34106
- const debtRaw = isFailedCall(data[tokenBase + 2]) ? 0n : big12(data[tokenBase + 2]);
34107
- const exchangeRate = isFailedCall(data[tokenBase + 3]) ? 0n : big12(data[tokenBase + 3]);
34690
+ const shares = isFailedCall(data[tokenBase]) ? 0n : big14(data[tokenBase]);
34691
+ const collateralShares = isFailedCall(data[tokenBase + 1]) ? 0n : big14(data[tokenBase + 1]);
34692
+ const debtRaw = isFailedCall(data[tokenBase + 2]) ? 0n : big14(data[tokenBase + 2]);
34693
+ const exchangeRate = isFailedCall(data[tokenBase + 3]) ? 0n : big14(data[tokenBase + 3]);
34108
34694
  info.tokens[cToken.toLowerCase()] = {
34109
34695
  shares: shares.toString(),
34110
34696
  collateralShares: collateralShares.toString(),
@@ -34118,7 +34704,7 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
34118
34704
  const display = getDisplayPrice(rowMeta);
34119
34705
  const oracle = getOraclePrice(rowMeta);
34120
34706
  const histPrice = rowMeta.price?.priceUsd24h ?? display;
34121
- const toUnderlying = (s) => exchangeRate > 0n ? s * exchangeRate / WAD13 : s;
34707
+ const toUnderlying = (s) => exchangeRate > 0n ? s * exchangeRate / WAD14 : s;
34122
34708
  const depositsRaw = toUnderlying(collateralShares);
34123
34709
  const depositsStr = parseRawAmount(
34124
34710
  depositsRaw.toString(),
@@ -34163,8 +34749,8 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
34163
34749
  expected
34164
34750
  ];
34165
34751
  };
34166
- var WAD14 = 10n ** 18n;
34167
- var big13 = (v) => {
34752
+ var WAD15 = 10n ** 18n;
34753
+ var big15 = (v) => {
34168
34754
  try {
34169
34755
  if (typeof v === "bigint") return v;
34170
34756
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -34186,14 +34772,14 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
34186
34772
  const base = i * TWYNE_READS_PER_VAULT;
34187
34773
  const totalRaw = data[base];
34188
34774
  if (isFailedCall(totalRaw)) return;
34189
- const total = big13(totalRaw);
34190
- const reserved = isFailedCall(data[base + 1]) ? 0n : big13(data[base + 1]);
34191
- const debt = isFailedCall(data[base + 2]) ? 0n : big13(data[base + 2]);
34192
- const liqLtv = isFailedCall(data[base + 3]) ? 0n : big13(data[base + 3]);
34775
+ const total = big15(totalRaw);
34776
+ const reserved = isFailedCall(data[base + 1]) ? 0n : big15(data[base + 1]);
34777
+ const debt = isFailedCall(data[base + 2]) ? 0n : big15(data[base + 2]);
34778
+ const liqLtv = isFailedCall(data[base + 3]) ? 0n : big15(data[base + 3]);
34193
34779
  const canLiquidate = isFailedCall(data[base + 4]) ? false : Boolean(data[base + 4]);
34194
34780
  const extLiquidated = isFailedCall(data[base + 5]) ? false : Boolean(data[base + 5]);
34195
- const releasable = isFailedCall(data[base + 6]) ? 0n : big13(data[base + 6]);
34196
- const scale3 = isFailedCall(data[base + 8]) ? WAD14 : big13(data[base + 8]) || WAD14;
34781
+ const releasable = isFailedCall(data[base + 6]) ? 0n : big15(data[base + 6]);
34782
+ const scale3 = ref.collateralToUnderlying ?? WAD15;
34197
34783
  const userCollateral = total > reserved ? total - reserved : 0n;
34198
34784
  if (userCollateral === 0n && debt === 0n) return;
34199
34785
  const market = markets.find(
@@ -34209,7 +34795,7 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
34209
34795
  });
34210
34796
  }
34211
34797
  byMarket.get(lenderKey).rows.push({
34212
- coll: userCollateral * scale3 / WAD14,
34798
+ coll: userCollateral * scale3 / WAD15,
34213
34799
  debt,
34214
34800
  info: {
34215
34801
  collateralVault: ref.vault,
@@ -34308,7 +34894,7 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
34308
34894
  ];
34309
34895
  };
34310
34896
  var RAY7 = 10n ** 27n;
34311
- var big14 = (v) => {
34897
+ var big16 = (v) => {
34312
34898
  try {
34313
34899
  if (typeof v === "bigint") return v;
34314
34900
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -34316,7 +34902,7 @@ var big14 = (v) => {
34316
34902
  }
34317
34903
  return 0n;
34318
34904
  };
34319
- var field9 = (res, name, idx) => big14(res?.[name] ?? res?.[idx]);
34905
+ var field9 = (res, name, idx) => big16(res?.[name] ?? res?.[idx]);
34320
34906
  var getDssUserDataConverter = (lender, chainId, account, meta) => {
34321
34907
  const cfg = dssConfigFor(lender, chainId);
34322
34908
  const markets = dssChainData(lender, chainId)?.markets ?? [];
@@ -34431,7 +35017,7 @@ var getDssUserDataConverter = (lender, chainId, account, meta) => {
34431
35017
  expected
34432
35018
  ];
34433
35019
  };
34434
- var big15 = (v) => {
35020
+ var big17 = (v) => {
34435
35021
  try {
34436
35022
  if (typeof v === "bigint") return v;
34437
35023
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -34461,11 +35047,11 @@ var getFrankencoinUserDataConverter = (lender, chainId, account, meta) => {
34461
35047
  const ownerRes = data[base];
34462
35048
  if (isFailedCall(ownerRes)) return;
34463
35049
  if (String(ownerRes).toLowerCase() !== lowerAccount) return;
34464
- const minted = big15(data[base + 1]);
34465
- const price2 = big15(data[base + 2]);
34466
- const expiration = big15(data[base + 3]);
34467
- const challenged = big15(data[base + 4]);
34468
- const coll = big15(data[base + 5]);
35050
+ const minted = big17(data[base + 1]);
35051
+ const price2 = big17(data[base + 2]);
35052
+ const expiration = big17(data[base + 3]);
35053
+ const challenged = big17(data[base + 4]);
35054
+ const coll = big17(data[base + 5]);
34469
35055
  if (minted === 0n && coll === 0n) return;
34470
35056
  const market = marketByOriginal.get(p.original);
34471
35057
  if (!market) return;
@@ -34566,7 +35152,7 @@ var getFrankencoinUserDataConverter = (lender, chainId, account, meta) => {
34566
35152
 
34567
35153
  // src/lending/user-data/teller/userCallParse.ts
34568
35154
  var nowSec7 = () => Math.floor(Date.now() / 1e3);
34569
- var big16 = (v) => {
35155
+ var big18 = (v) => {
34570
35156
  try {
34571
35157
  if (typeof v === "bigint") return v;
34572
35158
  if (typeof v === "number" || typeof v === "string") return BigInt(v);
@@ -34588,7 +35174,7 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
34588
35174
  const base = i * TELLER_CALLS_PER_BID;
34589
35175
  const bidRes = data[base];
34590
35176
  const owed = data[base + 1];
34591
- const collAmount = big16(data[base + 2]);
35177
+ const collAmount = big18(data[base + 2]);
34592
35178
  const defaulted = !!data[base + 3];
34593
35179
  if (isFailedCall(bidRes) || isFailedCall(owed) || !bidRes) return;
34594
35180
  const pool = b.pool;
@@ -34609,17 +35195,17 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
34609
35195
  const collDisplay = collMeta ? getDisplayPrice(collMeta) : 0;
34610
35196
  const collOracle = collMeta ? getOraclePrice(collMeta) : 0;
34611
35197
  const collHist = collMeta?.price?.priceUsd24h ?? collDisplay;
34612
- const owedPrincipal = big16(field10(owed, "principal", 0));
34613
- const owedInterest = big16(field10(owed, "interest", 1));
35198
+ const owedPrincipal = big18(field10(owed, "principal", 0));
35199
+ const owedInterest = big18(field10(owed, "interest", 1));
34614
35200
  const owedTotal = owedPrincipal + owedInterest;
34615
35201
  if (owedTotal === 0n && collAmount === 0n) return;
34616
35202
  const loanDetails = field10(bidRes, "loanDetails", 5);
34617
35203
  const terms = field10(bidRes, "terms", 6);
34618
35204
  const acceptedTs = Number(
34619
- big16(field10(loanDetails, "acceptedTimestamp", 4))
35205
+ big18(field10(loanDetails, "acceptedTimestamp", 4))
34620
35206
  );
34621
- const loanDuration = Number(big16(field10(loanDetails, "loanDuration", 6)));
34622
- const aprBps = Number(big16(field10(terms, "APR", 2)));
35207
+ const loanDuration = Number(big18(field10(loanDetails, "loanDuration", 6)));
35208
+ const aprBps = Number(big18(field10(terms, "APR", 2)));
34623
35209
  const maturity = acceptedTs > 0 ? acceptedTs + loanDuration : void 0;
34624
35210
  const isMatured2 = defaulted || maturity !== void 0 && maturity < now;
34625
35211
  const collStr = parseRawAmount(collAmount.toString(), collDecimals);
@@ -34996,6 +35582,8 @@ function getUserDataConverter(lender, chainId, account, params, meta) {
34996
35582
  return getTermMaxUserDataConverter(lender, chainId, account, meta);
34997
35583
  if (isInverse(lender))
34998
35584
  return getInverseUserDataConverter(lender, chainId, account, meta);
35585
+ if (isCooler(lender))
35586
+ return getCoolerUserDataConverter(lender, chainId, account, meta?.[lender]);
34999
35587
  if (isLlamaLend(lender))
35000
35588
  return getLlamaLendUserDataConverter(lender, chainId, account, meta);
35001
35589
  if (isResupply(lender))
@@ -39618,6 +40206,16 @@ var VAULT_CONVERT_ABI = [
39618
40206
  outputs: [{ type: "uint256" }]
39619
40207
  }
39620
40208
  ];
40209
+ var TWYNE_USER_ABI = [
40210
+ ...TwyneCollateralVaultAbi,
40211
+ {
40212
+ name: "convertToAssets",
40213
+ type: "function",
40214
+ stateMutability: "view",
40215
+ inputs: [{ name: "shares", type: "uint256" }],
40216
+ outputs: [{ type: "uint256" }]
40217
+ }
40218
+ ];
39621
40219
  var getAbi2 = (lender) => {
39622
40220
  if (isAaveV4Type(lender)) return [...AaveV4SpokeAbi];
39623
40221
  if (isAaveV2Type(lender))
@@ -39663,6 +40261,7 @@ var getAbi2 = (lender) => {
39663
40261
  if (isTermMax(lender)) return [...TermMaxViewerAbi];
39664
40262
  if (isInverse(lender))
39665
40263
  return [...InverseMarketAbi, ...InverseEscrowAbi, ...InverseDbrAbi];
40264
+ if (isCooler(lender)) return [...CoolerMonoAbi];
39666
40265
  if (isLlamaLend(lender))
39667
40266
  return [...LlamaLendControllerAbi, ...LlamaLendAmmAbi];
39668
40267
  if (isDssType(lender)) return [...UsddVatAbi];
@@ -39673,7 +40272,7 @@ var getAbi2 = (lender) => {
39673
40272
  return [...ResupplyPairAbi, ...VAULT_CONVERT_ABI];
39674
40273
  if (isCurvance(lender))
39675
40274
  return [...CurvanceMarketManagerAbi, ...CurvanceCTokenAbi];
39676
- if (isTwyne(lender)) return [...TwyneCollateralVaultAbi];
40275
+ if (isTwyne(lender)) return TWYNE_USER_ABI;
39677
40276
  if (isInit(lender)) return InitLensAbi;
39678
40277
  if (isEulerType(lender)) return accountLensAbi;
39679
40278
  if (isCompoundV2Type(lender))
@@ -46810,6 +47409,192 @@ var NATIVE_WNLP_ENTRIES = Object.fromEntries(
46810
47409
  )
46811
47410
  ])
46812
47411
  );
47412
+ var REWARD_RATE_ABI = [
47413
+ {
47414
+ name: "getCurrentRewardRate",
47415
+ type: "function",
47416
+ stateMutability: "view",
47417
+ inputs: [{ type: "address", name: "token" }],
47418
+ outputs: [{ type: "uint256" }]
47419
+ }
47420
+ ];
47421
+ var BITWAY_LEGS = [
47422
+ // Absolute Return 0x5C4a6903…
47423
+ {
47424
+ share: "0xccafb706225331aedfec75b5347d462b98ed2fd2",
47425
+ // bwUSDT
47426
+ vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47427
+ token: "0x55d398326f99059ff775485246999027b3197955"
47428
+ // USDT
47429
+ },
47430
+ {
47431
+ share: "0xaa3d2534b4b87a2859e28c223f18265244ffffb7",
47432
+ // bwU
47433
+ vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47434
+ token: "0xce24439f2d9c6a2289f741120fe202248b666666"
47435
+ // U
47436
+ },
47437
+ {
47438
+ share: "0x82356c921422a2202e0f96dfccc352598ca8ef71",
47439
+ // bwBTW
47440
+ vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47441
+ token: "0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa"
47442
+ // BTW
47443
+ },
47444
+ // Core Alpha 0xb82E3206…
47445
+ {
47446
+ share: "0x73af543d809c8d3414e5b92b3aa2c25b182ba3a1",
47447
+ // BTWUSDT
47448
+ vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47449
+ token: "0x55d398326f99059ff775485246999027b3197955"
47450
+ // USDT
47451
+ },
47452
+ {
47453
+ share: "0xb5c3617d4f077851cc6c7fae558d32e9782307f9",
47454
+ // BTWUSD1
47455
+ vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47456
+ token: "0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d"
47457
+ // USD1
47458
+ },
47459
+ {
47460
+ share: "0x4effb6bce5cad64d7162c7f7f15f557221b106d5",
47461
+ // BTWU
47462
+ vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47463
+ token: "0xce24439f2d9c6a2289f741120fe202248b666666"
47464
+ // U
47465
+ }
47466
+ ];
47467
+ var bitwayYieldKey = (share) => `bitway::${Chain.BNB_SMART_CHAIN_MAINNET}::${share.toLowerCase()}`;
47468
+ var bitwayFetcher = {
47469
+ label: "BITWAY_EARN",
47470
+ fetch: async () => {
47471
+ const rates = await multicallRetryUniversal({
47472
+ chain: Chain.BNB_SMART_CHAIN_MAINNET,
47473
+ abi: REWARD_RATE_ABI,
47474
+ calls: BITWAY_LEGS.map(({ vault, token }) => ({
47475
+ address: vault,
47476
+ name: "getCurrentRewardRate",
47477
+ params: [token]
47478
+ })),
47479
+ allowFailure: true
47480
+ });
47481
+ const out = {};
47482
+ BITWAY_LEGS.forEach(({ share }, i) => {
47483
+ const raw = rates[i];
47484
+ if (typeof raw !== "bigint") return;
47485
+ const apr = Number(raw) / 100;
47486
+ if (Number.isFinite(apr) && apr >= 0 && apr <= 1e3) {
47487
+ out[bitwayYieldKey(share)] = apr;
47488
+ }
47489
+ });
47490
+ if (Object.keys(out).length === 0) {
47491
+ throw new Error("Bitway: no leg returned a readable reward rate");
47492
+ }
47493
+ return out;
47494
+ }
47495
+ };
47496
+
47497
+ // src/vaults/savings/registryBitway.ts
47498
+ var BITWAY_LEGS2 = [
47499
+ [
47500
+ "bwUSDT",
47501
+ "Absolute Return USDT",
47502
+ "0xccafb706225331aedfec75b5347d462b98ed2fd2",
47503
+ "0x55d398326f99059ff775485246999027b3197955",
47504
+ "USDT",
47505
+ "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47506
+ "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
47507
+ "the Absolute Return strategy (0.5% instant-exit fee)"
47508
+ ],
47509
+ [
47510
+ "bwU",
47511
+ "Absolute Return U",
47512
+ "0xaa3d2534b4b87a2859e28c223f18265244ffffb7",
47513
+ "0xce24439f2d9c6a2289f741120fe202248b666666",
47514
+ "U",
47515
+ "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47516
+ "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
47517
+ "the Absolute Return strategy (0.5% instant-exit fee)"
47518
+ ],
47519
+ [
47520
+ "bwBTW",
47521
+ "Absolute Return BTW",
47522
+ "0x82356c921422a2202e0f96dfccc352598ca8ef71",
47523
+ "0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa",
47524
+ "BTW",
47525
+ "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
47526
+ "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
47527
+ "the Absolute Return strategy (0.5% instant-exit fee). The rate is denominated in BTW, Bitway's own volatile token \u2014 not in dollars"
47528
+ ],
47529
+ [
47530
+ "BTWUSDT",
47531
+ "Core Alpha USDT",
47532
+ "0x73af543d809c8d3414e5b92b3aa2c25b182ba3a1",
47533
+ "0x55d398326f99059ff775485246999027b3197955",
47534
+ "USDT",
47535
+ "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47536
+ "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
47537
+ "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
47538
+ ],
47539
+ [
47540
+ "BTWUSD1",
47541
+ "Core Alpha USD1",
47542
+ "0xb5c3617d4f077851cc6c7fae558d32e9782307f9",
47543
+ "0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d",
47544
+ "USD1",
47545
+ "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47546
+ "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
47547
+ "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
47548
+ ],
47549
+ [
47550
+ "BTWU",
47551
+ "Core Alpha U",
47552
+ "0x4effb6bce5cad64d7162c7f7f15f557221b106d5",
47553
+ "0xce24439f2d9c6a2289f741120fe202248b666666",
47554
+ "U",
47555
+ "0xb82e32062c773c7748776c06fdb11b92edae3b63",
47556
+ "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
47557
+ "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
47558
+ ]
47559
+ ];
47560
+ var BITWAY_ENTRIES = {
47561
+ [Chain.BNB_SMART_CHAIN_MAINNET]: BITWAY_LEGS2.map(
47562
+ ([
47563
+ symbol,
47564
+ label,
47565
+ address,
47566
+ underlying,
47567
+ underlyingSymbol,
47568
+ stakingVault,
47569
+ withdrawVault,
47570
+ strategyNote
47571
+ ]) => ({
47572
+ reader: "bitway-vault",
47573
+ address,
47574
+ underlying,
47575
+ symbol,
47576
+ label,
47577
+ brand: "Bitway",
47578
+ description: `${symbol} is the receipt for ${underlyingSymbol} staked into Bitway Earn's ${strategyNote}. Capital runs market-neutral trading in CEX/custodian accounts; yield settles at a fixed admin-set rate with no on-chain solvency invariant. Exit: free 7-day queue (payout frozen at the request-time rate) or an instant withdrawal capped by a small on-chain buffer. Withdrawal rights stay with the staking address \u2014 a transferee of the receipt token cannot exit.`,
47579
+ decimals: 18,
47580
+ underlyingDecimals: 18,
47581
+ isRebasing: false,
47582
+ isMintable: true,
47583
+ mintContract: stakingVault,
47584
+ accrual: "linear",
47585
+ withdrawalMode: "fee-or-queued",
47586
+ withdrawalCooldownSeconds: 604800,
47587
+ withdrawQueue: withdrawVault,
47588
+ // The instant leg pays from the staking vault's own token balance;
47589
+ // the reader treats `priceOracle` as "where the rate lives" (the
47590
+ // two-arg convertToAssets) — both are the parent vault.
47591
+ inventoryContract: stakingVault,
47592
+ priceOracle: stakingVault,
47593
+ yieldFetcher: bitwayFetcher,
47594
+ yieldKey: bitwayYieldKey(address)
47595
+ })
47596
+ )
47597
+ };
46813
47598
 
46814
47599
  // src/vaults/savings/registry.ts
46815
47600
  var stUsdGroup = {
@@ -47900,7 +48685,15 @@ var SINGLE_CHAIN_ENTRIES = {
47900
48685
  underlying: "0x09d4214c03d01f49544c0448dbe3a27f768f2b34",
47901
48686
  symbol: "wsrUSD",
47902
48687
  brand: "Reservoir",
47903
- description: "rUSD is Reservoir's asset-backed stablecoin; srUSD accrues the Reservoir savings rate funded by the protocol's RWA and credit portfolios, and wsrUSD is its non-rebasing wrapper. Instant exit, subject to PSM liquidity.",
48688
+ // NB: NOT a wrapper of srUSD despite the name verified on-chain
48689
+ // 2026-08-19 (see RESERVOIR.md): a second-generation Savingcoin
48690
+ // directly over rUSD with its own governance-set accumulator.
48691
+ // Deposits burn rUSD and exits mint it, so the vault custodies
48692
+ // nothing and there is no on-chain solvency invariant (the
48693
+ // CreditEnforcer's covenant minimums are zeroed and its adapters
48694
+ // removed). Exit to rUSD is instant/unlimited; par exit to USDC is
48695
+ // bounded by live USDC-PSM inventory (~0.1% of the book).
48696
+ description: "rUSD is Reservoir's asset-backed stablecoin; wsrUSD accrues the Reservoir savings rate (governance-set, funded by the protocol's RWA and credit portfolios) directly on rUSD \u2014 reserves are managed off-chain with no on-chain solvency invariant. Exit to rUSD is instant; converting onward to USDC at par depends on the PSM's live inventory, a small fraction of the book.",
47904
48697
  decimals: 18,
47905
48698
  isRebasing: false,
47906
48699
  isMintable: true,
@@ -48469,6 +49262,10 @@ var SAVINGS_REGISTRY = (() => {
48469
49262
  if (!out[chainId]) out[chainId] = [];
48470
49263
  out[chainId].push(...entries);
48471
49264
  }
49265
+ for (const [chainId, entries] of Object.entries(BITWAY_ENTRIES)) {
49266
+ if (!out[chainId]) out[chainId] = [];
49267
+ out[chainId].push(...entries);
49268
+ }
48472
49269
  return out;
48473
49270
  })();
48474
49271
  var savingsBalanceKind = (chainId, address) => {
@@ -49148,8 +49945,13 @@ var UPSHIFT_CHAIN_IDS = /* @__PURE__ */ new Set([
49148
49945
  // Plasma
49149
49946
  "57073",
49150
49947
  // Ink
49151
- "999"
49948
+ "999",
49152
49949
  // HyperEVM
49950
+ // Citrea. Added 2026-08-19: the listing carries a live, visible $2.56M
49951
+ // RockawayX vault there (`Earn ctUSD`) that this gate was short-circuiting
49952
+ // away — the fetch itself is HTTP-only and chain-agnostic, so a chain
49953
+ // missing from this set is the only thing that can hide one.
49954
+ "4114"
49153
49955
  ]);
49154
49956
  var hasUpshiftVaults = (chainId) => UPSHIFT_CHAIN_IDS.has(String(chainId));
49155
49957
  async function fetchUpshiftApiVaults() {
@@ -49998,7 +50800,7 @@ var dtrinityRebateRewardFetcher = {
49998
50800
  }
49999
50801
  };
50000
50802
  var SECONDS_PER_YEAR14 = 31536e3;
50001
- var WAD15 = 10n ** 18n;
50803
+ var WAD16 = 10n ** 18n;
50002
50804
  var ZERO2 = "0x0000000000000000000000000000000000000000";
50003
50805
  var UNBOOSTED_FACTOR = 0.4;
50004
50806
  var MAX_BOOST = 2.5;
@@ -50216,7 +51018,7 @@ async function fetchForChain(chainId, nowSeconds) {
50216
51018
  { address: m.gauge, name: "totalSupply", params: [] },
50217
51019
  { address: m.gauge, name: "is_killed", params: [] },
50218
51020
  { address: m.gauge, name: "reward_count", params: [] },
50219
- { address: m.vault, name: "convertToAssets", params: [WAD15] },
51021
+ { address: m.vault, name: "convertToAssets", params: [WAD16] },
50220
51022
  isL1 ? {
50221
51023
  address: GAUGE_CONTROLLER,
50222
51024
  name: "gauge_relative_weight",
@@ -50232,7 +51034,7 @@ async function fetchForChain(chainId, nowSeconds) {
50232
51034
  abi: GAUGE_ABI,
50233
51035
  allowFailure: true
50234
51036
  });
50235
- const big20 = (v) => {
51037
+ const big22 = (v) => {
50236
51038
  try {
50237
51039
  if (typeof v === "bigint") return v;
50238
51040
  if (typeof v === "string" && v !== "0x") return BigInt(v);
@@ -50246,15 +51048,15 @@ async function fetchForChain(chainId, nowSeconds) {
50246
51048
  const b = i * STRIDE;
50247
51049
  return {
50248
51050
  market: m,
50249
- inflationRate: big20(r1[b]),
50250
- workingSupply: big20(r1[b + 1]),
50251
- totalSupply: big20(r1[b + 2]),
51051
+ inflationRate: big22(r1[b]),
51052
+ workingSupply: big22(r1[b + 1]),
51053
+ totalSupply: big22(r1[b + 2]),
50252
51054
  isKilled: r1[b + 3] === true,
50253
- rewardCount: Number(big20(r1[b + 4])),
50254
- pricePerShare: big20(r1[b + 5]),
51055
+ rewardCount: Number(big22(r1[b + 4])),
51056
+ pricePerShare: big22(r1[b + 5]),
50255
51057
  // Off L1 the child gauge's own rate is already market-scoped, so the
50256
51058
  // weight is the identity.
50257
- relativeWeight: isL1 ? big20(r1[b + 6]) : WAD15
51059
+ relativeWeight: isL1 ? big22(r1[b + 6]) : WAD16
50258
51060
  };
50259
51061
  });
50260
51062
  const tokenCalls = state.flatMap(
@@ -50347,7 +51149,7 @@ async function fetchForChain(chainId, nowSeconds) {
50347
51149
  const decoded = decodeRewardData(data);
50348
51150
  if (!decoded) continue;
50349
51151
  const { periodFinish, rate } = decoded;
50350
- const decimals = typeof decRaw === "number" ? decRaw : Number(big20(decRaw) || 18n);
51152
+ const decimals = typeof decRaw === "number" ? decRaw : Number(big22(decRaw) || 18n);
50351
51153
  const rewardPrice = priceOf(prices, chainId, token);
50352
51154
  const apr = extraRewardApr({
50353
51155
  rate,
@@ -50777,7 +51579,8 @@ function generateMorphoLenderKey(marketId) {
50777
51579
  }
50778
51580
  function getMorphoMarketsForChain(chainId, marketOverrides) {
50779
51581
  const chainOverrides = marketOverrides?.[chainId] ?? [];
50780
- return chainOverrides.map((override) => ({
51582
+ const markets = chainOverrides.length ? chainOverrides : morphoTypeOracles()?.[chainId]?.[Lender.MORPHO_BLUE] ?? [];
51583
+ return markets.map((override) => ({
50781
51584
  oracle: override.oracle,
50782
51585
  loanAsset: override.loanAsset,
50783
51586
  collateralAsset: override.collateralAsset,
@@ -51362,7 +52165,7 @@ function getDssCalls(chainId) {
51362
52165
  return results;
51363
52166
  }
51364
52167
  var RAY10 = 1e27;
51365
- var big17 = (v) => {
52168
+ var big19 = (v) => {
51366
52169
  try {
51367
52170
  if (typeof v === "bigint") return v;
51368
52171
  if (v == null || v === "0x") return 0n;
@@ -51374,16 +52177,16 @@ var big17 = (v) => {
51374
52177
  var field12 = (res, name, idx) => {
51375
52178
  const v = res?.[name];
51376
52179
  if (typeof v === "bigint" || typeof v === "number" || typeof v === "string") {
51377
- return big17(v);
52180
+ return big19(v);
51378
52181
  }
51379
- return big17(res?.[idx]);
52182
+ return big19(res?.[idx]);
51380
52183
  };
51381
52184
  function parseDssResults(data, meta, context) {
51382
52185
  const { chainId } = context;
51383
52186
  const key3 = dssLenderKey(meta.lender, chainId, meta.ilk);
51384
52187
  const entries = [];
51385
52188
  const spot = field12(data?.[0], "spot", 2);
51386
- const mat = big17(meta.mat);
52189
+ const mat = big19(meta.mat);
51387
52190
  if (spot > 0n && mat > 0n) {
51388
52191
  const collUSD = Number(spot) / RAY10 * (Number(mat) / RAY10);
51389
52192
  if (collUSD > 0 && collUSD < 1e9) {
@@ -57655,7 +58458,7 @@ var num4 = (v) => {
57655
58458
  const n = Number(v);
57656
58459
  return Number.isFinite(n) ? n : 0;
57657
58460
  };
57658
- var big18 = (v) => {
58461
+ var big20 = (v) => {
57659
58462
  try {
57660
58463
  if (v === void 0 || v === null || v === "") return "0";
57661
58464
  const s = String(v);
@@ -57691,12 +58494,12 @@ async function fetchTermMaxVaultsFromApi(chainId, prices = {}, tokenList = {}, f
57691
58494
  const assetEntry = tokenList[underlying];
57692
58495
  const priceKey = toOracleKey(assetEntry?.assetGroup) || toGenericPriceKey(underlying, chainId);
57693
58496
  const priceUsd = prices[priceKey];
57694
- const totalAssets = big18(r.totalAssets);
57695
- const totalSupply = big18(r.totalSupplyAmt);
58497
+ const totalAssets = big20(r.totalAssets);
58498
+ const totalSupply = big20(r.totalSupplyAmt);
57696
58499
  const totalAssetsFormatted = Number(totalAssets) / scale3;
57697
58500
  const supplyRate = num4(r.apr) * 100;
57698
58501
  const rewardsRate = num4(r?.incentiveData?.TMX_APR) * 100;
57699
- const rawLiquidity = BigInt(big18(r.redeemableAmt ?? r.idleFunds ?? "0"));
58502
+ const rawLiquidity = BigInt(big20(r.redeemableAmt ?? r.idleFunds ?? "0"));
57700
58503
  const totalAssetsBig = BigInt(totalAssets);
57701
58504
  const liquidity = (rawLiquidity > totalAssetsBig ? totalAssetsBig : rawLiquidity).toString();
57702
58505
  const liquidityFormatted = Number(liquidity) / scale3;
@@ -57732,7 +58535,7 @@ async function fetchTermMaxVaultsFromApi(chainId, prices = {}, tokenList = {}, f
57732
58535
  liquidityUsd: priceUsd ? liquidityFormatted * priceUsd : 0,
57733
58536
  version: r.version,
57734
58537
  isPaused: r.isPaused === true || void 0,
57735
- supplyCap: r.capacity ? big18(r.capacity) : void 0,
58538
+ supplyCap: r.capacity ? big20(r.capacity) : void 0,
57736
58539
  basePool: r.poolAddress ? lower3(r.poolAddress) : void 0
57737
58540
  };
57738
58541
  }
@@ -57788,7 +58591,7 @@ var Erc20DecimalsBalanceAbi = [
57788
58591
 
57789
58592
  // src/vaults/termmax/fetchFromChain.ts
57790
58593
  var DECIMAL_BASE2 = 100000000n;
57791
- var big19 = (v) => {
58594
+ var big21 = (v) => {
57792
58595
  if (v === void 0 || v === null || v === "0x") return 0n;
57793
58596
  try {
57794
58597
  return typeof v === "bigint" ? v : BigInt(v);
@@ -57852,7 +58655,7 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
57852
58655
  vaults.forEach((address, i) => {
57853
58656
  const at = (k) => res[i * READS_PER_VAULT + VAULT_READS.indexOf(k)];
57854
58657
  const asset = addr(at("asset"));
57855
- const totalAssets = big19(at("totalAssets"));
58658
+ const totalAssets = big21(at("totalAssets"));
57856
58659
  if (!asset || totalAssets === 0n) return;
57857
58660
  rows.push({
57858
58661
  address,
@@ -57861,11 +58664,11 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
57861
58664
  decimals: num5(at("decimals")) ?? 18,
57862
58665
  asset,
57863
58666
  totalAssets,
57864
- totalSupply: big19(at("totalSupply")),
57865
- annualizedInterest: big19(at("annualizedInterest")),
57866
- accretingPrincipal: big19(at("accretingPrincipal")),
57867
- performanceFeeRate: big19(at("performanceFeeRate")),
57868
- aprRaw: at("apr") != null ? big19(at("apr")) : void 0,
58667
+ totalSupply: big21(at("totalSupply")),
58668
+ annualizedInterest: big21(at("annualizedInterest")),
58669
+ accretingPrincipal: big21(at("accretingPrincipal")),
58670
+ performanceFeeRate: big21(at("performanceFeeRate")),
58671
+ aprRaw: at("apr") != null ? big21(at("apr")) : void 0,
57869
58672
  curator: addr(at("curator")),
57870
58673
  guardian: addr(at("guardian")),
57871
58674
  timelock: num5(at("timelock")),
@@ -57886,7 +58689,7 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
57886
58689
  const out = {};
57887
58690
  rows.forEach((r, i) => {
57888
58691
  const assetDecimals = num5(res2[i * 2]) ?? r.decimals;
57889
- const idle = big19(res2[i * 2 + 1]);
58692
+ const idle = big21(res2[i * 2 + 1]);
57890
58693
  const assetEntry = tokenList[r.asset];
57891
58694
  const priceKey = toOracleKey(assetEntry?.assetGroup) || toGenericPriceKey(r.asset, chainId);
57892
58695
  const priceUsd = prices[priceKey];
@@ -63393,6 +64196,45 @@ var NativeWithdrawQueueReadAbi = [
63393
64196
  }
63394
64197
  ];
63395
64198
 
64199
+ // src/vaults/savings/abis/bitway.ts
64200
+ var BitwayVaultReadAbi = [
64201
+ {
64202
+ name: "convertToAssets",
64203
+ type: "function",
64204
+ stateMutability: "view",
64205
+ inputs: [{ type: "uint256" }, { type: "address", name: "token" }],
64206
+ outputs: [{ type: "uint256" }]
64207
+ },
64208
+ {
64209
+ name: "getTVL",
64210
+ type: "function",
64211
+ stateMutability: "view",
64212
+ inputs: [{ type: "address", name: "token" }],
64213
+ outputs: [{ type: "uint256" }]
64214
+ },
64215
+ {
64216
+ name: "getContractBalance",
64217
+ type: "function",
64218
+ stateMutability: "view",
64219
+ inputs: [{ type: "address", name: "token" }],
64220
+ outputs: [{ type: "uint256" }]
64221
+ },
64222
+ {
64223
+ name: "getCurrentRewardRate",
64224
+ type: "function",
64225
+ stateMutability: "view",
64226
+ inputs: [{ type: "address", name: "token" }],
64227
+ outputs: [{ type: "uint256" }]
64228
+ },
64229
+ {
64230
+ name: "WAITING_TIME",
64231
+ type: "function",
64232
+ stateMutability: "view",
64233
+ inputs: [],
64234
+ outputs: [{ type: "uint256" }]
64235
+ }
64236
+ ];
64237
+
63396
64238
  // src/vaults/savings/abis/frankencoin.ts
63397
64239
  var FrankencoinSavingsReadAbi = [
63398
64240
  {
@@ -63607,6 +64449,65 @@ var readerErc4626WithdrawLimit = (entry) => {
63607
64449
  };
63608
64450
  };
63609
64451
 
64452
+ // src/vaults/savings/readers/bitwayVault.ts
64453
+ var BITWAY_PENALTY_BPS = {
64454
+ // Absolute Return
64455
+ "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1": 50,
64456
+ // Core Alpha
64457
+ "0xb82e32062c773c7748776c06fdb11b92edae3b63": 0
64458
+ };
64459
+ var readerBitwayVault = (entry) => {
64460
+ const { address, underlying, priceOracle } = entry;
64461
+ const vault = priceOracle ?? entry.mintContract ?? address;
64462
+ const shareUnit = 10n ** BigInt(entry.decimals);
64463
+ const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
64464
+ const penaltyBps = BITWAY_PENALTY_BPS[vault.toLowerCase()];
64465
+ return {
64466
+ calls: [
64467
+ { address, name: "totalSupply", params: [] },
64468
+ {
64469
+ address: vault,
64470
+ name: "convertToAssets",
64471
+ params: [ONE_E1813, underlying]
64472
+ },
64473
+ { address: vault, name: "getContractBalance", params: [underlying] },
64474
+ { address: vault, name: "WAITING_TIME", params: [] }
64475
+ ],
64476
+ abis: [
64477
+ TotalSupplyAbi2,
64478
+ BitwayVaultReadAbi,
64479
+ BitwayVaultReadAbi,
64480
+ BitwayVaultReadAbi
64481
+ ],
64482
+ parse: ([supply, rate, buffer, waitingTime]) => {
64483
+ const totalSupply = toBigInt16(supply);
64484
+ const exchangeRate = toBigInt16(rate);
64485
+ if (totalSupply === void 0 || exchangeRate === void 0 || exchangeRate === 0n) {
64486
+ return void 0;
64487
+ }
64488
+ const capacity = toBigInt16(buffer);
64489
+ const wait = toBigInt16(waitingTime);
64490
+ return {
64491
+ // totalSupply is in raw share units; convert to raw underlying.
64492
+ // (Every live leg is 18/18-dec — BSC stables are 18-dec — but the
64493
+ // rescale keeps a future 6-dec listing honest.)
64494
+ totalAssets: totalSupply * exchangeRate * underlyingUnit / (shareUnit * ONE_E1813),
64495
+ totalSupply,
64496
+ exchangeRate,
64497
+ withdrawFeeBps: penaltyBps,
64498
+ // The flash flag has no getter either (`flashNotEnable`, packed
64499
+ // storage — enabled on both vaults live). A drained buffer already
64500
+ // zeroes the instant leg's reported liquidity, which is the same
64501
+ // caller-visible outcome as a disabled flash path.
64502
+ instantRedeemEnabled: penaltyBps !== void 0 ? true : void 0,
64503
+ instantRedeemCapacity: capacity,
64504
+ withdrawalCooldownSeconds: wait !== void 0 && wait <= 366n * 86400n ? Number(wait) : void 0,
64505
+ withdrawQueue: entry.withdrawQueue
64506
+ };
64507
+ }
64508
+ };
64509
+ };
64510
+
63610
64511
  // src/vaults/savings/readers/frankencoinSavings.ts
63611
64512
  var readerFrankencoinSavings = (entry) => ({
63612
64513
  calls: [
@@ -63866,6 +64767,8 @@ var buildReader2 = (entry) => {
63866
64767
  return readerFrankencoinSavings(entry);
63867
64768
  case "hyperbeat-vault":
63868
64769
  return readerHyperbeatVault(entry);
64770
+ case "bitway-vault":
64771
+ return readerBitwayVault(entry);
63869
64772
  case "yieldbasis-lt":
63870
64773
  return readerYieldBasisLt(entry);
63871
64774
  case "wren-nav":
@@ -64516,6 +65419,7 @@ function parseVault8(v, chainId, prices, tokenList) {
64516
65419
  const vaultAddr = (v?.address ?? receiptAddr).toLowerCase();
64517
65420
  const asset0 = v.depositAssets?.find((a) => a?.address);
64518
65421
  const assetAddr = (asset0?.address ?? "").toLowerCase();
65422
+ const depositAssets = (v.depositAssets ?? []).map((a) => (a?.address ?? "").toLowerCase()).filter((a) => isEvmAddress(a));
64519
65423
  if (!receiptAddr || !assetAddr) return null;
64520
65424
  if (!isEvmAddress(receiptAddr) || !isEvmAddress(assetAddr)) return null;
64521
65425
  const assetMeta = tokenList[assetAddr];
@@ -64553,6 +65457,7 @@ function parseVault8(v, chainId, prices, tokenList) {
64553
65457
  address: receiptAddr,
64554
65458
  vaultAddress: vaultAddr,
64555
65459
  underlying: assetAddr,
65460
+ depositAssets,
64556
65461
  symbol,
64557
65462
  name: name || symbol,
64558
65463
  decimals,
@@ -64603,6 +65508,7 @@ function parseVault8(v, chainId, prices, tokenList) {
64603
65508
  totalAssetsUsd
64604
65509
  };
64605
65510
  }
65511
+ var isServable = (v) => v?.isVisible !== false || v?.withdrawalOnly === true;
64606
65512
  var fetchUpshiftVaults = async (chainId, prices = {}, tokenList = {}) => {
64607
65513
  if (!hasUpshiftVaults(chainId)) return {};
64608
65514
  const items = await fetchUpshiftApiVaults();
@@ -64610,7 +65516,7 @@ var fetchUpshiftVaults = async (chainId, prices = {}, tokenList = {}) => {
64610
65516
  const out = {};
64611
65517
  for (const item of items) {
64612
65518
  if (Number(item?.chainId) !== want) continue;
64613
- if (item?.isVisible === false) continue;
65519
+ if (!isServable(item)) continue;
64614
65520
  const parsed = parseVault8(item, chainId, prices, tokenList);
64615
65521
  if (parsed) out[parsed.address] = parsed;
64616
65522
  }
@@ -65723,23 +66629,23 @@ var priceGmMarkets = async (chainId, multicallRetry, markets, prices) => {
65723
66629
  const indexMax = price(prices, m.indexToken)?.max;
65724
66630
  if (Array.isArray(dsRes) && longMax != null && shortMax != null) {
65725
66631
  const base = i * SLOTS;
65726
- const big20 = (j) => typeof dsRes[base + j] === "bigint" ? dsRes[base + j] : 0n;
66632
+ const big22 = (j) => typeof dsRes[base + j] === "bigint" ? dsRes[base + j] : 0n;
65727
66633
  const cap = computeDepositCapacityUsd(
65728
- [info?.longTokenAmount, longMax, big20(0), big20(2)],
65729
- [info?.shortTokenAmount, shortMax, big20(1), big20(3)]
66634
+ [info?.longTokenAmount, longMax, big22(0), big22(2)],
66635
+ [info?.shortTokenAmount, shortMax, big22(1), big22(3)]
65730
66636
  );
65731
66637
  if (cap != null) value.depositCapacityUsd = cap;
65732
66638
  if (indexMax != null) {
65733
66639
  const divisor = m.longToken.toLowerCase() === m.shortToken.toLowerCase() ? 2n : 1n;
65734
- const reservedUsdLong = (big20(4) + big20(5)) / divisor * indexMax;
65735
- const reservedUsdShort = (big20(6) + big20(7)) / divisor;
66640
+ const reservedUsdLong = (big22(4) + big22(5)) / divisor * indexMax;
66641
+ const reservedUsdShort = (big22(6) + big22(7)) / divisor;
65736
66642
  const liq = computeLiquidityUsd(
65737
66643
  info?.longTokenUsd,
65738
66644
  info?.shortTokenUsd,
65739
66645
  reservedUsdLong,
65740
66646
  reservedUsdShort,
65741
- big20(8),
65742
- big20(9)
66647
+ big22(8),
66648
+ big22(9)
65743
66649
  );
65744
66650
  if (liq != null)
65745
66651
  value.liquidityUsd = Math.max(0, Math.min(liq, value.tvlUsd));
@@ -65938,21 +66844,21 @@ var fetchGmxExecutionFees = async (chainId, multicallRetry, gasPriceWei) => {
65938
66844
  } catch {
65939
66845
  return void 0;
65940
66846
  }
65941
- const big20 = (i) => typeof res[i] === "bigint" ? res[i] : 0n;
65942
- const base = big20(0);
65943
- const mult = big20(1);
66847
+ const big22 = (i) => typeof res[i] === "bigint" ? res[i] : 0n;
66848
+ const base = big22(0);
66849
+ const mult = big22(1);
65944
66850
  if (base === 0n && mult === 0n) return void 0;
65945
66851
  const PRECISION = 10n ** 30n;
65946
66852
  const adjusted = (opGas) => base + opGas * mult / PRECISION;
65947
66853
  const fee = (opGas) => (adjusted(opGas) * gasPriceWei).toString();
65948
- const glvExtra = big20(6) * GLV_NOMINAL_MARKET_COUNT;
66854
+ const glvExtra = big22(6) * GLV_NOMINAL_MARKET_COUNT;
65949
66855
  return {
65950
66856
  chainId,
65951
66857
  gasPriceWei: gasPriceWei.toString(),
65952
- deposit: fee(big20(2)),
65953
- withdrawal: fee(big20(3)),
65954
- glvDeposit: fee(big20(4) + glvExtra),
65955
- glvWithdrawal: fee(big20(5) + glvExtra)
66858
+ deposit: fee(big22(2)),
66859
+ withdrawal: fee(big22(3)),
66860
+ glvDeposit: fee(big22(4) + glvExtra),
66861
+ glvWithdrawal: fee(big22(5) + glvExtra)
65956
66862
  };
65957
66863
  };
65958
66864
 
@@ -67610,6 +68516,27 @@ var TERM_PROFILES = [
67610
68516
  ]
67611
68517
  }
67612
68518
  }),
68519
+ P({
68520
+ id: "cooler.mono@v1",
68521
+ name: "Olympus Cooler V2 (MonoCooler)",
68522
+ family: "cooler",
68523
+ supply: {
68524
+ description: "gOHM collateral on a treasury-backed CDP. It earns nothing here \u2014 gOHM staking emissions are currently zero \u2014 and it backs only your own debt.",
68525
+ implications: [
68526
+ "Your counterparty is the Olympus treasury itself: there are no external lenders, and collateral seized in a liquidation is unstaked and BURNED."
68527
+ ]
68528
+ },
68529
+ borrow: {
68530
+ description: "A perpetual treasury CDP at a fixed protocol-set rate \u2014 0.5 % effective today, governance-settable with a hard 10 % cap. There is NO price-based liquidation: the LTV is a debt-per-gOHM PRICE that only ratchets up, and the sole trigger is your accruing debt outrunning that ratchet (LLTV = OLTV \xD7 1.01).",
68531
+ implications: [
68532
+ "No market price enters the solvency math: liquidation happens only if your compounding debt crosses the up-only governance LTV ratchet, never because the gOHM price moved. A max-borrowed account needs roughly two years of a frozen ratchet to cross.",
68533
+ "If liquidated, your gOHM is unstaked and BURNED \u2014 there is no auction and no external lender to make whole; the counterparty is the Olympus treasury.",
68534
+ "There is a 1,000 USDS minimum debt: it gates borrows AND partial repays \u2014 any action leaving a debt below it reverts (a full repay is always fine).",
68535
+ "The position is perpetual \u2014 no maturity, no expiry.",
68536
+ "The debt token itself is governance-swappable (a new treasury borrower can replace USDS), so read it live rather than assuming USDS."
68537
+ ]
68538
+ }
68539
+ }),
67613
68540
  P({
67614
68541
  id: "dss.cdp@v1",
67615
68542
  name: "Maker-style (dss) CDP ilk",
@@ -67896,7 +68823,7 @@ var TERM_SHEET_SCHEMA_VERSION = 1;
67896
68823
 
67897
68824
  // src/terms/buildTermSheet.ts
67898
68825
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
67899
- var clamp01 = (v) => Math.max(0, Math.min(1, v));
68826
+ var clamp012 = (v) => Math.max(0, Math.min(1, v));
67900
68827
  function assetRef(input) {
67901
68828
  const a = input.asset ?? {};
67902
68829
  return {
@@ -68083,6 +69010,9 @@ function resolveMinDebt(input) {
68083
69010
  m.river?.minNetDebt,
68084
69011
  // Inverse FiRM.
68085
69012
  m.inverse?.minDebt,
69013
+ // Cooler (Olympus V2) — `minDebtRequired`, 1,000 USDS. Gates borrows AND
69014
+ // partial repays: any action leaving 0 < debt < minDebt reverts.
69015
+ m.cooler?.minDebt,
68086
69016
  // dss (Sky / the USDD fork): `dust` IS the per-vault debt floor.
68087
69017
  m.dss?.dust ?? m.usdd?.dust,
68088
69018
  // Gearbox credit facade.
@@ -68109,7 +69039,7 @@ function resolveMinCollateral(input) {
68109
69039
  }
68110
69040
  function capUtil(total, cap) {
68111
69041
  if (!isNum(cap) || cap <= 0 || !isNum(total)) return void 0;
68112
- return clamp01(total / cap);
69042
+ return clamp012(total / cap);
68113
69043
  }
68114
69044
  function buildAvailability(input, side) {
68115
69045
  const frozen = input.isFrozen === true;
@@ -68148,7 +69078,7 @@ function buildUtilization(input) {
68148
69078
  if (!isNum(input.utilization)) return void 0;
68149
69079
  const shared = isNum(input.irmTotalDeposits) && isNum(input.irmTotalDebt);
68150
69080
  return {
68151
- utilization: clamp01(input.utilization),
69081
+ utilization: clamp012(input.utilization),
68152
69082
  basis: shared ? "pool" : "market",
68153
69083
  irmTotalDeposits: input.irmTotalDeposits,
68154
69084
  irmTotalDebt: input.irmTotalDebt,
@@ -68288,7 +69218,7 @@ function buildSupply(input, now, siblings) {
68288
69218
  const liquidity = isNum(input.totalLiquidity) ? {
68289
69219
  assets: input.totalLiquidity,
68290
69220
  assetsUsd: input.totalLiquidityUsd,
68291
- ratio: isNum(input.totalDeposits) && input.totalDeposits > 0 ? clamp01(input.totalLiquidity / input.totalDeposits) : void 0
69221
+ ratio: isNum(input.totalDeposits) && input.totalDeposits > 0 ? clamp012(input.totalLiquidity / input.totalDeposits) : void 0
68292
69222
  } : void 0;
68293
69223
  const supply = {
68294
69224
  role: canBeCollateral ? earns ? "both" : "collateral" : "yield",
@@ -68699,7 +69629,7 @@ function windowFromAprWindow(aprWindow) {
68699
69629
 
68700
69630
  // src/terms/vault/build.ts
68701
69631
  var isNum2 = (v) => typeof v === "number" && Number.isFinite(v);
68702
- var clamp012 = (v) => Math.max(0, Math.min(1, v));
69632
+ var clamp013 = (v) => Math.max(0, Math.min(1, v));
68703
69633
  function buildRate2(input, t, maturity) {
68704
69634
  const hasLegs = input.supplyRate != null || input.rewardsRate != null;
68705
69635
  const base = hasLegs ? input.supplyRate ?? 0 : input.totalRate ?? 0;
@@ -68876,7 +69806,7 @@ function settlementFor(mode, priceRisk) {
68876
69806
  function buildExit(input, t, fees) {
68877
69807
  const mode = resolveExitMode(input, t);
68878
69808
  const priceRisk = resolvePriceRisk(input, t);
68879
- const ratio = input.instantLiquidityRatio ?? (isNum2(input.liquidity) && isNum2(input.totalAssets) && input.totalAssets > 0 ? clamp012(input.liquidity / input.totalAssets) : void 0);
69809
+ const ratio = input.instantLiquidityRatio ?? (isNum2(input.liquidity) && isNum2(input.totalAssets) && input.totalAssets > 0 ? clamp013(input.liquidity / input.totalAssets) : void 0);
68880
69810
  return {
68881
69811
  mode,
68882
69812
  settlement: settlementFor(mode, priceRisk),
@@ -69034,7 +69964,7 @@ function buildUtilization2(input, t) {
69034
69964
  const total = input.expectedLiquidity;
69035
69965
  if (!isNum2(borrowed) || !isNum2(total) || total <= 0) return void 0;
69036
69966
  return {
69037
- utilization: clamp012(borrowed / total),
69967
+ utilization: clamp013(borrowed / total),
69038
69968
  // The ratio is the underlying pool's, not this share token's.
69039
69969
  basis: "pool",
69040
69970
  irmTotalDeposits: total,
@@ -71126,6 +72056,10 @@ var ROW_DESCRIPTOR_KEYS = [
71126
72056
  "river",
71127
72057
  "teller",
71128
72058
  "inverse",
72059
+ // Cooler: the price-LTV ratchet, the drip schedule and the minDebt gate —
72060
+ // the descriptor is the only carrier of the protocol truth (the fractional
72061
+ // factors on the row are display-only).
72062
+ "cooler",
71129
72063
  "exactly",
71130
72064
  "usdd",
71131
72065
  "dss",
@@ -72035,6 +72969,68 @@ var inverseAdapter = {
72035
72969
  }
72036
72970
  })
72037
72971
  };
72972
+ var coolerAdapter = {
72973
+ id: "cooler",
72974
+ matches: isCooler,
72975
+ profileId: () => "cooler.mono@v1",
72976
+ build: (input) => {
72977
+ const c = input.market?.cooler ?? {};
72978
+ return {
72979
+ // The "oracle" is a governance drip schedule, not a price feed — the
72980
+ // solvency path uses no market price at all.
72981
+ oracle: { kind: "none" },
72982
+ supply: {
72983
+ role: "collateral",
72984
+ availability: { opensWith: "both-legs" },
72985
+ counterparty: { kind: "cdp", solvency: "overcollateralized" }
72986
+ },
72987
+ borrow: {
72988
+ rate: {
72989
+ // Governance-set with no curve — the dss/USDD shape.
72990
+ kind: "variable-managed",
72991
+ source: "governance",
72992
+ isLocked: false,
72993
+ /** MAX_INTEREST_RATE — a hard 10 % cap enforced by code. */
72994
+ maxApr: 10
72995
+ },
72996
+ debtShape: "accruing",
72997
+ maturity: { kind: "perpetual" },
72998
+ exit: {
72999
+ earlyRepay: "free",
73000
+ atMaturityCost: "accrued",
73001
+ lateBehaviour: "none",
73002
+ partialAllowed: true,
73003
+ // Over-repay CLAMPS on MonoCooler — a full close is always safe.
73004
+ overRepayReverts: false
73005
+ },
73006
+ liquidation: {
73007
+ // The trigger is TIME, never price: debt compounding at ~0.5 %/yr
73008
+ // against an up-only OLTV ratchet (LLTV = OLTV × 1.01). Never apply
73009
+ // "HF < 1 at spot price ⇒ liquidatable" copy here.
73010
+ trigger: "time",
73011
+ model: "repay-seize",
73012
+ // Seized gOHM is unstaked and BURNED — nobody receives it.
73013
+ seizure: "full-collateral",
73014
+ badDebt: "protocol-absorbed",
73015
+ permissioned: false
73016
+ },
73017
+ counterparty: {
73018
+ kind: "cdp",
73019
+ solvency: "overcollateralized",
73020
+ address: typeof c.addresses?.treasury === "string" ? c.addresses.treasury : void 0
73021
+ },
73022
+ availability: {
73023
+ requires: ["token-approval"]
73024
+ }
73025
+ },
73026
+ constraints: {
73027
+ crossMargin: false,
73028
+ positionModel: "account",
73029
+ positionIdMeaning: "One position per address on the monolithic MonoCooler book \u2014 the account address is the position key."
73030
+ }
73031
+ };
73032
+ }
73033
+ };
72038
73034
  var dssAdapter = {
72039
73035
  id: "dss",
72040
73036
  matches: isDssType,
@@ -72667,6 +73663,7 @@ var TERM_ADAPTERS = [
72667
73663
  liquityAdapter,
72668
73664
  riverAdapter,
72669
73665
  inverseAdapter,
73666
+ coolerAdapter,
72670
73667
  dssAdapter,
72671
73668
  compoundV3Adapter,
72672
73669
  fluidAdapter,
@@ -73442,12 +74439,14 @@ var NON_4626_DEPOSIT_KINDS = /* @__PURE__ */ new Set([
73442
74439
  "yieldbasis",
73443
74440
  "wren",
73444
74441
  "hyperbeat",
73445
- "native-wnlp"
74442
+ "native-wnlp",
74443
+ "bitway"
73446
74444
  ]);
73447
74445
  function acceptsVaultZap(row, provider) {
73448
74446
  if (ZAP_EXCLUDED_PROVIDERS.has(provider)) return false;
73449
74447
  const share = row.shareToken?.address ?? row.ref;
73450
74448
  if (!share) return false;
74449
+ if (provider === "upshift" && isSplitUpshiftRow(row, share)) return false;
73451
74450
  try {
73452
74451
  const entry = findSavingsWithdrawEntry(row.chainId, share);
73453
74452
  if (entry && NON_4626_DEPOSIT_KINDS.has(entry.kind)) return false;
@@ -73456,6 +74455,10 @@ function acceptsVaultZap(row, provider) {
73456
74455
  }
73457
74456
  return true;
73458
74457
  }
74458
+ function isSplitUpshiftRow(row, share) {
74459
+ const deposit = (row.providerMeta ?? {}).depositContract;
74460
+ return typeof deposit === "string" && deposit.toLowerCase() !== String(share).toLowerCase();
74461
+ }
73459
74462
  function isSecondaryMarketRow(row) {
73460
74463
  const meta = row.providerMeta ?? {};
73461
74464
  if (meta.secondaryMarketOnly === true) return true;
@@ -73532,7 +74535,7 @@ function vaultCapabilities(row) {
73532
74535
  caps.push({
73533
74536
  action: "claim",
73534
74537
  async: false,
73535
- requires: claimRequires()
74538
+ requires: claimRequires(row, provider)
73536
74539
  });
73537
74540
  }
73538
74541
  if (supportsCancel(provider, meta)) {
@@ -73548,6 +74551,11 @@ function swapRoutedProvidersArePriceConsistent() {
73548
74551
  return [...SWAP_ROUTED_PROVIDERS].filter((p) => !isBookPriced(p));
73549
74552
  }
73550
74553
  function depositInputs(row, provider) {
74554
+ if (provider === "upshift") {
74555
+ const assets = (row.providerMeta ?? {}).depositAssets;
74556
+ if (!Array.isArray(assets) || assets.length < 2) return void 0;
74557
+ return assets.filter((a) => typeof a === "string").map((asset) => ({ asset, mode: "direct" }));
74558
+ }
73551
74559
  if (provider !== "lst") return void 0;
73552
74560
  const share = row.shareToken?.address ?? row.ref;
73553
74561
  if (!share) return void 0;
@@ -73594,7 +74602,10 @@ function requestRequires(provider) {
73594
74602
  if (isBookPriced(provider)) requires.push("slippage");
73595
74603
  return requires.length ? requires : void 0;
73596
74604
  }
73597
- function claimRequires(provider) {
74605
+ function claimRequires(row, provider) {
74606
+ const share = row.shareToken?.address ?? row.ref;
74607
+ if (provider === "upshift" && share && isSplitUpshiftRow(row, share))
74608
+ return ["claimableEpoch"];
73598
74609
  return void 0;
73599
74610
  }
73600
74611
  function supportsCancel(provider, meta) {
@@ -73803,6 +74814,6 @@ function earnPositionTotals(items) {
73803
74814
  };
73804
74815
  }
73805
74816
 
73806
- export { ApiBookSource, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, EARN_DESCRIPTIONS, EARN_LABELS, EMPTY_BALANCE, EXACTLY_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, TELLER_CALLS_PER_BID, TERMMAX_CALLS_PER_ACCOUNT, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchDolomiteAccountNumbers, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidDexState, fetchFluidFTokens, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchYearnApiVaults, fetchYearnVaults, filterActiveLenders, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isSecondaryMarketOnly, isStablecoinSymbol, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, parseBalanceFetcherResult, parseEarnUid, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, pruneFeedStats, rankFindings, ratePercent, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, resolveAdapter, resolveDerivation, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, supplyDescription, supplyFindings, supplyHeadline, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, tickToAprNumber, tickToPrice, toDigest, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
74817
+ export { ApiBookSource, DEFAULT_MIDNIGHT_API, DEFAULT_OUTLIER_GUARD, DEFAULT_PROFILE_ID, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_TERMMAX_API, EARN_DESCRIPTIONS, EARN_LABELS, EMPTY_BALANCE, EXACTLY_LENDER_KEY, FRACTION_RATE_PROVIDERS, GMX_API_HOSTS, GMX_READ_CONTRACTS, GMX_SUPPORTED_CHAINS, HYPERCORE_VAULT_REGISTRY, IDLE_MARKET_ID, INTERFACE_IDS, LAGOON_API_URL, LAGOON_CHAIN_IDS, MORPHO_LENS, MULTICALL_FAILURE, MaxParamThresholds, PASSTHROUGH_RATE_EPSILON, PENDLE_ASSETS_URL, PENDLE_CHAIN_IDS, PENDLE_MARKETS_URL, SDK_FRACTION_RATE_PROVIDERS, SPECTRA_NETWORKS, SPECTRA_RATE_MAX_PERCENT, SPECTRA_RATE_MIN_PERCENT, STABLECOIN_SYMBOLS, STCELO_MANAGER_ADDRESS, TELLER_CALLS_PER_BID, TERMMAX_CALLS_PER_ACCOUNT, DECIMAL_BASE as TERMMAX_DECIMAL_BASE, TERMMAX_LIQUIDATION_PENALTY, TERMMAX_LIQUIDATION_WINDOW_SECS, TERMMAX_LIQUIDATOR_BONUS, TERMMAX_PARTIAL_CLOSE_FACTOR, TERMMAX_PARTIAL_LIQUIDATION_THRESHOLD_USD, TERM_ADAPTERS, TERM_PROFILES, TERM_SHEET_SCHEMA_VERSION, TermMaxApiSource, TermSubgraphSource, UPSHIFT_CHAIN_IDS, UPSHIFT_VAULTS_URL, VAULT_PROVIDERS, VAULT_PROVIDER_PROFILE, VAULT_PROVIDER_TRAITS, VAULT_SHARE_PRICE_PROBE, VAULT_VENUE_PREFIX, VOLATILE_VAULT_OVERRIDES, YEARN_CHAIN_IDS, YEARN_YDAEMON_BASE, __resetResupplyUserCaches, accountDepositListKey, accountWithdrawalListKey, appendSnapshot, applyPositionDelta, attachImplications, attachPricesToFlashLiquidity, borrowDescription, borrowFindings, borrowHeadline, buildExposures2 as buildExposures, buildFluidFTokensCall, buildLendingPositionUid, buildLiquityUserCall, buildLoopResult, buildMorphoTypeCall, buildMorphoTypeUserCallWithLens, buildPortfolioTotals, buildSumerAccumulators, buildSummaries, buildTellerUserCall, buildTermMaxUserCall, buildTermSheet, buildTermSheetsForGroup, buildVaultEarnUid, buildVaultLookup, buildVaultTermSheet, calculateLeverage, calculateNetApr, calculateOverallNetApr, calculateWeightedAverage, classifyFreshness, classifyReliability, classifyVault, clearPendleMarketsCache, clearSpectraMarketsCache, collateralSymbolsByVenue, collectFeedObservations, computeBorrowDelta2 as computeBorrowDelta, computeCloseTradeDeltas, computeCollateralSwapDeltas, computeDebtSwapDeltas, computeDepositDelta2 as computeDepositDelta, computeEModeAnalysis, computeOpenTradeDeltas, computePostTradeMetrics, computeRepayDelta2 as computeRepayDelta, computeSumerBorrowDelta, computeSumerDepositDelta, computeSumerRepayDelta, computeSumerWaterfall, computeSumerWithdrawDelta, computeVaultApr, computeWithdrawDelta2 as computeWithdrawDelta, computeZapTradeDeltas, consensusReference, convertCoolerMarketsToResponse, convertDssMarketsToResponse, convertExactlyMarketsToResponse, convertFrankencoinMarketsToResponse, convertFraxlendPairsToResponse, convertInverseMarketsToResponse, convertLenderUserDataResult, convertLiquityMarketsToResponse, convertLlamaLendMarketsToResponse, convertResupplyMarketsToResponse, convertRiverMarketsToResponse, convertTellerMarketsToResponse, convertTermMarketsToResponse, convertTermMaxMarketsToResponse, convertUsddMarketsToResponse, createMarketUid, createMidnightBookSource, createMulticallRpcCall, createRawRpcCalls, createTermBookSource, createTermMaxDataSource, decodeListaMarkets, decodeMarkets, decodePackedListaUserDataset, decodePackedMorphoUserDataset, deriveBorrowTags, deriveSupplyTags, detectInterfaceKinds, dexResolverFor, disambiguateEarnNames, dssIlkBytes32, dssKeyParts, dssLenderKey, duration, earnDescription, earnLabel, earnMarketFromPool, earnMarketFromVault, earnMarketLabel, earnPositionFromLenderEntry, earnPositionFromVaultBalance, earnPositionTotals, earnRowSubtitle, earnUidFromMarketUid, earnVaultTerms, earnVenueKind, encodeBalanceFetcherCalldata, enrichTermSheet, enrichmentIndexFromRows, exactlyPairLtv, exactlyPenaltyRateToAprPercent, exactlyWadRateToPercent, feePhrase, feedKeyOf, feedStatKey, fetchCoolerMarkets, fetchDolomiteAccountNumbers, fetchDssMarkets, fetchEulerEarnVaults, fetchEulerEarnVaultsFromSubgraph, fetchEulerSubAccountIndexes, fetchExactlyMarkets, fetchFlashLiquidityForChain, fetchFluidDexState, fetchFluidFTokens, fetchFrankencoinMarkets, fetchFraxlendPairs, fetchGeneralYields, fetchGeneralYieldsByMarketUid, fetchGmxExecutionFees, fetchGmxTickerPrices, fetchGmxVaults, fetchHypercoreVaults, fetchInverseMarkets, fetchLagoonApiVaults, fetchLagoonVaults, fetchLiquityMarkets, fetchListaVaultsFromChain, fetchLlamaLendMarkets, fetchMorphoUserBalances, fetchMorphoUserPositionMarkets, fetchMorphoVaults, fetchMorphoVaultsFromApi, fetchMorphoVaultsFromChain, fetchOraclePrices, fetchPendleApiAssets, fetchPendleApiMarkets, fetchPendlePrices, fetchPendlePtMarkets, fetchResupplyMarkets, fetchRiverMarkets, fetchSiloVaults, fetchSpectraApiMarkets, fetchSpectraPtMarkets, fetchTellerMarkets, fetchTermMarkets, fetchTermMaxMarkets, fetchTokenBalances, fetchTokenMetadata, fetchUpshiftApiVaults, fetchUpshiftVaults, fetchUsddMarkets, fetchYearnApiVaults, fetchYearnVaults, filterActiveLenders, filterLendersByProtocol, finalizeInfo, findingsFor, formatRaw, frankencoinKeyParts, frankencoinLenderKey, fraxlendAssetPerCollateral, fraxlendKeyParts, fraxlendLenderKey, fuseLenderData, generateLendingPools, getAavesForChain, getAssetConfig, getBalanceForMarketUid, getBorrowCapacity, getCachedFluidDexState, getCachedLiquityTroves, getCachedTellerBids, getCachedTermMaxDiscovery, getCachedTermMaxMarket, getCachedTermMaxMarkets, getCoreValidators, getFluidFTokensConverter, getGmxApiHost, getGmxReadContracts, getGmxUserPositions, getHealthFactor, getHypercoreUserPositions, getHypercoreVaultRegistry, getLenderAssets, getLenderPublicData, getLenderPublicDataAll, getLenderPublicDataViaApi, getLenderUserDataMulti, getLenderUserDataResult, getLendersForChain, getLstDelegation, getLstValidators, getLstWithdrawalRegistry, getLstWithdrawalRequests, getMaxAmountClose, getMaxAmountCollateralSwap, getMaxAmountDebtSwap, getMaxAmountOpen, getMergedUserData, getMorphoTypeMarketConverter, getReadFailurePolicy, getResolvedDolomiteAccountNumbers, getStCeloValidatorGroups, getSubAccountAddress, getSubAccountIndex, getTermProfile, getVaultPublicDataAll, getVaultWithdrawalRequests, hasCritical, hasEulerEarnVaultSubgraph, hasLagoonVaults, hasMorphoPositionIndex, hasMorphoUserApi, hasMorphoUserSubgraph, hasPendleMarkets, hasSpectraMarkets, hasUpshiftVaults, hasYearnVaults, ilkToKeySegment, implausibleRatePercent, inverseKeyParts, inverseLenderKey, isBoundNeed, isFailedCall, isIlliquid, isLendingPosition, isLiveMarket as isLivePendleMarket, isLiveSpectraMarket, isSecondaryMarketOnly, isStablecoinSymbol, isVaultPosition, isVaultVenue, isYearnV3, keySegmentToIlk, keysFromMaps, lenderApiOnly, lenderFamily, liquityCandidateTroveIds, liquityKeyParts, liquityLenderKey, llamaLendKeyParts, llamaLendLenderKey, mergeDeep, multicall3Abi2 as multicall3Abi, nanTo, needsLenderApproval, needsTokenApproval, noOpResult, normalizeToBytes, parseBalanceFetcherResult, parseEarnUid, parseMergedResult, parseMulticallRpcResponses, parseExpirySeconds as parsePendleExpirySeconds, parseRawRpcBatchResponses, parseRawRpcResponses, parseCurveFee as parseSpectraCurveFee, parsePtRate as parseSpectraPtRate, parseTermMaxLtv, parseTokenBalanceResult, pct, assetKey as pendleAssetKey, pickPool as pickSpectraPool, positivePart2 as positivePart, predictInverseEscrow, prepareLenderUserDataRpcCalls, prepareMergedMulticallParams, prepareMergedRpcCalls, prepareMulticallInputs, prepareTokenBalanceRpcCalls, priceGlvVaults, priceGmMarkets, probeAaveFeedTimestamps, pruneFeedStats, rankFindings, ratePercent, readVaultSharePrices, rejectOutliers as rejectPriceOutliers, resolveAdapter, resolveDerivation, resolveEarnIdentity, resolveModeConfig, resolveStCeloDepositGroup, resolveVaultProfileId, resupplyKeyParts, resupplyLenderKey, resupplyMarketLabel, riverKeyParts, riverLenderKey, sanePercent as saneSpectraPercent, savingsAddresses, savingsBalanceKind, secondaryMarketVault, selectAssetGroupPrices, shortDate, spectraAddress, spectraNetwork, spectraPoolsUrl, splitChainScopedAddress as splitPendleChainScopedAddress, stampCapabilities, stampEarnSubtitles, stampVaultClassification, stampVaultTermSheets, stripLeadingBrand, supplyDescription, supplyFindings, supplyHeadline, swapRoutedProvidersArePriceConsistent, tellerBpsToPercent, tellerImpliedLtv, tellerLenderKey, tellerPoolFromLenderKey, termLenderKey, termMaxApiBase, borrowNif as termMaxBorrowNif, curveApr as termMaxCurveApr, curveAprNumber as termMaxCurveAprNumber, daysToMaturity as termMaxDaysToMaturity, lendNif as termMaxLendNif, mintGtFeeRatio as termMaxMintGtFeeRatio, ratioToNumber as termMaxRatioToNumber, ratioToPercent as termMaxRatioToPercent, tickToAprNumber, tickToPrice, toDigest, toTermSheetInput, toVaultTermInput, trancheFromCounterparty, tryParseEarnUid, unflattenLenderData, updateFeedStats, usdValue, usddIlkBytes32, usddKeyParts, usddLenderKey, validateTermSheet, validateTermSheets, validateUserData, vaultSharesToAssets, vaultTermInputFromEarnMarket, vaultTermInputFromSourceRow, vaultTraits, vaultVenue, venueBrand, venueBrandKey, withMaturityLabel, withTrancheLabel };
73807
74818
  //# sourceMappingURL=index.js.map
73808
74819
  //# sourceMappingURL=index.js.map