# Open Money Market: Interest rate model

This article is written primarily for the benefit of the internal team at Konkrete to further their high level understanding of the technology and business.

The Open Money Market (OMM) protocol is designed to enable someone with a type of an asset to use it as collateral and borrow another asset. This is predicated on the lenders being willing to make the loan by accepting the borrowers assets as collateral.

The protocol is designed to support Assets represented as ERC20 tokens only and is heavily inspired by the Compound protocol.

Consider 5 people, A, B, C, D, E with varying amounts of ERC20 tokens called TK1, TK2, TK3, TK4 and TK5 respectively.

The current market price of each token in $ is as follows:

Which means the actual worth of each of the tokens held are as follows

However price is only part of the story. Some tokens might be more liquid than others, while others might not command a readily available market despite having a high price. In addition some tokens might be far more volatile than others leading to huge price changes.

This effectively means you need another parameter that reflects the confidence in the value of the asset. This is represented as the Collateral factor which can vary between 0.1 to 0.9 (or a fraction of the original assets value).

A highly stable asset with strong liquidity will have a high collateral factor and another asset with lower liquidity and high price volatility would have a lower collateral factor.

For our example, consider the following:

Hence the true net worth of each asset would be number of tokens*price*collateral factor

The value of each tokens can be summed up to come up with a true net worth of each person.

This is also effectively the total borrowing ability of each.

Consider A wants to borrow 20 TK1 tokens. They are priced at 10 each, which means they are worth $200.

A has a borrowing ability of $3250 which is much in excess of that so he will be able to borrow those tokens from the pool.

There are currently 150 tokens of each type on the market.

If A borrows 20 TKN1 our of the 150, that means those 20 have been *utilized** *on the loan and are now earning interest.

This is captured in the utilization rate which is calculated as:

Borrowed/Total Supply

which in this case becomes 20/150 or a utilization ratio of 13%

Consider that someone else now wants to borrow 20 more, in that case the total tokens lent out to borrowers becomes 20+20=40. The utilization rate in turn becomes 40/150 = 26%

A higher utilization rate reflects greater demand for a certain asset.

The way to balance this demand is to incentivize suppliers (or those who hold the asset currently) to participate in the market and disincentivize borrowers.

This can be done by making the interest rates a function of the utilization rate.

The greater the utilization rate, the higher the interest rate which increases the returns to the suppliers of the asset and makes it more expensive to borrow.

This would effectively increase the supply and reduce the borrowings bringing the market back in to balance.

The interest rate is directly proportional to the utilization rate.

However the rate of increase of the interest rate vs the utilization rate is effectively equal to the slope of the line shown above.

It is upto the admin of the system to determine what this rate should be. It can be more or less depending upon what the admin fancies.

This rate is captured in an input parameter called ** multiplier**. Admin provides an annual input value called

*MultiplierPerYear.*Note that the interest rate is never allowed to be zero. Even if the utilization rate is 0 the base interest rate is always a value in excess of 0. This is done primarily to avoid division by zero errors.

Admin gets to decide how much the base interest rate is and provides a per year input parameter called BaseInterestRatePerYear.

Interest rate = Base rate + utilization rate * multiplier

Note that above values are entered as annual or per year input parameters.

Every transaction that impacts the supply and demand of the assets, such as adding more tokens, or redeeming some or repaying etc has an impact on the utilization rate.

Ethereum has a block time of about 15 seconds. Which means every 15 seconds there is a potential impact to the utilization rate, which in turn would impact the interest rates.

Hence while calculating the interest due, it is not done at an annual calculation, but rather calculated once per block. The year is divided into a number of 15 second blocks ( 2102400 to be exact).

The total interest due is then a summation of all the interests due per block.

The interest for a block is calculated as

principal (p) * Interest rate (r) * time (t)

or

p*r*t

However summing this up misses on an important part.

The borrower in this model is not paying up the interest as it comes due. This can be great for those with lumpy outcomes such as real estate development which has all the cash come at the end of the project but during the development it is cash negative leaving no funds for servicing interest.

However if you are not paying the interest then it is only fair that it gets added to the original borrowing amount.

Hence the principal at any block is the original principal + the interest accrued till the previous block.

or

Pn= Pn-1 + Pn-1*r*t

and

Pn-1 = Pn-2 + Pn-2*r*t

and so on…

Hence,

Pn = Pn-1 (1 + r*t)

Note that for the above calculations r is calculated as rate per block, which means the original input parameters of multiplier rate and base rate are divided by the number of blocks per year. This is done to ensure that the variance in interest rates due to changing supply and demand is captured at a granular level as explained before.

A portion of the interest keeps getting added to the protocols ** reserves **which is expected to support ongoing development of the system.

When someone puts up their tokens for lending up they receive equivalent “c” tokens.

For eg: cDAI for DAI, cETH for ETH and so on.

These cTokens represent their ownership of the portion of the lending pool.

As the borrowings steadily go up, the interest owed to the pool starts getting accumulated which progressively increases the size of the pool.

Size of pool = Cash + Total Borrowings — Reserves

Total borrowings = Initial amount borrowed + Interest accumulated till date

Any time a borrower repays the loan the cash amount in the pool increases.

While the amount is not yet paid, it keeps accumulating compound interest leading to an increase in the Total borrowings.

When money is being lent out the pool keeps increasing, which in turn means the value of the cTokens that represent ownership of the pool steadily increases as well.

The exchange rate of cTokens to the underlying tokens deployed, hence steadily increases.

Consider the following example,

The initial exchange rate of TK1 to cTK1 tokens is set to 1. There are 150 TK1 tokens.

When 20 of these are lent out, the cash drops to 130 and amount lent out increases to 20.

150 cTK1 tokens are minted with an exchange rate of 1 cTK1 : 1 TK1.

Consider that after a period of time the interest on these 20 tokens has come to 5 tokens.

Hence the total borrowings now are 20+5=25

Ignoring reserves, the size of the pool is now 130 + 25 = 155.

The exchange rate of cTK1 to TK1 = 155/150 = 1.033

As more interest keeps getting accumulated this exchange rate steadily creeps upwards.

Any one who holds cTK1 can redeem it for TK1 provided the system has enough liquidity to support that request. Redeeming effectively takes money out of the system.

Suppose a borrower repays a loan along with the interest, that gets reflected n on the cash side of the equation. This effectively reduces the utilization rate and the interest rate.

Depending on the supply and demand over time, the value of cTokens steadily creeps upwards.

The amount borrowed by someone at any point in time is a function of the original amount borrowed and the passage of time since.

Whenever someone borrows, the system first checks if the collateral they have is sufficient to cover the loan. If so the tokens are disbursed to the borrower. A record is made of the time when the loan was made.

When it comes to determining what was due at a point in time, this original record is used in conjunction with the number of blocks elapsed since and the interest accumulated.

If this amount exceeds the collateral available from the borrower the collateral is liquidated.