ReadonlyaddressesReadonlychainReadonlycontractsReadonlyfixedThe bundled fixed constants (synchronous, no network).
addColl(hints) payable, top up collateral.
adjustTrove(...), combined collateral ± and/or debt ± (validated).
Liquidate several Troves in one call.
withdrawMUSD(amount, hints), borrow more (mint).
claimCollateral(), claim surplus; a safe no-op when there is none.
closeTrove(), full payoff (needs entireDebt − 200 MUSD; returns 200 + collateral).
Project entire debt with simple time-based interest. Pure.
The insertion-hint ritual → { upperHint, lowerHint, nicr } for a position of the given shape.
(collateral × price) / entireDebt (== contract computeCR). Pure.
Price at which a position hits MCR = (MCR × entireDebt) / collateral. Pure.
Nominal collateral ratio (collateral × 1e20) / principal (pure, no network). The sorted list is
keyed on PRINCIPAL, never on the entire debt (MK-006, MK-090).
The largest open draw that survives a price fall and a holding horizon the CALLER chooses
(MK-240). Both inputs are required and have no default; how long a position is held and how far
the price may fall are the holder's choices, not the library's. Returns the ceiling beside it and
the margin it was solved with. The price history for choosing the inputs is on drawForMargin in
math/getBorrowingPower.ts and in docs/03-core-api.md.
Live maxBorrowingCapacity, live entire debt, and the remaining headroom (MK-002).
The contract's ceiling for an open at this collateral (MK-100, MK-240): the largest draw accepted
right now with NO margin, which in normal mode opens at exactly the 110% liquidation threshold.
A limit to display, never an amount to borrow, and there is no amount to borrow on this
result. For a draw sized to a margin, call drawForMargin. An open time calculator only; for an
existing Trove use previewBorrow.
Read the governable constants, returned together with the fixed ones, cached for
constantsTtlMs (default DEFAULT_CONSTANTS_TTL_MS, 60 seconds). Also runs
verifyDeployment once.
The cache is time bounded because minNetDebt and the interest rate are governable and
used to be held for the lifetime of the client, so a long lived process could act on a
stale floor indefinitely (MK-012).
Protocol-wide live state, { tcr, isRecoveryMode, price, blockNumber }, from one block (MK-013).
Drop the cached governable constants, so the next getConstants re-reads them (MK-012).
For when you know something changed and do not want to wait out the TTL: a governance event observed in a log subscription, or a test that wants a deterministic re-read. It does NOT clear the deployment verification, which is memoized for the client's lifetime on purpose: a wiring pointer changing is a redeployment, not a governance action.
Whether liquidate(address) would liquidate the Trove now: getCurrentICR < MCR in BOTH modes, and
not the last Trove in the system (MK-001, MK-074). The protocol has no Recovery Mode widening
(TroveManager.sol:1146-1148).
Liquidate one Trove; throws NothingToLiquidate if it isn't liquidatable.
MK-042. The largest withdrawal the contract accepts now, and which gate caps it.
openTrove(debt, hints) payable, opens a Trove with hints absorbed.
MK-042. The combined adjust path: every ratio and mode gate, with the raw numbers.
Preview borrowing against an EXISTING Trove (MK-002): verdict, binding constraint, the
capacity picture, and the resulting ratios. Use this rather than getBorrowingPower,
which is an open time calculator.
MK-042. Closing, whose gate set is its own and two of whose gates are conditional.
Preview opening a Trove: an explicit verdict plus fee, debt, ICR, and liquidation price.
MK-048. What a single redeemCollateral call will ACTUALLY redeem, by walking the sorted
list the way the loop does. Not getRedemptionHints, which answers a different question and
over-reports in the gap between a Trove's headroom and its whole net debt.
Preview refinancing (MK-003, MK-019): the fee, the resulting principal and ICR, and a verdict that is false when the contract would refuse, Recovery Mode included.
MK-042. A pure collateral withdrawal. Refused OUTRIGHT in Recovery Mode.
Redeem MUSD for BTC (hints + governable fee + truncation surfaced).
refinance(hints), move to the current global rate (adds a refinancing fee).
repayMUSD(amount, hints), reduce debt (no approval needed).
Assert the contracts at the resolved addresses really are a consistent MUSD deployment
(MK-008): code present at all seven bundled addresses, all fourteen cross wiring
pointers resolving to that same map, HintHelpers.priceFeed() still unset, and
MCR/CCR equal to the bundled fixed constants. One multicall, memoized after the
first success, and awaited automatically before the first write.
Calling it yourself is only necessary if you want the check to happen at a moment you choose, for example right after constructing a client against an overridden address map.
withdrawColl(amount, hints), take collateral out.
The
createMusdClientsurface: live reads, preview math, hints, lifecycle writes, and the redemption/keeper functions, all bound to one chain + clients.