Function compound_interest
This function calculates the compound interest at the current time. This works by maintaining an internal cumulative interest rate tracker. The function converts the interest into the interest rate by the second, then compounds it based on the number of seconds that has passed since the last update to the cumulative interest rate. The change in the cumulative interest rate is then applied to the assets in the reserve. This function also calculates the amount of new debt, and a portion of that new debt is turned into spread fees for the protocol based on the configured rate.