@morpho-org/morpho-sdk 9.1.0 → 9.2.0

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 (56) hide show
  1. package/README.md +4 -0
  2. package/lib/cjs/abis.d.ts +1 -1
  3. package/lib/cjs/abis.js +3 -1
  4. package/lib/cjs/blue/constants.d.ts +1 -1
  5. package/lib/cjs/blue/constants.js +2 -1
  6. package/lib/cjs/constants.d.ts +2 -2
  7. package/lib/cjs/constants.js +4 -1
  8. package/lib/cjs/entities/blue/blue.d.ts +71 -16
  9. package/lib/cjs/entities/blue/blue.js +32 -4
  10. package/lib/cjs/entities/midnight/midnight.d.ts +2 -1
  11. package/lib/cjs/entities/midnight/midnight.js +5 -4
  12. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +8 -0
  13. package/lib/cjs/entities/vaultV1/vaultV1.js +5 -0
  14. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +4 -0
  15. package/lib/cjs/entities/vaultV2/vaultV2.js +3 -0
  16. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +37 -4
  17. package/lib/cjs/entities/vaultV2BlueReallocationData.js +197 -32
  18. package/lib/cjs/helpers/constant.d.ts +7 -0
  19. package/lib/cjs/helpers/constant.js +8 -1
  20. package/lib/cjs/helpers/deadShares.d.ts +82 -0
  21. package/lib/cjs/helpers/deadShares.js +200 -0
  22. package/lib/cjs/helpers/index.d.ts +2 -1
  23. package/lib/cjs/helpers/index.js +7 -1
  24. package/lib/cjs/midnight/abis.d.ts +1 -1
  25. package/lib/cjs/midnight/abis.js +3 -1
  26. package/lib/cjs/types/error.d.ts +54 -5
  27. package/lib/cjs/types/error.js +60 -6
  28. package/lib/cjs/types/sharedLiquidity.d.ts +10 -6
  29. package/lib/esm/abis.d.ts +1 -1
  30. package/lib/esm/abis.js +1 -1
  31. package/lib/esm/blue/constants.d.ts +1 -1
  32. package/lib/esm/blue/constants.js +1 -1
  33. package/lib/esm/constants.d.ts +2 -2
  34. package/lib/esm/constants.js +2 -2
  35. package/lib/esm/entities/blue/blue.d.ts +71 -16
  36. package/lib/esm/entities/blue/blue.js +34 -6
  37. package/lib/esm/entities/midnight/midnight.d.ts +2 -1
  38. package/lib/esm/entities/midnight/midnight.js +6 -5
  39. package/lib/esm/entities/vaultV1/vaultV1.d.ts +8 -0
  40. package/lib/esm/entities/vaultV1/vaultV1.js +5 -0
  41. package/lib/esm/entities/vaultV2/vaultV2.d.ts +4 -0
  42. package/lib/esm/entities/vaultV2/vaultV2.js +3 -0
  43. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +37 -4
  44. package/lib/esm/entities/vaultV2BlueReallocationData.js +197 -32
  45. package/lib/esm/helpers/constant.d.ts +7 -0
  46. package/lib/esm/helpers/constant.js +7 -0
  47. package/lib/esm/helpers/deadShares.d.ts +82 -0
  48. package/lib/esm/helpers/deadShares.js +195 -0
  49. package/lib/esm/helpers/index.d.ts +2 -1
  50. package/lib/esm/helpers/index.js +2 -1
  51. package/lib/esm/midnight/abis.d.ts +1 -1
  52. package/lib/esm/midnight/abis.js +1 -1
  53. package/lib/esm/types/error.d.ts +54 -5
  54. package/lib/esm/types/error.js +57 -5
  55. package/lib/esm/types/sharedLiquidity.d.ts +10 -6
  56. package/package.json +8 -7
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateBlueMarketDeadShares = validateBlueMarketDeadShares;
4
+ exports.validateVaultV1DeadShares = validateVaultV1DeadShares;
5
+ exports.validateVaultV2DeadShares = validateVaultV2DeadShares;
6
+ const blue_sdk_1 = require("@morpho-org/blue-sdk");
7
+ const error_js_1 = require("../types/error.js");
8
+ const constant_js_1 = require("./constant.js");
9
+ /**
10
+ * Checks that a Morpho Blue market holds at least `MIN_DEAD_SHARES` supply shares at `DEAD_ADDRESS`.
11
+ *
12
+ * @param market - Fetched market snapshot.
13
+ * @param path - Vaults leading to this market, outermost first; empty for a direct market.
14
+ * @returns Nothing; returns normally when the market passes.
15
+ * @throws {MissingDeadSharesDataError} when `market.deadSupplyShares` was not fetched.
16
+ * @throws {InsufficientDeadSharesError} when the market holds fewer than `MIN_DEAD_SHARES` dead supply shares.
17
+ * @example
18
+ * ```ts
19
+ * import { validateBlueMarketDeadShares } from "@morpho-org/morpho-sdk";
20
+ * import { fetchBlueMarket } from "@morpho-org/morpho-sdk/fetch";
21
+ * import { markets } from "@morpho-org/morpho-test";
22
+ * import { createPublicClient, http } from "viem";
23
+ * import { mainnet } from "viem/chains";
24
+ *
25
+ * const client = createPublicClient({ chain: mainnet, transport: http() });
26
+ * const market = await fetchBlueMarket(markets[mainnet.id].usdc_wbtc.id, client);
27
+ * validateBlueMarketDeadShares(market);
28
+ * // Returns void on success; throws if the snapshot fails the rule.
29
+ * ```
30
+ */
31
+ function validateBlueMarketDeadShares(market, path = []) {
32
+ const entity = [...path, market.id];
33
+ if (market.deadSupplyShares == null)
34
+ throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadSupplyShares" });
35
+ if (market.deadSupplyShares < constant_js_1.MIN_DEAD_SHARES)
36
+ throw new error_js_1.InsufficientDeadSharesError({
37
+ entity,
38
+ reason: "deadShares",
39
+ observed: market.deadSupplyShares,
40
+ required: constant_js_1.MIN_DEAD_SHARES,
41
+ });
42
+ }
43
+ /**
44
+ * Checks that a Vault V1 holds at least `MIN_DEAD_SHARES` shares at `DEAD_ADDRESS` and that every
45
+ * market in its withdraw queue passes `validateBlueMarketDeadShares`.
46
+ *
47
+ * @param vault - Fetched vault snapshot with its withdraw-queue allocations.
48
+ * @param path - Vaults leading to this vault, outermost first; empty for a direct deposit.
49
+ * @returns Nothing; returns normally when the vault and everything it can allocate to pass.
50
+ * @throws {MissingDeadSharesDataError} when `vault.deadShares`, a withdraw-queue allocation or a
51
+ * market's `deadSupplyShares` was not fetched.
52
+ * @throws {InsufficientDeadSharesError} when the vault or one of its withdraw-queue markets holds
53
+ * too few dead shares.
54
+ * @example
55
+ * ```ts
56
+ * import { validateVaultV1DeadShares } from "@morpho-org/morpho-sdk";
57
+ * import { fetchAccrualVault } from "@morpho-org/morpho-sdk/fetch";
58
+ * import { vaults } from "@morpho-org/morpho-test";
59
+ * import { createPublicClient, http } from "viem";
60
+ * import { mainnet } from "viem/chains";
61
+ *
62
+ * const client = createPublicClient({ chain: mainnet, transport: http() });
63
+ * const vault = await fetchAccrualVault(vaults[mainnet.id].steakUsdc.address, client);
64
+ * validateVaultV1DeadShares(vault);
65
+ * // Returns void on success; throws if the snapshot fails the rule.
66
+ * ```
67
+ */
68
+ function validateVaultV1DeadShares(vault, path = []) {
69
+ const entity = [...path, vault.address];
70
+ if (vault.deadShares == null)
71
+ throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadShares" });
72
+ if (vault.deadShares < constant_js_1.MIN_DEAD_SHARES)
73
+ throw new error_js_1.InsufficientDeadSharesError({
74
+ entity,
75
+ reason: "deadShares",
76
+ observed: vault.deadShares,
77
+ required: constant_js_1.MIN_DEAD_SHARES,
78
+ });
79
+ for (const marketId of vault.withdrawQueue) {
80
+ const allocation = vault.allocations.get(marketId);
81
+ if (allocation == null)
82
+ throw new error_js_1.MissingDeadSharesDataError({
83
+ entity: [...entity, marketId],
84
+ field: "allocation",
85
+ });
86
+ validateBlueMarketDeadShares(allocation.position.market, entity);
87
+ }
88
+ }
89
+ /**
90
+ * Checks a Vault V2 against the dead-deposit rule: at least `MIN_DEAD_SHARES` shares at
91
+ * `DEAD_ADDRESS` worth at least `MIN_VAULT_V2_DEAD_ASSETS` assets, a share price above
92
+ * `1 / (10 * virtualShares)`, and every Blue market or Vault V1 it can allocate to (non-zero
93
+ * absolute cap) passing its own rule. Zero-cap entries are skipped.
94
+ *
95
+ * @param vault - Fetched vault snapshot with its adapters and `absoluteCaps`.
96
+ * @param path - Vaults leading to this vault, outermost first; empty for a direct deposit.
97
+ * @returns Nothing; returns normally when the vault and everything it can allocate to pass.
98
+ * @throws {MissingDeadSharesDataError} when a dead-share field, an adapter cap, or the data of an
99
+ * adapter the SDK cannot hydrate is missing.
100
+ * @throws {InsufficientDeadSharesError} when the vault or an allocatable market or Vault V1 fails the rule.
101
+ * @example
102
+ * ```ts
103
+ * import { validateVaultV2DeadShares } from "@morpho-org/morpho-sdk";
104
+ * import { fetchAccrualVaultV2 } from "@morpho-org/morpho-sdk/fetch";
105
+ * import { createPublicClient, http } from "viem";
106
+ * import { mainnet } from "viem/chains";
107
+ *
108
+ * const client = createPublicClient({ chain: mainnet, transport: http() });
109
+ * const keyrockUsdcVaultV2 = "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145";
110
+ * const vault = await fetchAccrualVaultV2(keyrockUsdcVaultV2, client);
111
+ * validateVaultV2DeadShares(vault);
112
+ * // Returns void on success; throws if the snapshot fails the rule.
113
+ * ```
114
+ */
115
+ function validateVaultV2DeadShares(vault, path = []) {
116
+ const entity = [...path, vault.address];
117
+ const { deadShares, deadAssets, absoluteCaps } = vault;
118
+ if (deadShares == null)
119
+ throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadShares" });
120
+ if (deadAssets == null)
121
+ throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadAssets" });
122
+ if (absoluteCaps == null)
123
+ throw new error_js_1.MissingDeadSharesDataError({ entity, field: "absoluteCaps" });
124
+ if (deadShares < constant_js_1.MIN_DEAD_SHARES)
125
+ throw new error_js_1.InsufficientDeadSharesError({
126
+ entity,
127
+ reason: "deadShares",
128
+ observed: deadShares,
129
+ required: constant_js_1.MIN_DEAD_SHARES,
130
+ });
131
+ if (deadAssets < constant_js_1.MIN_VAULT_V2_DEAD_ASSETS)
132
+ throw new error_js_1.InsufficientDeadSharesError({
133
+ entity,
134
+ reason: "deadAssets",
135
+ observed: deadAssets,
136
+ required: constant_js_1.MIN_VAULT_V2_DEAD_ASSETS,
137
+ });
138
+ // Share price (totalAssets + 1) / (totalSupply + virtualShares) must exceed 1 / (10 * virtualShares).
139
+ const priceNumerator = (vault._totalAssets + 1n) * 10n * vault.virtualShares;
140
+ const priceDenominator = vault.totalSupply + vault.virtualShares;
141
+ if (priceNumerator <= priceDenominator)
142
+ throw new error_js_1.InsufficientDeadSharesError({
143
+ entity,
144
+ reason: "sharePrice",
145
+ observed: priceNumerator,
146
+ required: priceDenominator + 1n,
147
+ });
148
+ const capOf = (id, adapter) => {
149
+ const cap = absoluteCaps[id];
150
+ if (cap == null)
151
+ throw new error_js_1.MissingDeadSharesDataError({
152
+ entity: [...entity, adapter],
153
+ field: "absoluteCaps",
154
+ });
155
+ return cap;
156
+ };
157
+ for (const adapter of vault.accrualAdapters) {
158
+ if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter) {
159
+ const id = blue_sdk_1.VaultV2MorphoVaultV1Adapter.adapterCapId(adapter.address);
160
+ if (capOf(id, adapter.address) > 0n)
161
+ validateVaultV1DeadShares(adapter.accrualVaultV1, entity);
162
+ }
163
+ else if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter) {
164
+ for (const { market } of adapter.positions) {
165
+ const id = blue_sdk_1.VaultV2MorphoMarketV1Adapter.adapterMarketCapId(adapter.address, market.params);
166
+ if (capOf(id, adapter.address) > 0n)
167
+ validateBlueMarketDeadShares(market, entity);
168
+ }
169
+ }
170
+ else if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2) {
171
+ for (const market of adapter.markets) {
172
+ const id = blue_sdk_1.VaultV2MorphoMarketV1AdapterV2.adapterMarketCapId(adapter.address, market.params);
173
+ if (capOf(id, adapter.address) > 0n)
174
+ validateBlueMarketDeadShares(market, entity);
175
+ }
176
+ }
177
+ else {
178
+ throw new error_js_1.MissingDeadSharesDataError({
179
+ entity: [...entity, adapter.address],
180
+ field: "adapter",
181
+ });
182
+ }
183
+ }
184
+ // Deposits are allocated to the liquidity market, so the snapshot must hold it even when it
185
+ // has no allocation yet (the adapters only list markets they currently supply to).
186
+ const liquidityAdapter = vault.accrualLiquidityAdapter;
187
+ if (vault.liquidityData === "0x" ||
188
+ !(liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter ||
189
+ liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2))
190
+ return;
191
+ const liquidityMarketId = blue_sdk_1.MarketParams.fromHex(vault.liquidityData).id;
192
+ const markets = liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter
193
+ ? liquidityAdapter.positions.map(({ market }) => market)
194
+ : liquidityAdapter.markets;
195
+ if (!markets.some(({ id }) => id === liquidityMarketId))
196
+ throw new error_js_1.MissingDeadSharesDataError({
197
+ entity: [...entity, liquidityAdapter.address, liquidityMarketId],
198
+ field: "liquidityMarket",
199
+ });
200
+ }
@@ -1,5 +1,6 @@
1
1
  export { getMidnightBlueBuyCallbackAddress, getMidnightBlueBuyCallbackData, } from "./callback.js";
