@1delta/margin-fetcher 5.0.163 → 5.0.165

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
@@ -11510,7 +11510,8 @@ interface AlchemixTransmuterConfig {
11510
11510
  router: string;
11511
11511
  /**
11512
11512
  * Wall-clock seconds per `block.number` increment on this chain, because
11513
- * `timeToTransmute` is in BLOCKS. Ethereum 12, OP / Base 2 — and Arbitrum
11513
+ * `timeToTransmute` is in BLOCKS. Ethereum 12, OP 2, Base 0.2 (since
11514
+ * 2026-11-05 — it was 2, and Alchemix scaled the term ×10) — and Arbitrum
11514
11515
  * 12 as well, since its `block.number` is the L1 block number (the Arbitrum
11515
11516
  * transmuters read 1,095,750, the figure Ethereum's shipped with). Pinned,
11516
11517
  * measured by the live test.
package/dist/index.js CHANGED
@@ -59724,7 +59724,7 @@ var ROWS = [
59724
59724
  underlyingToken: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
59725
59725
  underlyingDecimals: 6,
59726
59726
  router: "0x720d1f945279a6d82eedcc9b7f85767279ea2f96",
59727
- secondsPerBlock: 2,
59727
+ secondsPerBlock: 0.2,
59728
59728
  quote: VELO(AERO_ROUTER, AERO_FACTORY, K_ALUSD)
59729
59729
  },
59730
59730
  termSeconds: 1209600 * 2,
@@ -93626,6 +93626,8 @@ var readerAccountableVault = (entry2) => {
93626
93626
  // src/vaults/savings/readers/alchemixTransmuter.ts
93627
93627
  var SECONDS_PER_YEAR24 = 31536e3;
93628
93628
  var UNCAPPED_FLOOR = 2n ** 200n;
93629
+ var MARGINAL_DIVISOR = 1000n;
93630
+ var MAX_DEPTH_IMPACT_BPS = 200n;
93629
93631
  var pow10 = (n) => 10n ** BigInt(n);
93630
93632
  var readerAlchemixTransmuter = (entry2) => {
93631
93633
  const cfg = entry2.alchemixTransmuter;
@@ -93634,11 +93636,11 @@ var readerAlchemixTransmuter = (entry2) => {
93634
93636
  `alchemix-transmuter entry ${entry2.address} has no alchemixTransmuter pins`
93635
93637
  );
93636
93638
  const q = cfg.quote;
93637
- const quoteCall = q.kind === "curve-ng" ? { address: q.pool, name: "get_dy", params: [q.i, q.j, q.unit] } : {
93639
+ const quoteCall = (amount5) => q.kind === "curve-ng" ? { address: q.pool, name: "get_dy", params: [q.i, q.j, amount5] } : {
93638
93640
  address: q.router,
93639
93641
  name: "getAmountsOut",
93640
93642
  params: [
93641
- q.unit,
93643
+ amount5,
93642
93644
  [
93643
93645
  {
93644
93646
  from: entry2.underlying,
@@ -93650,6 +93652,7 @@ var readerAlchemixTransmuter = (entry2) => {
93650
93652
  ]
93651
93653
  };
93652
93654
  const quoteAbi = q.kind === "curve-ng" ? CurveGetDyAbi : VeloRouterGetAmountsOutAbi;
93655
+ const marginalUnit = q.unit / MARGINAL_DIVISOR;
93653
93656
  return {
93654
93657
  calls: [
93655
93658
  { address: entry2.address, name: "totalLocked", params: [] },
@@ -93659,8 +93662,9 @@ var readerAlchemixTransmuter = (entry2) => {
93659
93662
  { address: entry2.address, name: "exitFee", params: [] },
93660
93663
  { address: entry2.address, name: "transmutationFee", params: [] },
93661
93664
  { address: cfg.alchemist, name: "totalSyntheticsIssued", params: [] },
93662
- quoteCall,
93663
- { address: entry2.address, name: "totalSupply", params: [] }
93665
+ quoteCall(q.unit),
93666
+ { address: entry2.address, name: "totalSupply", params: [] },
93667
+ quoteCall(marginalUnit)
93664
93668
  ],
93665
93669
  abis: [
93666
93670
  TransmuterTotalLockedAbi,
@@ -93671,7 +93675,8 @@ var readerAlchemixTransmuter = (entry2) => {
93671
93675
  TransmuterTransmutationFeeAbi,
93672
93676
  AlchemistTotalSyntheticsIssuedAbi,
93673
93677
  quoteAbi,
93674
- TransmuterTotalSupplyAbi
93678
+ TransmuterTotalSupplyAbi,
93679
+ quoteAbi
93675
93680
  ],
93676
93681
  parse: ([
93677
93682
  lockedRaw,
@@ -93681,7 +93686,9 @@ var readerAlchemixTransmuter = (entry2) => {
93681
93686
  exitFeeRaw,
93682
93687
  tfRaw,
93683
93688
  issuedRaw,
93684
- quoteRaw
93689
+ quoteRaw,
93690
+ _supplyRaw,
93691
+ marginalRaw
93685
93692
  ]) => {
93686
93693
  const totalLocked = toBigInt16(lockedRaw);
93687
93694
  const term = toBigInt16(termRaw);
@@ -93695,12 +93702,17 @@ var readerAlchemixTransmuter = (entry2) => {
93695
93702
  const capLeg = cap !== void 0 && active !== void 0 && cap < UNCAPPED_FLOOR ? cap > active ? cap - active : 0n : void 0;
93696
93703
  const issuedLeg = issued !== void 0 ? issued > totalLocked ? issued - totalLocked : 0n : void 0;
93697
93704
  const depositCapacity = capLeg !== void 0 && issuedLeg !== void 0 ? capLeg < issuedLeg ? capLeg : issuedLeg : capLeg ?? issuedLeg;
93698
- const termSeconds = Number(term) * cfg.secondsPerBlock;
93699
- const out = q.kind === "curve-ng" ? toBigInt16(quoteRaw) : Array.isArray(quoteRaw) ? toBigInt16(quoteRaw[quoteRaw.length - 1]) : void 0;
93700
- const price1e18 = out !== void 0 && out > 0n ? out * ONE_E1823 * pow10(18 - cfg.underlyingDecimals) / q.unit : void 0;
93705
+ const termSeconds = Math.round(Number(term) * cfg.secondsPerBlock);
93706
+ const priceOf2 = (raw, amount5) => {
93707
+ const out = q.kind === "curve-ng" ? toBigInt16(raw) : Array.isArray(raw) ? toBigInt16(raw[raw.length - 1]) : void 0;
93708
+ return out !== void 0 && out > 0n && amount5 > 0n ? out * ONE_E1823 * pow10(18 - cfg.underlyingDecimals) / amount5 : void 0;
93709
+ };
93710
+ const sizedPrice = priceOf2(quoteRaw, q.unit);
93711
+ const price1e18 = priceOf2(marginalRaw, marginalUnit);
93712
+ const deep = price1e18 !== void 0 && sizedPrice !== void 0 && (price1e18 - sizedPrice) * 10000n <= price1e18 * MAX_DEPTH_IMPACT_BPS;
93701
93713
  const marketDiscountBps = price1e18 !== void 0 ? Number((price1e18 - ONE_E1823) * 100000n / ONE_E1823) / 10 : void 0;
93702
93714
  const tf = transmutationFee !== void 0 ? Number(transmutationFee) / 1e4 : 0;
93703
- const supplyRate = price1e18 !== void 0 && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR24 / termSeconds) * 100 : void 0;
93715
+ const supplyRate = price1e18 !== void 0 && deep && termSeconds > 0 ? ((1 - tf) / (Number(price1e18) / 1e18) - 1) * (SECONDS_PER_YEAR24 / termSeconds) * 100 : void 0;
93704
93716
  const exitFeeBps = exitFee !== void 0 ? Number(exitFee) : void 0;
93705
93717
  const exitRoutes = [
93706
93718
  {
@@ -94543,7 +94555,7 @@ async function readTransmuterLots(multicallRetry, chainId, account, counted) {
94543
94555
  startBlock: Number(start),
94544
94556
  maturationBlock: Number(end),
94545
94557
  blocksToMaturity: Number(blocksLeft),
94546
- ...spb !== void 0 ? { secondsToMaturity: Number(blocksLeft) * spb } : {}
94558
+ ...spb !== void 0 ? { secondsToMaturity: Math.round(Number(blocksLeft) * spb) } : {}
94547
94559
  });
94548
94560
  });
94549
94561
  return out;
@@ -100343,6 +100355,11 @@ var SVM_SAVINGS_CURATION = {
100343
100355
  solvency: "nav-attested",
100344
100356
  description: "ONyc is a share of OnRe\u2019s Bermuda reinsurance fund: the fund writes reinsurance contracts and holds stablecoin collateral against them, and the premiums plus the collateral\u2019s yield accrue as a rising dollar NAV per ONyc. This is REINSURANCE risk, not a dollar deposit: a catastrophe the contracts cover (a hurricane, an earthquake) is paid out of the fund and writes the NAV down, and the NAV is OnRe\u2019s own published figure over an off-chain book. OnRe keeps a freeze authority over the token. ONyc is minted at OnRe\u2019s offer price on chain; it exits by selling into OnRe\u2019s USDG pool (instant, a fee plus a haircut that grows with the order\u2019s size and the day\u2019s selling, capped by what the pool holds) or by a redemption request OnRe\u2019s operator fulfils at its later NAV less a fee, paid straight to the wallet \u2014 OnRe publishes no time for that."
100345
100357
  },
100358
+ // Hylo xONYC — the levercoin of Hylo's ONyc exo pair (margin-fetcher-sol `HYLO_XONYC_DESCRIPTION`)
100359
+ BzaYb37TkhSMW8d7Xfa1zB697NWZdRG9DGWesdiYs5qA: {
100360
+ solvency: "nav-attested",
100361
+ description: "xONYC is the leveraged side of Hylo\u2019s ONyc pair: the pair holds OnRe ONyc and owes a hyUSD claim against part of it, and xONYC owns everything above that claim, so its dollar NAV moves about 2\u20133\xD7 ONyc\u2019s (the leverage floats with the pair\u2019s collateral ratio and Hylo rebalances it). The yield is ONyc\u2019s reinsurance yield on the whole collateral less a borrow rate on xONYC\u2019s market cap that Hylo pays to the eHYUSD earn pool each epoch \u2014 and the losses are levered the same way: a reinsurance write-down of ONyc\u2019s NAV (OnRe\u2019s own figure, relayed by Pyth) hits xONYC 2\u20133\xD7 as hard, and below a 1.0 collateral ratio the pair stops minting and redeeming. Minting takes ONyc and redeeming pays ONyc, both in the same transaction at the pair\u2019s NAV less a fee that rises when the pair is under-collateralized; minting is capped by a market-cap limit."
100362
+ },
100346
100363
  // Perena USD* — the vault NAV over off-chain + on-chain venues (margin-fetcher-sol `PERENA_USD_STAR_MECHANICS`)
100347
100364
  star9agSpjiFe3M49B3RniVU4CMBBEK3Qnaqn3RGiFM: {
100348
100365
  solvency: "nav-attested",
@@ -107026,6 +107043,20 @@ var SVM_EARN_VAULT_BUILDERS = {
107026
107043
  cancel: ["requestId"]
107027
107044
  }
107028
107045
  },
107046
+ // Hylo xYIELD levercoins (xONYC; calldata-sdk-sol `ComposerHyloExoActions`):
107047
+ // deposit = mint_levercoin_exo from the COLLATERAL (ONyc), withdraw BY
107048
+ // SHARES = redeem_levercoin_exo into ONyc, both in the transaction
107049
+ "savings:Hylo": {
107050
+ verbs: ["deposit", "withdraw"],
107051
+ depositInputs: [
107052
+ {
107053
+ asset: "5Y8NV33Vv7WbnLfq3zBcKSdYPrk7g2KoiQoe7M2tcxp5",
107054
+ symbol: "ONyc",
107055
+ mode: "direct"
107056
+ }
107057
+ ],
107058
+ requires: { withdraw: SHARES }
107059
+ },
107029
107060
  // JLP: the pool's own mint / burn from / into a custody token — the burn
107030
107061
  // by SHARES (the JLP a USD amount needs is only known at the block)
107031
107062
  "savings:Jupiter": {
@@ -107197,6 +107228,8 @@ var SVM_EARN_MINT_BUILDERS = {
107197
107228
  "59obFNBzyTBGowrkif5uK7ojS58vsuWz3ZCvg6tfZAGw": "savings:Huma",
107198
107229
  // OnRe ONyc
107199
107230
  "5Y8NV33Vv7WbnLfq3zBcKSdYPrk7g2KoiQoe7M2tcxp5": "savings:OnRe",
107231
+ // Hylo xONYC (the levercoin of the ONyc exo pair)
107232
+ BzaYb37TkhSMW8d7Xfa1zB697NWZdRG9DGWesdiYs5qA: "savings:Hylo",
107200
107233
  // JLP
107201
107234
  "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4": "savings:Jupiter",
107202
107235
  // Perena USD*-J (the junior tranche has a queued exit the other classes lack)