@1delta/margin-fetcher 5.0.64 → 5.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { Chain } from '@1delta/chain-registry';
9
9
  import { multicallRetryUniversal, getEvmClient, getEvmChain, getEvmClientUniversal } from '@1delta/providers';
10
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, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses } from '@1delta/calldata-sdk';
12
+ import { prepareDebitDataMulticall, prepareLenderDebitMulticall, parseDebitDataResult, parseLenderDebitResult, getPermit2ContractAddress, getLstAcceptedInputs, getCompoundV3CometAddress as getCompoundV3CometAddress$1, getMorphoAddress, getAaveCollateralTokenAddress, getSiloHalfForUnderlying, findSavingsWithdrawEntry, bandLtvCurve, InitMarginAddresses, ignoresReceiver, buildLstWithdrawRequest, SAVINGS_RECEIVER_CAPABILITY } 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
 
@@ -45376,8 +45376,14 @@ var LST_REGISTRY = {
45376
45376
  yieldKey: "Restaked Swell ETH::RSWETH"
45377
45377
  },
45378
45378
  {
45379
+ // Puffer pufETH. The underlying is **WETH**, not wstETH: `asset()`
45380
+ // returns `0xC02aaA39…` and the vault holds ZERO wstETH (verified
45381
+ // on-chain 2026-08-25). It was wstETH-denominated at launch and the
45382
+ // registry never followed the migration, so the row valued 24,108 ETH
45383
+ // of assets at the wstETH price — a ~20 % TVL overstatement, and a
45384
+ // `convertToAssets` of 1.082 labelled in the wrong unit.
45379
45385
  address: "0xd9a442856c234a39a81a089c06451ebaa4306a72",
45380
- underlying: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
45386
+ underlying: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
45381
45387
  symbol: "pufETH",
45382
45388
  brand: "Puffer",
45383
45389
  decimals: 18,
@@ -45387,7 +45393,8 @@ var LST_REGISTRY = {
45387
45393
  isMintable: true,
45388
45394
  isNativeUnderlying: true,
45389
45395
  mintContract: "0xd9a442856c234a39a81a089c06451ebaa4306a72",
45390
- mintInputAsset: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
45396
+ // The builder's only path is the native `depositETH(receiver)` zap.
45397
+ mintInputAsset: "native",
45391
45398
  withdrawalMode: "fee-or-queued",
45392
45399
  yieldFetcher: pufethFetcher,
45393
45400
  yieldKey: "PUFETH"
@@ -47673,12 +47680,14 @@ var strataFetcher = {
47673
47680
  }
47674
47681
  };
47675
47682
  var thBill = "Theo Short Duration US Treasury Fund::THBILL";
47683
+ var thBillBare = "thBILL::thBILL";
47676
47684
  var THBILL_DEFILLAMA_POOL = "e17dab50-85b1-45e8-b4a5-b8ae7898c4a3";
47677
47685
  var thbillFetcher = {
47678
47686
  label: "THBILL",
47679
47687
  fetch: async () => {
47680
47688
  const apy = await fetchDefiLlamaApy(THBILL_DEFILLAMA_POOL);
47681
- return { [thBill]: apyToAprPercent(apy) };
47689
+ const apr = apyToAprPercent(apy);
47690
+ return { [thBill]: apr, [thBillBare]: apr };
47682
47691
  }
47683
47692
  };
47684
47693
  var STHUSD_VAULT = "0xa808bc9775cb41c52c7842f8b50427fe7a770326";
@@ -62735,6 +62744,22 @@ var resolveAcceptedInputs = (chainId, shareToken, entry) => {
62735
62744
  }
62736
62745
  ];
62737
62746
  };
