import type { Address, ChainId, MarketParams, Token } from "@morpho-org/blue-sdk"; import type { ActionBundle } from "@morpho-org/bundler-sdk-viem"; import type { BorrowMigrationLimiter, MigratableProtocol, MigrationTransactionRequirement, SupplyMigrationLimiter } from "../../types/index.js"; /** * Namespace containing argument definitions for Migratable Borrow Position. */ export declare namespace MigratableBorrowPosition { /** * Arguments required for building a migration operation. */ interface Args { /** The collateral amount to migrate. */ collateralAmount: bigint; /** The borrow amount to migrate. */ borrowAmount: bigint; /** The market to migrate to. */ marketTo: MarketParams; /** Slippage tolerance for the current position (optional). */ slippageFrom?: bigint; /** The maximum amount of borrow shares mint (protects the sender from unexpected slippage). */ minSharePrice: bigint; } } /** * Interface representing the structure of a migratable borrow position. */ export interface IMigratableBorrowPosition { /** The chain ID where the position resides. */ chainId: ChainId; /** The protocol associated with the borrow position. */ protocol: MigratableProtocol; /** The user's address. */ user: Address; /** The token being used as collateral. */ collateralToken: Token; /** The loan token being borrowed. */ loanToken: Token; /** The total collateral balance of the position. */ collateral: bigint; /** The total borrow balance of the position. */ borrow: bigint; /** The annual percentage yield (APY) of the collateral position. */ collateralApy: number; /** The annual percentage yield (APY) of the borrow position. */ borrowApy: number; /** The maximum collateral migration limit and its corresponding limiter. */ maxWithdraw: { value: bigint; limiter: SupplyMigrationLimiter; }; /** The maximum borrow migration limit and its corresponding limiter. */ maxRepay: { value: bigint; limiter: BorrowMigrationLimiter; }; /** The liquidation loan to value (LLTV) of the market */ lltv: bigint; /** Whether the migration adapter is authorized to manage user's position on blue */ isBundlerManaging: boolean; /** User nonce on morpho contract */ morphoNonce: bigint; } /** * Abstract class representing a migratable borrow position. */ export declare abstract class MigratableBorrowPosition implements IMigratableBorrowPosition { readonly protocol: MigratableProtocol; readonly user: `0x${string}`; readonly loanToken: Token; readonly borrow: bigint; readonly borrowApy: number; readonly chainId: ChainId; readonly collateralToken: Token; readonly collateral: bigint; readonly collateralApy: number; readonly maxRepay: { value: bigint; limiter: BorrowMigrationLimiter; }; readonly maxWithdraw: { value: bigint; limiter: SupplyMigrationLimiter; }; readonly lltv: bigint; readonly isBundlerManaging: boolean; readonly morphoNonce: bigint; /** * Creates an instance of MigratableBorrowPosition. * * @param config - Configuration object containing the position details. */ constructor(config: IMigratableBorrowPosition); abstract getLtv(options?: { withdrawn?: bigint; repaid?: bigint; }): bigint | null; protected abstract _getMigrationTx(args: MigratableBorrowPosition.Args, supportsSignature: boolean): ActionBundle; /** * Method to retrieve a migration operation for the borrow position. * * @param args - The arguments required to execute the migration. * @param chainId - The chain ID of the migration. * @param supportsSignature - Whether the migration supports signature-based execution. * * @returns A migration bundle containing the migration details. */ getMigrationTx(args: MigratableBorrowPosition.Args, supportsSignature: boolean): ActionBundle; private _validateMigration; }