2
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, } from "./constant.js";
2
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, } from "./constant.js";
3
+ export { validateBlueMarketDeadShares, validateVaultV1DeadShares, validateVaultV2DeadShares, } from "./deadShares.js";
3
4
  export { addTransactionMetadata } from "./metadata.js";
4
5
  export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./previewVaultV2ForceWithdraw.js";
5
6
  export { type PreviewVaultV2InKindRedeemParams, previewVaultV2InKindRedeem, type VaultV2InKindRedeemMarketPreview, } from "./previewVaultV2InKindRedeem.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateRequirementSpender = exports.validateOfferSides = exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateMidnightNativeAmount = exports.validateMidnightMarketChainId = exports.validateChainId = exports.validateAccrualPosition = exports.getMidnightMaxSafeDebt = exports.computeVaultMaxSharePrice = exports.computeVaultMaxShareAllowance = exports.computeMinForceWithdrawSharePrice = exports.signAndVerifyTypedData = exports.grossFromNetAssets = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS = exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.DEFAULT_CAP_ACCRUAL_BUFFER = exports.DEFAULT_ALLOCATOR_CAP_HEADROOM = exports.APPROVE_ONLY_ONCE_TOKENS = exports.getMidnightBlueBuyCallbackData = exports.getMidnightBlueBuyCallbackAddress = void 0;