62747
+ var probeSelfOnly = (chainId, shareToken, route) => {
62748
+ try {
62749
+ const self = ignoresReceiver(buildLstWithdrawRequest, {
62750
+ chainId,
62751
+ shareToken,
62752
+ amount: 10n ** 18n,
62753
+ receiver: "0x00000000000000000000000000000000000000a1",
62754
+ // Neutral protocol-required inputs, so the probe measures the RECEIVER
62755
+ // and not a missing argument.
62756
+ options: { route, deadline: 9999999999n, minAssetOut: 0n, minHype: 0n }
62757
+ });
62758
+ return self ? true : void 0;
62759
+ } catch {
62760
+ return void 0;
62761
+ }
62762
+ };
62738
62763
  var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList = {}, opts = {}) => {
62739
62764
  const entries = getLstRegistry(chainId);
62740
62765
  if (entries.length === 0) return {};
@@ -62890,14 +62915,26 @@ var fetchLstShareTokens = async (chainId, multicallRetry, prices = {}, tokenList
62890
62915
  // list itself; everything else gets the coarse derivation, which is
62891
62916
  // still strictly better than making every consumer reassemble the two
62892
62917
  // legs out of `withdrawalMode` + one cooldown + one liquidity number.
62893
- exitRoutes: state.exitRoutes ?? deriveExitRoutes({
62918
+ exitRoutes: (state.exitRoutes ?? deriveExitRoutes({
62894
62919
  withdrawalMode: entry.withdrawalMode,
62895
62920
  withdrawFeeBps: state.withdrawFeeBps,
62896
62921
  withdrawalCooldownSeconds: cooldownSecs,
62897
62922
  liquidity: liquidityRaw.toString(),
62898
62923
  liquidityFormatted,
62899
62924
  liquidityUsd
62900
- }),
62925
+ })).map(
62926
+ (r) => (
62927
+ // A reader that already established it wins; otherwise probe.
62928
+ r.selfOnly !== void 0 || r.kind === "market" ? r : {
62929
+ ...r,
62930
+ selfOnly: probeSelfOnly(
62931
+ chainId,
62932
+ addressLc,
62933
+ r.kind === "instant" ? "instant" : "queued"
62934
+ )
62935
+ }
62936
+ )
62937
+ ),
62901
62938
  asset,
62902
62939
  priceUsd,
62903
62940
  totalAssetsFormatted,
@@ -67198,6 +67235,14 @@ var resolveYieldApr2 = async (entries) => (await resolveEntryApr(entries)).apr;
67198
67235
 
67199
67236
  // src/vaults/savings/fetchPublic.ts
67200
67237
  var ONE_E1814 = 10n ** 18n;
67238
+ var resolveSelfOnly = (chainId, vault) => {
67239
+ const entry = findSavingsWithdrawEntry(chainId, vault);
67240
+ if (!entry) return void 0;
67241
+ return SAVINGS_RECEIVER_CAPABILITY[entry.kind]?.exit === false ? true : void 0;
67242
+ };
67243
+ var withSelfOnly = (routes2, selfOnly) => selfOnly === void 0 ? routes2 : routes2.map(
67244
+ (r) => r.kind === "market" || r.selfOnly !== void 0 ? r : { ...r, selfOnly }
67245
+ );
67201
67246
  var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList = {}) => {
67202
67247
  const entries = getSavingsRegistry(chainId);
67203
67248
  if (entries.length === 0) return {};
@@ -67320,14 +67365,17 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
67320
67365
  // savings row gets it without a per-provider change; the queued leg's
67321
67366
  // fee is left ABSENT rather than 0 because "not published" and "free"
67322
67367
  // are different claims and only some protocols make the second.
67323
- exitRoutes: deriveExitRoutes({
67324
- withdrawalMode: entry.withdrawalMode,
67325
- withdrawFeeBps: state.withdrawFeeBps,
67326
- withdrawalCooldownSeconds: state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds,
67327
- liquidity: liquidityRaw,
67328
- liquidityFormatted,
67329
- liquidityUsd
67330
- }),
67368
+ exitRoutes: withSelfOnly(
67369
+ deriveExitRoutes({
67370
+ withdrawalMode: entry.withdrawalMode,
67371
+ withdrawFeeBps: state.withdrawFeeBps,
67372
+ withdrawalCooldownSeconds: state.withdrawalCooldownSeconds ?? entry.withdrawalCooldownSeconds,
67373
+ liquidity: liquidityRaw,
67374
+ liquidityFormatted,
67375
+ liquidityUsd
67376
+ }),
67377
+ resolveSelfOnly(chainId, entry.address)
67378
+ ),
67331
67379
  depositCapacity,
67332
67380
  depositCapacityFormatted,
67333
67381
  depositCapacityUsd,