import { Fraction } from './fraction'; /** The flavor of a rollover, resolved from the source borrow's config and the source/target reserve kinds. */ export type RolloverMode = 'fixedToFixed' | 'fixedToOpen' | 'openToFixed'; /** Why a rollover is not possible, mirroring the program's rollover preconditions. */ export type RolloverImpossibleReason = 'SourceBorrowNotFound' | 'LiquidityMintMismatch' | 'SourceReserveNotActive' | 'TargetReserveNotActive' | 'ObligationInElevationGroup' | 'MarketInEmergencyMode' | 'BorrowingDisabled' | 'ObligationBorrowingDisabled' | 'ObligationMarkedForDeleveraging' | 'ObligationHasObsoleteReserves' | 'TargetReserveDebtMaturityReached' | 'TargetBorrowFactorMismatch' | 'AutoRolloverNotEnabled' | 'OpenTermTargetNotAllowed' | 'MigrationToFixedNotEnabled' | 'MigrationTargetNotFixedTerm' | 'TargetReserveOpenTermOnly' | 'TargetBorrowRateTooHigh' | 'TargetDebtTermTooShort' | 'RolloverExecutionDisabled' | 'OutsideRolloverWindow' | 'RolloverNotApplicable' | 'ExistingTargetBorrowConfigMismatch' | 'ExistingTargetBorrowTermNotProlonged' | 'InsufficientTargetLiquidity' | 'PartialRolloverValueTooSmall' | 'ObligationBorrowValueExceeded'; /** * Result of {@link KaminoObligation.checkRolloverPossible}, a best-effort preflight eligibility check. * * On success, `mode` is the resolved rollover flavor, `isFullRollover` is true when the target reserve can * absorb the entire position (false when only a partial rollover fits the target's borrowable liquidity), and * `rollableAmount` is the liquidity amount (in the shared mint's lamports) that would actually be rolled over. * * On failure, `reason` is the first failing precondition. The check covers the program's rollover * preconditions (account/mint/reserve status, elevation group, borrow flags, borrow factor, the source * borrow's rollover-config opt-in and target rate/term criteria, the rollover execution window and timing, * the borrowable-liquidity caps / partial-rollover minimum, the same-reserve liquidity rule, the merge rules * for a reserve the obligation already borrows from, and the post-rollover borrow-value headroom). * * It is preflight, not an exact replica of the program: it reads the SDK's last-loaded reserve/obligation * state (the borrowable-liquidity and borrow-value math itself mirrors the on-chain fixed-point arithmetic), * and it does NOT evaluate the in-transaction freshness conditions * (reserve/obligation refreshed this slot, which the rollover transaction guarantees by refreshing inline), * the reserve program version, token-2022 mint extensions, or obligation-order support. The last means a * *partial* rollover into a reserve the obligation does not yet borrow adds a second debt, which the program * rejects when the obligation has an order requiring a single debt (a debt/collateral price-ratio stop-loss / * take-profit, or a single-debt deleverage order); such orders must be cancelled first. Treat `possible: true` * as eligible pending execution rather than a guarantee. */ export type RolloverPossibility = { possible: true; mode: RolloverMode; isFullRollover: boolean; rollableAmount: Fraction; } | { possible: false; mode: null; reason: RolloverImpossibleReason; }; //# sourceMappingURL=rolloverTypes.d.ts.map