import { type Address, type Hex } from "viem"; import type { LucidlyClient } from "./client.js"; import type { TxResult } from "./types.js"; /** * LucidlyFactoryV2 — the permissionless vault factory (v2.4.2 is the current live version). Same * address on every chain (Arachnid CREATE2 — verified live on Ethereum, Base, Arbitrum, Optimism), * so callers don't need to plumb a per-chain address through. One `deployVault(params)` tx deploys * the full stack (RolesAuthority, BoringVault, Manager, Accountant, Teller, PolicyManager + DC-15's * BoringOnChainQueue + BoringSolver + DC-16's per-vault MorphoFlashLoanAdapter), grants the right * roles to each contract, finalises ownership to the registry owner, and emits `VaultDeployed`. * The deployer becomes the strategist; the registry owner becomes the vault owner and the * streaming-mgmt-fee recipient. * * v2.4.2 additions over v2.3: * - DC-14: strategist receives STRATEGIST_ROOT_ROLE → can call manager.setManageRoot in ONE tx * (off-chain Merkle root seed instead of N sequential addRegistryPolicy calls). * - DC-15: each vault gets its own BoringOnChainQueue + BoringSolver — queued user withdrawals * via queue.requestOnChainWithdraw, fulfilment via solver.boringRedeemSelfSolve. * - DC-16: each vault gets its own MorphoFlashLoanAdapter (wired to morpho/vault/manager * immutables) — flashloan strategies work from tx-1 with zero post-deploy ops. * * v2.4.3 additions over v2.4.2: * - DC-17: when allowPublicDeposits=true the factory now sets the deposit/depositWithPermit * public capability on the per-vault RolesAuthority — fixes the UNAUTHORIZED revert that * prevented non-owner EOAs from depositing into "public" v2.4.2 vaults. * * Mirrors `window.LucidlyChain.deployVault` in the Pro UI byte-for-byte (same DeployParams tuple, * same FACTORY address, same VaultDeployed shape), so the two surfaces produce identical vaults. * * v2.4.2 (0xFC93bC7e…) and v2.3 (0x6612E3DE…) are fully deprecated. SDK 0.3.1 only targets v2.4.3. */ export declare const FACTORY_V2_ADDRESS: Address; /** DeployParams — must match LucidlyFactoryV2.DeployParams exactly. */ export interface FactoryV2DeployParams { /** CREATE2 salt — defaults to keccak256(`lucidly:${name}:${symbol}:${chainId}`) if omitted. */ salt?: Hex; name: string; symbol: string; baseAsset: Address; /** Initial NAV in baseAsset decimals (USDC = 6 → 1_000_000 = 1.0). */ startingRate: bigint; /** Upper bound on per-update rate change, on the 1e4 scale (10_050 = +0.5%). */ upperBoundBps: number; lowerBoundBps: number; minUpdateDelay: number; performanceFeeBps: number; shareLockSeconds: bigint; rateUpdater: Address; solver: Address; depositAssets: readonly Address[]; allowPublicDeposits: boolean; } export declare const FACTORY_V2_ABI: readonly [{ readonly type: "function"; readonly name: "deployVault"; readonly stateMutability: "nonpayable"; readonly inputs: readonly [{ readonly name: "p"; readonly type: "tuple"; readonly components: readonly [{ readonly name: "salt"; readonly type: "bytes32"; }, { readonly name: "name"; readonly type: "string"; }, { readonly name: "symbol"; readonly type: "string"; }, { readonly name: "baseAsset"; readonly type: "address"; }, { readonly name: "startingRate"; readonly type: "uint96"; }, { readonly name: "upperBoundBps"; readonly type: "uint16"; }, { readonly name: "lowerBoundBps"; readonly type: "uint16"; }, { readonly name: "minUpdateDelay"; readonly type: "uint24"; }, { readonly name: "performanceFeeBps"; readonly type: "uint16"; }, { readonly name: "shareLockSeconds"; readonly type: "uint64"; }, { readonly name: "rateUpdater"; readonly type: "address"; }, { readonly name: "solver"; readonly type: "address"; }, { readonly name: "depositAssets"; readonly type: "address[]"; }, { readonly name: "allowPublicDeposits"; readonly type: "bool"; }]; }]; readonly outputs: readonly []; }]; /** Parsed vault stack returned from a successful `deploy()`. */ export interface FactoryV2DeployResult { vault: Address; strategist: Address; rolesAuthority: Address; manager: Address; accountant: Address; teller: Address; policyManager: Address; baseAsset: Address; /** v2.4.2 (DC-15): per-vault BoringOnChainQueue — users call requestOnChainWithdraw here. */ queue: Address; /** v2.4.2 (DC-15): per-vault BoringSolver — strategist + off-chain bots call boringRedeemSelfSolve. */ solver: Address; /** v2.4.2 (DC-16): per-vault MorphoFlashLoanAdapter. Zero on chains without Morpho. */ flashLoanAdapter: Address; salt: Hex; txHash: Hex; } export declare class FactoryV2Module { private readonly client; constructor(client: LucidlyClient); /** Chain-invariant factory address. Exposed for callers that need to display it. */ address(): Address; /** * Deploy a new v2.3 vault. Sends `factory.deployVault(params)`, waits for the receipt, decodes * `VaultDeployed`, and returns the parsed stack. Requires a signer. */ deploy(params: FactoryV2DeployParams): Promise; /** Tx-only deploy: send and return { hash, wait } without parsing logs. */ deployTx(params: FactoryV2DeployParams): Promise; }