You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(irm): accrue interest before changing borrow rate bounds
Changing a market's rate cap, rate floor, or fixed borrow rate used to
take effect immediately, retroactively repricing all interest that had
accrued since the market's last update at the new value. Both IRMs now
call Moolah.accrueInterest for the market first, so elapsed interest is
settled at the bounds that were actually in effect and only future
interest uses the new ones.
Affected entry points:
- InterestRateModel: updateRateCap, updateRateFloor
- FixedRateIrm: updateRateCap, updateRateFloor, setBorrowRate
The accrual runs after the validation requires and before the storage
write. Ordering matters: Moolah calls back into the IRM's borrowRate
during accrual, so the callback must still observe the old value.
Accrual is a no-op when the market does not exist yet (lastUpdate == 0),
which keeps bounds settable ahead of market creation. FixedRateIrm needs
this in particular, since setBorrowRate is documented as running before
the market is created.
FixedRateIrm held no reference to Moolah, so it gains a MOOLAH immutable
and a constructor argument. This is a breaking constructor change: the
new implementation must be deployed via the updated scripts rather than
upgraded in place, and the address is baked into bytecode.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments