The live borrowing capacity picture for one owner (MK-002).

Declared here rather than beside previewBorrow since MK-060: the capacity gate (:850-852) is an adjust path gate, and borrowing is a point on the adjust path rather than a sibling of it. previewBorrow re-exports this type, so the public name is unchanged.

interface BorrowingCapacity {
    capacity: bigint;
    entireDebt: bigint;
    remaining: bigint;
}

Properties

capacity: bigint

maxBorrowingCapacity as stored on chain. Set at open, lowered on a collateral decrease, and reset from the current price by every refinance, up or down (MK-101).

entireDebt: bigint

The Trove's live entire debt, principal plus accrued interest, as the gate sees it.

remaining: bigint

capacity - entireDebt, floored at zero. The headroom for draw + fee, not for the draw.

This is the distance to the liquidation threshold, and it expires in about a second (MK-072). _calculateMaxBorrowingCapacity is (coll * price) / (110 * 1e16) (BorrowerOperations.sol:1323-1328) and MCR is 1.1e18, so capacity is exactly the entire debt at which _requireICRisAboveMCR (:1330-1335) stops holding, computed at the OPENING price. A draw that consumes this figure in full therefore lands the position at ICR == MCR, where one second of accrued interest is enough to make the same call revert with BorrowerOps: An operation that would result in ICR < MCR is not permitted. Observed on a fork at 1s, 60s, 600s and 3600s, and pinned by zz-limit-figures.fork.test.ts: the exact figure sent one second after the read is refused with ExceedsBorrowingCapacity, before gas.

Why it expires loudly, where the open ceiling expired silently (MK-100). _adjustTrove brings interest current before any gate (BorrowerOperations.sol:769), so this exact figure is REFUSED a block later rather than accepted at the threshold; the refusal is loud. An open evaluates its gates with no accrual (:648-657), which is why the open time ceiling was accepted and needed a margin. A draw just UNDER this figure is still accepted near MCR, which is the reason to size draws with previewBorrow and show its resultingIcr.

Use it to render headroom, not to size a draw. To size a draw, ask previewBorrow, which evaluates the ratio gate as well as this one and correctly returns viable: false for a draw sized from this number.