@gearbox-protocol/sdk 18.6.0-next.1 → 18.6.0-next.3

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.
Files changed (172) hide show
  1. package/dist/cjs/abi/signatureDegenNFT.js +14 -0
  2. package/dist/cjs/model/index.js +5 -2
  3. package/dist/cjs/model/openingApproval.js +1 -0
  4. package/dist/cjs/model/openingApproval.schema.js +17 -0
  5. package/dist/cjs/offchain/AbstractOffchainNamespace.js +6 -16
  6. package/dist/cjs/offchain/errors/OpeningSignerConfigurationError.js +7 -0
  7. package/dist/cjs/offchain/errors/OpeningSignerError.js +39 -0
  8. package/dist/cjs/offchain/errors/OpeningSignerQuorumError.js +12 -0
  9. package/dist/cjs/offchain/errors/OpeningSignerVerificationError.js +18 -0
  10. package/dist/cjs/offchain/errors/index.js +12 -0
  11. package/dist/cjs/offchain/index.js +16 -0
  12. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +9 -0
  13. package/dist/cjs/offchain/opportunities/index.js +4 -0
  14. package/dist/cjs/offchain/opportunities/openingApproval.js +141 -0
  15. package/dist/cjs/offchain/opportunities/openingSignerRegistries.js +12 -0
  16. package/dist/cjs/offchain/transport.js +21 -0
  17. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +20 -3
  18. package/dist/cjs/onchain/accounts/openingApproval.js +72 -0
  19. package/dist/cjs/onchain/index.js +3 -0
  20. package/dist/cjs/onchain/market/credit/CreditFacadeV310BaseContract.js +6 -2
  21. package/dist/cjs/onchain/market/credit/CreditFacadeV310Contract.js +14 -1
  22. package/dist/cjs/onchain/market/credit/CreditSuite.js +4 -2
  23. package/dist/cjs/onchain/market/credit/errors.js +18 -0
  24. package/dist/cjs/onchain/market/credit/index.js +3 -0
  25. package/dist/cjs/onchain/market/index.js +3 -0
  26. package/dist/cjs/onchain/preview/parse/parseFacadeOperationCalldata.js +1 -0
  27. package/dist/cjs/permissionless/api/GearboxPermissionless.js +3 -2
  28. package/dist/cjs/permissionless/api/analytics/PermissionlessAnalytics.js +20 -0
  29. package/dist/cjs/permissionless/api/analytics/schemas.js +3 -0
  30. package/dist/cjs/permissionless/api/transactions/InstanceOwnerTransactions.js +71 -17
  31. package/dist/cjs/permissionless/api/transactions/fixedRateWindowFeeds.js +134 -0
  32. package/dist/cjs/permissionless/api/transactions/lp-price-feeds.js +10 -35
  33. package/dist/cjs/permissionless/api/transactions/nextLowerBound.js +18 -0
  34. package/dist/cjs/sdk/execute/ExecuteApi.js +20 -3
  35. package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +1 -1
  36. package/dist/esm/abi/signatureDegenNFT.js +11 -0
  37. package/dist/esm/dev/RevolverTransport.js +1 -1
  38. package/dist/esm/dev/resilientTransport.js +1 -1
  39. package/dist/esm/dev/withdrawalUtils.js +1 -1
  40. package/dist/esm/model/analytics.schema.js +1 -1
  41. package/dist/esm/model/index.js +6 -4
  42. package/dist/esm/model/openingApproval.js +1 -0
  43. package/dist/esm/model/openingApproval.schema.js +16 -0
  44. package/dist/esm/offchain/AbstractOffchainNamespace.js +6 -16
  45. package/dist/esm/offchain/errors/OffchainValidationError.js +1 -1
  46. package/dist/esm/offchain/errors/OpeningSignerConfigurationError.js +6 -0
  47. package/dist/esm/offchain/errors/OpeningSignerError.js +34 -0
  48. package/dist/esm/offchain/errors/OpeningSignerQuorumError.js +11 -0
  49. package/dist/esm/offchain/errors/OpeningSignerVerificationError.js +17 -0
  50. package/dist/esm/offchain/errors/index.js +5 -1
  51. package/dist/esm/offchain/index.js +7 -1
  52. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +9 -0
  53. package/dist/esm/offchain/opportunities/index.js +4 -1
  54. package/dist/esm/offchain/opportunities/openingApproval.js +140 -0
  55. package/dist/esm/offchain/opportunities/openingSignerRegistries.js +11 -0
  56. package/dist/esm/offchain/transport.js +19 -0
  57. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +24 -7
  58. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +6 -6
  59. package/dist/esm/onchain/accounts/openingApproval.js +71 -0
  60. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +2 -2
  61. package/dist/esm/onchain/base/TokensMeta.js +4 -4
  62. package/dist/esm/onchain/chain/chains.js +1 -1
  63. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  64. package/dist/esm/onchain/index.js +3 -2
  65. package/dist/esm/onchain/market/MarketSuite.js +1 -1
  66. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  67. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +7 -3
  68. package/dist/esm/onchain/market/credit/CreditFacadeV310Contract.js +14 -1
  69. package/dist/esm/onchain/market/credit/CreditSuite.js +4 -2
  70. package/dist/esm/onchain/market/credit/errors.js +16 -0
  71. package/dist/esm/onchain/market/credit/index.js +2 -1
  72. package/dist/esm/onchain/market/index.js +2 -1
  73. package/dist/esm/onchain/market/pool/PoolV310Contract.js +3 -3
  74. package/dist/esm/onchain/market/rwa/RWARegistry.js +1 -1
  75. package/dist/esm/onchain/market/rwa/createDegenNFT.js +1 -1
  76. package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +1 -1
  77. package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +1 -1
  78. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +1 -1
  79. package/dist/esm/onchain/market/zapper/ZapperContract.js +2 -2
  80. package/dist/esm/onchain/positions/PositionsService.js +1 -1
  81. package/dist/esm/onchain/preview/parse/parseFacadeOperationCalldata.js +1 -0
  82. package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +1 -1
  83. package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +1 -1
  84. package/dist/esm/onchain/utils/zod.js +1 -1
  85. package/dist/esm/permissionless/api/GearboxPermissionless.js +3 -2
  86. package/dist/esm/permissionless/api/analytics/PermissionlessAnalytics.js +21 -1
  87. package/dist/esm/permissionless/api/analytics/schemas.js +3 -1
  88. package/dist/esm/permissionless/api/configurators/schemas.js +1 -1
  89. package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +2 -2
  90. package/dist/esm/permissionless/api/schemas.js +1 -1
  91. package/dist/esm/permissionless/api/transactions/InstanceOwnerTransactions.js +71 -17
  92. package/dist/esm/permissionless/api/transactions/fixedRateWindowFeeds.js +131 -0
  93. package/dist/esm/permissionless/api/transactions/lp-price-feeds.js +10 -34
  94. package/dist/esm/permissionless/api/transactions/nextLowerBound.js +17 -0
  95. package/dist/esm/permissionless/curator/actions/addAssetActionData.js +1 -1
  96. package/dist/esm/permissionless/curator/actions/addCollateralTokenActionData.js +1 -1
  97. package/dist/esm/permissionless/curator/actions/addPeripheryContractActionData.js +1 -1
  98. package/dist/esm/permissionless/curator/actions/createCreditSuiteActionData.js +1 -1
  99. package/dist/esm/permissionless/curator/actions/createMarketActionData.js +1 -1
  100. package/dist/esm/permissionless/curator/actions/creditManagerTargets.js +1 -1
  101. package/dist/esm/permissionless/curator/actions/deployContractActionData.js +1 -1
  102. package/dist/esm/permissionless/curator/actions/setPriceFeedActionData.js +1 -1
  103. package/dist/esm/permissionless/curator/actions/utils/rawAmounts.js +1 -1
  104. package/dist/esm/permissionless/curator/configurator-actions/setDefaultSplitActionData.js +1 -1
  105. package/dist/esm/permissionless/curator/plugins/adapters/adapterPluginHelpers.js +1 -1
  106. package/dist/esm/permissionless/curator/plugins/adapters/curve-v1/getCurveV1Plugin.js +1 -1
  107. package/dist/esm/permissionless/curator/plugins/adapters/curve-v1-steth/curveV1StETHPlugin.js +1 -1
  108. package/dist/esm/permissionless/curator/plugins/adapters/erc4626/erc4626AdapterPlugin.js +1 -1
  109. package/dist/esm/permissionless/curator/plugins/adapters/erc4626-referral/erc4626ReferralAdapterPlugin.js +1 -1
  110. package/dist/esm/permissionless/curator/plugins/adapters/mellow-erc4626/mellowErc4626AdapterPlugin.js +1 -1
  111. package/dist/esm/permissionless/curator/plugins/adapters/mellow-wrapper/mellowWrapperAdapterPlugin.js +1 -1
  112. package/dist/esm/permissionless/curator/plugins/adapters/midas-gateway/midasGatewayAdapterPlugin.js +1 -1
  113. package/dist/esm/permissionless/curator/plugins/adapters/midas-issuance/midasIssuanceAdapterPlugin.js +1 -1
  114. package/dist/esm/permissionless/curator/plugins/adapters/midas-redemption/midasRedemptionAdapterPlugin.js +1 -1
  115. package/dist/esm/permissionless/curator/plugins/adapters/securitize-redemption/securitizeRedemptionAdapterPlugin.js +1 -1
  116. package/dist/esm/permissionless/curator/plugins/adapters/staking-rewards/stakingRewardsPlugin.js +1 -1
  117. package/dist/esm/permissionless/curator/plugins/irm/linear/linearPlugin.js +1 -1
  118. package/dist/esm/permissionless/curator/plugins/loss-policies/alias/actions/setAliasActionData.js +1 -1
  119. package/dist/esm/permissionless/curator/plugins/loss-policies/alias/aliasedLossPolicyPlugin.js +1 -1
  120. package/dist/esm/permissionless/curator/plugins/rate-keepers/gauge/gaugePlugin.js +1 -1
  121. package/dist/esm/permissionless/curator/plugins/rate-keepers/tumbler/tumblerPlugin.js +1 -1
  122. package/dist/esm/permissionless/curator/rwaPeripherySetup.js +1 -1
  123. package/dist/esm/permissionless/curator/state/configurator/types.js +1 -1
  124. package/dist/esm/permissionless/curator/validationSchemas.js +1 -1
  125. package/dist/esm/sdk/GearboxSDK.js +2 -2
  126. package/dist/esm/sdk/execute/ExecuteApi.js +21 -4
  127. package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +1 -1
  128. package/dist/types/abi/signatureDegenNFT.d.ts +91 -0
  129. package/dist/types/model/index.d.ts +3 -1
  130. package/dist/types/model/openingApproval.d.ts +33 -0
  131. package/dist/types/model/openingApproval.schema.d.ts +11 -0
  132. package/dist/types/offchain/errors/OpeningSignerConfigurationError.d.ts +4 -0
  133. package/dist/types/offchain/errors/OpeningSignerError.d.ts +24 -0
  134. package/dist/types/offchain/errors/OpeningSignerQuorumError.d.ts +6 -0
  135. package/dist/types/offchain/errors/OpeningSignerVerificationError.d.ts +8 -0
  136. package/dist/types/offchain/errors/index.d.ts +5 -1
  137. package/dist/types/offchain/index.d.ts +8 -2
  138. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +2 -0
  139. package/dist/types/offchain/opportunities/index.d.ts +3 -1
  140. package/dist/types/offchain/opportunities/openingApproval.d.ts +3 -0
  141. package/dist/types/offchain/opportunities/openingSignerRegistries.d.ts +3 -0
  142. package/dist/types/offchain/opportunities/types.d.ts +2 -0
  143. package/dist/types/offchain/transport.d.ts +2 -0
  144. package/dist/types/offchain/types.d.ts +12 -0
  145. package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +4 -1
  146. package/dist/types/onchain/accounts/liquidations/types.d.ts +3 -3
  147. package/dist/types/onchain/accounts/openingApproval.d.ts +4 -0
  148. package/dist/types/onchain/accounts/types.d.ts +4 -0
  149. package/dist/types/onchain/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +2 -2
  150. package/dist/types/onchain/index.d.ts +2 -1
  151. package/dist/types/onchain/market/credit/CreditFacadeV310BaseContract.d.ts +28 -0
  152. package/dist/types/onchain/market/credit/CreditFacadeV310Contract.d.ts +1 -1
  153. package/dist/types/onchain/market/credit/CreditSuite.d.ts +2 -2
  154. package/dist/types/onchain/market/credit/errors.d.ts +11 -0
  155. package/dist/types/onchain/market/credit/index.d.ts +2 -1
  156. package/dist/types/onchain/market/credit/types.d.ts +1 -1
  157. package/dist/types/onchain/market/index.d.ts +2 -1
  158. package/dist/types/onchain/preview/parse/types-facades.d.ts +1 -0
  159. package/dist/types/permissionless/api/GearboxPermissionless.d.ts +2 -1
  160. package/dist/types/permissionless/api/analytics/PermissionlessAnalytics.d.ts +12 -1
  161. package/dist/types/permissionless/api/analytics/index.d.ts +2 -2
  162. package/dist/types/permissionless/api/analytics/schemas.d.ts +4 -0
  163. package/dist/types/permissionless/api/analytics/types.d.ts +29 -0
  164. package/dist/types/permissionless/api/index.d.ts +2 -2
  165. package/dist/types/permissionless/api/transactions/InstanceOwnerTransactions.d.ts +16 -9
  166. package/dist/types/permissionless/api/transactions/fixedRateWindowFeeds.d.ts +38 -0
  167. package/dist/types/permissionless/api/transactions/lp-price-feeds.d.ts +4 -6
  168. package/dist/types/permissionless/api/transactions/nextLowerBound.d.ts +15 -0
  169. package/dist/types/permissionless/index.d.ts +2 -2
  170. package/dist/types/sdk/execute/ExecuteApi.d.ts +2 -1
  171. package/dist/types/sdk/execute/types.d.ts +8 -1
  172. package/package.json +1 -1
