How much collateral can be withdrawn right now, and what stops more.

interface MaxWithdrawable {
    amount: bigint;
    capacityAfter: CapacityAfter;
    collateral: bigint;
    icrThreshold: bigint;
    isRecoveryMode: boolean;
    limitedBy: null | "RECOVERY_MODE" | "ICR" | "TCR";
    price: bigint;
    resultingIcr: bigint;
}

Properties

amount: bigint

BTC wei that can be withdrawn in a single withdrawCollateral call. Zero in Recovery Mode, where _requireNoCollWithdrawal (:1270) refuses any withdrawal at all.

Good for the block it was computed at and no block a caller can reach (MK-051, MK-073). The cap is bounded by ICR >= MCR against a debt that GROWS with accrued interest, so this figure SHRINKS: measured on a fork with only the delay varied, the reported maximum was accepted at 0s and refused with InsufficientCollateral at 1s, 60s, 600s, 3600s and 86400s, with half the maximum succeeding throughout as the control.

The SDK refuses it before sending rather than spending gas on it, so the cost is a typed error and not a failed transaction. Withdraw less than this, or recompute at the point of use. MK-051 carries the measurement.

A limit, not an amount to withdraw (MK-247): when the individual ratio caps it, a withdrawal that is accepted at it leaves the Trove at MCR, where liquidation begins (TroveManager.sol:1146-1148).

capacityAfter: CapacityAfter

The borrowing capacity a withdrawal of amount leaves, and what it removes (MK-242). A withdrawal stores min(current, (collateral - amount) * price / 1.1) (BorrowerOperations.sol:879-899) and adding the collateral back never raises it (:880), so withdrawing the maximum during a price fall can cut every later borrow until a refinance, whose cost is in recovery.

collateral: bigint

The collateral the Trove holds now.

icrThreshold: bigint

MCR normally, CCR in Recovery Mode.

isRecoveryMode: boolean
limitedBy: null | "RECOVERY_MODE" | "ICR" | "TCR"

Which gate caps it, or null when nothing does and the whole balance can come out.

price: bigint
resultingIcr: bigint

The ICR the Trove would have at amount, which is icrThreshold when ICR is the cap.