@morpho-org/morpho-sdk 5.8.0 → 5.9.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 +4 -0
- package/lib/cjs/abis.d.ts +543 -0
- package/lib/cjs/abis.js +738 -0
- package/lib/cjs/actions/blue/borrow.d.ts +5 -2
- package/lib/cjs/actions/blue/borrow.js +1 -1
- package/lib/cjs/actions/blue/refinance.d.ts +7 -2
- package/lib/cjs/actions/blue/refinance.js +3 -1
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +6 -2
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +2 -1
- package/lib/cjs/actions/blue/withdraw.d.ts +2 -1
- package/lib/cjs/actions/blue/withdraw.js +1 -1
- package/lib/cjs/blue/types.d.ts +3 -1
- package/lib/cjs/blue/utils.d.ts +3 -1
- package/lib/cjs/blue/utils.js +1 -0
- package/lib/cjs/bundler/actions.d.ts +2 -0
- package/lib/cjs/bundler/actions.js +2 -0
- package/lib/cjs/bundler/types.d.ts +10 -1
- package/lib/cjs/entities/blue/blue.d.ts +30 -5
- package/lib/cjs/entities/blue/blue.js +8 -2
- package/lib/cjs/entities/vaultV1/vaultV1.js +4 -12
- package/lib/cjs/entities/vaultV1ReallocationData.d.ts +18 -3
- package/lib/cjs/entities/vaultV1ReallocationData.js +11 -1
- package/lib/cjs/entities/vaultV2/vaultV2.js +6 -18
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +4 -1
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +4 -1
- package/lib/cjs/helpers/validate.d.ts +2 -0
- package/lib/cjs/helpers/validate.js +2 -0
- package/lib/cjs/types/error.d.ts +34 -6
- package/lib/cjs/types/error.js +34 -6
- package/lib/cjs/types/sharedLiquidity.d.ts +26 -3
- package/lib/cjs/types.d.ts +3 -1
- package/lib/cjs/utils.d.ts +3 -1
- package/lib/cjs/utils.js +1 -0
- package/lib/esm/abis.d.ts +543 -0
- package/lib/esm/abis.js +737 -0
- package/lib/esm/actions/blue/borrow.d.ts +5 -2
- package/lib/esm/actions/blue/borrow.js +1 -1
- package/lib/esm/actions/blue/refinance.d.ts +7 -2
- package/lib/esm/actions/blue/refinance.js +3 -1
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +6 -2
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +2 -1
- package/lib/esm/actions/blue/withdraw.d.ts +2 -1
- package/lib/esm/actions/blue/withdraw.js +1 -1
- package/lib/esm/blue/types.d.ts +3 -1
- package/lib/esm/blue/utils.d.ts +3 -1
- package/lib/esm/blue/utils.js +3 -1
- package/lib/esm/bundler/actions.d.ts +2 -0
- package/lib/esm/bundler/actions.js +2 -0
- package/lib/esm/bundler/types.d.ts +10 -1
- package/lib/esm/entities/blue/blue.d.ts +30 -5
- package/lib/esm/entities/blue/blue.js +8 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +4 -12
- package/lib/esm/entities/vaultV1ReallocationData.d.ts +18 -3
- package/lib/esm/entities/vaultV1ReallocationData.js +13 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +7 -19
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +4 -1
- package/lib/esm/helpers/computeVaultV1Reallocations.js +4 -1
- package/lib/esm/helpers/validate.d.ts +2 -0
- package/lib/esm/helpers/validate.js +2 -0
- package/lib/esm/types/error.d.ts +34 -6
- package/lib/esm/types/error.js +34 -6
- package/lib/esm/types/sharedLiquidity.d.ts +26 -3
- package/lib/esm/types.d.ts +3 -1
- package/lib/esm/utils.d.ts +3 -1
- package/lib/esm/utils.js +3 -1
- package/package.json +4 -4
|
@@ -14,7 +14,10 @@ export interface BlueBorrowParams {
|
|
|
14
14
|
receiver: Address;
|
|
15
15
|
/** Minimum borrow share price (in ray). Protects against share price manipulation. */
|
|
16
16
|
minSharePrice: bigint;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing.
|
|
19
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
|
|
20
|
+
*/
|
|
18
21
|
reallocations?: BlueReallocationPlan;
|
|
19
22
|
/**
|
|
20
23
|
* Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
|
|
@@ -43,7 +46,7 @@ export interface BlueBorrowParams {
|
|
|
43
46
|
* @param params.args.receiver - Address that receives the borrowed assets.
|
|
44
47
|
* @param params.args.minSharePrice - Minimum borrow share price (in ray). Slippage protection.
|
|
45
48
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
46
|
-
* execute before borrowing.
|
|
49
|
+
* execute before borrowing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
|
|
47
50
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
48
51
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
49
52
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -22,7 +22,7 @@ import { buildBlueReallocationActions } from "./buildReallocationActions.js";
|
|
|
22
22
|
* @param params.args.receiver - Address that receives the borrowed assets.
|
|
23
23
|
* @param params.args.minSharePrice - Minimum borrow share price (in ray). Slippage protection.
|
|
24
24
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
25
|
-
* execute before borrowing.
|
|
25
|
+
* execute before borrowing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
|
|
26
26
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
27
27
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
28
28
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -27,7 +27,10 @@ export interface BlueRefinanceParams {
|
|
|
27
27
|
minBorrowSharePrice: bigint;
|
|
28
28
|
/** Maximum repay share price on the source market (in ray); must be > 0 when a repay leg exists. */
|
|
29
29
|
maxRepaySharePrice: bigint;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Homogeneous Vault V1 or Vault V2 reallocations into the target market.
|
|
32
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
|
|
33
|
+
*/
|
|
31
34
|
targetReallocations?: BlueReallocationPlan;
|
|
32
35
|
/**
|
|
33
36
|
* Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
|
|
@@ -85,7 +88,9 @@ export interface BlueRefinanceParams {
|
|
|
85
88
|
* @param params.args.minBorrowSharePrice - Minimum borrow share price (ray) on the target.
|
|
86
89
|
* @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
|
|
87
90
|
* @param params.args.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
|
|
88
|
-
* target, run before the supply leg. V1
|
|
91
|
+
* target, run before the supply leg. Vault V1 inputs are deprecated for high-level Blue writes;
|
|
92
|
+
* use Vault V2 for new integrations. V1 fees add to `tx.value`; V2 penalties are paid in the
|
|
93
|
+
* target loan token.
|
|
89
94
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
90
95
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
91
96
|
* @param params.metadata - Optional analytics metadata appended to `tx.data`.
|
|
@@ -53,7 +53,9 @@ import { buildBlueReallocationActions } from "./buildReallocationActions.js";
|
|
|
53
53
|
* @param params.args.minBorrowSharePrice - Minimum borrow share price (ray) on the target.
|
|
54
54
|
* @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
|
|
55
55
|
* @param params.args.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
|
|
56
|
-
* target, run before the supply leg. V1
|
|
56
|
+
* target, run before the supply leg. Vault V1 inputs are deprecated for high-level Blue writes;
|
|
57
|
+
* use Vault V2 for new integrations. V1 fees add to `tx.value`; V2 penalties are paid in the
|
|
58
|
+
* target loan token.
|
|
57
59
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
58
60
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
59
61
|
* @param params.metadata - Optional analytics metadata appended to `tx.data`.
|
|
@@ -18,7 +18,10 @@ export interface BlueSupplyCollateralBorrowParams {
|
|
|
18
18
|
minSharePrice: bigint;
|
|
19
19
|
/** Optional pre-signed permit/permit2 approval for the collateral transfer. */
|
|
20
20
|
requirementSignature?: PermitRequirementSignature;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing.
|
|
23
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
|
|
24
|
+
*/
|
|
22
25
|
reallocations?: BlueReallocationPlan;
|
|
23
26
|
/**
|
|
24
27
|
* Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
|
|
@@ -59,7 +62,8 @@ export interface BlueSupplyCollateralBorrowParams {
|
|
|
59
62
|
* @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
|
|
60
63
|
* collateral supply. Requires the collateral token to be the chain's wNative.
|
|
61
64
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
62
|
-
* execute between the supply and borrow legs.
|
|
65
|
+
* execute between the supply and borrow legs. Vault V1 inputs are deprecated; use Vault V2 for
|
|
66
|
+
* new integrations.
|
|
63
67
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
64
68
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
65
69
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -36,7 +36,8 @@ import { buildBlueReallocationActions } from "./buildReallocationActions.js";
|
|
|
36
36
|
* @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
|
|
37
37
|
* collateral supply. Requires the collateral token to be the chain's wNative.
|
|
38
38
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
39
|
-
* execute between the supply and borrow legs.
|
|
39
|
+
* execute between the supply and borrow legs. Vault V1 inputs are deprecated; use Vault V2 for
|
|
40
|
+
* new integrations.
|
|
40
41
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
41
42
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
42
43
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -20,6 +20,7 @@ export interface BlueWithdrawParams {
|
|
|
20
20
|
* Homogeneous Vault V1 or Vault V2 reallocations to execute before withdrawing. V1 entries can be
|
|
21
21
|
* computed via `MorphoBlue.getVaultV1Reallocations({ operation: "withdraw", amount })` or directly
|
|
22
22
|
* via `computeVaultV1Reallocations({ operation: "withdraw", amount, ... })`.
|
|
23
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
|
|
23
24
|
*/
|
|
24
25
|
reallocations?: BlueReallocationPlan;
|
|
25
26
|
/**
|
|
@@ -59,7 +60,7 @@ export interface BlueWithdrawParams {
|
|
|
59
60
|
* @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
|
|
60
61
|
* protection.
|
|
61
62
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
62
|
-
* execute before withdrawing.
|
|
63
|
+
* execute before withdrawing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
|
|
63
64
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
64
65
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
65
66
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
@@ -32,7 +32,7 @@ import { buildBlueReallocationActions } from "./buildReallocationActions.js";
|
|
|
32
32
|
* @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
|
|
33
33
|
* protection.
|
|
34
34
|
* @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
|
|
35
|
-
* execute before withdrawing.
|
|
35
|
+
* execute before withdrawing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
|
|
36
36
|
* @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
|
|
37
37
|
* a `setAuthorizationWithSig` call is prepended to the bundle.
|
|
38
38
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
package/lib/esm/blue/types.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
|
|
2
|
-
export type { AuthorizationArgs,
|
|
2
|
+
export type { AuthorizationArgs,
|
|
3
|
+
/** @deprecated Args for the deprecated getDaiPermitTypedData; scheduled for removal in the next major. */
|
|
4
|
+
DaiPermitArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
|
|
2
2
|
export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
3
|
-
export { decodeBytes32String, getAuthorizationTypedData,
|
|
3
|
+
export { decodeBytes32String, getAuthorizationTypedData,
|
|
4
|
+
/** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
|
|
5
|
+
getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
package/lib/esm/blue/utils.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
|
|
2
|
-
export { decodeBytes32String, getAuthorizationTypedData,
|
|
2
|
+
export { decodeBytes32String, getAuthorizationTypedData,
|
|
3
|
+
/** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
|
|
4
|
+
getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
@@ -622,6 +622,8 @@ export declare namespace BundlerAction {
|
|
|
622
622
|
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
623
623
|
* @returns Encoded Bundler3 calls.
|
|
624
624
|
* @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
|
|
625
|
+
* @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use
|
|
626
|
+
* `vaultV2BluePublicAllocatorReallocate` or `vaultV2BluePublicAllocatorAllocateFromIdle`.
|
|
625
627
|
*
|
|
626
628
|
* @example
|
|
627
629
|
* ```ts
|
|
@@ -1072,6 +1072,8 @@ export var BundlerAction;
|
|
|
1072
1072
|
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
1073
1073
|
* @returns Encoded Bundler3 calls.
|
|
1074
1074
|
* @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
|
|
1075
|
+
* @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use
|
|
1076
|
+
* `vaultV2BluePublicAllocatorReallocate` or `vaultV2BluePublicAllocatorAllocateFromIdle`.
|
|
1075
1077
|
*
|
|
1076
1078
|
* @example
|
|
1077
1079
|
* ```ts
|
|
@@ -18,6 +18,9 @@ export interface Authorization {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Public allocator withdrawal input used by a `reallocateTo` Bundler3 action.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use Vault V2
|
|
23
|
+
* BluePublicAllocator actions.
|
|
21
24
|
*/
|
|
22
25
|
export interface InputReallocation {
|
|
23
26
|
/** Market to withdraw liquidity from. */
|
|
@@ -172,7 +175,13 @@ export interface ActionArgs {
|
|
|
172
175
|
receiver: Address,
|
|
173
176
|
skipRevert?: boolean
|
|
174
177
|
];
|
|
175
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* PublicAllocator reallocation to `supplyMarket` from `vault` withdrawals while paying `fee`;
|
|
180
|
+
* `skipRevert` controls Bundler3 revert handling.
|
|
181
|
+
*
|
|
182
|
+
* @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use Vault V2
|
|
183
|
+
* BluePublicAllocator actions.
|
|
184
|
+
*/
|
|
176
185
|
readonly reallocateTo: [
|
|
177
186
|
vault: Address,
|
|
178
187
|
fee: bigint,
|
|
@@ -106,6 +106,8 @@ export interface BlueActions {
|
|
|
106
106
|
* When `reallocations` is provided, its homogeneous V1 or V2 actions are
|
|
107
107
|
* prepended to move liquidity before withdrawing. V1 fees add
|
|
108
108
|
* to the transaction value; V2 penalties are paid in the loan token.
|
|
109
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
|
|
110
|
+
* reallocations for new integrations.
|
|
109
111
|
*
|
|
110
112
|
* `getRequirements` returns the loan-token approval needed for V2 penalties
|
|
111
113
|
* and `morpho.setAuthorization(generalAdapter1, true)` when GA1 is not yet
|
|
@@ -128,6 +130,7 @@ export interface BlueActions {
|
|
|
128
130
|
receiver?: Address;
|
|
129
131
|
positionData: AccrualPosition;
|
|
130
132
|
slippageTolerance?: bigint;
|
|
133
|
+
/** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
|
|
131
134
|
reallocations?: BlueReallocationPlan;
|
|
132
135
|
} & AssetsOrSharesArgs) => {
|
|
133
136
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueWithdrawAction>>;
|
|
@@ -143,6 +146,8 @@ export interface BlueActions {
|
|
|
143
146
|
* When `reallocations` is provided, its homogeneous V1 or V2 actions are
|
|
144
147
|
* prepended before borrowing. V1 fees add to the transaction
|
|
145
148
|
* value; V2 penalties are paid in the loan token.
|
|
149
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
|
|
150
|
+
* reallocations for new integrations.
|
|
146
151
|
*
|
|
147
152
|
* `getRequirements` returns the loan-token approval needed for V2 penalties
|
|
148
153
|
* and Morpho authorization for GeneralAdapter1 when needed.
|
|
@@ -164,6 +169,7 @@ export interface BlueActions {
|
|
|
164
169
|
amount: bigint;
|
|
165
170
|
positionData: AccrualPosition;
|
|
166
171
|
slippageTolerance?: bigint;
|
|
172
|
+
/** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
|
|
167
173
|
reallocations?: BlueReallocationPlan;
|
|
168
174
|
}) => {
|
|
169
175
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueBorrowAction>>;
|
|
@@ -265,6 +271,8 @@ export interface BlueActions {
|
|
|
265
271
|
* When `reallocations` is provided, its homogeneous V1 or V2 actions run
|
|
266
272
|
* between the collateral supply and `morphoBorrow`. V1 fees add
|
|
267
273
|
* to the transaction value; V2 penalties are paid in the loan token.
|
|
274
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
|
|
275
|
+
* reallocations for new integrations.
|
|
268
276
|
*
|
|
269
277
|
* `getRequirements` returns in parallel:
|
|
270
278
|
* - ERC20 approval or permit for collateral token (to GeneralAdapter1).
|
|
@@ -288,6 +296,7 @@ export interface BlueActions {
|
|
|
288
296
|
positionData: AccrualPosition;
|
|
289
297
|
borrowAmount: bigint;
|
|
290
298
|
slippageTolerance?: bigint;
|
|
299
|
+
/** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
|
|
291
300
|
reallocations?: BlueReallocationPlan;
|
|
292
301
|
} & DepositAmountArgs) => {
|
|
293
302
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralBorrowAction>>;
|
|
@@ -311,6 +320,8 @@ export interface BlueActions {
|
|
|
311
320
|
* A homogeneous V1 or V2 target reallocation plan runs first; V1 fees add
|
|
312
321
|
* to the transaction value and V2 penalties are paid
|
|
313
322
|
* in the loan token.
|
|
323
|
+
* Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
|
|
324
|
+
* reallocations for new integrations.
|
|
314
325
|
*
|
|
315
326
|
* `getRequirements` returns the loan-token approval needed for V2 penalties
|
|
316
327
|
* and Morpho authorization for GeneralAdapter1 when needed.
|
|
@@ -323,7 +334,8 @@ export interface BlueActions {
|
|
|
323
334
|
* @param params.borrowAssets - Loan assets to repay on source; exclusive with `borrowShares`.
|
|
324
335
|
* @param params.borrowShares - Borrow shares to repay on source; exclusive with `borrowAssets`.
|
|
325
336
|
* @param params.slippageTolerance - WAD slippage tolerance. Defaults to `DEFAULT_SLIPPAGE_TOLERANCE`.
|
|
326
|
-
* @param params.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
|
|
337
|
+
* @param params.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
|
|
338
|
+
* target market. Vault V1 inputs are deprecated; prefer Vault V2.
|
|
327
339
|
* @returns Object with `buildTx` and `getRequirements`.
|
|
328
340
|
* @throws {BundlerErrors.UnexpectedAction} when a V2 plan is unsupported on the chain.
|
|
329
341
|
* @throws {InputExceedsMaxError} when a V2 reallocation asset amount exceeds `uint128` or its penalty exceeds WAD.
|
|
@@ -344,6 +356,7 @@ export interface BlueActions {
|
|
|
344
356
|
borrowAssets?: bigint;
|
|
345
357
|
borrowShares?: bigint;
|
|
346
358
|
slippageTolerance?: bigint;
|
|
359
|
+
/** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
|
|
347
360
|
targetReallocations?: BlueReallocationPlan;
|
|
348
361
|
}) => {
|
|
349
362
|
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRefinanceAction>>;
|
|
@@ -369,6 +382,8 @@ export interface BlueActions {
|
|
|
369
382
|
* @param params.block - The block to fetch data at (number and timestamp).
|
|
370
383
|
* @returns A VaultV1ReallocationData instance populated with all required data.
|
|
371
384
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
385
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
386
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
372
387
|
*/
|
|
373
388
|
getVaultV1ReallocationData: (params: {
|
|
374
389
|
vaultAddresses: readonly Address[];
|
|
@@ -385,7 +400,8 @@ export interface BlueActions {
|
|
|
385
400
|
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
386
401
|
* @returns A `VaultV1ReallocationData` snapshot populated from one block.
|
|
387
402
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
388
|
-
* @deprecated
|
|
403
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
404
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
389
405
|
*/
|
|
390
406
|
getReallocationData: (params: {
|
|
391
407
|
vaultAddresses: readonly Address[];
|
|
@@ -444,6 +460,8 @@ export interface BlueActions {
|
|
|
444
460
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds the target market supply.
|
|
445
461
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
|
|
446
462
|
* @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
|
|
463
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
464
|
+
* {@link getVaultV2BlueReallocations}.
|
|
447
465
|
* @example
|
|
448
466
|
* ```ts
|
|
449
467
|
* const reallocations = market.getVaultV1Reallocations({
|
|
@@ -468,7 +486,8 @@ export interface BlueActions {
|
|
|
468
486
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
|
|
469
487
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
|
|
470
488
|
* @throws {UnknownReallocationMarketError} when the target market is absent.
|
|
471
|
-
* @deprecated
|
|
489
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
490
|
+
* {@link getVaultV2BlueReallocations}.
|
|
472
491
|
* @example
|
|
473
492
|
* ```ts
|
|
474
493
|
* const reallocations = market.getReallocations({
|
|
@@ -622,6 +641,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
622
641
|
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
623
642
|
* @returns Reallocation data ready for {@link getVaultV1Reallocations}.
|
|
624
643
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
644
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
645
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
625
646
|
* @example
|
|
626
647
|
* ```ts
|
|
627
648
|
* import { markets, vaults } from "@morpho-org/morpho-test";
|
|
@@ -655,7 +676,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
655
676
|
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
656
677
|
* @returns A `VaultV1ReallocationData` snapshot populated from one block.
|
|
657
678
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
658
|
-
* @deprecated
|
|
679
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
680
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
659
681
|
* @example
|
|
660
682
|
* ```ts
|
|
661
683
|
* const data = await market.getReallocationData({ vaultAddresses, block });
|
|
@@ -731,6 +753,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
731
753
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
|
|
732
754
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
|
|
733
755
|
* @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
|
|
756
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
757
|
+
* {@link getVaultV2BlueReallocations}.
|
|
734
758
|
* @example
|
|
735
759
|
* ```ts
|
|
736
760
|
* const reallocations = market.getVaultV1Reallocations({
|
|
@@ -755,7 +779,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
755
779
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
|
|
756
780
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
|
|
757
781
|
* @throws {UnknownReallocationMarketError} when the target market is absent.
|
|
758
|
-
* @deprecated
|
|
782
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
783
|
+
* {@link getVaultV2BlueReallocations}.
|
|
759
784
|
* @example
|
|
760
785
|
* ```ts
|
|
761
786
|
* const reallocations = market.getReallocations({
|
|
@@ -914,6 +914,8 @@ export class MorphoBlue {
|
|
|
914
914
|
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
915
915
|
* @returns Reallocation data ready for {@link getVaultV1Reallocations}.
|
|
916
916
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
917
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
918
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
917
919
|
* @example
|
|
918
920
|
* ```ts
|
|
919
921
|
* import { markets, vaults } from "@morpho-org/morpho-test";
|
|
@@ -1007,7 +1009,8 @@ export class MorphoBlue {
|
|
|
1007
1009
|
* @param params.block.timestamp - Timestamp corresponding to the fetched block.
|
|
1008
1010
|
* @returns A `VaultV1ReallocationData` snapshot populated from one block.
|
|
1009
1011
|
* @throws {ChainIdMismatchError} when the client chain does not match this market.
|
|
1010
|
-
* @deprecated
|
|
1012
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
1013
|
+
* {@link getVaultV2BlueReallocationData}.
|
|
1011
1014
|
* @example
|
|
1012
1015
|
* ```ts
|
|
1013
1016
|
* const data = await market.getReallocationData({ vaultAddresses, block });
|
|
@@ -1113,6 +1116,8 @@ export class MorphoBlue {
|
|
|
1113
1116
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
|
|
1114
1117
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
|
|
1115
1118
|
* @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
|
|
1119
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
1120
|
+
* {@link getVaultV2BlueReallocations}.
|
|
1116
1121
|
* @example
|
|
1117
1122
|
* ```ts
|
|
1118
1123
|
* const reallocations = market.getVaultV1Reallocations({
|
|
@@ -1157,7 +1162,8 @@ export class MorphoBlue {
|
|
|
1157
1162
|
* @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
|
|
1158
1163
|
* @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
|
|
1159
1164
|
* @throws {UnknownReallocationMarketError} when the target market is absent.
|
|
1160
|
-
* @deprecated
|
|
1165
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
1166
|
+
* {@link getVaultV2BlueReallocations}.
|
|
1161
1167
|
* @example
|
|
1162
1168
|
* ```ts
|
|
1163
1169
|
* const reallocations = market.getReallocations({
|
|
@@ -29,9 +29,7 @@ export class MorphoVaultV1 {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
deposit({ amount = 0n, userAddress, vaultData, slippageTolerance = DEFAULT_SLIPPAGE_TOLERANCE, nativeAmount, }) {
|
|
32
|
-
|
|
33
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
34
|
-
}
|
|
32
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
35
33
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
36
34
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
37
35
|
}
|
|
@@ -98,9 +96,7 @@ export class MorphoVaultV1 {
|
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
98
|
withdraw({ amount, userAddress }) {
|
|
101
|
-
|
|
102
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
103
|
-
}
|
|
99
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
104
100
|
return {
|
|
105
101
|
buildTx: () => vaultV1Withdraw({
|
|
106
102
|
vault: { address: this.vault },
|
|
@@ -114,9 +110,7 @@ export class MorphoVaultV1 {
|
|
|
114
110
|
};
|
|
115
111
|
}
|
|
116
112
|
redeem({ shares, userAddress }) {
|
|
117
|
-
|
|
118
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
119
|
-
}
|
|
113
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
120
114
|
return {
|
|
121
115
|
buildTx: () => vaultV1Redeem({
|
|
122
116
|
vault: { address: this.vault },
|
|
@@ -131,9 +125,7 @@ export class MorphoVaultV1 {
|
|
|
131
125
|
}
|
|
132
126
|
/** {@inheritDoc VaultV1Actions.inKindRedeem} */
|
|
133
127
|
inKindRedeem({ amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, }) {
|
|
134
|
-
|
|
135
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
136
|
-
}
|
|
128
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
137
129
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
138
130
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
139
131
|
}
|
|
@@ -3,6 +3,9 @@ import type { Address } from "viem";
|
|
|
3
3
|
import type { PublicAllocatorOptions, PublicReallocation, ReallocationComputeOptions } from "../types/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Input state required to construct {@link VaultV1ReallocationData}.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
8
|
+
* `InputVaultV2BlueReallocationData`.
|
|
6
9
|
*/
|
|
7
10
|
export interface InputVaultV1ReallocationData {
|
|
8
11
|
/** Chain id associated with the fetched state. */
|
|
@@ -19,7 +22,8 @@ export interface InputVaultV1ReallocationData {
|
|
|
19
22
|
/**
|
|
20
23
|
* Deprecated input name for Vault V1 reallocation data.
|
|
21
24
|
*
|
|
22
|
-
* @deprecated
|
|
25
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
26
|
+
* `InputVaultV2BlueReallocationData`.
|
|
23
27
|
*/
|
|
24
28
|
export type InputReallocationData = InputVaultV1ReallocationData;
|
|
25
29
|
/**
|
|
@@ -35,6 +39,9 @@ export type InputReallocationData = InputVaultV1ReallocationData;
|
|
|
35
39
|
* `markets`, `vaults`, `positions`, and `vaultMarketConfigs` as a read
|
|
36
40
|
* contract keyed by market id or address; use the getters for typed absence
|
|
37
41
|
* errors and use simulation methods to produce updated state.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
44
|
+
* `VaultV2BlueReallocationData`.
|
|
38
45
|
*/
|
|
39
46
|
export declare class VaultV1ReallocationData implements InputVaultV1ReallocationData {
|
|
40
47
|
/** Chain id associated with the fetched reallocation data. */
|
|
@@ -128,6 +135,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
|
|
|
128
135
|
* @param options - Optional allocator discovery options.
|
|
129
136
|
* @returns Computed source-market withdrawals and the post-reallocation state.
|
|
130
137
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
138
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
139
|
+
* `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
|
|
131
140
|
* @example
|
|
132
141
|
* ```ts
|
|
133
142
|
* import { createPublicClient, http } from "viem";
|
|
@@ -171,7 +180,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
|
|
|
171
180
|
* @param options - Optional allocator discovery options.
|
|
172
181
|
* @returns Computed source-market withdrawals and the post-reallocation state.
|
|
173
182
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
174
|
-
* @deprecated
|
|
183
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
184
|
+
* `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
|
|
175
185
|
*/
|
|
176
186
|
getMarketPublicReallocations(marketId: MarketId, options?: PublicAllocatorOptions): {
|
|
177
187
|
readonly withdrawals: readonly PublicReallocation[];
|
|
@@ -190,6 +200,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
|
|
|
190
200
|
* @param options - Optional allocator discovery options.
|
|
191
201
|
* @returns Total reallocatable assets in loan-token units; `0n` when none is available.
|
|
192
202
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
203
|
+
* @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
|
|
204
|
+
* `VaultV2BlueReallocationData.getPublicReallocationLiquidity`.
|
|
193
205
|
* @example
|
|
194
206
|
* ```ts
|
|
195
207
|
* import { createPublicClient, http } from "viem";
|
|
@@ -241,6 +253,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
|
|
|
241
253
|
* @param options - Optional reallocation options (supply target utilization trigger, timestamp, withdrawal caps).
|
|
242
254
|
* @returns Available liquidity to the given utilization in loan-token units; `0n` when none is available.
|
|
243
255
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
256
|
+
* @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
|
|
257
|
+
* `VaultV2BlueReallocationData.getAvailableLiquidityToUtilization`.
|
|
244
258
|
* @example
|
|
245
259
|
* ```ts
|
|
246
260
|
* import { createPublicClient, http, parseEther } from "viem";
|
|
@@ -306,6 +320,7 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
|
|
|
306
320
|
/**
|
|
307
321
|
* Deprecated class name for Vault V1 reallocation data.
|
|
308
322
|
*
|
|
309
|
-
* @deprecated
|
|
323
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
324
|
+
* `VaultV2BlueReallocationData`.
|
|
310
325
|
*/
|
|
311
326
|
export { VaultV1ReallocationData as ReallocationData };
|
|
@@ -57,6 +57,9 @@ const cloneVaultMarketConfig = (config) => new VaultMarketConfig({
|
|
|
57
57
|
* `markets`, `vaults`, `positions`, and `vaultMarketConfigs` as a read
|
|
58
58
|
* contract keyed by market id or address; use the getters for typed absence
|
|
59
59
|
* errors and use simulation methods to produce updated state.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
62
|
+
* `VaultV2BlueReallocationData`.
|
|
60
63
|
*/
|
|
61
64
|
export class VaultV1ReallocationData {
|
|
62
65
|
/** Chain id associated with the fetched reallocation data. */
|
|
@@ -212,6 +215,8 @@ export class VaultV1ReallocationData {
|
|
|
212
215
|
* @param options - Optional allocator discovery options.
|
|
213
216
|
* @returns Computed source-market withdrawals and the post-reallocation state.
|
|
214
217
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
218
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
219
|
+
* `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
|
|
215
220
|
* @example
|
|
216
221
|
* ```ts
|
|
217
222
|
* import { createPublicClient, http } from "viem";
|
|
@@ -307,7 +312,8 @@ export class VaultV1ReallocationData {
|
|
|
307
312
|
* @param options - Optional allocator discovery options.
|
|
308
313
|
* @returns Computed source-market withdrawals and the post-reallocation state.
|
|
309
314
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
310
|
-
* @deprecated
|
|
315
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
316
|
+
* `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
|
|
311
317
|
*/
|
|
312
318
|
getMarketPublicReallocations(marketId, options = {}) {
|
|
313
319
|
return this.computeVaultV1Reallocations(marketId, options);
|
|
@@ -325,6 +331,8 @@ export class VaultV1ReallocationData {
|
|
|
325
331
|
* @param options - Optional allocator discovery options.
|
|
326
332
|
* @returns Total reallocatable assets in loan-token units; `0n` when none is available.
|
|
327
333
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
334
|
+
* @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
|
|
335
|
+
* `VaultV2BlueReallocationData.getPublicReallocationLiquidity`.
|
|
328
336
|
* @example
|
|
329
337
|
* ```ts
|
|
330
338
|
* import { createPublicClient, http } from "viem";
|
|
@@ -379,6 +387,8 @@ export class VaultV1ReallocationData {
|
|
|
379
387
|
* @param options - Optional reallocation options (supply target utilization trigger, timestamp, withdrawal caps).
|
|
380
388
|
* @returns Available liquidity to the given utilization in loan-token units; `0n` when none is available.
|
|
381
389
|
* @throws {@link UnknownReallocationMarketError} when the target market is absent.
|
|
390
|
+
* @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
|
|
391
|
+
* `VaultV2BlueReallocationData.getAvailableLiquidityToUtilization`.
|
|
382
392
|
* @example
|
|
383
393
|
* ```ts
|
|
384
394
|
* import { createPublicClient, http, parseEther } from "viem";
|
|
@@ -528,6 +538,7 @@ export class VaultV1ReallocationData {
|
|
|
528
538
|
/**
|
|
529
539
|
* Deprecated class name for Vault V1 reallocation data.
|
|
530
540
|
*
|
|
531
|
-
* @deprecated
|
|
541
|
+
* @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
|
|
542
|
+
* `VaultV2BlueReallocationData`.
|
|
532
543
|
*/
|
|
533
544
|
export { VaultV1ReallocationData as ReallocationData };
|
|
@@ -4,7 +4,7 @@ import { getChainAddress, Time } from "@morpho-org/morpho-ts";
|
|
|
4
4
|
import { erc20Abi, isAddressEqual } from "viem";
|
|
5
5
|
import { multicall } from "viem/actions";
|
|
6
6
|
import { encodeErc20Approval, encodeVaultSharesPermit, getGeneralAdapterRequirements, vaultV2Deposit, vaultV2ForceRedeem, vaultV2ForceWithdraw, vaultV2InKindRedeem, vaultV2Redeem, vaultV2Withdraw, } from "../../actions/index.js";
|
|
7
|
-
import { validateSlippageTolerance } from "../../helpers/index.js";
|
|
7
|
+
import { validateChainId, validateSlippageTolerance, } from "../../helpers/index.js";
|
|
8
8
|
import { AdapterNotPartOfVaultError, ChainIdMismatchError, ChainWNativeMissingError, EmptyMarketParamsListError, ExpiredDeadlineError, InKindRedeemCoverageError, InKindRedeemRequiresSingleAdapterError, InKindRedeemZeroDeallocationError, InsufficientBlueBalanceForInKindRedeemError, NativeAmountOnNonWNativeVaultError, NegativeInputError, NonPositiveInputError, selectRequirementSignatures, UnsupportedInKindAdapterError, VaultAddressMismatchError, } from "../../types/index.js";
|
|
9
9
|
export class MorphoVaultV2 {
|
|
10
10
|
client;
|
|
@@ -28,9 +28,7 @@ export class MorphoVaultV2 {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
deposit({ amount = 0n, userAddress, vaultData, slippageTolerance = DEFAULT_SLIPPAGE_TOLERANCE, nativeAmount, }) {
|
|
31
|
-
|
|
32
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
33
|
-
}
|
|
31
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
34
32
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
35
33
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
36
34
|
}
|
|
@@ -101,9 +99,7 @@ export class MorphoVaultV2 {
|
|
|
101
99
|
};
|
|
102
100
|
}
|
|
103
101
|
withdraw({ amount, userAddress }) {
|
|
104
|
-
|
|
105
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
106
|
-
}
|
|
102
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
107
103
|
return {
|
|
108
104
|
buildTx: () => vaultV2Withdraw({
|
|
109
105
|
vault: { address: this.vault },
|
|
@@ -117,9 +113,7 @@ export class MorphoVaultV2 {
|
|
|
117
113
|
};
|
|
118
114
|
}
|
|
119
115
|
redeem({ shares, userAddress }) {
|
|
120
|
-
|
|
121
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
122
|
-
}
|
|
116
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
123
117
|
return {
|
|
124
118
|
buildTx: () => vaultV2Redeem({
|
|
125
119
|
vault: { address: this.vault },
|
|
@@ -134,9 +128,7 @@ export class MorphoVaultV2 {
|
|
|
134
128
|
}
|
|
135
129
|
/** {@inheritDoc VaultV2Actions.inKindRedeem} */
|
|
136
130
|
inKindRedeem({ amount, marketParamsList, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, }) {
|
|
137
|
-
|
|
138
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
139
|
-
}
|
|
131
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
140
132
|
if (!isAddressEqual(vaultData.address, this.vault)) {
|
|
141
133
|
throw new VaultAddressMismatchError(this.vault, vaultData.address);
|
|
142
134
|
}
|
|
@@ -313,9 +305,7 @@ export class MorphoVaultV2 {
|
|
|
313
305
|
};
|
|
314
306
|
}
|
|
315
307
|
forceWithdraw({ deallocations, withdraw, userAddress, }) {
|
|
316
|
-
|
|
317
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
318
|
-
}
|
|
308
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
319
309
|
return {
|
|
320
310
|
buildTx: () => vaultV2ForceWithdraw({
|
|
321
311
|
vault: { address: this.vault },
|
|
@@ -332,9 +322,7 @@ export class MorphoVaultV2 {
|
|
|
332
322
|
};
|
|
333
323
|
}
|
|
334
324
|
forceRedeem({ deallocations, redeem, userAddress, }) {
|
|
335
|
-
|
|
336
|
-
throw new ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
|
|
337
|
-
}
|
|
325
|
+
validateChainId(this.client.viemClient.chain?.id, this.chainId);
|
|
338
326
|
return {
|
|
339
327
|
buildTx: () => vaultV2ForceRedeem({
|
|
340
328
|
vault: { address: this.vault },
|