@@ -56,7 +56,8 @@ var GearboxPermissionless = class {
56
56
  **/
57
57
  analytics;
58
58
  /**
59
- * Namespace for the Safe batches an instance owner executes. Backend-free,
59
+ * Namespace for the Safe batches an instance owner executes. Backend-free
60
+ * except for the realized rates of fixed-rate windows,
60
61
  * see {@link InstanceOwnerTransactions}.
61
62
  **/
62
63
  transactions;
@@ -75,7 +76,7 @@ var GearboxPermissionless = class {
75
76
  this.oracles = new PermissionlessOracles(options, this.chains);
76
77
  this.configurators = new PermissionlessConfigurators(options, this.chains);
77
78
  this.analytics = new PermissionlessAnalytics(options);
78
- this.transactions = new InstanceOwnerTransactions(this.chains, this.oracles);
79
+ this.transactions = new InstanceOwnerTransactions(this.chains, this.oracles, this.analytics);
79
80
  this.deploy = new PermissionlessDeploy(this.chains);
80
81
  this.curator = new PermissionlessCurator(this.chains);
81
82
  }
@@ -1,5 +1,5 @@
1
1
  import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
2
- import { priceFeedChartSchema } from "./schemas.js";
2
+ import { priceFeedChartSchema, priceFeedRealizedRateSchema } from "./schemas.js";
3
3
  // src/permissionless/api/analytics/PermissionlessAnalytics.ts
4
4
  /**
5
5
  * History of the permissionless stack: what a thing did, rather than what it
@@ -44,5 +44,25 @@ var PermissionlessAnalytics = class extends AbstractOffchainNamespace {
44
44
  schema: priceFeedChartSchema
45
45
  });
46
46
  }
47
+ /**
48
+ * The rate one feed's price grew at between its latest print and the newest
49
+ * print at least `minSpanSeconds` before it.
50
+ *
51
+ * Backend-only for the same reason as {@link priceChart}: finding the prints
52
+ * takes the feed's history.
53
+ *
54
+ * @throws When the PriceFeedStore does not carry the feed, see
55
+ * {@link priceChart}.
56
+ **/
57
+ async realizedRate({ chainId, address, minSpanSeconds, maxPrintGapSeconds }) {
58
+ return this.getData({
59
+ path: `/pfs/${chainId}/price-feed/${address}/realized-rate`,
60
+ query: {
61
+ minSpanSeconds: minSpanSeconds?.toString(),
62
+ maxPrintGapSeconds: maxPrintGapSeconds?.toString()
63
+ },
64
+ schema: priceFeedRealizedRateSchema
65
+ });
66
+ }
47
67
  };
