@morpho-org/morpho-sdk 5.9.0 → 6.0.0-next.1
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 +404 -0
- package/README.md +127 -69
- package/lib/cjs/abis.d.ts +210 -0
- package/lib/cjs/abis.js +142 -2
- package/lib/cjs/actions/blue/borrow.d.ts +62 -61
- package/lib/cjs/actions/blue/borrow.js +48 -80
- package/lib/cjs/actions/blue/common.d.ts +86 -0
- package/lib/cjs/actions/blue/common.js +205 -0
- package/lib/cjs/actions/blue/refinance.d.ts +72 -112
- package/lib/cjs/actions/blue/refinance.js +97 -199
- package/lib/cjs/actions/blue/repay.d.ts +72 -68
- package/lib/cjs/actions/blue/repay.js +56 -118
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +148 -137
- package/lib/cjs/actions/blue/supply.d.ts +62 -45
- package/lib/cjs/actions/blue/supply.js +94 -70
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/cjs/actions/blue/supplyCollateral.js +52 -69
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +133 -120
- package/lib/cjs/actions/blue/withdraw.d.ts +68 -79
- package/lib/cjs/actions/blue/withdraw.js +101 -97
- package/lib/cjs/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/cjs/actions/blue/withdrawCollateral.js +45 -50
- package/lib/cjs/actions/bundles/common.d.ts +200 -0
- package/lib/cjs/actions/bundles/common.js +469 -0
- package/lib/cjs/actions/bundles/index.d.ts +3 -0
- package/lib/cjs/actions/bundles/index.js +23 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +125 -0
- package/lib/cjs/actions/index.d.ts +2 -1
- package/lib/cjs/actions/index.js +1 -0
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeBorrow.js +2 -2
- package/lib/cjs/actions/midnight/takeLend.d.ts +2 -2
- package/lib/cjs/actions/midnight/takeLend.js +2 -2
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +60 -19
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/cjs/actions/requirements/blue/getUnusedPermit2Nonce.js +72 -0
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/blue/index.js +1 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +30 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +8 -2
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -6
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +123 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- package/lib/cjs/actions/requirements/encode/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/index.js +1 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/cjs/actions/signatures/getTokenRequirementActions.js +4 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +18 -66
- package/lib/cjs/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/cjs/actions/vaultV1/deposit.js +110 -109
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/cjs/actions/vaultV1/migrateToV2.js +91 -104
- package/lib/cjs/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/cjs/actions/vaultV1/redeem.js +56 -33
- package/lib/cjs/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/cjs/actions/vaultV1/withdraw.js +86 -34
- package/lib/cjs/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/cjs/actions/vaultV2/deposit.js +111 -109
- package/lib/cjs/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/cjs/actions/vaultV2/redeem.js +56 -34
- package/lib/cjs/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/cjs/actions/vaultV2/withdraw.js +86 -35
- package/lib/cjs/bundler/actions.d.ts +4 -4
- package/lib/cjs/bundler/actions.js +4 -4
- package/lib/cjs/client/morphoViemExtension.d.ts +2 -1
- package/lib/cjs/client/morphoViemExtension.js +2 -1
- package/lib/cjs/entities/blue/blue.d.ts +806 -374
- package/lib/cjs/entities/blue/blue.js +449 -696
- package/lib/cjs/entities/index.d.ts +2 -0
- package/lib/cjs/entities/index.js +15 -0
- package/lib/cjs/entities/midnight/midnight.d.ts +2 -2
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +203 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +74 -0
- package/lib/cjs/entities/requirements/index.d.ts +1 -0
- package/lib/cjs/entities/requirements/index.js +17 -0
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +348 -98
- package/lib/cjs/entities/vaultV1/vaultV1.js +322 -120
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/cjs/entities/vaultV2/vaultV2.js +219 -77
- package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/cjs/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/cjs/helpers/index.d.ts +2 -1
- package/lib/cjs/helpers/index.js +5 -1
- package/lib/cjs/helpers/referralFee.d.ts +21 -0
- package/lib/cjs/helpers/referralFee.js +35 -0
- package/lib/cjs/helpers/slippage.d.ts +90 -1
- package/lib/cjs/helpers/slippage.js +123 -0
- package/lib/cjs/helpers/validate.d.ts +16 -23
- package/lib/cjs/helpers/validate.js +41 -48
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +3 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/types/action.d.ts +303 -210
- package/lib/cjs/types/action.js +29 -2
- package/lib/cjs/types/client.d.ts +9 -0
- package/lib/cjs/types/error.d.ts +193 -18
- package/lib/cjs/types/error.js +267 -24
- package/lib/cjs/types/sharedLiquidity.d.ts +0 -7
- package/lib/esm/abis.d.ts +210 -0
- package/lib/esm/abis.js +140 -0
- package/lib/esm/actions/blue/borrow.d.ts +62 -61
- package/lib/esm/actions/blue/borrow.js +48 -80
- package/lib/esm/actions/blue/common.d.ts +86 -0
- package/lib/esm/actions/blue/common.js +193 -0
- package/lib/esm/actions/blue/refinance.d.ts +72 -112
- package/lib/esm/actions/blue/refinance.js +98 -200
- package/lib/esm/actions/blue/repay.d.ts +72 -68
- package/lib/esm/actions/blue/repay.js +56 -118
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +85 -90
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +149 -138
- package/lib/esm/actions/blue/supply.d.ts +62 -45
- package/lib/esm/actions/blue/supply.js +94 -70
- package/lib/esm/actions/blue/supplyCollateral.d.ts +63 -40
- package/lib/esm/actions/blue/supplyCollateral.js +52 -69
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +82 -90
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +134 -121
- package/lib/esm/actions/blue/withdraw.d.ts +68 -79
- package/lib/esm/actions/blue/withdraw.js +100 -96
- package/lib/esm/actions/blue/withdrawCollateral.d.ts +56 -28
- package/lib/esm/actions/blue/withdrawCollateral.js +45 -50
- package/lib/esm/actions/bundles/common.d.ts +200 -0
- package/lib/esm/actions/bundles/common.js +457 -0
- package/lib/esm/actions/bundles/index.d.ts +3 -0
- package/lib/esm/actions/bundles/index.js +2 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
- package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +121 -0
- package/lib/esm/actions/index.d.ts +2 -1
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeBorrow.d.ts +2 -2
- package/lib/esm/actions/midnight/takeBorrow.js +2 -2
- package/lib/esm/actions/midnight/takeLend.d.ts +2 -2
- package/lib/esm/actions/midnight/takeLend.js +2 -2
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +29 -17
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +63 -22
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.d.ts +48 -0
- package/lib/esm/actions/requirements/blue/getUnusedPermit2Nonce.js +68 -0
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
- package/lib/esm/actions/requirements/blue/index.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +10 -7
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +31 -6
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +2 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -3
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +16 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +61 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +119 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +4 -4
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +6 -5
- package/lib/esm/actions/requirements/encode/index.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/index.js +1 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +6 -4
- package/lib/esm/actions/requirements/getRequirementsApproval.js +6 -4
- package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +1 -0
- package/lib/esm/actions/signatures/getTokenRequirementActions.js +5 -1
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +22 -30
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +19 -67
- package/lib/esm/actions/vaultV1/deposit.d.ts +73 -57
- package/lib/esm/actions/vaultV1/deposit.js +112 -111
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +43 -66
- package/lib/esm/actions/vaultV1/migrateToV2.js +93 -106
- package/lib/esm/actions/vaultV1/redeem.d.ts +30 -23
- package/lib/esm/actions/vaultV1/redeem.js +56 -33
- package/lib/esm/actions/vaultV1/withdraw.d.ts +58 -24
- package/lib/esm/actions/vaultV1/withdraw.js +86 -34
- package/lib/esm/actions/vaultV2/deposit.d.ts +74 -57
- package/lib/esm/actions/vaultV2/deposit.js +113 -111
- package/lib/esm/actions/vaultV2/redeem.d.ts +30 -24
- package/lib/esm/actions/vaultV2/redeem.js +56 -34
- package/lib/esm/actions/vaultV2/withdraw.d.ts +58 -25
- package/lib/esm/actions/vaultV2/withdraw.js +86 -35
- package/lib/esm/bundler/actions.d.ts +4 -4
- package/lib/esm/bundler/actions.js +4 -4
- package/lib/esm/client/morphoViemExtension.d.ts +2 -1
- package/lib/esm/client/morphoViemExtension.js +2 -1
- package/lib/esm/entities/blue/blue.d.ts +806 -374
- package/lib/esm/entities/blue/blue.js +455 -702
- package/lib/esm/entities/index.d.ts +2 -0
- package/lib/esm/entities/index.js +1 -0
- package/lib/esm/entities/midnight/midnight.d.ts +2 -2
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +87 -0
- package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +199 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
- package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +70 -0
- 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 +348 -98
- package/lib/esm/entities/vaultV1/vaultV1.js +326 -124
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +221 -68
- package/lib/esm/entities/vaultV2/vaultV2.js +222 -80
- package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +3 -9
- package/lib/esm/helpers/computeVaultV1Reallocations.js +3 -9
- package/lib/esm/helpers/index.d.ts +2 -1
- package/lib/esm/helpers/index.js +2 -1
- package/lib/esm/helpers/referralFee.d.ts +21 -0
- package/lib/esm/helpers/referralFee.js +31 -0
- package/lib/esm/helpers/slippage.d.ts +90 -1
- package/lib/esm/helpers/slippage.js +122 -2
- package/lib/esm/helpers/validate.d.ts +16 -23
- package/lib/esm/helpers/validate.js +40 -48
- package/lib/esm/helpers/validateRequirementSpender.d.ts +2 -1
- package/lib/esm/helpers/validateRequirementSpender.js +3 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/types/action.d.ts +303 -210
- package/lib/esm/types/action.js +28 -2
- package/lib/esm/types/client.d.ts +9 -0
- package/lib/esm/types/error.d.ts +193 -18
- package/lib/esm/types/error.js +252 -21
- package/lib/esm/types/sharedLiquidity.d.ts +0 -7
- package/package.json +6 -5
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +0 -63
- package/lib/cjs/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/cjs/actions/blue/buildReallocationActions.js +0 -141
- package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/cjs/actions/blue/resolveRepayFunding.js +0 -85
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +0 -47
- package/lib/esm/actions/blue/buildAssetFundingActions.js +0 -59
- package/lib/esm/actions/blue/buildReallocationActions.d.ts +0 -69
- package/lib/esm/actions/blue/buildReallocationActions.js +0 -135
- package/lib/esm/actions/blue/resolveRepayFunding.d.ts +0 -66
- package/lib/esm/actions/blue/resolveRepayFunding.js +0 -81
|
@@ -1,85 +1,62 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type Erc2612RequirementSignature, type Metadata, type Transaction, type VaultV1MigrateToV2Action, type VaultV1MigrateToV2AmountArgs } from "../../types/index.js";
|
|
3
3
|
/** Parameters for {@link vaultV1MigrateToV2}. */
|
|
4
4
|
export interface VaultV1MigrateToV2Params {
|
|
5
|
-
vault: {
|
|
6
|
-
chainId: number;
|
|
7
|
-
address: Address;
|
|
8
|
-
|
|
9
|
-
asset: Address;
|
|
5
|
+
readonly vault: {
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
readonly address: Address;
|
|
8
|
+
readonly asset: Address;
|
|
10
9
|
};
|
|
11
|
-
args: {
|
|
12
|
-
targetVault: Address;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
recipient: Address;
|
|
23
|
-
/** Pre-signed permit/permit2 approval for V1 share transfer. */
|
|
24
|
-
requirementSignature?: PermitRequirementSignature;
|
|
10
|
+
readonly args: VaultV1MigrateToV2AmountArgs & {
|
|
11
|
+
readonly targetVault: Address;
|
|
12
|
+
readonly targetAsset: Address;
|
|
13
|
+
readonly maxSharePriceVaultV2: bigint;
|
|
14
|
+
readonly userAddress: Address;
|
|
15
|
+
readonly recipient?: never;
|
|
16
|
+
readonly minSharePriceVaultV1?: never;
|
|
17
|
+
readonly requirementSignature?: Erc2612RequirementSignature;
|
|
18
|
+
readonly referralFeePct?: bigint;
|
|
19
|
+
readonly referralFeeRecipient?: Address;
|
|
20
|
+
readonly deadline: bigint;
|
|
25
21
|
};
|
|
26
|
-
metadata?: Metadata;
|
|
22
|
+
readonly metadata?: Metadata;
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* Encodes an assets-or-shares Vault V1 to Vault V2 migration through VaultBundlesV1.
|
|
30
26
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
43
|
-
* @
|
|
44
|
-
* @param params.args.targetVault - The target VaultV2 address.
|
|
45
|
-
* @param params.args.targetAsset - The underlying asset of the target V2 vault. Must equal
|
|
46
|
-
* `vault.asset`.
|
|
47
|
-
* @param params.args.shares - Number of V1 shares to migrate.
|
|
48
|
-
* @param params.args.minSharePriceVaultV1 - Minimum V1 share price in RAY (slippage protection
|
|
49
|
-
* for the redeem leg).
|
|
50
|
-
* @param params.args.maxSharePriceVaultV2 - Maximum V2 share price in RAY (inflation protection
|
|
51
|
-
* for the deposit leg).
|
|
52
|
-
* @param params.args.recipient - Address that receives the V2 vault shares.
|
|
53
|
-
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 for the V1 share
|
|
54
|
-
* transfer.
|
|
55
|
-
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
56
|
-
* @returns A deep-frozen `Transaction<VaultV1MigrateToV2Action>` with `to`, `value`, `data`, and
|
|
57
|
-
* the typed `action` discriminator the simulation layer consumes.
|
|
58
|
-
* @throws {VaultAssetMismatchError} when `targetAsset` differs from `vault.asset`.
|
|
59
|
-
* @throws {NonPositiveInputError} when `shares <= 0n` or `maxSharePriceVaultV2 <= 0n`.
|
|
60
|
-
* @throws {NegativeInputError} when `minSharePriceVaultV1 < 0n`.
|
|
61
|
-
* @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `requirementSignature`
|
|
62
|
-
* is provided and the signed asset differs from `vault.address` (the V1 share token).
|
|
63
|
-
* @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `requirementSignature`
|
|
64
|
-
* is provided and the signed amount differs from `args.shares`.
|
|
65
|
-
* @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when a Permit2 requirement
|
|
66
|
-
* signature is missing its expiration.
|
|
27
|
+
* @param params - Source/destination vaults, exclusive migration amount, fee, permit, and deadline.
|
|
28
|
+
* @returns A deep-frozen VaultBundlesV1 migration transaction.
|
|
29
|
+
* @throws {VaultAssetMismatchError} when source and destination assets differ.
|
|
30
|
+
* @throws {SameVaultMigrationError} when source and destination vaults are identical.
|
|
31
|
+
* @throws {AmountAndSharesExclusiveError} when both amount modes or neither are supplied.
|
|
32
|
+
* @throws {NonPositiveInputError} when the selected amount, destination share-price bound, or deadline is not positive.
|
|
33
|
+
* @throws {InputExceedsMaxError} when the selected amount, `maxSharePriceVaultV2`, or `deadline` exceeds uint256.
|
|
34
|
+
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
35
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
36
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
37
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
38
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
39
|
+
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
67
40
|
* @example
|
|
68
41
|
* ```ts
|
|
69
42
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
70
43
|
*
|
|
71
44
|
* const tx = vaultV1MigrateToV2({
|
|
72
|
-
* vault: {
|
|
45
|
+
* vault: {
|
|
46
|
+
* chainId: 1,
|
|
47
|
+
* address: "0x0000000000000000000000000000000000000001",
|
|
48
|
+
* asset: "0x0000000000000000000000000000000000000003",
|
|
49
|
+
* },
|
|
73
50
|
* args: {
|
|
74
|
-
* targetVault,
|
|
75
|
-
* targetAsset: USDC,
|
|
76
51
|
* shares: 1_000_000n,
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
52
|
+
* targetVault: "0x0000000000000000000000000000000000000002",
|
|
53
|
+
* targetAsset: "0x0000000000000000000000000000000000000003",
|
|
54
|
+
* maxSharePriceVaultV2: 1_000_000_000_000_000_000_000_000_000n,
|
|
55
|
+
* userAddress: "0x0000000000000000000000000000000000000004",
|
|
56
|
+
* deadline: 1_900_000_000n,
|
|
80
57
|
* },
|
|
81
58
|
* });
|
|
82
|
-
* // tx
|
|
59
|
+
* // tx.action.type === "vaultV1MigrateToV2"
|
|
83
60
|
* ```
|
|
84
61
|
*/
|
|
85
|
-
export declare const vaultV1MigrateToV2: (
|
|
62
|
+
export declare const vaultV1MigrateToV2: (params: VaultV1MigrateToV2Params) => Readonly<Transaction<VaultV1MigrateToV2Action>>;
|
|
@@ -1,136 +1,123 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaultV1MigrateToV2 = void 0;
|
|
4
|
-
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
5
|
const viem_1 = require("viem");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
const abis_js_1 = require("../../abis.js");
|
|
7
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
8
|
+
const index_js_1 = require("../../types/index.js");
|
|
9
|
+
const common_js_1 = require("../bundles/common.js");
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* Encodes an assets-or-shares Vault V1 to Vault V2 migration through VaultBundlesV1.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
26
|
-
* @
|
|
27
|
-
* @param params.args.targetVault - The target VaultV2 address.
|
|
28
|
-
* @param params.args.targetAsset - The underlying asset of the target V2 vault. Must equal
|
|
29
|
-
* `vault.asset`.
|
|
30
|
-
* @param params.args.shares - Number of V1 shares to migrate.
|
|
31
|
-
* @param params.args.minSharePriceVaultV1 - Minimum V1 share price in RAY (slippage protection
|
|
32
|
-
* for the redeem leg).
|
|
33
|
-
* @param params.args.maxSharePriceVaultV2 - Maximum V2 share price in RAY (inflation protection
|
|
34
|
-
* for the deposit leg).
|
|
35
|
-
* @param params.args.recipient - Address that receives the V2 vault shares.
|
|
36
|
-
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 for the V1 share
|
|
37
|
-
* transfer.
|
|
38
|
-
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
39
|
-
* @returns A deep-frozen `Transaction<VaultV1MigrateToV2Action>` with `to`, `value`, `data`, and
|
|
40
|
-
* the typed `action` discriminator the simulation layer consumes.
|
|
41
|
-
* @throws {VaultAssetMismatchError} when `targetAsset` differs from `vault.asset`.
|
|
42
|
-
* @throws {NonPositiveInputError} when `shares <= 0n` or `maxSharePriceVaultV2 <= 0n`.
|
|
43
|
-
* @throws {NegativeInputError} when `minSharePriceVaultV1 < 0n`.
|
|
44
|
-
* @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `requirementSignature`
|
|
45
|
-
* is provided and the signed asset differs from `vault.address` (the V1 share token).
|
|
46
|
-
* @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `requirementSignature`
|
|
47
|
-
* is provided and the signed amount differs from `args.shares`.
|
|
48
|
-
* @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when a Permit2 requirement
|
|
49
|
-
* signature is missing its expiration.
|
|
13
|
+
* @param params - Source/destination vaults, exclusive migration amount, fee, permit, and deadline.
|
|
14
|
+
* @returns A deep-frozen VaultBundlesV1 migration transaction.
|
|
15
|
+
* @throws {VaultAssetMismatchError} when source and destination assets differ.
|
|
16
|
+
* @throws {SameVaultMigrationError} when source and destination vaults are identical.
|
|
17
|
+
* @throws {AmountAndSharesExclusiveError} when both amount modes or neither are supplied.
|
|
18
|
+
* @throws {NonPositiveInputError} when the selected amount, destination share-price bound, or deadline is not positive.
|
|
19
|
+
* @throws {InputExceedsMaxError} when the selected amount, `maxSharePriceVaultV2`, or `deadline` exceeds uint256.
|
|
20
|
+
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
21
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
22
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
23
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
24
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
25
|
+
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
50
26
|
* @example
|
|
51
27
|
* ```ts
|
|
52
28
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
53
29
|
*
|
|
54
30
|
* const tx = vaultV1MigrateToV2({
|
|
55
|
-
* vault: {
|
|
31
|
+
* vault: {
|
|
32
|
+
* chainId: 1,
|
|
33
|
+
* address: "0x0000000000000000000000000000000000000001",
|
|
34
|
+
* asset: "0x0000000000000000000000000000000000000003",
|
|
35
|
+
* },
|
|
56
36
|
* args: {
|
|
57
|
-
* targetVault,
|
|
58
|
-
* targetAsset: USDC,
|
|
59
37
|
* shares: 1_000_000n,
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
38
|
+
* targetVault: "0x0000000000000000000000000000000000000002",
|
|
39
|
+
* targetAsset: "0x0000000000000000000000000000000000000003",
|
|
40
|
+
* maxSharePriceVaultV2: 1_000_000_000_000_000_000_000_000_000n,
|
|
41
|
+
* userAddress: "0x0000000000000000000000000000000000000004",
|
|
42
|
+
* deadline: 1_900_000_000n,
|
|
63
43
|
* },
|
|
64
44
|
* });
|
|
65
|
-
* // tx
|
|
45
|
+
* // tx.action.type === "vaultV1MigrateToV2"
|
|
66
46
|
* ```
|
|
67
47
|
*/
|
|
68
|
-
const vaultV1MigrateToV2 = (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!(0, viem_1.isAddressEqual)(sourceAsset, targetAsset)) {
|
|
72
|
-
throw new index_js_3.VaultAssetMismatchError(sourceAsset, targetAsset);
|
|
48
|
+
const vaultV1MigrateToV2 = (params) => {
|
|
49
|
+
if (!(0, viem_1.isAddressEqual)(params.vault.asset, params.args.targetAsset)) {
|
|
50
|
+
throw new index_js_1.VaultAssetMismatchError(params.vault.asset, params.args.targetAsset);
|
|
73
51
|
}
|
|
74
|
-
if (
|
|
75
|
-
throw new
|
|
52
|
+
if ((0, viem_1.isAddressEqual)(params.vault.address, params.args.targetVault)) {
|
|
53
|
+
throw new index_js_1.SameVaultMigrationError(params.vault.address);
|
|
76
54
|
}
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
const assets = "assets" in params.args ? params.args.assets : undefined;
|
|
56
|
+
const shares = "shares" in params.args ? params.args.shares : undefined;
|
|
57
|
+
if ((assets == null) === (shares == null)) {
|
|
58
|
+
throw new index_js_1.AmountAndSharesExclusiveError();
|
|
79
59
|
}
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
const selectedAmount = assets ?? shares ?? 0n;
|
|
61
|
+
if (selectedAmount <= 0n) {
|
|
62
|
+
throw new index_js_1.NonPositiveInputError(assets != null ? "assets" : "shares", selectedAmount);
|
|
82
63
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
64
|
+
if (params.args.maxSharePriceVaultV2 <= 0n) {
|
|
65
|
+
throw new index_js_1.NonPositiveInputError("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
|
|
66
|
+
}
|
|
67
|
+
// Reject ABI overflow with SDK errors before calldata encoding.
|
|
68
|
+
(0, validate_js_1.validateUint256Field)(assets != null ? "assets" : "shares", selectedAmount);
|
|
69
|
+
(0, validate_js_1.validateUint256Field)("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
|
|
70
|
+
const common = (0, common_js_1.normalizeBundlesCommonParams)(params.args);
|
|
71
|
+
const spender = (0, morpho_ts_1.getChainAddress)(params.vault.chainId, "bundles.vaultBundlesV1");
|
|
72
|
+
const sharesPermit = (0, common_js_1.getBundlesSharesPermit)({
|
|
73
|
+
vault: params.vault.address,
|
|
74
|
+
deadline: common.deadline,
|
|
75
|
+
owner: params.args.userAddress,
|
|
76
|
+
spender,
|
|
90
77
|
amount: shares,
|
|
91
|
-
|
|
92
|
-
requirementSignature,
|
|
93
|
-
}));
|
|
94
|
-
// GA1 redeems its own shares (owner = GA1, no allowance check).
|
|
95
|
-
actions.push({
|
|
96
|
-
type: "erc4626Redeem",
|
|
97
|
-
args: [
|
|
98
|
-
sourceVault,
|
|
99
|
-
viem_1.maxUint256,
|
|
100
|
-
minSharePriceVaultV1,
|
|
101
|
-
generalAdapter1,
|
|
102
|
-
generalAdapter1,
|
|
103
|
-
false /* skipRevert */,
|
|
104
|
-
],
|
|
105
|
-
});
|
|
106
|
-
// Deposit all resulting assets into V2.
|
|
107
|
-
actions.push({
|
|
108
|
-
type: "erc4626Deposit",
|
|
109
|
-
args: [
|
|
110
|
-
targetVault,
|
|
111
|
-
viem_1.maxUint256,
|
|
112
|
-
maxSharePriceVaultV2,
|
|
113
|
-
recipient,
|
|
114
|
-
false /* skipRevert */,
|
|
115
|
-
],
|
|
78
|
+
requirementSignature: params.args.requirementSignature,
|
|
116
79
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
80
|
+
const referralFeeAssets = assets == null
|
|
81
|
+
? undefined
|
|
82
|
+
: (0, common_js_1.getBundlesReferralFeeAssets)(assets, common.referralFeePct);
|
|
83
|
+
return (0, common_js_1.finalizeVaultBundlesV1Transaction)({
|
|
84
|
+
chainId: params.vault.chainId,
|
|
85
|
+
value: 0n,
|
|
86
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
87
|
+
abi: abis_js_1.vaultBundlesV1Abi,
|
|
88
|
+
functionName: "vaultBundlesV1Migrate",
|
|
89
|
+
args: [
|
|
90
|
+
params.vault.address,
|
|
91
|
+
params.args.targetVault,
|
|
92
|
+
assets ?? 0n,
|
|
93
|
+
shares ?? 0n,
|
|
94
|
+
params.args.maxSharePriceVaultV2,
|
|
95
|
+
sharesPermit,
|
|
96
|
+
common.referralFeePct,
|
|
97
|
+
common.referralFeeRecipient,
|
|
98
|
+
common.deadline,
|
|
99
|
+
],
|
|
100
|
+
}),
|
|
123
101
|
action: {
|
|
124
102
|
type: "vaultV1MigrateToV2",
|
|
125
103
|
args: {
|
|
126
|
-
sourceVault,
|
|
127
|
-
targetVault,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
maxSharePriceVaultV2,
|
|
131
|
-
|
|
104
|
+
sourceVault: params.vault.address,
|
|
105
|
+
targetVault: params.args.targetVault,
|
|
106
|
+
assets: assets ?? 0n,
|
|
107
|
+
shares: shares ?? 0n,
|
|
108
|
+
maxSharePriceVaultV2: params.args.maxSharePriceVaultV2,
|
|
109
|
+
referralFeePct: common.referralFeePct,
|
|
110
|
+
referralFeeRecipient: common.referralFeeRecipient,
|
|
111
|
+
...(assets != null && referralFeeAssets != null
|
|
112
|
+
? {
|
|
113
|
+
referralFeeAssets,
|
|
114
|
+
netAssets: assets - referralFeeAssets,
|
|
115
|
+
}
|
|
116
|
+
: {}),
|
|
117
|
+
deadline: common.deadline,
|
|
132
118
|
},
|
|
133
119
|
},
|
|
120
|
+
metadata: params.metadata,
|
|
134
121
|
});
|
|
135
122
|
};
|
|
136
123
|
exports.vaultV1MigrateToV2 = vaultV1MigrateToV2;
|
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import { type Metadata, type Transaction, type VaultV1RedeemAction } from "../../types/index.js";
|
|
2
|
+
import { type Erc2612RequirementSignature, type Metadata, type Transaction, type VaultV1RedeemAction } from "../../types/index.js";
|
|
3
3
|
/** Parameters for {@link vaultV1Redeem}. */
|
|
4
4
|
export interface VaultV1RedeemParams {
|
|
5
|
-
vault: {
|
|
6
|
-
|
|
5
|
+
readonly vault: {
|
|
6
|
+
readonly chainId: number;
|
|
7
|
+
readonly address: Address;
|
|
7
8
|
};
|
|
8
|
-
args: {
|
|
9
|
-
shares: bigint;
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
readonly args: {
|
|
10
|
+
readonly shares: bigint;
|
|
11
|
+
readonly userAddress: Address;
|
|
12
|
+
readonly recipient?: never;
|
|
13
|
+
readonly onBehalf?: never;
|
|
14
|
+
readonly requirementSignature?: Erc2612RequirementSignature;
|
|
15
|
+
readonly referralFeePct?: bigint;
|
|
16
|
+
readonly referralFeeRecipient?: Address;
|
|
17
|
+
readonly deadline: bigint;
|
|
12
18
|
};
|
|
13
|
-
metadata?: Metadata;
|
|
19
|
+
readonly metadata?: Metadata;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
|
-
*
|
|
22
|
+
* Encodes an exact-shares Vault V1 redemption through VaultBundlesV1.
|
|
17
23
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
26
|
-
*
|
|
27
|
-
* @throws {
|
|
24
|
+
* @param params - Vault, shares, share permit, fee, and deadline values.
|
|
25
|
+
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
26
|
+
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
27
|
+
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
28
|
+
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
29
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
30
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
31
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
32
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
33
|
+
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
28
34
|
* @example
|
|
29
35
|
* ```ts
|
|
30
36
|
* import { vaultV1Redeem } from "@morpho-org/morpho-sdk";
|
|
37
|
+
* import { zeroAddress } from "viem";
|
|
31
38
|
*
|
|
32
39
|
* const tx = vaultV1Redeem({
|
|
33
|
-
* vault: { address:
|
|
34
|
-
* args: { shares: 1_000_000n,
|
|
40
|
+
* vault: { chainId: 1, address: zeroAddress },
|
|
41
|
+
* args: { shares: 1_000_000n, userAddress: zeroAddress, deadline: 1_900_000_000n },
|
|
35
42
|
* });
|
|
36
|
-
* // tx
|
|
43
|
+
* // tx.action.type === "vaultV1Redeem"
|
|
37
44
|
* ```
|
|
38
45
|
*/
|
|
39
|
-
export declare const vaultV1Redeem: (
|
|
46
|
+
export declare const vaultV1Redeem: (params: VaultV1RedeemParams) => Readonly<Transaction<VaultV1RedeemAction>>;
|
|
@@ -1,57 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaultV1Redeem = void 0;
|
|
4
|
-
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
5
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
5
|
const viem_1 = require("viem");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const abis_js_1 = require("../../abis.js");
|
|
7
|
+
const validate_js_1 = require("../../helpers/validate.js");
|
|
8
|
+
const index_js_1 = require("../../types/index.js");
|
|
9
|
+
const common_js_1 = require("../bundles/common.js");
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Encodes an exact-shares Vault V1 redemption through VaultBundlesV1.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
* @throws {
|
|
13
|
+
* @param params - Vault, shares, share permit, fee, and deadline values.
|
|
14
|
+
* @returns A deep-frozen VaultBundlesV1 redemption transaction.
|
|
15
|
+
* @throws {NonPositiveInputError} when `shares` or `deadline` is not positive.
|
|
16
|
+
* @throws {InputExceedsMaxError} when `shares` or `deadline` exceeds uint256.
|
|
17
|
+
* @throws {NegativeInputError} when `referralFeePct` is negative.
|
|
18
|
+
* @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD.
|
|
19
|
+
* @throws {ReferralFeeRecipientMissingError} when a positive referral fee has no non-zero recipient.
|
|
20
|
+
* @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
|
|
21
|
+
* @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
|
|
22
|
+
* @throws {BundlesPermitMismatchError} when the optional share permit is incompatible.
|
|
22
23
|
* @example
|
|
23
24
|
* ```ts
|
|
24
25
|
* import { vaultV1Redeem } from "@morpho-org/morpho-sdk";
|
|
26
|
+
* import { zeroAddress } from "viem";
|
|
25
27
|
*
|
|
26
28
|
* const tx = vaultV1Redeem({
|
|
27
|
-
* vault: { address:
|
|
28
|
-
* args: { shares: 1_000_000n,
|
|
29
|
+
* vault: { chainId: 1, address: zeroAddress },
|
|
30
|
+
* args: { shares: 1_000_000n, userAddress: zeroAddress, deadline: 1_900_000_000n },
|
|
29
31
|
* });
|
|
30
|
-
* // tx
|
|
32
|
+
* // tx.action.type === "vaultV1Redeem"
|
|
31
33
|
* ```
|
|
32
34
|
*/
|
|
33
|
-
const vaultV1Redeem = (
|
|
34
|
-
if (shares <= 0n) {
|
|
35
|
-
throw new
|
|
35
|
+
const vaultV1Redeem = (params) => {
|
|
36
|
+
if (params.args.shares <= 0n) {
|
|
37
|
+
throw new index_js_1.NonPositiveInputError("shares", params.args.shares);
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
// Reject ABI overflow with SDK errors before calldata encoding.
|
|
40
|
+
(0, validate_js_1.validateUint256Field)("shares", params.args.shares);
|
|
41
|
+
const common = (0, common_js_1.normalizeBundlesCommonParams)(params.args);
|
|
42
|
+
const spender = (0, morpho_ts_1.getChainAddress)(params.vault.chainId, "bundles.vaultBundlesV1");
|
|
43
|
+
const sharesPermit = (0, common_js_1.getBundlesSharesPermit)({
|
|
44
|
+
vault: params.vault.address,
|
|
45
|
+
deadline: common.deadline,
|
|
46
|
+
owner: params.args.userAddress,
|
|
47
|
+
spender,
|
|
48
|
+
amount: params.args.shares,
|
|
49
|
+
requirementSignature: params.args.requirementSignature,
|
|
50
|
+
});
|
|
51
|
+
return (0, common_js_1.finalizeVaultBundlesV1Transaction)({
|
|
52
|
+
chainId: params.vault.chainId,
|
|
53
|
+
value: 0n,
|
|
39
54
|
data: (0, viem_1.encodeFunctionData)({
|
|
40
|
-
abi:
|
|
41
|
-
functionName: "
|
|
42
|
-
args: [
|
|
55
|
+
abi: abis_js_1.vaultBundlesV1Abi,
|
|
56
|
+
functionName: "vaultBundlesV1Withdraw",
|
|
57
|
+
args: [
|
|
58
|
+
params.vault.address,
|
|
59
|
+
0n,
|
|
60
|
+
params.args.shares,
|
|
61
|
+
sharesPermit,
|
|
62
|
+
common.referralFeePct,
|
|
63
|
+
common.referralFeeRecipient,
|
|
64
|
+
common.deadline,
|
|
65
|
+
],
|
|
43
66
|
}),
|
|
44
|
-
value: 0n,
|
|
45
|
-
};
|
|
46
|
-
if (metadata) {
|
|
47
|
-
tx = (0, index_js_1.addTransactionMetadata)(tx, metadata);
|
|
48
|
-
}
|
|
49
|
-
return (0, morpho_ts_1.deepFreeze)({
|
|
50
|
-
...tx,
|
|
51
67
|
action: {
|
|
52
68
|
type: "vaultV1Redeem",
|
|
53
|
-
args: {
|
|
69
|
+
args: {
|
|
70
|
+
vault: params.vault.address,
|
|
71
|
+
shares: params.args.shares,
|
|
72
|
+
referralFeePct: common.referralFeePct,
|
|
73
|
+
referralFeeRecipient: common.referralFeeRecipient,
|
|
74
|
+
deadline: common.deadline,
|
|
75
|
+
},
|
|
54
76
|
},
|
|
77
|
+
metadata: params.metadata,
|
|
55
78
|
});
|
|
56
79
|
};
|
|
57
80
|
exports.vaultV1Redeem = vaultV1Redeem;
|