@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,186 @@
|
|
|
1
|
+
import { DEFAULT_SLIPPAGE_TOLERANCE, MathLib, } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { _try, Time } from "@morpho-org/morpho-ts";
|
|
3
|
+
import { maxUint256 } from "viem";
|
|
4
|
+
import { computeMinForceWithdrawSharePrice, computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, MAX_SLIPPAGE_TOLERANCE, resolveVaultV2ForceWithdrawEligibility, validateSlippageTolerance, } from "../../helpers/index.js";
|
|
5
|
+
import { validateDeadline, validateReferralFee, validateUint256Field, } from "../../helpers/validate.js";
|
|
6
|
+
import { AdapterNotPartOfVaultError, ExpiredDeadlineError, InputExceedsMaxError, NonPositiveInputError, VaultV2ForceWithdrawCoverageError, VaultV2ForceWithdrawFeeSharesExceedBurnError, VaultV2ForceWithdrawSharePriceBelowFloorError, VaultV2ForceWithdrawZeroSharePriceError, VaultV2ForceWithdrawZeroWithdrawalError, VaultV2SingleAdapterRequiredError, VaultV2UndecodableLiquidityDataError, VaultV2UnsupportedExitAdapterError, VaultV2UnsupportedLiquidityAdapterError, } from "../../types/index.js";
|
|
7
|
+
const VAULT_V2_FEE_PROJECTION_HORIZON = Time.s.from.y(1n);
|
|
8
|
+
/** Resolves the supported adapter or reports the existing eligibility error. @internal */
|
|
9
|
+
function resolveForceWithdrawAdapter({ vaultData, adapterOverride, vault, }) {
|
|
10
|
+
const eligibility = resolveVaultV2ForceWithdrawEligibility(vaultData, adapterOverride);
|
|
11
|
+
switch (eligibility.type) {
|
|
12
|
+
case "eligible":
|
|
13
|
+
return eligibility;
|
|
14
|
+
case "adapterCount":
|
|
15
|
+
throw new VaultV2SingleAdapterRequiredError(vault, eligibility.adapters);
|
|
16
|
+
case "adapterMismatch":
|
|
17
|
+
throw new AdapterNotPartOfVaultError(vault, eligibility.adapter);
|
|
18
|
+
case "unsupportedAdapter":
|
|
19
|
+
throw new VaultV2UnsupportedExitAdapterError(eligibility.adapter);
|
|
20
|
+
case "unsupportedLiquidityAdapter":
|
|
21
|
+
throw new VaultV2UnsupportedLiquidityAdapterError({
|
|
22
|
+
vault: vault,
|
|
23
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
24
|
+
adapter: eligibility.adapter,
|
|
25
|
+
});
|
|
26
|
+
case "undecodableLiquidityData":
|
|
27
|
+
throw new VaultV2UndecodableLiquidityDataError({
|
|
28
|
+
vault: vault,
|
|
29
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
30
|
+
liquidityData: eligibility.liquidityData,
|
|
31
|
+
cause: eligibility.cause,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Validates and resolves the quote's execution and fee-projection deadline. @internal */
|
|
36
|
+
function resolveForceWithdrawDeadline({ deadlineOverride, now, }) {
|
|
37
|
+
const deadline = deadlineOverride ?? now + Time.s.from.h(2n);
|
|
38
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
39
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
40
|
+
validateDeadline(deadline);
|
|
41
|
+
if (deadline <= now) {
|
|
42
|
+
throw new ExpiredDeadlineError(deadline, now);
|
|
43
|
+
}
|
|
44
|
+
const maxDeadline = now + VAULT_V2_FEE_PROJECTION_HORIZON;
|
|
45
|
+
if (deadline > maxDeadline) {
|
|
46
|
+
throw new InputExceedsMaxError({
|
|
47
|
+
field: "deadline",
|
|
48
|
+
value: deadline,
|
|
49
|
+
max: maxDeadline,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return deadline;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @internal Computes the fixed exit quote from a snapshot without reads or signing.
|
|
56
|
+
* @param params - Snapshot, caller intent and explicit quote timestamp.
|
|
57
|
+
* @returns Fixed action fields and the minimum share allowance.
|
|
58
|
+
*/
|
|
59
|
+
export function computeVaultV2ForceWithdrawQuote({ exitAssets, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, slippageTolerance = DEFAULT_SLIPPAGE_TOLERANCE, minSharePriceE27: minSharePriceE27Override, referralFeePct = 0n, referralFeeRecipient, now, vault, }) {
|
|
60
|
+
if (exitAssets <= 0n) {
|
|
61
|
+
throw new NonPositiveInputError("exitAssets", exitAssets);
|
|
62
|
+
}
|
|
63
|
+
validateUint256Field("exitAssets", exitAssets);
|
|
64
|
+
validateSlippageTolerance(slippageTolerance);
|
|
65
|
+
// Called for its throws only: the raw pair is forwarded to the action, which normalizes it
|
|
66
|
+
// again on the encode path so a direct action caller gets the same guarantees.
|
|
67
|
+
validateReferralFee({ referralFeePct, referralFeeRecipient });
|
|
68
|
+
if (minSharePriceE27Override != null) {
|
|
69
|
+
// An unbounded override reopens the exact hole this path closes: the contract reads
|
|
70
|
+
// `minSharePriceE27 == 0` as "no bound".
|
|
71
|
+
if (minSharePriceE27Override <= 0n) {
|
|
72
|
+
throw new NonPositiveInputError("minSharePriceE27", minSharePriceE27Override);
|
|
73
|
+
}
|
|
74
|
+
// And an override the uint256 slot cannot hold must fail here rather than after
|
|
75
|
+
// `getRequirements()` has already asked for an approval or a permit signature.
|
|
76
|
+
validateUint256Field("minSharePriceE27", minSharePriceE27Override);
|
|
77
|
+
}
|
|
78
|
+
const deadline = resolveForceWithdrawDeadline({ deadlineOverride, now });
|
|
79
|
+
const eligibility = resolveForceWithdrawAdapter({
|
|
80
|
+
vaultData,
|
|
81
|
+
adapterOverride,
|
|
82
|
+
vault,
|
|
83
|
+
});
|
|
84
|
+
const { adapter: accrualAdapter, liquidityMarketId } = eligibility;
|
|
85
|
+
const adapter = accrualAdapter.address;
|
|
86
|
+
const plan = computeVaultV2ForceWithdrawPlan({
|
|
87
|
+
vaultData,
|
|
88
|
+
adapter: accrualAdapter,
|
|
89
|
+
liquidityMarketId,
|
|
90
|
+
exitAssets,
|
|
91
|
+
timestamp: now,
|
|
92
|
+
});
|
|
93
|
+
if (plan.withdrawnAssets <= 0n) {
|
|
94
|
+
throw new VaultV2ForceWithdrawZeroWithdrawalError({
|
|
95
|
+
vault: vault,
|
|
96
|
+
exitAssets,
|
|
97
|
+
penalty: plan.penalty,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// The contract's force-deallocation loop is unbounded: under-coverage panics on-chain.
|
|
101
|
+
if (plan.coveredAssets < plan.assetsToDeallocate) {
|
|
102
|
+
throw new VaultV2ForceWithdrawCoverageError({
|
|
103
|
+
required: plan.assetsToDeallocate,
|
|
104
|
+
covered: plan.coveredAssets,
|
|
105
|
+
maxExitAssets: plan.maxExitAssets,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const projectionTimestamp = deadline;
|
|
109
|
+
// VaultExitBundlesV1 measures shares as `sharesBefore - balanceAfter`; its first withdrawal
|
|
110
|
+
// accrues the vault before burning. The realized price sits between the raw snapshot price
|
|
111
|
+
// (pending fee mints not yet diluting it) and the `now` projection (interest the chain may not
|
|
112
|
+
// have accrued yet, e.g. when the wall clock runs ahead of the chain). Price the floor off the
|
|
113
|
+
// larger *net* burn of the two endpoints — the raw snapshot mints no fee shares, the `now`
|
|
114
|
+
// accrual mints `feeSharesNow` — so it never exceeds either, and use the projected deadline
|
|
115
|
+
// accrual for the fee-mint guard.
|
|
116
|
+
const { vault: nowVaultData } = vaultData.accrueInterest(MathLib.max(now, vaultData.lastUpdate));
|
|
117
|
+
const { vault: projectedVaultData } = vaultData.accrueInterest(MathLib.max(projectionTimestamp, vaultData.lastUpdate));
|
|
118
|
+
const sharesBurntRaw = computeVaultV2ForceWithdrawSharesBurnt({
|
|
119
|
+
vaultData,
|
|
120
|
+
deadlineVaultData: vaultData,
|
|
121
|
+
plan,
|
|
122
|
+
});
|
|
123
|
+
const sharesBurntNow = computeVaultV2ForceWithdrawSharesBurnt({
|
|
124
|
+
vaultData: nowVaultData,
|
|
125
|
+
deadlineVaultData: nowVaultData,
|
|
126
|
+
plan,
|
|
127
|
+
});
|
|
128
|
+
const feeSharesNow = computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
129
|
+
vaultData,
|
|
130
|
+
owner: userAddress,
|
|
131
|
+
timestamp: now,
|
|
132
|
+
});
|
|
133
|
+
const feeSharesProjected = computeVaultV2ForceWithdrawFeeSharesMinted({
|
|
134
|
+
vaultData,
|
|
135
|
+
owner: userAddress,
|
|
136
|
+
timestamp: projectionTimestamp,
|
|
137
|
+
});
|
|
138
|
+
const minSharesBurntProjected = computeVaultV2ForceWithdrawMinSharesBurnt({
|
|
139
|
+
vaultData: projectedVaultData,
|
|
140
|
+
plan,
|
|
141
|
+
});
|
|
142
|
+
// When fee shares are minted, the projected pair bounds every execution time in the window.
|
|
143
|
+
if (feeSharesProjected > 0n &&
|
|
144
|
+
feeSharesProjected >= minSharesBurntProjected) {
|
|
145
|
+
throw new VaultV2ForceWithdrawFeeSharesExceedBurnError({
|
|
146
|
+
vault: vault,
|
|
147
|
+
userAddress,
|
|
148
|
+
sharesBurnt: minSharesBurntProjected,
|
|
149
|
+
feeShares: feeSharesProjected,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// sharesBurntNow ≥ minSharesBurntNow ≥ minSharesBurntProjected > feeSharesProjected ≥ feeSharesNow
|
|
153
|
+
const sharesBurntForFloor = MathLib.max(sharesBurntRaw, sharesBurntNow - feeSharesNow);
|
|
154
|
+
if (minSharePriceE27Override != null) {
|
|
155
|
+
// The maximum-slippage threshold only bounds the override; unlike the transaction floor it
|
|
156
|
+
// may round to zero, in which case every positive override is acceptable.
|
|
157
|
+
const minAllowedSharePriceE27 = _try(() => computeMinForceWithdrawSharePrice({
|
|
158
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
159
|
+
sharesBurnt: sharesBurntForFloor,
|
|
160
|
+
slippageTolerance: MAX_SLIPPAGE_TOLERANCE,
|
|
161
|
+
}), VaultV2ForceWithdrawZeroSharePriceError) ?? 1n;
|
|
162
|
+
if (minSharePriceE27Override < minAllowedSharePriceE27) {
|
|
163
|
+
throw new VaultV2ForceWithdrawSharePriceBelowFloorError({
|
|
164
|
+
minSharePriceE27: minSharePriceE27Override,
|
|
165
|
+
floorE27: minAllowedSharePriceE27,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const minSharePriceE27 = minSharePriceE27Override ??
|
|
170
|
+
computeMinForceWithdrawSharePrice({
|
|
171
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
172
|
+
sharesBurnt: sharesBurntForFloor,
|
|
173
|
+
slippageTolerance,
|
|
174
|
+
});
|
|
175
|
+
// The floor is deliberately *not* capped at `MAX_ABSOLUTE_SHARE_PRICE` (100 assets/share):
|
|
176
|
+
// lowering a lower bound weakens it, so any vault whose share price grew past that would be left
|
|
177
|
+
// with no real protection. Its two sibling `computeMin*SharePrice` helpers cap nothing either —
|
|
178
|
+
// only the `computeMax*` ones do, where capping relaxes an upper bound and is safe.
|
|
179
|
+
validateUint256Field("minSharePriceE27", minSharePriceE27);
|
|
180
|
+
// This is the minimum allowance needed for successful execution, not an exit cap: the bundle
|
|
181
|
+
// independently rejects a realized share price below `minSharePriceE27`. Include the fee
|
|
182
|
+
// shares minted by the first withdrawal and enough headroom for the configured tolerance.
|
|
183
|
+
const allowanceSharePriceE27 = MathLib.max(MathLib.min(MathLib.mulDivDown(minSharePriceE27, MathLib.WAD - slippageTolerance, MathLib.WAD), minSharePriceE27 - 1n), 1n);
|
|
184
|
+
const requiredShareAllowance = MathLib.min(MathLib.max(MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27), MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n) + feeSharesProjected, maxUint256);
|
|
185
|
+
return { deadline, adapter, minSharePriceE27, requiredShareAllowance };
|
|
186
|
+
}
|
|
@@ -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,107 @@
|
|
|
1
|
+
import { AccrualVaultV2MorphoMarketV1AdapterV2, MarketUtils, MathLib, } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { Time } from "@morpho-org/morpho-ts";
|
|
3
|
+
import { isAddressEqual } from "viem";
|
|
4
|
+
import { validateDeadline } from "../../helpers/validate.js";
|
|
5
|
+
import { AdapterNotPartOfVaultError, EmptyMarketParamsListError, ExpiredDeadlineError, InKindRedeemCoverageError, InKindRedeemZeroDeallocationError, NonPositiveInputError, VaultV2SingleAdapterRequiredError, VaultV2UnsupportedExitAdapterError, } from "../../types/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* @internal Computes the fixed exit quote from a snapshot without reads or signing.
|
|
8
|
+
* @param params - Snapshot, caller intent and explicit quote timestamp.
|
|
9
|
+
* @returns Fixed action fields and the minimum share allowance.
|
|
10
|
+
*/
|
|
11
|
+
export function computeVaultV2InKindRedeemQuote({ amount, marketParamsList, vaultData, adapter: adapterOverride, deadline: deadlineOverride, now, vault, }) {
|
|
12
|
+
if (amount <= 0n) {
|
|
13
|
+
throw new NonPositiveInputError("amount", amount);
|
|
14
|
+
}
|
|
15
|
+
const marketParamsListSnapshot = marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => ({
|
|
16
|
+
loanToken,
|
|
17
|
+
collateralToken,
|
|
18
|
+
oracle,
|
|
19
|
+
irm,
|
|
20
|
+
lltv,
|
|
21
|
+
}));
|
|
22
|
+
const marketIdListSnapshot = marketParamsListSnapshot.map((marketParams) => MarketUtils.getMarketId(marketParams));
|
|
23
|
+
const deadline = deadlineOverride ?? now + Time.s.from.h(2n);
|
|
24
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
25
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
26
|
+
validateDeadline(deadline);
|
|
27
|
+
if (deadline <= now) {
|
|
28
|
+
throw new ExpiredDeadlineError(deadline, now);
|
|
29
|
+
}
|
|
30
|
+
if (vaultData.accrualAdapters.length !== 1) {
|
|
31
|
+
throw new VaultV2SingleAdapterRequiredError(vault, vaultData.accrualAdapters.length);
|
|
32
|
+
}
|
|
33
|
+
const soleAdapter = vaultData.accrualAdapters[0];
|
|
34
|
+
if (soleAdapter == null) {
|
|
35
|
+
throw new VaultV2SingleAdapterRequiredError(vault, 0);
|
|
36
|
+
}
|
|
37
|
+
const adapter = adapterOverride ?? soleAdapter.address;
|
|
38
|
+
if (!isAddressEqual(adapter, soleAdapter.address)) {
|
|
39
|
+
throw new AdapterNotPartOfVaultError(vault, adapter);
|
|
40
|
+
}
|
|
41
|
+
if (!(soleAdapter instanceof AccrualVaultV2MorphoMarketV1AdapterV2)) {
|
|
42
|
+
throw new VaultV2UnsupportedExitAdapterError(adapter);
|
|
43
|
+
}
|
|
44
|
+
const penalty = vaultData.forceDeallocatePenalties[soleAdapter.address] ?? 0n;
|
|
45
|
+
const idleAssets = MathLib.min(vaultData.assetBalance, amount);
|
|
46
|
+
const assetsToDeallocate = MathLib.wDivDown(amount - idleAssets, MathLib.WAD + penalty);
|
|
47
|
+
if (idleAssets === 0n && assetsToDeallocate === 0n) {
|
|
48
|
+
throw new InKindRedeemZeroDeallocationError({
|
|
49
|
+
vault: vault,
|
|
50
|
+
amount,
|
|
51
|
+
penalty,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (assetsToDeallocate > 0n && marketParamsListSnapshot.length === 0) {
|
|
55
|
+
throw new EmptyMarketParamsListError();
|
|
56
|
+
}
|
|
57
|
+
const assetsByMarket = new Map(soleAdapter.markets
|
|
58
|
+
.filter((market) => (soleAdapter.supplyShares[market.id] ?? 0n) !== 0n)
|
|
59
|
+
.map((market) => [
|
|
60
|
+
market.id,
|
|
61
|
+
market
|
|
62
|
+
.accrueInterest(now)
|
|
63
|
+
.toSupplyAssets(soleAdapter.supplyShares[market.id] ?? 0n),
|
|
64
|
+
]));
|
|
65
|
+
const uniqueMarketIds = new Set(marketIdListSnapshot);
|
|
66
|
+
let covered = 0n;
|
|
67
|
+
for (const id of uniqueMarketIds) {
|
|
68
|
+
covered += assetsByMarket.get(id) ?? 0n;
|
|
69
|
+
}
|
|
70
|
+
if (covered < assetsToDeallocate) {
|
|
71
|
+
const maxExitAssets = covered === 0n
|
|
72
|
+
? idleAssets
|
|
73
|
+
: idleAssets + MathLib.wMulUp(covered + 1n, MathLib.WAD + penalty) - 1n;
|
|
74
|
+
throw new InKindRedeemCoverageError({
|
|
75
|
+
required: assetsToDeallocate,
|
|
76
|
+
covered,
|
|
77
|
+
maxExitAssets,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
let remaining = assetsToDeallocate;
|
|
81
|
+
let peak = 0n;
|
|
82
|
+
const consumedMarketIds = new Set();
|
|
83
|
+
const { vault: allowanceVault } = vaultData.accrueInterest(deadline);
|
|
84
|
+
// Interest can lower the burn, while management fees can raise it; bound both endpoints.
|
|
85
|
+
const previewAllowance = (assets) => MathLib.max(vaultData.toShares(assets, "Up"), allowanceVault.toShares(assets, "Up"));
|
|
86
|
+
let requiredShareAllowance = previewAllowance(BigInt(marketParamsListSnapshot.length));
|
|
87
|
+
// Pre-burn previews upper-bound each separately rounded idle, penalty, and main burn.
|
|
88
|
+
requiredShareAllowance += previewAllowance(idleAssets);
|
|
89
|
+
for (const id of marketIdListSnapshot) {
|
|
90
|
+
const available = consumedMarketIds.has(id)
|
|
91
|
+
? 0n
|
|
92
|
+
: (assetsByMarket.get(id) ?? 0n);
|
|
93
|
+
consumedMarketIds.add(id);
|
|
94
|
+
const chunk = MathLib.min(available, remaining);
|
|
95
|
+
peak = MathLib.max(peak, chunk);
|
|
96
|
+
requiredShareAllowance += previewAllowance(MathLib.wMulUp(chunk, penalty));
|
|
97
|
+
requiredShareAllowance += previewAllowance(chunk);
|
|
98
|
+
remaining -= chunk;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
deadline,
|
|
102
|
+
adapter,
|
|
103
|
+
marketParamsListSnapshot,
|
|
104
|
+
requiredShareAllowance,
|
|
105
|
+
peak,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -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("../../types/action.js").ERC20ApprovalAction>> | import("../../types/action.js").Requirement<import("../../types/action.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("../../types/action.js").ERC20ApprovalAction>> | import("../../types/action.js").Requirement<import("../../types/action.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
|
}
|