import { type Address } from "viem"; import { type DepositAmountArgs, type Metadata, type PermitRequirementSignature, type Transaction, type VaultV2DepositAction } from "../../types/index.js"; /** Parameters for {@link vaultV2Deposit}. */ export interface VaultV2DepositParams { vault: { chainId: number; address: Address; asset: Address; }; args: DepositAmountArgs & { maxSharePrice: bigint; recipient: Address; requirementSignature?: PermitRequirementSignature; }; metadata?: Metadata; } /** * Prepares a deposit transaction for a VaultV2 contract. * * Routed through bundler3 to atomically execute the asset transfer and vault deposit. The * `GeneralAdapter1` enforces `maxSharePrice` on-chain to prevent inflation attacks. Never bypass * the general adapter. * * When `nativeAmount > 0`, that amount of native ETH is sent as `msg.value` to the bundler3 * multicall and wrapped into wNative via `GeneralAdapter1.wrapNative()`. The vault's underlying * asset must be the chain's wrapped native token. * * @param params.vault.chainId - The chain the vault lives on. * @param params.vault.address - The VaultV2 address. * @param params.vault.asset - The vault's underlying ERC-20 asset. * @param params.args.amount - Amount of ERC-20 assets to deposit. At least one of `amount` or * `nativeAmount` must be positive. Defaults to `0n`. * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage * protection enforced on-chain by `GeneralAdapter1`). * @param params.args.recipient - Address that receives the minted vault shares. * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval. * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the * deposit. Requires the vault asset to be the chain's wNative. * @param params.metadata - Optional analytics metadata attached to the bundle. * @returns A deep-frozen `Transaction` with `to`, `value`, `data`, and the * typed `action` discriminator the simulation layer consumes. * @throws {NegativeInputError} when `amount < 0n` or `nativeAmount < 0n`. * @throws {NonPositiveInputError} when `maxSharePrice <= 0n`, or when both `amount` and * `nativeAmount` resolve to zero. * @throws {ChainWNativeMissingError} when `nativeAmount` is provided but the chain has no * configured wNative. * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault * asset is not the chain's wNative. * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`). * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and * `requirementSignature` is provided and the signed amount differs from `args.amount`. * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a * Permit2 requirement signature is missing its expiration. * @example * ```ts * import { vaultV2Deposit } from "@morpho-org/morpho-sdk"; * * const tx = vaultV2Deposit({ * vault: { chainId: 1, address: vaultAddress, asset: USDC }, * args: { * amount: 1_000_000n, * maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x * recipient: depositor, * }, * }); * // tx satisfies Readonly> * ``` */ export declare const vaultV2Deposit: ({ vault: { chainId, address: vaultAddress, asset }, args: { amount, maxSharePrice, recipient, requirementSignature, nativeAmount, }, metadata, }: VaultV2DepositParams) => Readonly>;