@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION-v5-to-v6.md +199 -34
- package/README.md +23 -15
- package/lib/cjs/abis.d.ts +3 -2829
- package/lib/cjs/abis.js +1 -1938
- package/lib/cjs/actions/blue/borrow.d.ts +3 -2
- package/lib/cjs/actions/blue/borrow.js +3 -2
- package/lib/cjs/actions/blue/common.js +6 -35
- package/lib/cjs/actions/blue/refinance.d.ts +2 -2
- package/lib/cjs/actions/blue/refinance.js +2 -2
- package/lib/cjs/actions/blue/repay.d.ts +1 -1
- package/lib/cjs/actions/blue/repay.js +1 -1
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/cjs/actions/blue/supply.d.ts +2 -2
- package/lib/cjs/actions/blue/supply.js +4 -9
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
- package/lib/cjs/actions/blue/withdraw.js +3 -3
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
- package/lib/cjs/actions/bundles/common.d.ts +38 -4
- package/lib/cjs/actions/bundles/common.js +91 -35
- package/lib/cjs/actions/index.d.ts +0 -1
- package/lib/cjs/actions/index.js +0 -1
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
- package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/blue/index.js +0 -1
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/encode/index.js +0 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/cjs/actions/requirements/index.d.ts +0 -1
- package/lib/cjs/actions/requirements/index.js +0 -1
- package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV1/deposit.js +1 -2
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/cjs/actions/vaultV2/deposit.js +1 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/cjs/augment.d.ts +0 -1
- package/lib/cjs/augment.js +0 -1
- package/lib/cjs/blue/abis.d.ts +1 -1
- package/lib/cjs/blue/abis.js +1 -5
- package/lib/cjs/blue/entities.d.ts +2 -2
- package/lib/cjs/blue/entities.js +1 -2
- package/lib/cjs/blue/errors.d.ts +1 -1
- package/lib/cjs/blue/errors.js +2 -1
- package/lib/cjs/blue/fetch.d.ts +1 -1
- package/lib/cjs/blue/fetch.js +1 -2
- package/lib/cjs/blue/types.d.ts +2 -4
- package/lib/cjs/blue/utils.d.ts +1 -3
- package/lib/cjs/blue/utils.js +1 -3
- package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
- package/lib/cjs/client/morphoViemExtension.js +1 -1
- package/lib/cjs/constants.d.ts +3 -37
- package/lib/cjs/constants.js +1 -39
- package/lib/cjs/entities/blue/blue.d.ts +38 -264
- package/lib/cjs/entities/blue/blue.js +2 -203
- package/lib/cjs/entities/index.d.ts +3 -60
- package/lib/cjs/entities/index.js +1 -20
- package/lib/cjs/entities/midnight/midnight.js +20 -24
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
- package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +1 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
- package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
- package/lib/cjs/errors.d.ts +2 -46
- package/lib/cjs/errors.js +2 -46
- package/lib/cjs/fetch.d.ts +1 -15
- package/lib/cjs/fetch.js +1 -16
- package/lib/cjs/helpers/constant.d.ts +0 -2
- package/lib/cjs/helpers/constant.js +0 -2
- package/lib/cjs/helpers/index.d.ts +4 -3
- package/lib/cjs/helpers/index.js +10 -9
- package/lib/cjs/helpers/metadata.d.ts +3 -5
- package/lib/cjs/helpers/metadata.js +4 -6
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/cjs/helpers/slippage.d.ts +34 -90
- package/lib/cjs/helpers/slippage.js +52 -137
- package/lib/cjs/helpers/utilization.d.ts +12 -10
- package/lib/cjs/helpers/utilization.js +27 -12
- package/lib/cjs/helpers/validate.d.ts +66 -32
- package/lib/cjs/helpers/validate.js +84 -57
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
- package/lib/cjs/types/action.d.ts +102 -68
- package/lib/cjs/types/action.js +11 -4
- package/lib/cjs/types/error.d.ts +332 -385
- package/lib/cjs/types/error.js +369 -412
- package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
- package/lib/cjs/types.d.ts +2 -18
- package/lib/cjs/utils.d.ts +8 -35
- package/lib/cjs/utils.js +11 -36
- package/lib/esm/abis.d.ts +3 -2829
- package/lib/esm/abis.js +3 -1935
- package/lib/esm/actions/blue/borrow.d.ts +3 -2
- package/lib/esm/actions/blue/borrow.js +3 -2
- package/lib/esm/actions/blue/common.js +8 -37
- package/lib/esm/actions/blue/refinance.d.ts +2 -2
- package/lib/esm/actions/blue/refinance.js +2 -2
- package/lib/esm/actions/blue/repay.d.ts +1 -1
- package/lib/esm/actions/blue/repay.js +1 -1
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
- package/lib/esm/actions/blue/supply.d.ts +2 -2
- package/lib/esm/actions/blue/supply.js +6 -11
- package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/supplyCollateral.js +2 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
- package/lib/esm/actions/blue/withdraw.d.ts +3 -3
- package/lib/esm/actions/blue/withdraw.js +3 -3
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
- package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
- package/lib/esm/actions/bundles/common.d.ts +38 -4
- package/lib/esm/actions/bundles/common.js +91 -36
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
- package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
- package/lib/esm/actions/requirements/blue/index.js +0 -1
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
- package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
- package/lib/esm/actions/requirements/encode/index.js +0 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
- package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
- package/lib/esm/actions/requirements/index.d.ts +0 -1
- package/lib/esm/actions/requirements/index.js +0 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV1/deposit.js +1 -2
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
- package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
- package/lib/esm/actions/vaultV2/deposit.js +1 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
- package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
- package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
- package/lib/esm/augment.d.ts +0 -1
- package/lib/esm/augment.js +0 -1
- package/lib/esm/blue/abis.d.ts +1 -1
- package/lib/esm/blue/abis.js +1 -1
- package/lib/esm/blue/entities.d.ts +2 -2
- package/lib/esm/blue/entities.js +1 -1
- package/lib/esm/blue/errors.d.ts +1 -1
- package/lib/esm/blue/errors.js +1 -1
- package/lib/esm/blue/fetch.d.ts +1 -1
- package/lib/esm/blue/fetch.js +1 -1
- package/lib/esm/blue/types.d.ts +2 -4
- package/lib/esm/blue/utils.d.ts +1 -3
- package/lib/esm/blue/utils.js +1 -3
- package/lib/esm/client/morphoViemExtension.d.ts +1 -1
- package/lib/esm/client/morphoViemExtension.js +1 -1
- package/lib/esm/constants.d.ts +3 -37
- package/lib/esm/constants.js +3 -37
- package/lib/esm/entities/blue/blue.d.ts +38 -264
- package/lib/esm/entities/blue/blue.js +5 -206
- package/lib/esm/entities/index.d.ts +3 -60
- package/lib/esm/entities/index.js +1 -16
- package/lib/esm/entities/midnight/midnight.js +20 -24
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
- package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
- package/lib/esm/entities/requirements/index.d.ts +1 -0
- package/lib/esm/entities/requirements/index.js +1 -0
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
- package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
- package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
- package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
- package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
- package/lib/esm/errors.d.ts +2 -46
- package/lib/esm/errors.js +2 -46
- package/lib/esm/fetch.d.ts +1 -15
- package/lib/esm/fetch.js +1 -15
- package/lib/esm/helpers/constant.d.ts +0 -2
- package/lib/esm/helpers/constant.js +0 -2
- package/lib/esm/helpers/index.d.ts +4 -3
- package/lib/esm/helpers/index.js +4 -3
- package/lib/esm/helpers/metadata.d.ts +3 -5
- package/lib/esm/helpers/metadata.js +4 -6
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
- package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
- package/lib/esm/helpers/slippage.d.ts +34 -90
- package/lib/esm/helpers/slippage.js +52 -134
- package/lib/esm/helpers/utilization.d.ts +12 -10
- package/lib/esm/helpers/utilization.js +26 -11
- package/lib/esm/helpers/validate.d.ts +66 -32
- package/lib/esm/helpers/validate.js +83 -57
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +1 -3
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
- package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
- package/lib/esm/types/action.d.ts +102 -68
- package/lib/esm/types/action.js +12 -5
- package/lib/esm/types/error.d.ts +332 -385
- package/lib/esm/types/error.js +355 -392
- package/lib/esm/types/sharedLiquidity.d.ts +1 -117
- package/lib/esm/types.d.ts +2 -18
- package/lib/esm/utils.d.ts +8 -35
- package/lib/esm/utils.js +7 -34
- package/package.json +7 -15
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
- package/lib/cjs/actions/signatures/index.d.ts +0 -3
- package/lib/cjs/actions/signatures/index.js +0 -19
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
- package/lib/cjs/bundler/actions.d.ts +0 -797
- package/lib/cjs/bundler/actions.js +0 -1371
- package/lib/cjs/bundler/index.d.ts +0 -2
- package/lib/cjs/bundler/index.js +0 -18
- package/lib/cjs/bundler/types.d.ts +0 -235
- package/lib/cjs/bundler/types.js +0 -2
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
- package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
- package/lib/esm/actions/signatures/index.d.ts +0 -3
- package/lib/esm/actions/signatures/index.js +0 -3
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
- package/lib/esm/bundler/actions.d.ts +0 -797
- package/lib/esm/bundler/actions.js +0 -1368
- package/lib/esm/bundler/index.d.ts +0 -2
- package/lib/esm/bundler/index.js +0 -2
- package/lib/esm/bundler/types.d.ts +0 -235
- package/lib/esm/bundler/types.js +0 -1
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
- package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
- package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
- /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
- /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
|
@@ -13,6 +13,9 @@ const validate_js_1 = require("../../helpers/validate.js");
|
|
|
13
13
|
const index_js_3 = require("../../types/index.js");
|
|
14
14
|
const getVaultBundlesSharesRequirements_js_1 = require("../requirements/getVaultBundlesSharesRequirements.js");
|
|
15
15
|
const index_js_4 = require("../requirements/index.js");
|
|
16
|
+
// Maximum accepted deadline horizon; the on-chain management fee is capped at 5%/yr so the
|
|
17
|
+
// accrual model stays well-defined inside it.
|
|
18
|
+
const VAULT_V2_FEE_PROJECTION_HORIZON = morpho_ts_1.Time.s.from.y(1n);
|
|
16
19
|
class MorphoVaultV2 {
|
|
17
20
|
client;
|
|
18
21
|
vault;
|
|
@@ -30,7 +33,6 @@ class MorphoVaultV2 {
|
|
|
30
33
|
}
|
|
31
34
|
return (0, blue_sdk_viem_1.fetchAccrualVaultV2)(this.vault, this.client.viemClient, {
|
|
32
35
|
...parameters,
|
|
33
|
-
chainId: this.chainId,
|
|
34
36
|
deployless: this.client.options.supportDeployless,
|
|
35
37
|
});
|
|
36
38
|
}
|
|
@@ -289,21 +291,24 @@ class MorphoVaultV2 {
|
|
|
289
291
|
const marketIdListSnapshot = marketParamsListSnapshot.map((marketParams) => blue_sdk_1.MarketUtils.getMarketId(marketParams));
|
|
290
292
|
const now = morpho_ts_1.Time.timestamp();
|
|
291
293
|
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
294
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
295
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
296
|
+
(0, validate_js_1.validateDeadline)(deadline);
|
|
292
297
|
if (deadline <= now)
|
|
293
298
|
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
294
299
|
if (vaultData.accrualAdapters.length !== 1) {
|
|
295
|
-
throw new index_js_3.
|
|
300
|
+
throw new index_js_3.VaultV2SingleAdapterRequiredError(this.vault, vaultData.accrualAdapters.length);
|
|
296
301
|
}
|
|
297
302
|
const soleAdapter = vaultData.accrualAdapters[0];
|
|
298
303
|
if (soleAdapter == null) {
|
|
299
|
-
throw new index_js_3.
|
|
304
|
+
throw new index_js_3.VaultV2SingleAdapterRequiredError(this.vault, 0);
|
|
300
305
|
}
|
|
301
306
|
const adapter = adapterOverride ?? soleAdapter.address;
|
|
302
307
|
if (!(0, viem_1.isAddressEqual)(adapter, soleAdapter.address)) {
|
|
303
308
|
throw new index_js_3.AdapterNotPartOfVaultError(this.vault, adapter);
|
|
304
309
|
}
|
|
305
310
|
if (!(soleAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2)) {
|
|
306
|
-
throw new index_js_3.
|
|
311
|
+
throw new index_js_3.VaultV2UnsupportedExitAdapterError(adapter);
|
|
307
312
|
}
|
|
308
313
|
const penalty = vaultData.forceDeallocatePenalties[soleAdapter.address] ?? 0n;
|
|
309
314
|
const idleAssets = blue_sdk_1.MathLib.min(vaultData.assetBalance, amount);
|
|
@@ -318,7 +323,9 @@ class MorphoVaultV2 {
|
|
|
318
323
|
if (assetsToDeallocate > 0n && marketParamsListSnapshot.length === 0) {
|
|
319
324
|
throw new index_js_3.EmptyMarketParamsListError();
|
|
320
325
|
}
|
|
321
|
-
const assetsByMarket = new Map(soleAdapter.markets
|
|
326
|
+
const assetsByMarket = new Map(soleAdapter.markets
|
|
327
|
+
.filter((market) => (soleAdapter.supplyShares[market.id] ?? 0n) !== 0n)
|
|
328
|
+
.map((market) => [
|
|
322
329
|
market.id,
|
|
323
330
|
market
|
|
324
331
|
.accrueInterest(now)
|
|
@@ -361,8 +368,7 @@ class MorphoVaultV2 {
|
|
|
361
368
|
remaining -= chunk;
|
|
362
369
|
}
|
|
363
370
|
const vaultExitBundlesV1 = (0, morpho_ts_1.getChainAddress)(this.chainId, "bundles.vaultExitBundlesV1");
|
|
364
|
-
const
|
|
365
|
-
const blue = addresses.blue ?? addresses.morpho;
|
|
371
|
+
const blue = (0, morpho_ts_1.getChainAddress)(this.chainId, "blue");
|
|
366
372
|
return {
|
|
367
373
|
getRequirements: async () => {
|
|
368
374
|
const requirementsTimestamp = morpho_ts_1.Time.timestamp();
|
|
@@ -405,9 +411,14 @@ class MorphoVaultV2 {
|
|
|
405
411
|
required: peak,
|
|
406
412
|
});
|
|
407
413
|
}
|
|
408
|
-
|
|
414
|
+
// In-kind withdrawals carry no onchain share cap, so the allowance itself is the cap. A
|
|
415
|
+
// larger leftover allowance would let a share-price loss burn past `requiredShareAllowance`.
|
|
416
|
+
if (allowance === requiredShareAllowance)
|
|
409
417
|
return [];
|
|
410
|
-
|
|
418
|
+
// A lowering permit can be skipped after its nonce is consumed, so oversized allowances
|
|
419
|
+
// must be reset with an onchain approval.
|
|
420
|
+
if (allowance < requiredShareAllowance &&
|
|
421
|
+
this.client.options.supportSignature) {
|
|
411
422
|
return [
|
|
412
423
|
(0, index_js_1.encodeVaultSharesPermit)({
|
|
413
424
|
vault: vaultData,
|
|
@@ -431,8 +442,10 @@ class MorphoVaultV2 {
|
|
|
431
442
|
];
|
|
432
443
|
},
|
|
433
444
|
buildTx: (signatures) => {
|
|
434
|
-
const
|
|
435
|
-
|
|
445
|
+
const permit = (0, common_js_1.selectBundlesSharesPermitSignature)(signatures, {
|
|
446
|
+
spender: vaultExitBundlesV1,
|
|
447
|
+
amount: requiredShareAllowance,
|
|
448
|
+
deadline,
|
|
436
449
|
});
|
|
437
450
|
return (0, index_js_1.vaultV2InKindRedeem)({
|
|
438
451
|
vault: { chainId: this.chainId, address: this.vault },
|
|
@@ -449,21 +462,234 @@ class MorphoVaultV2 {
|
|
|
449
462
|
},
|
|
450
463
|
};
|
|
451
464
|
}
|
|
452
|
-
|
|
465
|
+
/** {@inheritDoc VaultV2Actions.forceWithdraw} */
|
|
466
|
+
forceWithdraw({ exitAssets, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, minSharePriceE27: minSharePriceE27Override, referralFeePct = 0n, referralFeeRecipient, }) {
|
|
453
467
|
(0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
|
|
468
|
+
if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
|
|
469
|
+
throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
|
|
470
|
+
}
|
|
471
|
+
if (exitAssets <= 0n)
|
|
472
|
+
throw new index_js_3.NonPositiveInputError("exitAssets", exitAssets);
|
|
473
|
+
(0, validate_js_1.validateUint256Field)("exitAssets", exitAssets);
|
|
474
|
+
(0, index_js_2.validateSlippageTolerance)(slippageTolerance);
|
|
475
|
+
// Called for its throws only: the raw pair is forwarded to the action, which normalizes it
|
|
476
|
+
// again on the encode path so a direct action caller gets the same guarantees.
|
|
477
|
+
(0, validate_js_1.validateReferralFee)({ referralFeePct, referralFeeRecipient });
|
|
478
|
+
if (minSharePriceE27Override != null) {
|
|
479
|
+
// An unbounded override reopens the exact hole this path closes: the contract reads
|
|
480
|
+
// `minSharePriceE27 == 0` as "no bound".
|
|
481
|
+
if (minSharePriceE27Override <= 0n) {
|
|
482
|
+
throw new index_js_3.NonPositiveInputError("minSharePriceE27", minSharePriceE27Override);
|
|
483
|
+
}
|
|
484
|
+
// And an override the uint256 slot cannot hold must fail here rather than after
|
|
485
|
+
// `getRequirements()` has already asked for an approval or a permit signature.
|
|
486
|
+
(0, validate_js_1.validateUint256Field)("minSharePriceE27", minSharePriceE27Override);
|
|
487
|
+
}
|
|
488
|
+
const now = morpho_ts_1.Time.timestamp();
|
|
489
|
+
const deadline = deadlineOverride ?? now + morpho_ts_1.Time.s.from.h(2n);
|
|
490
|
+
// Reject the same bounds the action enforces, before `getRequirements()` can walk the caller
|
|
491
|
+
// through a vault-share approval or an EIP-712 permit for a deadline `buildTx()` cannot encode.
|
|
492
|
+
(0, validate_js_1.validateDeadline)(deadline);
|
|
493
|
+
if (deadline <= now)
|
|
494
|
+
throw new index_js_3.ExpiredDeadlineError(deadline, now);
|
|
495
|
+
const maxDeadline = now + VAULT_V2_FEE_PROJECTION_HORIZON;
|
|
496
|
+
if (deadline > maxDeadline) {
|
|
497
|
+
throw new index_js_3.InputExceedsMaxError({
|
|
498
|
+
field: "deadline",
|
|
499
|
+
value: deadline,
|
|
500
|
+
max: maxDeadline,
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
const eligibility = (0, index_js_2.resolveVaultV2ForceWithdrawEligibility)(vaultData, adapterOverride);
|
|
504
|
+
switch (eligibility.type) {
|
|
505
|
+
case "eligible":
|
|
506
|
+
break;
|
|
507
|
+
case "adapterCount":
|
|
508
|
+
throw new index_js_3.VaultV2SingleAdapterRequiredError(this.vault, eligibility.adapters);
|
|
509
|
+
case "adapterMismatch":
|
|
510
|
+
throw new index_js_3.AdapterNotPartOfVaultError(this.vault, eligibility.adapter);
|
|
511
|
+
case "unsupportedAdapter":
|
|
512
|
+
throw new index_js_3.VaultV2UnsupportedExitAdapterError(eligibility.adapter);
|
|
513
|
+
case "unsupportedLiquidityAdapter":
|
|
514
|
+
throw new index_js_3.VaultV2UnsupportedLiquidityAdapterError({
|
|
515
|
+
vault: this.vault,
|
|
516
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
517
|
+
adapter: eligibility.adapter,
|
|
518
|
+
});
|
|
519
|
+
case "undecodableLiquidityData":
|
|
520
|
+
throw new index_js_3.VaultV2UndecodableLiquidityDataError({
|
|
521
|
+
vault: this.vault,
|
|
522
|
+
liquidityAdapter: eligibility.liquidityAdapter,
|
|
523
|
+
liquidityData: eligibility.liquidityData,
|
|
524
|
+
cause: eligibility.cause,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
const { adapter: accrualAdapter, liquidityMarketId } = eligibility;
|
|
528
|
+
const adapter = accrualAdapter.address;
|
|
529
|
+
const plan = (0, index_js_2.computeVaultV2ForceWithdrawPlan)({
|
|
530
|
+
vaultData,
|
|
531
|
+
adapter: accrualAdapter,
|
|
532
|
+
liquidityMarketId,
|
|
533
|
+
exitAssets,
|
|
534
|
+
timestamp: now,
|
|
535
|
+
});
|
|
536
|
+
if (plan.withdrawnAssets <= 0n) {
|
|
537
|
+
throw new index_js_3.VaultV2ForceWithdrawZeroWithdrawalError({
|
|
538
|
+
vault: this.vault,
|
|
539
|
+
exitAssets,
|
|
540
|
+
penalty: plan.penalty,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
// The contract's force-deallocation loop is unbounded: under-coverage panics on-chain.
|
|
544
|
+
if (plan.coveredAssets < plan.assetsToDeallocate) {
|
|
545
|
+
throw new index_js_3.VaultV2ForceWithdrawCoverageError({
|
|
546
|
+
required: plan.assetsToDeallocate,
|
|
547
|
+
covered: plan.coveredAssets,
|
|
548
|
+
maxExitAssets: plan.maxExitAssets,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
const projectionTimestamp = deadline;
|
|
552
|
+
// VaultExitBundlesV1 measures shares as `sharesBefore - balanceAfter`; its first withdrawal
|
|
553
|
+
// accrues the vault before burning. Use the `now` accrual for the floor and the projected
|
|
554
|
+
// deadline accrual for the fee-mint guard.
|
|
555
|
+
const { vault: nowVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(now, vaultData.lastUpdate));
|
|
556
|
+
const { vault: projectedVaultData } = vaultData.accrueInterest(blue_sdk_1.MathLib.max(projectionTimestamp, vaultData.lastUpdate));
|
|
557
|
+
const sharesBurntNow = (0, index_js_2.computeVaultV2ForceWithdrawSharesBurnt)({
|
|
558
|
+
vaultData: nowVaultData,
|
|
559
|
+
deadlineVaultData: nowVaultData,
|
|
560
|
+
plan,
|
|
561
|
+
});
|
|
562
|
+
const feeSharesNow = (0, index_js_2.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
563
|
+
vaultData,
|
|
564
|
+
owner: userAddress,
|
|
565
|
+
timestamp: now,
|
|
566
|
+
});
|
|
567
|
+
const feeSharesProjected = (0, index_js_2.computeVaultV2ForceWithdrawFeeSharesMinted)({
|
|
568
|
+
vaultData,
|
|
569
|
+
owner: userAddress,
|
|
570
|
+
timestamp: projectionTimestamp,
|
|
571
|
+
});
|
|
572
|
+
const minSharesBurntProjected = (0, index_js_2.computeVaultV2ForceWithdrawMinSharesBurnt)({
|
|
573
|
+
vaultData: projectedVaultData,
|
|
574
|
+
plan,
|
|
575
|
+
});
|
|
576
|
+
// When fee shares are minted, the projected pair bounds every execution time in the window.
|
|
577
|
+
if (feeSharesProjected > 0n &&
|
|
578
|
+
feeSharesProjected >= minSharesBurntProjected) {
|
|
579
|
+
throw new index_js_3.VaultV2ForceWithdrawFeeSharesExceedBurnError({
|
|
580
|
+
vault: this.vault,
|
|
581
|
+
userAddress,
|
|
582
|
+
sharesBurnt: minSharesBurntProjected,
|
|
583
|
+
feeShares: feeSharesProjected,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
// sharesBurntNow ≥ minSharesBurntNow ≥ minSharesBurntProjected > feeSharesProjected ≥ feeSharesNow
|
|
587
|
+
const netSharesBurntNow = sharesBurntNow - feeSharesNow;
|
|
588
|
+
if (minSharePriceE27Override != null) {
|
|
589
|
+
// The maximum-slippage threshold only bounds the override; unlike the transaction floor it
|
|
590
|
+
// may round to zero, in which case every positive override is acceptable.
|
|
591
|
+
const minAllowedSharePriceE27 = (0, morpho_ts_1._try)(() => (0, index_js_2.computeMinForceWithdrawSharePrice)({
|
|
592
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
593
|
+
sharesBurnt: netSharesBurntNow,
|
|
594
|
+
slippageTolerance: index_js_2.MAX_SLIPPAGE_TOLERANCE,
|
|
595
|
+
}), index_js_3.VaultV2ForceWithdrawZeroSharePriceError) ?? 1n;
|
|
596
|
+
if (minSharePriceE27Override < minAllowedSharePriceE27) {
|
|
597
|
+
throw new index_js_3.VaultV2ForceWithdrawSharePriceBelowFloorError({
|
|
598
|
+
minSharePriceE27: minSharePriceE27Override,
|
|
599
|
+
floorE27: minAllowedSharePriceE27,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const minSharePriceE27 = minSharePriceE27Override ??
|
|
604
|
+
(0, index_js_2.computeMinForceWithdrawSharePrice)({
|
|
605
|
+
withdrawnAssets: plan.withdrawnAssets,
|
|
606
|
+
sharesBurnt: netSharesBurntNow,
|
|
607
|
+
slippageTolerance,
|
|
608
|
+
});
|
|
609
|
+
// The floor is deliberately *not* capped at `MAX_ABSOLUTE_SHARE_PRICE` (100 assets/share):
|
|
610
|
+
// lowering a lower bound weakens it, so any vault whose share price grew past that would be left
|
|
611
|
+
// with no real protection. Its two sibling `computeMin*SharePrice` helpers cap nothing either —
|
|
612
|
+
// only the `computeMax*` ones do, where capping relaxes an upper bound and is safe.
|
|
613
|
+
(0, validate_js_1.validateUint256Field)("minSharePriceE27", minSharePriceE27);
|
|
614
|
+
// VaultExitBundlesV1's burn bound includes fee shares minted by the first withdrawal. Add the
|
|
615
|
+
// projected fee shares to the price-floor ceiling so the approval covers that mint.
|
|
616
|
+
// Saturated at `maxUint256` as an ABI-slot guard for an otherwise valid extreme share burn.
|
|
617
|
+
const requiredShareAllowance = blue_sdk_1.MathLib.min(blue_sdk_1.MathLib.mulDivUp(exitAssets, blue_sdk_1.MathLib.RAY, minSharePriceE27) +
|
|
618
|
+
feeSharesProjected, viem_1.maxUint256);
|
|
619
|
+
const vaultExitBundlesV1 = (0, morpho_ts_1.getChainAddress)(this.chainId, "bundles.vaultExitBundlesV1");
|
|
454
620
|
return {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
621
|
+
getRequirements: async () => {
|
|
622
|
+
const requirementsTimestamp = morpho_ts_1.Time.timestamp();
|
|
623
|
+
if (deadline <= requirementsTimestamp) {
|
|
624
|
+
throw new index_js_3.ExpiredDeadlineError(deadline, requirementsTimestamp);
|
|
625
|
+
}
|
|
626
|
+
// Vault gates are intentionally left to the final transaction: the receive-assets gate may
|
|
627
|
+
// inspect VaultExitBundlesV1's transient `initiator`, and a send-shares gate is arbitrary
|
|
628
|
+
// external code re-evaluated after each intermediate penalty burn, so neither is
|
|
629
|
+
// execution-equivalent from a standalone read. Unlike in-kind redemption, this exit never
|
|
630
|
+
// supplies into Morpho Blue, so no Blue token-balance check is needed.
|
|
631
|
+
const [allowance, nonce] = await (0, actions_1.multicall)(this.client.viemClient, {
|
|
632
|
+
allowFailure: false,
|
|
633
|
+
contracts: [
|
|
634
|
+
{
|
|
635
|
+
address: this.vault,
|
|
636
|
+
abi: viem_1.erc20Abi,
|
|
637
|
+
functionName: "allowance",
|
|
638
|
+
args: [userAddress, vaultExitBundlesV1],
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
address: this.vault,
|
|
642
|
+
abi: blue_sdk_viem_1.erc2612Abi,
|
|
643
|
+
functionName: "nonces",
|
|
644
|
+
args: [userAddress],
|
|
645
|
+
},
|
|
646
|
+
],
|
|
647
|
+
});
|
|
648
|
+
if (allowance >= requiredShareAllowance)
|
|
649
|
+
return [];
|
|
650
|
+
if (this.client.options.supportSignature) {
|
|
651
|
+
const requirement = (0, index_js_1.encodeVaultSharesPermit)({
|
|
652
|
+
vault: vaultData,
|
|
653
|
+
version: "vaultV2",
|
|
654
|
+
spender: vaultExitBundlesV1,
|
|
655
|
+
owner: userAddress,
|
|
656
|
+
chainId: this.chainId,
|
|
657
|
+
nonce,
|
|
658
|
+
amount: requiredShareAllowance,
|
|
659
|
+
deadline,
|
|
660
|
+
});
|
|
661
|
+
return [requirement];
|
|
662
|
+
}
|
|
663
|
+
return [
|
|
664
|
+
(0, index_js_1.encodeErc20Approval)({
|
|
665
|
+
token: this.vault,
|
|
666
|
+
spender: vaultExitBundlesV1,
|
|
667
|
+
amount: requiredShareAllowance,
|
|
668
|
+
chainId: this.chainId,
|
|
669
|
+
}),
|
|
670
|
+
];
|
|
671
|
+
},
|
|
672
|
+
buildTx: (signatures) => {
|
|
673
|
+
const permit = (0, common_js_1.selectBundlesSharesPermitSignature)(signatures, {
|
|
674
|
+
spender: vaultExitBundlesV1,
|
|
675
|
+
amount: requiredShareAllowance,
|
|
676
|
+
deadline,
|
|
677
|
+
});
|
|
678
|
+
return (0, index_js_1.vaultV2ForceWithdraw)({
|
|
679
|
+
vault: { chainId: this.chainId, address: this.vault },
|
|
680
|
+
args: {
|
|
681
|
+
adapter,
|
|
682
|
+
exitAssets,
|
|
683
|
+
minSharePriceE27,
|
|
684
|
+
userAddress,
|
|
685
|
+
deadline,
|
|
686
|
+
referralFeePct,
|
|
687
|
+
referralFeeRecipient,
|
|
688
|
+
requirementSignature: permit,
|
|
462
689
|
},
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
}),
|
|
690
|
+
metadata: this.client.options.metadata,
|
|
691
|
+
});
|
|
692
|
+
},
|
|
467
693
|
};
|
|
468
694
|
}
|
|
469
695
|
forceRedeem({ deallocations, redeem, userAddress, }) {
|
|
@@ -363,7 +363,11 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
|
|
|
363
363
|
* utilization defaults to 90% and is configurable through
|
|
364
364
|
* `options.maxWithdrawalUtilization`. Vaults whose configured penalty exceeds
|
|
365
365
|
* `options.maxPenalty` are ignored. By default, only zero-penalty vaults are
|
|
366
|
-
* considered.
|
|
366
|
+
* considered. Targets with no remaining supply or allocator capacity are skipped before
|
|
367
|
+
* projecting source interest. The adapter's minimum share minting requirement, supply-share
|
|
368
|
+
* limits, and target absolute or zero relative caps are checked against a one-asset deposit.
|
|
369
|
+
* Shared cap IDs that a source withdrawal can reduce remain eligible, as do deposits whose
|
|
370
|
+
* allocation does not increase after rounding.
|
|
367
371
|
*
|
|
368
372
|
* Shared-cap discovery is conservative. Operation planning searches at most
|
|
369
373
|
* 1,024 base units above its targeted amount for the nearest executable fit.
|
|
@@ -374,6 +378,7 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
|
|
|
374
378
|
* @param marketId - Target Blue market id.
|
|
375
379
|
* @param options - Optional discovery controls and operation to support.
|
|
376
380
|
* @returns Flat action-ready reallocations and their post-simulation state.
|
|
381
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
377
382
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
378
383
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
379
384
|
* @throws {NonPositiveInputError} when the operation amount is not positive and planning is enabled.
|
|
@@ -430,6 +435,7 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
|
|
|
430
435
|
* @param marketId - Target Blue market id.
|
|
431
436
|
* @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
|
|
432
437
|
* @returns Reallocatable market and idle assets, or `0n` when none are available; rounding-only shared-cap fits may be conservatively omitted.
|
|
438
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
433
439
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
434
440
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
435
441
|
* @throws {UnknownReallocationMarketError} when a required market is absent.
|
|
@@ -470,6 +476,7 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
|
|
|
470
476
|
* @param utilization - Desired utilization, scaled by WAD. Defaults to 90%.
|
|
471
477
|
* @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
|
|
472
478
|
* @returns Borrowable assets while remaining at or below `utilization`; rounding-only shared-cap fits may be conservatively omitted.
|
|
479
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
473
480
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
474
481
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
475
482
|
* @throws {UnknownReallocationMarketError} when a required market is absent.
|
|
@@ -5,6 +5,7 @@ const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
|
5
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const constant_js_1 = require("../helpers/constant.js");
|
|
8
|
+
const utilization_js_1 = require("../helpers/utilization.js");
|
|
8
9
|
const index_js_1 = require("../types/index.js");
|
|
9
10
|
const MAX_SHARED_CAP_SEARCH_STEPS = 1024n;
|
|
10
11
|
/** Creates isolated transaction-scoped state for one simulation. @internal */
|
|
@@ -44,18 +45,6 @@ const getAdapterIds = (cache, adapter, market) => {
|
|
|
44
45
|
cache.set(key, ids);
|
|
45
46
|
return ids;
|
|
46
47
|
};
|
|
47
|
-
const resolveMaxWithdrawalUtilization = (value) => {
|
|
48
|
-
const utilization = value ?? constant_js_1.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION;
|
|
49
|
-
if (utilization < 0n)
|
|
50
|
-
throw new index_js_1.NegativeInputError("maxWithdrawalUtilization", utilization);
|
|
51
|
-
if (utilization > blue_sdk_1.MathLib.WAD)
|
|
52
|
-
throw new index_js_1.InputExceedsMaxError({
|
|
53
|
-
field: "maxWithdrawalUtilization",
|
|
54
|
-
value: utilization,
|
|
55
|
-
max: blue_sdk_1.MathLib.WAD,
|
|
56
|
-
});
|
|
57
|
-
return utilization;
|
|
58
|
-
};
|
|
59
48
|
const resolveMaxPenalty = (value) => {
|
|
60
49
|
const penalty = value ?? constant_js_1.DEFAULT_MAX_REALLOCATION_PENALTY;
|
|
61
50
|
if (penalty < 0n)
|
|
@@ -75,16 +64,10 @@ const cloneAccrualVault = (vault, markets) => new blue_sdk_1.AccrualVault({
|
|
|
75
64
|
pendingTimelock: { ...vault.pendingTimelock },
|
|
76
65
|
pendingGuardian: { ...vault.pendingGuardian },
|
|
77
66
|
supplyQueue: [...vault.supplyQueue],
|
|
78
|
-
publicAllocatorConfig: vault.publicAllocatorConfig == null
|
|
79
|
-
? undefined
|
|
80
|
-
: { ...vault.publicAllocatorConfig },
|
|
81
67
|
}, [...vault.allocations.values()].map(({ config, position }) => ({
|
|
82
68
|
config: {
|
|
83
69
|
...config,
|
|
84
70
|
pendingCap: { ...config.pendingCap },
|
|
85
|
-
publicAllocatorConfig: config.publicAllocatorConfig == null
|
|
86
|
-
? undefined
|
|
87
|
-
: { ...config.publicAllocatorConfig },
|
|
88
71
|
},
|
|
89
72
|
position: clonePosition(position, markets),
|
|
90
73
|
})));
|
|
@@ -107,7 +90,11 @@ const cloneAdapter = (adapter, markets) => {
|
|
|
107
90
|
if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter)
|
|
108
91
|
return new blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter({ ...base, marketParamsList: [...adapter.marketParamsList] }, adapter.positions.map((position) => clonePosition(position, markets)));
|
|
109
92
|
if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter)
|
|
110
|
-
return new blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter({
|
|
93
|
+
return new blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter({
|
|
94
|
+
...base,
|
|
95
|
+
morphoVaultV1: adapter.morphoVaultV1,
|
|
96
|
+
parentAllocation: adapter.parentAllocation,
|
|
97
|
+
}, cloneAccrualVault(adapter.accrualVaultV1, markets), adapter.shares);
|
|
111
98
|
throw new blue_sdk_1.UnsupportedVaultV2AdapterError(adapter.address);
|
|
112
99
|
};
|
|
113
100
|
const cloneVault = (vault, { markets, adapterKeysToClone, }) => {
|
|
@@ -571,7 +558,11 @@ class VaultV2BlueReallocationData {
|
|
|
571
558
|
* utilization defaults to 90% and is configurable through
|
|
572
559
|
* `options.maxWithdrawalUtilization`. Vaults whose configured penalty exceeds
|
|
573
560
|
* `options.maxPenalty` are ignored. By default, only zero-penalty vaults are
|
|
574
|
-
* considered.
|
|
561
|
+
* considered. Targets with no remaining supply or allocator capacity are skipped before
|
|
562
|
+
* projecting source interest. The adapter's minimum share minting requirement, supply-share
|
|
563
|
+
* limits, and target absolute or zero relative caps are checked against a one-asset deposit.
|
|
564
|
+
* Shared cap IDs that a source withdrawal can reduce remain eligible, as do deposits whose
|
|
565
|
+
* allocation does not increase after rounding.
|
|
575
566
|
*
|
|
576
567
|
* Shared-cap discovery is conservative. Operation planning searches at most
|
|
577
568
|
* 1,024 base units above its targeted amount for the nearest executable fit.
|
|
@@ -582,6 +573,7 @@ class VaultV2BlueReallocationData {
|
|
|
582
573
|
* @param marketId - Target Blue market id.
|
|
583
574
|
* @param options - Optional discovery controls and operation to support.
|
|
584
575
|
* @returns Flat action-ready reallocations and their post-simulation state.
|
|
576
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
585
577
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
586
578
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
587
579
|
* @throws {NonPositiveInputError} when the operation amount is not positive and planning is enabled.
|
|
@@ -625,7 +617,7 @@ class VaultV2BlueReallocationData {
|
|
|
625
617
|
computeVaultV2BlueReallocations(marketId, options = {}) {
|
|
626
618
|
if (options.enabled === false)
|
|
627
619
|
return { reallocations: [], data: this };
|
|
628
|
-
const maxWithdrawalUtilization = resolveMaxWithdrawalUtilization(options.maxWithdrawalUtilization);
|
|
620
|
+
const maxWithdrawalUtilization = (0, utilization_js_1.resolveMaxWithdrawalUtilization)(options.maxWithdrawalUtilization);
|
|
629
621
|
const maxPenalty = resolveMaxPenalty(options.maxPenalty);
|
|
630
622
|
const resolvedOptions = { ...options, maxPenalty };
|
|
631
623
|
const operation = options.operation;
|
|
@@ -722,9 +714,7 @@ class VaultV2BlueReallocationData {
|
|
|
722
714
|
: BigInt(options.timestamp);
|
|
723
715
|
let data = this;
|
|
724
716
|
let simulationContext = context;
|
|
725
|
-
data.setMarkets(
|
|
726
|
-
.filter((market) => market != null)
|
|
727
|
-
.map((market) => market.accrueInterest(timestamp)));
|
|
717
|
+
data.setMarkets([data.getMarket(marketId).accrueInterest(timestamp)]);
|
|
728
718
|
const reallocations = [];
|
|
729
719
|
const configuredVaults = Object.keys(data.vaults);
|
|
730
720
|
const vaultKeyByLower = new Map(configuredVaults.map((vault) => [vault.toLowerCase(), vault]));
|
|
@@ -759,6 +749,7 @@ class VaultV2BlueReallocationData {
|
|
|
759
749
|
activeAdaptersCache.set(vaultAddress, activeAdapters);
|
|
760
750
|
}
|
|
761
751
|
const targetSupplyHeadroom = blue_sdk_1.MathLib.zeroFloorSub(blue_sdk_1.MathLib.MAX_UINT_128, targetMarket.totalSupplyAssets);
|
|
752
|
+
const minimumSupply = targetMarket.supply(1n, 0n);
|
|
762
753
|
const rawCandidates = [];
|
|
763
754
|
// Missing nested allocator state means the snapshot is incomplete, so
|
|
764
755
|
// typed getter errors below must propagate. Only explicit zero caps or
|
|
@@ -780,17 +771,35 @@ class VaultV2BlueReallocationData {
|
|
|
780
771
|
const adapterCapAllocation = data.getAllocation(vaultAddress, adapterCapId);
|
|
781
772
|
const collateralCapAllocation = data.getAllocation(vaultAddress, collateralCapId);
|
|
782
773
|
const adapterMarketCapAllocation = data.getAllocation(vaultAddress, adapterMarketCapId);
|
|
783
|
-
|
|
774
|
+
const targetAllocations = [
|
|
784
775
|
adapterCapAllocation,
|
|
785
776
|
collateralCapAllocation,
|
|
786
777
|
adapterMarketCapAllocation,
|
|
787
|
-
]
|
|
778
|
+
];
|
|
779
|
+
if (targetAllocations.some(({ absoluteCap }) => absoluteCap === 0n))
|
|
788
780
|
continue;
|
|
789
781
|
const expectedSupplyAssets = targetMarket.toSupplyAssets(adapter.supplyShares[marketId] ?? 0n);
|
|
790
782
|
const untracked = blue_sdk_1.MathLib.zeroFloorSub(expectedSupplyAssets, adapterMarketCapAllocation.allocation);
|
|
791
783
|
const allocatorHeadroom = marketPublicAllocatorConfig.getMaxIn(adapterMarketCapAllocation.allocation + untracked);
|
|
784
|
+
const minimumAllocation = minimumSupply.market.toSupplyAssets((adapter.supplyShares[marketId] ?? 0n) + minimumSupply.shares);
|
|
785
|
+
const minimumAllocationChange = minimumAllocation - adapterMarketCapAllocation.allocation;
|
|
786
|
+
const blockedTargetIds = targetAllocations
|
|
787
|
+
.filter(({ allocation, absoluteCap, relativeCap }) => {
|
|
788
|
+
const nextAllocation = allocation + minimumAllocationChange;
|
|
789
|
+
return (nextAllocation > absoluteCap ||
|
|
790
|
+
(relativeCap === 0n && nextAllocation > 0n));
|
|
791
|
+
})
|
|
792
|
+
.map(({ id }) => id);
|
|
793
|
+
// MorphoMarketV1AdapterV2 rejects supplies that mint fewer shares than assets.
|
|
794
|
+
if (targetSupplyHeadroom === 0n ||
|
|
795
|
+
allocatorHeadroom === 0n ||
|
|
796
|
+
minimumSupply.shares < minimumSupply.assets ||
|
|
797
|
+
minimumSupply.market.totalSupplyShares > blue_sdk_1.MathLib.MAX_UINT_128 ||
|
|
798
|
+
blockedTargetIds.includes(adapterMarketCapId))
|
|
799
|
+
continue;
|
|
792
800
|
if (publicAllocatorConfig.canPullFromIdle &&
|
|
793
|
-
availableIdleAssets > 0n
|
|
801
|
+
availableIdleAssets > 0n &&
|
|
802
|
+
blockedTargetIds.length === 0) {
|
|
794
803
|
const assets = blue_sdk_1.MathLib.min(blue_sdk_1.MathLib.MAX_UINT_128, targetSupplyHeadroom, allocatorHeadroom, availableIdleAssets);
|
|
795
804
|
if (assets > 0n) {
|
|
796
805
|
rawCandidates.push({
|
|
@@ -826,8 +835,16 @@ class VaultV2BlueReallocationData {
|
|
|
826
835
|
const sourceAllocations = sourceIds.map((id) => data.getAllocation(vaultAddress, id));
|
|
827
836
|
if (sourceAllocations.some(({ allocation }) => allocation === 0n))
|
|
828
837
|
continue;
|
|
829
|
-
const
|
|
830
|
-
|
|
838
|
+
const sourceSupplyShares = sourceAdapter.supplyShares[sourceMarket.id] ?? 0n;
|
|
839
|
+
if (sourceSupplyShares === 0n)
|
|
840
|
+
continue;
|
|
841
|
+
// A withdrawal can create target headroom only for shared cap IDs.
|
|
842
|
+
if (blockedTargetIds.some((id) => !sourceIds.includes(id)))
|
|
843
|
+
continue;
|
|
844
|
+
const accruedSourceMarket = sourceMarket.accrueInterest(timestamp);
|
|
845
|
+
data.setMarkets([accruedSourceMarket]);
|
|
846
|
+
const expectedSourceSupplyAssets = accruedSourceMarket.toSupplyAssets(sourceSupplyShares);
|
|
847
|
+
const assets = blue_sdk_1.MathLib.min(blue_sdk_1.MathLib.MAX_UINT_128, targetSupplyHeadroom, allocatorHeadroom, expectedSourceSupplyAssets, accruedSourceMarket.getWithdrawToUtilization(maxWithdrawalUtilization));
|
|
831
848
|
if (assets <= 0n)
|
|
832
849
|
continue;
|
|
833
850
|
rawCandidates.push({
|
|
@@ -848,9 +865,6 @@ class VaultV2BlueReallocationData {
|
|
|
848
865
|
for (const reallocation of rawCandidates) {
|
|
849
866
|
let lower = 0n;
|
|
850
867
|
let upper = reallocation.assets;
|
|
851
|
-
// MorphoMarketV1AdapterV2 rejects supplies that mint fewer shares than assets.
|
|
852
|
-
if (targetMarket.toSupplyShares(upper, "Down") < upper)
|
|
853
|
-
continue;
|
|
854
868
|
const reallocationAdapter = data.getAdapter(reallocation.vault, reallocation.to.adapter);
|
|
855
869
|
const targetIds = getAdapterIds(adapterIdsCache, reallocationAdapter, targetMarket);
|
|
856
870
|
const sourceIds = new Set();
|
|
@@ -954,6 +968,7 @@ class VaultV2BlueReallocationData {
|
|
|
954
968
|
* @param marketId - Target Blue market id.
|
|
955
969
|
* @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
|
|
956
970
|
* @returns Reallocatable market and idle assets, or `0n` when none are available; rounding-only shared-cap fits may be conservatively omitted.
|
|
971
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
957
972
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
958
973
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
959
974
|
* @throws {UnknownReallocationMarketError} when a required market is absent.
|
|
@@ -993,7 +1008,7 @@ class VaultV2BlueReallocationData {
|
|
|
993
1008
|
.computeVaultV2BlueReallocationsAtUtilizationInPlace({
|
|
994
1009
|
context: createSimulationContext(),
|
|
995
1010
|
marketId,
|
|
996
|
-
maxWithdrawalUtilization: resolveMaxWithdrawalUtilization(options?.maxWithdrawalUtilization),
|
|
1011
|
+
maxWithdrawalUtilization: (0, utilization_js_1.resolveMaxWithdrawalUtilization)(options?.maxWithdrawalUtilization),
|
|
997
1012
|
options: { ...options, maxPenalty },
|
|
998
1013
|
})
|
|
999
1014
|
.reallocations.reduce((total, { assets }) => total + assets, 0n);
|
|
@@ -1006,6 +1021,7 @@ class VaultV2BlueReallocationData {
|
|
|
1006
1021
|
* @param utilization - Desired utilization, scaled by WAD. Defaults to 90%.
|
|
1007
1022
|
* @param options - Optional timestamp, enable flag, vault allowlist, source utilization ceiling, and maximum penalty.
|
|
1008
1023
|
* @returns Borrowable assets while remaining at or below `utilization`; rounding-only shared-cap fits may be conservatively omitted.
|
|
1024
|
+
* @throws {UnsupportedBlueMarketIrmError} when a market with positive debt uses an unsupported IRM.
|
|
1009
1025
|
* @throws {NegativeInputError} when `maxWithdrawalUtilization` or `maxPenalty` is negative.
|
|
1010
1026
|
* @throws {InputExceedsMaxError} when `maxWithdrawalUtilization` or `maxPenalty` exceeds WAD.
|
|
1011
1027
|
* @throws {UnknownReallocationMarketError} when a required market is absent.
|
|
@@ -1051,7 +1067,7 @@ class VaultV2BlueReallocationData {
|
|
|
1051
1067
|
.computeVaultV2BlueReallocationsAtUtilizationInPlace({
|
|
1052
1068
|
context: createSimulationContext(),
|
|
1053
1069
|
marketId,
|
|
1054
|
-
maxWithdrawalUtilization: resolveMaxWithdrawalUtilization(options?.maxWithdrawalUtilization),
|
|
1070
|
+
maxWithdrawalUtilization: (0, utilization_js_1.resolveMaxWithdrawalUtilization)(options?.maxWithdrawalUtilization),
|
|
1055
1071
|
options: {
|
|
1056
1072
|
...options,
|
|
1057
1073
|
timestamp,
|
package/lib/cjs/errors.d.ts
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
|
-
export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError,
|
|
2
|
-
/** @deprecated Use InvalidBlueMarketParamsError or the raw protocol subpath. */
|
|
3
|
-
InvalidMarketParamsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError,
|
|
4
|
-
/** @deprecated Use UnknownBlueDataError or the raw protocol subpath. */
|
|
5
|
-
UnknownDataError, UnknownFactory as UnknownBlueFactory,
|
|
6
|
-
/** @deprecated Use UnknownBlueFactory or the raw protocol subpath. */
|
|
7
|
-
UnknownFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError,
|
|
8
|
-
/** @deprecated Use UnknownBlueMarketParamsError or the raw protocol subpath. */
|
|
9
|
-
UnknownMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory,
|
|
10
|
-
/** @deprecated Use UnknownBlueOfFactory or the raw protocol subpath. */
|
|
11
|
-
UnknownOfFactory, UnknownTokenError as UnknownBlueTokenError,
|
|
12
|
-
/** @deprecated Use UnknownBlueTokenError or the raw protocol subpath. */
|
|
13
|
-
UnknownTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError,
|
|
14
|
-
/** @deprecated Use UnknownBlueTokenPriceError or the raw protocol subpath. */
|
|
15
|
-
UnknownTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError,
|
|
16
|
-
/** @deprecated Use UnknownBlueVaultConfigError or the raw protocol subpath. */
|
|
17
|
-
UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedPreLiquidationParamsError as UnsupportedBluePreLiquidationParamsError,
|
|
18
|
-
/** @deprecated Use UnsupportedBluePreLiquidationParamsError or the raw protocol subpath. */
|
|
19
|
-
UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError as UnsupportedBlueVaultV2AdapterError,
|
|
20
|
-
/** @deprecated Use UnsupportedBlueVaultV2AdapterError or the raw protocol subpath. */
|
|
21
|
-
UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
|
|
1
|
+
export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError, UnsupportedPreLiquidationParamsError as UnsupportedBluePreLiquidationParamsError, UnsupportedVaultV2AdapterError as UnsupportedBlueVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
|
|
22
2
|
export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
|
|
23
|
-
export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError,
|
|
24
|
-
/** @deprecated Use InvalidMidnightOfferGroupError or the raw protocol subpath. */
|
|
25
|
-
InvalidOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError,
|
|
26
|
-
/** @deprecated Use InvalidMidnightOfferParameterError or the raw protocol subpath. */
|
|
27
|
-
InvalidOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError,
|
|
28
|
-
/** @deprecated Use InvalidMidnightPositionAccrualStateError or the raw protocol subpath. */
|
|
29
|
-
InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError,
|
|
30
|
-
/** @deprecated Use InvalidMidnightPositionAccrualTimestampError or the raw protocol subpath. */
|
|
31
|
-
InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError,
|
|
32
|
-
/** @deprecated Use InvalidMidnightPositionLossFactorError or the raw protocol subpath. */
|
|
33
|
-
InvalidPositionLossFactorError, InvalidTickSpacingError as InvalidMidnightTickSpacingError,
|
|
34
|
-
/** @deprecated Use InvalidMidnightTickSpacingError or the raw protocol subpath. */
|
|
35
|
-
InvalidTickSpacingError, InvalidTreeError as InvalidMidnightTreeError,
|
|
36
|
-
/** @deprecated Use InvalidMidnightTreeError or the raw protocol subpath. */
|
|
37
|
-
InvalidTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError,
|
|
38
|
-
/** @deprecated Use InvalidMidnightTreeHeightError or the raw protocol subpath. */
|
|
39
|
-
InvalidTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError,
|
|
40
|
-
/** @deprecated Use MidnightPriceGreaterThanOneError or the raw protocol subpath. */
|
|
41
|
-
PriceGreaterThanOneError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError,
|
|
42
|
-
/** @deprecated Use MidnightSettlementFeeExceedsPriceError or the raw protocol subpath. */
|
|
43
|
-
SettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError,
|
|
44
|
-
/** @deprecated Use MidnightTickOutOfRangeError or the raw protocol subpath. */
|
|
45
|
-
TickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError,
|
|
46
|
-
/** @deprecated Use UnknownMidnightCollateralIndexError or the raw protocol subpath. */
|
|
47
|
-
UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
|
|
3
|
+
export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
|
|
48
4
|
export type { ErrorClass } from "@morpho-org/morpho-ts";
|
|
49
5
|
export { _try, DivisionByZeroError, InvalidBitLengthError, NegativeValueError, RegistryValueAlreadyRegisteredError, } from "@morpho-org/morpho-ts";
|