3
+ exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateRequirementSpender = exports.validateOfferSides = exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateMidnightNativeAmount = exports.validateMidnightMarketChainId = exports.validateChainId = exports.validateAccrualPosition = exports.getMidnightMaxSafeDebt = exports.computeVaultMaxSharePrice = exports.computeVaultMaxShareAllowance = exports.computeMinForceWithdrawSharePrice = exports.signAndVerifyTypedData = exports.grossFromNetAssets = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.validateVaultV2DeadShares = exports.validateVaultV1DeadShares = exports.validateBlueMarketDeadShares = exports.MIN_VAULT_V2_DEAD_ASSETS = exports.MIN_DEAD_SHARES = exports.MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS = exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.DEFAULT_CAP_ACCRUAL_BUFFER = exports.DEFAULT_ALLOCATOR_CAP_HEADROOM = exports.APPROVE_ONLY_ONCE_TOKENS = exports.getMidnightBlueBuyCallbackData = exports.getMidnightBlueBuyCallbackAddress = void 0;
4
4
  var callback_js_1 = require("./callback.js");
5
5
  Object.defineProperty(exports, "getMidnightBlueBuyCallbackAddress", { enumerable: true, get: function () { return callback_js_1.getMidnightBlueBuyCallbackAddress; } });
