@1delta/margin-fetcher 5.0.160 → 5.0.161

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 CHANGED
@@ -12091,7 +12091,7 @@ declare const secondaryMarketVault: (chainId: string, address: string) => {
12091
12091
  declare const savingsAddresses: (chainId: string) => string[];
12092
12092
 
12093
12093
  /** Reader discriminant on a registry entry. Absent ⇒ `erc4626`. */
12094
- type SavingsReaderKind = 'erc4626' | 'erc4626-cooldown' | 'erc4626-idle' | 'erc4626-withdraw-limit' | 'native-wnlp' | 'nav-oracle' | 'frankencoin-savings' | 'hyperbeat-vault' | 'bitway-vault' | 'zerobase-vault' | 'bitfi-bfbtc' | 'bitfi-vault' | 'yieldbasis-lt' | 'wren-nav' | 'vesper-pool' | 'yearn-v2-vault' | 'venus-hub' | 'saturn-vault' | 'nest-vault' | 'usual-bond' | 'lista-rwa-pool' | 'lista-xaut-staking' | 'aster-asusdf-earn' | 'superform-supervault' | 'ipor-fusion' | 'mezzanine-tranche' | 'ember-vault' | 'mellow-core' | 'aera-v3' | 'origin-wrapper' | 'liminal-pipe' | 'veda-boring' | 'unitas-xgld' | 'royco-tranche' | 'inverter-oracle' | 'erc4626-cooldown-instant-fee' | 'sbold' | 'morpho-vault-v2' | 'accountable-vault' | 'inverse-jrdola' | 'inverse-sinv' | 'alchemix-transmuter' | 'threejane-lcc' | 'usdai-staked' | 'yuzu-ilp' | 'makina-machine';
12094
+ type SavingsReaderKind = 'erc4626' | 'erc4626-cooldown' | 'erc4626-idle' | 'erc4626-withdraw-limit' | 'native-wnlp' | 'nav-oracle' | 'frankencoin-savings' | 'hyperbeat-vault' | 'bitway-vault' | 'zerobase-vault' | 'bitfi-bfbtc' | 'bitfi-vault' | 'yieldbasis-lt' | 'wren-nav' | 'vesper-pool' | 'yearn-v2-vault' | 'venus-hub' | 'saturn-vault' | 'nest-vault' | 'usual-bond' | 'lista-rwa-pool' | 'lista-xaut-staking' | 'aster-asusdf-earn' | 'superform-supervault' | 'ipor-fusion' | 'mezzanine-tranche' | 'ember-vault' | 'mellow-core' | 'aera-v3' | 'origin-wrapper' | 'liminal-pipe' | 'veda-boring' | 'unitas-xgld' | 'royco-tranche' | 'inverter-oracle' | 'erc4626-cooldown-instant-fee' | 'sbold' | 'sky-stusds' | 'morpho-vault-v2' | 'accountable-vault' | 'inverse-jrdola' | 'inverse-sinv' | 'alchemix-transmuter' | 'threejane-lcc' | 'usdai-staked' | 'yuzu-ilp' | 'makina-machine';
12095
12095
 
12096
12096
  /** One Transmuter position NFT. Amounts are RAW alAsset (18-dec). */
12097
12097
  interface TransmuterLot {
package/dist/index.js CHANGED
@@ -62981,11 +62981,14 @@ var SINGLE_CHAIN_ENTRIES = {
62981
62981
  underlying: "0xdc035d45d973e3ec169d2276ddab16f1e407384f",
62982
62982
  symbol: "stUSDS",
62983
62983
  brand: "Sky",
62984
- description: "Sky's higher-yield staking module over USDS, with a utilisation-driven rate instead of the flat Sky Savings Rate. Withdrawals are instant but liquidity-dependent \u2014 the pool targets ~90% utilisation, so maxWithdraw can temporarily return less than your balance.",
62984
+ description: "Sky's higher-yield staking module over USDS, lent to SKY stakers borrowing through the LockstakeEngine, with a utilisation-driven rate instead of the flat Sky Savings Rate. Withdrawals settle instantly but only out of what those borrowers are not using \u2014 the pool targets ~90% utilisation and can sit at 100%, when nothing can be withdrawn until borrowers repay.",
62985
62985
  decimals: 18,
62986
62986
  isRebasing: false,
62987
62987
  isMintable: true,
62988
- withdrawalMode: "instant",
62988
+ // The USDS stays in the vault but is reserved for the LSE ilk's debt;
62989
+ // `sky-stusds` reads the free part (totalAssets − ilk debt).
62990
+ reader: "sky-stusds",
62991
+ withdrawalMode: "instant-capped",
62989
62992
  yieldFetcher: susdsFetcher,
62990
62993
  yieldKey: "Staked USDS::stUSDS"
62991
62994
  },
@@ -90031,6 +90034,53 @@ var EmberPauseStatusAbi = [
90031
90034
  }
90032
90035
  ];
90033
90036
 
90037
+ // src/vaults/savings/abis/sky.ts
90038
+ var VatIlksAbi = [
90039
+ {
90040
+ name: "ilks",
90041
+ type: "function",
90042
+ stateMutability: "view",
90043
+ inputs: [{ type: "bytes32", name: "ilk" }],
90044
+ outputs: [
90045
+ { type: "uint256", name: "Art" },
90046
+ { type: "uint256", name: "rate" },
90047
+ { type: "uint256", name: "spot" },
90048
+ { type: "uint256", name: "line" },
90049
+ { type: "uint256", name: "dust" }
90050
+ ]
90051
+ }
90052
+ ];
90053
+ var JugIlksAbi = [
90054
+ {
90055
+ name: "ilks",
90056
+ type: "function",
90057
+ stateMutability: "view",
90058
+ inputs: [{ type: "bytes32", name: "ilk" }],
90059
+ outputs: [
90060
+ { type: "uint256", name: "duty" },
90061
+ { type: "uint256", name: "rho" }
90062
+ ]
90063
+ }
90064
+ ];
90065
+ var ClipDueAbi = [
90066
+ {
90067
+ name: "Due",
90068
+ type: "function",
90069
+ stateMutability: "view",
90070
+ inputs: [],
90071
+ outputs: [{ type: "uint256" }]
90072
+ }
90073
+ ];
90074
+ var StUsdsMaxDepositAbi = [
90075
+ {
90076
+ name: "maxDeposit",
90077
+ type: "function",
90078
+ stateMutability: "view",
90079
+ inputs: [{ type: "address", name: "receiver" }],
90080
+ outputs: [{ type: "uint256" }]
90081
+ }
90082
+ ];
90083
+
90034
90084
  // src/vaults/savings/abis/inverse.ts
90035
90085
  var uintView = (name) => [
90036
90086
  {
@@ -93147,6 +93197,82 @@ var readerSBold = (entry2) => {
93147
93197
  };
93148
93198
  };
93149
93199
 
93200
+ // src/vaults/savings/readers/skyStUsds.ts
93201
+ var RAY11 = 10n ** 27n;
93202
+ var VAT = "0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B";
93203
+ var JUG = "0x19c0976f590D67707E62397C87829d896Dc0f1F1";
93204
+ var CLIP = "0x836F56750517b1528B5078Cba4Ac4B94fBE4A399";
93205
+ var ILK = "0x4c534556322d534b592d41000000000000000000000000000000000000000000";
93206
+ var NEUTRAL_PROBE8 = "0x000000000000000000000000000000000000dead";
93207
+ var rpow = (x, n) => {
93208
+ let z = n % 2n ? x : RAY11;
93209
+ for (n /= 2n; n > 0n; n /= 2n) {
93210
+ x = (x * x + RAY11 / 2n) / RAY11;
93211
+ if (n % 2n) z = (z * x + RAY11 / 2n) / RAY11;
93212
+ }
93213
+ return z;
93214
+ };
93215
+ var readerSkyStUsds = (entry2) => {
93216
+ const shareUnit = 10n ** BigInt(entry2.decimals);
93217
+ const underlyingUnit = 10n ** BigInt(entry2.underlyingDecimals ?? entry2.decimals);
93218
+ return {
93219
+ calls: [
93220
+ { address: entry2.address, name: "totalAssets", params: [] },
93221
+ { address: entry2.address, name: "totalSupply", params: [] },
93222
+ {
93223
+ address: entry2.address,
93224
+ name: "convertToAssets",
93225
+ params: [shareUnit]
93226
+ },
93227
+ { address: VAT, name: "ilks", params: [ILK] },
93228
+ { address: JUG, name: "ilks", params: [ILK] },
93229
+ { address: CLIP, name: "Due", params: [] },
93230
+ { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE8] }
93231
+ ],
93232
+ abis: [
93233
+ Erc4626ReadAbi2,
93234
+ TotalSupplyAbi2,
93235
+ Erc4626ReadAbi2,
93236
+ VatIlksAbi,
93237
+ JugIlksAbi,
93238
+ ClipDueAbi,
93239
+ StUsdsMaxDepositAbi
93240
+ ],
93241
+ parse: ([assets, supply, rate, vatIlk, jugIlk, due, maxDep]) => {
93242
+ const totalAssets = toBigInt16(assets);
93243
+ const totalSupply = toBigInt16(supply);
93244
+ const convertToAssetsRaw = toBigInt16(rate);
93245
+ if (totalAssets === void 0 || totalSupply === void 0 || convertToAssetsRaw === void 0) {
93246
+ return void 0;
93247
+ }
93248
+ const art = Array.isArray(vatIlk) ? toBigInt16(vatIlk[0]) : void 0;
93249
+ const ilkRate = Array.isArray(vatIlk) ? toBigInt16(vatIlk[1]) : void 0;
93250
+ const duty = Array.isArray(jugIlk) ? toBigInt16(jugIlk[0]) : void 0;
93251
+ const rho = Array.isArray(jugIlk) ? toBigInt16(jugIlk[1]) : void 0;
93252
+ const clipDue = toBigInt16(due);
93253
+ let capacity;
93254
+ if (art !== void 0 && ilkRate !== void 0 && duty !== void 0 && rho !== void 0 && clipDue !== void 0) {
93255
+ const now = BigInt(Math.floor(Date.now() / 1e3));
93256
+ const accrued = now > rho ? rpow(duty, now - rho) * ilkRate / RAY11 : ilkRate;
93257
+ const used = (art * accrued + clipDue) / RAY11;
93258
+ capacity = totalAssets > used ? totalAssets - used : 0n;
93259
+ }
93260
+ const depositCapacity = toBigInt16(maxDep);
93261
+ return {
93262
+ totalAssets,
93263
+ totalSupply,
93264
+ exchangeRate: convertToAssetsRaw * ONE_E1823 / underlyingUnit,
93265
+ ...capacity !== void 0 ? {
93266
+ instantRedeemCapacity: capacity,
93267
+ instantRedeemEnabled: true,
93268
+ withdrawFeeBps: 0
93269
+ } : {},
93270
+ ...depositCapacity !== void 0 ? { depositCapacity } : {}
93271
+ };
93272
+ }
93273
+ };
93274
+ };
93275
+
93150
93276
  // src/vaults/savings/readers/morphoVaultV2.ts
93151
93277
  var MorphoVaultV2ReadAbi = [
93152
93278
  {
@@ -93501,7 +93627,7 @@ var readerAlchemixTransmuter = (entry2) => {
93501
93627
  };
93502
93628
 
93503
93629
  // src/vaults/savings/readers/threeJaneLcc.ts
93504
- var RAY11 = 10n ** 27n;
93630
+ var RAY12 = 10n ** 27n;
93505
93631
  var readerThreeJaneLcc = (entry2) => {
93506
93632
  const cfg = entry2.threeJaneLcc;
93507
93633
  if (!cfg)
@@ -93558,7 +93684,7 @@ var readerThreeJaneLcc = (entry2) => {
93558
93684
  const paused = Array.isArray(pauseRaw) ? pauseRaw[0] === true : void 0;
93559
93685
  const shutdown = shutdownRaw?.active === true;
93560
93686
  const liquidityRate = reserveRaw?.currentLiquidityRate;
93561
- const supplyRate = typeof liquidityRate === "bigint" ? Number(liquidityRate * 1000000n / RAY11) / 1e4 : void 0;
93687
+ const supplyRate = typeof liquidityRate === "bigint" ? Number(liquidityRate * 1000000n / RAY12) / 1e4 : void 0;
93562
93688
  const promiseApr = cfg.promiseFeePct * 1e4 / Number(epoch.marginRatioBps);
93563
93689
  const rewardStreams = [
93564
93690
  {
@@ -93618,7 +93744,7 @@ var readerThreeJaneLcc = (entry2) => {
93618
93744
  };
93619
93745
 
93620
93746
  // src/vaults/savings/readers/gapSweep.ts
93621
- var NEUTRAL_PROBE8 = "0x000000000000000000000000000000000000dead";
93747
+ var NEUTRAL_PROBE9 = "0x000000000000000000000000000000000000dead";
93622
93748
  var MAX_UINT256 = 2n ** 256n - 1n;
93623
93749
  var readerUsdaiStaked = (entry2) => {
93624
93750
  const a = entry2.address;
@@ -93668,7 +93794,7 @@ var readerYuzuIlp = (entry2) => {
93668
93794
  { address: entry2.address, name: "totalAssets", params: [] },
93669
93795
  { address: entry2.address, name: "totalSupply", params: [] },
93670
93796
  { address: entry2.address, name: "convertToAssets", params: [shareUnit] },
93671
- { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE8] },
93797
+ { address: entry2.address, name: "maxDeposit", params: [NEUTRAL_PROBE9] },
93672
93798
  { address: entry2.address, name: "paused", params: [] }
93673
93799
  ],
93674
93800
  abis: [
@@ -93801,6 +93927,8 @@ var buildReader2 = (entry2) => {
93801
93927
  return readerUnitasXgld(entry2);
93802
93928
  case "sbold":
93803
93929
  return readerSBold(entry2);
93930
+ case "sky-stusds":
93931
+ return readerSkyStUsds(entry2);
93804
93932
  case "accountable-vault":
93805
93933
  return readerAccountableVault(entry2);
93806
93934
  case "morpho-vault-v2":
@@ -94079,7 +94207,9 @@ var fetchSavingsVaults = async (chainId, multicallRetry, prices = {}, tokenList
94079
94207
  // (`deposit(assets, receiver)`, `redeem(shares, receiver, owner)`);
94080
94208
  // the bespoke reader exists for the FRV lock, the rate blend and the
94081
94209
  // emission read, not because the standard surface is missing.
94082
- entry2.reader === "venus-hub" || // hbfUSD / pbfUSD ARE conforming 4626 — the bespoke reader exists for
94210
+ entry2.reader === "venus-hub" || // Sky stUSDS: plain 4626 legs; the reader adds the LSE-ilk debt that
94211
+ // caps the exit.
94212
+ entry2.reader === "sky-stusds" || // hbfUSD / pbfUSD ARE conforming 4626 — the bespoke reader exists for
94083
94213
  // the epoch ledger and the share-denominated supply cap, not because
94084
94214
  // the standard surface is missing. bfBTC (`bitfi-bfbtc`) is the
94085
94215
  // opposite and correctly falls through to `false`.