import { type Address } from "viem"; import type { LucidlyClient } from "./client.js"; import type { TxResult } from "./types.js"; /** Addresses of a deployed queue + its redeem solver. */ export interface QueueDeployment { queue: Address; solver: Address; } /** Decoded {@link AtomicQueue} request. */ export interface AtomicRequestView { /** unix seconds after which the request can no longer be solved. */ deadline: bigint; /** price of 1.0 whole share in `want` base units (the user's limit; fills at this or better). */ atomicPrice: bigint; /** shares the user is offering to redeem. */ offerAmount: bigint; /** true while a solve is mid-flight for this request. */ inSolve: boolean; } /** * Queued (asynchronous) redemptions via the Se7en-Seas AtomicQueue — the same mechanism syUSD * uses for withdrawals. Users post an {@link AtomicRequest} (offer shares, want an asset, at a * limit price by a deadline) and approve the queue to pull their shares. A SOLVER later unwinds * positions to free liquidity and fulfills a batch atomically through {@link LucidlyRedeemSolver}, * which burns the shares through the Teller and pays each user their `want` at the request price. * * This is the right path for vaults holding illiquid positions (Pendle, locked LPs, etc.) where the * instant Teller `bulkWithdraw` would revert for lack of free `want` liquidity. */ export declare class QueueModule { private readonly c; constructor(c: LucidlyClient); private _queue?; private _solver?; /** Point this module at an already-deployed queue + solver (e.g. a shared, multi-vault queue). */ attach(d: QueueDeployment): void; get address(): Address | undefined; get solverAddress(): Address | undefined; private requireQueue; private requireSolver; /** * Deploy an AtomicQueue + a LucidlyRedeemSolver and wire them into the active vault's * RolesAuthority: `updateAtomicRequest` becomes public (any holder can queue a request) and the * solver contract is granted SOLVER so it can drive `solve` and the Teller's `bulkWithdraw`. * * @param opts.operator EOA allowed to run solves and that supplies `want` top-up liquidity * (defaults to the signer). @param opts.owner queue admin able to pause (defaults to signer). * Run before finalizing vault ownership, or have the multisig owner perform the wiring. */ deployQueue(opts?: { operator?: Address; owner?: Address; rolesAuthority?: Address; }): Promise; /** * Post or update a redemption request. The caller offers `amount` of `offer` (the vault share * token, default = active vault) for `want`, at `price` (want base units per 1.0 whole share) and * must approve the queue to pull the shares (done automatically unless autoApprove=false). */ request(p: { want: Address | string; amount: bigint; price: bigint; offer?: Address | string; deadline?: bigint | number; }, opts?: { queue?: Address; autoApprove?: boolean; }): Promise; /** Read a user's current request for an (offer, want) pair. */ getRequest(user: Address, want: Address | string, offer?: Address | string, queue?: Address): Promise; /** True if the request is currently solvable (approved, funded, live, nonzero price/amount). */ isRequestValid(user: Address, want: Address | string, offer?: Address | string, queue?: Address): Promise; /** * Solver path: fulfill a batch of requests atomically. The solver contract pulls each user's * shares, the Teller burns them for `want` (sending proceeds to the operator), the operator tops * up the exact `want` owed, and the queue distributes it to users at their request price. * * @param p.minAssetsOut floor on Teller bulkWithdraw proceeds (solver slippage guard). * @param p.maxAssets cap on total `want` paid out across the batch (defaults to unbounded). * The operator must approve `want` to the solver contract (done automatically). */ solve(p: { want: Address | string; users: Address[]; offer?: Address | string; minAssetsOut?: bigint; maxAssets?: bigint; }, opts?: { queue?: Address; solver?: Address; teller?: Address; autoApprove?: boolean; }): Promise; }