6
6
  Object.defineProperty(exports, "getMidnightBlueBuyCallbackData", { enumerable: true, get: function () { return callback_js_1.getMidnightBlueBuyCallbackData; } });
@@ -17,6 +17,12 @@ Object.defineProperty(exports, "MAX_REALLOCATION_PENALTY", { enumerable: true, g
17
17
  Object.defineProperty(exports, "MAX_SLIPPAGE_TOLERANCE", { enumerable: true, get: function () { return constant_js_1.MAX_SLIPPAGE_TOLERANCE; } });
18
18
  Object.defineProperty(exports, "MAX_TOKEN_APPROVALS", { enumerable: true, get: function () { return constant_js_1.MAX_TOKEN_APPROVALS; } });
19
19
  Object.defineProperty(exports, "MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS", { enumerable: true, get: function () { return constant_js_1.MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS; } });
20
+ Object.defineProperty(exports, "MIN_DEAD_SHARES", { enumerable: true, get: function () { return constant_js_1.MIN_DEAD_SHARES; } });
21
+ Object.defineProperty(exports, "MIN_VAULT_V2_DEAD_ASSETS", { enumerable: true, get: function () { return constant_js_1.MIN_VAULT_V2_DEAD_ASSETS; } });
22
+ var deadShares_js_1 = require("./deadShares.js");
23
+ Object.defineProperty(exports, "validateBlueMarketDeadShares", { enumerable: true, get: function () { return deadShares_js_1.validateBlueMarketDeadShares; } });
24
+ Object.defineProperty(exports, "validateVaultV1DeadShares", { enumerable: true, get: function () { return deadShares_js_1.validateVaultV1DeadShares; } });
25
+ Object.defineProperty(exports, "validateVaultV2DeadShares", { enumerable: true, get: function () { return deadShares_js_1.validateVaultV2DeadShares; } });
20
26
  var metadata_js_1 = require("./metadata.js");
21
27
  Object.defineProperty(exports, "addTransactionMetadata", { enumerable: true, get: function () { return metadata_js_1.addTransactionMetadata; } });
22
28
  var previewVaultV2ForceWithdraw_js_1 = require("./previewVaultV2ForceWithdraw.js");
@@ -1 +1 @@
1
- export { blueBuyCallbackFactoryAbi, ecrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, priceRatifierV1Abi, rateRatifierV1Abi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
1
+ export { blueBuyCallbackFactoryAbi, ecrecoverAuthorizerAbi, ecrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, midnightEventsAbi, priceRatifierV1Abi, rateRatifierV1Abi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setterRatifierAbi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.midnightBundlesV2Abi = exports.midnightAbi = exports.ecrecoverRatifierAbi = exports.blueBuyCallbackFactoryAbi = void 0;
3
+ exports.setterRatifierAbi = exports.rateRatifierV1Abi = exports.priceRatifierV1Abi = exports.midnightEventsAbi = exports.midnightBundlesV2Abi = exports.midnightAbi = exports.ecrecoverRatifierAbi = exports.ecrecoverAuthorizerAbi = exports.blueBuyCallbackFactoryAbi = void 0;
4
4
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
5
  Object.defineProperty(exports, "blueBuyCallbackFactoryAbi", { enumerable: true, get: function () { return midnight_sdk_1.blueBuyCallbackFactoryAbi; } });
6
+ Object.defineProperty(exports, "ecrecoverAuthorizerAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverAuthorizerAbi; } });
6
7
  Object.defineProperty(exports, "ecrecoverRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverRatifierAbi; } });
7
8
  Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
8
9
  Object.defineProperty(exports, "midnightBundlesV2Abi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesV2Abi; } });
10
+ Object.defineProperty(exports, "midnightEventsAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightEventsAbi; } });
9
11
  Object.defineProperty(exports, "priceRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.priceRatifierV1Abi; } });
10
12
  Object.defineProperty(exports, "rateRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.rateRatifierV1Abi; } });
11
13
  Object.defineProperty(exports, "setterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
@@ -929,11 +929,16 @@ export declare class RepaySharesExceedDebtError extends Error {
929
929
  });
930
930
  }
931
931
  /**
932
- * Thrown when shared liquidity selected by a Vault V2 reallocation planner cannot
933
- * cover the operation's absolute shortfall on the target market — the resulting
934
- * `morphoBorrow` or `morphoWithdraw` would still revert onchain.
932
+ * Thrown when shared liquidity cannot cover the operation's required
933
+ * reallocated assets. When Blue's balance is explicit, it is also thrown if
934
+ * that balance cannot fund the penalty flash loan, an earlier market-sourced
935
+ * withdrawal, or the final operation transfer. A borrow or withdraw plan that
936
+ * otherwise covers its shortfall but whose planned penalty exceeds its amount
937
+ * instead throws `InputExceedsMaxError`.
935
938
  *
936
- * Pattern-match on the class and inspect `params` to surface the gap to users.
939
+ * `shortfall` is the reallocated assets required by the operation and is
940
+ * comparable to `available`. Pattern-match on the class and inspect `params`
941
+ * to surface the gap to users.
937
942
  */
938
943
  export declare class InsufficientSharedLiquidityError extends Error {
939
944
  readonly params: {
@@ -1316,7 +1321,12 @@ export declare class MidnightOfferCallbackDataMismatchError extends Error {
1316
1321
  readonly actualCallbackData: Hex;
1317
1322
  });
1318
1323
  }
1319
- /** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
1324
+ /**
1325
+ * Thrown when loan assets would be parked in a Morpho Blue market with no existing supply.
1326
+ *
1327
+ * @deprecated `supplyBlueMakeLend` now throws `InsufficientDeadSharesError` or
1328
+ * `MissingDeadSharesDataError` instead; kept exported so existing `instanceof` checks compile.
1329
+ */
1320
1330
  export declare class EmptyBlueParkingMarketError extends Error {
1321
1331
  constructor(params: {
1322
1332
  readonly marketId: MarketId;
@@ -1332,6 +1342,45 @@ export declare class ZeroBlueParkingSharesError extends Error {
1332
1342
  readonly assets: bigint;
1333
1343
  });
1334
1344
  }
1345
+ /** Which dead-deposit condition an entity failed. */
1346
+ export type DeadSharesFailureReason = "deadShares" | "deadAssets" | "sharePrice";
1347
+ /**
1348
+ * Thrown when a Morpho Blue market or vault, or a market or Vault V1 it can allocate to, fails the
1349
+ * dead-deposit rule that protects deposits against share-price inflation.
1350
+ */
1351
+ export declare class InsufficientDeadSharesError extends Error {
1352
+ /** Failing entity, outermost vault first; the last element is the market id or vault address. */
1353
+ readonly entity: readonly (Address | Hash)[];
1354
+ /** Failed condition. */
1355
+ readonly reason: DeadSharesFailureReason;
1356
+ /** Observed dead shares or assets; for `sharePrice`, `(totalAssets + 1) * 10 * virtualShares`. */
1357
+ readonly observed: bigint;
1358
+ /** Required minimum; for `sharePrice`, `totalSupply + virtualShares + 1`. */
1359
+ readonly required: bigint;
1360
+ constructor(params: {
1361
+ readonly entity: readonly (Address | Hash)[];
1362
+ readonly reason: DeadSharesFailureReason;
1363
+ readonly observed: bigint;
1364
+ readonly required: bigint;
1365
+ });
1366
+ }
1367
+ /** Snapshot field the dead-deposit check needs but the snapshot does not carry. */
1368
+ export type DeadSharesDataField = "deadSupplyShares" | "deadShares" | "deadAssets" | "absoluteCaps" | "allocation" | "adapter" | "liquidityMarket";
1369
+ /**
1370
+ * Thrown when a market or vault snapshot lacks the data the dead-deposit check needs, such as a
1371
+ * snapshot built by hand, from the Morpho API or by an older fetcher, or a Vault V2 adapter the
1372
+ * SDK cannot hydrate. The check fails closed rather than pass unverified data.
1373
+ */
1374
+ export declare class MissingDeadSharesDataError extends Error {
1375
+ /** Entity missing the data, outermost vault first. */
1376
+ readonly entity: readonly (Address | Hash)[];
1377
+ /** Missing field. */
1378
+ readonly field: DeadSharesDataField;
1379
+ constructor(params: {
1380
+ readonly entity: readonly (Address | Hash)[];
1381
+ readonly field: DeadSharesDataField;
1382
+ });
1383
+ }
1335
1384
  /** Thrown when a quoted Midnight takeable offer belongs to a different market than the requested flow. */
1336
1385
  export declare class MidnightTakeableOfferMarketMismatchError extends Error {
1337
1386
  constructor(params: {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DepositOwnerMismatchError = exports.DepositAssetMismatchError = exports.DepositAmountMismatchError = exports.EmptyDeallocationsError = exports.ExcessiveSlippageToleranceError = exports.MissingAccrualPositionError = exports.UnsupportedMidnightAuthorizationTargetError = exports.UnsupportedErc20ApprovalSpenderError = exports.MissingClientPropertyError = exports.CryptoUnavailableError = exports.ChainIdMismatchError = exports.AddressMismatchError = exports.UnsupportedRequirementSignatureError = exports.UnexpectedRequirementSignatureError = exports.AmbiguousRequirementSignaturesError = exports.MaxRepayAssetsBelowRepayAssetsError = exports.ReallocationsRequireBorrowError = exports.UnsupportedAuthorizationOperatorError = exports.ReallocationLoanTokenMismatchError = exports.SameVaultMigrationError = exports.AmountAndSharesExclusiveError = exports.MixedBundlesFundingError = exports.MidnightReferralFeePctExceededError = exports.ReferralFeePctExceededError = exports.ReferralFeeRecipientMissingError = exports.NativeFundingAmountMismatchError = exports.NoUnusedPermit2NonceError = exports.Permit2SignatureTransferNonceAlreadyUsedError = exports.BundlesRequirementSignatureMismatchError = exports.BundlesPermitMismatchError = exports.VaultIsBlueFeeRecipientError = exports.VaultMorphoMismatchError = exports.InsufficientBlueBalanceForInKindRedeemError = exports.InKindRedeemCoverageError = exports.InKindRedeemZeroDeallocationError = exports.VaultV2ForceWithdrawFeeSharesExceedBurnError = exports.VaultV2ForceWithdrawSharePriceBelowFloorError = exports.VaultV2ForceWithdrawZeroSharePriceError = exports.VaultV2ForceWithdrawZeroWithdrawalError = exports.VaultV2ForceWithdrawCoverageError = exports.VaultV2UndecodableLiquidityDataError = exports.VaultV2UnsupportedLiquidityAdapterError = exports.VaultV2UnsupportedExitAdapterError = exports.AdapterNotPartOfVaultError = exports.VaultV2SingleAdapterRequiredError = exports.ExpiredDeadlineError = exports.EmptyMarketParamsListError = exports.InputExceedsMaxError = exports.NonPositiveInputError = exports.NegativeInputError = void 0;
4
4
  exports.MidnightOfferMarketAddressMismatchError = exports.MidnightOfferMarketChainMismatchError = exports.MidnightTakeDeadlineTooFarError = exports.MidnightContractReceiverError = exports.MidnightZeroOnBehalfError = exports.MidnightZeroReceiverError = exports.MidnightRepayExceedsDebtError = exports.MidnightContinuousFeeAboveMaxError = exports.MidnightTakeTargetUnreachableError = exports.MidnightTakeableOffersNotFillableError = exports.UnboundedMidnightTakeInputError = exports.MidnightOfferSellerReceiverMismatchError = exports.MidnightOfferContinuousFeeCapError = exports.MidnightOfferMakerMismatchError = exports.MidnightOfferReduceOnlyError = exports.MidnightOfferSideMismatchError = exports.EmptyMidnightTakeableOffersError = exports.DuplicateMidnightGroupCancellationError = exports.EmptyMidnightCollateralSuppliesError = exports.EmptyMidnightGroupCancellationsError = exports.ReallocationAdapterSupplySharesUnderflowError = exports.ReallocationAllocationUnderflowError = exports.UnknownReallocationAdapterError = exports.UnknownReallocationMarketPublicAllocatorConfigError = exports.UnknownReallocationActiveAdaptersError = exports.UnknownReallocationPublicAllocatorConfigError = exports.UnknownReallocationAllocationError = exports.UnknownReallocationVaultError = exports.UnknownReallocationMarketError = exports.InsufficientSharedLiquidityError = exports.RepaySharesExceedDebtError = exports.InvalidSignatureError = exports.RepayExceedsDebtError = exports.WithdrawMakesPositionUnhealthyError = exports.WithdrawExceedsCollateralError = exports.MutuallyExclusiveRepayAmountsError = exports.InconsistentReallocationPenaltyError = exports.InvalidReallocationSourceTypeError = exports.InvalidReallocationAddressError = exports.InvalidVaultV2BlueReallocationShapeError = exports.ReallocationWithdrawalOnTargetMarketError = exports.AccrualPositionUserMismatchError = exports.MarketIdMismatchError = exports.MissingMarketPriceError = exports.BorrowExceedsSafeLtvError = exports.NativeAmountOnNonWNativeAssetError = exports.VaultAddressMismatchError = exports.ChainWNativeMissingError = exports.NativeAmountOnNonWNativeVaultError = exports.DepositSpenderMismatchError = void 0;
5
- exports.MidnightCalldataEncodingError = exports.MidnightZeroAccountError = exports.MissingContractCodeError = exports.MidnightOfferNotReduceOnlyError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.MidnightInvalidAccountAddressError = exports.InvalidMidnightHexInputError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.MidnightReplacementGroupCancelledError = exports.MidnightOfferRatifierMismatchError = exports.MidnightTakeableOfferZeroSellerReceiverError = exports.MidnightTakeableOfferMarketMismatchError = exports.ZeroBlueParkingSharesError = exports.EmptyBlueParkingMarketError = exports.MidnightOfferCallbackDataMismatchError = exports.MidnightOfferCallbackMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = void 0;
5
+ exports.MidnightCalldataEncodingError = exports.MidnightZeroAccountError = exports.MissingContractCodeError = exports.MidnightOfferNotReduceOnlyError = exports.RefinanceTokenMismatchError = exports.RefinanceSameMarketError = exports.VaultAssetMismatchError = exports.ReallocationWithdrawExceedsMarketSupplyError = exports.WithdrawSharesExceedSupplyError = exports.WithdrawExceedsSupplyError = exports.MutuallyExclusiveWithdrawAmountsError = exports.MidnightInvalidAccountAddressError = exports.InvalidMidnightHexInputError = exports.InsufficientMidnightWithdrawableLiquidityError = exports.MidnightRedeemExceedsCreditError = exports.NoMidnightCreditToRedeemError = exports.MidnightReplacementGroupCancelledError = exports.MidnightOfferRatifierMismatchError = exports.MidnightTakeableOfferZeroSellerReceiverError = exports.MidnightTakeableOfferMarketMismatchError = exports.MissingDeadSharesDataError = exports.InsufficientDeadSharesError = exports.ZeroBlueParkingSharesError = exports.EmptyBlueParkingMarketError = exports.MidnightOfferCallbackDataMismatchError = exports.MidnightOfferCallbackMismatchError = exports.MidnightOfferMarketLoanTokenMismatchError = exports.MidnightMarketAddressMismatchError = void 0;
6
6
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
7
7
  const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
8
8
  const constant_js_1 = require("../helpers/constant.js");
@@ -1219,11 +1219,16 @@ class RepaySharesExceedDebtError extends Error {
1219
1219
  }
1220
1220
  exports.RepaySharesExceedDebtError = RepaySharesExceedDebtError;
1221
1221
  /**
1222
- * Thrown when shared liquidity selected by a Vault V2 reallocation planner cannot
1223
- * cover the operation's absolute shortfall on the target market — the resulting
1224
- * `morphoBorrow` or `morphoWithdraw` would still revert onchain.
1222
+ * Thrown when shared liquidity cannot cover the operation's required
1223
+ * reallocated assets. When Blue's balance is explicit, it is also thrown if
1224
+ * that balance cannot fund the penalty flash loan, an earlier market-sourced
1225
+ * withdrawal, or the final operation transfer. A borrow or withdraw plan that
1226
+ * otherwise covers its shortfall but whose planned penalty exceeds its amount
1227
+ * instead throws `InputExceedsMaxError`.
1225
1228
  *
1226
- * Pattern-match on the class and inspect `params` to surface the gap to users.
1229
+ * `shortfall` is the reallocated assets required by the operation and is
1230
+ * comparable to `available`. Pattern-match on the class and inspect `params`
1231
+ * to surface the gap to users.
1227
1232
  */
1228
1233
  class InsufficientSharedLiquidityError extends Error {
1229
1234
  params;
@@ -1689,7 +1694,12 @@ class MidnightOfferCallbackDataMismatchError extends Error {
1689
1694
  }
1690
1695
  }
1691
1696
  exports.MidnightOfferCallbackDataMismatchError = MidnightOfferCallbackDataMismatchError;
1692
- /** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
1697
+ /**
1698
+ * Thrown when loan assets would be parked in a Morpho Blue market with no existing supply.
1699
+ *
1700
+ * @deprecated `supplyBlueMakeLend` now throws `InsufficientDeadSharesError` or
1701
+ * `MissingDeadSharesDataError` instead; kept exported so existing `instanceof` checks compile.
1702
+ */
1693
1703
  class EmptyBlueParkingMarketError extends Error {
1694
1704
  constructor(params) {
1695
1705
  super(`Morpho Blue market "${params.marketId}" has no supply shares. Parking assets in an empty market is exposed to supply-share-price inflation; choose a market with existing supply.`);
@@ -1708,6 +1718,50 @@ class ZeroBlueParkingSharesError extends Error {
1708
1718
  }
1709
1719
  }
1710
1720
  exports.ZeroBlueParkingSharesError = ZeroBlueParkingSharesError;
1721
+ /**
1722
+ * Thrown when a Morpho Blue market or vault, or a market or Vault V1 it can allocate to, fails the
1723
+ * dead-deposit rule that protects deposits against share-price inflation.
1724
+ */
1725
+ class InsufficientDeadSharesError extends Error {
1726
+ /** Failing entity, outermost vault first; the last element is the market id or vault address. */
1727
+ entity;
1728
+ /** Failed condition. */
1729
+ reason;
1730
+ /** Observed dead shares or assets; for `sharePrice`, `(totalAssets + 1) * 10 * virtualShares`. */
1731
+ observed;
1732
+ /** Required minimum; for `sharePrice`, `totalSupply + virtualShares + 1`. */
1733
+ required;
1734
+ constructor(params) {
1735
+ const target = params.entity.join(" > ");
1736
+ super(params.reason === "sharePrice"
1737
+ ? `Vault V2 "${target}" share price is at or below 1 / (10 * virtualShares) ("${params.observed}" < "${params.required}"), so it may have been deflated before its dead deposit. Choose another vault.`
1738
+ : `"${target}" holds "${params.observed}" dead ${params.reason === "deadShares" ? "shares" : "assets"} at 0x000000000000000000000000000000000000dEaD, below the required "${params.required}". Choose a market or vault with a sufficient dead deposit.`);
1739
+ this.name = "InsufficientDeadSharesError";
1740
+ this.entity = params.entity;
1741
+ this.reason = params.reason;
1742
+ this.observed = params.observed;
1743
+ this.required = params.required;
1744
+ }
1745
+ }
1746
+ exports.InsufficientDeadSharesError = InsufficientDeadSharesError;
1747
+ /**
1748
+ * Thrown when a market or vault snapshot lacks the data the dead-deposit check needs, such as a
1749
+ * snapshot built by hand, from the Morpho API or by an older fetcher, or a Vault V2 adapter the
1750
+ * SDK cannot hydrate. The check fails closed rather than pass unverified data.
1751
+ */
1752
+ class MissingDeadSharesDataError extends Error {
1753
+ /** Entity missing the data, outermost vault first. */
1754
+ entity;
1755
+ /** Missing field. */
1756
+ field;
1757
+ constructor(params) {
1758
+ super(`"${params.entity.join(" > ")}" has no "${params.field}" data for the dead-deposit check. Fetch the snapshot with the @morpho-org/blue-sdk-viem fetchers before building the transaction.`);
1759
+ this.name = "MissingDeadSharesDataError";
1760
+ this.entity = params.entity;
1761
+ this.field = params.field;
1762
+ }
1763
+ }
1764
+ exports.MissingDeadSharesDataError = MissingDeadSharesDataError;
1711
1765
  /** Thrown when a quoted Midnight takeable offer belongs to a different market than the requested flow. */
1712
1766
  class MidnightTakeableOfferMarketMismatchError extends Error {
1713
1767
  constructor(params) {
@@ -56,9 +56,11 @@ export interface VaultV2BluePublicAllocatorOptions {
56
56
  readonly reallocatableVaults?: Iterable<Address>;
57
57
  /**
58
58
  * Maximum utilization source markets may reach during friendly discovery,
59
- * scaled by WAD. Within each penalty tier, the amount-aware planner falls
60
- * back to 100% only when that tier's friendly pass leaves an absolute
61
- * shortfall.
59
+ * scaled by WAD. Within each penalty tier, the planner tries this friendly
60
+ * utilization before falling back to 100% when required coverage remains.
61
+ * Positive-penalty tiers cover the remaining absolute shortfall or, when
62
+ * larger, Blue's loan-token balance deficit while BlueBundlesV1 flash-loans
63
+ * the penalty.
62
64
  *
63
65
  * @default 90% (900000000000000000n)
64
66
  */
@@ -66,9 +68,11 @@ export interface VaultV2BluePublicAllocatorOptions {
66
68
  /**
67
69
  * Maximum proportional vault-asset penalty accepted per call, scaled by
68
70
  * WAD; higher-penalty vaults are ignored. Must not exceed WAD. Operation
69
- * plans consider penalty tiers ascending, free first. Each tier uses friendly
70
- * source utilization (90% by default) before 100%; positive tiers cover only
71
- * the remaining absolute shortfall. Free capacity inside
71
+ * plans consider penalty tiers ascending, free first. Each tier tries
72
+ * friendly source utilization (90% by default) before falling back to 100%
73
+ * when required coverage remains. Positive-penalty tiers cover the remaining
74
+ * absolute shortfall or, when larger, Blue's loan-token balance deficit while
75
+ * BlueBundlesV1 flash-loans the penalty. Free capacity inside
72
76
  * `allocatorCapHeadroom` stays unused, so a penalized leg can cover it.
73
77
  * Getters count all vaults up to this limit. For `refinance`, compute the
74
78
  * plan on the destination-market handle (for example,
package/lib/esm/abis.d.ts CHANGED
@@ -4,7 +4,7 @@ export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi,
4
4
  preLiquidationAbi as bluePreLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
6
  preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
7
- export { blueBuyCallbackFactoryAbi as midnightBlueBuyCallbackFactoryAbi, ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, priceRatifierV1Abi as midnightPriceRatifierV1Abi, rateRatifierV1Abi as midnightRateRatifierV1Abi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
7
+ export { blueBuyCallbackFactoryAbi as midnightBlueBuyCallbackFactoryAbi, ecrecoverAuthorizerAbi as midnightEcrecoverAuthorizerAbi, ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, midnightEventsAbi, priceRatifierV1Abi as midnightPriceRatifierV1Abi, rateRatifierV1Abi as midnightRateRatifierV1Abi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
8
8
  /** ABI for the VaultExitBundlesV1 periphery contract. */
9
9
  export declare const vaultExitBundlesV1Abi: readonly [{
10
10
  readonly type: "constructor";
package/lib/esm/abis.js CHANGED
@@ -4,7 +4,7 @@ export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi,
4
4
  preLiquidationAbi as bluePreLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
6
  preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
7
- export { blueBuyCallbackFactoryAbi as midnightBlueBuyCallbackFactoryAbi, ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, priceRatifierV1Abi as midnightPriceRatifierV1Abi, rateRatifierV1Abi as midnightRateRatifierV1Abi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
7
+ export { blueBuyCallbackFactoryAbi as midnightBlueBuyCallbackFactoryAbi, ecrecoverAuthorizerAbi as midnightEcrecoverAuthorizerAbi, ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesV2Abi, midnightEventsAbi, priceRatifierV1Abi as midnightPriceRatifierV1Abi, rateRatifierV1Abi as midnightRateRatifierV1Abi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
8
8
  /** ABI for the VaultExitBundlesV1 periphery contract. */
9
9
  export const vaultExitBundlesV1Abi = [
10
10
  {
@@ -1 +1 @@
1
- export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId, LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType, } from "@morpho-org/blue-sdk";
1
+ export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId, LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType, } from "@morpho-org/blue-sdk";
@@ -1 +1 @@
1
- export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId, LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType, } from "@morpho-org/blue-sdk";
1
+ export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId, LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType, } from "@morpho-org/blue-sdk";
@@ -1,4 +1,4 @@
1
- export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
1
+ export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
2
  export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";
4
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, } from "./helpers/constant.js";
@@ -1,4 +1,4 @@
1
- export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
1
+ export { DEAD_ADDRESS, DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
2
  export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
- export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, } from "./helpers/constant.js";
4
+ export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_ALLOCATOR_CAP_HEADROOM, DEFAULT_CAP_ACCRUAL_BUFFER, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, MIDNIGHT_TAKE_MAX_DEADLINE_SECONDS, MIN_DEAD_SHARES, MIN_VAULT_V2_DEAD_ASSETS, } from "./helpers/constant.js";