48
68
  export { PermissionlessAnalytics };
@@ -21,4 +21,6 @@ const priceFeedChartSchema = z.looseObject({
21
21
  intervalSeconds: z.number(),
22
22
  points: z.array(priceFeedChartPointSchema)
23
23
  });
24
- export { priceFeedChartPointSchema, priceFeedChartSchema };
24
+ /** {@link PriceFeedRealizedRate} */
25
+ const priceFeedRealizedRateSchema = z.looseObject({ rate: z.number().nullable() });
26
+ export { priceFeedChartPointSchema, priceFeedChartSchema, priceFeedRealizedRateSchema };
@@ -1,6 +1,6 @@
1
1
  import { addressSchema } from "../schemas.js";
2
- import { z } from "zod/v4";
3
2
  import { isHex } from "viem";
3
+ import { z } from "zod/v4";
4
4
  // src/permissionless/api/configurators/schemas.ts
5
5
  /** A `0x`-prefixed hex string, as viem's `Hex`. */
6
6
  const hexSchema = z.custom((value) => typeof value === "string" && isHex(value), { message: "invalid hex string" });
@@ -1,8 +1,8 @@
1
+ import { getAssetType, getNetworkType, isRWAToken, isSupportedNetwork } from "../../../onchain/chain/chains.js";
2
+ import { AP_PRICE_FEED_COMPRESSOR } from "../../../onchain/constants/address-provider.js";
1
3
  import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
2
4
  import { priceFeedDataSchema } from "../../../model/opportunities.schema.js";
3
5
  import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
4
- import { getAssetType, getNetworkType, isRWAToken, isSupportedNetwork } from "../../../onchain/chain/chains.js";
5
- import { AP_PRICE_FEED_COMPRESSOR } from "../../../onchain/constants/address-provider.js";
6
6
  import { OffchainStatusError } from "../../../offchain/errors/OffchainStatusError.js";
7
7
  import "../../../onchain/index.js";
8
8
  import { AddressProviderContract } from "../../bindings/address-provider.js";
@@ -1,5 +1,5 @@
1
- import { z } from "zod/v4";
2
1
  import { isAddress } from "viem";
2
+ import { z } from "zod/v4";
3
3
  // src/permissionless/api/schemas.ts
