@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
|
@@ -2,31 +2,25 @@ import { DEFAULT_SLIPPAGE_TOLERANCE, Eip5267Domain, Token, } from "@morpho-org/b
|
|
|
2
2
|
import { fetchAccrualVault } 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 { buildVaultV1Deposit, } from "../../actions/vaultV1/deposit.js";
|
|
8
|
+
import { buildVaultV1InKindRedeem, } from "../../actions/vaultV1/inKindRedeem.js";
|
|
9
|
+
import { buildVaultV1MigrateToV2, } from "../../actions/vaultV1/migrateToV2.js";
|
|
10
|
+
import { buildVaultV1Redeem, } from "../../actions/vaultV1/redeem.js";
|
|
11
|
+
import { buildVaultV1Withdraw, } from "../../actions/vaultV1/withdraw.js";
|
|
8
12
|
import { computeVaultMaxShareAllowance, computeVaultMaxSharePrice, validateChainId, validateSlippageTolerance, } from "../../helpers/index.js";
|
|
9
13
|
import { resolveTransactionMetadata } from "../../helpers/metadata.js";
|
|
10
|
-
import {
|
|
14
|
+
import { parseUint256 } from "../../helpers/parse.js";
|
|
15
|
+
import { validateNativeVaultAsset } from "../../helpers/validate.js";
|
|
11
16
|
import { AmountAndSharesExclusiveError, ExpiredDeadlineError, NonPositiveInputError, SameVaultMigrationError, VaultAddressMismatchError, VaultAssetMismatchError, } from "../../types/index.js";
|
|
12
17
|
import { assertRegistryTargetsHaveCode } from "../requirements/assertContractCode.js";
|
|
13
|
-
import {
|
|
18
|
+
import { getParsedBundlesTokenRequirements, parseGetBundlesTokenRequirements, } from "../requirements/getBundlesTokenRequirements.js";
|
|
19
|
+
import { getParsedVaultBundlesSharesRequirements, parseVaultBundlesSharesRequirements, } from "../requirements/getVaultBundlesSharesRequirements.js";
|
|
14
20
|
import { getVaultV1InKindRedeemRequirements } from "../requirements/getVaultV1InKindRedeemRequirements.js";
|
|
15
|
-
import {
|
|
21
|
+
import { validateNativeRequirements } from "../requirements/validateNativeRequirements.js";
|
|
16
22
|
import { computeVaultV1InKindRedeemQuote } from "./inKindRedeemQuote.js";
|
|
17
23
|
import { computeVaultV1MigrateToV2Quote } from "./migrateToV2Quote.js";
|
|
18
|
-
function getMigrationAmounts(params) {
|
|
19
|
-
const assets = "assets" in params ? params.assets : undefined;
|
|
20
|
-
const shares = "shares" in params ? params.shares : undefined;
|
|
21
|
-
if ((assets == null) === (shares == null)) {
|
|
22
|
-
throw new AmountAndSharesExclusiveError();
|
|
23
|
-
}
|
|
24
|
-
const selectedAmount = assets ?? shares ?? 0n;
|
|
25
|
-
if (selectedAmount <= 0n) {
|
|
26
|
-
throw new NonPositiveInputError(assets == null ? "shares" : "assets", selectedAmount);
|
|
27
|
-
}
|
|
28
|
-
return { assets, shares };
|
|
29
|
-
}
|
|
30
24
|
/** Binds a viem client to a Vault V1 (MetaMorpho) vault's action builders. */
|
|
31
25
|
export class MorphoVaultV1 {
|
|
32
26
|
client;
|
|
@@ -39,7 +33,10 @@ export class MorphoVaultV1 {
|
|
|
39
33
|
this.chainId = chainId;
|
|
40
34
|
}
|
|
41
35
|
async getData(parameters) {
|
|
42
|
-
|
|
36
|
+
return this.getDataWithChainCheck(createChainCheck(this.client.viemClient, this.chainId), parameters);
|
|
37
|
+
}
|
|
38
|
+
async getDataWithChainCheck(chainCheck, parameters) {
|
|
39
|
+
await chainCheck();
|
|
43
40
|
return fetchAccrualVault(this.vault, this.client.viemClient, {
|
|
44
41
|
...parameters,
|
|
45
42
|
deployless: this.client.options.supportDeployless,
|
|
@@ -53,16 +50,20 @@ export class MorphoVaultV1 {
|
|
|
53
50
|
*
|
|
54
51
|
* @param roles - Registry labels to resolve and check.
|
|
55
52
|
*/
|
|
56
|
-
async assertWriteTargets(roles) {
|
|
53
|
+
async assertWriteTargets(roles, chainCheck) {
|
|
57
54
|
const targets = [];
|
|
58
55
|
for (const role of roles) {
|
|
59
56
|
const address = getChainAddress(this.chainId, role);
|
|
60
57
|
targets.push({ role, address });
|
|
61
58
|
}
|
|
62
|
-
await assertRegistryTargetsHaveCode(this.client.viemClient, this.chainId, targets);
|
|
59
|
+
await assertRegistryTargetsHaveCode(this.client.viemClient, this.chainId, targets, chainCheck);
|
|
63
60
|
}
|
|
64
61
|
/** {@inheritDoc VaultV1Actions.deposit} */
|
|
65
62
|
deposit(params) {
|
|
63
|
+
return this.buildDeposit(this.parseDeposit(params));
|
|
64
|
+
}
|
|
65
|
+
/** Owns the complete raw deposit boundary, including snapshot-derived price protection. */
|
|
66
|
+
parseDeposit(params) {
|
|
66
67
|
const suppliedNow = params.now;
|
|
67
68
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
68
69
|
const { userAddress, vaultData } = params;
|
|
@@ -76,16 +77,15 @@ export class MorphoVaultV1 {
|
|
|
76
77
|
if (deadline <= createdAt) {
|
|
77
78
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
78
79
|
}
|
|
79
|
-
const common =
|
|
80
|
+
const common = parseBundlesCommon({
|
|
80
81
|
deadline,
|
|
81
82
|
referralFeePct: params.referralFeePct,
|
|
82
83
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
83
84
|
});
|
|
84
85
|
const funding = resolveBundlesFunding(params);
|
|
85
|
-
//
|
|
86
|
-
|
|
86
|
+
// Enforce ABI and native-asset bounds at the constructor, before lazy requirements.
|
|
87
|
+
parseUint256(funding.value > 0n ? "nativeAmount" : "amount", funding.assets);
|
|
87
88
|
if (funding.value > 0n) {
|
|
88
|
-
// The native path must target the chain's registered wrapped-native asset.
|
|
89
89
|
validateNativeVaultAsset(this.chainId, vaultAsset);
|
|
90
90
|
}
|
|
91
91
|
const referralFeeAssets = getBundlesReferralFeeAssets(funding.assets, common.referralFeePct);
|
|
@@ -96,35 +96,69 @@ export class MorphoVaultV1 {
|
|
|
96
96
|
slippageTolerance: params.slippageTolerance ?? DEFAULT_SLIPPAGE_TOLERANCE,
|
|
97
97
|
});
|
|
98
98
|
const spender = getChainAddress(this.chainId, "bundles.vaultBundlesV1");
|
|
99
|
+
if (maxSharePrice <= 0n) {
|
|
100
|
+
throw new NonPositiveInputError("maxSharePrice", maxSharePrice);
|
|
101
|
+
}
|
|
102
|
+
// A computed price must still fit the contract's ABI.
|
|
103
|
+
parseUint256("maxSharePrice", maxSharePrice);
|
|
104
|
+
const parsed = {
|
|
105
|
+
vault: { chainId: this.chainId, address: this.vault, asset: vaultAsset },
|
|
106
|
+
userAddress,
|
|
107
|
+
funding,
|
|
108
|
+
maxSharePrice,
|
|
109
|
+
common,
|
|
110
|
+
metadata,
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
suppliedNow,
|
|
114
|
+
parsed,
|
|
115
|
+
spender,
|
|
116
|
+
vaultAsset,
|
|
117
|
+
userAddress,
|
|
118
|
+
funding,
|
|
119
|
+
deadline,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
buildDeposit(input) {
|
|
123
|
+
const { parsed, spender, vaultAsset, userAddress, funding, deadline } = input;
|
|
99
124
|
let pendingRequirements;
|
|
100
125
|
return Object.freeze({
|
|
101
126
|
getRequirements: async (requirementOptions) => {
|
|
102
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
127
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
103
128
|
if (deadline <= now) {
|
|
104
129
|
throw new ExpiredDeadlineError(deadline, now);
|
|
105
130
|
}
|
|
131
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
132
|
+
if (funding.value > 0n) {
|
|
133
|
+
// Native funding skips the token resolver's chain validation.
|
|
134
|
+
await validateNativeRequirements(this.client.viemClient, {
|
|
135
|
+
chainId: this.chainId,
|
|
136
|
+
chainCheck,
|
|
137
|
+
assertWriteTargets: () => this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck),
|
|
138
|
+
});
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
142
|
+
const tokenInput = parseGetBundlesTokenRequirements(this.client.viemClient, {
|
|
143
|
+
token: vaultAsset,
|
|
144
|
+
spender,
|
|
145
|
+
amount: funding.assets,
|
|
146
|
+
owner: userAddress,
|
|
147
|
+
chainId: this.chainId,
|
|
148
|
+
deadline,
|
|
149
|
+
supportSignature: this.client.options.supportSignature,
|
|
150
|
+
supportDeployless: this.client.options.supportDeployless,
|
|
151
|
+
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
152
|
+
now,
|
|
153
|
+
});
|
|
154
|
+
// Check each non-no-op invocation before sharing an in-flight state read.
|
|
155
|
+
if (tokenInput.amount > 0n) {
|
|
156
|
+
await chainCheck();
|
|
157
|
+
}
|
|
106
158
|
if (pendingRequirements != null) {
|
|
107
159
|
return await pendingRequirements;
|
|
108
160
|
}
|
|
109
|
-
|
|
110
|
-
// allowance/nonce reads.
|
|
111
|
-
const pending = (async () => {
|
|
112
|
-
await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
|
|
113
|
-
return funding.value > 0n
|
|
114
|
-
? []
|
|
115
|
-
: getBundlesTokenRequirements(this.client.viemClient, {
|
|
116
|
-
token: vaultAsset,
|
|
117
|
-
spender,
|
|
118
|
-
amount: funding.assets,
|
|
119
|
-
owner: userAddress,
|
|
120
|
-
chainId: this.chainId,
|
|
121
|
-
deadline,
|
|
122
|
-
supportSignature: this.client.options.supportSignature,
|
|
123
|
-
supportDeployless: this.client.options.supportDeployless,
|
|
124
|
-
useSimplePermit: requirementOptions?.useSimplePermit,
|
|
125
|
-
now,
|
|
126
|
-
});
|
|
127
|
-
})();
|
|
161
|
+
const pending = getParsedBundlesTokenRequirements({ viemClient: this.client.viemClient, chainCheck }, tokenInput);
|
|
128
162
|
pendingRequirements = pending;
|
|
129
163
|
try {
|
|
130
164
|
return await pending;
|
|
@@ -139,29 +173,14 @@ export class MorphoVaultV1 {
|
|
|
139
173
|
buildTx: (signatures) => {
|
|
140
174
|
// The pure deposit action rejects a token signature supplied alongside native funding.
|
|
141
175
|
const requirementSignature = selectBundlesTokenRequirementSignature(signatures, { spender, amount: funding.assets, deadline });
|
|
142
|
-
return
|
|
143
|
-
vault: {
|
|
144
|
-
chainId: this.chainId,
|
|
145
|
-
address: this.vault,
|
|
146
|
-
asset: vaultAsset,
|
|
147
|
-
},
|
|
148
|
-
args: {
|
|
149
|
-
...(funding.value > 0n
|
|
150
|
-
? { nativeAmount: funding.assets }
|
|
151
|
-
: { amount: funding.assets }),
|
|
152
|
-
maxSharePrice,
|
|
153
|
-
userAddress,
|
|
154
|
-
requirementSignature,
|
|
155
|
-
referralFeePct: common.referralFeePct,
|
|
156
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
157
|
-
deadline,
|
|
158
|
-
},
|
|
159
|
-
metadata,
|
|
160
|
-
});
|
|
176
|
+
return buildVaultV1Deposit(parsed, { requirementSignature });
|
|
161
177
|
},
|
|
162
178
|
});
|
|
163
179
|
}
|
|
164
180
|
withdraw(params) {
|
|
181
|
+
return this.buildWithdraw(this.parseWithdraw(params));
|
|
182
|
+
}
|
|
183
|
+
parseWithdraw(params) {
|
|
165
184
|
const suppliedNow = params.now;
|
|
166
185
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
167
186
|
const { amount, userAddress, vaultData } = params;
|
|
@@ -173,13 +192,13 @@ export class MorphoVaultV1 {
|
|
|
173
192
|
throw new NonPositiveInputError("amount", amount);
|
|
174
193
|
}
|
|
175
194
|
// Reject values outside the ABI range before resolving any requirements.
|
|
176
|
-
|
|
195
|
+
const parsedAmount = parseUint256("amount", amount);
|
|
177
196
|
const createdAt = suppliedNow ?? Time.timestamp();
|
|
178
197
|
const deadline = params.deadline ?? createdAt + Time.s.from.h(2n);
|
|
179
198
|
if (deadline <= createdAt) {
|
|
180
199
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
181
200
|
}
|
|
182
|
-
const common =
|
|
201
|
+
const common = parseBundlesCommon({
|
|
183
202
|
deadline,
|
|
184
203
|
referralFeePct: params.referralFeePct,
|
|
185
204
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
@@ -194,15 +213,34 @@ export class MorphoVaultV1 {
|
|
|
194
213
|
assets: amount,
|
|
195
214
|
slippageTolerance,
|
|
196
215
|
});
|
|
216
|
+
const parsed = {
|
|
217
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
218
|
+
args: { amount: parsedAmount, userAddress, ...common },
|
|
219
|
+
common,
|
|
220
|
+
metadata,
|
|
221
|
+
};
|
|
222
|
+
return {
|
|
223
|
+
suppliedNow,
|
|
224
|
+
parsed,
|
|
225
|
+
spender,
|
|
226
|
+
vaultData,
|
|
227
|
+
userAddress,
|
|
228
|
+
requiredShareAllowance,
|
|
229
|
+
deadline,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
buildWithdraw(input) {
|
|
233
|
+
const { parsed, spender, vaultData, userAddress, requiredShareAllowance, deadline, } = input;
|
|
197
234
|
return Object.freeze({
|
|
198
235
|
getRequirements: async () => {
|
|
199
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
236
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
200
237
|
if (deadline <= now) {
|
|
201
238
|
throw new ExpiredDeadlineError(deadline, now);
|
|
202
239
|
}
|
|
203
|
-
|
|
240
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
241
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
204
242
|
// Re-read the live share allowance on every call instead of caching the resolved requirements.
|
|
205
|
-
return
|
|
243
|
+
return getParsedVaultBundlesSharesRequirements({ viemClient: this.client.viemClient, chainCheck }, parseVaultBundlesSharesRequirements(this.client.viemClient, {
|
|
206
244
|
vaultData,
|
|
207
245
|
version: "vaultV1",
|
|
208
246
|
owner: userAddress,
|
|
@@ -211,7 +249,7 @@ export class MorphoVaultV1 {
|
|
|
211
249
|
deadline,
|
|
212
250
|
supportSignature: this.client.options.supportSignature,
|
|
213
251
|
now,
|
|
214
|
-
});
|
|
252
|
+
}));
|
|
215
253
|
},
|
|
216
254
|
buildTx: (signatures) => {
|
|
217
255
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -219,23 +257,15 @@ export class MorphoVaultV1 {
|
|
|
219
257
|
amount: requiredShareAllowance,
|
|
220
258
|
deadline,
|
|
221
259
|
});
|
|
222
|
-
return
|
|
223
|
-
vault: { chainId: this.chainId, address: this.vault },
|
|
224
|
-
args: {
|
|
225
|
-
amount,
|
|
226
|
-
userAddress,
|
|
227
|
-
requirementSignature: permit,
|
|
228
|
-
referralFeePct: common.referralFeePct,
|
|
229
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
230
|
-
deadline,
|
|
231
|
-
},
|
|
232
|
-
metadata,
|
|
233
|
-
});
|
|
260
|
+
return buildVaultV1Withdraw(parsed, { requirementSignature: permit });
|
|
234
261
|
},
|
|
235
262
|
});
|
|
236
263
|
}
|
|
237
264
|
/** {@inheritDoc VaultV1Actions.redeem} */
|
|
238
265
|
redeem(params) {
|
|
266
|
+
return this.buildRedeem(this.parseRedeem(params));
|
|
267
|
+
}
|
|
268
|
+
parseRedeem(params) {
|
|
239
269
|
const suppliedNow = params.now;
|
|
240
270
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
241
271
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
@@ -248,21 +278,32 @@ export class MorphoVaultV1 {
|
|
|
248
278
|
if (deadline <= createdAt) {
|
|
249
279
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
250
280
|
}
|
|
251
|
-
const common =
|
|
281
|
+
const common = parseBundlesCommon({
|
|
252
282
|
deadline,
|
|
253
283
|
referralFeePct: params.referralFeePct,
|
|
254
284
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
255
285
|
});
|
|
256
286
|
const spender = getChainAddress(this.chainId, "bundles.vaultBundlesV1");
|
|
287
|
+
const parsed = {
|
|
288
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
289
|
+
args: { shares: parseUint256("shares", shares), userAddress, ...common },
|
|
290
|
+
common,
|
|
291
|
+
metadata,
|
|
292
|
+
};
|
|
293
|
+
return { suppliedNow, parsed, spender, shares, userAddress, deadline };
|
|
294
|
+
}
|
|
295
|
+
buildRedeem(input) {
|
|
296
|
+
const { parsed, spender, shares, userAddress, deadline } = input;
|
|
257
297
|
return Object.freeze({
|
|
258
298
|
getRequirements: async () => {
|
|
259
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
299
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
260
300
|
if (deadline <= now) {
|
|
261
301
|
throw new ExpiredDeadlineError(deadline, now);
|
|
262
302
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
303
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
304
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
305
|
+
return getParsedVaultBundlesSharesRequirements({ viemClient: this.client.viemClient, chainCheck }, parseVaultBundlesSharesRequirements(this.client.viemClient, {
|
|
306
|
+
vaultData: await this.getDataWithChainCheck(chainCheck),
|
|
266
307
|
version: "vaultV1",
|
|
267
308
|
owner: userAddress,
|
|
268
309
|
chainId: this.chainId,
|
|
@@ -270,7 +311,7 @@ export class MorphoVaultV1 {
|
|
|
270
311
|
deadline,
|
|
271
312
|
supportSignature: this.client.options.supportSignature,
|
|
272
313
|
now,
|
|
273
|
-
});
|
|
314
|
+
}));
|
|
274
315
|
},
|
|
275
316
|
buildTx: (signatures) => {
|
|
276
317
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -278,26 +319,16 @@ export class MorphoVaultV1 {
|
|
|
278
319
|
amount: shares,
|
|
279
320
|
deadline,
|
|
280
321
|
});
|
|
281
|
-
return
|
|
282
|
-
vault: { chainId: this.chainId, address: this.vault },
|
|
283
|
-
args: {
|
|
284
|
-
shares,
|
|
285
|
-
userAddress,
|
|
286
|
-
requirementSignature: permit,
|
|
287
|
-
referralFeePct: common.referralFeePct,
|
|
288
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
289
|
-
deadline,
|
|
290
|
-
},
|
|
291
|
-
metadata,
|
|
292
|
-
});
|
|
322
|
+
return buildVaultV1Redeem(parsed, { requirementSignature: permit });
|
|
293
323
|
},
|
|
294
324
|
});
|
|
295
325
|
}
|
|
296
326
|
/** {@inheritDoc VaultV1Actions.inKindRedeem} */
|
|
297
327
|
inKindRedeem(params) {
|
|
298
|
-
|
|
328
|
+
return this.buildInKindRedeem(this.parseInKindRedeem(params));
|
|
329
|
+
}
|
|
330
|
+
parseInKindRedeem({ now: suppliedNow, amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, }) {
|
|
299
331
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
300
|
-
const { amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, } = params;
|
|
301
332
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
302
333
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
303
334
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
@@ -310,6 +341,29 @@ export class MorphoVaultV1 {
|
|
|
310
341
|
now: suppliedNow ?? Time.timestamp(),
|
|
311
342
|
chainId: this.chainId,
|
|
312
343
|
});
|
|
344
|
+
const parsed = {
|
|
345
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
346
|
+
args: {
|
|
347
|
+
amount,
|
|
348
|
+
marketParamsList: marketParamsListSnapshot,
|
|
349
|
+
userAddress,
|
|
350
|
+
deadline,
|
|
351
|
+
},
|
|
352
|
+
metadata,
|
|
353
|
+
};
|
|
354
|
+
return {
|
|
355
|
+
suppliedNow,
|
|
356
|
+
parsed,
|
|
357
|
+
deadline,
|
|
358
|
+
userAddress,
|
|
359
|
+
vaultData,
|
|
360
|
+
vaultExitBundlesV1,
|
|
361
|
+
amount,
|
|
362
|
+
requiredShareAllowance,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
buildInKindRedeem(input) {
|
|
366
|
+
const { parsed, deadline, userAddress, vaultData, vaultExitBundlesV1, amount, requiredShareAllowance, } = input;
|
|
313
367
|
return {
|
|
314
368
|
getRequirements: () => getVaultV1InKindRedeemRequirements(this.client.viemClient, {
|
|
315
369
|
vaultData,
|
|
@@ -320,7 +374,7 @@ export class MorphoVaultV1 {
|
|
|
320
374
|
requiredShareAllowance,
|
|
321
375
|
supportSignature: this.client.options.supportSignature,
|
|
322
376
|
amount,
|
|
323
|
-
now: suppliedNow,
|
|
377
|
+
now: input.suppliedNow,
|
|
324
378
|
}),
|
|
325
379
|
buildTx: (signatures) => {
|
|
326
380
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -328,22 +382,17 @@ export class MorphoVaultV1 {
|
|
|
328
382
|
amount: requiredShareAllowance,
|
|
329
383
|
deadline,
|
|
330
384
|
});
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
args: {
|
|
334
|
-
amount,
|
|
335
|
-
marketParamsList: marketParamsListSnapshot,
|
|
336
|
-
userAddress,
|
|
337
|
-
deadline,
|
|
338
|
-
requirementSignature: permit,
|
|
339
|
-
},
|
|
340
|
-
metadata,
|
|
385
|
+
return buildVaultV1InKindRedeem(parsed, {
|
|
386
|
+
requirementSignature: permit,
|
|
341
387
|
});
|
|
342
388
|
},
|
|
343
389
|
};
|
|
344
390
|
}
|
|
345
391
|
/** {@inheritDoc VaultV1Actions.migrateToV2} */
|
|
346
392
|
migrateToV2(params) {
|
|
393
|
+
return this.buildMigrateToV2(this.parseMigrateToV2(params));
|
|
394
|
+
}
|
|
395
|
+
parseMigrateToV2(params) {
|
|
347
396
|
const suppliedNow = params.now;
|
|
348
397
|
const metadata = resolveTransactionMetadata(this.client.options.metadata, suppliedNow);
|
|
349
398
|
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
@@ -356,7 +405,15 @@ export class MorphoVaultV1 {
|
|
|
356
405
|
if (isAddressEqual(this.vault, params.targetVault.address)) {
|
|
357
406
|
throw new SameVaultMigrationError(this.vault);
|
|
358
407
|
}
|
|
359
|
-
const
|
|
408
|
+
const assets = "assets" in params ? params.assets : undefined;
|
|
409
|
+
const shares = "shares" in params ? params.shares : undefined;
|
|
410
|
+
if ((assets == null) === (shares == null)) {
|
|
411
|
+
throw new AmountAndSharesExclusiveError();
|
|
412
|
+
}
|
|
413
|
+
const selected = assets ?? shares ?? 0n;
|
|
414
|
+
if (selected <= 0n) {
|
|
415
|
+
throw new NonPositiveInputError(assets == null ? "shares" : "assets", selected);
|
|
416
|
+
}
|
|
360
417
|
const slippageTolerance = params.slippageTolerance ?? DEFAULT_SLIPPAGE_TOLERANCE;
|
|
361
418
|
validateSlippageTolerance(slippageTolerance);
|
|
362
419
|
const createdAt = suppliedNow ?? Time.timestamp();
|
|
@@ -364,18 +421,20 @@ export class MorphoVaultV1 {
|
|
|
364
421
|
if (deadline <= createdAt) {
|
|
365
422
|
throw new ExpiredDeadlineError(deadline, createdAt);
|
|
366
423
|
}
|
|
367
|
-
const common =
|
|
424
|
+
const common = parseBundlesCommon({
|
|
368
425
|
deadline,
|
|
369
426
|
referralFeePct: params.referralFeePct,
|
|
370
427
|
referralFeeRecipient: params.referralFeeRecipient,
|
|
371
428
|
});
|
|
429
|
+
// Only the destination receives a deposit; the source vault is an exit.
|
|
430
|
+
// V1 redeem accrues market interest and performance fees before converting shares.
|
|
372
431
|
const { maxSharePriceVaultV2, requiredShareAllowance } = computeVaultV1MigrateToV2Quote({
|
|
373
432
|
sourceVault: params.sourceVault,
|
|
374
433
|
targetVault: params.targetVault,
|
|
375
|
-
...(assets == null ? { shares:
|
|
434
|
+
...(assets == null ? { shares: selected } : { assets: selected }),
|
|
376
435
|
referralFeePct: common.referralFeePct,
|
|
377
|
-
deadline,
|
|
378
436
|
slippageTolerance,
|
|
437
|
+
deadline,
|
|
379
438
|
now: createdAt,
|
|
380
439
|
});
|
|
381
440
|
const spender = getChainAddress(this.chainId, "bundles.vaultBundlesV1");
|
|
@@ -394,15 +453,41 @@ export class MorphoVaultV1 {
|
|
|
394
453
|
extensions: [...domain.extensions],
|
|
395
454
|
}),
|
|
396
455
|
});
|
|
456
|
+
if (maxSharePriceVaultV2 <= 0n) {
|
|
457
|
+
throw new NonPositiveInputError("maxSharePriceVaultV2", maxSharePriceVaultV2);
|
|
458
|
+
}
|
|
459
|
+
// Preserve destination positivity before the source and destination ABI bounds.
|
|
460
|
+
parseUint256(assets == null ? "shares" : "assets", selected);
|
|
461
|
+
parseUint256("maxSharePriceVaultV2", maxSharePriceVaultV2);
|
|
462
|
+
const parsed = {
|
|
463
|
+
vault: { chainId: this.chainId, address: this.vault, asset: sourceAsset },
|
|
464
|
+
args: { targetVault: targetAddress, targetAsset, userAddress, ...common },
|
|
465
|
+
bounds: { assets, shares, maxSharePriceVaultV2 },
|
|
466
|
+
common,
|
|
467
|
+
metadata,
|
|
468
|
+
};
|
|
469
|
+
return {
|
|
470
|
+
suppliedNow,
|
|
471
|
+
parsed,
|
|
472
|
+
deadline,
|
|
473
|
+
sourceToken,
|
|
474
|
+
userAddress,
|
|
475
|
+
requiredShareAllowance,
|
|
476
|
+
spender,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
buildMigrateToV2(input) {
|
|
480
|
+
const { parsed, deadline, sourceToken, userAddress, requiredShareAllowance, spender, } = input;
|
|
397
481
|
return Object.freeze({
|
|
398
482
|
getRequirements: async () => {
|
|
399
|
-
const now = suppliedNow ?? Time.timestamp();
|
|
483
|
+
const now = input.suppliedNow ?? Time.timestamp();
|
|
400
484
|
if (deadline <= now) {
|
|
401
485
|
throw new ExpiredDeadlineError(deadline, now);
|
|
402
486
|
}
|
|
403
|
-
|
|
487
|
+
const chainCheck = createChainCheck(this.client.viemClient, this.chainId);
|
|
488
|
+
await this.assertWriteTargets(["bundles.vaultBundlesV1"], chainCheck);
|
|
404
489
|
// Re-read the live share allowance on every call instead of caching the resolved requirements.
|
|
405
|
-
return
|
|
490
|
+
return getParsedVaultBundlesSharesRequirements({ viemClient: this.client.viemClient, chainCheck }, parseVaultBundlesSharesRequirements(this.client.viemClient, {
|
|
406
491
|
vaultData: sourceToken,
|
|
407
492
|
version: "vaultV1",
|
|
408
493
|
owner: userAddress,
|
|
@@ -411,7 +496,7 @@ export class MorphoVaultV1 {
|
|
|
411
496
|
deadline,
|
|
412
497
|
supportSignature: this.client.options.supportSignature,
|
|
413
498
|
now,
|
|
414
|
-
});
|
|
499
|
+
}));
|
|
415
500
|
},
|
|
416
501
|
buildTx: (signatures) => {
|
|
417
502
|
const permit = selectBundlesSharesPermitSignature(signatures, {
|
|
@@ -419,24 +504,8 @@ export class MorphoVaultV1 {
|
|
|
419
504
|
amount: requiredShareAllowance,
|
|
420
505
|
deadline,
|
|
421
506
|
});
|
|
422
|
-
return
|
|
423
|
-
|
|
424
|
-
chainId: this.chainId,
|
|
425
|
-
address: this.vault,
|
|
426
|
-
asset: sourceAsset,
|
|
427
|
-
},
|
|
428
|
-
args: {
|
|
429
|
-
targetVault: targetAddress,
|
|
430
|
-
targetAsset,
|
|
431
|
-
...(assets == null ? { shares: shares ?? 0n } : { assets }),
|
|
432
|
-
maxSharePriceVaultV2,
|
|
433
|
-
userAddress,
|
|
434
|
-
requirementSignature: permit,
|
|
435
|
-
referralFeePct: common.referralFeePct,
|
|
436
|
-
referralFeeRecipient: common.referralFeeRecipient,
|
|
437
|
-
deadline,
|
|
438
|
-
},
|
|
439
|
-
metadata,
|
|
507
|
+
return buildVaultV1MigrateToV2(parsed, {
|
|
508
|
+
requirementSignature: permit,
|
|
440
509
|
});
|
|
441
510
|
},
|
|
442
511
|
});
|
|
@@ -22,4 +22,8 @@ export declare function computeVaultV2ForceWithdrawQuote({ exitAssets, vaultData
|
|
|
22
22
|
adapter: `0x${string}`;
|
|
23
23
|
minSharePriceE27: bigint;
|
|
24
24
|
requiredShareAllowance: bigint;
|
|
25
|
+
referral: {
|
|
26
|
+
readonly referralFeePct: bigint;
|
|
27
|
+
readonly referralFeeRecipient: Address;
|
|
28
|
+
};
|
|
25
29
|
};
|
|
@@ -2,7 +2,8 @@ import { DEFAULT_SLIPPAGE_TOLERANCE, MathLib, } from "@morpho-org/blue-sdk";
|
|
|
2
2
|
import { _try, Time } from "@morpho-org/morpho-ts";
|
|
3
3
|
import { maxUint256 } from "viem";
|
|
4
4
|
import { computeMinForceWithdrawSharePrice, computeVaultV2ForceWithdrawFeeSharesMinted, computeVaultV2ForceWithdrawMinSharesBurnt, computeVaultV2ForceWithdrawPlan, computeVaultV2ForceWithdrawSharesBurnt, MAX_SLIPPAGE_TOLERANCE, resolveVaultV2ForceWithdrawEligibility, validateSlippageTolerance, } from "../../helpers/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parseReferralFee } from "../../helpers/parse.js";
|
|
6
|
+
import { validateDeadline, validateUint256Field, } from "../../helpers/validate.js";
|
|
6
7
|
import { AdapterNotPartOfVaultError, ExpiredDeadlineError, InputExceedsMaxError, NonPositiveInputError, VaultV2ForceWithdrawCoverageError, VaultV2ForceWithdrawFeeSharesExceedBurnError, VaultV2ForceWithdrawSharePriceBelowFloorError, VaultV2ForceWithdrawZeroSharePriceError, VaultV2ForceWithdrawZeroWithdrawalError, VaultV2SingleAdapterRequiredError, VaultV2UndecodableLiquidityDataError, VaultV2UnsupportedExitAdapterError, VaultV2UnsupportedLiquidityAdapterError, } from "../../types/index.js";
|
|
7
8
|
const VAULT_V2_FEE_PROJECTION_HORIZON = Time.s.from.y(1n);
|
|
8
9
|
/** Resolves the supported adapter or reports the existing eligibility error. @internal */
|
|
@@ -62,9 +63,7 @@ export function computeVaultV2ForceWithdrawQuote({ exitAssets, vaultData, userAd
|
|
|
62
63
|
}
|
|
63
64
|
validateUint256Field("exitAssets", exitAssets);
|
|
64
65
|
validateSlippageTolerance(slippageTolerance);
|
|
65
|
-
|
|
66
|
-
// again on the encode path so a direct action caller gets the same guarantees.
|
|
67
|
-
validateReferralFee({ referralFeePct, referralFeeRecipient });
|
|
66
|
+
const referral = parseReferralFee({ referralFeePct, referralFeeRecipient });
|
|
68
67
|
if (minSharePriceE27Override != null) {
|
|
69
68
|
// An unbounded override reopens the exact hole this path closes: the contract reads
|
|
70
69
|
// `minSharePriceE27 == 0` as "no bound".
|
|
@@ -182,5 +181,11 @@ export function computeVaultV2ForceWithdrawQuote({ exitAssets, vaultData, userAd
|
|
|
182
181
|
// shares minted by the first withdrawal and enough headroom for the configured tolerance.
|
|
183
182
|
const allowanceSharePriceE27 = MathLib.max(MathLib.min(MathLib.mulDivDown(minSharePriceE27, MathLib.WAD - slippageTolerance, MathLib.WAD), minSharePriceE27 - 1n), 1n);
|
|
184
183
|
const requiredShareAllowance = MathLib.min(MathLib.max(MathLib.mulDivUp(exitAssets, MathLib.RAY, allowanceSharePriceE27), MathLib.mulDivUp(exitAssets, MathLib.RAY, minSharePriceE27) + 1n) + feeSharesProjected, maxUint256);
|
|
185
|
-
return {
|
|
184
|
+
return {
|
|
185
|
+
deadline,
|
|
186
|
+
adapter,
|
|
187
|
+
minSharePriceE27,
|
|
188
|
+
requiredShareAllowance,
|
|
189
|
+
referral,
|
|
190
|
+
};
|
|
186
191
|
}
|
|
@@ -16,13 +16,13 @@ export declare function computeVaultV2InKindRedeemQuote({ amount, marketParamsLi
|
|
|
16
16
|
}): {
|
|
17
17
|
deadline: bigint;
|
|
18
18
|
adapter: `0x${string}`;
|
|
19
|
-
marketParamsListSnapshot: {
|
|
19
|
+
marketParamsListSnapshot: readonly Readonly<{
|
|
20
20
|
loanToken: `0x${string}`;
|
|
21
21
|
collateralToken: `0x${string}`;
|
|
22
22
|
oracle: `0x${string}`;
|
|
23
23
|
irm: `0x${string}`;
|
|
24
24
|
lltv: bigint;
|
|
25
|
-
}[];
|
|
25
|
+
}>[];
|
|
26
26
|
requiredShareAllowance: bigint;
|
|
27
27
|
peak: bigint;
|
|
28
28
|
};
|
|
@@ -12,13 +12,7 @@ export function computeVaultV2InKindRedeemQuote({ amount, marketParamsList, vaul
|
|
|
12
12
|
if (amount <= 0n) {
|
|
13
13
|
throw new NonPositiveInputError("amount", amount);
|
|
14
14
|
}
|
|
15
|
-
const marketParamsListSnapshot = marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => ({
|
|
16
|
-
loanToken,
|
|
17
|
-
collateralToken,
|
|
18
|
-
oracle,
|
|
19
|
-
irm,
|
|
20
|
-
lltv,
|
|
21
|
-
}));
|
|
15
|
+
const marketParamsListSnapshot = Object.freeze(marketParamsList.map(({ loanToken, collateralToken, oracle, irm, lltv }) => Object.freeze({ loanToken, collateralToken, oracle, irm, lltv })));
|
|
22
16
|
const marketIdListSnapshot = marketParamsListSnapshot.map((marketParams) => MarketUtils.getMarketId(marketParams));
|
|
23
17
|
const deadline = deadlineOverride ?? now + Time.s.from.h(2n);
|
|
24
18
|
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|