import { type ethers } from "ethers"; import { type ContractProvider } from "../../utils"; import type { DeployAdapterResult } from "./GlobalAdapters"; export interface MarketParams { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; } /** Snapshot of a Morpho V1 market. Assets in loanToken units, rates 1e18 WAD. */ export interface MorphoMarketState { marketParams: MarketParams; totalSupplyAssets: bigint; totalSupplyShares: bigint; totalBorrowAssets: bigint; totalBorrowShares: bigint; lastUpdate: bigint; fee: bigint; /** totalBorrowAssets * 1e18 / totalSupplyAssets (0 if no supply). */ utilization: bigint; /** totalSupplyAssets - totalBorrowAssets. */ liquidity: bigint; /** Per-second supply rate in WAD, derived from borrowRateView * util * (1 - fee). */ supplyRatePerSec: bigint; } export declare function deployMorphoMarketV1AdapterV2(cp: ContractProvider, vaultAddress: string): Promise; export declare function isMorphoMarketV1AdapterV2(cp: ContractProvider, account: string): Promise; export declare function findMorphoMarketV1AdapterV2(cp: ContractProvider, vaultAddress: string): Promise; /** Read the morpho address baked into the factory. */ export declare function getFactoryMorpho(cp: ContractProvider): Promise; /** Read the adaptive-curve IRM address baked into the factory. */ export declare function getFactoryAdaptiveCurveIrm(cp: ContractProvider): Promise; export declare function getIds(contract: ethers.Contract, marketParams: MarketParams): Promise; /** Read the on-chain `adapterId` (bytes32) baked into the deployed adapter. */ export declare function getAdapterId(contract: ethers.Contract): Promise; export declare function getUnderlying(contract: ethers.Contract): Promise; export declare function getMarketIdsLength(contract: ethers.Contract): Promise; export declare function getMarketId(contract: ethers.Contract, index: number): Promise; export declare function getSkimRecipient(contract: ethers.Contract): Promise; /** * Vault-side tracked allocation for one market (the `this/marketParams` id). * Lazy: only resynced to the real position on (de)allocate, so it excludes * interest/losses accrued since the last interaction. Use * `getExpectedSupplyAssets` for the live per-market value. */ export declare function getAllocation(contract: ethers.Contract, marketParams: MarketParams): Promise; /** * Live value of the adapter's position on one market by `id` (bytes32 hash), * in loan asset units, pending interest included. Exactly the per-market * term of `realAssets`. */ export declare function getExpectedSupplyAssets(contract: ethers.Contract, id: string): Promise; /** Adapter's raw supply shares on one market by `id` (bytes32 hash). */ export declare function getSupplyShares(contract: ethers.Contract, id: string): Promise; /** Loan asset (the parent vault's asset) supplied to the markets. */ export declare function getAsset(contract: ethers.Contract): Promise; /** Adaptive-curve IRM address baked into the deployed adapter. */ export declare function getAdaptiveCurveIrm(contract: ethers.Contract): Promise; /** Timelock duration (seconds) for a given selector on this adapter. */ export declare function getTimelock(contract: ethers.Contract, selector: string): Promise; /** Whether `selector` has been permanently abdicated (i.e. timelock-locked-forever). */ export declare function getAbdicated(contract: ethers.Contract, selector: string): Promise; /** When the previously-submitted call payload `data` becomes executable (unix sec). */ export declare function getExecutableAt(contract: ethers.Contract, data: string): Promise; /** * Read the live state of a single Morpho V1 market by `id` (the bytes32 hash). * Resolves marketParams via `morpho.idToMarketParams(id)`, then pulls totals * and the IRM's borrow rate to derive utilization + supply rate. * * Returns the *stored* state (not interest-accrued past `lastUpdate`). */ export declare function getMarketState(contract: ethers.Contract, id: string): Promise; /** Schedule a timelocked call. `data` = the encoded function call to execute later. */ export declare function submit(contract: ethers.Contract, data: string): Promise; /** Cancel a previously submitted call before it executes. */ export declare function revoke(contract: ethers.Contract, data: string): Promise; /** Permanently disable `selector` on this adapter. Irreversible. */ export declare function abdicate(contract: ethers.Contract, selector: string): Promise; /** Increase the timelock for `selector`. Not itself timelocked. */ export declare function increaseTimelock(contract: ethers.Contract, selector: string, newDuration: bigint): Promise; /** Decrease the timelock for `selector`. Itself timelocked — must be `submit`'d first. */ export declare function decreaseTimelock(contract: ethers.Contract, selector: string, newDuration: bigint): Promise; /** Timelocked — must be `submit`'d first. */ export declare function setSkimRecipient(contract: ethers.Contract, newSkimRecipient: string): Promise; export declare function skim(contract: ethers.Contract, token: string): Promise; /** * Write off the adapter's recorded supply shares on a market (sets them to * 0), e.g. after bad debt. Timelocked, must be `submit`'d first. Follow up * with a `deallocate(market, 0)` on the vault to resync its allocation. */ export declare function burnShares(contract: ethers.Contract, id: string): Promise;