How could Compound's interest accruing every block? How's that implemented?

by nrek   Last Updated April 16, 2019 01:28 AM

Here I'm referring to, which is quite an awesome product.

One thing inspires me most is that the interests accrued in Compound are updated per block. How's that even possible?

From its FAQ (

How often is interest calculated?

The interest rates you see in the Interface and Market Overview are quoted as annual interest rates. Interest accrues each Ethereum block; every ~15 seconds, your balance will increase by (1/2102400) of the quoted interest rate. Really!

I still couldn't figure out how to do that, as I'm seeing exactly it works even without frontend UI - by setting requestedAmount to be 0xff...ff.

Can someone please educate me on this? Thanks.

Related Questions

Updated October 09, 2018 12:28 PM

Updated November 28, 2018 04:28 AM

Updated December 12, 2018 08:28 AM

Updated January 10, 2019 23:28 PM

Updated July 23, 2018 00:28 AM