4
4
  /**
5
5
  * Runtime schemas shared by the {@link GearboxPermissionless} namespaces.
@@ -3,6 +3,7 @@ import { getNetworkType } from "../../../onchain/chain/chains.js";
3
3
  import { AP_PRICE_FEED_COMPRESSOR } from "../../../onchain/constants/address-provider.js";
4
4
  import { VERSION_RANGE_310 } from "../../../onchain/constants/versions.js";
5
5
  import { ChainContractsRegister } from "../../../onchain/base/ChainContractsRegister.js";
6
+ import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
6
7
  import { OnchainSDK } from "../../../onchain/OnchainSDK.js";
7
8
  import "../../../onchain/index.js";
8
9
  import { InstanceManagerContract } from "../../bindings/instance-manager.js";
@@ -11,20 +12,26 @@ import "../../deployment/addresses.js";
11
12
  import { convertRawTxToSafeMultisigTx, getSafeBatch } from "../../utils/governance/batch.js";
12
13
  import { getUpdatablePriceFeeds } from "../../utils/price-update/get-updatable-feeds.js";
13
14
  import { PriceFeedNotInStoreError } from "../errors.js";
15
+ import { getFixedRateWindowFeeds, rateWindowContext, updateRateAndBounds } from "./fixedRateWindowFeeds.js";
14
16
  import { getFeedsToUpdate, updateBounds } from "./lp-price-feeds.js";
17
+ import { decodeFunctionResult, encodeFunctionData } from "viem";
15
18
  // src/permissionless/api/transactions/InstanceOwnerTransactions.ts
16
19
  const lower = (value) => value.toLowerCase();
17
20
  /**
18
21
  * The Safe batches an instance owner executes to apply what a curator
19
22
  * prepared: adding their private feeds to the PriceFeedStore, renaming feeds,
20
- * changing staleness periods, forbidding feeds and refreshing LP bounds.
23
+ * changing staleness periods, forbidding feeds and refreshing LP bounds and
24
+ * fixed-rate windows.
21
25
  *
22
26
  * Every batch is wrapped with `wrapConfigureLocal`, so the InstanceManager is
23
27
  * the only caller the PriceFeedStore ever sees.
24
28
  *
25
- * Backend-free: a batch is built off the chain it will be executed on, and
26
- * the store it reads is the one {@link PermissionlessOracles} already
27
- * fetched. Nothing is sent either — a curator never executes these
29
+ * Backend-free but for one read: a batch is built off the chain it will be
30
+ * executed on, and the store it reads is the one {@link PermissionlessOracles}
31
+ * already fetched. The exception is the realized rate of a fixed-rate window,
32
+ * which takes the feed's price history and so comes from
33
+ * {@link PermissionlessAnalytics}; without it the window keeps its rate. Nothing
34
+ * is sent either — a curator never executes these
28
35
  * themselves. They prepare a batch and hand it to the instance owner, who
29
36
  * reviews and executes it from their Safe.
30
37
  *
@@ -40,9 +47,11 @@ const lower = (value) => value.toLowerCase();
40
47
  var InstanceOwnerTransactions = class {
41
48
  #chains;
42
49
  #oracles;
43
- constructor(chains, oracles) {
50
+ #analytics;
51
+ constructor(chains, oracles, analytics) {
44
52
  this.#chains = chains;
45
53
  this.#oracles = oracles;
54
+ this.#analytics = analytics;
46
55
  }
47
56
  /**
48
57
  * The batch that adds the named feeds to the store and allows the named
@@ -128,27 +137,51 @@ var InstanceOwnerTransactions = class {
128
137
  }
129
138
  /**
130
139
  * The batch that pulls every drifted LP feed's lower bound back under its
131
- * exchange rate. Unlike the others this takes no input: the whole store is
132
- * scanned and only the feeds that drifted produce a transaction, so this
133
- * one is slow.
140
+ * exchange rate, and every drifted fixed-rate window back around its
141
+ * underlying price, resetting the window's growth rate when the realized
142
+ * one moved away from it. Unlike the others this takes no input: the whole
143
+ * store is scanned and only the feeds that drifted produce a transaction,
144
+ * so this one is slow.
134
145
  **/
135
- async updateBounds({ chainId, owner }) {
146
+ async updateBoundsAndRates({ chainId, owner }) {
136
147
  const batch = await this.#batchContext(chainId);
137
- const pfCompressor = await this.#priceFeedCompressor(batch.client);
138
148
  const known = await batch.store.getKnownPriceFeeds();
139
149
  const isKnown = new Set(known.map(lower));
140
- const feeds = await getFeedsToUpdate(batch.client, pfCompressor, known);
150
+ const trees = await this.#loadPriceFeedTrees(batch.client, known);
151
+ const lpFeeds = await getFeedsToUpdate(batch.client, trees);
152
+ const windowFeeds = getFixedRateWindowFeeds(trees);
153
+ const windowContext = await rateWindowContext(batch.client, async (feed, lookbackSeconds) => {
154
+ const { rate } = await this.#analytics.realizedRate({
155
+ chainId,
156
+ address: feed,
157
+ minSpanSeconds: lookbackSeconds
158
+ });
159
+ return rate;
160
+ });
161
+ const updates = [];
162
+ for (const feed of lpFeeds) updates.push({
163
+ feed,
164
+ txs: await updateBounds(batch.client, feed.address)
165
+ });
166
+ const windows = [];
167
+ for (const feed of windowFeeds) {
168
+ const txs = await updateRateAndBounds(batch.client, feed.address, windowContext);
169
+ if (txs.length > 0) windows.push(feed.address);
170
+ updates.push({
171
+ feed,
172
+ txs
173
+ });
174
+ }
141
175
  const addTxs = [];
142
176
  const added = [];
143
177
  const configureTxs = [];
