@morpho-org/morpho-sdk 6.0.0-next.4 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION-v5-to-v6.md +20 -14
- package/README.md +6 -4
- package/lib/cjs/actions/bundles/common.d.ts +18 -23
- package/lib/cjs/actions/bundles/common.js +36 -83
- package/lib/cjs/actions/bundles/index.d.ts +1 -1
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +6 -2
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +6 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +1 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +11 -3
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +19 -1
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -1
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +12 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +62 -17
- package/lib/cjs/actions/vaultV1/migrateToV2.js +48 -17
- package/lib/cjs/actions/vaultV1/redeem.d.ts +28 -1
- package/lib/cjs/actions/vaultV1/redeem.js +17 -1
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV1/withdraw.js +1 -1
- package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +3 -2
- package/lib/cjs/actions/vaultV2/forceWithdraw.js +3 -2
- package/lib/cjs/actions/vaultV2/redeem.d.ts +28 -1
- package/lib/cjs/actions/vaultV2/redeem.js +17 -1
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +1 -1
- package/lib/cjs/actions/vaultV2/withdraw.js +1 -1
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +29 -20
- package/lib/cjs/entities/vaultV1/vaultV1.js +50 -84
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +33 -24
- package/lib/cjs/entities/vaultV2/vaultV2.js +44 -72
- package/lib/cjs/types/action.d.ts +1 -0
- package/lib/esm/actions/bundles/common.d.ts +18 -23
- package/lib/esm/actions/bundles/common.js +34 -80
- package/lib/esm/actions/bundles/index.d.ts +1 -1
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +6 -2
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +6 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +1 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +11 -3
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -3
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -1
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +14 -2
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +62 -17
- package/lib/esm/actions/vaultV1/migrateToV2.js +48 -17
- package/lib/esm/actions/vaultV1/redeem.d.ts +28 -1
- package/lib/esm/actions/vaultV1/redeem.js +17 -1
- package/lib/esm/actions/vaultV1/withdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV1/withdraw.js +1 -1
- package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +3 -2
- package/lib/esm/actions/vaultV2/forceWithdraw.js +3 -2
- package/lib/esm/actions/vaultV2/redeem.d.ts +28 -1
- package/lib/esm/actions/vaultV2/redeem.js +17 -1
- package/lib/esm/actions/vaultV2/withdraw.d.ts +1 -1
- package/lib/esm/actions/vaultV2/withdraw.js +1 -1
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +29 -20
- package/lib/esm/entities/vaultV1/vaultV1.js +52 -86
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +33 -24
- package/lib/esm/entities/vaultV2/vaultV2.js +46 -74
- package/lib/esm/types/action.d.ts +1 -0
- package/package.json +5 -5
|
@@ -3,28 +3,65 @@ import { type Erc2612RequirementSignature, type Metadata, type Transaction, type
|
|
|
3
3
|
/** Parameters for {@link vaultV1MigrateToV2}. */
|
|
4
4
|
export interface VaultV1MigrateToV2Params {
|
|
5
5
|
readonly vault: {
|
|
6
|
+
/** Chain containing the vaults and their registered VaultBundlesV1 contract. */
|
|
6
7
|
readonly chainId: number;
|
|
8
|
+
/** Source Vault V1 address whose shares are burned. */
|
|
7
9
|
readonly address: Address;
|
|
10
|
+
/** Source vault's underlying ERC-20 asset; must equal `args.targetAsset`. */
|
|
8
11
|
readonly asset: Address;
|
|
9
12
|
};
|
|
10
13
|
readonly args: VaultV1MigrateToV2AmountArgs & {
|
|
14
|
+
/** Destination Vault V2 contract receiving the net migrated assets. */
|
|
11
15
|
readonly targetVault: Address;
|
|
16
|
+
/** Destination vault's underlying ERC-20 asset; must equal `vault.asset`. */
|
|
12
17
|
readonly targetAsset: Address;
|
|
18
|
+
/** Maximum accepted destination share price, scaled by RAY (1e27). */
|
|
13
19
|
readonly maxSharePriceVaultV2: bigint;
|
|
20
|
+
/** Share owner and transaction sender; VaultBundlesV1 mints shares to this account. */
|
|
14
21
|
readonly userAddress: Address;
|
|
22
|
+
/** Unsupported; shares are always minted to the transaction sender. */
|
|
15
23
|
readonly recipient?: never;
|
|
24
|
+
/** Unsupported; the source Vault V1 withdrawal carries no share-price bound. */
|
|
16
25
|
readonly minSharePriceVaultV1?: never;
|
|
26
|
+
/** Optional ERC-2612 vault-share permit for the migrated source shares. */
|
|
17
27
|
readonly requirementSignature?: Erc2612RequirementSignature;
|
|
28
|
+
/** Optional WAD-scaled fee in [0, 1e18), defaulting to zero. */
|
|
18
29
|
readonly referralFeePct?: bigint;
|
|
30
|
+
/** Optional fee recipient; a nonzero address is required when `referralFeePct > 0n`. */
|
|
19
31
|
readonly referralFeeRecipient?: Address;
|
|
32
|
+
/** Positive uint256 Unix timestamp in seconds after which execution reverts. */
|
|
20
33
|
readonly deadline: bigint;
|
|
21
34
|
};
|
|
35
|
+
/** Optional analytics metadata appended to the transaction calldata. */
|
|
22
36
|
readonly metadata?: Metadata;
|
|
23
37
|
}
|
|
24
38
|
/**
|
|
25
39
|
* Encodes an assets-or-shares Vault V1 to Vault V2 migration through VaultBundlesV1.
|
|
26
40
|
*
|
|
27
|
-
* @param params -
|
|
41
|
+
* @param params.vault.chainId - Chain containing the vaults and their registered VaultBundlesV1 contract.
|
|
42
|
+
* @param params.vault.address - Source Vault V1 address whose shares are burned.
|
|
43
|
+
* @param params.vault.asset - Source vault's underlying ERC-20 asset; must equal `args.targetAsset`.
|
|
44
|
+
* @param params.args.assets - Gross migrated amount in asset base units, exclusive with `shares`.
|
|
45
|
+
* @param params.args.shares - Source vault shares to burn for the migration, exclusive with `assets`.
|
|
46
|
+
* @param params.args.targetVault - Destination Vault V2 contract receiving the net migrated assets.
|
|
47
|
+
* @param params.args.targetAsset - Destination vault's underlying ERC-20 asset; must equal `vault.asset`.
|
|
48
|
+
* @param params.args.maxSharePriceVaultV2 - Positive maximum asset base units per share base unit
|
|
49
|
+
* on the destination Vault V2 deposit, scaled by RAY (1e27).
|
|
50
|
+
* @param params.args.userAddress - Share owner and transaction sender; VaultBundlesV1 mints shares to this account.
|
|
51
|
+
* @param params.args.recipient - Unsupported; shares are always minted to the transaction sender.
|
|
52
|
+
* @param params.args.minSharePriceVaultV1 - Unsupported; the source Vault V1 withdrawal carries no
|
|
53
|
+
* share-price bound.
|
|
54
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
55
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
56
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
57
|
+
* The fee is rounded down and deducted from gross assets before depositing.
|
|
58
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
59
|
+
* when `referralFeePct > 0n`.
|
|
60
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
61
|
+
* execution reverts. This pure builder does not check the current time.
|
|
62
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
63
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
64
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
28
65
|
* @returns A deep-frozen VaultBundlesV1 migration transaction.
|
|
29
66
|
* @throws {VaultAssetMismatchError} when source and destination assets differ.
|
|
30
67
|
* @throws {SameVaultMigrationError} when source and destination vaults are identical.
|
|
@@ -39,24 +76,32 @@ export interface VaultV1MigrateToV2Params {
|
|
|
39
76
|
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
40
77
|
* @example
|
|
41
78
|
* ```ts
|
|
79
|
+
* import { vaults } from "@morpho-org/morpho-test";
|
|
42
80
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
81
|
+
* import type { Address } from "viem";
|
|
82
|
+
* import { mainnet } from "viem/chains";
|
|
43
83
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
84
|
+
* export function buildSteakUsdcMigration(
|
|
85
|
+
* targetVault: Address,
|
|
86
|
+
* userAddress: Address,
|
|
87
|
+
* maxSharePriceVaultV2: bigint,
|
|
88
|
+
* deadline: bigint,
|
|
89
|
+
* ) {
|
|
90
|
+
* const vault = vaults[mainnet.id].steakUsdc;
|
|
91
|
+
* const tx = vaultV1MigrateToV2({
|
|
92
|
+
* vault: { chainId: mainnet.id, address: vault.address, asset: vault.asset },
|
|
93
|
+
* args: {
|
|
94
|
+
* shares: 1_000_000n,
|
|
95
|
+
* targetVault,
|
|
96
|
+
* targetAsset: vault.asset,
|
|
97
|
+
* maxSharePriceVaultV2,
|
|
98
|
+
* userAddress,
|
|
99
|
+
* deadline,
|
|
100
|
+
* },
|
|
101
|
+
* });
|
|
102
|
+
* // tx satisfies Readonly<Transaction<VaultV1MigrateToV2Action>>
|
|
103
|
+
* return tx;
|
|
104
|
+
* }
|
|
60
105
|
* ```
|
|
61
106
|
*/
|
|
62
107
|
export declare const vaultV1MigrateToV2: (params: VaultV1MigrateToV2Params) => Readonly<Transaction<VaultV1MigrateToV2Action>>;
|
|
@@ -10,7 +10,30 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Encodes an assets-or-shares Vault V1 to Vault V2 migration through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
|
-
* @param params -
|
|
13
|
+
* @param params.vault.chainId - Chain containing the vaults and their registered VaultBundlesV1 contract.
|
|
14
|
+
* @param params.vault.address - Source Vault V1 address whose shares are burned.
|
|
15
|
+
* @param params.vault.asset - Source vault's underlying ERC-20 asset; must equal `args.targetAsset`.
|
|
16
|
+
* @param params.args.assets - Gross migrated amount in asset base units, exclusive with `shares`.
|
|
17
|
+
* @param params.args.shares - Source vault shares to burn for the migration, exclusive with `assets`.
|
|
18
|
+
* @param params.args.targetVault - Destination Vault V2 contract receiving the net migrated assets.
|
|
19
|
+
* @param params.args.targetAsset - Destination vault's underlying ERC-20 asset; must equal `vault.asset`.
|
|
20
|
+
* @param params.args.maxSharePriceVaultV2 - Positive maximum asset base units per share base unit
|
|
21
|
+
* on the destination Vault V2 deposit, scaled by RAY (1e27).
|
|
22
|
+
* @param params.args.userAddress - Share owner and transaction sender; VaultBundlesV1 mints shares to this account.
|
|
23
|
+
* @param params.args.recipient - Unsupported; shares are always minted to the transaction sender.
|
|
24
|
+
* @param params.args.minSharePriceVaultV1 - Unsupported; the source Vault V1 withdrawal carries no
|
|
25
|
+
* share-price bound.
|
|
26
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
27
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
28
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
29
|
+
* The fee is rounded down and deducted from gross assets before depositing.
|
|
30
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
31
|
+
* when `referralFeePct > 0n`.
|
|
32
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
33
|
+
* execution reverts. This pure builder does not check the current time.
|
|
34
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
35
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
36
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
14
37
|
* @returns A deep-frozen VaultBundlesV1 migration transaction.
|
|
15
38
|
* @throws {VaultAssetMismatchError} when source and destination assets differ.
|
|
16
39
|
* @throws {SameVaultMigrationError} when source and destination vaults are identical.
|
|
@@ -25,24 +48,32 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
25
48
|
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
26
49
|
* @example
|
|
27
50
|
* ```ts
|
|
51
|
+
* import { vaults } from "@morpho-org/morpho-test";
|
|
28
52
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
53
|
+
* import type { Address } from "viem";
|
|
54
|
+
* import { mainnet } from "viem/chains";
|
|
29
55
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
56
|
+
* export function buildSteakUsdcMigration(
|
|
57
|
+
* targetVault: Address,
|
|
58
|
+
* userAddress: Address,
|
|
59
|
+
* maxSharePriceVaultV2: bigint,
|
|
60
|
+
* deadline: bigint,
|
|
61
|
+
* ) {
|
|
62
|
+
* const vault = vaults[mainnet.id].steakUsdc;
|
|
63
|
+
* const tx = vaultV1MigrateToV2({
|
|
64
|
+
* vault: { chainId: mainnet.id, address: vault.address, asset: vault.asset },
|
|
65
|
+
* args: {
|
|
66
|
+
* shares: 1_000_000n,
|
|
67
|
+
* targetVault,
|
|
68
|
+
* targetAsset: vault.asset,
|
|
69
|
+
* maxSharePriceVaultV2,
|
|
70
|
+
* userAddress,
|
|
71
|
+
* deadline,
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
* // tx satisfies Readonly<Transaction<VaultV1MigrateToV2Action>>
|
|
75
|
+
* return tx;
|
|
76
|
+
* }
|
|
46
77
|
* ```
|
|
47
78
|
*/
|
|
48
79
|
const vaultV1MigrateToV2 = (params) => {
|
|
@@ -3,25 +3,52 @@ import { type Erc2612RequirementSignature, type Metadata, type Transaction, type
|
|
|
3
3
|
/** Parameters for {@link vaultV1Redeem}. */
|
|
4
4
|
export interface VaultV1RedeemParams {
|
|
5
5
|
readonly vault: {
|
|
6
|
+
/** Chain containing the vault and its registered VaultBundlesV1 contract. */
|
|
6
7
|
readonly chainId: number;
|
|
8
|
+
/** Vault V1 whose shares are burned for the redemption. */
|
|
7
9
|
readonly address: Address;
|
|
8
10
|
};
|
|
9
11
|
readonly args: {
|
|
12
|
+
/** Vault shares to redeem, in share base units. */
|
|
10
13
|
readonly shares: bigint;
|
|
14
|
+
/** Share owner and transaction sender; receives the net redeemed assets. */
|
|
11
15
|
readonly userAddress: Address;
|
|
16
|
+
/** Unsupported; net assets are always paid to the transaction sender. */
|
|
12
17
|
readonly recipient?: never;
|
|
18
|
+
/** Unsupported; VaultBundlesV1 always burns the transaction sender's shares. */
|
|
13
19
|
readonly onBehalf?: never;
|
|
20
|
+
/** Optional ERC-2612 vault-share permit for the redeemed shares. */
|
|
14
21
|
readonly requirementSignature?: Erc2612RequirementSignature;
|
|
22
|
+
/** Optional WAD-scaled fee in [0, 1e18), defaulting to zero. */
|
|
15
23
|
readonly referralFeePct?: bigint;
|
|
24
|
+
/** Optional fee recipient; a nonzero address is required when `referralFeePct > 0n`. */
|
|
16
25
|
readonly referralFeeRecipient?: Address;
|
|
26
|
+
/** Positive uint256 Unix timestamp in seconds after which execution reverts. */
|
|
17
27
|
readonly deadline: bigint;
|
|
18
28
|
};
|
|
29
|
+
/** Optional analytics metadata appended to the transaction calldata. */
|
|
19
30
|
readonly metadata?: Metadata;
|
|
20
31
|
}
|
|
21
32
|
/**
|
|
22
33
|
* Encodes an exact-shares Vault V1 redemption through VaultBundlesV1.
|
|
23
34
|
*
|
|
24
|
-
* @param params -
|
|
35
|
+
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
36
|
+
* @param params.vault.address - Vault V1 whose shares are burned for the redemption.
|
|
37
|
+
* @param params.args.shares - Positive vault shares to redeem, in share base units.
|
|
38
|
+
* @param params.args.userAddress - Share owner and transaction sender; receives the net redeemed assets.
|
|
39
|
+
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
40
|
+
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
41
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
42
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
43
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
44
|
+
* The fee is rounded down and deducted from the gross redeemed assets.
|
|
45
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
46
|
+
* when `referralFeePct > 0n`.
|
|
47
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
48
|
+
* execution reverts. This pure builder does not check the current time.
|
|
49
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
50
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
51
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
25
52
|
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
26
53
|
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
27
54
|
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
@@ -10,7 +10,23 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Encodes an exact-shares Vault V1 redemption through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
|
-
* @param params -
|
|
13
|
+
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
14
|
+
* @param params.vault.address - Vault V1 whose shares are burned for the redemption.
|
|
15
|
+
* @param params.args.shares - Positive vault shares to redeem, in share base units.
|
|
16
|
+
* @param params.args.userAddress - Share owner and transaction sender; receives the net redeemed assets.
|
|
17
|
+
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
18
|
+
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
19
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
20
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
21
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
22
|
+
* The fee is rounded down and deducted from the gross redeemed assets.
|
|
23
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
24
|
+
* when `referralFeePct > 0n`.
|
|
25
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
26
|
+
* execution reverts. This pure builder does not check the current time.
|
|
27
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
28
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
29
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
14
30
|
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
15
31
|
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
16
32
|
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
@@ -22,7 +22,7 @@ export interface VaultV1WithdrawParams {
|
|
|
22
22
|
* Encodes an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
23
23
|
*
|
|
24
24
|
* This low-level builder does not bind `permit.value` to a share cap; use
|
|
25
|
-
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the cap from `
|
|
25
|
+
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the share cap derived from the handle's `vaultData`.
|
|
26
26
|
*
|
|
27
27
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
28
28
|
* @param params.vault.address - Vault V1 whose shares are burned for the withdrawal.
|
|
@@ -11,7 +11,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
11
11
|
* Encodes an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
13
|
* This low-level builder does not bind `permit.value` to a share cap; use
|
|
14
|
-
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the cap from `
|
|
14
|
+
* `MorphoVaultV1.withdraw().buildTx()` to validate it against the share cap derived from the handle's `vaultData`.
|
|
15
15
|
*
|
|
16
16
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
17
17
|
* @param params.vault.address - Vault V1 whose shares are burned for the withdrawal.
|
|
@@ -56,8 +56,9 @@ export interface VaultV2ForceWithdrawParams {
|
|
|
56
56
|
* `data`, and the typed action discriminator.
|
|
57
57
|
* @throws {NonPositiveInputError} when `exitAssets` or `deadline` is not positive.
|
|
58
58
|
* @throws {NegativeInputError} when `referralFeePct` or `minSharePriceE27` is negative.
|
|
59
|
-
* @throws {
|
|
60
|
-
* with `PctExceeded`)
|
|
59
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is not below WAD (the contract
|
|
60
|
+
* rejects it with `PctExceeded`); it extends {@link InputExceedsMaxError}.
|
|
61
|
+
* @throws {InputExceedsMaxError} when `exitAssets`, `deadline`, or `minSharePriceE27` exceeds `uint256`.
|
|
61
62
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
62
63
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
63
64
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
@@ -46,8 +46,9 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
46
46
|
* `data`, and the typed action discriminator.
|
|
47
47
|
* @throws {NonPositiveInputError} when `exitAssets` or `deadline` is not positive.
|
|
48
48
|
* @throws {NegativeInputError} when `referralFeePct` or `minSharePriceE27` is negative.
|
|
49
|
-
* @throws {
|
|
50
|
-
* with `PctExceeded`)
|
|
49
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is not below WAD (the contract
|
|
50
|
+
* rejects it with `PctExceeded`); it extends {@link InputExceedsMaxError}.
|
|
51
|
+
* @throws {InputExceedsMaxError} when `exitAssets`, `deadline`, or `minSharePriceE27` exceeds `uint256`.
|
|
51
52
|
* @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
|
|
52
53
|
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
53
54
|
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
@@ -3,25 +3,52 @@ import { type Erc2612RequirementSignature, type Metadata, type Transaction, type
|
|
|
3
3
|
/** Parameters for {@link vaultV2Redeem}. */
|
|
4
4
|
export interface VaultV2RedeemParams {
|
|
5
5
|
readonly vault: {
|
|
6
|
+
/** Chain containing the vault and its registered VaultBundlesV1 contract. */
|
|
6
7
|
readonly chainId: number;
|
|
8
|
+
/** Vault V2 whose shares are burned for the redemption. */
|
|
7
9
|
readonly address: Address;
|
|
8
10
|
};
|
|
9
11
|
readonly args: {
|
|
12
|
+
/** Vault shares to redeem, in share base units. */
|
|
10
13
|
readonly shares: bigint;
|
|
14
|
+
/** Share owner and transaction sender; receives the net redeemed assets. */
|
|
11
15
|
readonly userAddress: Address;
|
|
16
|
+
/** Unsupported; net assets are always paid to the transaction sender. */
|
|
12
17
|
readonly recipient?: never;
|
|
18
|
+
/** Unsupported; VaultBundlesV1 always burns the transaction sender's shares. */
|
|
13
19
|
readonly onBehalf?: never;
|
|
20
|
+
/** Optional ERC-2612 vault-share permit for the redeemed shares. */
|
|
14
21
|
readonly requirementSignature?: Erc2612RequirementSignature;
|
|
22
|
+
/** Optional WAD-scaled fee in [0, 1e18), defaulting to zero. */
|
|
15
23
|
readonly referralFeePct?: bigint;
|
|
24
|
+
/** Optional fee recipient; a nonzero address is required when `referralFeePct > 0n`. */
|
|
16
25
|
readonly referralFeeRecipient?: Address;
|
|
26
|
+
/** Positive uint256 Unix timestamp in seconds after which execution reverts. */
|
|
17
27
|
readonly deadline: bigint;
|
|
18
28
|
};
|
|
29
|
+
/** Optional analytics metadata appended to the transaction calldata. */
|
|
19
30
|
readonly metadata?: Metadata;
|
|
20
31
|
}
|
|
21
32
|
/**
|
|
22
33
|
* Encodes an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
23
34
|
*
|
|
24
|
-
* @param params -
|
|
35
|
+
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
36
|
+
* @param params.vault.address - Vault V2 whose shares are burned for the redemption.
|
|
37
|
+
* @param params.args.shares - Positive vault shares to redeem, in share base units.
|
|
38
|
+
* @param params.args.userAddress - Share owner and transaction sender; receives the net redeemed assets.
|
|
39
|
+
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
40
|
+
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
41
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
42
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
43
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
44
|
+
* The fee is rounded down and deducted from the gross redeemed assets.
|
|
45
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
46
|
+
* when `referralFeePct > 0n`.
|
|
47
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
48
|
+
* execution reverts. This pure builder does not check the current time.
|
|
49
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
50
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
51
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
25
52
|
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
26
53
|
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
27
54
|
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
@@ -10,7 +10,23 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Encodes an exact-shares Vault V2 redemption through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
|
-
* @param params -
|
|
13
|
+
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
14
|
+
* @param params.vault.address - Vault V2 whose shares are burned for the redemption.
|
|
15
|
+
* @param params.args.shares - Positive vault shares to redeem, in share base units.
|
|
16
|
+
* @param params.args.userAddress - Share owner and transaction sender; receives the net redeemed assets.
|
|
17
|
+
* @param params.args.recipient - Unsupported; net assets are always paid to the transaction sender.
|
|
18
|
+
* @param params.args.onBehalf - Unsupported; VaultBundlesV1 always burns the transaction sender's shares.
|
|
19
|
+
* @param params.args.requirementSignature - Optional ERC-2612 vault-share permit for `userAddress`
|
|
20
|
+
* and the registered VaultBundlesV1 spender. Omit when the share allowance is already set.
|
|
21
|
+
* @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
|
|
22
|
+
* The fee is rounded down and deducted from the gross redeemed assets.
|
|
23
|
+
* @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
|
|
24
|
+
* when `referralFeePct > 0n`.
|
|
25
|
+
* @param params.args.deadline - Required positive uint256 Unix timestamp in seconds after which
|
|
26
|
+
* execution reverts. This pure builder does not check the current time.
|
|
27
|
+
* @param params.metadata - Optional analytics metadata appended to the transaction calldata.
|
|
28
|
+
* @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
|
|
29
|
+
* @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
|
|
14
30
|
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
15
31
|
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
16
32
|
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
@@ -22,7 +22,7 @@ export interface VaultV2WithdrawParams {
|
|
|
22
22
|
* Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
23
23
|
*
|
|
24
24
|
* This low-level builder does not bind `permit.value` to a share cap; use
|
|
25
|
-
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the cap from `
|
|
25
|
+
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the share cap derived from the handle's `vaultData`.
|
|
26
26
|
*
|
|
27
27
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
28
28
|
* @param params.vault.address - Vault V2 whose shares are burned for the withdrawal.
|
|
@@ -11,7 +11,7 @@ const common_js_1 = require("../bundles/common.js");
|
|
|
11
11
|
* Encodes an exact-assets Vault V2 withdrawal through VaultBundlesV1.
|
|
12
12
|
*
|
|
13
13
|
* This low-level builder does not bind `permit.value` to a share cap; use
|
|
14
|
-
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the cap from `
|
|
14
|
+
* `MorphoVaultV2.withdraw().buildTx()` to validate it against the share cap derived from the handle's `vaultData`.
|
|
15
15
|
*
|
|
16
16
|
* @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
|
|
17
17
|
* @param params.vault.address - Vault V2 whose shares are burned for the withdrawal.
|
|
@@ -9,6 +9,7 @@ export interface VaultV1Actions {
|
|
|
9
9
|
*
|
|
10
10
|
* @param {FetchParameters} [parameters] - Optional fetch parameters (block number, state overrides, etc.).
|
|
11
11
|
* @returns {Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>} The requested vault state.
|
|
12
|
+
* @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
|
|
12
13
|
*/
|
|
13
14
|
getData: (parameters?: FetchParameters) => Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>;
|
|
14
15
|
/**
|
|
@@ -19,7 +20,7 @@ export interface VaultV1Actions {
|
|
|
19
20
|
* Permit2 nonce state. Native funding is exclusive and skips token requirements. Shares are
|
|
20
21
|
* always minted to the transaction sender, which must be `userAddress`.
|
|
21
22
|
* Concurrent requirement reads share the first caller's options; later calls refresh on-chain
|
|
22
|
-
* state using their own options.
|
|
23
|
+
* state using their own options.
|
|
23
24
|
*
|
|
24
25
|
* @param params.userAddress - Account that funds, signs, submits, and receives the vault shares.
|
|
25
26
|
* @param params.vaultData - Pre-fetched Vault V1 snapshot used for asset and share conversion.
|
|
@@ -55,8 +56,9 @@ export interface VaultV1Actions {
|
|
|
55
56
|
* `getRequirements()` when the Permit2 nonce exceeds uint256.
|
|
56
57
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple token signatures are supplied.
|
|
57
58
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
58
|
-
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature
|
|
59
|
-
* this
|
|
59
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
60
|
+
* deadline differ from this operation's, or when the signature's carried action nonce is
|
|
61
|
+
* inconsistent with its signed nonce.
|
|
60
62
|
* @throws {DepositOwnerMismatchError} from `buildTx()` when the signed owner differs from `userAddress`.
|
|
61
63
|
* @throws {DepositAssetMismatchError} from `buildTx()` when the signed asset differs from the vault asset.
|
|
62
64
|
* @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when signature metadata is malformed.
|
|
@@ -95,13 +97,14 @@ export interface VaultV1Actions {
|
|
|
95
97
|
/**
|
|
96
98
|
* Prepares an exact-assets Vault V1 withdrawal through VaultBundlesV1.
|
|
97
99
|
*
|
|
98
|
-
*
|
|
99
|
-
* vault-share allowance and, when a signature is needed, the permit nonce on
|
|
100
|
-
* Captures the requested amount and owner at creation, so later
|
|
101
|
-
* change this handle's requirements or transaction.
|
|
100
|
+
* Derives the share-burn cap from the supplied `vaultData` snapshot at handle creation, then
|
|
101
|
+
* reads the live vault-share allowance and, when a signature is needed, the permit nonce on
|
|
102
|
+
* each `getRequirements()` call. Captures the requested amount and owner at creation, so later
|
|
103
|
+
* changes to `params` do not change this handle's requirements or transaction.
|
|
102
104
|
*
|
|
103
105
|
* @param params.amount - Positive gross withdrawal in underlying asset base units, before fees.
|
|
104
106
|
* @param params.userAddress - Share owner that must sign and submit; receives the net assets.
|
|
107
|
+
* @param params.vaultData - Pre-fetched Vault V1 snapshot used to derive the share cap.
|
|
105
108
|
* @param params.slippageTolerance - Optional WAD-scaled share-price loss tolerance applied to
|
|
106
109
|
* the share cap for MetaMorpho 1.0; MetaMorpho 1.1 retains its lost-assets clamp.
|
|
107
110
|
* Defaults to 0.03% and cannot exceed 10%.
|
|
@@ -114,8 +117,11 @@ export interface VaultV1Actions {
|
|
|
114
117
|
* which returns a deep-frozen `Transaction<VaultV1WithdrawAction>`. Requirements are empty
|
|
115
118
|
* when the allowance equals the cap; an oversized allowance is always reset with an exact
|
|
116
119
|
* onchain approval, and an insufficient one is raised by an approval or, with signature
|
|
117
|
-
* support, an ERC-2612 request. The cap
|
|
118
|
-
*
|
|
120
|
+
* support, an ERC-2612 request. The cap is fixed at handle creation while each call re-reads
|
|
121
|
+
* the allowance. Confirm the approval or pass its signed permit to `buildTx`.
|
|
122
|
+
* @remarks VaultBundlesV1 skips a share permit whose nonce was already consumed and proceeds
|
|
123
|
+
* under the live allowance, so execute every requirement returned by the latest
|
|
124
|
+
* `getRequirements()` — including the oversized-allowance reset — before submitting.
|
|
119
125
|
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
120
126
|
* @throws {NonPositiveInputError} when `amount` or the computed share cap is not positive.
|
|
121
127
|
* @throws {ExpiredDeadlineError} when `deadline` is not in the future at handle creation or
|
|
@@ -125,14 +131,14 @@ export interface VaultV1Actions {
|
|
|
125
131
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
126
132
|
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no nonzero recipient.
|
|
127
133
|
* @throws {ExcessiveSlippageToleranceError} when `slippageTolerance` exceeds 10%.
|
|
134
|
+
* @throws {VaultAddressMismatchError} when `vaultData` belongs to another vault.
|
|
128
135
|
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
129
136
|
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
130
137
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when an unsupported signature is supplied.
|
|
131
138
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permits are supplied.
|
|
132
|
-
* @throws {BundlesPermitMismatchError} from `buildTx()` when the share permit is malformed
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* @throws {viem.BaseError} when a vault, allowance, or nonce read or transaction encoding fails.
|
|
139
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the share permit is malformed or
|
|
140
|
+
* its spender, amount or deadline differ from this operation's.
|
|
141
|
+
* @throws {viem.BaseError} when an allowance or nonce read or transaction encoding fails.
|
|
136
142
|
* @example
|
|
137
143
|
* ```ts
|
|
138
144
|
* import { morphoViemExtension } from "@morpho-org/morpho-sdk";
|
|
@@ -144,7 +150,8 @@ export interface VaultV1Actions {
|
|
|
144
150
|
* const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
145
151
|
* .extend(morphoViemExtension({ supportSignature: false }));
|
|
146
152
|
* const vault = client.morpho.vaultV1(vaultAddress, mainnet.id);
|
|
147
|
-
* const
|
|
153
|
+
* const vaultData = await vault.getData();
|
|
154
|
+
* const action = vault.withdraw({ amount: 1_000_000n, userAddress, vaultData });
|
|
148
155
|
* const requirements = await action.getRequirements();
|
|
149
156
|
* // Send and confirm each approval before calling action.buildTx().
|
|
150
157
|
* // action.buildTx() returns Readonly<Transaction<VaultV1WithdrawAction>>.
|
|
@@ -155,6 +162,7 @@ export interface VaultV1Actions {
|
|
|
155
162
|
withdraw: (params: {
|
|
156
163
|
readonly amount: bigint;
|
|
157
164
|
readonly userAddress: Address;
|
|
165
|
+
readonly vaultData: AccrualVault;
|
|
158
166
|
readonly slippageTolerance?: bigint;
|
|
159
167
|
readonly referralFeePct?: bigint;
|
|
160
168
|
readonly referralFeeRecipient?: Address;
|
|
@@ -166,7 +174,6 @@ export interface VaultV1Actions {
|
|
|
166
174
|
* Captures `shares` and `userAddress` at handle creation for both requirements and `buildTx()`.
|
|
167
175
|
* The caller must satisfy the exact vault-share allowance returned by `getRequirements()` before
|
|
168
176
|
* `buildTx()`; every requirement resolution re-reads the live allowance and checks the deadline.
|
|
169
|
-
* `buildTx()` accepts permits from the latest completed requirement resolution.
|
|
170
177
|
*
|
|
171
178
|
* @param params.shares - Exact vault shares to burn.
|
|
172
179
|
* @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
|
|
@@ -180,6 +187,7 @@ export interface VaultV1Actions {
|
|
|
180
187
|
* @throws {ChainIdMismatchError} when the connected client targets another chain.
|
|
181
188
|
* @throws {NonPositiveInputError} when `shares` is not positive.
|
|
182
189
|
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
190
|
+
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
183
191
|
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
184
192
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
185
193
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
@@ -188,8 +196,8 @@ export interface VaultV1Actions {
|
|
|
188
196
|
* @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
|
|
189
197
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
|
|
190
198
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
|
|
191
|
-
* @throws {BundlesPermitMismatchError} from `buildTx()` when the
|
|
192
|
-
*
|
|
199
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
200
|
+
* deadline differ from this operation's.
|
|
193
201
|
* @example
|
|
194
202
|
* ```ts
|
|
195
203
|
* import { vaults } from "@morpho-org/morpho-test";
|
|
@@ -314,7 +322,6 @@ export interface VaultV1Actions {
|
|
|
314
322
|
* VaultBundlesV1. Only the destination deposit has an onchain share-price bound. The caller must
|
|
315
323
|
* satisfy the exact source-vault share requirement before building the transaction.
|
|
316
324
|
* Captures vault identities, permit-domain metadata, and the owner at handle creation.
|
|
317
|
-
* `buildTx()` accepts permits from the latest completed requirement resolution.
|
|
318
325
|
*
|
|
319
326
|
* @param params.userAddress - Account that signs and submits the transaction; VaultBundlesV1
|
|
320
327
|
* burns and mints shares for `msg.sender`.
|
|
@@ -347,6 +354,7 @@ export interface VaultV1Actions {
|
|
|
347
354
|
* @throws {NegativeInputError} when slippage tolerance or `referralFeePct` is negative.
|
|
348
355
|
* @throws {ExcessiveSlippageToleranceError} when slippage tolerance exceeds the SDK maximum.
|
|
349
356
|
* @throws {ExpiredDeadlineError} when the deadline is stale at creation or requirement resolution.
|
|
357
|
+
* @throws {InputExceedsMaxError} when the selected amount, `maxSharePriceVaultV2`, or `deadline` exceeds uint256.
|
|
350
358
|
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
351
359
|
* @throws {ReferralFeeRecipientMissingError} when a positive fee has no non-zero recipient.
|
|
352
360
|
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
@@ -354,8 +362,8 @@ export interface VaultV1Actions {
|
|
|
354
362
|
* @throws {viem.BaseError} from `getRequirements()` when an allowance or permit-nonce read fails.
|
|
355
363
|
* @throws {AmbiguousRequirementSignaturesError} from `buildTx()` when multiple permit signatures are supplied.
|
|
356
364
|
* @throws {UnexpectedRequirementSignatureError} from `buildTx()` when a non-permit signature is supplied.
|
|
357
|
-
* @throws {BundlesPermitMismatchError} from `buildTx()` when the
|
|
358
|
-
*
|
|
365
|
+
* @throws {BundlesPermitMismatchError} from `buildTx()` when the signature's spender, amount or
|
|
366
|
+
* deadline differ from this operation's.
|
|
359
367
|
* @example
|
|
360
368
|
* ```ts
|
|
361
369
|
* import { vaults } from "@morpho-org/morpho-test";
|
|
@@ -427,6 +435,7 @@ export declare class MorphoVaultV1 implements VaultV1Actions {
|
|
|
427
435
|
withdraw(params: {
|
|
428
436
|
readonly amount: bigint;
|
|
429
437
|
readonly userAddress: Address;
|
|
438
|
+
readonly vaultData: AccrualVault;
|
|
430
439
|
readonly slippageTolerance?: bigint;
|
|
431
440
|
readonly referralFeePct?: bigint;
|
|
432
441
|
readonly referralFeeRecipient?: Address;
|