import { AccrualPosition, AccrualVault, AccrualVaultV2, AccrualVaultV2MorphoVaultV1Adapter, type Address, AssetBalances, type Holding, type Market, type MarketId, type MaxBorrowOptions, type MaxWithdrawCollateralOptions, type PeripheralBalanceType, type Position, type Token, type User, type Vault, type VaultMarketConfig, type VaultUser, type VaultV2, type VaultV2Adapter, WrappedToken } from "@morpho-org/blue-sdk"; import { type MaybeDraft } from "./handlers/index.js"; /** * The default maximum utilization allowed to reach to find shared liquidity (scaled by WAD). */ export declare const DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = 920000000000000000n; export interface PublicAllocatorOptions { enabled?: boolean; reallocatableVaults?: Address[]; /** * The maximum utilization of each market allowed to reach to find shared liquidity (scaled by WAD). */ maxWithdrawalUtilization?: Record; /** * The default maximum utilization allowed to reach to find shared liquidity (scaled by WAD). * @default 92% */ defaultMaxWithdrawalUtilization?: bigint; delay?: bigint; } export interface PublicReallocation { id: MarketId; vault: Address; assets: bigint; } export interface MinimalBlock { number: bigint; timestamp: bigint; } export interface InputSimulationState { chainId: number; block: MinimalBlock; global?: { feeRecipient?: Address; }; markets?: Record; users?: Record; tokens?: Record; vaults?: Record; /** * Positions indexed by user then by market. */ positions?: Record>; /** * Holdings indexed by user then by token. */ holdings?: Record>; /** * VaultMarketConfigs indexed by vault then by market. */ vaultMarketConfigs?: Record>; /** * VaultUsers indexed by vault then by user. */ vaultUsers?: Record>; vaultV2s?: Record; vaultV2Adapters?: Record; } export declare class SimulationState implements InputSimulationState { readonly chainId: number; block: MinimalBlock; readonly global: { feeRecipient?: Address; }; readonly markets: Record; readonly users: Record; readonly tokens: Record; readonly vaults: Record; /** * Positions indexed by user then by market. */ readonly positions: Record>; /** * Holdings indexed by user then by token. */ readonly holdings: Record>; /** * VaultMarketConfigs indexed by vault then by market. */ readonly vaultMarketConfigs: Record>; /** * VaultUsers indexed by vault then by user. */ readonly vaultUsers: Record>; readonly vaultV2s: Record; readonly vaultV2Adapters: Record; constructor({ chainId, block: { number, timestamp }, global: { feeRecipient }, markets, users, tokens, vaults, positions, holdings, vaultMarketConfigs, vaultUsers, vaultV2s, vaultV2Adapters, }: InputSimulationState); getMarket(marketId: MarketId): Market; tryGetMarket(marketId: MarketId): Market | undefined; getUser(address: Address): User; tryGetUser(address: Address): User | undefined; getToken(address: Address): Token; tryGetToken(address: Address): Token | undefined; getVault(address: Address): Vault; tryGetVault(address: Address): Vault | undefined; getAccrualVault(address: Address): AccrualVault; tryGetAccrualVault(address: Address): AccrualVault | undefined; getPosition(user: Address, market: MarketId): Position; tryGetPosition(user: Address, market: MarketId): Position | undefined; getAccrualPosition(user: Address, marketId: MarketId): AccrualPosition; tryGetAccrualPosition(user: Address, marketId: MarketId): AccrualPosition | undefined; getHolding(user: Address, token: Address): Holding; tryGetHolding(user: Address, token: Address): Holding | undefined; getVaultMarketConfig(vault: Address, market: MarketId): VaultMarketConfig; tryGetVaultMarketConfig(vault: Address, market: MarketId): VaultMarketConfig | undefined; getVaultUser(vault: Address, user: Address): VaultUser; tryGetVaultUser(vault: Address, user: Address): VaultUser | undefined; getWrappedToken(address: Address): WrappedToken; tryGetWrappedToken(address: Address): WrappedToken | undefined; getVaultV2Adapter(address: Address): VaultV2Adapter; tryGetVaultV2Adapter(address: Address): VaultV2Adapter | undefined; getAccrualVaultV2Adapter(address: Address): AccrualVaultV2MorphoVaultV1Adapter; tryGetAccrualVaultV2Adapter(address: Address): AccrualVaultV2MorphoVaultV1Adapter | undefined; getVaultV2(address: Address): VaultV2; tryGetVaultV2(address: Address): VaultV2 | undefined; getAccrualVaultV2(address: Address): AccrualVaultV2; tryGetAccrualVaultV2(address: Address): AccrualVaultV2 | undefined; getBundleBalance(user: Address, token: Address, accountBundlerBalance?: boolean): bigint | undefined; getBundleMaxBalance(user: Address, token: Address, slippage?: bigint, disabledPeripheralTokens?: Set): bigint | undefined; getBundleMaxCapacities(user: Address, marketId: MarketId, slippage?: bigint, publicAllocatorOptions?: PublicAllocatorOptions, disabledPeripheralTokens?: Set, maxCapacitiesOptions?: { borrow?: MaxBorrowOptions; withdrawCollateral?: MaxWithdrawCollateralOptions; }): import("@morpho-org/blue-sdk").MaxPositionCapacities | undefined; getBundleAssetBalances(user: Address, token: Address, slippage?: bigint, accountBundlerBalance?: boolean): AssetBalances | undefined; /** * Calculates the public reallocations required to reach the maximum liquidity available according to some reallocation algorithm. * @param marketId The market on which to calculate the shared liquidity. * @param options The options for the reallocation. * @returns The array of withdrawals to perform and the end simulation data. * @warning The end SimulationData may have incorrectly accrued some fee from public reallocations multiple times. */ getMarketPublicReallocations(marketId: MarketId, { enabled, reallocatableVaults, defaultMaxWithdrawalUtilization, maxWithdrawalUtilization, delay, }?: PublicAllocatorOptions): { withdrawals: PublicReallocation[]; data: MaybeDraft; }; }