import { type RoundingDirection } from "../math/index.js"; import type { BigIntish } from "../types.js"; /** ERC-4626 virtual share and asset conversion helpers for MetaMorpho vaults. */ export declare namespace VaultUtils { /** Virtual assets added to ERC-4626 total assets in conversion formulas. */ const VIRTUAL_ASSETS = 1n; /** * Returns the decimals offset between 18-decimal vault shares and an asset. * * @param decimals - The asset decimals. * @returns The non-negative decimals offset. * @example * ```ts * import { VaultUtils } from "@morpho-org/blue-sdk"; * * const offset = VaultUtils.decimalsOffset(6n); * // offset === 12n * ``` */ function decimalsOffset(decimals: BigIntish): bigint; /** * Converts vault shares to underlying assets. * * @param shares - The amount of vault shares. * @param vault.totalAssets - The vault's total assets. * @param vault.totalSupply - The vault's total share supply. * @param vault.decimalsOffset - The vault's decimals offset. * @param rounding - Optional rounding direction. Defaults to `"Down"`. * @returns The equivalent amount of underlying assets. * @example * ```ts * import { VaultUtils } from "@morpho-org/blue-sdk"; * * const assets = VaultUtils.toAssets(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n }); * // assets satisfies bigint * ``` */ function toAssets(shares: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: { totalAssets: BigIntish; totalSupply: BigIntish; decimalsOffset: BigIntish; }, rounding?: RoundingDirection): bigint; /** * Converts underlying assets to vault shares. * * @param assets - The amount of underlying assets. * @param vault.totalAssets - The vault's total assets. * @param vault.totalSupply - The vault's total share supply. * @param vault.decimalsOffset - The vault's decimals offset. * @param rounding - Optional rounding direction. Defaults to `"Up"`. * @returns The equivalent amount of vault shares. * @example * ```ts * import { VaultUtils } from "@morpho-org/blue-sdk"; * * const shares = VaultUtils.toShares(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n }); * // shares satisfies bigint * ``` */ function toShares(assets: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: { totalAssets: BigIntish; totalSupply: BigIntish; decimalsOffset: BigIntish; }, rounding?: RoundingDirection): bigint; }