144
- for (const feed of feeds) {
145
- const boundTxs = await updateBounds(batch.client, feed.address);
146
- if (boundTxs.length === 0) continue;
178
+ for (const { feed, txs } of updates) {
179
+ if (txs.length === 0) continue;
147
180
  if (!isKnown.has(feed.address)) {
148
181
  addTxs.push(batch.store.addPriceFeedTx(feed.address, 0, feed.description));
149
182
  added.push(feed.address);
150
183
  }
151
- configureTxs.push(...boundTxs);
184
+ configureTxs.push(...txs);
152
185
  }
153
186
  const txs = [...addTxs, batch.store.configurePriceFeeds(configureTxs.map((tx) => ({
154
187
  target: tx.to,
@@ -157,9 +190,9 @@ var InstanceOwnerTransactions = class {
157
190
  return this.#envelope({
158
191
  batch,
159
192
  author: owner,
160
- name: "update-bounds",
193
+ name: "update-bounds-and-rates",
161
194
  txs,
162
- touchedFeeds: added
195
+ touchedFeeds: [.../* @__PURE__ */ new Set([...added, ...windows])]
163
196
  });
164
197
  }
165
198
  /**
@@ -215,6 +248,27 @@ var InstanceOwnerTransactions = class {
215
248
  async #priceFeedCompressor(client) {
216
249
  return this.#compressorFrom(await this.#sdk(client));
217
250
  }
251
+ /**
252
+ * Every node of the feed trees behind `feeds`. The trees reach past `feeds`
253
+ * themselves, so a feed read inside one of them is among the nodes whether
254
+ * or not it is one of `feeds`.
255
+ **/
256
+ async #loadPriceFeedTrees(client, feeds) {
257
+ const { data } = await client.call({
258
+ to: await this.#priceFeedCompressor(client),
259
+ data: encodeFunctionData({
260
+ abi: priceFeedCompressorAbi,
261
+ functionName: "loadPriceFeedTree",
262
+ args: [feeds]
263
+ }),
264
+ gas: 200000000n
265
+ });
266
+ return decodeFunctionResult({
267
+ abi: priceFeedCompressorAbi,
268
+ functionName: "loadPriceFeedTree",
269
+ data: data ?? "0x"
270
+ });
271
+ }
218
272
  #compressorFrom(sdk) {
219
273
  const [compressor] = sdk.addressProvider.mustGetLatest(AP_PRICE_FEED_COMPRESSOR, VERSION_RANGE_310);
220
274
  return compressor;
@@ -0,0 +1,131 @@
1
+ import { bytes32ToString } from "../../../onchain/utils/bytes32ToString.js";
2
+ import { createRawTx } from "../../../onchain/utils/createRawTx.js";
3
+ import { PERCENTAGE_FACTOR, SECONDS_PER_YEAR } from "../../../onchain/constants/math.js";
4
+ import { simulateMulticall } from "../../../onchain/utils/viem/simulateMulticall.js";
5
+ import { fixedRateWindowPriceFeedAbi } from "../../../onchain/abi/oracles.js";
6
+ import { iPriceFeedAbi } from "../../../abi/iPriceFeed.js";
7
+ import "../../../onchain/abi/index.js";
8
+ import "../../../onchain/index.js";
9
+ import { nextLowerBound } from "./nextLowerBound.js";
10
+ // src/permissionless/api/transactions/fixedRateWindowFeeds.ts
11
+ const FIXED_RATE_WINDOW = "PRICE_FEED::FIXED_RATE_WINDOW";
12
+ /**
13
+ * Minimum span the realized rate is measured over. A feed whose underlying
14
+ * may go longer than this without printing is measured over its staleness
15
+ * period instead, so that the span still holds several prints.
16
+ **/
17
+ const MIN_RATE_LOOKBACK = 2592e3;
18
+ /**
19
+ * How far, in percent of the current rate, the realized rate has to differ
20
+ * before the rate is reset along with the bounds.
21
+ **/
22
+ const RATE_DEVIATION_PERCENT = 10;
23
+ /** Of the feed tree nodes, the ones that are fixed-rate window feeds. */
24
+ function getFixedRateWindowFeeds(trees) {
25
+ const feeds = /* @__PURE__ */ new Map();
26
+ for (const node of trees) if (bytes32ToString(node.baseParams.contractType) === FIXED_RATE_WINDOW) feeds.set(node.baseParams.addr.toLowerCase(), node.description);
27
+ return Array.from(feeds, ([address, description]) => ({
28
+ address,
29
+ description
30
+ }));
31
+ }
32
+ /** Pins the batch to the latest block. */
33
+ async function rateWindowContext(client, realizedRate) {
34
+ const block = await client.getBlock();
35
+ return {
36
+ blockNumber: block.number,
37
+ now: block.timestamp,
38
+ realizedRate
39
+ };
40
+ }
41
+ /**
42
+ * Moves a fixed-rate window feed's lower bound back under its underlying
43
+ * price, by the same rule LP feeds follow. When the bound moves, the growth
44
+ * rate is reset too if the rate the price realized differs from it by more
45
+ * than {@link RATE_DEVIATION_PERCENT}. Returns nothing when the bound still
46
+ * fits.
47
+ *
48
+ * The realized rate is measured on the window feed's own history rather than
49
+ * the underlying's: only the store's feeds are indexed, which the underlying
50
+ * usually is not, and inside the window the two prices are the same.
51
+ **/
52
+ async function updateRateAndBounds(client, address, context) {
53
+ const { results } = await simulateMulticall(client, {
54
+ contracts: [
55
+ {
56
+ address,
57
+ abi: fixedRateWindowPriceFeedAbi,
58
+ functionName: "priceFeed"
59
+ },
60
+ {
61
+ address,
62
+ abi: fixedRateWindowPriceFeedAbi,
63
+ functionName: "stalenessPeriod"
64
+ },
65
+ {
66
+ address,
67
+ abi: fixedRateWindowPriceFeedAbi,
68
+ functionName: "growthRate"
69
+ },
70
+ {
71
+ address,
72
+ abi: fixedRateWindowPriceFeedAbi,
73
+ functionName: "lowerBoundBase"
74
+ },
75
+ {
76
+ address,
77
+ abi: fixedRateWindowPriceFeedAbi,
78
+ functionName: "timestampLU"
79
+ },
80
+ {
81
+ address,
82
+ abi: fixedRateWindowPriceFeedAbi,
83
+ functionName: "maxGrowthRate"
84
+ }
85
+ ],
86
+ allowFailure: false,
87
+ blockNumber: context.blockNumber
88
+ });
89
+ const [underlying, stalenessPeriod, growthRate, lowerBoundBase, timestampLU, maxGrowthRate] = results;
90
+ const [, value] = await client.readContract({
91
+ abi: iPriceFeedAbi,
92
+ address: underlying,
93
+ functionName: "latestRoundData",
94
+ blockNumber: context.blockNumber
95
+ });
96
+ const next = nextLowerBound(value, currentLowerBound(lowerBoundBase, growthRate, timestampLU, context.now));
97
+ if (!next) return [];
98
+ let rate = growthRate;
99
+ let rateNote;
100
+ try {
101
+ const realized = await context.realizedRate(address, Math.max(MIN_RATE_LOOKBACK, stalenessPeriod));
102
+ if (realized === null) rateNote = "realized rate unavailable, rate kept";
103
+ else {
104
+ const realizedBps = Math.round(realized * Number(PERCENTAGE_FACTOR));
105
+ rate = nextRate(growthRate, realizedBps, maxGrowthRate);
106
+ rateNote = `realized rate: ${realizedBps} bps`;
107
+ }
108
+ } catch (error) {
109
+ rateNote = `realized rate unavailable (${error instanceof Error ? error.message : String(error)}), rate kept`;
110
+ }
111
+ return [createRawTx(address, {
112
+ abi: fixedRateWindowPriceFeedAbi,
113
+ functionName: "setRateAndBounds",
114
+ args: [rate, next.lowerBound]
115
+ }, `[${address}].setRateAndBounds(${rate}, ${next.lowerBound}); // deviationFromValue: ${(100 * next.deviationFromValue).toFixed(2)}%, ${rateNote}`)];
116
+ }
117
+ /** The lower bound the feed enforces at `now`, grown the way the contract grows it. */
118
+ function currentLowerBound(lowerBoundBase, growthRate, timestampLU, now) {
119
+ const growth = BigInt(growthRate) * (now - timestampLU) / BigInt(SECONDS_PER_YEAR);
120
+ return lowerBoundBase * (PERCENTAGE_FACTOR + growth) / PERCENTAGE_FACTOR;
121
+ }
122
+ /**
123
+ * The realized rate, clamped into what the feed accepts, when it differs from
124
+ * the current one by more than {@link RATE_DEVIATION_PERCENT}; the current
125
+ * rate otherwise.
126
+ **/
127
+ function nextRate(current, realized, max) {
128
+ const candidate = Math.min(Math.max(realized, 0), max);
129
+ return Math.abs(candidate - current) * 100 > current * RATE_DEVIATION_PERCENT ? candidate : current;
130
+ }
131
+ export { getFixedRateWindowFeeds, rateWindowContext, updateRateAndBounds };
@@ -1,10 +1,9 @@
1
1
  import { createRawTx } from "../../../onchain/utils/createRawTx.js";
2
2
  import { simulateMulticall } from "../../../onchain/utils/viem/simulateMulticall.js";
3
- import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
4
3
  import "../../../onchain/index.js";
5
- import { decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
4
+ import { nextLowerBound } from "./nextLowerBound.js";
5
+ import { parseAbi } from "viem";
6
6
  // src/permissionless/api/transactions/lp-price-feeds.ts
7
- const LOWER_BOUND_FACTOR = 999n;
8
7
  const ilpPriceFeedAbi = parseAbi([
9
8
  "function contractType() external view returns (bytes32)",
10
9
  "function setLimiter(uint256 newLimiter) external",
@@ -26,9 +25,6 @@ function getValue(client, address) {
26
25
  functionName: "getLPExchangeRate"
27
26
  });
28
27
  }
29
- function toLowerBound(value) {
30
- return value * LOWER_BOUND_FACTOR / 1000n;
31
- }
32
28
  /**
33
29
  * Moves an LP feed's lower bound back under its current exchange rate, when
34
30
  * the rate has outgrown the bound or drifted far enough from it to be worth a
@@ -37,40 +33,20 @@ function toLowerBound(value) {
37
33
  async function updateBounds(client, address) {
38
34
  const value = await getValue(client, address);
39
35
  const currentLowerBoundValue = await currentLowerBound(client, address);
40
- const lowerBound = toLowerBound(value);
41
- const deviationFromValue = Math.floor(Number(10000n * (value - currentLowerBoundValue) / currentLowerBoundValue)) / 1e4;
42
- const deviationFromBound = Math.floor(Number(10000n * (lowerBound - currentLowerBoundValue) / currentLowerBoundValue)) / 1e4;
43
- const txs = [];
44
- if (deviationFromValue < 0 || Math.abs(deviationFromBound) > .005) txs.push(createRawTx(address, {
36
+ const next = nextLowerBound(value, currentLowerBoundValue);
37
+ if (!next) return [];
38
+ return [createRawTx(address, {
45
39
  abi: ilpPriceFeedAbi,
46
40
  functionName: "setLimiter",
47
- args: [lowerBound]
48
- }, `[${address}].setLimiter(${lowerBound}); // deviationFromValue: ${(100 * deviationFromValue).toFixed(2)}%`));
49
- return txs;
41
+ args: [next.lowerBound]
42
+ }, `[${address}].setLimiter(${next.lowerBound}); // deviationFromValue: ${(100 * next.deviationFromValue).toFixed(2)}%`)];
50
43
  }
51
44
  /**
52
- * Of the whole feed tree behind `feeds`, the ones that are LP feeds: the
53
- * probe keeps whatever answers `getLPExchangeRate`.
54
- *
55
- * The trees reach past `feeds` themselves, so an LP feed read inside one of
56
- * them is among the results whether or not it is one of `feeds`.
45
+ * Of the feed tree nodes, the ones that are LP feeds: the probe keeps
46
+ * whatever answers `getLPExchangeRate`.
57
47
  **/
58
- async function getFeedsToUpdate(client, pfCompressor, feeds) {
48
+ async function getFeedsToUpdate(client, trees) {
59
49
  const updateableFeeds = /* @__PURE__ */ new Map();
60
- const { data } = await client.call({
61
- to: pfCompressor,
62
- data: encodeFunctionData({
63
- abi: priceFeedCompressorAbi,
64
- functionName: "loadPriceFeedTree",
65
- args: [feeds]
66
- }),
67
- gas: 200000000n
68
- });
69
- const trees = decodeFunctionResult({
70
- abi: priceFeedCompressorAbi,
71
- functionName: "loadPriceFeedTree",
72
- data: data ?? "0x"
73
- });
74
50
  for (const tree of trees) updateableFeeds.set(tree.baseParams.addr.toLowerCase(), tree.description);
75
51
  const candidates = Array.from(updateableFeeds.keys());
76
52
  const { results } = await simulateMulticall(client, {
@@ -0,0 +1,17 @@
1
+ // src/permissionless/api/transactions/nextLowerBound.ts
2
+ const LOWER_BOUND_FACTOR = 999n;
3
+ /**
4
+ * Where a feed's lower bound should move to under `value`, when the value has
5
+ * outgrown the bound or drifted far enough from it to be worth a transaction.
6
+ * Returns nothing when the bound still fits.
7
+ **/
8
+ function nextLowerBound(value, currentLowerBound) {
9
+ const lowerBound = value * LOWER_BOUND_FACTOR / 1000n;
10
+ const deviationFromValue = Math.floor(Number(10000n * (value - currentLowerBound) / currentLowerBound)) / 1e4;
11
+ const deviationFromBound = Math.floor(Number(10000n * (lowerBound - currentLowerBound) / currentLowerBound)) / 1e4;
12
+ if (deviationFromValue < 0 || Math.abs(deviationFromBound) > .005) return {
13
+ lowerBound,
14
+ deviationFromValue
15
+ };
16
+ }
17
+ export { nextLowerBound };
@@ -6,8 +6,8 @@ import { defineMarketAction } from "./defineMarketAction.js";
6
6
  import { byToken, resource } from "./utils/actionKeys.js";
7
7
  import { findAsset, isUnderlying, underlyingNotAllowed } from "./utils/checkHelpers.js";
8
8
  import { priceFeedDiagnostics, resolvePriceFeed } from "./utils/priceFeedChecks.js";
9
- import { z } from "zod/v4";
10
9
  import { zeroAddress } from "viem";
10
+ import { z } from "zod/v4";
11
11
  // src/permissionless/curator/actions/addAssetActionData.ts
12
12
  const addAssetActionData = defineMarketAction({
13
13
  type: "MARKET::addAsset",
@@ -10,8 +10,8 @@ import { contractRejected, isUnknown, readBytecode, readChain } from "./utils/ch
10
10
  import { assetNotFound, creditManagerNotFound, findAsset, findCollateral, findCreditManager, isUnderlying, liquidationThresholdDiagnostics, underlyingNotAllowed } from "./utils/checkHelpers.js";
11
11
  import { configureCreditManager } from "./utils/configureCalls.js";
12
12
  import { updateCreditManagerState } from "./utils/creditManagerStateUpdates.js";
13
- import { z } from "zod/v4";
14
13
  import { erc20Abi, isAddress, zeroAddress } from "viem";
14
+ import { z } from "zod/v4";
15
15
  // src/permissionless/curator/actions/addCollateralTokenActionData.ts
16
16
  const addCollateralTokenActionData = defineMarketAction({
17
17
  type: "CREDIT::addCollateralToken",
@@ -9,8 +9,8 @@ import { resource } from "./utils/actionKeys.js";
9
9
  import { contractRejected, readChain } from "./utils/chainReads.js";
10
10
  import { noOp } from "./utils/checkHelpers.js";
11
11
  import { BYTECODE_REPOSITORY } from "./utils/systemContracts.js";
12
- import { z } from "zod/v4";
13
12
  import { getContract, hexToString } from "viem";
13
+ import { z } from "zod/v4";
14
14
  // src/permissionless/curator/actions/addPeripheryContractActionData.ts
15
15
  /** Matches configurator periphery buckets (see SDK `PeripheryDomain`). **/
16
16
  const peripheryContractDomains = ["DEGEN_NFT", "ZAPPER"];
@@ -11,8 +11,8 @@ import { paramsKey, requiresDegenNft, resource } from "./utils/actionKeys.js";
11
11
  import { findCreditManager } from "./utils/checkHelpers.js";
12
12
  import { degenNftDiagnostics, resolveDegenNft } from "./utils/degenNftChecks.js";
13
13
  import { MAX_UINT128 } from "./utils/rawAmounts.js";
14
- import { z } from "zod/v4";
15
14
  import { zeroAddress } from "viem";
15
+ import { z } from "zod/v4";
16
16
  // src/permissionless/curator/actions/createCreditSuiteActionData.ts
17
17
  const createCreditSuiteSchema = z.object({
18
18
  id: z.string().min(1).optional(),
@@ -9,8 +9,8 @@ import { actionError } from "./actionDiagnostics.js";
9
9
  import { defineMarketAction } from "./defineMarketAction.js";
10
10
  import { priceFeedDiagnostics, resolvePriceFeed } from "./utils/priceFeedChecks.js";
11
11
  import { ADDRESS_PROVIDER, addressProvider } from "./utils/systemContracts.js";
12
- import { z } from "zod/v4";
13
12
  import { zeroAddress } from "viem";
13
+ import { z } from "zod/v4";
14
14
  // src/permissionless/curator/actions/createMarketActionData.ts
15
15
  const marketLabelSchema = nonEmptyStringSchema.refine((data) => data.length >= 3, { message: "Must be at least 3 characters long" });
16
16
  const createMarketParamsSchema = z.object({
@@ -1,7 +1,7 @@
1
1
  import { isSameAddress } from "../utils/addressUtils.js";
2
2
  import { addressSchema } from "../validationSchemas.js";
3
- import { z } from "zod/v4";
4
3
  import { zeroAddress } from "viem";
4
+ import { z } from "zod/v4";
5
5
  // src/permissionless/curator/actions/creditManagerTargets.ts
6
6
  /**
7
7
  * Credit manager targets: an action names the credit manager it configures
@@ -6,8 +6,8 @@ import { defineMarketAction } from "./defineMarketAction.js";
6
6
  import { resource } from "./utils/actionKeys.js";
7
7
  import { noOp } from "./utils/checkHelpers.js";
8
8
  import { bytecodeRepository } from "./utils/systemContracts.js";
9
- import { z } from "zod/v4";
10
9
  import { toBytes } from "viem";
10
+ import { z } from "zod/v4";
11
11
  // src/permissionless/curator/actions/deployContractActionData.ts
12
12
  /** Periphery domain of a contract type: `ZAPPER::ERC4626_UNDERLYING` → `ZAPPER`. **/
13
13
  function peripheryDomainOf(contractType) {
@@ -6,8 +6,8 @@ import { assetNotFound, findAsset, isUnderlying, noOp } from "./utils/checkHelpe
6
6
  import { configurePriceOracle } from "./utils/configureCalls.js";
7
7
  import { priceFeedDiagnostics, resolvePriceFeed } from "./utils/priceFeedChecks.js";
8
8
  import { updateMarketAsset } from "./utils/updateMarketAsset.js";
9
- import { z } from "zod/v4";
10
9
  import { zeroAddress } from "viem";
10
+ import { z } from "zod/v4";
11
11
  // src/permissionless/curator/actions/setPriceFeedActionData.ts
12
12
  const setPriceFeedActionData = defineMarketAction({
13
13
  type: "ORACLE::setPriceFeed",
@@ -4,8 +4,8 @@ import { errorMessage } from "../../utils/errorMessage.js";
4
4
  import { tokenAmountSchema } from "../../validationSchemas.js";
5
5
  import { actionError } from "../actionDiagnostics.js";
6
6
  import { convertUnderlyingAmount } from "../builderContext.js";
7
- import { z } from "zod/v4";
8
7
  import { maxUint256 } from "viem";
8
+ import { z } from "zod/v4";
9
9
  // src/permissionless/curator/actions/utils/rawAmounts.ts
10
10
  const MAX_UINT128 = (1n << 128n) - 1n;
11
11
  const MAX_QUOTA = (1n << 95n) - 1n;
@@ -7,8 +7,8 @@ import { isSameAddress } from "../utils/addressUtils.js";
7
7
  import { addressSchema, percentageSchema } from "../validationSchemas.js";
8
8
  import { resolveTreasurySplitter, treasurySplitter } from "./configuratorActionHelpers.js";
9
9
  import { defineConfiguratorAction } from "./defineConfiguratorAction.js";
10
- import { z } from "zod/v4";
11
10
  import { encodeFunctionData } from "viem";
11
+ import { z } from "zod/v4";
12
12
  // src/permissionless/curator/configurator-actions/setDefaultSplitActionData.ts
13
13
  /** Percentages as the splitter stores them. **/
14
14
  const scaleProportions = (proportions) => proportions.map((proportion) => Math.round(proportion * 100));
@@ -3,8 +3,8 @@ import "../../../../onchain/index.js";
3
3
  import { addressSchema, literalsSchema } from "../../validationSchemas.js";
4
4
  import { plainAdapterStateSchema } from "./adapterStateSchema.js";
5
5
  import { checkCollateralTokens } from "./adapterValidation.js";
6
- import { z } from "zod/v4";
7
6
  import { encodeAbiParameters, isAddress, stringToHex, zeroAddress, zeroHash } from "viem";
7
+ import { z } from "zod/v4";
8
8
  // src/permissionless/curator/plugins/adapters/adapterPluginHelpers.ts
9
9
  /**
10
10
  * Scaffolding shared by the adapter plugins. Kept apart from `builtinAdapterPlugins.ts` so
@@ -2,8 +2,8 @@ import { addressSchema } from "../../../validationSchemas.js";
2
2
  import { adapterDeployParams, getter, plainAdapter, resolveTargetTokens, sdkState } from "../adapterPluginHelpers.js";
3
3
  import { getCurveTargetCoins } from "../adapterValidation.js";
4
4
  import { defineAdapterPlugin } from "../defineAdapterPlugin.js";
5
- import { z } from "zod/v4";
6
5
  import { zeroAddress } from "viem";
6
+ import { z } from "zod/v4";
7
7
  // src/permissionless/curator/plugins/adapters/curve-v1/getCurveV1Plugin.ts
8
8
  const CURVE_V1_ADAPTER_TYPES = [
9
9
  "CURVE_V1_2ASSETS",
@@ -2,8 +2,8 @@ import { addressSchema } from "../../../validationSchemas.js";
2
2
  import { adapterDeployParams, plainAdapter } from "../adapterPluginHelpers.js";
3
3
  import { resolveCurveTarget } from "../curve-v1/getCurveV1Plugin.js";
4
4
  import { defineAdapterPlugin } from "../defineAdapterPlugin.js";
5
- import { z } from "zod/v4";
6
5
  import { zeroAddress } from "viem";
6
+ import { z } from "zod/v4";
7
7
  // src/permissionless/curator/plugins/adapters/curve-v1-steth/curveV1StETHPlugin.ts
8
8
  const curveV1StETHDeployParamsSchema = z.object({
9
9
  type: z.literal("CURVE_V1_STECRV_POOL"),
@@ -1,8 +1,8 @@
1
1
  import { addressSchema } from "../../../validationSchemas.js";
2
2
  import { adapterDeployParams, plainAdapter, readAddress, resolveTargetTokens } from "../adapterPluginHelpers.js";
3
3
  import { defineAdapterPlugin } from "../defineAdapterPlugin.js";
4
- import { z } from "zod/v4";
5
4
  import { zeroAddress } from "viem";
5
+ import { z } from "zod/v4";
6
6
  // src/permissionless/curator/plugins/adapters/erc4626/erc4626AdapterPlugin.ts
7
7
  /** v3.1.1 takes the vault only; v3.1.2 also takes the vault's gateway. **/
8
8
  const erc4626DeployParamsSchema = z.discriminatedUnion("version", [z.object({
@@ -2,8 +2,8 @@ import { addressSchema, uintSchema } from "../../../validationSchemas.js";
2
2
  import { adapterDeployParams, plainAdapter } from "../adapterPluginHelpers.js";
3
3
  import { defineAdapterPlugin } from "../defineAdapterPlugin.js";
4
4
  import { resolveErc4626Target } from "../erc4626/erc4626AdapterPlugin.js";
5
- import { z } from "zod/v4";
6
5
  import { zeroAddress } from "viem";
6
+ import { z } from "zod/v4";
7
7
  // src/permissionless/curator/plugins/adapters/erc4626-referral/erc4626ReferralAdapterPlugin.ts
8
8
  const erc4626ReferralDeployParamsSchema = z.object({
9
9
  type: z.literal("ERC4626_VAULT_REFERRAL"),
@@ -2,8 +2,8 @@ import { addressSchema } from "../../../validationSchemas.js";
2
2
  import { adapterDeployParams, plainAdapter, stakedTokenDeployParamsSchema } from "../adapterPluginHelpers.js";
3
3
  import { defineAdapterPlugin } from "../defineAdapterPlugin.js";
4
4
  import { resolveErc4626Target } from "../erc4626/erc4626AdapterPlugin.js";
5
- import { z } from "zod/v4";
6
5
  import { zeroAddress } from "viem";
6
+ import { z } from "zod/v4";
7
7
  // src/permissionless/curator/plugins/adapters/mellow-erc4626/mellowErc4626AdapterPlugin.ts
8
8
  /**
9
9
  * v310 takes no staked token; v312 does. v311 has no constructor ABI in the