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
{{ message }}
Repository navigation
FLO-18: perSecondInterestRate() Uses Linear Instead of Logarithmic Decomposition #227
The protocol calculates the interest rate applied per second by linearly dividing the annual rate by the number of seconds in a year. However, the interest is actually applied to the global indices using an exponential compounding formula. When a linear rate is plugged into an exponential compounding function, the effective annual percentage yield (APY) can diverge significantly from the intended annual rate. This results in borrowers being overcharged and the protocol's economic model becoming increasingly inaccurate as the nominal interest rate increases.
Recommendation
To ensure that the compounded per-second rate exactly matches the intended annual rate, the protocol must use the natural logarithm to decompose the annual rate. The per-second rate should be calculated as: r_sec = ln(1 + r_annual) / 31536000 Since ln is not natively available in Cadence, the protocol should either pre-calculate the per-second rates off-chain before passing them to setInterestCurve(), or utilize a fixed-point math library capable of approximating Taylor series for logarithmic functions.
Activity
holyfuchs commentedon Mar 9, 2026
I don't think Taylor makes sense. Will clarify in the Q&A if we use nominal interest.