@1delta/margin-fetcher 5.0.54 → 5.0.56
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.d.ts +133 -4
- package/dist/index.js +1286 -314
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 } 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,
|
|
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
|
-
import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, bandLtvCurve, InitMarginAddresses } from '@1delta/calldata-sdk';
|
|
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';
|
|
14
14
|
import { BALANCER_V2_FORKS, BALANCER_V3_FORKS, UNISWAP_V4_FORKS, isFlashLoanSourceExcluded, FLASH_LOAN_IDS } from '@1delta/dex-registry';
|
|
15
15
|
|
|
@@ -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
|
}
|
|
@@ -6501,6 +6504,10 @@ var getCompoundV3Assets = (chainId, lendingProtocol) => {
|
|
|
6501
6504
|
function getAaveTypePoolDataProviderAddress(chainId, lender) {
|
|
6502
6505
|
return aavePools()?.[lender]?.[chainId]?.protocolDataProvider;
|
|
6503
6506
|
}
|
|
6507
|
+
function getAaveTypeEModeCount(chainId, lender) {
|
|
6508
|
+
const count = aavePools()?.[lender]?.[chainId]?.eModeCount;
|
|
6509
|
+
return typeof count === "number" && Number.isFinite(count) && count >= 0 ? count : void 0;
|
|
6510
|
+
}
|
|
6504
6511
|
function getAaveTypePoolAddress(chainId, lender) {
|
|
6505
6512
|
return aavePools()?.[lender]?.[chainId]?.pool;
|
|
6506
6513
|
}
|
|
@@ -6556,18 +6563,21 @@ function range(n) {
|
|
|
6556
6563
|
return Array.from({ length: n + 1 }, (_3, i) => i);
|
|
6557
6564
|
}
|
|
6558
6565
|
var AAVE_V3_EMODES = (chain, lender) => {
|
|
6566
|
+
const eModeCount = getAaveTypeEModeCount(chain, lender);
|
|
6567
|
+
if (eModeCount !== void 0) return range(eModeCount);
|
|
6559
6568
|
if (chain === Chain.ETHEREUM_MAINNET) {
|
|
6560
6569
|
if (lender === Lender.AAVE_V3) return range(50);
|
|
6561
6570
|
if (lender === Lender.AAVE_V3_PRIME) return range(12);
|
|
6571
|
+
if (lender === Lender.AAVE_V3_HORIZON) return range(12);
|
|
6562
6572
|
}
|
|
6563
6573
|
if (chain === Chain.ARBITRUM_ONE) {
|
|
6564
6574
|
if (lender === Lender.AAVE_V3) return range(12);
|
|
6565
6575
|
}
|
|
6566
6576
|
if (chain === Chain.BASE) {
|
|
6567
|
-
if (lender === Lender.AAVE_V3) return range(
|
|
6577
|
+
if (lender === Lender.AAVE_V3) return range(18);
|
|
6568
6578
|
}
|
|
6569
6579
|
if (chain === Chain.PLASMA_MAINNET) {
|
|
6570
|
-
if (lender === Lender.AAVE_V3) return range(
|
|
6580
|
+
if (lender === Lender.AAVE_V3) return range(30);
|
|
6571
6581
|
}
|
|
6572
6582
|
return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
6573
6583
|
};
|
|
@@ -22372,7 +22382,7 @@ async function fetchTellerMarkets(chainId) {
|
|
|
22372
22382
|
} catch {
|
|
22373
22383
|
return { chainId, pools: [] };
|
|
22374
22384
|
}
|
|
22375
|
-
const
|
|
22385
|
+
const big22 = (i) => {
|
|
22376
22386
|
const r = results[i];
|
|
22377
22387
|
if (typeof r === "bigint") return r;
|
|
22378
22388
|
if (typeof r === "number") return BigInt(r);
|
|
@@ -22386,20 +22396,20 @@ async function fetchTellerMarkets(chainId) {
|
|
|
22386
22396
|
return null;
|
|
22387
22397
|
};
|
|
22388
22398
|
const num18 = (i) => {
|
|
22389
|
-
const b =
|
|
22399
|
+
const b = big22(i);
|
|
22390
22400
|
return b === null ? null : Number(b);
|
|
22391
22401
|
};
|
|
22392
22402
|
const pool0 = pools.map((config, i) => {
|
|
22393
22403
|
const base = i * READS_PER_POOL;
|
|
22394
22404
|
return {
|
|
22395
22405
|
config,
|
|
22396
|
-
available:
|
|
22397
|
-
committed:
|
|
22406
|
+
available: big22(base),
|
|
22407
|
+
committed: big22(base + 1),
|
|
22398
22408
|
minRateBps: num18(base + 2),
|
|
22399
|
-
collateralPerPrincipal:
|
|
22409
|
+
collateralPerPrincipal: big22(base + 3),
|
|
22400
22410
|
maxLoanDuration: num18(base + 4),
|
|
22401
|
-
marketId:
|
|
22402
|
-
totalAssets:
|
|
22411
|
+
marketId: big22(base + 5),
|
|
22412
|
+
totalAssets: big22(base + 6)
|
|
22403
22413
|
};
|
|
22404
22414
|
});
|
|
22405
22415
|
const attByMarket = /* @__PURE__ */ new Map();
|
|
@@ -23472,6 +23482,107 @@ function num(api, key3) {
|
|
|
23472
23482
|
const v = api?.[key3];
|
|
23473
23483
|
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
23474
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
|
+
}
|
|
23475
23586
|
var DEFAULT_BANDS = 10;
|
|
23476
23587
|
var LLAMALEND_READ_ABI = [
|
|
23477
23588
|
...LlamaLendControllerAbi,
|
|
@@ -23765,7 +23876,7 @@ var STATE_READS = 14;
|
|
|
23765
23876
|
var ONE = 10n ** 18n;
|
|
23766
23877
|
var identityCache = /* @__PURE__ */ new Map();
|
|
23767
23878
|
var identityKey = (chainId, pair) => `${chainId}:${pair.toLowerCase()}`;
|
|
23768
|
-
var
|
|
23879
|
+
var big2 = (v) => {
|
|
23769
23880
|
if (typeof v === "bigint") return v;
|
|
23770
23881
|
if (typeof v === "number") return BigInt(v);
|
|
23771
23882
|
return null;
|
|
@@ -23974,28 +24085,28 @@ async function fetchResupplyMarkets(lender, chainId) {
|
|
|
23974
24085
|
const accounting = results[base + 5];
|
|
23975
24086
|
const rateInfo = results[base + 6];
|
|
23976
24087
|
const exchangeInfo = results[base + 7];
|
|
23977
|
-
const tuple = (v, idx) => Array.isArray(v) ?
|
|
24088
|
+
const tuple = (v, idx) => Array.isArray(v) ? big2(v[idx]) : null;
|
|
23978
24089
|
return {
|
|
23979
24090
|
identity,
|
|
23980
|
-
maxLTV:
|
|
23981
|
-
borrowLimit:
|
|
23982
|
-
liquidationFee:
|
|
23983
|
-
mintFee:
|
|
23984
|
-
minimumBorrowAmount:
|
|
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]),
|
|
23985
24096
|
totalBorrowAmount: tuple(accounting, 1),
|
|
23986
24097
|
totalBorrowShares: tuple(accounting, 2),
|
|
23987
24098
|
totalCollateral: tuple(accounting, 3),
|
|
23988
24099
|
ratePerSec: tuple(rateInfo, 1),
|
|
23989
24100
|
exchangeRate: tuple(exchangeInfo, 2),
|
|
23990
|
-
collateralPrice:
|
|
24101
|
+
collateralPrice: big2(results[base + 8]),
|
|
23991
24102
|
// Indices follow the PUSH ORDER above exactly: the two reward reads sit
|
|
23992
24103
|
// at +9/+10, BEFORE the lens block, so the lens reads are +11/+12.
|
|
23993
24104
|
// (Getting this wrong is silent — it produced a 3-billion-percent APR
|
|
23994
24105
|
// before the numbers were checked against a hand computation.)
|
|
23995
|
-
convexPid:
|
|
23996
|
-
rsupWeight: pairEmissions ?
|
|
23997
|
-
liveRatePerSec: utilities ?
|
|
23998
|
-
underlyingSupplyRatePerSec: utilities ?
|
|
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,
|
|
23999
24110
|
collateralRewards: []
|
|
24000
24111
|
};
|
|
24001
24112
|
});
|
|
@@ -24053,9 +24164,9 @@ async function readRewardContext(chainId, registry, utilities) {
|
|
|
24053
24164
|
],
|
|
24054
24165
|
allowFailure: true
|
|
24055
24166
|
});
|
|
24056
|
-
const periodFinish =
|
|
24057
|
-
const rewardRate =
|
|
24058
|
-
const totalWeight =
|
|
24167
|
+
const periodFinish = big2(stream[0]);
|
|
24168
|
+
const rewardRate = big2(stream[1]);
|
|
24169
|
+
const totalWeight = big2(stream[2]);
|
|
24059
24170
|
if (periodFinish === null || rewardRate === null || totalWeight === null || totalWeight === 0n) {
|
|
24060
24171
|
return { pairEmissions, convexPoolUtil };
|
|
24061
24172
|
}
|
|
@@ -24124,7 +24235,7 @@ function getCurvanceAssetRoster(chainId, lender) {
|
|
|
24124
24235
|
// src/lending/public-data/curvance/fetchPublic.ts
|
|
24125
24236
|
var FALLBACK_TOKEN_READS = 12;
|
|
24126
24237
|
var zero = "0x0000000000000000000000000000000000000000";
|
|
24127
|
-
var
|
|
24238
|
+
var big3 = (v) => {
|
|
24128
24239
|
if (typeof v === "bigint") return v;
|
|
24129
24240
|
if (typeof v === "number") return BigInt(v);
|
|
24130
24241
|
if (typeof v === "string" && v !== "0x") {
|
|
@@ -24239,41 +24350,41 @@ async function fetchViaReader(lender, chainId, config) {
|
|
|
24239
24350
|
assetSymbol: str(t?.asset?.symbol, "?"),
|
|
24240
24351
|
assetName: str(t?.asset?.name, "?"),
|
|
24241
24352
|
assetDecimals: num3(t?.asset?.decimals, 18),
|
|
24242
|
-
collRatio:
|
|
24243
|
-
collReqSoft:
|
|
24244
|
-
collReqHard:
|
|
24245
|
-
liqIncBase:
|
|
24246
|
-
liqIncCurve:
|
|
24247
|
-
closeFactorBase:
|
|
24248
|
-
maxLeverage:
|
|
24249
|
-
collateralCap:
|
|
24250
|
-
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),
|
|
24251
24362
|
mintPaused: !!t?.mintPaused,
|
|
24252
24363
|
collateralizationPaused: !!t?.collateralizationPaused,
|
|
24253
24364
|
borrowPaused: !!t?.borrowPaused,
|
|
24254
24365
|
redeemPaused: !!t?.redeemPaused,
|
|
24255
|
-
totalAssets:
|
|
24256
|
-
totalSupply:
|
|
24257
|
-
exchangeRate:
|
|
24258
|
-
collateral:
|
|
24259
|
-
debt:
|
|
24260
|
-
liquidity:
|
|
24261
|
-
assetPrice:
|
|
24262
|
-
assetPriceLower:
|
|
24263
|
-
borrowRate:
|
|
24264
|
-
predictedBorrowRate:
|
|
24265
|
-
supplyRate:
|
|
24266
|
-
utilizationRate:
|
|
24267
|
-
interestFee:
|
|
24268
|
-
irmTargetRate:
|
|
24269
|
-
irmMaxRate:
|
|
24270
|
-
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)
|
|
24271
24382
|
});
|
|
24272
24383
|
}
|
|
24273
24384
|
if (tokens.length === 0) continue;
|
|
24274
24385
|
markets.push({
|
|
24275
24386
|
marketManager,
|
|
24276
|
-
cooldownLength:
|
|
24387
|
+
cooldownLength: big3(m?.cooldownLength),
|
|
24277
24388
|
// Filled in below — one batched round for every market at once.
|
|
24278
24389
|
minLoanSizeUsdWad: 0n,
|
|
24279
24390
|
tokens
|
|
@@ -24334,7 +24445,7 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
24334
24445
|
const pairs = [];
|
|
24335
24446
|
managers.forEach((mm, i) => {
|
|
24336
24447
|
const toks = listed[i * 2];
|
|
24337
|
-
const redeemPaused =
|
|
24448
|
+
const redeemPaused = big3(listed[i * 2 + 1]) === 2n;
|
|
24338
24449
|
if (!Array.isArray(toks)) return;
|
|
24339
24450
|
for (const t of toks) {
|
|
24340
24451
|
if (typeof t === "string" && t.startsWith("0x")) {
|
|
@@ -24420,9 +24531,9 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
24420
24531
|
const paused = results[base + 4];
|
|
24421
24532
|
const asset = results[base + 7];
|
|
24422
24533
|
if (!Array.isArray(coll) || typeof asset !== "string") return;
|
|
24423
|
-
const tuple = (v, idx) => Array.isArray(v) ?
|
|
24424
|
-
const held =
|
|
24425
|
-
const debt =
|
|
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]);
|
|
24426
24537
|
const token = {
|
|
24427
24538
|
cToken: p.cToken,
|
|
24428
24539
|
symbol: str(results[base + 5], "c?"),
|
|
@@ -24439,13 +24550,13 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
24439
24550
|
liqIncCurve: tuple(liq, 1),
|
|
24440
24551
|
closeFactorBase: tuple(liq, 4),
|
|
24441
24552
|
maxLeverage: 0n,
|
|
24442
|
-
collateralCap:
|
|
24443
|
-
debtCap:
|
|
24553
|
+
collateralCap: big3(results[base + 2]),
|
|
24554
|
+
debtCap: big3(results[base + 3]),
|
|
24444
24555
|
mintPaused: Array.isArray(paused) ? !!paused[0] : false,
|
|
24445
24556
|
collateralizationPaused: Array.isArray(paused) ? !!paused[1] : false,
|
|
24446
24557
|
borrowPaused: Array.isArray(paused) ? !!paused[2] : false,
|
|
24447
24558
|
redeemPaused: p.redeemPaused,
|
|
24448
|
-
totalAssets:
|
|
24559
|
+
totalAssets: big3(results[base + 8]),
|
|
24449
24560
|
totalSupply: 0n,
|
|
24450
24561
|
exchangeRate: 0n,
|
|
24451
24562
|
collateral: 0n,
|
|
@@ -24459,7 +24570,7 @@ async function fetchViaMulticall(lender, chainId, config) {
|
|
|
24459
24570
|
predictedBorrowRate: 0n,
|
|
24460
24571
|
supplyRate: 0n,
|
|
24461
24572
|
utilizationRate: held + debt > 0n ? debt * 10n ** 18n / (held + debt) : 0n,
|
|
24462
|
-
interestFee:
|
|
24573
|
+
interestFee: big3(results[base + 11]),
|
|
24463
24574
|
irmTargetRate: 0n,
|
|
24464
24575
|
irmMaxRate: 0n,
|
|
24465
24576
|
irmTargetUtilization: 0n
|
|
@@ -24546,7 +24657,7 @@ var ERC20_ABI = [
|
|
|
24546
24657
|
];
|
|
24547
24658
|
var RAY4 = 1e27;
|
|
24548
24659
|
var ok = (v) => v !== void 0 && v !== null && v !== "0x";
|
|
24549
|
-
var
|
|
24660
|
+
var big4 = (v) => {
|
|
24550
24661
|
if (typeof v === "bigint") return v;
|
|
24551
24662
|
if (typeof v === "number") return BigInt(v);
|
|
24552
24663
|
if (typeof v === "string" && /^(0x[0-9a-fA-F]+|\d+)$/.test(v)) return BigInt(v);
|
|
@@ -24654,10 +24765,10 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24654
24765
|
const pendingDebtBalances = [];
|
|
24655
24766
|
markets.forEach((m, i) => {
|
|
24656
24767
|
const c = i * 8;
|
|
24657
|
-
const creditTotalAssets =
|
|
24658
|
-
const creditTotalBorrows =
|
|
24659
|
-
const creditCash =
|
|
24660
|
-
const creditRateSpy =
|
|
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]);
|
|
24661
24772
|
if (creditTotalAssets === void 0 || creditCash === void 0 || creditRateSpy === void 0) return;
|
|
24662
24773
|
const aaveIdx = aaveMarkets.indexOf(m);
|
|
24663
24774
|
const eulerIdx = eulerMarkets.indexOf(m);
|
|
@@ -24676,21 +24787,21 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24676
24787
|
if (ok(debtReserve) && debtReserve?.currentVariableBorrowRate !== void 0)
|
|
24677
24788
|
externalBorrowRate = Number(debtReserve.currentVariableBorrowRate) / RAY4;
|
|
24678
24789
|
if (ok(debtReserve)) {
|
|
24679
|
-
const virtual =
|
|
24790
|
+
const virtual = big4(debtReserve.virtualUnderlyingBalance);
|
|
24680
24791
|
if (virtual !== void 0 && virtual > 0n) externalBorrowLiquidity = virtual;
|
|
24681
24792
|
else if (typeof debtReserve.aTokenAddress === "string")
|
|
24682
24793
|
debtAToken = debtReserve.aTokenAddress;
|
|
24683
24794
|
}
|
|
24684
24795
|
} else if (eulerIdx >= 0) {
|
|
24685
24796
|
const e = eulerIdx * 7;
|
|
24686
|
-
externalLiqLtv =
|
|
24687
|
-
const spy =
|
|
24797
|
+
externalLiqLtv = big4(eulerReads[e]);
|
|
24798
|
+
const spy = big4(eulerReads[e + 1]);
|
|
24688
24799
|
if (spy !== void 0) externalBorrowRate = Number(spy) / RAY4 * 31536e3;
|
|
24689
|
-
externalBorrowLiquidity =
|
|
24690
|
-
const collSpy =
|
|
24691
|
-
const collAssets =
|
|
24692
|
-
const collBorrows =
|
|
24693
|
-
const collFeeBps =
|
|
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;
|
|
24694
24805
|
if (collSpy !== void 0 && collAssets && collAssets > 0n) {
|
|
24695
24806
|
const util = Number(collBorrows ?? 0n) / Number(collAssets);
|
|
24696
24807
|
externalSupplyRate = Number(collSpy) / RAY4 * 31536e3 * util * (1 - Number(collFeeBps) / 1e4);
|
|
@@ -24698,7 +24809,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24698
24809
|
}
|
|
24699
24810
|
const s = i * 3;
|
|
24700
24811
|
if (externalBorrowLiquidity === void 0 && !debtAToken) {
|
|
24701
|
-
externalBorrowLiquidity =
|
|
24812
|
+
externalBorrowLiquidity = big4(scaleReads[s + 2]);
|
|
24702
24813
|
}
|
|
24703
24814
|
if (debtAToken) pendingDebtBalances.push({ index: out.length, token: m.targetAsset, holder: debtAToken });
|
|
24704
24815
|
out.push({
|
|
@@ -24707,19 +24818,19 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24707
24818
|
creditTotalBorrows: creditTotalBorrows ?? 0n,
|
|
24708
24819
|
creditCash,
|
|
24709
24820
|
creditRateSpy,
|
|
24710
|
-
creditDepositCapacity:
|
|
24821
|
+
creditDepositCapacity: big4(creditReads[c + 7]),
|
|
24711
24822
|
creditDecimals: Number(creditReads[c + 4] ?? 18),
|
|
24712
24823
|
creditSymbol: typeof creditReads[c + 5] === "string" ? creditReads[c + 5] : void 0,
|
|
24713
24824
|
creditIrm: typeof creditReads[c + 6] === "string" ? creditReads[c + 6].toLowerCase() : m.creditIrm,
|
|
24714
24825
|
externalLiqLtv,
|
|
24715
|
-
maxTwyneLiqLtv:
|
|
24716
|
-
externalLiqBuffer:
|
|
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),
|
|
24717
24828
|
externalSupplyRate,
|
|
24718
24829
|
externalBorrowRate,
|
|
24719
24830
|
externalBorrowLiquidity,
|
|
24720
24831
|
collateralDecimals: Number(scaleReads[s] ?? 18),
|
|
24721
24832
|
targetDecimals: Number(scaleReads[s + 1] ?? 18),
|
|
24722
|
-
collateralToUnderlying:
|
|
24833
|
+
collateralToUnderlying: big4(wrapperReads[i]),
|
|
24723
24834
|
// Computed HERE, never read from the roster: a stored flag goes stale,
|
|
24724
24835
|
// and two of the three live PT markets have already matured.
|
|
24725
24836
|
collateralMatured: !!m.collateralMaturity && m.collateralMaturity <= nowSec9,
|
|
@@ -24738,7 +24849,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24738
24849
|
allowFailure: true
|
|
24739
24850
|
});
|
|
24740
24851
|
pendingDebtBalances.forEach((p, i) => {
|
|
24741
|
-
const v =
|
|
24852
|
+
const v = big4(balances[i]);
|
|
24742
24853
|
if (v !== void 0 && out[p.index]) out[p.index].externalBorrowLiquidity = v;
|
|
24743
24854
|
});
|
|
24744
24855
|
}
|
|
@@ -24746,7 +24857,7 @@ async function fetchTwyneMarkets(lender, chainId) {
|
|
|
24746
24857
|
return { lender, chainId, config, markets: out };
|
|
24747
24858
|
}
|
|
24748
24859
|
var PAIR_READS = 15;
|
|
24749
|
-
var
|
|
24860
|
+
var big5 = (v) => {
|
|
24750
24861
|
if (typeof v === "bigint") return v;
|
|
24751
24862
|
if (typeof v === "number") return BigInt(v);
|
|
24752
24863
|
if (typeof v === "string" && v !== "0x") {
|
|
@@ -24853,41 +24964,41 @@ async function fetchFraxlendPairs(lender, chainId) {
|
|
|
24853
24964
|
decimals: dec(decimals),
|
|
24854
24965
|
asset: asset.toLowerCase(),
|
|
24855
24966
|
collateral: collateral.toLowerCase(),
|
|
24856
|
-
maxLtv:
|
|
24857
|
-
ltvPrecision:
|
|
24858
|
-
exchangePrecision:
|
|
24859
|
-
liqPrecision:
|
|
24967
|
+
maxLtv: big5(maxLtv),
|
|
24968
|
+
ltvPrecision: big5(ltvPrec) || 100000n,
|
|
24969
|
+
exchangePrecision: big5(exPrec) || 10n ** 18n,
|
|
24970
|
+
liqPrecision: big5(liqPrec) || 100000n,
|
|
24860
24971
|
cleanLiquidationFee: 0n,
|
|
24861
24972
|
dirtyLiquidationFee: 0n,
|
|
24862
24973
|
protocolLiquidationFee: 0n,
|
|
24863
|
-
depositLimit:
|
|
24864
|
-
borrowLimit:
|
|
24865
|
-
totalAssetAmount:
|
|
24974
|
+
depositLimit: big5(depositLimit),
|
|
24975
|
+
borrowLimit: big5(borrowLimit),
|
|
24976
|
+
totalAssetAmount: big5(
|
|
24866
24977
|
totalAsset.amount ?? totalAsset[0]
|
|
24867
24978
|
),
|
|
24868
|
-
totalAssetShares:
|
|
24979
|
+
totalAssetShares: big5(
|
|
24869
24980
|
totalAsset.shares ?? totalAsset[1]
|
|
24870
24981
|
),
|
|
24871
|
-
totalBorrowAmount:
|
|
24982
|
+
totalBorrowAmount: big5(
|
|
24872
24983
|
totalBorrow.amount ?? totalBorrow[0]
|
|
24873
24984
|
),
|
|
24874
|
-
totalBorrowShares:
|
|
24985
|
+
totalBorrowShares: big5(
|
|
24875
24986
|
totalBorrow.shares ?? totalBorrow[1]
|
|
24876
24987
|
),
|
|
24877
|
-
totalCollateral:
|
|
24988
|
+
totalCollateral: big5(totalCollateral),
|
|
24878
24989
|
oracle: str2(xrInfo[0], "").toLowerCase(),
|
|
24879
24990
|
maxOracleDeviation: Number(xrInfo[1] ?? 0),
|
|
24880
|
-
exchangeRateLastTimestamp:
|
|
24881
|
-
lowExchangeRate:
|
|
24882
|
-
highExchangeRate:
|
|
24883
|
-
ratePerSec:
|
|
24884
|
-
fullUtilizationRate:
|
|
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(
|
|
24885
24996
|
rateInfo.fullUtilizationRate ?? rateInfo[4]
|
|
24886
24997
|
),
|
|
24887
24998
|
feeToProtocolRate: Number(
|
|
24888
24999
|
rateInfo.feeToProtocolRate ?? rateInfo[1] ?? 0
|
|
24889
25000
|
),
|
|
24890
|
-
rateLastTimestamp:
|
|
25001
|
+
rateLastTimestamp: big5(
|
|
24891
25002
|
rateInfo.lastTimestamp ?? rateInfo[2]
|
|
24892
25003
|
),
|
|
24893
25004
|
rateContract: str2(rateContract, "").toLowerCase(),
|
|
@@ -25131,6 +25242,197 @@ function convertInverseMarketsToResponse(raw, chainId, prices = {}, _additionalY
|
|
|
25131
25242
|
return out;
|
|
25132
25243
|
}
|
|
25133
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
|
+
|
|
25134
25436
|
// src/lending/public-data/llamalend/convertPublic.ts
|
|
25135
25437
|
function llamaLendLenderKey(lender, controller) {
|
|
25136
25438
|
return `${lender}_${controller.replace(/^0x/i, "").toUpperCase()}`;
|
|
@@ -25141,7 +25443,7 @@ function llamaLendKeyParts(key3) {
|
|
|
25141
25443
|
if (!/^[0-9A-F]{40}$/.test(suffix)) return void 0;
|
|
25142
25444
|
return { lender: "LLAMALEND", controller: "0x" + suffix.toLowerCase() };
|
|
25143
25445
|
}
|
|
25144
|
-
function
|
|
25446
|
+
function currencyFor10(address, decimals, symbol, tokens) {
|
|
25145
25447
|
const lower4 = address.toLowerCase();
|
|
25146
25448
|
return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
|
|
25147
25449
|
}
|
|
@@ -25204,7 +25506,7 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
|
|
|
25204
25506
|
name: "Collateral " + collSymbol,
|
|
25205
25507
|
poolId: market.controller.toLowerCase(),
|
|
25206
25508
|
underlying: collAddr,
|
|
25207
|
-
asset:
|
|
25509
|
+
asset: currencyFor10(collAddr, collDecimals, collSymbol, tokens),
|
|
25208
25510
|
// Collateral lives inside the LLAMMA spread over bands; there is no
|
|
25209
25511
|
// single market-level balance worth reporting, and the number the UI
|
|
25210
25512
|
// needs is the borrowed side anyway.
|
|
@@ -25252,7 +25554,7 @@ function convertLlamaLendMarketsToResponse(raw, chainId, prices = {}, additional
|
|
|
25252
25554
|
name: loanSymbol,
|
|
25253
25555
|
poolId: market.controller.toLowerCase(),
|
|
25254
25556
|
underlying: loanAddr,
|
|
25255
|
-
asset:
|
|
25557
|
+
asset: currencyFor10(loanAddr, loanDecimals, loanSymbol, tokens),
|
|
25256
25558
|
totalDeposits,
|
|
25257
25559
|
totalDebtStable: 0,
|
|
25258
25560
|
totalDebt,
|
|
@@ -25490,7 +25792,7 @@ function resupplyKeyParts(key3) {
|
|
|
25490
25792
|
var SECONDS_PER_YEAR9 = 31536e3;
|
|
25491
25793
|
var LTV_PRECISION = 1e5;
|
|
25492
25794
|
var ONE2 = 10n ** 18n;
|
|
25493
|
-
function
|
|
25795
|
+
function currencyFor11(address, decimals, symbol, tokens) {
|
|
25494
25796
|
const lower4 = address.toLowerCase();
|
|
25495
25797
|
return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
|
|
25496
25798
|
}
|
|
@@ -25601,7 +25903,7 @@ function convertResupplyMarketsToResponse(raw, chainId, prices = {}, _additional
|
|
|
25601
25903
|
name: "Collateral " + collSymbol,
|
|
25602
25904
|
poolId: id.pair.toLowerCase(),
|
|
25603
25905
|
underlying: collAddr,
|
|
25604
|
-
asset:
|
|
25906
|
+
asset: currencyFor11(collAddr, collDecimals, collSymbol, tokens),
|
|
25605
25907
|
totalDeposits: totalColl,
|
|
25606
25908
|
totalDebtStable: 0,
|
|
25607
25909
|
totalDebt: 0,
|
|
@@ -25654,7 +25956,7 @@ function convertResupplyMarketsToResponse(raw, chainId, prices = {}, _additional
|
|
|
25654
25956
|
name: debtSymbol,
|
|
25655
25957
|
poolId: id.pair.toLowerCase(),
|
|
25656
25958
|
underlying: debtAddr,
|
|
25657
|
-
asset:
|
|
25959
|
+
asset: currencyFor11(debtAddr, debtDecimals, debtSymbol, tokens),
|
|
25658
25960
|
totalDeposits: 0,
|
|
25659
25961
|
totalDebtStable: 0,
|
|
25660
25962
|
totalDebt,
|
|
@@ -25783,7 +26085,7 @@ var BPS2 = 1e4;
|
|
|
25783
26085
|
function ratePerSecToApr2(rate) {
|
|
25784
26086
|
return Number(rate) / 1e18 * SECONDS_PER_YEAR10 * 100;
|
|
25785
26087
|
}
|
|
25786
|
-
function
|
|
26088
|
+
function currencyFor12(address, decimals, symbol, name, tokens) {
|
|
25787
26089
|
const lower4 = address.toLowerCase();
|
|
25788
26090
|
return tokens[lower4] ?? { address: lower4, symbol, name, decimals };
|
|
25789
26091
|
}
|
|
@@ -25838,7 +26140,7 @@ function convertCurvanceMarketsToResponse(raw, chainId, prices = {}, _additional
|
|
|
25838
26140
|
name: t.assetSymbol,
|
|
25839
26141
|
poolId: market.marketManager.toLowerCase(),
|
|
25840
26142
|
underlying: assetAddr,
|
|
25841
|
-
asset:
|
|
26143
|
+
asset: currencyFor12(assetAddr, dec2, t.assetSymbol, t.assetName, tokens),
|
|
25842
26144
|
totalDeposits,
|
|
25843
26145
|
totalDebtStable: 0,
|
|
25844
26146
|
totalDebt,
|
|
@@ -26010,7 +26312,19 @@ function resolvePositionManagers(cfg, marketManager) {
|
|
|
26010
26312
|
|
|
26011
26313
|
// src/lending/public-data/twyne/convertPublic.ts
|
|
26012
26314
|
function twyneLenderKey(lender, chainId, intermediateVault, targetAsset) {
|
|
26013
|
-
|
|
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
|
+
};
|
|
26014
26328
|
}
|
|
26015
26329
|
var SECONDS_PER_YEAR11 = 31536e3;
|
|
26016
26330
|
var BPS3 = 1e4;
|
|
@@ -26019,7 +26333,7 @@ var toFloat2 = (v, dec2) => v === void 0 ? 0 : Number(v) / 10 ** dec2;
|
|
|
26019
26333
|
function spyToApr(spy) {
|
|
26020
26334
|
return Number(spy) / RAY5 * SECONDS_PER_YEAR11 * 100;
|
|
26021
26335
|
}
|
|
26022
|
-
function
|
|
26336
|
+
function currencyFor13(address, decimals, symbol, tokens) {
|
|
26023
26337
|
const lower4 = address.toLowerCase();
|
|
26024
26338
|
return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
|
|
26025
26339
|
}
|
|
@@ -26053,7 +26367,7 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
26053
26367
|
name: m.symbol ?? collToken?.symbol ?? "collateral",
|
|
26054
26368
|
poolId: m.intermediateVault.toLowerCase(),
|
|
26055
26369
|
underlying: collAddr,
|
|
26056
|
-
asset:
|
|
26370
|
+
asset: currencyFor13(collAddr, row.collateralDecimals, m.symbol ?? "", tokens),
|
|
26057
26371
|
totalDeposits: creditTotal,
|
|
26058
26372
|
totalDebtStable: 0,
|
|
26059
26373
|
totalDebt: 0,
|
|
@@ -26137,7 +26451,7 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
26137
26451
|
name: debtToken?.symbol ?? "debt",
|
|
26138
26452
|
poolId: m.intermediateVault.toLowerCase(),
|
|
26139
26453
|
underlying: debtAddr,
|
|
26140
|
-
asset:
|
|
26454
|
+
asset: currencyFor13(debtAddr, row.targetDecimals, debtToken?.symbol ?? "", tokens),
|
|
26141
26455
|
// Borrower aggregates are NOT readable without an event replay — see the
|
|
26142
26456
|
// header. Zero here means "not measured", and the descriptor says so.
|
|
26143
26457
|
totalDeposits: 0,
|
|
@@ -26185,7 +26499,13 @@ function convertTwyneMarketsToResponse(raw, chainId, prices = {}, _additionalYie
|
|
|
26185
26499
|
entry.params = {
|
|
26186
26500
|
market: {
|
|
26187
26501
|
lender: lenderKey,
|
|
26188
|
-
|
|
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"}`,
|
|
26189
26509
|
loanDecimals: row.targetDecimals,
|
|
26190
26510
|
collateralDecimals: row.collateralDecimals,
|
|
26191
26511
|
id: m.intermediateVault.toLowerCase(),
|
|
@@ -26270,7 +26590,7 @@ var SECONDS_PER_YEAR12 = 31536e3;
|
|
|
26270
26590
|
var ratePerSecToApr3 = (rate) => Number(rate) / 1e18 * SECONDS_PER_YEAR12 * 100;
|
|
26271
26591
|
var toFloat3 = (raw, decimals) => Number(raw) / 10 ** decimals;
|
|
26272
26592
|
var MAX_UINT = (1n << 256n) - 1n;
|
|
26273
|
-
function
|
|
26593
|
+
function currencyFor14(address, decimals, symbol, name, tokens) {
|
|
26274
26594
|
const lower4 = address.toLowerCase();
|
|
26275
26595
|
return tokens[lower4] ?? { address: lower4, symbol, name, decimals };
|
|
26276
26596
|
}
|
|
@@ -26319,7 +26639,7 @@ function convertFraxlendPairsToResponse(raw, chainId, prices = {}, _additionalYi
|
|
|
26319
26639
|
name: p.assetSymbol,
|
|
26320
26640
|
poolId: p.pair.toLowerCase(),
|
|
26321
26641
|
underlying: p.asset,
|
|
26322
|
-
asset:
|
|
26642
|
+
asset: currencyFor14(
|
|
26323
26643
|
p.asset,
|
|
26324
26644
|
p.assetDecimals,
|
|
26325
26645
|
p.assetSymbol,
|
|
@@ -26372,7 +26692,7 @@ function convertFraxlendPairsToResponse(raw, chainId, prices = {}, _additionalYi
|
|
|
26372
26692
|
name: p.collateralSymbol,
|
|
26373
26693
|
poolId: p.pair.toLowerCase(),
|
|
26374
26694
|
underlying: p.collateral,
|
|
26375
|
-
asset:
|
|
26695
|
+
asset: currencyFor14(
|
|
26376
26696
|
p.collateral,
|
|
26377
26697
|
p.collateralDecimals,
|
|
26378
26698
|
p.collateralSymbol,
|
|
@@ -26542,12 +26862,12 @@ async function fetchDssMarkets(lender, chainId) {
|
|
|
26542
26862
|
} catch {
|
|
26543
26863
|
return { lender, config, chainData, markets: [] };
|
|
26544
26864
|
}
|
|
26545
|
-
const
|
|
26865
|
+
const big22 = (v) => {
|
|
26546
26866
|
if (typeof v === "bigint") return v;
|
|
26547
26867
|
if (typeof v === "number") return BigInt(v);
|
|
26548
26868
|
return null;
|
|
26549
26869
|
};
|
|
26550
|
-
const field13 = (res, name, idx) =>
|
|
26870
|
+
const field13 = (res, name, idx) => big22(res?.[name] ?? res?.[idx]);
|
|
26551
26871
|
let cursor = 0;
|
|
26552
26872
|
const out = markets.map((market, i) => {
|
|
26553
26873
|
const base = cursor;
|
|
@@ -26564,7 +26884,7 @@ async function fetchDssMarkets(lender, chainId) {
|
|
|
26564
26884
|
dust: field13(vatIlk, "dust", 4),
|
|
26565
26885
|
duty: field13(jugIlk, "duty", 0),
|
|
26566
26886
|
mat: field13(spotIlk, "mat", 1),
|
|
26567
|
-
joinBalance: joinReadIndex[i] >= 0 ?
|
|
26887
|
+
joinBalance: joinReadIndex[i] >= 0 ? big22(results[joinReadIndex[i]]) : null
|
|
26568
26888
|
};
|
|
26569
26889
|
});
|
|
26570
26890
|
return { lender, config, chainData, markets: out };
|
|
@@ -26585,14 +26905,14 @@ function dssKeyParts(key3) {
|
|
|
26585
26905
|
if (!m) return void 0;
|
|
26586
26906
|
return { lender: m[1], chainId: m[2], ilk: keySegmentToIlk(m[3]) };
|
|
26587
26907
|
}
|
|
26588
|
-
var
|
|
26908
|
+
var WAD11 = 1e18;
|
|
26589
26909
|
var RAY6 = 1e27;
|
|
26590
26910
|
var RAD = 1e45;
|
|
26591
26911
|
var YEAR_SECONDS2 = 31536e3;
|
|
26592
26912
|
function toHuman4(raw, decimals) {
|
|
26593
26913
|
return Number(raw) / 10 ** decimals;
|
|
26594
26914
|
}
|
|
26595
|
-
function
|
|
26915
|
+
function currencyFor15(address, decimals, symbol, tokens) {
|
|
26596
26916
|
const lower4 = address.toLowerCase();
|
|
26597
26917
|
return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
|
|
26598
26918
|
}
|
|
@@ -26629,7 +26949,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
|
|
|
26629
26949
|
const totalColl = m.joinBalance !== null ? toHuman4(m.joinBalance, collDecimals) : 0;
|
|
26630
26950
|
const mat = m.mat !== null ? Number(m.mat) / RAY6 : Number(market.mat) / RAY6 || 1.5;
|
|
26631
26951
|
const ltv = mat > 0 ? 1 / mat : 0;
|
|
26632
|
-
const chop = market.chop ? Number(market.chop) /
|
|
26952
|
+
const chop = market.chop ? Number(market.chop) / WAD11 : 0;
|
|
26633
26953
|
const liqPenalty = chop > 1 ? chop - 1 : 0;
|
|
26634
26954
|
const duty = m.duty !== null ? m.duty : BigInt(market.duty ?? 0);
|
|
26635
26955
|
const borrowApr = duty > BigInt(1e27) ? Number(duty - BigInt(10) ** BigInt(27)) / RAY6 * YEAR_SECONDS2 * 100 : 0;
|
|
@@ -26644,7 +26964,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
|
|
|
26644
26964
|
name: "Collateral " + collSymbol,
|
|
26645
26965
|
poolId: market.gemJoin?.toLowerCase(),
|
|
26646
26966
|
underlying: collAddr,
|
|
26647
|
-
asset:
|
|
26967
|
+
asset: currencyFor15(collAddr, collDecimals, collSymbol, tokens),
|
|
26648
26968
|
totalDeposits: totalColl,
|
|
26649
26969
|
totalDebtStable: 0,
|
|
26650
26970
|
totalDebt: 0,
|
|
@@ -26688,7 +27008,7 @@ function convertDssMarketsToResponse(raw, chainId, prices = {}, _additionalYield
|
|
|
26688
27008
|
name: debtSymbol,
|
|
26689
27009
|
poolId: cfg.vat.toLowerCase(),
|
|
26690
27010
|
underlying: debtAddr,
|
|
26691
|
-
asset:
|
|
27011
|
+
asset: currencyFor15(debtAddr, debtDecimals, debtSymbol, tokens),
|
|
26692
27012
|
totalDeposits: 0,
|
|
26693
27013
|
totalDebtStable: 0,
|
|
26694
27014
|
totalDebt,
|
|
@@ -26838,26 +27158,26 @@ async function fetchFrankencoinMarkets(lender, chainId) {
|
|
|
26838
27158
|
} catch {
|
|
26839
27159
|
return { lender, config, chainData, markets: [] };
|
|
26840
27160
|
}
|
|
26841
|
-
const
|
|
27161
|
+
const big22 = (v) => {
|
|
26842
27162
|
if (typeof v === "bigint") return v;
|
|
26843
27163
|
if (typeof v === "number") return BigInt(v);
|
|
26844
27164
|
return null;
|
|
26845
27165
|
};
|
|
26846
27166
|
const out = markets.map((market, i) => {
|
|
26847
27167
|
const base = i * READS_PER_MARKET3;
|
|
26848
|
-
const expiration =
|
|
27168
|
+
const expiration = big22(results[base + 7]);
|
|
26849
27169
|
return {
|
|
26850
27170
|
market,
|
|
26851
|
-
price:
|
|
26852
|
-
minted:
|
|
26853
|
-
availableForClones:
|
|
26854
|
-
annualInterestPPM:
|
|
26855
|
-
currentFeePPM:
|
|
26856
|
-
reserveContribution:
|
|
26857
|
-
challengedAmount:
|
|
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]),
|
|
26858
27178
|
expiration,
|
|
26859
27179
|
isClosed: typeof results[base + 8] === "boolean" ? results[base + 8] : null,
|
|
26860
|
-
collateralBalance:
|
|
27180
|
+
collateralBalance: big22(results[base + 9])
|
|
26861
27181
|
};
|
|
26862
27182
|
});
|
|
26863
27183
|
return { lender, config, chainData, markets: out };
|
|
@@ -26879,7 +27199,7 @@ function frankencoinKeyParts(key3) {
|
|
|
26879
27199
|
};
|
|
26880
27200
|
}
|
|
26881
27201
|
var PPM = 1e6;
|
|
26882
|
-
function
|
|
27202
|
+
function currencyFor16(address, decimals, symbol, tokens) {
|
|
26883
27203
|
const lower4 = address.toLowerCase();
|
|
26884
27204
|
return tokens[lower4] ?? { address: lower4, symbol, name: symbol, decimals };
|
|
26885
27205
|
}
|
|
@@ -26930,7 +27250,7 @@ function convertFrankencoinMarketsToResponse(raw, chainId, prices = {}, _additio
|
|
|
26930
27250
|
name: "Collateral " + collSymbol,
|
|
26931
27251
|
poolId: market.position.toLowerCase(),
|
|
26932
27252
|
underlying: collAddr,
|
|
26933
|
-
asset:
|
|
27253
|
+
asset: currencyFor16(collAddr, collDecimals, collSymbol, tokens),
|
|
26934
27254
|
totalDeposits: totalColl,
|
|
26935
27255
|
totalDebtStable: 0,
|
|
26936
27256
|
totalDebt: 0,
|
|
@@ -26977,7 +27297,7 @@ function convertFrankencoinMarketsToResponse(raw, chainId, prices = {}, _additio
|
|
|
26977
27297
|
name: debtSymbol,
|
|
26978
27298
|
poolId: cfg.mintingHub.toLowerCase(),
|
|
26979
27299
|
underlying: debtAddr,
|
|
26980
|
-
asset:
|
|
27300
|
+
asset: currencyFor16(debtAddr, debtDecimals, debtSymbol, tokens),
|
|
26981
27301
|
totalDeposits: 0,
|
|
26982
27302
|
totalDebtStable: 0,
|
|
26983
27303
|
totalDebt,
|
|
@@ -27698,6 +28018,7 @@ async function getLenderDataFromApi(lender, chainId, prices, additionalYields, i
|
|
|
27698
28018
|
if (isRiver(lender)) return await fetchRiverMarkets(lender, chainId);
|
|
27699
28019
|
if (isTeller(lender)) return await fetchTellerMarkets(chainId);
|
|
27700
28020
|
if (isInverse(lender)) return await fetchInverseMarkets(lender, chainId);
|
|
28021
|
+
if (isCooler(lender)) return await fetchCoolerMarkets(lender, chainId);
|
|
27701
28022
|
if (isLlamaLend(lender)) return await fetchLlamaLendMarkets(lender, chainId);
|
|
27702
28023
|
if (isResupply(lender)) return await fetchResupplyMarkets(lender, chainId);
|
|
27703
28024
|
if (isCurvance(lender)) return await fetchCurvanceMarkets(lender, chainId);
|
|
@@ -27768,6 +28089,14 @@ function convertLenderDataFromApi(lender, chainId, data, prices, additionalYield
|
|
|
27768
28089
|
additionalYields,
|
|
27769
28090
|
list
|
|
27770
28091
|
);
|
|
28092
|
+
if (isCooler(lender))
|
|
28093
|
+
return convertCoolerMarketsToResponse(
|
|
28094
|
+
data,
|
|
28095
|
+
chainId,
|
|
28096
|
+
prices,
|
|
28097
|
+
additionalYields,
|
|
28098
|
+
list
|
|
28099
|
+
)[lender] ?? {};
|
|
27771
28100
|
if (isLlamaLend(lender))
|
|
27772
28101
|
return convertLlamaLendMarketsToResponse(
|
|
27773
28102
|
data,
|
|
@@ -28032,6 +28361,7 @@ function lenderApiOnly(lender, chainId) {
|
|
|
28032
28361
|
if (isRiver(lender)) return true;
|
|
28033
28362
|
if (isTeller(lender)) return true;
|
|
28034
28363
|
if (isInverse(lender)) return true;
|
|
28364
|
+
if (isCooler(lender)) return true;
|
|
28035
28365
|
if (isTermMax(lender)) return true;
|
|
28036
28366
|
if (isResupply(lender)) return true;
|
|
28037
28367
|
if (isCurvance(lender)) return true;
|
|
@@ -29564,6 +29894,14 @@ var buildInverseUserCall = (chainId, lender, account) => {
|
|
|
29564
29894
|
);
|
|
29565
29895
|
return calls;
|
|
29566
29896
|
};
|
|
29897
|
+
var COOLER_USER_CALLS = 1;
|
|
29898
|
+
var buildCoolerUserCall = (chainId, lender, account) => {
|
|
29899
|
+
const cfg = coolerConfigFor(lender, chainId);
|
|
29900
|
+
if (!cfg?.monoCooler) return [];
|
|
29901
|
+
return [
|
|
29902
|
+
{ address: cfg.monoCooler, name: "accountPosition", params: [account] }
|
|
29903
|
+
];
|
|
29904
|
+
};
|
|
29567
29905
|
var RESUPPLY_CALLS_PER_PAIR = 2;
|
|
29568
29906
|
var ONE3 = 10n ** 18n;
|
|
29569
29907
|
var ROSTER_TTL_MS = 5 * 6e4;
|
|
@@ -29857,7 +30195,7 @@ var buildCurvanceUserCall = async (chainId, lender, account) => {
|
|
|
29857
30195
|
]);
|
|
29858
30196
|
};
|
|
29859
30197
|
var DISCOVERY_TTL_MS3 = 6e4;
|
|
29860
|
-
var TWYNE_READS_PER_VAULT =
|
|
30198
|
+
var TWYNE_READS_PER_VAULT = 7;
|
|
29861
30199
|
var discoveryCache4 = /* @__PURE__ */ new Map();
|
|
29862
30200
|
var discoveryKey3 = (chainId, lender, account) => `${chainId}:${lender}:${account.toLowerCase()}`;
|
|
29863
30201
|
function getCachedTwyneDiscovery(chainId, lender, account) {
|
|
@@ -29899,9 +30237,15 @@ async function discover(chainId, lender, account) {
|
|
|
29899
30237
|
abi: TwyneCollateralVaultAbi,
|
|
29900
30238
|
allowFailure: true
|
|
29901
30239
|
});
|
|
29902
|
-
const
|
|
29903
|
-
|
|
29904
|
-
|
|
30240
|
+
const queried = twyneKeyParts(lender);
|
|
30241
|
+
const known = new Map(
|
|
30242
|
+
(twyneChainData(lender, chainId)?.markets ?? []).filter(
|
|
30243
|
+
(m) => !queried || lower2(m.intermediateVault) === lower2(queried.intermediateVault) && lower2(m.targetAsset) === lower2(queried.targetAsset)
|
|
30244
|
+
).map(
|
|
30245
|
+
(m) => [
|
|
30246
|
+
`${lower2(m.intermediateVault)}|${lower2(m.targetAsset)}`,
|
|
30247
|
+
m.collateralAsset
|
|
30248
|
+
]
|
|
29905
30249
|
)
|
|
29906
30250
|
);
|
|
29907
30251
|
const vaults = [];
|
|
@@ -29911,9 +30255,40 @@ async function discover(chainId, lender, account) {
|
|
|
29911
30255
|
const owner = refs[i * 3 + 2];
|
|
29912
30256
|
if (!isAddress2(iv) || !isAddress2(target)) return;
|
|
29913
30257
|
if (isAddress2(owner) && lower2(owner) !== lower2(account)) return;
|
|
29914
|
-
|
|
29915
|
-
|
|
30258
|
+
const marketKey2 = `${lower2(iv)}|${lower2(target)}`;
|
|
30259
|
+
if (!known.has(marketKey2)) return;
|
|
30260
|
+
vaults.push({
|
|
30261
|
+
vault,
|
|
30262
|
+
intermediateVault: lower2(iv),
|
|
30263
|
+
targetAsset: lower2(target),
|
|
30264
|
+
collateralAsset: known.get(marketKey2)
|
|
30265
|
+
});
|
|
29916
30266
|
});
|
|
30267
|
+
const receipts = [
|
|
30268
|
+
...new Set(vaults.map((v) => v.collateralAsset).filter((a) => !!a))
|
|
30269
|
+
];
|
|
30270
|
+
if (receipts.length > 0) {
|
|
30271
|
+
const scales = await multicallRetryUniversal({
|
|
30272
|
+
chain: chainId,
|
|
30273
|
+
calls: receipts.map((address) => ({
|
|
30274
|
+
address,
|
|
30275
|
+
name: "convertToAssets",
|
|
30276
|
+
args: [10n ** 18n]
|
|
30277
|
+
})),
|
|
30278
|
+
abi: TwyneATokenWrapperAbi,
|
|
30279
|
+
allowFailure: true
|
|
30280
|
+
});
|
|
30281
|
+
const byReceipt = /* @__PURE__ */ new Map();
|
|
30282
|
+
receipts.forEach((address, i) => {
|
|
30283
|
+
const v = scales[i];
|
|
30284
|
+
const scale3 = typeof v === "bigint" ? v : typeof v === "string" && /^\d+$/.test(v) ? BigInt(v) : void 0;
|
|
30285
|
+
if (scale3 && scale3 > 0n) byReceipt.set(lower2(address), scale3);
|
|
30286
|
+
});
|
|
30287
|
+
for (const v of vaults) {
|
|
30288
|
+
const scale3 = v.collateralAsset ? byReceipt.get(lower2(v.collateralAsset)) : void 0;
|
|
30289
|
+
if (scale3) v.collateralToUnderlying = scale3;
|
|
30290
|
+
}
|
|
30291
|
+
}
|
|
29917
30292
|
const result = { vaults, at: Date.now() };
|
|
29918
30293
|
discoveryCache4.set(key3, result);
|
|
29919
30294
|
return result;
|
|
@@ -29928,9 +30303,7 @@ async function buildTwyneUserCall(chainId, lender, account) {
|
|
|
29928
30303
|
{ address: vault, name: "twyneLiqLTV", args: [] },
|
|
29929
30304
|
{ address: vault, name: "canLiquidate", args: [] },
|
|
29930
30305
|
{ address: vault, name: "isExternallyLiquidated", args: [] },
|
|
29931
|
-
{ address: vault, name: "canRebalance", args: [] }
|
|
29932
|
-
{ address: vault, name: "asset", args: [] },
|
|
29933
|
-
{ address: vault, name: "convertToAssets", args: [10n ** 18n] }
|
|
30306
|
+
{ address: vault, name: "canRebalance", args: [] }
|
|
29934
30307
|
]);
|
|
29935
30308
|
}
|
|
29936
30309
|
var DSS_CALLS_PER_CDP = 1;
|
|
@@ -29943,7 +30316,7 @@ var getCachedDssCdps = (lender, chainId, account) => {
|
|
|
29943
30316
|
if (!hit || Date.now() - hit.at > CACHE_TTL_MS2) return void 0;
|
|
29944
30317
|
return hit;
|
|
29945
30318
|
};
|
|
29946
|
-
var
|
|
30319
|
+
var big6 = (v) => {
|
|
29947
30320
|
try {
|
|
29948
30321
|
if (typeof v === "bigint") return v;
|
|
29949
30322
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -29974,7 +30347,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
|
|
|
29974
30347
|
],
|
|
29975
30348
|
allowFailure: false
|
|
29976
30349
|
});
|
|
29977
|
-
owners.push({ owner: account, count:
|
|
30350
|
+
owners.push({ owner: account, count: big6(rawCount), cursor: big6(rawFirst) });
|
|
29978
30351
|
const proxy = String(rawProxy ?? zero2);
|
|
29979
30352
|
if (proxy.toLowerCase() !== zero2) {
|
|
29980
30353
|
const [pCount, pFirst] = await multicallRetryUniversal({
|
|
@@ -29986,7 +30359,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
|
|
|
29986
30359
|
],
|
|
29987
30360
|
allowFailure: false
|
|
29988
30361
|
});
|
|
29989
|
-
owners.push({ owner: proxy, count:
|
|
30362
|
+
owners.push({ owner: proxy, count: big6(pCount), cursor: big6(pFirst) });
|
|
29990
30363
|
}
|
|
29991
30364
|
} catch {
|
|
29992
30365
|
return [];
|
|
@@ -30027,7 +30400,7 @@ var buildDssUserCall = async (chainId, lender, account) => {
|
|
|
30027
30400
|
if (curated.has(ilk)) {
|
|
30028
30401
|
cdps.push({ cdpId: cursor.toString(), urn: String(urn), ilk });
|
|
30029
30402
|
}
|
|
30030
|
-
cursor =
|
|
30403
|
+
cursor = big6(field6(link, "next", 1));
|
|
30031
30404
|
}
|
|
30032
30405
|
}
|
|
30033
30406
|
} catch {
|
|
@@ -30276,6 +30649,7 @@ async function buildUserCall(chainId, lender, account, params, getClient) {
|
|
|
30276
30649
|
if (isTeller(lender)) return buildTellerUserCall(chainId, lender, account);
|
|
30277
30650
|
if (isTermMax(lender)) return buildTermMaxUserCall(chainId, lender, account);
|
|
30278
30651
|
if (isInverse(lender)) return buildInverseUserCall(chainId, lender, account);
|
|
30652
|
+
if (isCooler(lender)) return buildCoolerUserCall(chainId, lender, account);
|
|
30279
30653
|
if (isLlamaLend(lender))
|
|
30280
30654
|
return buildLlamaLendUserCall(chainId, lender, account);
|
|
30281
30655
|
if (isResupply(lender)) return buildResupplyUserCall(chainId, lender, account);
|
|
@@ -32830,7 +33204,7 @@ var getMidnightUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
32830
33204
|
totalCalls
|
|
32831
33205
|
];
|
|
32832
33206
|
};
|
|
32833
|
-
var
|
|
33207
|
+
var WAD12 = 1000000000000000000n;
|
|
32834
33208
|
function toBigInt12(v) {
|
|
32835
33209
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
32836
33210
|
if (typeof v === "bigint") return v;
|
|
@@ -32872,8 +33246,8 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
32872
33246
|
const debtStr = parseRawAmount(debtUnits.toString(), market.loanDecimals);
|
|
32873
33247
|
const debtNum = Number(debtStr);
|
|
32874
33248
|
const repoBalance = toBigInt12(balanceResult);
|
|
32875
|
-
const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) ||
|
|
32876
|
-
const lentUnits = repoBalance * redemptionValue /
|
|
33249
|
+
const redemptionValue = toBigInt12(redemptionResult) || toBigInt12(market.redemptionValue) || WAD12;
|
|
33250
|
+
const lentUnits = repoBalance * redemptionValue / WAD12;
|
|
32877
33251
|
const depositsStr = parseRawAmount(lentUnits.toString(), market.loanDecimals);
|
|
32878
33252
|
const depositsNum = Number(depositsStr);
|
|
32879
33253
|
const posData = {};
|
|
@@ -32951,7 +33325,7 @@ var getTermUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
32951
33325
|
};
|
|
32952
33326
|
var nowSec6 = () => Math.floor(Date.now() / 1e3);
|
|
32953
33327
|
var DAY_SECONDS = 86400n;
|
|
32954
|
-
var
|
|
33328
|
+
var WAD13 = 10n ** 18n;
|
|
32955
33329
|
function sumPreview(positions) {
|
|
32956
33330
|
return positions.reduce((acc, p) => acc + p.previewValue, 0n);
|
|
32957
33331
|
}
|
|
@@ -32975,7 +33349,7 @@ function toDetail(positions, kind, now, penaltyRate, penaltyApr) {
|
|
|
32975
33349
|
...kind === "borrow" ? {
|
|
32976
33350
|
...overdue ? { latePenalty: excess.toString() } : { earlyRepayDiscount: gap.toString() },
|
|
32977
33351
|
// face × penaltyRate × 1 day — what another day of being late adds.
|
|
32978
|
-
latePenaltyPerDay: (face * penaltyRate * DAY_SECONDS /
|
|
33352
|
+
latePenaltyPerDay: (face * penaltyRate * DAY_SECONDS / WAD13).toString(),
|
|
32979
33353
|
latePenaltyApr: penaltyApr
|
|
32980
33354
|
} : {
|
|
32981
33355
|
...overdue ? {} : { earlyExitCost: gap.toString() },
|
|
@@ -33104,7 +33478,7 @@ var getExactlyUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
33104
33478
|
latePenalty: penalty,
|
|
33105
33479
|
/** further penalty per day overdue — linear on face */
|
|
33106
33480
|
latePenaltyPerDay: parseRawAmount(
|
|
33107
|
-
(face * m.penaltyRate * DAY_SECONDS /
|
|
33481
|
+
(face * m.penaltyRate * DAY_SECONDS / WAD13).toString(),
|
|
33108
33482
|
decimals
|
|
33109
33483
|
),
|
|
33110
33484
|
latePenaltyApr: penaltyApr,
|
|
@@ -33135,7 +33509,7 @@ var getExactlyUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
33135
33509
|
expected
|
|
33136
33510
|
];
|
|
33137
33511
|
};
|
|
33138
|
-
var
|
|
33512
|
+
var big7 = (v) => {
|
|
33139
33513
|
try {
|
|
33140
33514
|
if (typeof v === "bigint") return v;
|
|
33141
33515
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33143,7 +33517,7 @@ var big6 = (v) => {
|
|
|
33143
33517
|
}
|
|
33144
33518
|
return 0n;
|
|
33145
33519
|
};
|
|
33146
|
-
var field7 = (res, name, idx) =>
|
|
33520
|
+
var field7 = (res, name, idx) => big7(res?.[name] ?? res?.[idx]);
|
|
33147
33521
|
var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
|
|
33148
33522
|
const cfg = liquityConfigFor(lender, chainId);
|
|
33149
33523
|
const branches = liquityBranchesByChain(lender, chainId);
|
|
@@ -33264,11 +33638,11 @@ var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33264
33638
|
};
|
|
33265
33639
|
});
|
|
33266
33640
|
const spBase = troves.length * 2;
|
|
33267
|
-
const spDeposit =
|
|
33268
|
-
const spYield =
|
|
33269
|
-
const spCollGain =
|
|
33270
|
-
const spStashed =
|
|
33271
|
-
const collSurplus = branch.collSurplusPool ?
|
|
33641
|
+
const spDeposit = big7(slice2[spBase]);
|
|
33642
|
+
const spYield = big7(slice2[spBase + 1]);
|
|
33643
|
+
const spCollGain = big7(slice2[spBase + 2]);
|
|
33644
|
+
const spStashed = big7(slice2[spBase + 3]);
|
|
33645
|
+
const collSurplus = branch.collSurplusPool ? big7(slice2[spBase + 4]) : 0n;
|
|
33272
33646
|
const spStable = spDeposit + spYield;
|
|
33273
33647
|
const spColl = spCollGain + spStashed + collSurplus;
|
|
33274
33648
|
if (spStable > 0n || spColl > 0n) {
|
|
@@ -33347,7 +33721,7 @@ var getLiquityUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33347
33721
|
expected
|
|
33348
33722
|
];
|
|
33349
33723
|
};
|
|
33350
|
-
var
|
|
33724
|
+
var big8 = (v) => {
|
|
33351
33725
|
try {
|
|
33352
33726
|
if (typeof v === "bigint") return v;
|
|
33353
33727
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33355,7 +33729,7 @@ var big7 = (v) => {
|
|
|
33355
33729
|
}
|
|
33356
33730
|
return 0n;
|
|
33357
33731
|
};
|
|
33358
|
-
var field8 = (res, name, idx) =>
|
|
33732
|
+
var field8 = (res, name, idx) => big8(res?.[name] ?? res?.[idx]);
|
|
33359
33733
|
var getRiverUserDataConverter = (lender, chainId, account, meta) => {
|
|
33360
33734
|
const cfg = riverConfigFor(lender, chainId);
|
|
33361
33735
|
const markets = riverChainData(lender, chainId)?.markets ?? [];
|
|
@@ -33367,13 +33741,13 @@ var getRiverUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33367
33741
|
const debtAddr = cfg.debtToken.toLowerCase();
|
|
33368
33742
|
const debtDecimals = cfg.debtDecimals ?? 18;
|
|
33369
33743
|
const out = {};
|
|
33370
|
-
const spDeposit =
|
|
33744
|
+
const spDeposit = big8(data[markets.length * RIVER_CALLS_PER_MARKET]);
|
|
33371
33745
|
markets.forEach((market, i) => {
|
|
33372
33746
|
const base = i * RIVER_CALLS_PER_MARKET;
|
|
33373
33747
|
const entire = data[base];
|
|
33374
33748
|
if (isFailedCall(entire) || isFailedCall(data[base + 1])) return;
|
|
33375
|
-
const status = Number(
|
|
33376
|
-
const surplus =
|
|
33749
|
+
const status = Number(big8(data[base + 1]));
|
|
33750
|
+
const surplus = big8(data[base + 2]);
|
|
33377
33751
|
const lenderKey = riverLenderKey(lender, chainId, market.index);
|
|
33378
33752
|
const metaMap = meta?.[lenderKey];
|
|
33379
33753
|
if (!metaMap) return;
|
|
@@ -33481,7 +33855,7 @@ var getRiverUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33481
33855
|
expected
|
|
33482
33856
|
];
|
|
33483
33857
|
};
|
|
33484
|
-
var
|
|
33858
|
+
var big9 = (v) => {
|
|
33485
33859
|
try {
|
|
33486
33860
|
if (typeof v === "bigint") return v;
|
|
33487
33861
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33500,24 +33874,24 @@ var getInverseUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33500
33874
|
const dolaAddr = cfg.dola.toLowerCase();
|
|
33501
33875
|
const debtDecimals = cfg.debtDecimals ?? 18;
|
|
33502
33876
|
const tailBase = markets.length * INVERSE_CALLS_PER_MARKET;
|
|
33503
|
-
const dbrBalance =
|
|
33504
|
-
const dbrDeficit =
|
|
33877
|
+
const dbrBalance = big9(data[tailBase]);
|
|
33878
|
+
const dbrDeficit = big9(data[tailBase + 1]);
|
|
33505
33879
|
const dbrSignedRaw = data[tailBase + 2];
|
|
33506
|
-
const dbrSigned = isFailedCall(dbrSignedRaw) ? 0n :
|
|
33880
|
+
const dbrSigned = isFailedCall(dbrSignedRaw) ? 0n : big9(dbrSignedRaw);
|
|
33507
33881
|
const dbrTotalDebtRaw = data[tailBase + 3];
|
|
33508
|
-
const dbrTotalDebt = isFailedCall(dbrTotalDebtRaw) ? 0n :
|
|
33882
|
+
const dbrTotalDebt = isFailedCall(dbrTotalDebtRaw) ? 0n : big9(dbrTotalDebtRaw);
|
|
33509
33883
|
const dbrRunway = dbrTotalDebt > 0n ? dbrBalance * 31536000n / dbrTotalDebt : 0n;
|
|
33510
33884
|
const nowSec9 = BigInt(Math.floor(Date.now() / 1e3));
|
|
33511
33885
|
const out = {};
|
|
33512
33886
|
markets.forEach((market, i) => {
|
|
33513
33887
|
const base = i * INVERSE_CALLS_PER_MARKET;
|
|
33514
|
-
const escrowBal = isFailedCall(data[base]) ? 0n :
|
|
33888
|
+
const escrowBal = isFailedCall(data[base]) ? 0n : big9(data[base]);
|
|
33515
33889
|
const debtRaw = data[base + 1];
|
|
33516
33890
|
if (isFailedCall(debtRaw)) return;
|
|
33517
|
-
const debt =
|
|
33891
|
+
const debt = big9(debtRaw);
|
|
33518
33892
|
if (escrowBal === 0n && debt === 0n) return;
|
|
33519
|
-
const creditLimit = isFailedCall(data[base + 2]) ? 0n :
|
|
33520
|
-
const withdrawalLimit = isFailedCall(data[base + 3]) ? 0n :
|
|
33893
|
+
const creditLimit = isFailedCall(data[base + 2]) ? 0n : big9(data[base + 2]);
|
|
33894
|
+
const withdrawalLimit = isFailedCall(data[base + 3]) ? 0n : big9(data[base + 3]);
|
|
33521
33895
|
const lenderKey = inverseLenderKey(lender, market.address);
|
|
33522
33896
|
const metaMap = meta?.[lenderKey];
|
|
33523
33897
|
if (!metaMap) return;
|
|
@@ -33603,7 +33977,118 @@ var getInverseUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33603
33977
|
expected
|
|
33604
33978
|
];
|
|
33605
33979
|
};
|
|
33606
|
-
var
|
|
33980
|
+
var big10 = (v) => {
|
|
33981
|
+
try {
|
|
33982
|
+
if (typeof v === "bigint") return v;
|
|
33983
|
+
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
33984
|
+
} catch {
|
|
33985
|
+
}
|
|
33986
|
+
return 0n;
|
|
33987
|
+
};
|
|
33988
|
+
var getCoolerUserDataConverter = (lender, chainId, account, meta) => {
|
|
33989
|
+
const cfg = coolerConfigFor(lender, chainId);
|
|
33990
|
+
const expected = cfg?.monoCooler ? COOLER_USER_CALLS : 0;
|
|
33991
|
+
return [
|
|
33992
|
+
(data) => {
|
|
33993
|
+
if (!cfg || expected === 0 || !meta) return void 0;
|
|
33994
|
+
if (!data || data.length < expected) return void 0;
|
|
33995
|
+
const raw = data[0];
|
|
33996
|
+
if (isFailedCall(raw)) return void 0;
|
|
33997
|
+
const pos = Array.isArray(raw) ? {
|
|
33998
|
+
collateral: raw[0],
|
|
33999
|
+
currentDebt: raw[1],
|
|
34000
|
+
maxOriginationDebtAmount: raw[2],
|
|
34001
|
+
liquidationDebtAmount: raw[3],
|
|
34002
|
+
healthFactor: raw[4],
|
|
34003
|
+
currentLtv: raw[5],
|
|
34004
|
+
totalDelegated: raw[6]
|
|
34005
|
+
} : raw;
|
|
34006
|
+
if (pos === null || typeof pos !== "object") return void 0;
|
|
34007
|
+
const collateral = big10(pos.collateral);
|
|
34008
|
+
const debt = big10(pos.currentDebt);
|
|
34009
|
+
if (collateral === 0n && debt === 0n) return void 0;
|
|
34010
|
+
const collAddr = cfg.gohm.toLowerCase();
|
|
34011
|
+
const collUid = createMarketUid(chainId, lender, collAddr);
|
|
34012
|
+
let loanUid = createMarketUid(chainId, lender, cfg.usds.toLowerCase());
|
|
34013
|
+
if (!meta[loanUid]) {
|
|
34014
|
+
const other = Object.keys(meta).find((k) => k !== collUid);
|
|
34015
|
+
if (other) loanUid = other;
|
|
34016
|
+
}
|
|
34017
|
+
const collMeta = meta[collUid];
|
|
34018
|
+
const loanMeta = meta[loanUid];
|
|
34019
|
+
const collDisplay = collMeta ? getDisplayPrice(collMeta) : 0;
|
|
34020
|
+
const collOracle = collMeta ? getOraclePrice(collMeta) : 0;
|
|
34021
|
+
const collHist = collMeta?.price?.priceUsd24h ?? collDisplay;
|
|
34022
|
+
const loanDisplay = loanMeta ? getDisplayPrice(loanMeta) : 0;
|
|
34023
|
+
const loanOracle = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
34024
|
+
const loanHist = loanMeta?.price?.priceUsd24h ?? loanDisplay;
|
|
34025
|
+
const coolerInfo = {
|
|
34026
|
+
healthFactor: big10(pos.healthFactor).toString(),
|
|
34027
|
+
currentLtv: big10(pos.currentLtv).toString(),
|
|
34028
|
+
totalDelegated: big10(pos.totalDelegated).toString(),
|
|
34029
|
+
maxOriginationDebtAmount: big10(pos.maxOriginationDebtAmount).toString(),
|
|
34030
|
+
liquidationDebtAmount: big10(pos.liquidationDebtAmount).toString()
|
|
34031
|
+
};
|
|
34032
|
+
const collStr = parseRawAmount(collateral.toString(), 18);
|
|
34033
|
+
const collNum = Number(collStr);
|
|
34034
|
+
const debtStr = parseRawAmount(debt.toString(), 18);
|
|
34035
|
+
const debtNum = Number(debtStr);
|
|
34036
|
+
const loanUnderlying = loanMeta?.asset?.address ?? cfg.usds.toLowerCase();
|
|
34037
|
+
const lendingPositions = {
|
|
34038
|
+
"0": {
|
|
34039
|
+
[collUid]: {
|
|
34040
|
+
marketUid: collUid,
|
|
34041
|
+
underlying: collAddr,
|
|
34042
|
+
deposits: collStr,
|
|
34043
|
+
debt: "0",
|
|
34044
|
+
debtStable: "0",
|
|
34045
|
+
depositsUSD: collNum * collDisplay,
|
|
34046
|
+
debtUSD: 0,
|
|
34047
|
+
debtStableUSD: 0,
|
|
34048
|
+
depositsUSDOracle: collNum * collOracle,
|
|
34049
|
+
debtUSDOracle: 0,
|
|
34050
|
+
debtStableUSDOracle: 0,
|
|
34051
|
+
stableBorrowRate: "0",
|
|
34052
|
+
collateralEnabled: true,
|
|
34053
|
+
claimableRewards: 0
|
|
34054
|
+
},
|
|
34055
|
+
[loanUid]: {
|
|
34056
|
+
marketUid: loanUid,
|
|
34057
|
+
underlying: loanUnderlying,
|
|
34058
|
+
deposits: "0",
|
|
34059
|
+
debt: debtStr,
|
|
34060
|
+
debtStable: "0",
|
|
34061
|
+
depositsUSD: 0,
|
|
34062
|
+
debtUSD: debtNum * loanDisplay,
|
|
34063
|
+
debtStableUSD: 0,
|
|
34064
|
+
depositsUSDOracle: 0,
|
|
34065
|
+
debtUSDOracle: debtNum * loanOracle,
|
|
34066
|
+
debtStableUSDOracle: 0,
|
|
34067
|
+
stableBorrowRate: "0",
|
|
34068
|
+
collateralEnabled: false,
|
|
34069
|
+
claimableRewards: 0,
|
|
34070
|
+
coolerInfo
|
|
34071
|
+
}
|
|
34072
|
+
}
|
|
34073
|
+
};
|
|
34074
|
+
const modes = { "0": 0 };
|
|
34075
|
+
const hist = {
|
|
34076
|
+
"0": {
|
|
34077
|
+
totalDeposits24h: collNum * collHist,
|
|
34078
|
+
totalDebt24h: debtNum * loanHist
|
|
34079
|
+
}
|
|
34080
|
+
};
|
|
34081
|
+
const userData = createMultiAccountTypeUserState(
|
|
34082
|
+
{ chainId, account, lendingPositions, modes },
|
|
34083
|
+
meta,
|
|
34084
|
+
hist
|
|
34085
|
+
);
|
|
34086
|
+
return userData && userData.data.length > 0 ? userData : void 0;
|
|
34087
|
+
},
|
|
34088
|
+
expected
|
|
34089
|
+
];
|
|
34090
|
+
};
|
|
34091
|
+
var big11 = (v) => {
|
|
33607
34092
|
try {
|
|
33608
34093
|
if (typeof v === "bigint") return v;
|
|
33609
34094
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33613,7 +34098,7 @@ var big9 = (v) => {
|
|
|
33613
34098
|
};
|
|
33614
34099
|
var arrAt = (v, i) => {
|
|
33615
34100
|
if (isFailedCall(v) || !Array.isArray(v)) return 0n;
|
|
33616
|
-
return
|
|
34101
|
+
return big11(v[i]);
|
|
33617
34102
|
};
|
|
33618
34103
|
var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
|
|
33619
34104
|
const cfg = llamaLendConfigFor(lender, chainId);
|
|
@@ -33628,24 +34113,24 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33628
34113
|
const base = i * LLAMALEND_CALLS_PER_MARKET;
|
|
33629
34114
|
const stateRaw = data[base];
|
|
33630
34115
|
if (isFailedCall(stateRaw) || !Array.isArray(stateRaw)) return;
|
|
33631
|
-
const collateral =
|
|
33632
|
-
const bandBorrowed =
|
|
33633
|
-
const debt =
|
|
33634
|
-
const bandCount = Number(
|
|
34116
|
+
const collateral = big11(stateRaw[0]);
|
|
34117
|
+
const bandBorrowed = big11(stateRaw[1]);
|
|
34118
|
+
const debt = big11(stateRaw[2]);
|
|
34119
|
+
const bandCount = Number(big11(stateRaw[3]));
|
|
33635
34120
|
const vaultSharesRaw = data[base + 5];
|
|
33636
34121
|
const gaugeSharesRaw = data[base + 6];
|
|
33637
|
-
const vaultShares = isFailedCall(vaultSharesRaw) ? 0n :
|
|
33638
|
-
const gaugeShares = isFailedCall(gaugeSharesRaw) ? 0n :
|
|
34122
|
+
const vaultShares = isFailedCall(vaultSharesRaw) ? 0n : big11(vaultSharesRaw);
|
|
34123
|
+
const gaugeShares = isFailedCall(gaugeSharesRaw) ? 0n : big11(gaugeSharesRaw);
|
|
33639
34124
|
const lendShares = vaultShares + gaugeShares;
|
|
33640
34125
|
if (collateral === 0n && debt === 0n && bandBorrowed === 0n && lendShares === 0n)
|
|
33641
34126
|
return;
|
|
33642
34127
|
const healthRaw = data[base + 1];
|
|
33643
|
-
const health = isFailedCall(healthRaw) ? 0n :
|
|
34128
|
+
const health = isFailedCall(healthRaw) ? 0n : big11(healthRaw);
|
|
33644
34129
|
const pricesRaw = data[base + 2];
|
|
33645
34130
|
const priceUpper = arrAt(pricesRaw, 0);
|
|
33646
34131
|
const priceLower = arrAt(pricesRaw, 1);
|
|
33647
34132
|
const ticksRaw = data[base + 3];
|
|
33648
|
-
const bands = isFailedCall(ticksRaw) || !Array.isArray(ticksRaw) ? void 0 : [Number(
|
|
34133
|
+
const bands = isFailedCall(ticksRaw) || !Array.isArray(ticksRaw) ? void 0 : [Number(big11(ticksRaw[0])), Number(big11(ticksRaw[1]))];
|
|
33649
34134
|
const approvalRaw = data[base + 4];
|
|
33650
34135
|
const delegated = isFailedCall(approvalRaw) ? false : approvalRaw === true;
|
|
33651
34136
|
const lenderKey = llamaLendLenderKey(lender, market.controller);
|
|
@@ -33666,7 +34151,7 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33666
34151
|
const loanOracle = loanMeta ? getOraclePrice(loanMeta) : 0;
|
|
33667
34152
|
const loanHist = loanMeta?.price?.priceUsd24h ?? loanDisplay;
|
|
33668
34153
|
const shareToAssetRaw = data[base + 7];
|
|
33669
|
-
const shareToAsset = isFailedCall(shareToAssetRaw) ? 0n :
|
|
34154
|
+
const shareToAsset = isFailedCall(shareToAssetRaw) ? 0n : big11(shareToAssetRaw);
|
|
33670
34155
|
const lendAssets = shareToAsset === 0n ? 0n : lendShares * shareToAsset / 10n ** 18n;
|
|
33671
34156
|
const lendStr = parseRawAmount(lendAssets.toString(), loanDecimals);
|
|
33672
34157
|
const depositStr = parseRawAmount(
|
|
@@ -33755,7 +34240,7 @@ var getLlamaLendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33755
34240
|
expected
|
|
33756
34241
|
];
|
|
33757
34242
|
};
|
|
33758
|
-
var
|
|
34243
|
+
var big12 = (v) => {
|
|
33759
34244
|
try {
|
|
33760
34245
|
if (typeof v === "bigint") return v;
|
|
33761
34246
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33763,7 +34248,7 @@ var big10 = (v) => {
|
|
|
33763
34248
|
}
|
|
33764
34249
|
return 0n;
|
|
33765
34250
|
};
|
|
33766
|
-
var tupleAt = (v, i) => Array.isArray(v) ?
|
|
34251
|
+
var tupleAt = (v, i) => Array.isArray(v) ? big12(v[i]) : 0n;
|
|
33767
34252
|
var ONE4 = 10n ** 18n;
|
|
33768
34253
|
function sharesToAmount(shares, totalAmount, totalShares) {
|
|
33769
34254
|
if (totalShares === 0n || shares === 0n) return 0n;
|
|
@@ -33789,7 +34274,7 @@ var getResupplyUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33789
34274
|
if (isFailedCall(accounting) || !Array.isArray(accounting)) return;
|
|
33790
34275
|
const totalBorrowAmount = tupleAt(accounting, 1);
|
|
33791
34276
|
const totalBorrowShares = tupleAt(accounting, 2);
|
|
33792
|
-
const sharePrice = isFailedCall(data[base + 1]) ? 0n :
|
|
34277
|
+
const sharePrice = isFailedCall(data[base + 1]) ? 0n : big12(data[base + 1]);
|
|
33793
34278
|
const lenderKey = resupplyLenderKey(lender, chainId, pair);
|
|
33794
34279
|
const metaMap = meta?.[lenderKey];
|
|
33795
34280
|
if (!metaMap) return;
|
|
@@ -33887,7 +34372,7 @@ var getResupplyUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33887
34372
|
expected
|
|
33888
34373
|
];
|
|
33889
34374
|
};
|
|
33890
|
-
var
|
|
34375
|
+
var big13 = (v) => {
|
|
33891
34376
|
try {
|
|
33892
34377
|
if (typeof v === "bigint") return v;
|
|
33893
34378
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -33918,9 +34403,9 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33918
34403
|
const fTokenRaw = data[base + 2];
|
|
33919
34404
|
const previewRaw = data[base + 3];
|
|
33920
34405
|
if (isFailedCall(collRaw) || isFailedCall(sharesRaw)) return;
|
|
33921
|
-
const collateral =
|
|
33922
|
-
const borrowShares =
|
|
33923
|
-
const fTokenShares = isFailedCall(fTokenRaw) ? 0n :
|
|
34406
|
+
const collateral = big13(collRaw);
|
|
34407
|
+
const borrowShares = big13(sharesRaw);
|
|
34408
|
+
const fTokenShares = isFailedCall(fTokenRaw) ? 0n : big13(fTokenRaw);
|
|
33924
34409
|
if (collateral === 0n && borrowShares === 0n && fTokenShares === 0n)
|
|
33925
34410
|
return;
|
|
33926
34411
|
let totalBorrowAmount = 0n;
|
|
@@ -33930,10 +34415,10 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
33930
34415
|
if (!isFailedCall(previewRaw) && previewRaw) {
|
|
33931
34416
|
const ta = previewRaw[4];
|
|
33932
34417
|
const tb = previewRaw[5];
|
|
33933
|
-
totalAssetAmount =
|
|
33934
|
-
totalAssetShares =
|
|
33935
|
-
totalBorrowAmount =
|
|
33936
|
-
totalBorrowShares =
|
|
34418
|
+
totalAssetAmount = big13(ta?.amount ?? ta?.[0]);
|
|
34419
|
+
totalAssetShares = big13(ta?.shares ?? ta?.[1]);
|
|
34420
|
+
totalBorrowAmount = big13(tb?.amount ?? tb?.[0]);
|
|
34421
|
+
totalBorrowShares = big13(tb?.shares ?? tb?.[1]);
|
|
33937
34422
|
}
|
|
33938
34423
|
const debt = fraxlendToAmount(
|
|
33939
34424
|
borrowShares,
|
|
@@ -34040,8 +34525,8 @@ var getFraxlendUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34040
34525
|
expected
|
|
34041
34526
|
];
|
|
34042
34527
|
};
|
|
34043
|
-
var
|
|
34044
|
-
var
|
|
34528
|
+
var WAD14 = 10n ** 18n;
|
|
34529
|
+
var big14 = (v) => {
|
|
34045
34530
|
try {
|
|
34046
34531
|
if (typeof v === "bigint") return v;
|
|
34047
34532
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -34049,7 +34534,7 @@ var big12 = (v) => {
|
|
|
34049
34534
|
}
|
|
34050
34535
|
return 0n;
|
|
34051
34536
|
};
|
|
34052
|
-
var tupleAt2 = (v, i) => Array.isArray(v) ?
|
|
34537
|
+
var tupleAt2 = (v, i) => Array.isArray(v) ? big14(v[i]) : 0n;
|
|
34053
34538
|
var HOLD_PERIOD_SECONDS = 1200n;
|
|
34054
34539
|
var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
|
|
34055
34540
|
const cfg = curvanceConfigFor(lender, chainId);
|
|
@@ -34072,7 +34557,7 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34072
34557
|
const cooldownRaw = data[base];
|
|
34073
34558
|
const status = data[base + 1];
|
|
34074
34559
|
if (isFailedCall(status) || !Array.isArray(status)) continue;
|
|
34075
|
-
const cooldownTimestamp = isFailedCall(cooldownRaw) ? 0n :
|
|
34560
|
+
const cooldownTimestamp = isFailedCall(cooldownRaw) ? 0n : big14(cooldownRaw);
|
|
34076
34561
|
const holdPeriodEndsAt = cooldownTimestamp > 0n ? cooldownTimestamp + HOLD_PERIOD_SECONDS : 0n;
|
|
34077
34562
|
const holdPeriodActive = holdPeriodEndsAt > nowSeconds;
|
|
34078
34563
|
const lenderKey = curvanceLenderKey(lender, chainId, p.marketManager);
|
|
@@ -34094,10 +34579,10 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34094
34579
|
let rows = 0;
|
|
34095
34580
|
p.activeTokens.forEach(({ cToken, asset }, i) => {
|
|
34096
34581
|
const tokenBase = base + CURVANCE_MARKET_READS + i * CURVANCE_READS_PER_TOKEN;
|
|
34097
|
-
const shares = isFailedCall(data[tokenBase]) ? 0n :
|
|
34098
|
-
const collateralShares = isFailedCall(data[tokenBase + 1]) ? 0n :
|
|
34099
|
-
const debtRaw = isFailedCall(data[tokenBase + 2]) ? 0n :
|
|
34100
|
-
const exchangeRate = isFailedCall(data[tokenBase + 3]) ? 0n :
|
|
34582
|
+
const shares = isFailedCall(data[tokenBase]) ? 0n : big14(data[tokenBase]);
|
|
34583
|
+
const collateralShares = isFailedCall(data[tokenBase + 1]) ? 0n : big14(data[tokenBase + 1]);
|
|
34584
|
+
const debtRaw = isFailedCall(data[tokenBase + 2]) ? 0n : big14(data[tokenBase + 2]);
|
|
34585
|
+
const exchangeRate = isFailedCall(data[tokenBase + 3]) ? 0n : big14(data[tokenBase + 3]);
|
|
34101
34586
|
info.tokens[cToken.toLowerCase()] = {
|
|
34102
34587
|
shares: shares.toString(),
|
|
34103
34588
|
collateralShares: collateralShares.toString(),
|
|
@@ -34111,7 +34596,7 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34111
34596
|
const display = getDisplayPrice(rowMeta);
|
|
34112
34597
|
const oracle = getOraclePrice(rowMeta);
|
|
34113
34598
|
const histPrice = rowMeta.price?.priceUsd24h ?? display;
|
|
34114
|
-
const toUnderlying = (s) => exchangeRate > 0n ? s * exchangeRate /
|
|
34599
|
+
const toUnderlying = (s) => exchangeRate > 0n ? s * exchangeRate / WAD14 : s;
|
|
34115
34600
|
const depositsRaw = toUnderlying(collateralShares);
|
|
34116
34601
|
const depositsStr = parseRawAmount(
|
|
34117
34602
|
depositsRaw.toString(),
|
|
@@ -34156,8 +34641,8 @@ var getCurvanceUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34156
34641
|
expected
|
|
34157
34642
|
];
|
|
34158
34643
|
};
|
|
34159
|
-
var
|
|
34160
|
-
var
|
|
34644
|
+
var WAD15 = 10n ** 18n;
|
|
34645
|
+
var big15 = (v) => {
|
|
34161
34646
|
try {
|
|
34162
34647
|
if (typeof v === "bigint") return v;
|
|
34163
34648
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -34179,14 +34664,14 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34179
34664
|
const base = i * TWYNE_READS_PER_VAULT;
|
|
34180
34665
|
const totalRaw = data[base];
|
|
34181
34666
|
if (isFailedCall(totalRaw)) return;
|
|
34182
|
-
const total =
|
|
34183
|
-
const reserved = isFailedCall(data[base + 1]) ? 0n :
|
|
34184
|
-
const debt = isFailedCall(data[base + 2]) ? 0n :
|
|
34185
|
-
const liqLtv = isFailedCall(data[base + 3]) ? 0n :
|
|
34667
|
+
const total = big15(totalRaw);
|
|
34668
|
+
const reserved = isFailedCall(data[base + 1]) ? 0n : big15(data[base + 1]);
|
|
34669
|
+
const debt = isFailedCall(data[base + 2]) ? 0n : big15(data[base + 2]);
|
|
34670
|
+
const liqLtv = isFailedCall(data[base + 3]) ? 0n : big15(data[base + 3]);
|
|
34186
34671
|
const canLiquidate = isFailedCall(data[base + 4]) ? false : Boolean(data[base + 4]);
|
|
34187
34672
|
const extLiquidated = isFailedCall(data[base + 5]) ? false : Boolean(data[base + 5]);
|
|
34188
|
-
const releasable = isFailedCall(data[base + 6]) ? 0n :
|
|
34189
|
-
const scale3 =
|
|
34673
|
+
const releasable = isFailedCall(data[base + 6]) ? 0n : big15(data[base + 6]);
|
|
34674
|
+
const scale3 = ref.collateralToUnderlying ?? WAD15;
|
|
34190
34675
|
const userCollateral = total > reserved ? total - reserved : 0n;
|
|
34191
34676
|
if (userCollateral === 0n && debt === 0n) return;
|
|
34192
34677
|
const market = markets.find(
|
|
@@ -34202,7 +34687,7 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34202
34687
|
});
|
|
34203
34688
|
}
|
|
34204
34689
|
byMarket.get(lenderKey).rows.push({
|
|
34205
|
-
coll: userCollateral * scale3 /
|
|
34690
|
+
coll: userCollateral * scale3 / WAD15,
|
|
34206
34691
|
debt,
|
|
34207
34692
|
info: {
|
|
34208
34693
|
collateralVault: ref.vault,
|
|
@@ -34301,7 +34786,7 @@ var getTwyneUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34301
34786
|
];
|
|
34302
34787
|
};
|
|
34303
34788
|
var RAY7 = 10n ** 27n;
|
|
34304
|
-
var
|
|
34789
|
+
var big16 = (v) => {
|
|
34305
34790
|
try {
|
|
34306
34791
|
if (typeof v === "bigint") return v;
|
|
34307
34792
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -34309,7 +34794,7 @@ var big14 = (v) => {
|
|
|
34309
34794
|
}
|
|
34310
34795
|
return 0n;
|
|
34311
34796
|
};
|
|
34312
|
-
var field9 = (res, name, idx) =>
|
|
34797
|
+
var field9 = (res, name, idx) => big16(res?.[name] ?? res?.[idx]);
|
|
34313
34798
|
var getDssUserDataConverter = (lender, chainId, account, meta) => {
|
|
34314
34799
|
const cfg = dssConfigFor(lender, chainId);
|
|
34315
34800
|
const markets = dssChainData(lender, chainId)?.markets ?? [];
|
|
@@ -34424,7 +34909,7 @@ var getDssUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34424
34909
|
expected
|
|
34425
34910
|
];
|
|
34426
34911
|
};
|
|
34427
|
-
var
|
|
34912
|
+
var big17 = (v) => {
|
|
34428
34913
|
try {
|
|
34429
34914
|
if (typeof v === "bigint") return v;
|
|
34430
34915
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -34454,11 +34939,11 @@ var getFrankencoinUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34454
34939
|
const ownerRes = data[base];
|
|
34455
34940
|
if (isFailedCall(ownerRes)) return;
|
|
34456
34941
|
if (String(ownerRes).toLowerCase() !== lowerAccount) return;
|
|
34457
|
-
const minted =
|
|
34458
|
-
const price2 =
|
|
34459
|
-
const expiration =
|
|
34460
|
-
const challenged =
|
|
34461
|
-
const coll =
|
|
34942
|
+
const minted = big17(data[base + 1]);
|
|
34943
|
+
const price2 = big17(data[base + 2]);
|
|
34944
|
+
const expiration = big17(data[base + 3]);
|
|
34945
|
+
const challenged = big17(data[base + 4]);
|
|
34946
|
+
const coll = big17(data[base + 5]);
|
|
34462
34947
|
if (minted === 0n && coll === 0n) return;
|
|
34463
34948
|
const market = marketByOriginal.get(p.original);
|
|
34464
34949
|
if (!market) return;
|
|
@@ -34559,7 +35044,7 @@ var getFrankencoinUserDataConverter = (lender, chainId, account, meta) => {
|
|
|
34559
35044
|
|
|
34560
35045
|
// src/lending/user-data/teller/userCallParse.ts
|
|
34561
35046
|
var nowSec7 = () => Math.floor(Date.now() / 1e3);
|
|
34562
|
-
var
|
|
35047
|
+
var big18 = (v) => {
|
|
34563
35048
|
try {
|
|
34564
35049
|
if (typeof v === "bigint") return v;
|
|
34565
35050
|
if (typeof v === "number" || typeof v === "string") return BigInt(v);
|
|
@@ -34581,7 +35066,7 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
34581
35066
|
const base = i * TELLER_CALLS_PER_BID;
|
|
34582
35067
|
const bidRes = data[base];
|
|
34583
35068
|
const owed = data[base + 1];
|
|
34584
|
-
const collAmount =
|
|
35069
|
+
const collAmount = big18(data[base + 2]);
|
|
34585
35070
|
const defaulted = !!data[base + 3];
|
|
34586
35071
|
if (isFailedCall(bidRes) || isFailedCall(owed) || !bidRes) return;
|
|
34587
35072
|
const pool = b.pool;
|
|
@@ -34602,17 +35087,17 @@ var getTellerUserDataConverter = (_lender, chainId, account, meta) => {
|
|
|
34602
35087
|
const collDisplay = collMeta ? getDisplayPrice(collMeta) : 0;
|
|
34603
35088
|
const collOracle = collMeta ? getOraclePrice(collMeta) : 0;
|
|
34604
35089
|
const collHist = collMeta?.price?.priceUsd24h ?? collDisplay;
|
|
34605
|
-
const owedPrincipal =
|
|
34606
|
-
const owedInterest =
|
|
35090
|
+
const owedPrincipal = big18(field10(owed, "principal", 0));
|
|
35091
|
+
const owedInterest = big18(field10(owed, "interest", 1));
|
|
34607
35092
|
const owedTotal = owedPrincipal + owedInterest;
|
|
34608
35093
|
if (owedTotal === 0n && collAmount === 0n) return;
|
|
34609
35094
|
const loanDetails = field10(bidRes, "loanDetails", 5);
|
|
34610
35095
|
const terms = field10(bidRes, "terms", 6);
|
|
34611
35096
|
const acceptedTs = Number(
|
|
34612
|
-
|
|
35097
|
+
big18(field10(loanDetails, "acceptedTimestamp", 4))
|
|
34613
35098
|
);
|
|
34614
|
-
const loanDuration = Number(
|
|
34615
|
-
const aprBps = Number(
|
|
35099
|
+
const loanDuration = Number(big18(field10(loanDetails, "loanDuration", 6)));
|
|
35100
|
+
const aprBps = Number(big18(field10(terms, "APR", 2)));
|
|
34616
35101
|
const maturity = acceptedTs > 0 ? acceptedTs + loanDuration : void 0;
|
|
34617
35102
|
const isMatured2 = defaulted || maturity !== void 0 && maturity < now;
|
|
34618
35103
|
const collStr = parseRawAmount(collAmount.toString(), collDecimals);
|
|
@@ -34989,6 +35474,8 @@ function getUserDataConverter(lender, chainId, account, params, meta) {
|
|
|
34989
35474
|
return getTermMaxUserDataConverter(lender, chainId, account, meta);
|
|
34990
35475
|
if (isInverse(lender))
|
|
34991
35476
|
return getInverseUserDataConverter(lender, chainId, account, meta);
|
|
35477
|
+
if (isCooler(lender))
|
|
35478
|
+
return getCoolerUserDataConverter(lender, chainId, account, meta?.[lender]);
|
|
34992
35479
|
if (isLlamaLend(lender))
|
|
34993
35480
|
return getLlamaLendUserDataConverter(lender, chainId, account, meta);
|
|
34994
35481
|
if (isResupply(lender))
|
|
@@ -39611,6 +40098,16 @@ var VAULT_CONVERT_ABI = [
|
|
|
39611
40098
|
outputs: [{ type: "uint256" }]
|
|
39612
40099
|
}
|
|
39613
40100
|
];
|
|
40101
|
+
var TWYNE_USER_ABI = [
|
|
40102
|
+
...TwyneCollateralVaultAbi,
|
|
40103
|
+
{
|
|
40104
|
+
name: "convertToAssets",
|
|
40105
|
+
type: "function",
|
|
40106
|
+
stateMutability: "view",
|
|
40107
|
+
inputs: [{ name: "shares", type: "uint256" }],
|
|
40108
|
+
outputs: [{ type: "uint256" }]
|
|
40109
|
+
}
|
|
40110
|
+
];
|
|
39614
40111
|
var getAbi2 = (lender) => {
|
|
39615
40112
|
if (isAaveV4Type(lender)) return [...AaveV4SpokeAbi];
|
|
39616
40113
|
if (isAaveV2Type(lender))
|
|
@@ -39656,6 +40153,7 @@ var getAbi2 = (lender) => {
|
|
|
39656
40153
|
if (isTermMax(lender)) return [...TermMaxViewerAbi];
|
|
39657
40154
|
if (isInverse(lender))
|
|
39658
40155
|
return [...InverseMarketAbi, ...InverseEscrowAbi, ...InverseDbrAbi];
|
|
40156
|
+
if (isCooler(lender)) return [...CoolerMonoAbi];
|
|
39659
40157
|
if (isLlamaLend(lender))
|
|
39660
40158
|
return [...LlamaLendControllerAbi, ...LlamaLendAmmAbi];
|
|
39661
40159
|
if (isDssType(lender)) return [...UsddVatAbi];
|
|
@@ -39666,7 +40164,7 @@ var getAbi2 = (lender) => {
|
|
|
39666
40164
|
return [...ResupplyPairAbi, ...VAULT_CONVERT_ABI];
|
|
39667
40165
|
if (isCurvance(lender))
|
|
39668
40166
|
return [...CurvanceMarketManagerAbi, ...CurvanceCTokenAbi];
|
|
39669
|
-
if (isTwyne(lender)) return
|
|
40167
|
+
if (isTwyne(lender)) return TWYNE_USER_ABI;
|
|
39670
40168
|
if (isInit(lender)) return InitLensAbi;
|
|
39671
40169
|
if (isEulerType(lender)) return accountLensAbi;
|
|
39672
40170
|
if (isCompoundV2Type(lender))
|
|
@@ -46803,6 +47301,192 @@ var NATIVE_WNLP_ENTRIES = Object.fromEntries(
|
|
|
46803
47301
|
)
|
|
46804
47302
|
])
|
|
46805
47303
|
);
|
|
47304
|
+
var REWARD_RATE_ABI = [
|
|
47305
|
+
{
|
|
47306
|
+
name: "getCurrentRewardRate",
|
|
47307
|
+
type: "function",
|
|
47308
|
+
stateMutability: "view",
|
|
47309
|
+
inputs: [{ type: "address", name: "token" }],
|
|
47310
|
+
outputs: [{ type: "uint256" }]
|
|
47311
|
+
}
|
|
47312
|
+
];
|
|
47313
|
+
var BITWAY_LEGS = [
|
|
47314
|
+
// Absolute Return 0x5C4a6903…
|
|
47315
|
+
{
|
|
47316
|
+
share: "0xccafb706225331aedfec75b5347d462b98ed2fd2",
|
|
47317
|
+
// bwUSDT
|
|
47318
|
+
vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47319
|
+
token: "0x55d398326f99059ff775485246999027b3197955"
|
|
47320
|
+
// USDT
|
|
47321
|
+
},
|
|
47322
|
+
{
|
|
47323
|
+
share: "0xaa3d2534b4b87a2859e28c223f18265244ffffb7",
|
|
47324
|
+
// bwU
|
|
47325
|
+
vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47326
|
+
token: "0xce24439f2d9c6a2289f741120fe202248b666666"
|
|
47327
|
+
// U
|
|
47328
|
+
},
|
|
47329
|
+
{
|
|
47330
|
+
share: "0x82356c921422a2202e0f96dfccc352598ca8ef71",
|
|
47331
|
+
// bwBTW
|
|
47332
|
+
vault: "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47333
|
+
token: "0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa"
|
|
47334
|
+
// BTW
|
|
47335
|
+
},
|
|
47336
|
+
// Core Alpha 0xb82E3206…
|
|
47337
|
+
{
|
|
47338
|
+
share: "0x73af543d809c8d3414e5b92b3aa2c25b182ba3a1",
|
|
47339
|
+
// BTWUSDT
|
|
47340
|
+
vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47341
|
+
token: "0x55d398326f99059ff775485246999027b3197955"
|
|
47342
|
+
// USDT
|
|
47343
|
+
},
|
|
47344
|
+
{
|
|
47345
|
+
share: "0xb5c3617d4f077851cc6c7fae558d32e9782307f9",
|
|
47346
|
+
// BTWUSD1
|
|
47347
|
+
vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47348
|
+
token: "0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d"
|
|
47349
|
+
// USD1
|
|
47350
|
+
},
|
|
47351
|
+
{
|
|
47352
|
+
share: "0x4effb6bce5cad64d7162c7f7f15f557221b106d5",
|
|
47353
|
+
// BTWU
|
|
47354
|
+
vault: "0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47355
|
+
token: "0xce24439f2d9c6a2289f741120fe202248b666666"
|
|
47356
|
+
// U
|
|
47357
|
+
}
|
|
47358
|
+
];
|
|
47359
|
+
var bitwayYieldKey = (share) => `bitway::${Chain.BNB_SMART_CHAIN_MAINNET}::${share.toLowerCase()}`;
|
|
47360
|
+
var bitwayFetcher = {
|
|
47361
|
+
label: "BITWAY_EARN",
|
|
47362
|
+
fetch: async () => {
|
|
47363
|
+
const rates = await multicallRetryUniversal({
|
|
47364
|
+
chain: Chain.BNB_SMART_CHAIN_MAINNET,
|
|
47365
|
+
abi: REWARD_RATE_ABI,
|
|
47366
|
+
calls: BITWAY_LEGS.map(({ vault, token }) => ({
|
|
47367
|
+
address: vault,
|
|
47368
|
+
name: "getCurrentRewardRate",
|
|
47369
|
+
params: [token]
|
|
47370
|
+
})),
|
|
47371
|
+
allowFailure: true
|
|
47372
|
+
});
|
|
47373
|
+
const out = {};
|
|
47374
|
+
BITWAY_LEGS.forEach(({ share }, i) => {
|
|
47375
|
+
const raw = rates[i];
|
|
47376
|
+
if (typeof raw !== "bigint") return;
|
|
47377
|
+
const apr = Number(raw) / 100;
|
|
47378
|
+
if (Number.isFinite(apr) && apr >= 0 && apr <= 1e3) {
|
|
47379
|
+
out[bitwayYieldKey(share)] = apr;
|
|
47380
|
+
}
|
|
47381
|
+
});
|
|
47382
|
+
if (Object.keys(out).length === 0) {
|
|
47383
|
+
throw new Error("Bitway: no leg returned a readable reward rate");
|
|
47384
|
+
}
|
|
47385
|
+
return out;
|
|
47386
|
+
}
|
|
47387
|
+
};
|
|
47388
|
+
|
|
47389
|
+
// src/vaults/savings/registryBitway.ts
|
|
47390
|
+
var BITWAY_LEGS2 = [
|
|
47391
|
+
[
|
|
47392
|
+
"bwUSDT",
|
|
47393
|
+
"Absolute Return USDT",
|
|
47394
|
+
"0xccafb706225331aedfec75b5347d462b98ed2fd2",
|
|
47395
|
+
"0x55d398326f99059ff775485246999027b3197955",
|
|
47396
|
+
"USDT",
|
|
47397
|
+
"0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47398
|
+
"0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
|
|
47399
|
+
"the Absolute Return strategy (0.5% instant-exit fee)"
|
|
47400
|
+
],
|
|
47401
|
+
[
|
|
47402
|
+
"bwU",
|
|
47403
|
+
"Absolute Return U",
|
|
47404
|
+
"0xaa3d2534b4b87a2859e28c223f18265244ffffb7",
|
|
47405
|
+
"0xce24439f2d9c6a2289f741120fe202248b666666",
|
|
47406
|
+
"U",
|
|
47407
|
+
"0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47408
|
+
"0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
|
|
47409
|
+
"the Absolute Return strategy (0.5% instant-exit fee)"
|
|
47410
|
+
],
|
|
47411
|
+
[
|
|
47412
|
+
"bwBTW",
|
|
47413
|
+
"Absolute Return BTW",
|
|
47414
|
+
"0x82356c921422a2202e0f96dfccc352598ca8ef71",
|
|
47415
|
+
"0x444045b0ee1ee319a660a5e3d604ca0ffa35acaa",
|
|
47416
|
+
"BTW",
|
|
47417
|
+
"0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
|
|
47418
|
+
"0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
|
|
47419
|
+
"the Absolute Return strategy (0.5% instant-exit fee). The rate is denominated in BTW, Bitway's own volatile token \u2014 not in dollars"
|
|
47420
|
+
],
|
|
47421
|
+
[
|
|
47422
|
+
"BTWUSDT",
|
|
47423
|
+
"Core Alpha USDT",
|
|
47424
|
+
"0x73af543d809c8d3414e5b92b3aa2c25b182ba3a1",
|
|
47425
|
+
"0x55d398326f99059ff775485246999027b3197955",
|
|
47426
|
+
"USDT",
|
|
47427
|
+
"0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47428
|
+
"0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
|
|
47429
|
+
"the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
|
|
47430
|
+
],
|
|
47431
|
+
[
|
|
47432
|
+
"BTWUSD1",
|
|
47433
|
+
"Core Alpha USD1",
|
|
47434
|
+
"0xb5c3617d4f077851cc6c7fae558d32e9782307f9",
|
|
47435
|
+
"0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d",
|
|
47436
|
+
"USD1",
|
|
47437
|
+
"0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47438
|
+
"0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
|
|
47439
|
+
"the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
|
|
47440
|
+
],
|
|
47441
|
+
[
|
|
47442
|
+
"BTWU",
|
|
47443
|
+
"Core Alpha U",
|
|
47444
|
+
"0x4effb6bce5cad64d7162c7f7f15f557221b106d5",
|
|
47445
|
+
"0xce24439f2d9c6a2289f741120fe202248b666666",
|
|
47446
|
+
"U",
|
|
47447
|
+
"0xb82e32062c773c7748776c06fdb11b92edae3b63",
|
|
47448
|
+
"0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
|
|
47449
|
+
"the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
|
|
47450
|
+
]
|
|
47451
|
+
];
|
|
47452
|
+
var BITWAY_ENTRIES = {
|
|
47453
|
+
[Chain.BNB_SMART_CHAIN_MAINNET]: BITWAY_LEGS2.map(
|
|
47454
|
+
([
|
|
47455
|
+
symbol,
|
|
47456
|
+
label,
|
|
47457
|
+
address,
|
|
47458
|
+
underlying,
|
|
47459
|
+
underlyingSymbol,
|
|
47460
|
+
stakingVault,
|
|
47461
|
+
withdrawVault,
|
|
47462
|
+
strategyNote
|
|
47463
|
+
]) => ({
|
|
47464
|
+
reader: "bitway-vault",
|
|
47465
|
+
address,
|
|
47466
|
+
underlying,
|
|
47467
|
+
symbol,
|
|
47468
|
+
label,
|
|
47469
|
+
brand: "Bitway",
|
|
47470
|
+
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.`,
|
|
47471
|
+
decimals: 18,
|
|
47472
|
+
underlyingDecimals: 18,
|
|
47473
|
+
isRebasing: false,
|
|
47474
|
+
isMintable: true,
|
|
47475
|
+
mintContract: stakingVault,
|
|
47476
|
+
accrual: "linear",
|
|
47477
|
+
withdrawalMode: "fee-or-queued",
|
|
47478
|
+
withdrawalCooldownSeconds: 604800,
|
|
47479
|
+
withdrawQueue: withdrawVault,
|
|
47480
|
+
// The instant leg pays from the staking vault's own token balance;
|
|
47481
|
+
// the reader treats `priceOracle` as "where the rate lives" (the
|
|
47482
|
+
// two-arg convertToAssets) — both are the parent vault.
|
|
47483
|
+
inventoryContract: stakingVault,
|
|
47484
|
+
priceOracle: stakingVault,
|
|
47485
|
+
yieldFetcher: bitwayFetcher,
|
|
47486
|
+
yieldKey: bitwayYieldKey(address)
|
|
47487
|
+
})
|
|
47488
|
+
)
|
|
47489
|
+
};
|
|
46806
47490
|
|
|
46807
47491
|
// src/vaults/savings/registry.ts
|
|
46808
47492
|
var stUsdGroup = {
|
|
@@ -46951,19 +47635,29 @@ var reUsdGroup = {
|
|
|
46951
47635
|
symbol: "reUSD",
|
|
46952
47636
|
solvency: "tranched-senior",
|
|
46953
47637
|
brand: "Re Protocol",
|
|
46954
|
-
description: "Senior tranche of Re's reinsurance capital stack: deposits back insurance-linked programs and earn underwriting premium (the junior reUSDe absorbs losses first).
|
|
47638
|
+
description: "Senior tranche of Re's reinsurance capital stack: deposits back insurance-linked programs and earn underwriting premium (the junior reUSDe absorbs losses first). A bare ERC-20 priced by a daily NAV oracle. Minting and redeeming at NAV need Re's KYC approval; without it the position is entered and exited by TRADING reUSD (deepest venue: Curve reUSD/USDC on Ethereum), at whatever discount or premium to NAV the market pays. For KYC'd holders redemption is instant (small fee) while the buffer holds, otherwise it queues \u2014 quarterly in the worst case.",
|
|
46955
47639
|
decimals: 18,
|
|
46956
47640
|
underlyingDecimals: 6,
|
|
46957
47641
|
isRebasing: false,
|
|
46958
47642
|
isMintable: false,
|
|
47643
|
+
secondaryMarketOnly: true,
|
|
46959
47644
|
withdrawalMode: "request-based",
|
|
46960
47645
|
// Quarterly queue — the documented worst case, and the live case
|
|
46961
|
-
// wherever the buffer sits under 1 % of supply.
|
|
47646
|
+
// wherever the buffer sits under 1 % of supply. It describes the KYC
|
|
47647
|
+
// holder's exit; ours is the sale (`secondaryMarketOnly`).
|
|
46962
47648
|
withdrawalCooldownSeconds: 90 * 86400,
|
|
46963
47649
|
yieldFetcher: reProtocolFetcher,
|
|
46964
47650
|
yieldKey: REUSD_KEY
|
|
46965
47651
|
},
|
|
46966
47652
|
chains: {
|
|
47653
|
+
// TRAP, per chain: the ICL is a DIFFERENT contract from the token, and
|
|
47654
|
+
// the address that looks like a queue is not one. Re's address book
|
|
47655
|
+
// labels `0x5c454f55…` and its siblings "Daily Instant Redemption Vault
|
|
47656
|
+
// — payout token custody", which is `inventoryContract`'s definition,
|
|
47657
|
+
// not `withdrawQueue`'s. Only Ethereum publishes an actual delayed-
|
|
47658
|
+
// redemption module (`WindowRedemption`, the quarterly window); the
|
|
47659
|
+
// other three name none, so they carry none rather than a plausible
|
|
47660
|
+
// address a caller might try to request against.
|
|
46967
47661
|
"1": {
|
|
46968
47662
|
address: "0x5086bf358635b81d8c47c66d1c8b9e567db70c72",
|
|
46969
47663
|
underlying: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
@@ -46971,29 +47665,34 @@ var reUsdGroup = {
|
|
|
46971
47665
|
priceOracle: "0x72b5760cfbe437dd01409f44055fdfb8f8121b46",
|
|
46972
47666
|
mintContract: "0x4691c475be804fa85f91c2d6d0adf03114de3093",
|
|
46973
47667
|
// ICL
|
|
46974
|
-
withdrawQueue: "
|
|
47668
|
+
withdrawQueue: "0xd2e077d945ec77b45fbe4622e01f4c79e4ba389a",
|
|
47669
|
+
// WindowRedemption
|
|
47670
|
+
inventoryContract: "0x5c454f5526e41fbe917b63475cd8ca7e4631b147"
|
|
46975
47671
|
},
|
|
46976
47672
|
"8453": {
|
|
46977
47673
|
address: "0x7d214438d0f27afccc23b3d1e1a53906ace5cfea",
|
|
46978
47674
|
underlying: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
46979
47675
|
priceOracle: "0x67a3226e69a1a8316ef1807a44f077af80071926",
|
|
46980
|
-
//
|
|
46981
|
-
|
|
46982
|
-
|
|
47676
|
+
// NOT the token — that was wrong. `0x7d214438…` is a plain
|
|
47677
|
+
// `ShareToken`: role-gated `mint(address,uint256)`, no `kycRegistry()`,
|
|
47678
|
+
// no `deposit` of any arity. Base's ICL is its own contract, and
|
|
47679
|
+
// answers `kycRegistry() = 0xd4326b16…` / `shareToken() = 0x7d214438…`.
|
|
47680
|
+
mintContract: "0xd75ea2fd3d00399df7b7241ab7a189085ab2ede9",
|
|
47681
|
+
inventoryContract: "0x9ab62aebabe738ab233c447eedce88d1d0a61fe3"
|
|
46983
47682
|
},
|
|
46984
47683
|
"42161": {
|
|
46985
47684
|
address: "0x76ce01f0ef25aa66cc5f1e546a005e4a63b25609",
|
|
46986
47685
|
underlying: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
46987
47686
|
priceOracle: "0x48abcc5a711ac23d3730bf627415dc898cbc5967",
|
|
46988
47687
|
mintContract: "0x802edbb1ec20548a4388abc337e4011718eb0291",
|
|
46989
|
-
|
|
47688
|
+
inventoryContract: "0xfd4016ea13ca8acc04a11a99702df076a4d3b852"
|
|
46990
47689
|
},
|
|
46991
47690
|
"43114": {
|
|
46992
47691
|
address: "0x180af87b47bf272b2df59dccf2d76a6eafa625bf",
|
|
46993
47692
|
underlying: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
46994
47693
|
priceOracle: "0x4c558694f16484e5c7a4a52bd210d471860ce7bc",
|
|
46995
47694
|
mintContract: "0xb22a8533e6cd81598f82514a42f0b3161745fbe1",
|
|
46996
|
-
|
|
47695
|
+
inventoryContract: "0xe13292f97e38da0c64398de5e0bfc95180de9d23"
|
|
46997
47696
|
}
|
|
46998
47697
|
// NB: our token list also carries reUSD on BNB (0xba9425ec…) and Ink
|
|
46999
47698
|
// (0x5bcf6b00…), but Re publishes no NAV oracle for either, so there
|
|
@@ -47878,7 +48577,15 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
47878
48577
|
underlying: "0x09d4214c03d01f49544c0448dbe3a27f768f2b34",
|
|
47879
48578
|
symbol: "wsrUSD",
|
|
47880
48579
|
brand: "Reservoir",
|
|
47881
|
-
|
|
48580
|
+
// NB: NOT a wrapper of srUSD despite the name — verified on-chain
|
|
48581
|
+
// 2026-08-19 (see RESERVOIR.md): a second-generation Savingcoin
|
|
48582
|
+
// directly over rUSD with its own governance-set accumulator.
|
|
48583
|
+
// Deposits burn rUSD and exits mint it, so the vault custodies
|
|
48584
|
+
// nothing and there is no on-chain solvency invariant (the
|
|
48585
|
+
// CreditEnforcer's covenant minimums are zeroed and its adapters
|
|
48586
|
+
// removed). Exit to rUSD is instant/unlimited; par exit to USDC is
|
|
48587
|
+
// bounded by live USDC-PSM inventory (~0.1% of the book).
|
|
48588
|
+
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.",
|
|
47882
48589
|
decimals: 18,
|
|
47883
48590
|
isRebasing: false,
|
|
47884
48591
|
isMintable: true,
|
|
@@ -48101,7 +48808,8 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48101
48808
|
{
|
|
48102
48809
|
// Re Protocol reUSDe — the JUNIOR tranche of the same reinsurance
|
|
48103
48810
|
// capital stack as reUSD (see `reUsdGroup` for the model, the
|
|
48104
|
-
// liquidity caveat
|
|
48811
|
+
// liquidity caveat, why `isMintable` is false and why the row is
|
|
48812
|
+
// therefore `secondaryMarketOnly`). Ethereum only,
|
|
48105
48813
|
// ~$18.8M, and it earns roughly double reUSD's rate precisely
|
|
48106
48814
|
// because it absorbs losses first. Underlying is USDe, so unlike
|
|
48107
48815
|
// reUSD the share and underlying decimals align at 18.
|
|
@@ -48115,11 +48823,15 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48115
48823
|
symbol: "reUSDe",
|
|
48116
48824
|
solvency: "tranched-junior",
|
|
48117
48825
|
brand: "Re Protocol",
|
|
48118
|
-
description: "Junior tranche of Re's reinsurance capital stack, denominated in USDe: it pays roughly double the senior reUSD rate because it absorbs underwriting losses first. Bare ERC-20 priced by a daily NAV oracle; exits are request-based, with a quarterly queue in the worst case.",
|
|
48826
|
+
description: "Junior tranche of Re's reinsurance capital stack, denominated in USDe: it pays roughly double the senior reUSD rate because it absorbs underwriting losses first. Bare ERC-20 priced by a daily NAV oracle. Minting and redeeming at NAV require Re's KYC/AML approval; without it the only way in and out is trading reUSDe on the secondary market (Curve reUSDe/sUSDe, thinner than the reUSD book). For KYC'd holders exits are request-based, with a quarterly queue in the worst case.",
|
|
48119
48827
|
decimals: 18,
|
|
48120
48828
|
underlyingDecimals: 18,
|
|
48121
48829
|
isRebasing: false,
|
|
48122
48830
|
isMintable: false,
|
|
48831
|
+
// Its Curve venue (reUSDe/sUSDe) is materially thinner than reUSD's:
|
|
48832
|
+
// quoted -0.64 % at $14k and -2.17 % at $140k. Still the only route
|
|
48833
|
+
// without KYC, and the reason the leg refuses to build unbounded.
|
|
48834
|
+
secondaryMarketOnly: true,
|
|
48123
48835
|
withdrawalMode: "request-based",
|
|
48124
48836
|
withdrawalCooldownSeconds: 90 * 86400,
|
|
48125
48837
|
yieldFetcher: reProtocolFetcher,
|
|
@@ -48263,12 +48975,15 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48263
48975
|
// - The Midas periphery the DOCS still list is RETIRED: both its
|
|
48264
48976
|
// instant paths revert `Pausable: paused` and its NAV aggregators
|
|
48265
48977
|
// last updated 2025-12-22. Never build against the docs' addresses.
|
|
48266
|
-
// - Exit is two-legged (`fee-or-queued`)
|
|
48267
|
-
// queue's `instantWithdrawalFee` (30 bps
|
|
48268
|
-
// the retired stack),
|
|
48269
|
-
// (
|
|
48270
|
-
//
|
|
48271
|
-
//
|
|
48978
|
+
// - Exit is two-legged (`fee-or-queued`), FORK-PROVEN 2026-08-18:
|
|
48979
|
+
// `instantWithdraw` at the queue's `instantWithdrawalFee` (30 bps
|
|
48980
|
+
// live — the docs' 0.5% is the retired stack), paid from the vault's
|
|
48981
|
+
// depositReceiver wallet (`inventoryContract` below — NOT the queue,
|
|
48982
|
+
// whose balance can read 0 while the instant leg still pays); or a
|
|
48983
|
+
// free `createWithdrawalRequest` processed by ops and PAID OUT
|
|
48984
|
+
// AUTOMATICALLY — no claim step. Cancel exists but only fires AFTER
|
|
48985
|
+
// the request's deadline (`WithdrawalRequestDeadlineNotMet` before
|
|
48986
|
+
// it): it is the reclaim path for an expired request, not an abort.
|
|
48272
48987
|
// - Deposits are permissionless and uncapped (`isPaused` false,
|
|
48273
48988
|
// `depositCap` 0 = uncapped, no fee), via the Depositor
|
|
48274
48989
|
// (`mintContract`) — NOT the share token.
|
|
@@ -48298,7 +49013,7 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48298
49013
|
withdrawalMode: "fee-or-queued",
|
|
48299
49014
|
withdrawalCooldownSeconds: 86400,
|
|
48300
49015
|
withdrawQueue: "0x240e0b2cb615ded2fe90fde265b15988dc45b1c6",
|
|
48301
|
-
inventoryContract: "
|
|
49016
|
+
inventoryContract: "0xfd1fd829e4e89cae8190596698e84754c3fec16c",
|
|
48302
49017
|
priceOracle: "0x3636a26ec1d512c5ecff42f7adaa5ce7964c6579",
|
|
48303
49018
|
yieldFetcher: hyperbeatVaultsFetcher,
|
|
48304
49019
|
yieldKey: "Hyperbeat USDT::hbUSDT"
|
|
@@ -48319,7 +49034,7 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48319
49034
|
withdrawalMode: "fee-or-queued",
|
|
48320
49035
|
withdrawalCooldownSeconds: 86400,
|
|
48321
49036
|
withdrawQueue: "0x10024239474120ce410dd7ce203793c81d438be3",
|
|
48322
|
-
inventoryContract: "
|
|
49037
|
+
inventoryContract: "0x7abf6da6c2c131b58c1f4cb3947b0cfe2edc1c2a",
|
|
48323
49038
|
priceOracle: "0xe0995a641d454c149e6c808baa37cb2b38763316",
|
|
48324
49039
|
yieldFetcher: hyperbeatVaultsFetcher,
|
|
48325
49040
|
yieldKey: "Hyperbeat USDC::hbUSDC"
|
|
@@ -48339,7 +49054,7 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48339
49054
|
withdrawalMode: "fee-or-queued",
|
|
48340
49055
|
withdrawalCooldownSeconds: 259200,
|
|
48341
49056
|
withdrawQueue: "0x8b04cd6561abf2de78112da30ccb919fe8d09d98",
|
|
48342
|
-
inventoryContract: "
|
|
49057
|
+
inventoryContract: "0xa980d98de0fff436e1a3e7d9a06999b03c8aa59e",
|
|
48343
49058
|
priceOracle: "0x5ed0ec0b0643dab621dc814c8d058e161b9b884b",
|
|
48344
49059
|
yieldFetcher: hyperbeatVaultsFetcher,
|
|
48345
49060
|
yieldKey: "Hyperbeat LST Vault::lstHYPE"
|
|
@@ -48362,7 +49077,7 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
48362
49077
|
withdrawalMode: "fee-or-queued",
|
|
48363
49078
|
withdrawalCooldownSeconds: 259200,
|
|
48364
49079
|
withdrawQueue: "0xa03e0e3b7e6204c9a8d237c4fbd30793555a84fe",
|
|
48365
|
-
inventoryContract: "
|
|
49080
|
+
inventoryContract: "0xb3f15e41fc1536e47ee7de20c7b44fb1eec70aec",
|
|
48366
49081
|
priceOracle: "0x90a0a650f0c403a92ae22f162b3e61818d6f8f11",
|
|
48367
49082
|
yieldFetcher: hyperbeatVaultsFetcher,
|
|
48368
49083
|
yieldKey: "Liquid HYPE Yield::liquidHYPE"
|
|
@@ -48439,12 +49154,25 @@ var SAVINGS_REGISTRY = (() => {
|
|
|
48439
49154
|
if (!out[chainId]) out[chainId] = [];
|
|
48440
49155
|
out[chainId].push(...entries);
|
|
48441
49156
|
}
|
|
49157
|
+
for (const [chainId, entries] of Object.entries(BITWAY_ENTRIES)) {
|
|
49158
|
+
if (!out[chainId]) out[chainId] = [];
|
|
49159
|
+
out[chainId].push(...entries);
|
|
49160
|
+
}
|
|
48442
49161
|
return out;
|
|
48443
49162
|
})();
|
|
48444
49163
|
var savingsBalanceKind = (chainId, address) => {
|
|
48445
49164
|
const lc = address.toLowerCase();
|
|
48446
49165
|
return (SAVINGS_REGISTRY[chainId] ?? []).find((e) => e.address === lc)?.balanceKind;
|
|
48447
49166
|
};
|
|
49167
|
+
var isSecondaryMarketOnly = (chainId, address) => (SAVINGS_REGISTRY[chainId] ?? []).some(
|
|
49168
|
+
(e) => e.address === address.toLowerCase() && e.secondaryMarketOnly === true
|
|
49169
|
+
);
|
|
49170
|
+
var secondaryMarketVault = (chainId, address) => {
|
|
49171
|
+
const e = (SAVINGS_REGISTRY[chainId] ?? []).find(
|
|
49172
|
+
(x) => x.address === address.toLowerCase() && x.secondaryMarketOnly === true
|
|
49173
|
+
);
|
|
49174
|
+
return e ? { underlying: e.underlying, symbol: e.symbol } : void 0;
|
|
49175
|
+
};
|
|
48448
49176
|
var savingsAddresses = (chainId) => (SAVINGS_REGISTRY[chainId] ?? []).map((e) => e.address);
|
|
48449
49177
|
var getSavingsRegistry = (chainId) => SAVINGS_REGISTRY[chainId] ?? [];
|
|
48450
49178
|
|
|
@@ -49959,7 +50687,7 @@ var dtrinityRebateRewardFetcher = {
|
|
|
49959
50687
|
}
|
|
49960
50688
|
};
|
|
49961
50689
|
var SECONDS_PER_YEAR14 = 31536e3;
|
|
49962
|
-
var
|
|
50690
|
+
var WAD16 = 10n ** 18n;
|
|
49963
50691
|
var ZERO2 = "0x0000000000000000000000000000000000000000";
|
|
49964
50692
|
var UNBOOSTED_FACTOR = 0.4;
|
|
49965
50693
|
var MAX_BOOST = 2.5;
|
|
@@ -50177,7 +50905,7 @@ async function fetchForChain(chainId, nowSeconds) {
|
|
|
50177
50905
|
{ address: m.gauge, name: "totalSupply", params: [] },
|
|
50178
50906
|
{ address: m.gauge, name: "is_killed", params: [] },
|
|
50179
50907
|
{ address: m.gauge, name: "reward_count", params: [] },
|
|
50180
|
-
{ address: m.vault, name: "convertToAssets", params: [
|
|
50908
|
+
{ address: m.vault, name: "convertToAssets", params: [WAD16] },
|
|
50181
50909
|
isL1 ? {
|
|
50182
50910
|
address: GAUGE_CONTROLLER,
|
|
50183
50911
|
name: "gauge_relative_weight",
|
|
@@ -50193,7 +50921,7 @@ async function fetchForChain(chainId, nowSeconds) {
|
|
|
50193
50921
|
abi: GAUGE_ABI,
|
|
50194
50922
|
allowFailure: true
|
|
50195
50923
|
});
|
|
50196
|
-
const
|
|
50924
|
+
const big22 = (v) => {
|
|
50197
50925
|
try {
|
|
50198
50926
|
if (typeof v === "bigint") return v;
|
|
50199
50927
|
if (typeof v === "string" && v !== "0x") return BigInt(v);
|
|
@@ -50207,15 +50935,15 @@ async function fetchForChain(chainId, nowSeconds) {
|
|
|
50207
50935
|
const b = i * STRIDE;
|
|
50208
50936
|
return {
|
|
50209
50937
|
market: m,
|
|
50210
|
-
inflationRate:
|
|
50211
|
-
workingSupply:
|
|
50212
|
-
totalSupply:
|
|
50938
|
+
inflationRate: big22(r1[b]),
|
|
50939
|
+
workingSupply: big22(r1[b + 1]),
|
|
50940
|
+
totalSupply: big22(r1[b + 2]),
|
|
50213
50941
|
isKilled: r1[b + 3] === true,
|
|
50214
|
-
rewardCount: Number(
|
|
50215
|
-
pricePerShare:
|
|
50942
|
+
rewardCount: Number(big22(r1[b + 4])),
|
|
50943
|
+
pricePerShare: big22(r1[b + 5]),
|
|
50216
50944
|
// Off L1 the child gauge's own rate is already market-scoped, so the
|
|
50217
50945
|
// weight is the identity.
|
|
50218
|
-
relativeWeight: isL1 ?
|
|
50946
|
+
relativeWeight: isL1 ? big22(r1[b + 6]) : WAD16
|
|
50219
50947
|
};
|
|
50220
50948
|
});
|
|
50221
50949
|
const tokenCalls = state.flatMap(
|
|
@@ -50308,7 +51036,7 @@ async function fetchForChain(chainId, nowSeconds) {
|
|
|
50308
51036
|
const decoded = decodeRewardData(data);
|
|
50309
51037
|
if (!decoded) continue;
|
|
50310
51038
|
const { periodFinish, rate } = decoded;
|
|
50311
|
-
const decimals = typeof decRaw === "number" ? decRaw : Number(
|
|
51039
|
+
const decimals = typeof decRaw === "number" ? decRaw : Number(big22(decRaw) || 18n);
|
|
50312
51040
|
const rewardPrice = priceOf(prices, chainId, token);
|
|
50313
51041
|
const apr = extraRewardApr({
|
|
50314
51042
|
rate,
|
|
@@ -51323,7 +52051,7 @@ function getDssCalls(chainId) {
|
|
|
51323
52051
|
return results;
|
|
51324
52052
|
}
|
|
51325
52053
|
var RAY10 = 1e27;
|
|
51326
|
-
var
|
|
52054
|
+
var big19 = (v) => {
|
|
51327
52055
|
try {
|
|
51328
52056
|
if (typeof v === "bigint") return v;
|
|
51329
52057
|
if (v == null || v === "0x") return 0n;
|
|
@@ -51335,16 +52063,16 @@ var big17 = (v) => {
|
|
|
51335
52063
|
var field12 = (res, name, idx) => {
|
|
51336
52064
|
const v = res?.[name];
|
|
51337
52065
|
if (typeof v === "bigint" || typeof v === "number" || typeof v === "string") {
|
|
51338
|
-
return
|
|
52066
|
+
return big19(v);
|
|
51339
52067
|
}
|
|
51340
|
-
return
|
|
52068
|
+
return big19(res?.[idx]);
|
|
51341
52069
|
};
|
|
51342
52070
|
function parseDssResults(data, meta, context) {
|
|
51343
52071
|
const { chainId } = context;
|
|
51344
52072
|
const key3 = dssLenderKey(meta.lender, chainId, meta.ilk);
|
|
51345
52073
|
const entries = [];
|
|
51346
52074
|
const spot = field12(data?.[0], "spot", 2);
|
|
51347
|
-
const mat =
|
|
52075
|
+
const mat = big19(meta.mat);
|
|
51348
52076
|
if (spot > 0n && mat > 0n) {
|
|
51349
52077
|
const collUSD = Number(spot) / RAY10 * (Number(mat) / RAY10);
|
|
51350
52078
|
if (collUSD > 0 && collUSD < 1e9) {
|
|
@@ -57616,7 +58344,7 @@ var num4 = (v) => {
|
|
|
57616
58344
|
const n = Number(v);
|
|
57617
58345
|
return Number.isFinite(n) ? n : 0;
|
|
57618
58346
|
};
|
|
57619
|
-
var
|
|
58347
|
+
var big20 = (v) => {
|
|
57620
58348
|
try {
|
|
57621
58349
|
if (v === void 0 || v === null || v === "") return "0";
|
|
57622
58350
|
const s = String(v);
|
|
@@ -57652,12 +58380,12 @@ async function fetchTermMaxVaultsFromApi(chainId, prices = {}, tokenList = {}, f
|
|
|
57652
58380
|
const assetEntry = tokenList[underlying];
|
|
57653
58381
|
const priceKey = toOracleKey(assetEntry?.assetGroup) || toGenericPriceKey(underlying, chainId);
|
|
57654
58382
|
const priceUsd = prices[priceKey];
|
|
57655
|
-
const totalAssets =
|
|
57656
|
-
const totalSupply =
|
|
58383
|
+
const totalAssets = big20(r.totalAssets);
|
|
58384
|
+
const totalSupply = big20(r.totalSupplyAmt);
|
|
57657
58385
|
const totalAssetsFormatted = Number(totalAssets) / scale3;
|
|
57658
58386
|
const supplyRate = num4(r.apr) * 100;
|
|
57659
58387
|
const rewardsRate = num4(r?.incentiveData?.TMX_APR) * 100;
|
|
57660
|
-
const rawLiquidity = BigInt(
|
|
58388
|
+
const rawLiquidity = BigInt(big20(r.redeemableAmt ?? r.idleFunds ?? "0"));
|
|
57661
58389
|
const totalAssetsBig = BigInt(totalAssets);
|
|
57662
58390
|
const liquidity = (rawLiquidity > totalAssetsBig ? totalAssetsBig : rawLiquidity).toString();
|
|
57663
58391
|
const liquidityFormatted = Number(liquidity) / scale3;
|
|
@@ -57693,7 +58421,7 @@ async function fetchTermMaxVaultsFromApi(chainId, prices = {}, tokenList = {}, f
|
|
|
57693
58421
|
liquidityUsd: priceUsd ? liquidityFormatted * priceUsd : 0,
|
|
57694
58422
|
version: r.version,
|
|
57695
58423
|
isPaused: r.isPaused === true || void 0,
|
|
57696
|
-
supplyCap: r.capacity ?
|
|
58424
|
+
supplyCap: r.capacity ? big20(r.capacity) : void 0,
|
|
57697
58425
|
basePool: r.poolAddress ? lower3(r.poolAddress) : void 0
|
|
57698
58426
|
};
|
|
57699
58427
|
}
|
|
@@ -57749,7 +58477,7 @@ var Erc20DecimalsBalanceAbi = [
|
|
|
57749
58477
|
|
|
57750
58478
|
// src/vaults/termmax/fetchFromChain.ts
|
|
57751
58479
|
var DECIMAL_BASE2 = 100000000n;
|
|
57752
|
-
var
|
|
58480
|
+
var big21 = (v) => {
|
|
57753
58481
|
if (v === void 0 || v === null || v === "0x") return 0n;
|
|
57754
58482
|
try {
|
|
57755
58483
|
return typeof v === "bigint" ? v : BigInt(v);
|
|
@@ -57813,7 +58541,7 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
|
|
|
57813
58541
|
vaults.forEach((address, i) => {
|
|
57814
58542
|
const at = (k) => res[i * READS_PER_VAULT + VAULT_READS.indexOf(k)];
|
|
57815
58543
|
const asset = addr(at("asset"));
|
|
57816
|
-
const totalAssets =
|
|
58544
|
+
const totalAssets = big21(at("totalAssets"));
|
|
57817
58545
|
if (!asset || totalAssets === 0n) return;
|
|
57818
58546
|
rows.push({
|
|
57819
58547
|
address,
|
|
@@ -57822,11 +58550,11 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
|
|
|
57822
58550
|
decimals: num5(at("decimals")) ?? 18,
|
|
57823
58551
|
asset,
|
|
57824
58552
|
totalAssets,
|
|
57825
|
-
totalSupply:
|
|
57826
|
-
annualizedInterest:
|
|
57827
|
-
accretingPrincipal:
|
|
57828
|
-
performanceFeeRate:
|
|
57829
|
-
aprRaw: at("apr") != null ?
|
|
58553
|
+
totalSupply: big21(at("totalSupply")),
|
|
58554
|
+
annualizedInterest: big21(at("annualizedInterest")),
|
|
58555
|
+
accretingPrincipal: big21(at("accretingPrincipal")),
|
|
58556
|
+
performanceFeeRate: big21(at("performanceFeeRate")),
|
|
58557
|
+
aprRaw: at("apr") != null ? big21(at("apr")) : void 0,
|
|
57830
58558
|
curator: addr(at("curator")),
|
|
57831
58559
|
guardian: addr(at("guardian")),
|
|
57832
58560
|
timelock: num5(at("timelock")),
|
|
@@ -57847,7 +58575,7 @@ var fetchTermMaxVaultsFromChain = async (chainId, multicallRetry, prices = {}, t
|
|
|
57847
58575
|
const out = {};
|
|
57848
58576
|
rows.forEach((r, i) => {
|
|
57849
58577
|
const assetDecimals = num5(res2[i * 2]) ?? r.decimals;
|
|
57850
|
-
const idle =
|
|
58578
|
+
const idle = big21(res2[i * 2 + 1]);
|
|
57851
58579
|
const assetEntry = tokenList[r.asset];
|
|
57852
58580
|
const priceKey = toOracleKey(assetEntry?.assetGroup) || toGenericPriceKey(r.asset, chainId);
|
|
57853
58581
|
const priceUsd = prices[priceKey];
|
|
@@ -63354,6 +64082,45 @@ var NativeWithdrawQueueReadAbi = [
|
|
|
63354
64082
|
}
|
|
63355
64083
|
];
|
|
63356
64084
|
|
|
64085
|
+
// src/vaults/savings/abis/bitway.ts
|
|
64086
|
+
var BitwayVaultReadAbi = [
|
|
64087
|
+
{
|
|
64088
|
+
name: "convertToAssets",
|
|
64089
|
+
type: "function",
|
|
64090
|
+
stateMutability: "view",
|
|
64091
|
+
inputs: [{ type: "uint256" }, { type: "address", name: "token" }],
|
|
64092
|
+
outputs: [{ type: "uint256" }]
|
|
64093
|
+
},
|
|
64094
|
+
{
|
|
64095
|
+
name: "getTVL",
|
|
64096
|
+
type: "function",
|
|
64097
|
+
stateMutability: "view",
|
|
64098
|
+
inputs: [{ type: "address", name: "token" }],
|
|
64099
|
+
outputs: [{ type: "uint256" }]
|
|
64100
|
+
},
|
|
64101
|
+
{
|
|
64102
|
+
name: "getContractBalance",
|
|
64103
|
+
type: "function",
|
|
64104
|
+
stateMutability: "view",
|
|
64105
|
+
inputs: [{ type: "address", name: "token" }],
|
|
64106
|
+
outputs: [{ type: "uint256" }]
|
|
64107
|
+
},
|
|
64108
|
+
{
|
|
64109
|
+
name: "getCurrentRewardRate",
|
|
64110
|
+
type: "function",
|
|
64111
|
+
stateMutability: "view",
|
|
64112
|
+
inputs: [{ type: "address", name: "token" }],
|
|
64113
|
+
outputs: [{ type: "uint256" }]
|
|
64114
|
+
},
|
|
64115
|
+
{
|
|
64116
|
+
name: "WAITING_TIME",
|
|
64117
|
+
type: "function",
|
|
64118
|
+
stateMutability: "view",
|
|
64119
|
+
inputs: [],
|
|
64120
|
+
outputs: [{ type: "uint256" }]
|
|
64121
|
+
}
|
|
64122
|
+
];
|
|
64123
|
+
|
|
63357
64124
|
// src/vaults/savings/abis/frankencoin.ts
|
|
63358
64125
|
var FrankencoinSavingsReadAbi = [
|
|
63359
64126
|
{
|
|
@@ -63568,6 +64335,65 @@ var readerErc4626WithdrawLimit = (entry) => {
|
|
|
63568
64335
|
};
|
|
63569
64336
|
};
|
|
63570
64337
|
|
|
64338
|
+
// src/vaults/savings/readers/bitwayVault.ts
|
|
64339
|
+
var BITWAY_PENALTY_BPS = {
|
|
64340
|
+
// Absolute Return
|
|
64341
|
+
"0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1": 50,
|
|
64342
|
+
// Core Alpha
|
|
64343
|
+
"0xb82e32062c773c7748776c06fdb11b92edae3b63": 0
|
|
64344
|
+
};
|
|
64345
|
+
var readerBitwayVault = (entry) => {
|
|
64346
|
+
const { address, underlying, priceOracle } = entry;
|
|
64347
|
+
const vault = priceOracle ?? entry.mintContract ?? address;
|
|
64348
|
+
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
64349
|
+
const underlyingUnit = 10n ** BigInt(entry.underlyingDecimals ?? entry.decimals);
|
|
64350
|
+
const penaltyBps = BITWAY_PENALTY_BPS[vault.toLowerCase()];
|
|
64351
|
+
return {
|
|
64352
|
+
calls: [
|
|
64353
|
+
{ address, name: "totalSupply", params: [] },
|
|
64354
|
+
{
|
|
64355
|
+
address: vault,
|
|
64356
|
+
name: "convertToAssets",
|
|
64357
|
+
params: [ONE_E1813, underlying]
|
|
64358
|
+
},
|
|
64359
|
+
{ address: vault, name: "getContractBalance", params: [underlying] },
|
|
64360
|
+
{ address: vault, name: "WAITING_TIME", params: [] }
|
|
64361
|
+
],
|
|
64362
|
+
abis: [
|
|
64363
|
+
TotalSupplyAbi2,
|
|
64364
|
+
BitwayVaultReadAbi,
|
|
64365
|
+
BitwayVaultReadAbi,
|
|
64366
|
+
BitwayVaultReadAbi
|
|
64367
|
+
],
|
|
64368
|
+
parse: ([supply, rate, buffer, waitingTime]) => {
|
|
64369
|
+
const totalSupply = toBigInt16(supply);
|
|
64370
|
+
const exchangeRate = toBigInt16(rate);
|
|
64371
|
+
if (totalSupply === void 0 || exchangeRate === void 0 || exchangeRate === 0n) {
|
|
64372
|
+
return void 0;
|
|
64373
|
+
}
|
|
64374
|
+
const capacity = toBigInt16(buffer);
|
|
64375
|
+
const wait = toBigInt16(waitingTime);
|
|
64376
|
+
return {
|
|
64377
|
+
// totalSupply is in raw share units; convert to raw underlying.
|
|
64378
|
+
// (Every live leg is 18/18-dec — BSC stables are 18-dec — but the
|
|
64379
|
+
// rescale keeps a future 6-dec listing honest.)
|
|
64380
|
+
totalAssets: totalSupply * exchangeRate * underlyingUnit / (shareUnit * ONE_E1813),
|
|
64381
|
+
totalSupply,
|
|
64382
|
+
exchangeRate,
|
|
64383
|
+
withdrawFeeBps: penaltyBps,
|
|
64384
|
+
// The flash flag has no getter either (`flashNotEnable`, packed
|
|
64385
|
+
// storage — enabled on both vaults live). A drained buffer already
|
|
64386
|
+
// zeroes the instant leg's reported liquidity, which is the same
|
|
64387
|
+
// caller-visible outcome as a disabled flash path.
|
|
64388
|
+
instantRedeemEnabled: penaltyBps !== void 0 ? true : void 0,
|
|
64389
|
+
instantRedeemCapacity: capacity,
|
|
64390
|
+
withdrawalCooldownSeconds: wait !== void 0 && wait <= 366n * 86400n ? Number(wait) : void 0,
|
|
64391
|
+
withdrawQueue: entry.withdrawQueue
|
|
64392
|
+
};
|
|
64393
|
+
}
|
|
64394
|
+
};
|
|
64395
|
+
};
|
|
64396
|
+
|
|
63571
64397
|
// src/vaults/savings/readers/frankencoinSavings.ts
|
|
63572
64398
|
var readerFrankencoinSavings = (entry) => ({
|
|
63573
64399
|
calls: [
|
|
@@ -63593,7 +64419,7 @@ var readerFrankencoinSavings = (entry) => ({
|
|
|
63593
64419
|
|
|
63594
64420
|
// src/vaults/savings/readers/hyperbeatVault.ts
|
|
63595
64421
|
var readerHyperbeatVault = (entry) => {
|
|
63596
|
-
const { address, underlying, priceOracle, withdrawQueue } = entry;
|
|
64422
|
+
const { address, underlying, priceOracle, withdrawQueue, inventoryContract } = entry;
|
|
63597
64423
|
const pricer = priceOracle ?? address;
|
|
63598
64424
|
const queue = withdrawQueue ?? address;
|
|
63599
64425
|
const shareUnit = 10n ** BigInt(entry.decimals);
|
|
@@ -63603,7 +64429,13 @@ var readerHyperbeatVault = (entry) => {
|
|
|
63603
64429
|
{ address, name: "totalSupply", params: [] },
|
|
63604
64430
|
{ address: pricer, name: "getRate", params: [] },
|
|
63605
64431
|
{ address: pricer, name: "decimals", params: [] },
|
|
63606
|
-
|
|
64432
|
+
// Falls back to the queue when no depositReceiver is pinned — yields
|
|
64433
|
+
// a 0 capacity rather than a malformed call.
|
|
64434
|
+
{
|
|
64435
|
+
address: underlying,
|
|
64436
|
+
name: "balanceOf",
|
|
64437
|
+
params: [inventoryContract ?? queue]
|
|
64438
|
+
},
|
|
63607
64439
|
{ address: queue, name: "instantWithdrawalFee", params: [] },
|
|
63608
64440
|
{ address: queue, name: "isInstantWithdrawalPaused", params: [] }
|
|
63609
64441
|
],
|
|
@@ -63821,6 +64653,8 @@ var buildReader2 = (entry) => {
|
|
|
63821
64653
|
return readerFrankencoinSavings(entry);
|
|
63822
64654
|
case "hyperbeat-vault":
|
|
63823
64655
|
return readerHyperbeatVault(entry);
|
|
64656
|
+
case "bitway-vault":
|
|
64657
|
+
return readerBitwayVault(entry);
|
|
63824
64658
|
case "yieldbasis-lt":
|
|
63825
64659
|
return readerYieldBasisLt(entry);
|
|
63826
64660
|
case "wren-nav":
|
|
@@ -63939,6 +64773,9 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
|
|
|
63939
64773
|
isRebasing: entry.isRebasing,
|
|
63940
64774
|
isMintable: entry.isMintable,
|
|
63941
64775
|
mintContract: entry.mintContract?.toLowerCase() ?? addressLc,
|
|
64776
|
+
// Only emitted when true — an absent field is the ordinary vault, and
|
|
64777
|
+
// `false` on 200 rows would read as a claim nobody made.
|
|
64778
|
+
...entry.secondaryMarketOnly ? { secondaryMarketOnly: true } : {},
|
|
63942
64779
|
withdrawalMode: entry.withdrawalMode,
|
|
63943
64780
|
// On-chain wins over the registry's pinned fallback — Native's
|
|
63944
64781
|
// queue window is per-asset and governance-mutable.
|
|
@@ -65675,23 +66512,23 @@ var priceGmMarkets = async (chainId, multicallRetry, markets, prices) => {
|
|
|
65675
66512
|
const indexMax = price(prices, m.indexToken)?.max;
|
|
65676
66513
|
if (Array.isArray(dsRes) && longMax != null && shortMax != null) {
|
|
65677
66514
|
const base = i * SLOTS;
|
|
65678
|
-
const
|
|
66515
|
+
const big22 = (j) => typeof dsRes[base + j] === "bigint" ? dsRes[base + j] : 0n;
|
|
65679
66516
|
const cap = computeDepositCapacityUsd(
|
|
65680
|
-
[info?.longTokenAmount, longMax,
|
|
65681
|
-
[info?.shortTokenAmount, shortMax,
|
|
66517
|
+
[info?.longTokenAmount, longMax, big22(0), big22(2)],
|
|
66518
|
+
[info?.shortTokenAmount, shortMax, big22(1), big22(3)]
|
|
65682
66519
|
);
|
|
65683
66520
|
if (cap != null) value.depositCapacityUsd = cap;
|
|
65684
66521
|
if (indexMax != null) {
|
|
65685
66522
|
const divisor = m.longToken.toLowerCase() === m.shortToken.toLowerCase() ? 2n : 1n;
|
|
65686
|
-
const reservedUsdLong = (
|
|
65687
|
-
const reservedUsdShort = (
|
|
66523
|
+
const reservedUsdLong = (big22(4) + big22(5)) / divisor * indexMax;
|
|
66524
|
+
const reservedUsdShort = (big22(6) + big22(7)) / divisor;
|
|
65688
66525
|
const liq = computeLiquidityUsd(
|
|
65689
66526
|
info?.longTokenUsd,
|
|
65690
66527
|
info?.shortTokenUsd,
|
|
65691
66528
|
reservedUsdLong,
|
|
65692
66529
|
reservedUsdShort,
|
|
65693
|
-
|
|
65694
|
-
|
|
66530
|
+
big22(8),
|
|
66531
|
+
big22(9)
|
|
65695
66532
|
);
|
|
65696
66533
|
if (liq != null)
|
|
65697
66534
|
value.liquidityUsd = Math.max(0, Math.min(liq, value.tvlUsd));
|
|
@@ -65890,21 +66727,21 @@ var fetchGmxExecutionFees = async (chainId, multicallRetry, gasPriceWei) => {
|
|
|
65890
66727
|
} catch {
|
|
65891
66728
|
return void 0;
|
|
65892
66729
|
}
|
|
65893
|
-
const
|
|
65894
|
-
const base =
|
|
65895
|
-
const mult =
|
|
66730
|
+
const big22 = (i) => typeof res[i] === "bigint" ? res[i] : 0n;
|
|
66731
|
+
const base = big22(0);
|
|
66732
|
+
const mult = big22(1);
|
|
65896
66733
|
if (base === 0n && mult === 0n) return void 0;
|
|
65897
66734
|
const PRECISION = 10n ** 30n;
|
|
65898
66735
|
const adjusted = (opGas) => base + opGas * mult / PRECISION;
|
|
65899
66736
|
const fee = (opGas) => (adjusted(opGas) * gasPriceWei).toString();
|
|
65900
|
-
const glvExtra =
|
|
66737
|
+
const glvExtra = big22(6) * GLV_NOMINAL_MARKET_COUNT;
|
|
65901
66738
|
return {
|
|
65902
66739
|
chainId,
|
|
65903
66740
|
gasPriceWei: gasPriceWei.toString(),
|
|
65904
|
-
deposit: fee(
|
|
65905
|
-
withdrawal: fee(
|
|
65906
|
-
glvDeposit: fee(
|
|
65907
|
-
glvWithdrawal: fee(
|
|
66741
|
+
deposit: fee(big22(2)),
|
|
66742
|
+
withdrawal: fee(big22(3)),
|
|
66743
|
+
glvDeposit: fee(big22(4) + glvExtra),
|
|
66744
|
+
glvWithdrawal: fee(big22(5) + glvExtra)
|
|
65908
66745
|
};
|
|
65909
66746
|
};
|
|
65910
66747
|
|
|
@@ -67562,6 +68399,27 @@ var TERM_PROFILES = [
|
|
|
67562
68399
|
]
|
|
67563
68400
|
}
|
|
67564
68401
|
}),
|
|
68402
|
+
P({
|
|
68403
|
+
id: "cooler.mono@v1",
|
|
68404
|
+
name: "Olympus Cooler V2 (MonoCooler)",
|
|
68405
|
+
family: "cooler",
|
|
68406
|
+
supply: {
|
|
68407
|
+
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.",
|
|
68408
|
+
implications: [
|
|
68409
|
+
"Your counterparty is the Olympus treasury itself: there are no external lenders, and collateral seized in a liquidation is unstaked and BURNED."
|
|
68410
|
+
]
|
|
68411
|
+
},
|
|
68412
|
+
borrow: {
|
|
68413
|
+
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).",
|
|
68414
|
+
implications: [
|
|
68415
|
+
"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.",
|
|
68416
|
+
"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.",
|
|
68417
|
+
"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).",
|
|
68418
|
+
"The position is perpetual \u2014 no maturity, no expiry.",
|
|
68419
|
+
"The debt token itself is governance-swappable (a new treasury borrower can replace USDS), so read it live rather than assuming USDS."
|
|
68420
|
+
]
|
|
68421
|
+
}
|
|
68422
|
+
}),
|
|
67565
68423
|
P({
|
|
67566
68424
|
id: "dss.cdp@v1",
|
|
67567
68425
|
name: "Maker-style (dss) CDP ilk",
|
|
@@ -67848,7 +68706,7 @@ var TERM_SHEET_SCHEMA_VERSION = 1;
|
|
|
67848
68706
|
|
|
67849
68707
|
// src/terms/buildTermSheet.ts
|
|
67850
68708
|
var isNum = (v) => typeof v === "number" && Number.isFinite(v);
|
|
67851
|
-
var
|
|
68709
|
+
var clamp012 = (v) => Math.max(0, Math.min(1, v));
|
|
67852
68710
|
function assetRef(input) {
|
|
67853
68711
|
const a = input.asset ?? {};
|
|
67854
68712
|
return {
|
|
@@ -68035,6 +68893,9 @@ function resolveMinDebt(input) {
|
|
|
68035
68893
|
m.river?.minNetDebt,
|
|
68036
68894
|
// Inverse FiRM.
|
|
68037
68895
|
m.inverse?.minDebt,
|
|
68896
|
+
// Cooler (Olympus V2) — `minDebtRequired`, 1,000 USDS. Gates borrows AND
|
|
68897
|
+
// partial repays: any action leaving 0 < debt < minDebt reverts.
|
|
68898
|
+
m.cooler?.minDebt,
|
|
68038
68899
|
// dss (Sky / the USDD fork): `dust` IS the per-vault debt floor.
|
|
68039
68900
|
m.dss?.dust ?? m.usdd?.dust,
|
|
68040
68901
|
// Gearbox credit facade.
|
|
@@ -68061,7 +68922,7 @@ function resolveMinCollateral(input) {
|
|
|
68061
68922
|
}
|
|
68062
68923
|
function capUtil(total, cap) {
|
|
68063
68924
|
if (!isNum(cap) || cap <= 0 || !isNum(total)) return void 0;
|
|
68064
|
-
return
|
|
68925
|
+
return clamp012(total / cap);
|
|
68065
68926
|
}
|
|
68066
68927
|
function buildAvailability(input, side) {
|
|
68067
68928
|
const frozen = input.isFrozen === true;
|
|
@@ -68100,7 +68961,7 @@ function buildUtilization(input) {
|
|
|
68100
68961
|
if (!isNum(input.utilization)) return void 0;
|
|
68101
68962
|
const shared = isNum(input.irmTotalDeposits) && isNum(input.irmTotalDebt);
|
|
68102
68963
|
return {
|
|
68103
|
-
utilization:
|
|
68964
|
+
utilization: clamp012(input.utilization),
|
|
68104
68965
|
basis: shared ? "pool" : "market",
|
|
68105
68966
|
irmTotalDeposits: input.irmTotalDeposits,
|
|
68106
68967
|
irmTotalDebt: input.irmTotalDebt,
|
|
@@ -68240,7 +69101,7 @@ function buildSupply(input, now, siblings) {
|
|
|
68240
69101
|
const liquidity = isNum(input.totalLiquidity) ? {
|
|
68241
69102
|
assets: input.totalLiquidity,
|
|
68242
69103
|
assetsUsd: input.totalLiquidityUsd,
|
|
68243
|
-
ratio: isNum(input.totalDeposits) && input.totalDeposits > 0 ?
|
|
69104
|
+
ratio: isNum(input.totalDeposits) && input.totalDeposits > 0 ? clamp012(input.totalLiquidity / input.totalDeposits) : void 0
|
|
68244
69105
|
} : void 0;
|
|
68245
69106
|
const supply = {
|
|
68246
69107
|
role: canBeCollateral ? earns ? "both" : "collateral" : "yield",
|
|
@@ -68651,7 +69512,7 @@ function windowFromAprWindow(aprWindow) {
|
|
|
68651
69512
|
|
|
68652
69513
|
// src/terms/vault/build.ts
|
|
68653
69514
|
var isNum2 = (v) => typeof v === "number" && Number.isFinite(v);
|
|
68654
|
-
var
|
|
69515
|
+
var clamp013 = (v) => Math.max(0, Math.min(1, v));
|
|
68655
69516
|
function buildRate2(input, t, maturity) {
|
|
68656
69517
|
const hasLegs = input.supplyRate != null || input.rewardsRate != null;
|
|
68657
69518
|
const base = hasLegs ? input.supplyRate ?? 0 : input.totalRate ?? 0;
|
|
@@ -68828,7 +69689,7 @@ function settlementFor(mode, priceRisk) {
|
|
|
68828
69689
|
function buildExit(input, t, fees) {
|
|
68829
69690
|
const mode = resolveExitMode(input, t);
|
|
68830
69691
|
const priceRisk = resolvePriceRisk(input, t);
|
|
68831
|
-
const ratio = input.instantLiquidityRatio ?? (isNum2(input.liquidity) && isNum2(input.totalAssets) && input.totalAssets > 0 ?
|
|
69692
|
+
const ratio = input.instantLiquidityRatio ?? (isNum2(input.liquidity) && isNum2(input.totalAssets) && input.totalAssets > 0 ? clamp013(input.liquidity / input.totalAssets) : void 0);
|
|
68832
69693
|
return {
|
|
68833
69694
|
mode,
|
|
68834
69695
|
settlement: settlementFor(mode, priceRisk),
|
|
@@ -68986,7 +69847,7 @@ function buildUtilization2(input, t) {
|
|
|
68986
69847
|
const total = input.expectedLiquidity;
|
|
68987
69848
|
if (!isNum2(borrowed) || !isNum2(total) || total <= 0) return void 0;
|
|
68988
69849
|
return {
|
|
68989
|
-
utilization:
|
|
69850
|
+
utilization: clamp013(borrowed / total),
|
|
68990
69851
|
// The ratio is the underlying pool's, not this share token's.
|
|
68991
69852
|
basis: "pool",
|
|
68992
69853
|
irmTotalDeposits: total,
|
|
@@ -71078,6 +71939,10 @@ var ROW_DESCRIPTOR_KEYS = [
|
|
|
71078
71939
|
"river",
|
|
71079
71940
|
"teller",
|
|
71080
71941
|
"inverse",
|
|
71942
|
+
// Cooler: the price-LTV ratchet, the drip schedule and the minDebt gate —
|
|
71943
|
+
// the descriptor is the only carrier of the protocol truth (the fractional
|
|
71944
|
+
// factors on the row are display-only).
|
|
71945
|
+
"cooler",
|
|
71081
71946
|
"exactly",
|
|
71082
71947
|
"usdd",
|
|
71083
71948
|
"dss",
|
|
@@ -71987,6 +72852,68 @@ var inverseAdapter = {
|
|
|
71987
72852
|
}
|
|
71988
72853
|
})
|
|
71989
72854
|
};
|
|
72855
|
+
var coolerAdapter = {
|
|
72856
|
+
id: "cooler",
|
|
72857
|
+
matches: isCooler,
|
|
72858
|
+
profileId: () => "cooler.mono@v1",
|
|
72859
|
+
build: (input) => {
|
|
72860
|
+
const c = input.market?.cooler ?? {};
|
|
72861
|
+
return {
|
|
72862
|
+
// The "oracle" is a governance drip schedule, not a price feed — the
|
|
72863
|
+
// solvency path uses no market price at all.
|
|
72864
|
+
oracle: { kind: "none" },
|
|
72865
|
+
supply: {
|
|
72866
|
+
role: "collateral",
|
|
72867
|
+
availability: { opensWith: "both-legs" },
|
|
72868
|
+
counterparty: { kind: "cdp", solvency: "overcollateralized" }
|
|
72869
|
+
},
|
|
72870
|
+
borrow: {
|
|
72871
|
+
rate: {
|
|
72872
|
+
// Governance-set with no curve — the dss/USDD shape.
|
|
72873
|
+
kind: "variable-managed",
|
|
72874
|
+
source: "governance",
|
|
72875
|
+
isLocked: false,
|
|
72876
|
+
/** MAX_INTEREST_RATE — a hard 10 % cap enforced by code. */
|
|
72877
|
+
maxApr: 10
|
|
72878
|
+
},
|
|
72879
|
+
debtShape: "accruing",
|
|
72880
|
+
maturity: { kind: "perpetual" },
|
|
72881
|
+
exit: {
|
|
72882
|
+
earlyRepay: "free",
|
|
72883
|
+
atMaturityCost: "accrued",
|
|
72884
|
+
lateBehaviour: "none",
|
|
72885
|
+
partialAllowed: true,
|
|
72886
|
+
// Over-repay CLAMPS on MonoCooler — a full close is always safe.
|
|
72887
|
+
overRepayReverts: false
|
|
72888
|
+
},
|
|
72889
|
+
liquidation: {
|
|
72890
|
+
// The trigger is TIME, never price: debt compounding at ~0.5 %/yr
|
|
72891
|
+
// against an up-only OLTV ratchet (LLTV = OLTV × 1.01). Never apply
|
|
72892
|
+
// "HF < 1 at spot price ⇒ liquidatable" copy here.
|
|
72893
|
+
trigger: "time",
|
|
72894
|
+
model: "repay-seize",
|
|
72895
|
+
// Seized gOHM is unstaked and BURNED — nobody receives it.
|
|
72896
|
+
seizure: "full-collateral",
|
|
72897
|
+
badDebt: "protocol-absorbed",
|
|
72898
|
+
permissioned: false
|
|
72899
|
+
},
|
|
72900
|
+
counterparty: {
|
|
72901
|
+
kind: "cdp",
|
|
72902
|
+
solvency: "overcollateralized",
|
|
72903
|
+
address: typeof c.addresses?.treasury === "string" ? c.addresses.treasury : void 0
|
|
72904
|
+
},
|
|
72905
|
+
availability: {
|
|
72906
|
+
requires: ["token-approval"]
|
|
72907
|
+
}
|
|
72908
|
+
},
|
|
72909
|
+
constraints: {
|
|
72910
|
+
crossMargin: false,
|
|
72911
|
+
positionModel: "account",
|
|
72912
|
+
positionIdMeaning: "One position per address on the monolithic MonoCooler book \u2014 the account address is the position key."
|
|
72913
|
+
}
|
|
72914
|
+
};
|
|
72915
|
+
}
|
|
72916
|
+
};
|
|
71990
72917
|
var dssAdapter = {
|
|
71991
72918
|
id: "dss",
|
|
71992
72919
|
matches: isDssType,
|
|
@@ -72619,6 +73546,7 @@ var TERM_ADAPTERS = [
|
|
|
72619
73546
|
liquityAdapter,
|
|
72620
73547
|
riverAdapter,
|
|
72621
73548
|
inverseAdapter,
|
|
73549
|
+
coolerAdapter,
|
|
72622
73550
|
dssAdapter,
|
|
72623
73551
|
compoundV3Adapter,
|
|
72624
73552
|
fluidAdapter,
|
|
@@ -73379,10 +74307,51 @@ function lendingCapabilities(row) {
|
|
|
73379
74307
|
}
|
|
73380
74308
|
return caps;
|
|
73381
74309
|
}
|
|
73382
|
-
var SWAP_ROUTED_PROVIDERS = /* @__PURE__ */ new Set([
|
|
73383
|
-
|
|
74310
|
+
var SWAP_ROUTED_PROVIDERS = /* @__PURE__ */ new Set([
|
|
74311
|
+
"pendle",
|
|
74312
|
+
"spectra"
|
|
74313
|
+
]);
|
|
74314
|
+
var ZAP_EXCLUDED_PROVIDERS = /* @__PURE__ */ new Set([
|
|
74315
|
+
"lst",
|
|
74316
|
+
"gmx",
|
|
74317
|
+
"hypercore",
|
|
74318
|
+
"lagoon"
|
|
74319
|
+
]);
|
|
74320
|
+
var NON_4626_DEPOSIT_KINDS = /* @__PURE__ */ new Set([
|
|
74321
|
+
"frankencoin",
|
|
74322
|
+
"yieldbasis",
|
|
74323
|
+
"wren",
|
|
74324
|
+
"hyperbeat",
|
|
74325
|
+
"native-wnlp",
|
|
74326
|
+
"bitway"
|
|
74327
|
+
]);
|
|
74328
|
+
function acceptsVaultZap(row, provider) {
|
|
74329
|
+
if (ZAP_EXCLUDED_PROVIDERS.has(provider)) return false;
|
|
74330
|
+
const share = row.shareToken?.address ?? row.ref;
|
|
74331
|
+
if (!share) return false;
|
|
74332
|
+
try {
|
|
74333
|
+
const entry = findSavingsWithdrawEntry(row.chainId, share);
|
|
74334
|
+
if (entry && NON_4626_DEPOSIT_KINDS.has(entry.kind)) return false;
|
|
74335
|
+
} catch {
|
|
74336
|
+
return false;
|
|
74337
|
+
}
|
|
74338
|
+
return true;
|
|
74339
|
+
}
|
|
74340
|
+
function isSecondaryMarketRow(row) {
|
|
74341
|
+
const meta = row.providerMeta ?? {};
|
|
74342
|
+
if (meta.secondaryMarketOnly === true) return true;
|
|
74343
|
+
const share = row.shareToken?.address ?? row.ref;
|
|
74344
|
+
if (!share || !row.chainId) return false;
|
|
74345
|
+
try {
|
|
74346
|
+
return isSecondaryMarketOnly(String(row.chainId), share);
|
|
74347
|
+
} catch {
|
|
74348
|
+
return false;
|
|
74349
|
+
}
|
|
74350
|
+
}
|
|
74351
|
+
function swapRoutedCapabilities(row, opts) {
|
|
73384
74352
|
const caps = [];
|
|
73385
|
-
|
|
74353
|
+
const entryOpen = row.availability.canDeposit || opts?.ignoreMintPermission === true && row.availability.gating === "allowlist-contract" && (row.providerMeta ?? {}).paused !== true;
|
|
74354
|
+
if (entryOpen) {
|
|
73386
74355
|
caps.push({
|
|
73387
74356
|
action: "deposit",
|
|
73388
74357
|
via: "swap",
|
|
@@ -73405,17 +74374,20 @@ function vaultCapabilities(row) {
|
|
|
73405
74374
|
const meta = row.providerMeta ?? {};
|
|
73406
74375
|
const caps = [];
|
|
73407
74376
|
if (SWAP_ROUTED_PROVIDERS.has(provider)) return swapRoutedCapabilities(row);
|
|
74377
|
+
if (isSecondaryMarketRow(row))
|
|
74378
|
+
return swapRoutedCapabilities(row, { ignoreMintPermission: true });
|
|
73408
74379
|
if (row.availability.canDeposit) {
|
|
73409
74380
|
const inputs = depositInputs(row, provider);
|
|
73410
74381
|
caps.push({
|
|
73411
74382
|
action: "deposit",
|
|
73412
74383
|
inputs,
|
|
73413
74384
|
requires: depositRequires(provider, meta, inputs),
|
|
73414
|
-
// Phase 3
|
|
73415
|
-
//
|
|
73416
|
-
//
|
|
73417
|
-
// input that
|
|
73418
|
-
|
|
74385
|
+
// Phase 3 (EARN_ENDPOINT_PLAN §5.3): `/v1/actions/earn/deposit` routes
|
|
74386
|
+
// a mismatched `payAsset` through an aggregator swap + composed 4626
|
|
74387
|
+
// deposit — but ONLY for rows whose deposit is a plain synchronous
|
|
74388
|
+
// ERC-4626 call. Advertising it anywhere else builds a zap input that
|
|
74389
|
+
// 400s at submit, which is exactly what this flag existed to prevent.
|
|
74390
|
+
acceptsPayAsset: acceptsVaultZap(row, provider)
|
|
73419
74391
|
});
|
|
73420
74392
|
}
|
|
73421
74393
|
if (!row.availability.canWithdraw) return caps;
|
|
@@ -73712,6 +74684,6 @@ function earnPositionTotals(items) {
|
|
|
73712
74684
|
};
|
|
73713
74685
|
}
|
|
73714
74686
|
|
|
73715
|
-
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, 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, 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 };
|
|
74687
|
+
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 };
|
|
73716
74688
|
//# sourceMappingURL=index.js.map
|
|
73717
74689
|
//# sourceMappingURL=index.js.map
|