@morpho-org/morpho-sdk 10.0.2 → 10.1.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/README.md +6 -2
- package/lib/cjs/actions/blue/borrow.d.ts +2 -1
- package/lib/cjs/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/borrow.internal.js +35 -0
- package/lib/cjs/actions/blue/borrow.js +4 -16
- package/lib/cjs/actions/blue/common.d.ts +50 -28
- package/lib/cjs/actions/blue/common.js +21 -34
- package/lib/cjs/actions/blue/encode.d.ts +23 -0
- package/lib/cjs/actions/blue/encode.js +171 -0
- package/lib/cjs/actions/blue/refinance.d.ts +3 -2
- package/lib/cjs/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/cjs/actions/blue/refinance.internal.js +62 -0
- package/lib/cjs/actions/blue/refinance.js +5 -63
- package/lib/cjs/actions/blue/refinanceValidation.d.ts +4 -5
- package/lib/cjs/actions/blue/refinanceValidation.js +1 -3
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/repay.internal.js +38 -0
- package/lib/cjs/actions/blue/repay.js +2 -17
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.internal.js +112 -0
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +3 -116
- package/lib/cjs/actions/blue/signatures.d.ts +30 -0
- package/lib/cjs/actions/blue/signatures.js +90 -0
- package/lib/cjs/actions/blue/supply.d.ts +1 -1
- package/lib/cjs/actions/blue/supply.internal.d.ts +32 -0
- package/lib/cjs/actions/blue/supply.internal.js +101 -0
- package/lib/cjs/actions/blue/supply.js +2 -67
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +1 -1
- package/lib/cjs/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/cjs/actions/blue/supplyCollateral.internal.js +37 -0
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -17
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +4 -3
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.d.ts +63 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.internal.js +94 -0
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +5 -106
- package/lib/cjs/actions/blue/withdraw.d.ts +4 -3
- package/lib/cjs/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/cjs/actions/blue/withdraw.internal.js +84 -0
- package/lib/cjs/actions/blue/withdraw.js +5 -78
- package/lib/cjs/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.internal.js +58 -0
- package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/cjs/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/cjs/actions/blue/withdrawCollateral.internal.js +39 -0
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -17
- package/lib/cjs/actions/bundles/common.d.ts +9 -0
- package/lib/cjs/actions/bundles/common.js +18 -6
- package/lib/cjs/actions/bundles/index.d.ts +1 -1
- package/lib/cjs/actions/bundles/index.js +3 -16
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +59 -60
- package/lib/cjs/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/cjs/actions/midnight/cancelAndMake.js +46 -87
- package/lib/cjs/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/cjs/actions/midnight/cancelOffers.js +22 -4
- package/lib/cjs/actions/midnight/encode.d.ts +36 -0
- package/lib/cjs/actions/midnight/encode.js +554 -0
- package/lib/cjs/actions/midnight/index.d.ts +14 -13
- package/lib/cjs/actions/midnight/index.js +29 -13
- package/lib/cjs/actions/midnight/parse.d.ts +35 -0
- package/lib/cjs/actions/midnight/parse.js +73 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/cjs/actions/midnight/parseCollateralBatch.js +216 -0
- package/lib/cjs/actions/midnight/redeem.d.ts +16 -3
- package/lib/cjs/actions/midnight/redeem.js +22 -51
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +42 -67
- package/lib/cjs/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/cjs/actions/midnight/supplyCollateral.js +60 -54
- package/lib/cjs/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +39 -66
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/cjs/actions/midnight/supplyCollateralWithNative.js +142 -0
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +25 -55
- package/lib/cjs/actions/midnight/takeLend.d.ts +21 -1
- package/lib/cjs/actions/midnight/takeLend.js +30 -57
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +34 -61
- package/lib/cjs/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/cjs/actions/midnight/takeWithdraw.js +78 -115
- package/lib/cjs/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/cjs/actions/midnight/withdrawCollateral.js +25 -56
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +39 -19
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/blue/index.js +3 -15
- package/lib/cjs/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/cjs/actions/requirements/chainCheck.js +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +40 -27
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +36 -17
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +44 -9
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +61 -24
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +25 -4
- package/lib/cjs/actions/requirements/encode/index.d.ts +5 -5
- package/lib/cjs/actions/requirements/encode/index.js +11 -19
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +40 -12
- package/lib/cjs/actions/requirements/index.d.ts +1 -1
- package/lib/cjs/actions/requirements/index.js +3 -1
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +34 -19
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +26 -12
- package/lib/cjs/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/cjs/actions/requirements/midnight/index.js +5 -16
- package/lib/cjs/actions/vaultV1/deposit.d.ts +21 -0
- package/lib/cjs/actions/vaultV1/deposit.js +46 -10
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +36 -16
- package/lib/cjs/actions/vaultV1/index.d.ts +5 -5
- package/lib/cjs/actions/vaultV1/index.js +11 -19
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +21 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +49 -11
- package/lib/cjs/actions/vaultV1/redeem.d.ts +19 -0
- package/lib/cjs/actions/vaultV1/redeem.js +28 -7
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +19 -0
- package/lib/cjs/actions/vaultV1/withdraw.js +28 -7
- package/lib/cjs/actions/vaultV2/deposit.d.ts +21 -0
- package/lib/cjs/actions/vaultV2/deposit.js +46 -10
- package/lib/cjs/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/cjs/actions/vaultV2/forceRedeem.js +39 -8
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +23 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +36 -14
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +35 -15
- package/lib/cjs/actions/vaultV2/index.d.ts +6 -6
- package/lib/cjs/actions/vaultV2/index.js +13 -20
- package/lib/cjs/actions/vaultV2/redeem.d.ts +19 -0
- package/lib/cjs/actions/vaultV2/redeem.js +28 -7
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +19 -0
- package/lib/cjs/actions/vaultV2/withdraw.js +28 -7
- package/lib/cjs/entities/blue/blue.d.ts +35 -8
- package/lib/cjs/entities/blue/blue.js +467 -406
- package/lib/cjs/entities/midnight/midnight.d.ts +117 -41
- package/lib/cjs/entities/midnight/midnight.js +472 -843
- package/lib/cjs/entities/midnight/parse.d.ts +74 -0
- package/lib/cjs/entities/midnight/parse.js +336 -0
- package/lib/cjs/entities/midnight/prepare.d.ts +47 -0
- package/lib/cjs/entities/midnight/prepare.js +293 -0
- package/lib/cjs/entities/midnight/publication.d.ts +7 -3
- package/lib/cjs/entities/midnight/publication.js +10 -7
- package/lib/cjs/entities/midnight/types.d.ts +7 -0
- package/lib/cjs/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/cjs/entities/requirements/assertContractCode.js +24 -15
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +59 -51
- package/lib/cjs/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/cjs/entities/requirements/getErc2612Permit.js +20 -4
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +24 -7
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +27 -7
- package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/cjs/entities/requirements/index.d.ts +2 -2
- package/lib/cjs/entities/requirements/index.js +5 -16
- package/lib/cjs/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/cjs/entities/requirements/validateNativeRequirements.js +37 -0
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +1 -7
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +17 -40
- package/lib/cjs/entities/vaultV1/vaultV1.js +228 -159
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +9 -4
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +21 -52
- package/lib/cjs/entities/vaultV2/vaultV2.js +226 -150
- package/lib/cjs/helpers/parse.d.ts +33 -0
- package/lib/cjs/helpers/parse.js +71 -0
- package/lib/cjs/helpers/parseMidnight.d.ts +48 -0
- package/lib/cjs/helpers/parseMidnight.js +95 -0
- package/lib/cjs/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/cjs/helpers/parseMidnightMaker.js +154 -0
- package/lib/cjs/helpers/validate.d.ts +3 -2
- package/lib/cjs/helpers/validate.js +4 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.js +4 -4
- package/lib/cjs/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/transactionPlan/blue/refinance.js +17 -9
- package/lib/cjs/transactionPlan/blue/repay.js +2 -1
- package/lib/cjs/transactionPlan/blue/repayWithdrawCollateral.js +23 -4
- package/lib/cjs/transactionPlan/blue/supplyCollateralBorrow.js +2 -2
- package/lib/cjs/transactionPlan/blue/withdraw.d.ts +2 -2
- package/lib/cjs/transactionPlan/blue/withdraw.js +3 -3
- package/lib/cjs/transactionPlan/blue/withdrawCollateral.js +6 -2
- package/lib/cjs/transactionPlan/validation.d.ts +1 -1
- package/lib/cjs/transactionPlan/validation.js +3 -0
- package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +2 -2
- package/lib/cjs/transactionPlan/vaultv1/deposit.js +2 -2
- package/lib/cjs/types/action.d.ts +13 -2
- package/lib/cjs/types/error.d.ts +20 -2
- package/lib/cjs/types/error.js +32 -3
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/actions/blue/borrow.d.ts +2 -1
- package/lib/esm/actions/blue/borrow.internal.d.ts +13 -0
- package/lib/esm/actions/blue/borrow.internal.js +30 -0
- package/lib/esm/actions/blue/borrow.js +4 -16
- package/lib/esm/actions/blue/common.d.ts +50 -28
- package/lib/esm/actions/blue/common.js +21 -33
- package/lib/esm/actions/blue/encode.d.ts +23 -0
- package/lib/esm/actions/blue/encode.js +164 -0
- package/lib/esm/actions/blue/refinance.d.ts +3 -2
- package/lib/esm/actions/blue/refinance.internal.d.ts +42 -0
- package/lib/esm/actions/blue/refinance.internal.js +56 -0
- package/lib/esm/actions/blue/refinance.js +5 -63
- package/lib/esm/actions/blue/refinanceValidation.d.ts +4 -5
- package/lib/esm/actions/blue/refinanceValidation.js +2 -4
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.internal.d.ts +13 -0
- package/lib/esm/actions/blue/repay.internal.js +33 -0
- package/lib/esm/actions/blue/repay.js +2 -17
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.d.ts +61 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.internal.js +104 -0
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +3 -116
- package/lib/esm/actions/blue/signatures.d.ts +30 -0
- package/lib/esm/actions/blue/signatures.js +82 -0
- package/lib/esm/actions/blue/supply.d.ts +1 -1
- package/lib/esm/actions/blue/supply.internal.d.ts +32 -0
- package/lib/esm/actions/blue/supply.internal.js +95 -0
- package/lib/esm/actions/blue/supply.js +2 -67
- package/lib/esm/actions/blue/supplyCollateral.d.ts +1 -1
- package/lib/esm/actions/blue/supplyCollateral.internal.d.ts +13 -0
- package/lib/esm/actions/blue/supplyCollateral.internal.js +32 -0
- package/lib/esm/actions/blue/supplyCollateral.js +2 -17
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +4 -3
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.d.ts +63 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.internal.js +87 -0
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +5 -106
- package/lib/esm/actions/blue/withdraw.d.ts +4 -3
- package/lib/esm/actions/blue/withdraw.internal.d.ts +56 -0
- package/lib/esm/actions/blue/withdraw.internal.js +77 -0
- package/lib/esm/actions/blue/withdraw.js +5 -78
- package/lib/esm/actions/blue/withdrawBuyCallback.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.d.ts +20 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.internal.js +53 -0
- package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -39
- package/lib/esm/actions/blue/withdrawCollateral.internal.d.ts +16 -0
- package/lib/esm/actions/blue/withdrawCollateral.internal.js +34 -0
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -17
- package/lib/esm/actions/bundles/common.d.ts +9 -0
- package/lib/esm/actions/bundles/common.js +15 -4
- package/lib/esm/actions/bundles/index.d.ts +1 -1
- package/lib/esm/actions/bundles/index.js +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +14 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +58 -61
- package/lib/esm/actions/midnight/cancelAndMake.d.ts +22 -1
- package/lib/esm/actions/midnight/cancelAndMake.js +43 -85
- package/lib/esm/actions/midnight/cancelOffers.d.ts +11 -0
- package/lib/esm/actions/midnight/cancelOffers.js +18 -2
- package/lib/esm/actions/midnight/encode.d.ts +36 -0
- package/lib/esm/actions/midnight/encode.js +539 -0
- package/lib/esm/actions/midnight/index.d.ts +14 -13
- package/lib/esm/actions/midnight/index.js +14 -13
- package/lib/esm/actions/midnight/parse.d.ts +35 -0
- package/lib/esm/actions/midnight/parse.js +68 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.d.ts +58 -0
- package/lib/esm/actions/midnight/parseCollateralBatch.js +209 -0
- package/lib/esm/actions/midnight/redeem.d.ts +16 -3
- package/lib/esm/actions/midnight/redeem.js +20 -50
- package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +13 -0
- package/lib/esm/actions/midnight/repayWithdrawCollateral.js +38 -64
- package/lib/esm/actions/midnight/supplyCollateral.d.ts +40 -5
- package/lib/esm/actions/midnight/supplyCollateral.js +57 -53
- package/lib/esm/actions/midnight/supplyCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/supplyCollateralBatch.js +3 -62
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +24 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +33 -61
- package/lib/esm/actions/midnight/supplyCollateralWithNative.d.ts +77 -0
- package/lib/esm/actions/midnight/supplyCollateralWithNative.js +137 -0
- package/lib/esm/actions/midnight/takeBorrow.d.ts +17 -2
- package/lib/esm/actions/midnight/takeBorrow.js +20 -51
- package/lib/esm/actions/midnight/takeLend.d.ts +21 -1
- package/lib/esm/actions/midnight/takeLend.js +26 -54
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -2
- package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +30 -58
- package/lib/esm/actions/midnight/takeWithdraw.d.ts +17 -2
- package/lib/esm/actions/midnight/takeWithdraw.js +76 -114
- package/lib/esm/actions/midnight/withdrawCollateral.d.ts +16 -3
- package/lib/esm/actions/midnight/withdrawCollateral.js +23 -55
- package/lib/esm/actions/midnight/withdrawCollateralBatch.d.ts +3 -3
- package/lib/esm/actions/midnight/withdrawCollateralBatch.js +3 -71
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +13 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +36 -18
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -1
- package/lib/esm/actions/requirements/blue/index.js +1 -1
- package/lib/esm/actions/requirements/chainCheck.d.ts +5 -0
- package/lib/esm/actions/requirements/chainCheck.js +6 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +36 -25
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +11 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +33 -16
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +14 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +41 -8
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +59 -24
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +10 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +21 -2
- package/lib/esm/actions/requirements/encode/index.d.ts +5 -5
- package/lib/esm/actions/requirements/encode/index.js +5 -5
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +26 -11
- package/lib/esm/actions/requirements/getRequirementsApproval.js +38 -12
- package/lib/esm/actions/requirements/index.d.ts +1 -1
- package/lib/esm/actions/requirements/index.js +1 -1
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +31 -18
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +11 -0
- package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +22 -10
- package/lib/esm/actions/requirements/midnight/index.d.ts +2 -2
- package/lib/esm/actions/requirements/midnight/index.js +2 -2
- package/lib/esm/actions/vaultV1/deposit.d.ts +21 -0
- package/lib/esm/actions/vaultV1/deposit.js +43 -9
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV1/inKindRedeem.js +33 -15
- package/lib/esm/actions/vaultV1/index.d.ts +5 -5
- package/lib/esm/actions/vaultV1/index.js +5 -5
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +21 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +47 -11
- package/lib/esm/actions/vaultV1/redeem.d.ts +19 -0
- package/lib/esm/actions/vaultV1/redeem.js +26 -7
- package/lib/esm/actions/vaultV1/withdraw.d.ts +19 -0
- package/lib/esm/actions/vaultV1/withdraw.js +26 -7
- package/lib/esm/actions/vaultV2/deposit.d.ts +21 -0
- package/lib/esm/actions/vaultV2/deposit.js +43 -9
- package/lib/esm/actions/vaultV2/forceRedeem.d.ts +20 -2
- package/lib/esm/actions/vaultV2/forceRedeem.js +35 -6
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +23 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.js +33 -13
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +18 -1
- package/lib/esm/actions/vaultV2/inKindRedeem.js +32 -14
- package/lib/esm/actions/vaultV2/index.d.ts +6 -6
- package/lib/esm/actions/vaultV2/index.js +6 -6
- package/lib/esm/actions/vaultV2/redeem.d.ts +19 -0
- package/lib/esm/actions/vaultV2/redeem.js +26 -7
- package/lib/esm/actions/vaultV2/withdraw.d.ts +19 -0
- package/lib/esm/actions/vaultV2/withdraw.js +26 -7
- package/lib/esm/entities/blue/blue.d.ts +35 -8
- package/lib/esm/entities/blue/blue.js +449 -388
- package/lib/esm/entities/midnight/midnight.d.ts +117 -41
- package/lib/esm/entities/midnight/midnight.js +455 -826
- package/lib/esm/entities/midnight/parse.d.ts +74 -0
- package/lib/esm/entities/midnight/parse.js +320 -0
- package/lib/esm/entities/midnight/prepare.d.ts +47 -0
- package/lib/esm/entities/midnight/prepare.js +282 -0
- package/lib/esm/entities/midnight/publication.d.ts +7 -3
- package/lib/esm/entities/midnight/publication.js +7 -3
- package/lib/esm/entities/midnight/types.d.ts +7 -0
- package/lib/esm/entities/requirements/assertContractCode.d.ts +10 -5
- package/lib/esm/entities/requirements/assertContractCode.js +24 -15
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +15 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +53 -47
- package/lib/esm/entities/requirements/getErc2612Permit.d.ts +7 -3
- package/lib/esm/entities/requirements/getErc2612Permit.js +19 -4
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +15 -0
- package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +20 -5
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +14 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +23 -5
- package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +4 -3
- package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +4 -3
- package/lib/esm/entities/requirements/index.d.ts +2 -2
- package/lib/esm/entities/requirements/index.js +2 -2
- package/lib/esm/entities/requirements/validateNativeRequirements.d.ts +21 -0
- package/lib/esm/entities/requirements/validateNativeRequirements.js +33 -0
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +1 -7
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +17 -40
- package/lib/esm/entities/vaultV1/vaultV1.js +208 -139
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +4 -0
- package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +10 -5
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +2 -2
- package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +1 -7
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +21 -52
- package/lib/esm/entities/vaultV2/vaultV2.js +209 -133
- package/lib/esm/helpers/parse.d.ts +33 -0
- package/lib/esm/helpers/parse.js +61 -0
- package/lib/esm/helpers/parseMidnight.d.ts +48 -0
- package/lib/esm/helpers/parseMidnight.js +80 -0
- package/lib/esm/helpers/parseMidnightMaker.d.ts +44 -0
- package/lib/esm/helpers/parseMidnightMaker.js +147 -0
- package/lib/esm/helpers/validate.d.ts +3 -2
- package/lib/esm/helpers/validate.js +5 -1
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.d.ts +8 -0
- package/lib/esm/helpers/validateMidnightCancelAndMakePublication.js +2 -2
- package/lib/esm/helpers/validateMidnightPublication.d.ts +17 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/transactionPlan/blue/refinance.js +18 -10
- package/lib/esm/transactionPlan/blue/repay.js +3 -2
- package/lib/esm/transactionPlan/blue/repayWithdrawCollateral.js +24 -5
- package/lib/esm/transactionPlan/blue/supplyCollateralBorrow.js +2 -2
- package/lib/esm/transactionPlan/blue/withdraw.d.ts +2 -2
- package/lib/esm/transactionPlan/blue/withdraw.js +3 -3
- package/lib/esm/transactionPlan/blue/withdrawCollateral.js +6 -2
- package/lib/esm/transactionPlan/validation.d.ts +1 -1
- package/lib/esm/transactionPlan/validation.js +3 -0
- package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +2 -2
- package/lib/esm/transactionPlan/vaultv1/deposit.js +2 -2
- package/lib/esm/types/action.d.ts +13 -2
- package/lib/esm/types/error.d.ts +20 -2
- package/lib/esm/types/error.js +27 -0
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -511,8 +511,8 @@ export interface VaultV2Actions {
|
|
|
511
511
|
* @returns An object whose `buildTx()` returns a deep-frozen `Transaction<VaultV2ForceRedeemAction>`
|
|
512
512
|
* encoding the vault `multicall`.
|
|
513
513
|
* @throws {ChainIdMismatchError} when the connected client declares another chain or none.
|
|
514
|
-
* @throws {EmptyDeallocationsError}
|
|
515
|
-
* @throws {NonPositiveInputError}
|
|
514
|
+
* @throws {EmptyDeallocationsError} when creating the handle if `deallocations` is empty.
|
|
515
|
+
* @throws {NonPositiveInputError} when creating the handle if `redeem.shares <= 0n` or any deallocation
|
|
516
516
|
* amount is non-positive.
|
|
517
517
|
* @example
|
|
518
518
|
* ```ts
|
|
@@ -544,6 +544,7 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
544
544
|
private readonly chainId;
|
|
545
545
|
constructor(client: MorphoClientType, vault: Address, chainId: number);
|
|
546
546
|
getData(parameters?: FetchParameters): Promise<AccrualVaultV2>;
|
|
547
|
+
private getDataWithChainCheck;
|
|
547
548
|
/**
|
|
548
549
|
* Asserts that every registry contract this flow's transaction targets or names as
|
|
549
550
|
* spender/authorized operator holds code, with one `eth_getCode` per distinct address
|
|
@@ -554,68 +555,36 @@ export declare class MorphoVaultV2 implements VaultV2Actions {
|
|
|
554
555
|
*/
|
|
555
556
|
private assertWriteTargets;
|
|
556
557
|
/** {@inheritDoc VaultV2Actions.deposit} */
|
|
557
|
-
deposit(params: {
|
|
558
|
-
readonly userAddress: Address;
|
|
559
|
-
readonly vaultData: AccrualVaultV2;
|
|
560
|
-
readonly slippageTolerance?: bigint;
|
|
561
|
-
readonly referralFeePct?: bigint;
|
|
562
|
-
readonly referralFeeRecipient?: Address;
|
|
563
|
-
readonly deadline?: bigint;
|
|
564
|
-
} & ReferenceTimestampParams & BundlesFundingArgs): Readonly<{
|
|
558
|
+
deposit(params: Parameters<VaultV2Actions["deposit"]>[0]): Readonly<{
|
|
565
559
|
getRequirements: (requirementOptions?: BundlesTokenRequirementsOptions) => Promise<readonly ActionRequirement[]>;
|
|
566
560
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2DepositAction>>;
|
|
567
561
|
}>;
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
readonly vaultData: AccrualVaultV2;
|
|
572
|
-
readonly slippageTolerance?: bigint;
|
|
573
|
-
readonly referralFeePct?: bigint;
|
|
574
|
-
readonly referralFeeRecipient?: Address;
|
|
575
|
-
readonly deadline?: bigint;
|
|
576
|
-
} & ReferenceTimestampParams): Readonly<{
|
|
562
|
+
private parseDeposit;
|
|
563
|
+
private buildDeposit;
|
|
564
|
+
withdraw(params: Parameters<VaultV2Actions["withdraw"]>[0]): Readonly<{
|
|
577
565
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../types/action.js").ERC20ApprovalAction>> | import("../../types/action.js").Requirement<import("../../types/action.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
578
566
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2WithdrawAction>>;
|
|
579
567
|
}>;
|
|
568
|
+
private parseWithdraw;
|
|
569
|
+
private buildWithdraw;
|
|
580
570
|
/** {@inheritDoc VaultV2Actions.redeem} */
|
|
581
|
-
redeem(params: {
|
|
582
|
-
readonly shares: bigint;
|
|
583
|
-
readonly userAddress: Address;
|
|
584
|
-
readonly referralFeePct?: bigint;
|
|
585
|
-
readonly referralFeeRecipient?: Address;
|
|
586
|
-
readonly deadline?: bigint;
|
|
587
|
-
} & ReferenceTimestampParams): Readonly<{
|
|
571
|
+
redeem(params: Parameters<VaultV2Actions["redeem"]>[0]): Readonly<{
|
|
588
572
|
getRequirements: () => Promise<readonly (Readonly<Transaction<import("../../types/action.js").ERC20ApprovalAction>> | import("../../types/action.js").Requirement<import("../../types/action.js").Erc2612RequirementSignature, undefined>)[]>;
|
|
589
573
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<VaultV2RedeemAction>>;
|
|
590
574
|
}>;
|
|
575
|
+
private parseRedeem;
|
|
576
|
+
private buildRedeem;
|
|
591
577
|
/** {@inheritDoc VaultV2Actions.inKindRedeem} */
|
|
592
|
-
inKindRedeem(params:
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
readonly vaultData: AccrualVaultV2;
|
|
596
|
-
readonly userAddress: Address;
|
|
597
|
-
readonly adapter?: Address;
|
|
598
|
-
readonly deadline?: bigint;
|
|
599
|
-
} & ReferenceTimestampParams): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
578
|
+
inKindRedeem(params: Parameters<VaultV2Actions["inKindRedeem"]>[0]): ActionOutput<VaultV2InKindRedeemAction, readonly RequirementSignature[], undefined>;
|
|
579
|
+
private parseInKindRedeem;
|
|
580
|
+
private buildInKindRedeem;
|
|
600
581
|
/** {@inheritDoc VaultV2Actions.forceWithdraw} */
|
|
601
|
-
forceWithdraw(params:
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
readonly adapter?: Address;
|
|
606
|
-
readonly deadline?: bigint;
|
|
607
|
-
readonly slippageTolerance?: bigint;
|
|
608
|
-
readonly minSharePriceE27?: bigint;
|
|
609
|
-
readonly referralFeePct?: bigint;
|
|
610
|
-
readonly referralFeeRecipient?: Address;
|
|
611
|
-
} & ReferenceTimestampParams): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
612
|
-
forceRedeem(params: {
|
|
613
|
-
deallocations: readonly Deallocation[];
|
|
614
|
-
redeem: {
|
|
615
|
-
shares: bigint;
|
|
616
|
-
};
|
|
617
|
-
userAddress: Address;
|
|
618
|
-
} & ReferenceTimestampParams): {
|
|
582
|
+
forceWithdraw(params: Parameters<VaultV2Actions["forceWithdraw"]>[0]): ActionOutput<VaultV2ForceWithdrawAction, readonly RequirementSignature[], undefined>;
|
|
583
|
+
private parseForceWithdraw;
|
|
584
|
+
private buildForceWithdraw;
|
|
585
|
+
forceRedeem(params: Parameters<VaultV2Actions["forceRedeem"]>[0]): {
|
|
619
586
|
buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
|
|
620
587
|
};
|
|
588
|
+
private parseForceRedeem;
|
|
589
|
+
private buildForceRedeem;
|
|
621
590
|
}
|
|
@@ -2,18 +2,25 @@ import { DEFAULT_SLIPPAGE_TOLERANCE, MarketParams, } from "@morpho-org/blue-sdk"
|
|
|
2
2
|
import { fetchAccrualVaultV2 } from "@morpho-org/blue-sdk-viem";
|
|
3
3
|
import { getChainAddress, Time, } from "@morpho-org/morpho-ts";
|
|
4
4
|
import { isAddressEqual } from "viem";
|
|
5
|
-
import { getBundlesReferralFeeAssets, normalizeBundlesCommonParams, resolveBundlesFunding, selectBundlesSharesPermitSignature, selectBundlesTokenRequirementSignature, } from "../../actions/bundles/common.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { getBundlesReferralFeeAssets, normalizeBundlesCommonParams as parseBundlesCommon, resolveBundlesFunding, selectBundlesSharesPermitSignature, selectBundlesTokenRequirementSignature, } from "../../actions/bundles/common.js";
|
|
6
|
+
import { createChainCheck, } from "../../actions/requirements/chainCheck.js";
|
|
7
|
+
import { buildVaultV2Deposit, } from "../../actions/vaultV2/deposit.js";
|
|
8
|
+
import { buildVaultV2ForceRedeem, parseVaultV2ForceRedeem, } from "../../actions/vaultV2/forceRedeem.js";
|
|
9
|
+
import { buildVaultV2ForceWithdraw, } from "../../actions/vaultV2/forceWithdraw.js";
|
|
10
|
+
import { buildVaultV2InKindRedeem, } from "../../actions/vaultV2/inKindRedeem.js";
|
|
11
|
+
import { buildVaultV2Redeem, } from "../../actions/vaultV2/redeem.js";
|
|
12
|
+
import { buildVaultV2Withdraw, } from "../../actions/vaultV2/withdraw.js";
|
|
8
13
|
import { computeVaultMaxShareAllowance, computeVaultMaxSharePrice, validateChainId, validateSlippageTolerance, } from "../../helpers/index.js";
|
|
9
14
|
import { resolveTransactionMetadata } from "../../helpers/metadata.js";
|
|
10
|
-
import {
|
|
15
|
+
import { parseUint256 } from "../../helpers/parse.js";
|
|
16
|
+
import { validateNativeVaultAsset } from "../../helpers/validate.js";
|
|
11
17
|
import { ExpiredDeadlineError, NonPositiveInputError, VaultAddressMismatchError, } from "../../types/index.js";
|
|
12
18
|
import { assertRegistryTargetsHaveCode } from "../requirements/assertContractCode.js";
|
|
13
|
-
import {
|
|
19
|
+
import { getParsedBundlesTokenRequirements, parseGetBundlesTokenRequirements, } from "../requirements/getBundlesTokenRequirements.js";
|
|
20
|
+
import { getParsedVaultBundlesSharesRequirements, parseVaultBundlesSharesRequirements, } from "../requirements/getVaultBundlesSharesRequirements.js";
|
|
14
21
|
import { getVaultV2ForceWithdrawRequirements } from "../requirements/getVaultV2ForceWithdrawRequirements.js";
|
|
15
22
|
import { getVaultV2InKindRedeemRequirements } from "../requirements/getVaultV2InKindRedeemRequirements.js";
|
|
16
|
-
import {
|
|
23
|
+
import { validateNativeRequirements } from "../requirements/validateNativeRequirements.js";
|
|
17
24
|
import { computeVaultV2ForceWithdrawQuote } from "./forceWithdrawQuote.js";
|
|
18
25
|
import { computeVaultV2InKindRedeemQuote } from "./inKindRedeemQuote.js";
|
|
19
26
|
/** Binds a viem client to a Vault V2 vault's action builders. */
|
|
@@ -28,7 +35,10 @@ export class MorphoVaultV2 {
|
|
|
28
35
|
this.chainId = chainId;
|
|
29
36
|
}
|
|
30
37
|
async getData(parameters) {
|
|
31
|
-
|
|
38
|
+
return this.getDataWithChainCheck(createChainCheck(this.client.viemClient, this.chainId), parameters);
|
|
39
|
+
}
|
|
40
|
+
async getDataWithChainCheck(chainCheck, parameters) {
|
|
41
|
+
await chainCheck();
|
|
32
42
|
return fetchAccrualVaultV2(this.vault, this.client.viemClient, {
|
|
33
43
|
...parameters,
|
|
34
44
|
deployless: this.client.options.supportDeployless,
|
|
@@ -42,16 +52,19 @@ export class MorphoVaultV2 {
|
|
|
42
52
|
*
|
|
43
53
|
* @param roles - Registry labels to resolve and check.
|
|
44
54
|
*/
|
|
45
|
-
async assertWriteTargets(roles) {
|
|
55
|
+
async assertWriteTargets(roles, chainCheck) {
|
|
46
56
|
const targets = [];
|
|
47
57
|
for (const role of roles) {
|
|
48
58
|
const address = getChainAddress(this.chainId, role);
|
|
49
59
|
targets.push({ role, address });
|
|
50
60
|
}
|
|
51
|
-
await assertRegistryTargetsHaveCode(this.client.viemClient, this.chainId, targets);
|
|
61
|
+
await assertRegistryTargetsHaveCode(this.client.viemClient, this.chainId, targets, chainCheck);
|
|
52
62
|
}
|
|
53
63
|
/** {@inheritDoc VaultV2Actions.deposit} */
|
|
54
64
|
deposit(params) {
|
|
65
|
+
return this.buildDeposit(this.parseDeposit(params));
|
|
66
|
+
}
|
|
67
|
+
parseDeposit(params) {
|
|
55
68
|
const suppliedNow = params.now;
|
|
56
69
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
57
70
|
const { userAddress, vaultData } = params;
|
|
@@ -65,16 +78,15 @@ export class MorphoVaultV2 {
|
|
|
65
78
|
if (deadline <= createdAt) {
|
|
66
79
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
67
80
|
}
|
|
68
|
-
const common =
|
|
81
|
+
const common = parseBundlesCommon({
|
|
69
82
|
deadline,
|
|
70
83
|
referralFeePct: params.referralFeePct,
|
|
71
84
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
72
85
|
});
|
|
73
86
|
const funding = resolveBundlesFunding(params);
|
|
74
|
-
// Reject
|
|
75
|
-
|
|
87
|
+
// Reject invalid funding before preparing a lazy handle.
|
|
88
|
+
parseUint256(funding.value > 0n ? "nativeAmount" : "amount", funding.assets);
|
|
76
89
|
if (funding.value > 0n) {
|
|
77
|
-
// The native path must target the chain's registered wrapped-native asset.
|
|
78
90
|
validateNativeVaultAsset(this.chainId, vaultAsset);
|
|
79
91
|
}
|
|
80
92
|
const referralFeeAssets = getBundlesReferralFeeAssets(funding.assets, common.referralFeePct);
|
|
@@ -85,35 +97,69 @@ export class MorphoVaultV2 {
|
|
|
85
97
|
slippageTolerance: params.slippageTolerance ?? DEFAULT_SLIPPAGE_TOLERANCE,
|
|
86
98
|
});
|
|
87
99
|
const spender = getChainAddress(this.chainId, "bundles.vaultBundlesV1");
|
|
100
|
+
if (maxSharePrice <= 0n) {
|
|
101
|
+
throw new NonPositiveInputError("maxSharePrice", maxSharePrice);
|
|
102
|
+
}
|
|
103
|
+
// Computed bounds also have to fit uint256.
|
|
104
|
+
parseUint256("maxSharePrice", maxSharePrice);
|
|
105
|
+
const parsed = {
|
|
106
|
+
vault: { chainId: this.chainId, address: this.vault, asset: vaultAsset },
|
|
107
|
+
userAddress,
|
|
108
|
+
funding,
|
|
109
|
+
maxSharePrice,
|
|
110
|
+
common,
|
|
111
|
+
metadata,
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
suppliedNow,
|
|
115
|
+
parsed,
|
|
116
|
+
spender,
|
|
117
|
+
vaultAsset,
|
|
118
|
+
userAddress,
|
|
119
|
+
funding,
|
|
120
|
+
deadline,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
buildDeposit(input) {
|
|
124
|
+
const { parsed, spender, vaultAsset, userAddress, funding, deadline } = input;
|
|
88
125
|
let pendingRequirements;
|
|
89
126
|
return Object.freeze({
|
|
90
127
|
getRequirements: async (requirementOptions) => {
|
|
91
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
128
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
92
129
|
if (deadline <= now) {
|
|
93
130
|
throw new ExpiredDeadlineError(deadline, now);
|
|
94
131
|
}
|
|
132
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
133
|
+
if (funding.value > 0n) {
|
|
134
|
+
// Native funding skips the token resolver's chain validation.
|
|
135
|
+
await validateNativeRequirements(this.client.viemClient, {
|
|
136
|
+
chainId: this.chainId,
|
|
137
|
+
chainCheck,
|
|
138
|
+
assertWriteTargets: () => this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck),
|
|
139
|
+
});
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
143
|
+
const tokenInput = parseGetBundlesTokenRequirements(this.client.viemClient, {
|
|
144
|
+
token: vaultAsset,
|
|
145
|
+
spender,
|
|
146
|
+
amount: funding.assets,
|
|
147
|
+
owner: userAddress,
|
|
148
|
+
chainId: this.chainId,
|
|
149
|
+
deadline,
|
|
150
|
+
supportSignature: this.client.options.supportSignature,
|
|
151
|
+
supportDeployless: this.client.options.supportDeployless,
|
|
152
|
+
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
153
|
+
now,
|
|
154
|
+
});
|
|
155
|
+
// Check each non-no-op invocation before sharing an in-flight state read.
|
|
156
|
+
if (tokenInput.amount > 0n) {
|
|
157
|
+
await chainCheck();
|
|
158
|
+
}
|
|
95
159
|
if (pendingRequirements != null) {
|
|
96
160
|
return await pendingRequirements;
|
|
97
161
|
}
|
|
98
|
-
|
|
99
|
-
// allowance/nonce reads.
|
|
100
|
-
const pending = (async () => {
|
|
101
|
-
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
102
|
-
return funding.value > 0n
|
|
103
|
-
? []
|
|
104
|
-
: getBundlesTokenRequirements(this.client.viemClient, {
|
|
105
|
-
token: vaultAsset,
|
|
106
|
-
spender,
|
|
107
|
-
amount: funding.assets,
|
|
108
|
-
owner: userAddress,
|
|
109
|
-
chainId: this.chainId,
|
|
110
|
-
deadline,
|
|
111
|
-
supportSignature: this.client.options.supportSignature,
|
|
112
|
-
supportDeployless: this.client.options.supportDeployless,
|
|
113
|
-
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
114
|
-
now,
|
|
115
|
-
});
|
|
116
|
-
})();
|
|
162
|
+
const pending = getParsedBundlesTokenRequirements({ viemClient: this.client.viemClient, chainCheck }, tokenInput);
|
|
117
163
|
pendingRequirements = pending;
|
|
118
164
|
try {
|
|
119
165
|
return await pending;
|
|
@@ -128,29 +174,14 @@ export class MorphoVaultV2 {
|
|
|
128
174
|
buildTx: (signatures) => {
|
|
129
175
|
// The pure deposit action rejects a token signature supplied alongside native funding.
|
|
130
176
|
const requirementSignature = selectBundlesTokenRequirementSignature(signatures, { spender, amount: funding.assets, deadline });
|
|
131
|
-
return
|
|
132
|
-
vault: {
|
|
133
|
-
chainId: this.chainId,
|
|
134
|
-
address: this.vault,
|
|
135
|
-
asset: vaultAsset,
|
|
136
|
-
},
|
|
137
|
-
args: {
|
|
138
|
-
...(funding.value > 0n
|
|
139
|
-
? { nativeAmount: funding.assets }
|
|
140
|
-
: { amount: funding.assets }),
|
|
141
|
-
maxSharePrice,
|
|
142
|
-
userAddress,
|
|
143
|
-
requirementSignature,
|
|
144
|
-
referralFeePct: common.referralFeePct,
|
|
145
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
146
|
-
deadline,
|
|
147
|
-
},
|
|
148
|
-
metadata,
|
|
149
|
-
});
|
|
177
|
+
return buildVaultV2Deposit(parsed, { requirementSignature });
|
|
150
178
|
},
|
|
151
179
|
});
|
|
152
180
|
}
|
|
153
181
|
withdraw(params) {
|
|
182
|
+
return this.buildWithdraw(this.parseWithdraw(params));
|
|
183
|
+
}
|
|
184
|
+
parseWithdraw(params) {
|
|
154
185
|
const suppliedNow = params.now;
|
|
155
186
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
156
187
|
const { amount, userAddress, vaultData } = params;
|
|
@@ -162,13 +193,13 @@ export class MorphoVaultV2 {
|
|
|
162
193
|
throw new NonPositiveInputError("amount", amount);
|
|
163
194
|
}
|
|
164
195
|
// Reject values outside the ABI range before resolving any requirements.
|
|
165
|
-
|
|
196
|
+
const parsedAmount = parseUint256("amount", amount);
|
|
166
197
|
const createdAt = suppliedNow ?? Time.timestamp();
|
|
167
198
|
const deadline = params.deadline ?? createdAt + Time.s.from.h(2n);
|
|
168
199
|
if (deadline <= createdAt) {
|
|
169
200
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
170
201
|
}
|
|
171
|
-
const common =
|
|
202
|
+
const common = parseBundlesCommon({
|
|
172
203
|
deadline,
|
|
173
204
|
referralFeePct: params.referralFeePct,
|
|
174
205
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
@@ -183,15 +214,34 @@ export class MorphoVaultV2 {
|
|
|
183
214
|
assets: amount,
|
|
184
215
|
slippageTolerance,
|
|
185
216
|
});
|
|
217
|
+
const parsed = {
|
|
218
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
219
|
+
args: { amount: parsedAmount, userAddress, ...common },
|
|
220
|
+
common,
|
|
221
|
+
metadata,
|
|
222
|
+
};
|
|
223
|
+
return {
|
|
224
|
+
suppliedNow,
|
|
225
|
+
parsed,
|
|
226
|
+
spender,
|
|
227
|
+
vaultData,
|
|
228
|
+
userAddress,
|
|
229
|
+
requiredShareAllowance,
|
|
230
|
+
deadline,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
buildWithdraw(input) {
|
|
234
|
+
const { parsed, spender, vaultData, userAddress, requiredShareAllowance, deadline, } = input;
|
|
186
235
|
return Object.freeze({
|
|
187
236
|
getRequirements: async () => {
|
|
188
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
237
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
189
238
|
if (deadline <= now) {
|
|
190
239
|
throw new ExpiredDeadlineError(deadline, now);
|
|
191
240
|
}
|
|
192
|
-
|
|
241
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
242
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
193
243
|
// Re-read the live share allowance on every call instead of caching the resolved requirements.
|
|
194
|
-
return
|
|
244
|
+
return getParsedVaultBundlesSharesRequirements({ viemClient: this.client.viemClient, chainCheck }, parseVaultBundlesSharesRequirements(this.client.viemClient, {
|
|
195
245
|
vaultData,
|
|
196
246
|
version: "vaultV2",
|
|
197
247
|
owner: userAddress,
|
|
@@ -200,7 +250,7 @@ export class MorphoVaultV2 {
|
|
|
200
250
|
deadline,
|
|
201
251
|
supportSignature: this.client.options.supportSignature,
|
|
202
252
|
now,
|
|
203
|
-
});
|
|
253
|
+
}));
|
|
204
254
|
},
|
|
205
255
|
buildTx: (signatures) => {
|
|
206
256
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -208,23 +258,15 @@ export class MorphoVaultV2 {
|
|
|
208
258
|
amount: requiredShareAllowance,
|
|
209
259
|
deadline,
|
|
210
260
|
});
|
|
211
|
-
return
|
|
212
|
-
vault: { chainId: this.chainId, address: this.vault },
|
|
213
|
-
args: {
|
|
214
|
-
amount,
|
|
215
|
-
userAddress,
|
|
216
|
-
requirementSignature: permit,
|
|
217
|
-
referralFeePct: common.referralFeePct,
|
|
218
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
219
|
-
deadline,
|
|
220
|
-
},
|
|
221
|
-
metadata,
|
|
222
|
-
});
|
|
261
|
+
return buildVaultV2Withdraw(parsed, { requirementSignature: permit });
|
|
223
262
|
},
|
|
224
263
|
});
|
|
225
264
|
}
|
|
226
265
|
/** {@inheritDoc VaultV2Actions.redeem} */
|
|
227
266
|
redeem(params) {
|
|
267
|
+
return this.buildRedeem(this.parseRedeem(params));
|
|
268
|
+
}
|
|
269
|
+
parseRedeem(params) {
|
|
228
270
|
const suppliedNow = params.now;
|
|
229
271
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
230
272
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
@@ -237,21 +279,32 @@ export class MorphoVaultV2 {
|
|
|
237
279
|
if (deadline <= createdAt) {
|
|
238
280
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
239
281
|
}
|
|
240
|
-
const common =
|
|
282
|
+
const common = parseBundlesCommon({
|
|
241
283
|
deadline,
|
|
242
284
|
referralFeePct: params.referralFeePct,
|
|
243
285
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
244
286
|
});
|
|
245
287
|
const spender = getChainAddress(this.chainId, "bundles.vaultBundlesV1");
|
|
288
|
+
const parsed = {
|
|
289
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
290
|
+
args: { shares: parseUint256("shares", shares), userAddress, ...common },
|
|
291
|
+
common,
|
|
292
|
+
metadata,
|
|
293
|
+
};
|
|
294
|
+
return { suppliedNow, parsed, spender, shares, userAddress, deadline };
|
|
295
|
+
}
|
|
296
|
+
buildRedeem(input) {
|
|
297
|
+
const { parsed, spender, shares, userAddress, deadline } = input;
|
|
246
298
|
return Object.freeze({
|
|
247
299
|
getRequirements: async () => {
|
|
248
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
300
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
249
301
|
if (deadline <= now) {
|
|
250
302
|
throw new ExpiredDeadlineError(deadline, now);
|
|
251
303
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
304
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
305
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
306
|
+
return getParsedVaultBundlesSharesRequirements({ viemClient: this.client.viemClient, chainCheck }, parseVaultBundlesSharesRequirements(this.client.viemClient, {
|
|
307
|
+
vaultData: await this.getDataWithChainCheck(chainCheck),
|
|
255
308
|
version: "vaultV2",
|
|
256
309
|
owner: userAddress,
|
|
257
310
|
chainId: this.chainId,
|
|
@@ -259,7 +312,7 @@ export class MorphoVaultV2 {
|
|
|
259
312
|
deadline,
|
|
260
313
|
supportSignature: this.client.options.supportSignature,
|
|
261
314
|
now,
|
|
262
|
-
});
|
|
315
|
+
}));
|
|
263
316
|
},
|
|
264
317
|
buildTx: (signatures) => {
|
|
265
318
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -267,26 +320,16 @@ export class MorphoVaultV2 {
|
|
|
267
320
|
amount: shares,
|
|
268
321
|
deadline,
|
|
269
322
|
});
|
|
270
|
-
return
|
|
271
|
-
vault: { chainId: this.chainId, address: this.vault },
|
|
272
|
-
args: {
|
|
273
|
-
shares,
|
|
274
|
-
userAddress,
|
|
275
|
-
requirementSignature: permit,
|
|
276
|
-
referralFeePct: common.referralFeePct,
|
|
277
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
278
|
-
deadline,
|
|
279
|
-
},
|
|
280
|
-
metadata,
|
|
281
|
-
});
|
|
323
|
+
return buildVaultV2Redeem(parsed, { requirementSignature: permit });
|
|
282
324
|
},
|
|
283
325
|
});
|
|
284
326
|
}
|
|
285
327
|
/** {@inheritDoc VaultV2Actions.inKindRedeem} */
|
|
286
328
|
inKindRedeem(params) {
|
|
287
|
-
|
|
329
|
+
return this.buildInKindRedeem(this.parseInKindRedeem(params));
|
|
330
|
+
}
|
|
331
|
+
parseInKindRedeem({ now: suppliedNow, amount, marketParamsList, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, }) {
|
|
288
332
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
289
|
-
const { amount, marketParamsList, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, } = params;
|
|
290
333
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
291
334
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
292
335
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
@@ -295,12 +338,36 @@ export class MorphoVaultV2 {
|
|
|
295
338
|
amount,
|
|
296
339
|
marketParamsList,
|
|
297
340
|
vaultData,
|
|
298
|
-
deadline: deadlineOverride,
|
|
299
341
|
adapter: adapterOverride,
|
|
342
|
+
deadline: deadlineOverride,
|
|
300
343
|
now: suppliedNow ?? Time.timestamp(),
|
|
301
344
|
vault: this.vault,
|
|
302
345
|
});
|
|
303
346
|
const vaultExitBundlesV1 = getChainAddress(this.chainId, "bundles.vaultExitBundlesV1");
|
|
347
|
+
const parsed = {
|
|
348
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
349
|
+
args: {
|
|
350
|
+
adapter,
|
|
351
|
+
amount,
|
|
352
|
+
marketParamsList: marketParamsListSnapshot,
|
|
353
|
+
userAddress,
|
|
354
|
+
deadline,
|
|
355
|
+
},
|
|
356
|
+
metadata,
|
|
357
|
+
};
|
|
358
|
+
return {
|
|
359
|
+
suppliedNow,
|
|
360
|
+
parsed,
|
|
361
|
+
deadline,
|
|
362
|
+
userAddress,
|
|
363
|
+
vaultData,
|
|
364
|
+
vaultExitBundlesV1,
|
|
365
|
+
peak,
|
|
366
|
+
requiredShareAllowance,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
buildInKindRedeem(input) {
|
|
370
|
+
const { parsed, deadline, userAddress, vaultData, vaultExitBundlesV1, peak, requiredShareAllowance, } = input;
|
|
304
371
|
return {
|
|
305
372
|
getRequirements: () => getVaultV2InKindRedeemRequirements(this.client.viemClient, {
|
|
306
373
|
vaultData,
|
|
@@ -311,7 +378,7 @@ export class MorphoVaultV2 {
|
|
|
311
378
|
requiredShareAllowance,
|
|
312
379
|
supportSignature: this.client.options.supportSignature,
|
|
313
380
|
peak,
|
|
314
|
-
now: suppliedNow,
|
|
381
|
+
now: input.suppliedNow,
|
|
315
382
|
}),
|
|
316
383
|
buildTx: (signatures) => {
|
|
317
384
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -319,31 +386,23 @@ export class MorphoVaultV2 {
|
|
|
319
386
|
amount: requiredShareAllowance,
|
|
320
387
|
deadline,
|
|
321
388
|
});
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
args: {
|
|
325
|
-
adapter,
|
|
326
|
-
amount,
|
|
327
|
-
marketParamsList: marketParamsListSnapshot,
|
|
328
|
-
userAddress,
|
|
329
|
-
deadline,
|
|
330
|
-
requirementSignature: permit,
|
|
331
|
-
},
|
|
332
|
-
metadata,
|
|
389
|
+
return buildVaultV2InKindRedeem(parsed, {
|
|
390
|
+
requirementSignature: permit,
|
|
333
391
|
});
|
|
334
392
|
},
|
|
335
393
|
};
|
|
336
394
|
}
|
|
337
395
|
/** {@inheritDoc VaultV2Actions.forceWithdraw} */
|
|
338
396
|
forceWithdraw(params) {
|
|
339
|
-
|
|
397
|
+
return this.buildForceWithdraw(this.parseForceWithdraw(params));
|
|
398
|
+
}
|
|
399
|
+
parseForceWithdraw({ now: suppliedNow, exitAssets, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, slippageTolerance = DEFAULT_SLIPPAGE_TOLERANCE, minSharePriceE27: minSharePriceE27Override, referralFeePct = 0n, referralFeeRecipient, }) {
|
|
340
400
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
341
|
-
const { exitAssets, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, slippageTolerance = DEFAULT_SLIPPAGE_TOLERANCE, minSharePriceE27: minSharePriceE27Override, referralFeePct = 0n, referralFeeRecipient, } = params;
|
|
342
401
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
343
402
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
344
403
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
345
404
|
}
|
|
346
|
-
const { deadline, adapter, minSharePriceE27, requiredShareAllowance } = computeVaultV2ForceWithdrawQuote({
|
|
405
|
+
const { deadline, adapter, minSharePriceE27, requiredShareAllowance, referral, } = computeVaultV2ForceWithdrawQuote({
|
|
347
406
|
exitAssets,
|
|
348
407
|
vaultData,
|
|
349
408
|
userAddress,
|
|
@@ -357,6 +416,30 @@ export class MorphoVaultV2 {
|
|
|
357
416
|
vault: this.vault,
|
|
358
417
|
});
|
|
359
418
|
const vaultExitBundlesV1 = getChainAddress(this.chainId, "bundles.vaultExitBundlesV1");
|
|
419
|
+
const parsed = {
|
|
420
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
421
|
+
args: {
|
|
422
|
+
adapter,
|
|
423
|
+
exitAssets,
|
|
424
|
+
minSharePriceE27,
|
|
425
|
+
userAddress,
|
|
426
|
+
deadline,
|
|
427
|
+
},
|
|
428
|
+
referral,
|
|
429
|
+
metadata,
|
|
430
|
+
};
|
|
431
|
+
return {
|
|
432
|
+
suppliedNow,
|
|
433
|
+
parsed,
|
|
434
|
+
deadline,
|
|
435
|
+
userAddress,
|
|
436
|
+
vaultData,
|
|
437
|
+
vaultExitBundlesV1,
|
|
438
|
+
requiredShareAllowance,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
buildForceWithdraw(input) {
|
|
442
|
+
const { parsed, deadline, userAddress, vaultData, vaultExitBundlesV1, requiredShareAllowance, } = input;
|
|
360
443
|
return {
|
|
361
444
|
getRequirements: () => getVaultV2ForceWithdrawRequirements(this.client.viemClient, {
|
|
362
445
|
vaultData,
|
|
@@ -366,7 +449,7 @@ export class MorphoVaultV2 {
|
|
|
366
449
|
deadline,
|
|
367
450
|
requiredShareAllowance,
|
|
368
451
|
supportSignature: this.client.options.supportSignature,
|
|
369
|
-
now: suppliedNow,
|
|
452
|
+
now: input.suppliedNow,
|
|
370
453
|
}),
|
|
371
454
|
buildTx: (signatures) => {
|
|
372
455
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -374,26 +457,17 @@ export class MorphoVaultV2 {
|
|
|
374
457
|
amount: requiredShareAllowance,
|
|
375
458
|
deadline,
|
|
376
459
|
});
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
args: {
|
|
380
|
-
adapter,
|
|
381
|
-
exitAssets,
|
|
382
|
-
minSharePriceE27,
|
|
383
|
-
userAddress,
|
|
384
|
-
deadline,
|
|
385
|
-
referralFeePct,
|
|
386
|
-
referralFeeRecipient,
|
|
387
|
-
requirementSignature: permit,
|
|
388
|
-
},
|
|
389
|
-
metadata,
|
|
460
|
+
return buildVaultV2ForceWithdraw(parsed, {
|
|
461
|
+
requirementSignature: permit,
|
|
390
462
|
});
|
|
391
463
|
},
|
|
392
464
|
};
|
|
393
465
|
}
|
|
394
466
|
forceRedeem(params) {
|
|
395
|
-
|
|
396
|
-
|
|
467
|
+
return this.buildForceRedeem(this.parseForceRedeem(params));
|
|
468
|
+
}
|
|
469
|
+
parseForceRedeem({ now: suppliedNow, deallocations, redeem, userAddress, }) {
|
|
470
|
+
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
397
471
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
398
472
|
const shares = redeem.shares;
|
|
399
473
|
const deallocationsSnapshot = deallocations.map(({ adapter, marketParams, amount }) => ({
|
|
@@ -401,16 +475,18 @@ export class MorphoVaultV2 {
|
|
|
401
475
|
amount,
|
|
402
476
|
...(marketParams && { marketParams: new MarketParams(marketParams) }),
|
|
403
477
|
}));
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
478
|
+
const parsed = parseVaultV2ForceRedeem({
|
|
479
|
+
vault: { address: this.vault },
|
|
480
|
+
args: {
|
|
481
|
+
deallocations: deallocationsSnapshot,
|
|
482
|
+
redeem: { shares, recipient: userAddress },
|
|
483
|
+
onBehalf: userAddress,
|
|
484
|
+
},
|
|
485
|
+
metadata,
|
|
486
|
+
});
|
|
487
|
+
return parsed;
|
|
488
|
+
}
|
|
489
|
+
buildForceRedeem(parsed) {
|
|
490
|
+
return { buildTx: () => buildVaultV2ForceRedeem(parsed) };
|
|
415
491
|
}
|
|
416
492
|
}
|