Interest a position accrues over a window, as the protocol computes it (MK-089).
(principal * rateBps * seconds) / (10_000 * SECONDS_PER_YEAR), floor divided, mirroring
InterestRateMath.calculateInterestOwed (InterestRateMath.sol:12-22) term for term.
One implementation, because two callers ask it.computeEntireDebt projects a
position's debt forward, and math/previewRedeem.ts sizes the accrual margin that separates
the two edges of the redemption gap. Those two used to carry the formula separately and had
DIVERGED on the base: one accrued on the principal, the other on the entire debt, which
over-states the margin by the interest already owed. docs/08-conventions.md ยง11 is the rule
that says the fix is one copy rather than two that agree today; this is that copy, and it is
the same shape as isBorrowingFeeCharged for the fee rule (MK-069).
The rate is per Trove. setTroveInterestRate is called only at open
(BorrowerOperations.sol:668-672) and at refinance (:1075), each time from the governable
interestRateManager.interestRate(), so a Trove keeps whatever the global was when it last
touched one and two Troves in the same system can carry different rates.
Interest a position accrues over a window, as the protocol computes it (MK-089).
(principal * rateBps * seconds) / (10_000 * SECONDS_PER_YEAR), floor divided, mirroringInterestRateMath.calculateInterestOwed(InterestRateMath.sol:12-22) term for term.One implementation, because two callers ask it. computeEntireDebt projects a position's debt forward, and
math/previewRedeem.tssizes the accrual margin that separates the two edges of the redemption gap. Those two used to carry the formula separately and had DIVERGED on the base: one accrued on the principal, the other on the entire debt, which over-states the margin by the interest already owed.docs/08-conventions.mdยง11 is the rule that says the fix is one copy rather than two that agree today; this is that copy, and it is the same shape as isBorrowingFeeCharged for the fee rule (MK-069).The rate is per Trove.
setTroveInterestRateis called only at open (BorrowerOperations.sol:668-672) and at refinance (:1075), each time from the governableinterestRateManager.interestRate(), so a Trove keeps whatever the global was when it last touched one and two Troves in the same system can carry different rates.