@morpho-org/morpho-sdk 9.8.0 → 10.0.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 +109 -13
- package/lib/cjs/actions/blue/common.js +4 -2
- package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -1
- package/lib/cjs/actions/bundles/common.js +20 -14
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +3 -2
- 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 +108 -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/supplyCollateralBatch.js +4 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +3 -2
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeBorrow.js +3 -2
- package/lib/cjs/actions/midnight/takeLend.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeLend.js +3 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +3 -2
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/cjs/actions/midnight/takeWithdraw.js +3 -2
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +4 -2
- 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 +5 -13
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +6 -3
- package/lib/cjs/actions/vaultV1/migrateToV2.js +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +4 -2
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +4 -2
- package/lib/cjs/entities/blue/blue.d.ts +34 -28
- package/lib/cjs/entities/blue/blue.js +107 -77
- package/lib/cjs/entities/midnight/deadline.d.ts +2 -2
- package/lib/cjs/entities/midnight/deadline.js +4 -3
- package/lib/cjs/entities/midnight/midnight.d.ts +49 -51
- package/lib/cjs/entities/midnight/midnight.js +158 -138
- package/lib/cjs/entities/midnight/publication.d.ts +2 -0
- package/lib/cjs/entities/midnight/publication.js +193 -138
- package/lib/cjs/entities/midnight/types.d.ts +4 -4
- package/lib/cjs/entities/requirements/assertContractCode.js +4 -2
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +24 -28
- package/lib/cjs/entities/requirements/getErc2612Permit.js +10 -5
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -4
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +111 -0
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +76 -0
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +93 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +85 -0
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
- package/lib/cjs/entities/vaultV1/migrateToV2Quote.js +37 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/cjs/entities/vaultV1/vaultV1.js +90 -194
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +189 -0
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +110 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +16 -16
- package/lib/cjs/entities/vaultV2/vaultV2.js +94 -385
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +14 -0
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +1599 -883
- package/lib/cjs/errors.d.ts +1 -1
- package/lib/cjs/errors.js +2 -1
- package/lib/cjs/helpers/deadShares.js +83 -47
- package/lib/cjs/helpers/encodeMidnightCalldata.js +4 -2
- package/lib/cjs/helpers/metadata.d.ts +14 -2
- package/lib/cjs/helpers/metadata.js +49 -8
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +44 -27
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +11 -2
- package/lib/cjs/helpers/utilization.js +10 -5
- package/lib/cjs/helpers/validate.js +88 -67
- package/lib/cjs/helpers/validateMidnightBounds.js +2 -1
- package/lib/cjs/helpers/validateMidnightCollateralBatch.js +2 -1
- package/lib/cjs/helpers/validateMidnightPublication.js +4 -2
- package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +177 -104
- package/lib/cjs/helpers/validatePositiveInput.js +2 -1
- package/lib/cjs/helpers/validateTakeableOffers.js +2 -1
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +40 -22
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +10 -1
- package/lib/cjs/transactionPlan/approval.js +12 -1
- package/lib/cjs/transactionPlan/deposit.d.ts +22 -0
- package/lib/cjs/transactionPlan/deposit.js +139 -0
- package/lib/cjs/transactionPlan/error.d.ts +10 -8
- package/lib/cjs/transactionPlan/error.js +10 -8
- package/lib/cjs/transactionPlan/getTokenPermit.js +2 -1
- package/lib/cjs/transactionPlan/index.d.ts +18 -0
- package/lib/cjs/transactionPlan/index.js +23 -5
- package/lib/cjs/transactionPlan/intent.d.ts +3 -3
- package/lib/cjs/transactionPlan/intent.js +14 -7
- package/lib/cjs/transactionPlan/permit.d.ts +1 -1
- package/lib/cjs/transactionPlan/permit.js +86 -20
- package/lib/cjs/transactionPlan/plan.d.ts +16 -6
- package/lib/cjs/transactionPlan/plan.js +77 -24
- package/lib/cjs/transactionPlan/redeem.d.ts +18 -0
- package/lib/cjs/transactionPlan/redeem.js +63 -0
- package/lib/cjs/transactionPlan/requirements.d.ts +4 -3
- package/lib/cjs/transactionPlan/requirements.js +12 -6
- package/lib/cjs/transactionPlan/serde.d.ts +2 -2
- package/lib/cjs/transactionPlan/serde.js +45 -19
- package/lib/cjs/transactionPlan/shareSpending.d.ts +18 -0
- package/lib/cjs/transactionPlan/shareSpending.js +50 -0
- package/lib/cjs/transactionPlan/types.d.ts +117 -11
- package/lib/cjs/transactionPlan/validateActions.js +11 -1
- package/lib/cjs/transactionPlan/validation.js +6 -3
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +93 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +94 -0
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
- package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.js +203 -0
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
- package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +217 -0
- package/lib/cjs/transactionPlan/vaultv1/redeem.d.ts +69 -0
- package/lib/cjs/transactionPlan/vaultv1/redeem.js +78 -0
- package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +77 -0
- package/lib/cjs/transactionPlan/vaultv1/withdraw.js +88 -0
- package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +18 -33
- package/lib/cjs/transactionPlan/vaultv2/deposit.js +19 -143
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
- package/lib/cjs/transactionPlan/vaultv2/forceRedeem.js +155 -0
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
- package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +206 -0
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
- package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.js +206 -0
- package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +84 -0
- package/lib/cjs/transactionPlan/vaultv2/redeem.js +86 -0
- package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +18 -29
- package/lib/cjs/transactionPlan/vaultv2/withdraw.js +21 -126
- package/lib/cjs/transactionPlan/version.js +2 -1
- package/lib/cjs/transactionPlan/withdraw.d.ts +18 -0
- package/lib/cjs/transactionPlan/withdraw.js +94 -0
- package/lib/cjs/types/action.d.ts +26 -2
- package/lib/cjs/types/action.js +17 -9
- package/lib/cjs/types/error.d.ts +8 -1
- package/lib/cjs/types/error.js +21 -6
- package/lib/cjs/types/metadata.d.ts +12 -2
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/actions/blue/common.js +4 -2
- package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -1
- package/lib/esm/actions/bundles/common.js +20 -14
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +3 -4
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +3 -2
- 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 +104 -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/supplyCollateralBatch.js +4 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +3 -2
- package/lib/esm/actions/midnight/takeBorrow.d.ts +1 -1
- package/lib/esm/actions/midnight/takeBorrow.js +3 -2
- package/lib/esm/actions/midnight/takeLend.d.ts +1 -1
- package/lib/esm/actions/midnight/takeLend.js +3 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -1
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +3 -2
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +1 -1
- package/lib/esm/actions/midnight/takeWithdraw.js +3 -2
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +4 -2
- 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 +7 -15
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +3 -5
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +26 -23
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +6 -3
- package/lib/esm/actions/vaultV1/migrateToV2.js +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +4 -2
- package/lib/esm/actions/vaultV2/inKindRedeem.js +4 -2
- package/lib/esm/entities/blue/blue.d.ts +34 -28
- package/lib/esm/entities/blue/blue.js +107 -77
- package/lib/esm/entities/midnight/deadline.d.ts +2 -2
- package/lib/esm/entities/midnight/deadline.js +4 -3
- package/lib/esm/entities/midnight/midnight.d.ts +49 -51
- package/lib/esm/entities/midnight/midnight.js +159 -139
- package/lib/esm/entities/midnight/publication.d.ts +2 -0
- package/lib/esm/entities/midnight/publication.js +193 -138
- package/lib/esm/entities/midnight/types.d.ts +4 -4
- package/lib/esm/entities/requirements/assertContractCode.js +4 -2
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +3 -5
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +25 -29
- package/lib/esm/entities/requirements/getErc2612Permit.js +10 -5
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -4
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +108 -0
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +73 -0
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +90 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +82 -0
- package/lib/esm/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
- package/lib/esm/entities/vaultV1/migrateToV2Quote.js +34 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +12 -12
- package/lib/esm/entities/vaultV1/vaultV1.js +96 -200
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +186 -0
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +107 -0
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +16 -16
- package/lib/esm/entities/vaultV2/vaultV2.js +102 -393
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +14 -0
- package/lib/esm/entities/vaultV2BlueReallocationData.js +1599 -883
- package/lib/esm/errors.d.ts +1 -1
- package/lib/esm/errors.js +1 -1
- package/lib/esm/helpers/deadShares.js +83 -47
- package/lib/esm/helpers/encodeMidnightCalldata.js +4 -2
- package/lib/esm/helpers/metadata.d.ts +14 -2
- package/lib/esm/helpers/metadata.js +48 -8
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +44 -27
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +11 -2
- package/lib/esm/helpers/utilization.js +10 -5
- package/lib/esm/helpers/validate.js +88 -67
- package/lib/esm/helpers/validateMidnightBounds.js +2 -1
- package/lib/esm/helpers/validateMidnightCollateralBatch.js +2 -1
- package/lib/esm/helpers/validateMidnightPublication.js +4 -2
- package/lib/esm/helpers/validateMidnightTakeFeasibility.js +176 -103
- package/lib/esm/helpers/validatePositiveInput.js +2 -1
- package/lib/esm/helpers/validateTakeableOffers.js +2 -1
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +40 -22
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/transactionPlan/approval.js +13 -2
- package/lib/esm/transactionPlan/deposit.d.ts +22 -0
- package/lib/esm/transactionPlan/deposit.js +135 -0
- package/lib/esm/transactionPlan/error.d.ts +10 -8
- package/lib/esm/transactionPlan/error.js +10 -8
- package/lib/esm/transactionPlan/getTokenPermit.js +2 -1
- package/lib/esm/transactionPlan/index.d.ts +18 -0
- package/lib/esm/transactionPlan/index.js +9 -0
- package/lib/esm/transactionPlan/intent.d.ts +3 -3
- package/lib/esm/transactionPlan/intent.js +14 -7
- package/lib/esm/transactionPlan/permit.d.ts +1 -1
- package/lib/esm/transactionPlan/permit.js +86 -20
- package/lib/esm/transactionPlan/plan.d.ts +16 -6
- package/lib/esm/transactionPlan/plan.js +73 -20
- package/lib/esm/transactionPlan/redeem.d.ts +18 -0
- package/lib/esm/transactionPlan/redeem.js +59 -0
- package/lib/esm/transactionPlan/requirements.d.ts +4 -3
- package/lib/esm/transactionPlan/requirements.js +12 -6
- package/lib/esm/transactionPlan/serde.d.ts +2 -2
- package/lib/esm/transactionPlan/serde.js +45 -19
- package/lib/esm/transactionPlan/shareSpending.d.ts +18 -0
- package/lib/esm/transactionPlan/shareSpending.js +47 -0
- package/lib/esm/transactionPlan/types.d.ts +117 -11
- package/lib/esm/transactionPlan/validateActions.js +11 -1
- package/lib/esm/transactionPlan/validation.js +6 -3
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +93 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.js +90 -0
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
- package/lib/esm/transactionPlan/vaultv1/inKindRedeem.js +198 -0
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
- package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +212 -0
- package/lib/esm/transactionPlan/vaultv1/redeem.d.ts +69 -0
- package/lib/esm/transactionPlan/vaultv1/redeem.js +74 -0
- package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +77 -0
- package/lib/esm/transactionPlan/vaultv1/withdraw.js +84 -0
- package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +18 -33
- package/lib/esm/transactionPlan/vaultv2/deposit.js +21 -144
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
- package/lib/esm/transactionPlan/vaultv2/forceRedeem.js +150 -0
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
- package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +201 -0
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
- package/lib/esm/transactionPlan/vaultv2/inKindRedeem.js +201 -0
- package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +84 -0
- package/lib/esm/transactionPlan/vaultv2/redeem.js +82 -0
- package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +18 -29
- package/lib/esm/transactionPlan/vaultv2/withdraw.js +23 -127
- package/lib/esm/transactionPlan/version.js +2 -1
- package/lib/esm/transactionPlan/withdraw.d.ts +18 -0
- package/lib/esm/transactionPlan/withdraw.js +90 -0
- package/lib/esm/types/action.d.ts +26 -2
- package/lib/esm/types/action.js +17 -9
- package/lib/esm/types/error.d.ts +8 -1
- package/lib/esm/types/error.js +21 -6
- package/lib/esm/types/metadata.d.ts +12 -2
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeVaultV2ForceWithdrawQuote = computeVaultV2ForceWithdrawQuote;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
8
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
9
|
+
const index_js_2 = require("../../types/index.js");
|
|
10
|
+
const VAULT_V2_FEE_PROJECTION_HORIZON = morpho_ts_1.Time.s.from.y(1n);
|
|
11
|
+
/** Resolves the supported adapter or reports the existing eligibility error. @internal */
|
|
12
|
+
function resolveForceWithdrawAdapter({ vaultData, adapterOverride, vault, }) {
|
|
13
|
+
const eligibility = (0, index_js_1.resolveVaultV2ForceWithdrawEligibility)(vaultData, adapterOverride);
|
|
14
|
+
switch (eligibility.type) {
|
|
15
|
+
case "eligible":
|
|
16
|
+
return eligibility;
|
|
17
|
+
case "adapterCount":
|
|
18
|
+
throw new index_js_2.VaultV2SingleAdapterRequiredError(vault, eligibility.adapters);
|
|
19
|
+
case "adapterMismatch":
|
|
20
|
+
throw new index_js_2.AdapterNotPartOfVaultError(vault, eligibility.adapter);
|
|
21
|
+
case "unsupportedAdapter":
|
|
22
|
+
throw new index_js_2.VaultV2UnsupportedExitAdapterError(eligibility.adapter);
|
|
23
|
+
case "unsupportedLiquidityAdapter":
|
|
24
|
+
throw new index_js_2.VaultV2UnsupportedLiquidityAdapterError({
|
|
25
|
+
vault: vault,
|
|
26
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
27
|
+
adapter: eligibility.adapter,
|
|
28
|
+
});
|
|
29
|
+
case "undecodableLiquidityData":
|
|
30
|
+
throw new index_js_2.VaultV2UndecodableLiquidityDataError({
|
|
31
|
+
vault: vault,
|
|
32
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
33
|
+
liquidityData: eligibility.liquidityData,
|
|
34
|
+
cause: eligibility.cause,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Validates and resolves the quote's execution and fee-projection deadline. @internal */
|
|
39
|
+
function resolveForceWithdrawDeadline({ deadlineOverride, now, }) {
|
|
40
|
+
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
41
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
42
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
43
|
+
(0, validate_js_1.validateDeadline)(deadline);
|
|
44
|
+
if (deadline <= now) {
|
|
45
|
+
throw new index_js_2.ExpiredDeadlineError(deadline, now);
|
|
46
|
+
}
|
|
47
|
+
const maxDeadline = now + VAULT_V2_FEE_PROJECTION_HORIZON;
|
|
48
|
+
if (deadline > maxDeadline) {
|
|
49
|
+
throw new index_js_2.InputExceedsMaxError({
|
|
50
|
+
field: "deadline",
|
|
51
|
+
value: deadline,
|
|
52
|
+
max: maxDeadline,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return deadline;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @internal Computes the fixed exit quote from a snapshot without reads or signing.
|
|
59
|
+
* @param params - Snapshot, caller intent and explicit quote timestamp.
|
|
60
|
+
* @returns Fixed action fields and the minimum share allowance.
|
|
61
|
+
*/
|
|
62
|
+
function computeVaultV2ForceWithdrawQuote({ exitAssets, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, minSharePriceE27: minSharePriceE27Override, referralFeePct = 0n, referralFeeRecipient, now, vault, }) {
|
|
63
|
+
if (exitAssets <= 0n) {
|
|
64
|
+
throw new index_js_2.NonPositiveInputError("exitAssets", exitAssets);
|
|
65
|
+
}
|
|
66
|
+
(0, validate_js_1.validateUint256Field)("exitAssets", exitAssets);
|
|
67
|
+
(0, index_js_1.validateSlippageTolerance)(slippageTolerance);
|
|
68
|
+
// Called for its throws only: the raw pair is forwarded to the action, which normalizes it
|
|
69
|
+
// again on the encode path so a direct action caller gets the same guarantees.
|
|
70
|
+
(0, validate_js_1.validateReferralFee)({ referralFeePct, referralFeeRecipient });
|
|
71
|
+
if (minSharePriceE27Override != null) {
|
|
72
|
+
// An unbounded override reopens the exact hole this path closes: the contract reads
|
|
73
|
+
// `minSharePriceE27 == 0` as "no bound".
|
|
74
|
+
if (minSharePriceE27Override <= 0n) {
|
|
75
|
+
throw new index_js_2.NonPositiveInputError("minSharePriceE27", minSharePriceE27Override);
|
|
76
|
+
}
|
|
77
|
+
// And an override the uint256 slot cannot hold must fail here rather than after
|
|
78
|
+
// `getRequirements()` has already asked for an approval or a permit signature.
|
|
79
|
+
(0, validate_js_1.validateUint256Field)("minSharePriceE27", minSharePriceE27Override);
|
|
80
|
+
}
|
|
81
|
+
const deadline = resolveForceWithdrawDeadline({ deadlineOverride, now });
|
|
82
|
+
const eligibility = resolveForceWithdrawAdapter({
|
|
83
|
+
vaultData,
|
|
84
|
+
adapterOverride,
|
|
85
|
+
vault,
|
|
86
|
+
});
|
|
87
|
+
const { adapter: accrualAdapter, liquidityMarketId } = eligibility;
|
|
88
|
+
const adapter = accrualAdapter.address;
|
|
89
|
+
const plan = (0, index_js_1.computeVaultV2ForceWithdrawPlan)({
|
|
90
|
+
vaultData,
|
|
91
|
+
adapter: accrualAdapter,
|
|
92
|
+
liquidityMarketId,
|
|
93
|
+
exitAssets,
|
|
94
|
+
timestamp: now,
|
|
95
|
+
});
|
|
96
|
+
if (plan.withdrawnAssets <= 0n) {
|
|
97
|
+
throw new index_js_2.VaultV2ForceWithdrawZeroWithdrawalError({
|
|
98
|
+
vault: vault,
|
|
99
|
+
exitAssets,
|
|
100
|
+
penalty: plan.penalty,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// The contract's force-deallocation loop is unbounded: under-coverage panics on-chain.
|
|
104
|
+
if (plan.coveredAssets < plan.assetsToDeallocate) {
|
|
105
|
+
throw new index_js_2.VaultV2ForceWithdrawCoverageError({
|
|
106
|
+
required: plan.assetsToDeallocate,
|
|
107
|
+
covered: plan.coveredAssets,
|
|
108
|
+
maxExitAssets: plan.maxExitAssets,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const projectionTimestamp = deadline;
|
|
112
|
+
// VaultExitBundlesV1 measures shares as `sharesBefore - balanceAfter`; its first withdrawal
|
|
113
|
+
// accrues the vault before burning. The realized price sits between the raw snapshot price
|
|
114
|
+
// (pending fee mints not yet diluting it) and the `now` projection (interest the chain may not
|
|
115
|
+
// have accrued yet, e.g. when the wall clock runs ahead of the chain). Price the floor off the
|
|
116
|
+
// larger *net* burn of the two endpoints — the raw snapshot mints no fee shares, the `now`
|
|
117
|
+
// accrual mints `feeSharesNow` — so it never exceeds either, and use the projected deadline
|
|
118
|
+
// accrual for the fee-mint guard.
|
|
119
|
+
const { vault: nowVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(now, vaultData.lastUpdate));
|
|
120
|
+
const { vault: projectedVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(projectionTimestamp, vaultData.lastUpdate));
|
|
121
|
+
const sharesBurntRaw = (0, index_js_1.computeVaultV2ForceWithdrawSharesBurnt)({
|
|
122
|
+
vaultData,
|
|
123
|
+
deadlineVaultData: vaultData,
|
|
124
|
+
plan,
|
|
125
|
+
});
|
|
126
|
+
const sharesBurntNow = (0, index_js_1.computeVaultV2ForceWithdrawSharesBurnt)({
|
|
127
|
+
vaultData: nowVaultData,
|
|
128
|
+
deadlineVaultData: nowVaultData,
|
|
129
|
+
plan,
|
|
130
|
+
});
|
|
131
|
+
const feeSharesNow = (0, index_js_1.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
132
|
+
vaultData,
|
|
133
|
+
owner: userAddress,
|
|
134
|
+
timestamp: now,
|
|
135
|
+
});
|
|
136
|
+
const feeSharesProjected = (0, index_js_1.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
137
|
+
vaultData,
|
|
138
|
+
owner: userAddress,
|
|
139
|
+
timestamp: projectionTimestamp,
|
|
140
|
+
});
|
|
141
|
+
const minSharesBurntProjected = (0, index_js_1.computeVaultV2ForceWithdrawMinSharesBurnt)({
|
|
142
|
+
vaultData: projectedVaultData,
|
|
143
|
+
plan,
|
|
144
|
+
});
|
|
145
|
+
// When fee shares are minted, the projected pair bounds every execution time in the window.
|
|
146
|
+
if (feeSharesProjected > 0n &&
|
|
147
|
+
feeSharesProjected >= minSharesBurntProjected) {
|
|
148
|
+
throw new index_js_2.VaultV2ForceWithdrawFeeSharesExceedBurnError({
|
|
149
|
+
vault: vault,
|
|
150
|
+
userAddress,
|
|
151
|
+
sharesBurnt: minSharesBurntProjected,
|
|
152
|
+
feeShares: feeSharesProjected,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// sharesBurntNow ≥ minSharesBurntNow ≥ minSharesBurntProjected > feeSharesProjected ≥ feeSharesNow
|
|
156
|
+
const sharesBurntForFloor = blue_sdk_1.MathLib.max(sharesBurntRaw, sharesBurntNow - feeSharesNow);
|
|
157
|
+
if (minSharePriceE27Override != null) {
|
|
158
|
+
// The maximum-slippage threshold only bounds the override; unlike the transaction floor it
|
|
159
|
+
// may round to zero, in which case every positive override is acceptable.
|
|
160
|
+
const minAllowedSharePriceE27 = (0, morpho_ts_1._try)(() => (0, index_js_1.computeMinForceWithdrawSharePrice)({
|
|
161
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
162
|
+
sharesBurnt: sharesBurntForFloor,
|
|
163
|
+
slippageTolerance: index_js_1.MAX_SLIPPAGE_TOLERANCE,
|
|
164
|
+
}), index_js_2.VaultV2ForceWithdrawZeroSharePriceError) ?? 1n;
|
|
165
|
+
if (minSharePriceE27Override < minAllowedSharePriceE27) {
|
|
166
|
+
throw new index_js_2.VaultV2ForceWithdrawSharePriceBelowFloorError({
|
|
167
|
+
minSharePriceE27: minSharePriceE27Override,
|
|
168
|
+
floorE27: minAllowedSharePriceE27,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const minSharePriceE27 = minSharePriceE27Override ??
|
|
173
|
+
(0, index_js_1.computeMinForceWithdrawSharePrice)({
|
|
174
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
175
|
+
sharesBurnt: sharesBurntForFloor,
|
|
176
|
+
slippageTolerance,
|
|
177
|
+
});
|
|
178
|
+
// The floor is deliberately *not* capped at `MAX_ABSOLUTE_SHARE_PRICE` (100 assets/share):
|
|
179
|
+
// lowering a lower bound weakens it, so any vault whose share price grew past that would be left
|
|
180
|
+
// with no real protection. Its two sibling `computeMin*SharePrice` helpers cap nothing either —
|
|
181
|
+
// only the `computeMax*` ones do, where capping relaxes an upper bound and is safe.
|
|
182
|
+
(0, validate_js_1.validateUint256Field)("minSharePriceE27", minSharePriceE27);
|
|
183
|
+
// This is the minimum allowance needed for successful execution, not an exit cap: the bundle
|
|
184
|
+
// independently rejects a realized share price below `minSharePriceE27`. Include the fee
|
|
185
|
+
// shares minted by the first withdrawal and enough headroom for the configured tolerance.
|
|
186
|
+
const allowanceSharePriceE27 = blue_sdk_1.MathLib.max(blue_sdk_1.MathLib.min(blue_sdk_1.MathLib.mulDivDown(minSharePriceE27, blue_sdk_1.MathLib.WAD - slippageTolerance, blue_sdk_1.MathLib.WAD), minSharePriceE27 - 1n), 1n);
|
|
187
|
+
const requiredShareAllowance = blue_sdk_1.MathLib.min(blue_sdk_1.MathLib.max(blue_sdk_1.MathLib.mulDivUp(exitAssets, blue_sdk_1.MathLib.RAY, allowanceSharePriceE27), blue_sdk_1.MathLib.mulDivUp(exitAssets, blue_sdk_1.MathLib.RAY, minSharePriceE27) + 1n) + feeSharesProjected, viem_1.maxUint256);
|
|
188
|
+
return { deadline, adapter, minSharePriceE27, requiredShareAllowance };
|
|
189
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AccrualVaultV2, type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
/**
|
|
4
|
+
* @internal Computes the fixed exit quote from a snapshot without reads or signing.
|
|
5
|
+
* @param params - Snapshot, caller intent and explicit quote timestamp.
|
|
6
|
+
* @returns Fixed action fields and the minimum share allowance.
|
|
7
|
+
*/
|
|
8
|
+
export declare function computeVaultV2InKindRedeemQuote({ amount, marketParamsList, vaultData, adapter: adapterOverride, deadline: deadlineOverride, now, vault, }: {
|
|
9
|
+
readonly amount: bigint;
|
|
10
|
+
readonly marketParamsList: readonly MarketParams[];
|
|
11
|
+
readonly vaultData: AccrualVaultV2;
|
|
12
|
+
readonly adapter?: Address;
|
|
13
|
+
readonly deadline?: bigint;
|
|
14
|
+
readonly now: bigint;
|
|
15
|
+
readonly vault: Address;
|
|
16
|
+
}): {
|
|
17
|
+
deadline: bigint;
|
|
18
|
+
adapter: `0x${string}`;
|
|
19
|
+
marketParamsListSnapshot: {
|
|
20
|
+
loanToken: `0x${string}`;
|
|
21
|
+
collateralToken: `0x${string}`;
|
|
22
|
+
oracle: `0x${string}`;
|
|
23
|
+
irm: `0x${string}`;
|
|
24
|
+
lltv: bigint;
|
|
25
|
+
}[];
|
|
26
|
+
requiredShareAllowance: bigint;
|
|
27
|
+
peak: bigint;
|
|
28
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeVaultV2InKindRedeemQuote = computeVaultV2InKindRedeemQuote;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
8
|
+
const index_js_1 = require("../../types/index.js");
|
|
9
|
+
/**
|
|
10
|
+
* @internal Computes the fixed exit quote from a snapshot without reads or signing.
|
|
11
|
+
* @param params - Snapshot, caller intent and explicit quote timestamp.
|
|
12
|
+
* @returns Fixed action fields and the minimum share allowance.
|
|
13
|
+
*/
|
|
14
|
+
function computeVaultV2InKindRedeemQuote({ amount, marketParamsList, vaultData, adapter: adapterOverride, deadline: deadlineOverride, now, vault, }) {
|
|
15
|
+
if (amount <= 0n) {
|
|
16
|
+
throw new index_js_1.NonPositiveInputError("amount", amount);
|
|
17
|
+
}
|
|
18
|
+
const marketParamsListSnapshot = marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => ({
|
|
19
|
+
loanToken,
|
|
20
|
+
collateralToken,
|
|
21
|
+
oracle,
|
|
22
|
+
irm,
|
|
23
|
+
lltv,
|
|
24
|
+
}));
|
|
25
|
+
const marketIdListSnapshot = marketParamsListSnapshot.map((marketParams) => blue_sdk_1.MarketUtils.getMarketId(marketParams));
|
|
26
|
+
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
27
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
28
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
29
|
+
(0, validate_js_1.validateDeadline)(deadline);
|
|
30
|
+
if (deadline <= now) {
|
|
31
|
+
throw new index_js_1.ExpiredDeadlineError(deadline, now);
|
|
32
|
+
}
|
|
33
|
+
if (vaultData.accrualAdapters.length !== 1) {
|
|
34
|
+
throw new index_js_1.VaultV2SingleAdapterRequiredError(vault, vaultData.accrualAdapters.length);
|
|
35
|
+
}
|
|
36
|
+
const soleAdapter = vaultData.accrualAdapters[0];
|
|
37
|
+
if (soleAdapter == null) {
|
|
38
|
+
throw new index_js_1.VaultV2SingleAdapterRequiredError(vault, 0);
|
|
39
|
+
}
|
|
40
|
+
const adapter = adapterOverride ?? soleAdapter.address;
|
|
41
|
+
if (!(0, viem_1.isAddressEqual)(adapter, soleAdapter.address)) {
|
|
42
|
+
throw new index_js_1.AdapterNotPartOfVaultError(vault, adapter);
|
|
43
|
+
}
|
|
44
|
+
if (!(soleAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2)) {
|
|
45
|
+
throw new index_js_1.VaultV2UnsupportedExitAdapterError(adapter);
|
|
46
|
+
}
|
|
47
|
+
const penalty = vaultData.forceDeallocatePenalties[soleAdapter.address] ?? 0n;
|
|
48
|
+
const idleAssets = blue_sdk_1.MathLib.min(vaultData.assetBalance, amount);
|
|
49
|
+
const assetsToDeallocate = blue_sdk_1.MathLib.wDivDown(amount - idleAssets, blue_sdk_1.MathLib.WAD + penalty);
|
|
50
|
+
if (idleAssets === 0n && assetsToDeallocate === 0n) {
|
|
51
|
+
throw new index_js_1.InKindRedeemZeroDeallocationError({
|
|
52
|
+
vault: vault,
|
|
53
|
+
amount,
|
|
54
|
+
penalty,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (assetsToDeallocate > 0n && marketParamsListSnapshot.length === 0) {
|
|
58
|
+
throw new index_js_1.EmptyMarketParamsListError();
|
|
59
|
+
}
|
|
60
|
+
const assetsByMarket = new Map(soleAdapter.markets
|
|
61
|
+
.filter((market) => (soleAdapter.supplyShares[market.id] ?? 0n) !== 0n)
|
|
62
|
+
.map((market) => [
|
|
63
|
+
market.id,
|
|
64
|
+
market
|
|
65
|
+
.accrueInterest(now)
|
|
66
|
+
.toSupplyAssets(soleAdapter.supplyShares[market.id] ?? 0n),
|
|
67
|
+
]));
|
|
68
|
+
const uniqueMarketIds = new Set(marketIdListSnapshot);
|
|
69
|
+
let covered = 0n;
|
|
70
|
+
for (const id of uniqueMarketIds) {
|
|
71
|
+
covered += assetsByMarket.get(id) ?? 0n;
|
|
72
|
+
}
|
|
73
|
+
if (covered < assetsToDeallocate) {
|
|
74
|
+
const maxExitAssets = covered === 0n
|
|
75
|
+
? idleAssets
|
|
76
|
+
: idleAssets + blue_sdk_1.MathLib.wMulUp(covered + 1n, blue_sdk_1.MathLib.WAD + penalty) - 1n;
|
|
77
|
+
throw new index_js_1.InKindRedeemCoverageError({
|
|
78
|
+
required: assetsToDeallocate,
|
|
79
|
+
covered,
|
|
80
|
+
maxExitAssets,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
let remaining = assetsToDeallocate;
|
|
84
|
+
let peak = 0n;
|
|
85
|
+
const consumedMarketIds = new Set();
|
|
86
|
+
const { vault: allowanceVault } = vaultData.accrueInterest(deadline);
|
|
87
|
+
// Interest can lower the burn, while management fees can raise it; bound both endpoints.
|
|
88
|
+
const previewAllowance = (assets) => blue_sdk_1.MathLib.max(vaultData.toShares(assets, "Up"), allowanceVault.toShares(assets, "Up"));
|
|
89
|
+
let requiredShareAllowance = previewAllowance(BigInt(marketParamsListSnapshot.length));
|
|
90
|
+
// Pre-burn previews upper-bound each separately rounded idle, penalty, and main burn.
|
|
91
|
+
requiredShareAllowance += previewAllowance(idleAssets);
|
|
92
|
+
for (const id of marketIdListSnapshot) {
|
|
93
|
+
const available = consumedMarketIds.has(id)
|
|
94
|
+
? 0n
|
|
95
|
+
: (assetsByMarket.get(id) ?? 0n);
|
|
96
|
+
consumedMarketIds.add(id);
|
|
97
|
+
const chunk = blue_sdk_1.MathLib.min(available, remaining);
|
|
98
|
+
peak = blue_sdk_1.MathLib.max(peak, chunk);
|
|
99
|
+
requiredShareAllowance += previewAllowance(blue_sdk_1.MathLib.wMulUp(chunk, penalty));
|
|
100
|
+
requiredShareAllowance += previewAllowance(chunk);
|
|
101
|
+
remaining -= chunk;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
deadline,
|
|
105
|
+
adapter,
|
|
106
|
+
marketParamsListSnapshot,
|
|
107
|
+
requiredShareAllowance,
|
|
108
|
+
peak,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -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.
|
|
@@ -113,7 +113,7 @@ export interface VaultV2Actions {
|
|
|
113
113
|
readonly referralFeePct?: bigint;
|
|
114
114
|
readonly referralFeeRecipient?: Address;
|
|
115
115
|
readonly deadline?: bigint;
|
|
116
|
-
} & BundlesFundingArgs) => ActionOutput<VaultV2DepositAction, readonly RequirementSignature[], BundlesTokenRequirementsOptions>;
|
|
116
|
+
} & ReferenceTimestampParams & BundlesFundingArgs) => ActionOutput<VaultV2DepositAction, readonly RequirementSignature[], BundlesTokenRequirementsOptions>;
|
|
117
117
|
/**
|
|
118
118
|
* Prepares an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
119
119
|
*
|
|
@@ -192,7 +192,7 @@ export interface VaultV2Actions {
|
|
|
192
192
|
readonly referralFeePct?: bigint;
|
|
193
193
|
readonly referralFeeRecipient?: Address;
|
|
194
194
|
readonly deadline?: bigint;
|
|
195
|
-
}) => ActionOutput<VaultV2WithdrawAction, readonly RequirementSignature[], undefined>;
|
|
195
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2WithdrawAction, readonly RequirementSignature[], undefined>;
|
|
196
196
|
/**
|
|
197
197
|
* Prepares an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
198
198
|
*
|
|
@@ -257,7 +257,7 @@ export interface VaultV2Actions {
|
|
|
257
257
|
readonly referralFeePct?: bigint;
|
|
258
258
|
readonly referralFeeRecipient?: Address;
|
|
259
259
|
readonly deadline?: bigint;
|
|
260
|
-
}) => ActionOutput<VaultV2RedeemAction, readonly RequirementSignature[], undefined>;
|
|
260
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2RedeemAction, readonly RequirementSignature[], undefined>;
|
|
261
261
|
/**
|
|
262
262
|
* Prepares an illiquid Vault V2 exit into idle assets and Morpho Blue supply positions.
|
|
263
263
|
*
|
|
@@ -346,7 +346,7 @@ export interface VaultV2Actions {
|
|
|
346
346
|
readonly userAddress: Address;
|
|
347
347
|
readonly adapter?: Address;
|
|
348
348
|
readonly deadline?: bigint;
|
|
349
|
-
}) => ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
349
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
350
350
|
/**
|
|
351
351
|
* Prepares a Vault V2 force withdrawal through VaultExitBundlesV1.
|
|
352
352
|
*
|
|
@@ -488,7 +488,7 @@ export interface VaultV2Actions {
|
|
|
488
488
|
readonly minSharePriceE27?: bigint;
|
|
489
489
|
readonly referralFeePct?: bigint;
|
|
490
490
|
readonly referralFeeRecipient?: Address;
|
|
491
|
-
}) => ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
491
|
+
} & ReferenceTimestampParams) => ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
492
492
|
/**
|
|
493
493
|
* Prepares a force redeem transaction for the VaultV2 contract using the vault's native multicall.
|
|
494
494
|
*
|
|
@@ -533,7 +533,7 @@ export interface VaultV2Actions {
|
|
|
533
533
|
shares: bigint;
|
|
534
534
|
};
|
|
535
535
|
userAddress: Address;
|
|
536
|
-
}) => {
|
|
536
|
+
} & ReferenceTimestampParams) => {
|
|
537
537
|
buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
538
538
|
};
|
|
539
539
|
}
|
|
@@ -561,7 +561,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
561
561
|
readonly referralFeePct?: bigint;
|
|
562
562
|
readonly referralFeeRecipient?: Address;
|
|
563
563
|
readonly deadline?: bigint;
|
|
564
|
-
} & BundlesFundingArgs): Readonly<{
|
|
564
|
+
} & ReferenceTimestampParams & BundlesFundingArgs): Readonly<{
|
|
565
565
|
getRequirements: (requirementOptions?: BundlesTokenRequirementsOptions) => Promise<readonly ActionRequirement[]>;
|
|
566
566
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2DepositAction>>;
|
|
567
567
|
}>;
|
|
@@ -573,7 +573,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
573
573
|
readonly referralFeePct?: bigint;
|
|
574
574
|
readonly referralFeeRecipient?: Address;
|
|
575
575
|
readonly deadline?: bigint;
|
|
576
|
-
}): Readonly<{
|
|
576
|
+
} & ReferenceTimestampParams): Readonly<{
|
|
577
577
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../index.js").ERC20ApprovalAction>> | import("../../index.js").Requirement<import("../../index.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
578
578
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2WithdrawAction>>;
|
|
579
579
|
}>;
|
|
@@ -584,21 +584,21 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
584
584
|
readonly referralFeePct?: bigint;
|
|
585
585
|
readonly referralFeeRecipient?: Address;
|
|
586
586
|
readonly deadline?: bigint;
|
|
587
|
-
}): Readonly<{
|
|
587
|
+
} & ReferenceTimestampParams): Readonly<{
|
|
588
588
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../index.js").ERC20ApprovalAction>> | import("../../index.js").Requirement<import("../../index.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
589
589
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2RedeemAction>>;
|
|
590
590
|
}>;
|
|
591
591
|
/** {@inheritDoc VaultV2Actions.inKindRedeem} */
|
|
592
|
-
inKindRedeem(
|
|
592
|
+
inKindRedeem(params: {
|
|
593
593
|
readonly amount: bigint;
|
|
594
594
|
readonly marketParamsList: readonly MarketParams[];
|
|
595
595
|
readonly vaultData: AccrualVaultV2;
|
|
596
596
|
readonly userAddress: Address;
|
|
597
597
|
readonly adapter?: Address;
|
|
598
598
|
readonly deadline?: bigint;
|
|
599
|
-
}): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
599
|
+
} & ReferenceTimestampParams): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
600
600
|
/** {@inheritDoc VaultV2Actions.forceWithdraw} */
|
|
601
|
-
forceWithdraw(
|
|
601
|
+
forceWithdraw(params: {
|
|
602
602
|
readonly exitAssets: bigint;
|
|
603
603
|
readonly vaultData: AccrualVaultV2;
|
|
604
604
|
readonly userAddress: Address;
|
|
@@ -608,14 +608,14 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
608
608
|
readonly minSharePriceE27?: bigint;
|
|
609
609
|
readonly referralFeePct?: bigint;
|
|
610
610
|
readonly referralFeeRecipient?: Address;
|
|
611
|
-
}): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
612
|
-
forceRedeem(
|
|
611
|
+
} & ReferenceTimestampParams): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
612
|
+
forceRedeem(params: {
|
|
613
613
|
deallocations: readonly Deallocation[];
|
|
614
614
|
redeem: {
|
|
615
615
|
shares: bigint;
|
|
616
616
|
};
|
|
617
617
|
userAddress: Address;
|
|
618
|
-
}): {
|
|
618
|
+
} & ReferenceTimestampParams): {
|
|
619
619
|
buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
620
620
|
};
|
|
621
621
|
}
|