@morpho-org/morpho-sdk 9.7.0 → 10.0.0-next.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.
- package/MIGRATION-v9-to-v10.md +114 -0
- package/README.md +5 -1
- package/lib/cjs/abis.d.ts +1 -1
- package/lib/cjs/abis.js +5 -1
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +1 -1
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +2 -1
- package/lib/cjs/actions/midnight/cancelAndMake.js +2 -1
- package/lib/cjs/actions/midnight/cancelOffers.d.ts +54 -0
- package/lib/cjs/actions/midnight/cancelOffers.js +107 -0
- package/lib/cjs/actions/midnight/index.d.ts +1 -0
- package/lib/cjs/actions/midnight/index.js +1 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +1 -1
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeBorrow.js +1 -1
- package/lib/cjs/actions/midnight/takeLend.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeLend.js +1 -1
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +1 -1
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeWithdraw.js +1 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +3 -3
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +3 -2
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +5 -1
- package/lib/cjs/blue/entities.d.ts +4 -4
- package/lib/cjs/blue/entities.js +3 -1
- package/lib/cjs/blue/errors.d.ts +2 -2
- package/lib/cjs/blue/errors.js +5 -1
- package/lib/cjs/blue/fetch.d.ts +2 -2
- package/lib/cjs/blue/fetch.js +3 -1
- package/lib/cjs/blue/utils.d.ts +1 -1
- package/lib/cjs/blue/utils.js +2 -1
- package/lib/cjs/entities/blue/blue.d.ts +34 -28
- package/lib/cjs/entities/blue/blue.js +99 -73
- package/lib/cjs/entities/index.d.ts +4 -4
- package/lib/cjs/entities/index.js +3 -1
- package/lib/cjs/entities/midnight/deadline.d.ts +2 -2
- package/lib/cjs/entities/midnight/deadline.js +2 -2
- package/lib/cjs/entities/midnight/midnight.d.ts +49 -51
- package/lib/cjs/entities/midnight/midnight.js +144 -131
- package/lib/cjs/entities/midnight/publication.d.ts +2 -0
- package/lib/cjs/entities/midnight/publication.js +126 -100
- package/lib/cjs/entities/midnight/types.d.ts +4 -4
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +17 -17
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +3 -4
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +1 -1
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/cjs/entities/vaultV1/vaultV1.js +83 -57
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +50 -24
- package/lib/cjs/entities/vaultV2/vaultV2.js +166 -90
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +17 -2
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1410 -806
- package/lib/cjs/errors.d.ts +4 -4
- package/lib/cjs/errors.js +7 -5
- package/lib/cjs/fetch.d.ts +2 -2
- package/lib/cjs/fetch.js +3 -1
- package/lib/cjs/helpers/deadShares.js +55 -34
- package/lib/cjs/helpers/metadata.d.ts +14 -2
- package/lib/cjs/helpers/metadata.js +39 -4
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +34 -22
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +7 -1
- package/lib/cjs/helpers/validate.js +76 -61
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +154 -103
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +31 -20
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/midnight/errors.d.ts +2 -1
- package/lib/cjs/midnight/errors.js +5 -4
- package/lib/cjs/transactionPlan/plan.js +6 -3
- package/lib/cjs/transactionPlan/serde.js +7 -7
- package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +6 -4
- package/lib/cjs/transactionPlan/vaultv2/deposit.js +5 -3
- package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +6 -4
- package/lib/cjs/transactionPlan/vaultv2/withdraw.js +5 -3
- package/lib/cjs/types/action.d.ts +26 -2
- package/lib/cjs/types/action.js +1 -1
- package/lib/cjs/types/error.js +11 -5
- package/lib/cjs/types/metadata.d.ts +12 -2
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +4 -2
- package/lib/cjs/version.d.ts +2 -0
- package/lib/cjs/version.js +6 -0
- package/lib/esm/abis.d.ts +1 -1
- package/lib/esm/abis.js +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +1 -1
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +2 -1
- package/lib/esm/actions/midnight/cancelAndMake.js +2 -1
- package/lib/esm/actions/midnight/cancelOffers.d.ts +54 -0
- package/lib/esm/actions/midnight/cancelOffers.js +103 -0
- package/lib/esm/actions/midnight/index.d.ts +1 -0
- package/lib/esm/actions/midnight/index.js +1 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +1 -1
- package/lib/esm/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/takeBorrow.js +1 -1
- package/lib/esm/actions/midnight/takeLend.d.ts +1 -1
- package/lib/esm/actions/midnight/takeLend.js +1 -1
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +1 -1
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/esm/actions/midnight/takeWithdraw.js +1 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -4
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +4 -6
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +3 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +3 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +3 -2
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +4 -4
- package/lib/esm/blue/entities.js +2 -2
- package/lib/esm/blue/errors.d.ts +2 -2
- package/lib/esm/blue/errors.js +2 -2
- package/lib/esm/blue/fetch.d.ts +2 -2
- package/lib/esm/blue/fetch.js +2 -2
- package/lib/esm/blue/utils.d.ts +1 -1
- package/lib/esm/blue/utils.js +1 -1
- package/lib/esm/entities/blue/blue.d.ts +34 -28
- package/lib/esm/entities/blue/blue.js +99 -73
- package/lib/esm/entities/index.d.ts +4 -4
- package/lib/esm/entities/index.js +2 -2
- package/lib/esm/entities/midnight/deadline.d.ts +2 -2
- package/lib/esm/entities/midnight/deadline.js +2 -2
- package/lib/esm/entities/midnight/midnight.d.ts +49 -51
- package/lib/esm/entities/midnight/midnight.js +145 -132
- package/lib/esm/entities/midnight/publication.d.ts +2 -0
- package/lib/esm/entities/midnight/publication.js +126 -100
- package/lib/esm/entities/midnight/types.d.ts +4 -4
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +17 -17
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +3 -4
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +1 -1
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/esm/entities/vaultV1/vaultV1.js +83 -57
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +50 -24
- package/lib/esm/entities/vaultV2/vaultV2.js +166 -90
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +17 -2
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1410 -806
- package/lib/esm/errors.d.ts +4 -4
- package/lib/esm/errors.js +4 -4
- package/lib/esm/fetch.d.ts +2 -2
- package/lib/esm/fetch.js +2 -2
- package/lib/esm/helpers/deadShares.js +56 -35
- package/lib/esm/helpers/metadata.d.ts +14 -2
- package/lib/esm/helpers/metadata.js +38 -4
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +34 -22
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +7 -1
- package/lib/esm/helpers/validate.js +76 -61
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +153 -102
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +31 -20
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/midnight/errors.d.ts +2 -1
- package/lib/esm/midnight/errors.js +2 -1
- package/lib/esm/transactionPlan/plan.js +6 -3
- package/lib/esm/transactionPlan/serde.js +7 -7
- package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +6 -4
- package/lib/esm/transactionPlan/vaultv2/deposit.js +5 -3
- package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +6 -4
- package/lib/esm/transactionPlan/vaultv2/withdraw.js +5 -3
- package/lib/esm/types/action.d.ts +26 -2
- package/lib/esm/types/action.js +1 -1
- package/lib/esm/types/error.js +11 -5
- package/lib/esm/types/metadata.d.ts +12 -2
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/lib/esm/version.d.ts +2 -0
- package/lib/esm/version.js +3 -0
- package/package.json +8 -7
|
@@ -10,11 +10,58 @@ const common_js_1 = require("../../actions/bundles/common.js");
|
|
|
10
10
|
const index_js_1 = require("../../actions/index.js");
|
|
11
11
|
const validateClientChainId_js_1 = require("../../actions/requirements/validateClientChainId.js");
|
|
12
12
|
const index_js_2 = require("../../helpers/index.js");
|
|
13
|
+
const metadata_js_1 = require("../../helpers/metadata.js");
|
|
13
14
|
const validate_js_1 = require("../../helpers/validate.js");
|
|
14
15
|
const index_js_3 = require("../../types/index.js");
|
|
15
16
|
const assertContractCode_js_1 = require("../requirements/assertContractCode.js");
|
|
16
17
|
const getVaultBundlesSharesRequirements_js_1 = require("../requirements/getVaultBundlesSharesRequirements.js");
|
|
17
18
|
const index_js_4 = require("../requirements/index.js");
|
|
19
|
+
function validateInKindCoverage({ amount, marketParamsListSnapshot, vaultData, now, }) {
|
|
20
|
+
let covered = 0n;
|
|
21
|
+
const assignedByMarket = new Map();
|
|
22
|
+
for (const marketParams of marketParamsListSnapshot) {
|
|
23
|
+
if (covered === amount)
|
|
24
|
+
break;
|
|
25
|
+
const marketId = blue_sdk_1.MarketUtils.getMarketId(marketParams);
|
|
26
|
+
const allocation = vaultData.allocations.get(marketId);
|
|
27
|
+
if (allocation?.config.enabled !== true)
|
|
28
|
+
continue;
|
|
29
|
+
if (allocation.position.supplyShares === 0n)
|
|
30
|
+
continue;
|
|
31
|
+
const market = allocation.position.market.accrueInterest(now);
|
|
32
|
+
const available = market.toSupplyAssets(allocation.position.supplyShares);
|
|
33
|
+
const assigned = assignedByMarket.get(marketId) ?? 0n;
|
|
34
|
+
const chunk = blue_sdk_1.MathLib.min(available, amount - covered);
|
|
35
|
+
if (assigned + chunk > available) {
|
|
36
|
+
throw new index_js_3.InKindRedeemCoverageError({
|
|
37
|
+
required: amount,
|
|
38
|
+
covered,
|
|
39
|
+
maxExitAssets: covered,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
assignedByMarket.set(marketId, assigned + chunk);
|
|
43
|
+
covered += chunk;
|
|
44
|
+
}
|
|
45
|
+
if (covered < amount) {
|
|
46
|
+
throw new index_js_3.InKindRedeemCoverageError({
|
|
47
|
+
required: amount,
|
|
48
|
+
covered,
|
|
49
|
+
maxExitAssets: covered,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getMigrationAmounts(params) {
|
|
54
|
+
const assets = "assets" in params ? params.assets : undefined;
|
|
55
|
+
const shares = "shares" in params ? params.shares : undefined;
|
|
56
|
+
if ((assets == null) === (shares == null)) {
|
|
57
|
+
throw new index_js_3.AmountAndSharesExclusiveError();
|
|
58
|
+
}
|
|
59
|
+
const selectedAmount = assets ?? shares ?? 0n;
|
|
60
|
+
if (selectedAmount <= 0n) {
|
|
61
|
+
throw new index_js_3.NonPositiveInputError(assets != null ? "assets" : "shares", selectedAmount);
|
|
62
|
+
}
|
|
63
|
+
return { assets, shares };
|
|
64
|
+
}
|
|
18
65
|
/** Binds a viem client to a Vault V1 (MetaMorpho) vault's action builders. */
|
|
19
66
|
class MorphoVaultV1 {
|
|
20
67
|
client;
|
|
@@ -51,13 +98,15 @@ class MorphoVaultV1 {
|
|
|
51
98
|
}
|
|
52
99
|
/** {@inheritDoc VaultV1Actions.deposit} */
|
|
53
100
|
deposit(params) {
|
|
101
|
+
const suppliedNow = params.now;
|
|
102
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(this.client.options.metadata, suppliedNow);
|
|
54
103
|
const { userAddress, vaultData } = params;
|
|
55
104
|
const { asset: vaultAsset } = vaultData;
|
|
56
105
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
57
106
|
if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
|
|
58
107
|
throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
|
|
59
108
|
}
|
|
60
|
-
const createdAt = morpho_ts_1.Time.timestamp();
|
|
109
|
+
const createdAt = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
61
110
|
const deadline = params.deadline ?? createdAt + morpho_ts_1.Time.s.from.h(2n);
|
|
62
111
|
if (deadline <= createdAt)
|
|
63
112
|
throw new index_js_3.ExpiredDeadlineError(deadline, createdAt);
|
|
@@ -84,7 +133,7 @@ class MorphoVaultV1 {
|
|
|
84
133
|
let pendingRequirements;
|
|
85
134
|
return Object.freeze({
|
|
86
135
|
getRequirements: async (requirementOptions) => {
|
|
87
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
136
|
+
const now = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
88
137
|
if (deadline <= now)
|
|
89
138
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
90
139
|
if (pendingRequirements != null)
|
|
@@ -138,12 +187,14 @@ class MorphoVaultV1 {
|
|
|
138
187
|
referralFeeRecipient: common.referralFeeRecipient,
|
|
139
188
|
deadline,
|
|
140
189
|
},
|
|
141
|
-
metadata
|
|
190
|
+
metadata,
|
|
142
191
|
});
|
|
143
192
|
},
|
|
144
193
|
});
|
|
145
194
|
}
|
|
146
195
|
withdraw(params) {
|
|
196
|
+
const suppliedNow = params.now;
|
|
197
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(this.client.options.metadata, suppliedNow);
|
|
147
198
|
const { amount, userAddress, vaultData } = params;
|
|
148
199
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
149
200
|
if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
|
|
@@ -153,7 +204,7 @@ class MorphoVaultV1 {
|
|
|
153
204
|
throw new index_js_3.NonPositiveInputError("amount", amount);
|
|
154
205
|
// Reject values outside the ABI range before resolving any requirements.
|
|
155
206
|
(0, validate_js_1.validateUint256Field)("amount", amount);
|
|
156
|
-
const createdAt = morpho_ts_1.Time.timestamp();
|
|
207
|
+
const createdAt = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
157
208
|
const deadline = params.deadline ?? createdAt + morpho_ts_1.Time.s.from.h(2n);
|
|
158
209
|
if (deadline <= createdAt)
|
|
159
210
|
throw new index_js_3.ExpiredDeadlineError(deadline, createdAt);
|
|
@@ -174,7 +225,7 @@ class MorphoVaultV1 {
|
|
|
174
225
|
});
|
|
175
226
|
return Object.freeze({
|
|
176
227
|
getRequirements: async () => {
|
|
177
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
228
|
+
const now = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
178
229
|
if (deadline <= now)
|
|
179
230
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
180
231
|
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
@@ -206,18 +257,20 @@ class MorphoVaultV1 {
|
|
|
206
257
|
referralFeeRecipient: common.referralFeeRecipient,
|
|
207
258
|
deadline,
|
|
208
259
|
},
|
|
209
|
-
metadata
|
|
260
|
+
metadata,
|
|
210
261
|
});
|
|
211
262
|
},
|
|
212
263
|
});
|
|
213
264
|
}
|
|
214
265
|
/** {@inheritDoc VaultV1Actions.redeem} */
|
|
215
266
|
redeem(params) {
|
|
267
|
+
const suppliedNow = params.now;
|
|
268
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(this.client.options.metadata, suppliedNow);
|
|
216
269
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
217
270
|
const { shares, userAddress } = params;
|
|
218
271
|
if (shares <= 0n)
|
|
219
272
|
throw new index_js_3.NonPositiveInputError("shares", shares);
|
|
220
|
-
const createdAt = morpho_ts_1.Time.timestamp();
|
|
273
|
+
const createdAt = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
221
274
|
const deadline = params.deadline ?? createdAt + morpho_ts_1.Time.s.from.h(2n);
|
|
222
275
|
if (deadline <= createdAt)
|
|
223
276
|
throw new index_js_3.ExpiredDeadlineError(deadline, createdAt);
|
|
@@ -229,7 +282,7 @@ class MorphoVaultV1 {
|
|
|
229
282
|
const spender = (0, morpho_ts_1.getChainAddress)(this.chainId, "bundles.vaultBundlesV1");
|
|
230
283
|
return Object.freeze({
|
|
231
284
|
getRequirements: async () => {
|
|
232
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
285
|
+
const now = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
233
286
|
if (deadline <= now)
|
|
234
287
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
235
288
|
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
@@ -260,13 +313,16 @@ class MorphoVaultV1 {
|
|
|
260
313
|
referralFeeRecipient: common.referralFeeRecipient,
|
|
261
314
|
deadline,
|
|
262
315
|
},
|
|
263
|
-
metadata
|
|
316
|
+
metadata,
|
|
264
317
|
});
|
|
265
318
|
},
|
|
266
319
|
});
|
|
267
320
|
}
|
|
268
321
|
/** {@inheritDoc VaultV1Actions.inKindRedeem} */
|
|
269
|
-
inKindRedeem(
|
|
322
|
+
inKindRedeem(params) {
|
|
323
|
+
const suppliedNow = params.now;
|
|
324
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(this.client.options.metadata, suppliedNow);
|
|
325
|
+
const { amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, } = params;
|
|
270
326
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
271
327
|
if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
|
|
272
328
|
throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
|
|
@@ -282,7 +338,7 @@ class MorphoVaultV1 {
|
|
|
282
338
|
irm,
|
|
283
339
|
lltv,
|
|
284
340
|
}));
|
|
285
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
341
|
+
const now = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
286
342
|
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
287
343
|
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
288
344
|
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
@@ -291,38 +347,13 @@ class MorphoVaultV1 {
|
|
|
291
347
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
292
348
|
const vaultExitBundlesV1 = (0, morpho_ts_1.getChainAddress)(this.chainId, "bundles.vaultExitBundlesV1");
|
|
293
349
|
const blue = (0, morpho_ts_1.getChainAddress)(this.chainId, "blue");
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (allocation?.config.enabled !== true)
|
|
302
|
-
continue;
|
|
303
|
-
if (allocation.position.supplyShares === 0n)
|
|
304
|
-
continue;
|
|
305
|
-
const market = allocation.position.market.accrueInterest(now);
|
|
306
|
-
const available = market.toSupplyAssets(allocation.position.supplyShares);
|
|
307
|
-
const assigned = assignedByMarket.get(marketId) ?? 0n;
|
|
308
|
-
const chunk = blue_sdk_1.MathLib.min(available, amount - covered);
|
|
309
|
-
if (assigned + chunk > available) {
|
|
310
|
-
throw new index_js_3.InKindRedeemCoverageError({
|
|
311
|
-
required: amount,
|
|
312
|
-
covered,
|
|
313
|
-
maxExitAssets: covered,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
assignedByMarket.set(marketId, assigned + chunk);
|
|
317
|
-
covered += chunk;
|
|
318
|
-
}
|
|
319
|
-
if (covered < amount) {
|
|
320
|
-
throw new index_js_3.InKindRedeemCoverageError({
|
|
321
|
-
required: amount,
|
|
322
|
-
covered,
|
|
323
|
-
maxExitAssets: covered,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
350
|
+
// Reject insufficient ordered market coverage before preparing share requirements.
|
|
351
|
+
validateInKindCoverage({
|
|
352
|
+
amount,
|
|
353
|
+
marketParamsListSnapshot,
|
|
354
|
+
vaultData,
|
|
355
|
+
now,
|
|
356
|
+
});
|
|
326
357
|
const requiredShareAllowance = (0, index_js_2.computeVaultMaxShareAllowance)({
|
|
327
358
|
vaultData,
|
|
328
359
|
deadline: now,
|
|
@@ -331,7 +362,7 @@ class MorphoVaultV1 {
|
|
|
331
362
|
});
|
|
332
363
|
return {
|
|
333
364
|
getRequirements: async () => {
|
|
334
|
-
const requirementsTimestamp = morpho_ts_1.Time.timestamp();
|
|
365
|
+
const requirementsTimestamp = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
335
366
|
if (deadline <= requirementsTimestamp) {
|
|
336
367
|
throw new index_js_3.ExpiredDeadlineError(deadline, requirementsTimestamp);
|
|
337
368
|
}
|
|
@@ -393,6 +424,7 @@ class MorphoVaultV1 {
|
|
|
393
424
|
if (this.client.options.supportSignature) {
|
|
394
425
|
return [
|
|
395
426
|
(0, index_js_1.encodeVaultSharesPermit)({
|
|
427
|
+
now: suppliedNow == null ? undefined : now,
|
|
396
428
|
vault: vaultData,
|
|
397
429
|
version: "vaultV1",
|
|
398
430
|
spender: vaultExitBundlesV1,
|
|
@@ -427,13 +459,15 @@ class MorphoVaultV1 {
|
|
|
427
459
|
deadline,
|
|
428
460
|
requirementSignature: permit,
|
|
429
461
|
},
|
|
430
|
-
metadata
|
|
462
|
+
metadata,
|
|
431
463
|
});
|
|
432
464
|
},
|
|
433
465
|
};
|
|
434
466
|
}
|
|
435
467
|
/** {@inheritDoc VaultV1Actions.migrateToV2} */
|
|
436
468
|
migrateToV2(params) {
|
|
469
|
+
const suppliedNow = params.now;
|
|
470
|
+
const metadata = (0, metadata_js_1.resolveTransactionMetadata)(this.client.options.metadata, suppliedNow);
|
|
437
471
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
438
472
|
if (!(0, viem_1.isAddressEqual)(params.sourceVault.address, this.vault)) {
|
|
439
473
|
throw new index_js_3.VaultAddressMismatchError(this.vault, params.sourceVault.address);
|
|
@@ -444,18 +478,10 @@ class MorphoVaultV1 {
|
|
|
444
478
|
if ((0, viem_1.isAddressEqual)(this.vault, params.targetVault.address)) {
|
|
445
479
|
throw new index_js_3.SameVaultMigrationError(this.vault);
|
|
446
480
|
}
|
|
447
|
-
const
|
|
448
|
-
const shares = "shares" in params ? params.shares : undefined;
|
|
449
|
-
if ((assets == null) === (shares == null)) {
|
|
450
|
-
throw new index_js_3.AmountAndSharesExclusiveError();
|
|
451
|
-
}
|
|
452
|
-
const selectedAmount = assets ?? shares ?? 0n;
|
|
453
|
-
if (selectedAmount <= 0n) {
|
|
454
|
-
throw new index_js_3.NonPositiveInputError(assets != null ? "assets" : "shares", selectedAmount);
|
|
455
|
-
}
|
|
481
|
+
const { assets, shares } = getMigrationAmounts(params);
|
|
456
482
|
const slippageTolerance = params.slippageTolerance ?? blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE;
|
|
457
483
|
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
458
|
-
const createdAt = morpho_ts_1.Time.timestamp();
|
|
484
|
+
const createdAt = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
459
485
|
const deadline = params.deadline ?? createdAt + morpho_ts_1.Time.s.from.h(2n);
|
|
460
486
|
if (deadline <= createdAt)
|
|
461
487
|
throw new index_js_3.ExpiredDeadlineError(deadline, createdAt);
|
|
@@ -504,7 +530,7 @@ class MorphoVaultV1 {
|
|
|
504
530
|
});
|
|
505
531
|
return Object.freeze({
|
|
506
532
|
getRequirements: async () => {
|
|
507
|
-
const now = morpho_ts_1.Time.timestamp();
|
|
533
|
+
const now = suppliedNow ?? morpho_ts_1.Time.timestamp();
|
|
508
534
|
if (deadline <= now)
|
|
509
535
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
510
536
|
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
@@ -543,7 +569,7 @@ class MorphoVaultV1 {
|
|
|
543
569
|
referralFeeRecipient: common.referralFeeRecipient,
|
|
544
570
|
deadline,
|
|
545
571
|
},
|
|
546
|
-
metadata
|
|
572
|
+
metadata,
|
|
547
573
|
});
|
|
548
574
|
},
|
|
549
575
|
});
|
|
@@ -2,7 +2,7 @@ import { type AccrualVaultV2, MarketParams } from "@morpho-org/blue-sdk";
|
|
|
2
2
|
import { fetchAccrualVaultV2 } from "@morpho-org/blue-sdk-viem";
|
|
3
3
|
import { type Address } from "viem";
|
|
4
4
|
import type { FetchParameters } from "../../types/data.js";
|
|
5
|
-
import { type ActionOutput, type ActionRequirement, type BundlesFundingArgs, type BundlesTokenRequirementsOptions, type Deallocation, type MorphoClientType, type RequirementSignature, type Transaction, type VaultV2DepositAction, type VaultV2ForceRedeemAction, type VaultV2ForceWithdrawAction, type VaultV2InKindRedeemAction, type VaultV2RedeemAction, type VaultV2WithdrawAction } from "../../types/index.js";
|
|
5
|
+
import { type ActionOutput, type ActionRequirement, type BundlesFundingArgs, type BundlesTokenRequirementsOptions, type Deallocation, type MorphoClientType, type ReferenceTimestampParams, type RequirementSignature, type Transaction, type VaultV2DepositAction, type VaultV2ForceRedeemAction, type VaultV2ForceWithdrawAction, type VaultV2InKindRedeemAction, type VaultV2RedeemAction, type VaultV2WithdrawAction } from "../../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Action surface for Vault V2 reads and writes; writes route through VaultBundlesV1 and
|
|
8
8
|
* VaultExitBundlesV1, except `forceRedeem`, which uses the vault's native multicall.
|
|
@@ -65,7 +65,9 @@ export interface VaultV2Actions {
|
|
|
65
65
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no recipient.
|
|
66
66
|
* @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
|
|
67
67
|
* @throws {NativeAmountOnNonWNativeVaultError} when native funding targets a non-wNative vault.
|
|
68
|
-
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256
|
|
68
|
+
* @throws {InputExceedsMaxError} when funding or the deadline exceeds uint256, or when the vault's
|
|
69
|
+
* liquidity adapter is a Midnight adapter (it cannot receive vault allocations, so no deposit
|
|
70
|
+
* fits and `max` is `0n`).
|
|
69
71
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
70
72
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
71
73
|
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
@@ -113,7 +115,7 @@ export interface VaultV2Actions {
|
|
|
113
115
|
readonly referralFeePct?: bigint;
|
|
114
116
|
readonly referralFeeRecipient?: Address;
|
|
115
117
|
readonly deadline?: bigint;
|
|
116
|
-
} & BundlesFundingArgs) => ActionOutput<VaultV2DepositAction, readonly RequirementSignature[], BundlesTokenRequirementsOptions>;
|
|
118
|
+
} & ReferenceTimestampParams & BundlesFundingArgs) => ActionOutput<VaultV2DepositAction, readonly RequirementSignature[], BundlesTokenRequirementsOptions>;
|
|
117
119
|
/**
|
|
118
120
|
* Prepares an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
119
121
|
*
|
|
@@ -147,7 +149,9 @@ export interface VaultV2Actions {
|
|
|
147
149
|
* @throws {NonPositiveInputError} when `amount` or the computed required share amount is not positive.
|
|
148
150
|
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
149
151
|
* at any `getRequirements()` call.
|
|
150
|
-
* @throws {InputExceedsMaxError} when `amount` or `deadline` exceeds uint256 at handle creation
|
|
152
|
+
* @throws {InputExceedsMaxError} when `amount` or `deadline` exceeds uint256 at handle creation,
|
|
153
|
+
* or when the vault's liquidity adapter is a Midnight adapter and `amount` exceeds the vault's
|
|
154
|
+
* idle assets plus what the adapter can withdraw from the liquidity market.
|
|
151
155
|
* @throws {NegativeInputError} when `referralFeePct` or `slippageTolerance` is negative.
|
|
152
156
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
153
157
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
|
|
@@ -192,7 +196,7 @@ export interface VaultV2Actions {
|
|
|
192
196
|
readonly referralFeePct?: bigint;
|
|
193
197
|
readonly referralFeeRecipient?: Address;
|
|
194
198
|
readonly deadline?: bigint;
|
|
195
|
-
}) => ActionOutput<VaultV2WithdrawAction, readonly RequirementSignature[], undefined>;
|
|
199
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2WithdrawAction, readonly RequirementSignature[], undefined>;
|
|
196
200
|
/**
|
|
197
201
|
* Prepares an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
198
202
|
*
|
|
@@ -213,7 +217,25 @@ export interface VaultV2Actions {
|
|
|
213
217
|
* @throws {NonPositiveInputError} when `shares` is not positive.
|
|
214
218
|
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
215
219
|
* requirement resolution.
|
|
216
|
-
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256
|
|
220
|
+
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256, or from
|
|
221
|
+
* `getRequirements()` when the vault's liquidity adapter is a Midnight adapter and `shares`
|
|
222
|
+
* are worth more than the vault's idle assets plus what the adapter can withdraw from the
|
|
223
|
+
* liquidity market.
|
|
224
|
+
* @throws {UnknownBlueFactory} from `getRequirements()` when the configured chain has no VaultV2 factory.
|
|
225
|
+
* @throws {UnknownBlueOfFactory} from `getRequirements()` when the vault is not a VaultV2 from the
|
|
226
|
+
* configured factory.
|
|
227
|
+
* @throws {UnsupportedBlueVaultV2AdapterError} from `getRequirements()` when the vault or one of its
|
|
228
|
+
* adapters uses an unsupported adapter class.
|
|
229
|
+
* @throws {UnsupportedBlueMarketIrmError} from `getRequirements()` when the vault's liquidity adapter
|
|
230
|
+
* is a Midnight adapter and accrual projects an underlying market with positive debt that uses an
|
|
231
|
+
* unsupported IRM.
|
|
232
|
+
* @throws {UnknownBlueMarketAllocationError} from `getRequirements()` when the vault's liquidity
|
|
233
|
+
* adapter is a Midnight adapter and accrual meets a nested Vault V1 withdraw queue market without
|
|
234
|
+
* allocation data.
|
|
235
|
+
* @throws {InvalidMidnightPositionLossFactorError} from `getRequirements()` when the vault's liquidity
|
|
236
|
+
* adapter is a Midnight adapter and accrual meets a market loss factor below a position's.
|
|
237
|
+
* @throws {InvalidMidnightPositionAccrualStateError} from `getRequirements()` when the vault's
|
|
238
|
+
* liquidity adapter is a Midnight adapter and accrual meets invalid Midnight position inputs.
|
|
217
239
|
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
218
240
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is not below WAD.
|
|
219
241
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
@@ -221,7 +243,7 @@ export interface VaultV2Actions {
|
|
|
221
243
|
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
222
244
|
* @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
|
|
223
245
|
* contract has no code at its registered address.
|
|
224
|
-
* @throws {viem.BaseError} from `getRequirements()` when
|
|
246
|
+
* @throws {viem.BaseError} from `getRequirements()` when a vault-state, allowance, nonce, `eth_chainId`, or
|
|
225
247
|
* `eth_getCode` read fails.
|
|
226
248
|
* @throws {UnknownTokenError} from `getRequirements()` when the share token fetched by
|
|
227
249
|
* `getData()` has unusable decimals.
|
|
@@ -257,7 +279,7 @@ export interface VaultV2Actions {
|
|
|
257
279
|
readonly referralFeePct?: bigint;
|
|
258
280
|
readonly referralFeeRecipient?: Address;
|
|
259
281
|
readonly deadline?: bigint;
|
|
260
|
-
}) => ActionOutput<VaultV2RedeemAction, readonly RequirementSignature[], undefined>;
|
|
282
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2RedeemAction, readonly RequirementSignature[], undefined>;
|
|
261
283
|
/**
|
|
262
284
|
* Prepares an illiquid Vault V2 exit into idle assets and Morpho Blue supply positions.
|
|
263
285
|
*
|
|
@@ -299,9 +321,11 @@ export interface VaultV2Actions {
|
|
|
299
321
|
* @throws {InputExceedsMaxError} when `deadline` exceeds `uint256`.
|
|
300
322
|
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
301
323
|
* requirement resolution.
|
|
302
|
-
* @throws {VaultV2SingleAdapterRequiredError} when the vault does not have one adapter
|
|
324
|
+
* @throws {VaultV2SingleAdapterRequiredError} when the vault does not have one adapter, including
|
|
325
|
+
* a vault that mixes Blue and Midnight adapters.
|
|
303
326
|
* @throws {AdapterNotPartOfVaultError} when `adapter` is not the vault's adapter.
|
|
304
|
-
* @throws {VaultV2UnsupportedExitAdapterError} when the adapter is not a MorphoMarketV1AdapterV2
|
|
327
|
+
* @throws {VaultV2UnsupportedExitAdapterError} when the adapter is not a MorphoMarketV1AdapterV2,
|
|
328
|
+
* including a Midnight adapter.
|
|
305
329
|
* @throws {InKindRedeemCoverageError} when the deduplicated list cannot cover the exit.
|
|
306
330
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
307
331
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
@@ -346,7 +370,7 @@ export interface VaultV2Actions {
|
|
|
346
370
|
readonly userAddress: Address;
|
|
347
371
|
readonly adapter?: Address;
|
|
348
372
|
readonly deadline?: bigint;
|
|
349
|
-
}) => ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
373
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
350
374
|
/**
|
|
351
375
|
* Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
352
376
|
*
|
|
@@ -426,9 +450,11 @@ export interface VaultV2Actions {
|
|
|
426
450
|
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
427
451
|
* requirement resolution.
|
|
428
452
|
* @throws {ExcessiveSlippageToleranceError} when `slippageTolerance` exceeds the SDK maximum.
|
|
429
|
-
* @throws {VaultV2SingleAdapterRequiredError} when the vault does not have exactly one adapter
|
|
453
|
+
* @throws {VaultV2SingleAdapterRequiredError} when the vault does not have exactly one adapter,
|
|
454
|
+
* including a vault that mixes Blue and Midnight adapters.
|
|
430
455
|
* @throws {AdapterNotPartOfVaultError} when `adapter` is not the vault's adapter.
|
|
431
|
-
* @throws {VaultV2UnsupportedExitAdapterError} when the adapter is not a MorphoMarketV1AdapterV2
|
|
456
|
+
* @throws {VaultV2UnsupportedExitAdapterError} when the adapter is not a MorphoMarketV1AdapterV2,
|
|
457
|
+
* including a Midnight adapter.
|
|
432
458
|
* @throws {VaultV2UnsupportedLiquidityAdapterError} when the vault routes liquidity through
|
|
433
459
|
* another adapter.
|
|
434
460
|
* @throws {VaultV2UndecodableLiquidityDataError} when the vault's `liquidityData` does not decode
|
|
@@ -488,7 +514,7 @@ export interface VaultV2Actions {
|
|
|
488
514
|
readonly minSharePriceE27?: bigint;
|
|
489
515
|
readonly referralFeePct?: bigint;
|
|
490
516
|
readonly referralFeeRecipient?: Address;
|
|
491
|
-
}) => ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
517
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
492
518
|
/**
|
|
493
519
|
* Prepares a force redeem transaction for the VaultV2 contract using the vault's native multicall.
|
|
494
520
|
*
|
|
@@ -533,7 +559,7 @@ export interface VaultV2Actions {
|
|
|
533
559
|
shares: bigint;
|
|
534
560
|
};
|
|
535
561
|
userAddress: Address;
|
|
536
|
-
}) => {
|
|
562
|
+
} & ReferenceTimestampParams) => {
|
|
537
563
|
buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
538
564
|
};
|
|
539
565
|
}
|
|
@@ -561,7 +587,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
561
587
|
readonly referralFeePct?: bigint;
|
|
562
588
|
readonly referralFeeRecipient?: Address;
|
|
563
589
|
readonly deadline?: bigint;
|
|
564
|
-
} & BundlesFundingArgs): Readonly<{
|
|
590
|
+
} & ReferenceTimestampParams & BundlesFundingArgs): Readonly<{
|
|
565
591
|
getRequirements: (requirementOptions?: BundlesTokenRequirementsOptions) => Promise<readonly ActionRequirement[]>;
|
|
566
592
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2DepositAction>>;
|
|
567
593
|
}>;
|
|
@@ -573,7 +599,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
573
599
|
readonly referralFeePct?: bigint;
|
|
574
600
|
readonly referralFeeRecipient?: Address;
|
|
575
601
|
readonly deadline?: bigint;
|
|
576
|
-
}): Readonly<{
|
|
602
|
+
} & ReferenceTimestampParams): Readonly<{
|
|
577
603
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../index.js").ERC20ApprovalAction>> | import("../../index.js").Requirement<import("../../index.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
578
604
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2WithdrawAction>>;
|
|
579
605
|
}>;
|
|
@@ -584,21 +610,21 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
584
610
|
readonly referralFeePct?: bigint;
|
|
585
611
|
readonly referralFeeRecipient?: Address;
|
|
586
612
|
readonly deadline?: bigint;
|
|
587
|
-
}): Readonly<{
|
|
613
|
+
} & ReferenceTimestampParams): Readonly<{
|
|
588
614
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../index.js").ERC20ApprovalAction>> | import("../../index.js").Requirement<import("../../index.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
589
615
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2RedeemAction>>;
|
|
590
616
|
}>;
|
|
591
617
|
/** {@inheritDoc VaultV2Actions.inKindRedeem} */
|
|
592
|
-
inKindRedeem(
|
|
618
|
+
inKindRedeem(params: {
|
|
593
619
|
readonly amount: bigint;
|
|
594
620
|
readonly marketParamsList: readonly MarketParams[];
|
|
595
621
|
readonly vaultData: AccrualVaultV2;
|
|
596
622
|
readonly userAddress: Address;
|
|
597
623
|
readonly adapter?: Address;
|
|
598
624
|
readonly deadline?: bigint;
|
|
599
|
-
}): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
625
|
+
} & ReferenceTimestampParams): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
600
626
|
/** {@inheritDoc VaultV2Actions.forceWithdraw} */
|
|
601
|
-
forceWithdraw(
|
|
627
|
+
forceWithdraw(params: {
|
|
602
628
|
readonly exitAssets: bigint;
|
|
603
629
|
readonly vaultData: AccrualVaultV2;
|
|
604
630
|
readonly userAddress: Address;
|
|
@@ -608,14 +634,14 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
608
634
|
readonly minSharePriceE27?: bigint;
|
|
609
635
|
readonly referralFeePct?: bigint;
|
|
610
636
|
readonly referralFeeRecipient?: Address;
|
|
611
|
-
}): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
612
|
-
forceRedeem(
|
|
637
|
+
} & ReferenceTimestampParams): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
638
|
+
forceRedeem(params: {
|
|
613
639
|
deallocations: readonly Deallocation[];
|
|
614
640
|
redeem: {
|
|
615
641
|
shares: bigint;
|
|
616
642
|
};
|
|
617
643
|
userAddress: Address;
|
|
618
|
-
}): {
|
|
644
|
+
} & ReferenceTimestampParams): {
|
|
619
645
|
buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
620
646
|
};
|
|
621
647
|
}
|