Result of previewRefinance: a verdict plus every raw number behind it.

interface RefinancePreview {
    bindingConstraint: null | RefinanceBlockReason;
    currentCapacity: bigint;
    currentInterestRateBps: number;
    fee: bigint;
    feeBase: bigint;
    feeExempt: boolean;
    isRecoveryMode: boolean;
    price: bigint;
    principal: bigint;
    reasons: RefinanceBlockReason[];
    refinancingFeePercentage: number;
    resultingCapacity: bigint;
    resultingEntireDebt: bigint;
    resultingIcr: bigint;
    resultingInterestRateBps: number;
    resultingPrincipal: bigint;
    resultingTcr: bigint;
    viable: boolean;
}

Properties

bindingConstraint: null | RefinanceBlockReason

The reason that binds first, or null when viable.

currentCapacity: bigint

getTroveMaxBorrowingCapacity(owner), the capacity before the refinance (MK-101).

currentInterestRateBps: number

getTroveInterestRate(owner): the rate the Trove carries now, in basis points (MK-101).

fee: bigint

The refinancing fee in MUSD. Zero for a fee exempt account.

feeBase: bigint

The quantity the percentage is applied to: the current NET debt, entire debt minus 200.

feeExempt: boolean

Whether the account is fee exempt.

isRecoveryMode: boolean

Whether the system is in Recovery Mode right now.

price: bigint

BTC/USD used for every number above.

principal: bigint

Principal before the refinance.

Every reason it would be refused, in contract call order. Empty when viable.

refinancingFeePercentage: number

The governable refinancingFeePercentage, read live, as a whole percent.

resultingCapacity: bigint

The capacity the refinance WRITES: coll * price / (110 * 1e16) at the current price (BorrowerOperations.sol:1077-1084), unconditionally. Lower than currentCapacity when the price has fallen since the capacity was last set, which cuts every later borrow; higher when it has risen (MK-101).

resultingEntireDebt: bigint

Entire debt after the refinance.

resultingIcr: bigint

The Trove's ICR after the refinance, at the current price.

resultingInterestRateBps: number

interestRateManager.interestRate(): the rate the Trove WILL carry after the refinance, in basis points (BorrowerOperations.sol:1069, :1075). It can be higher than currentInterestRateBps, in which case the refinance raises the rate AND charges fee. The preview does not refuse that, because the contract does not; it reports it (MK-101).

resultingPrincipal: bigint

Principal after: the fee is capitalized, so it grows by exactly the fee.

resultingTcr: bigint

The system TCR the contract checks, which already includes the capitalized fee.

viable: boolean

True only when the contract would let the refinance through.