The role of the interest rate model is to calculate the total interest for a loan and to distribute the interest to the liquidity ticks used. Ticks and their use in loans are described in more detail in the Liquidity Ticks section.
The primary interest rate model is the WeightedInterestRateModel. It determines the total interest of a loan by summing the weighted interest due to each tick at their assigned rate. For example, if a 25 ETH, 30 day loan borrowed funds from the three ticks: 5 ETH at 10%, 10 ETH at 10%, and 10 ETH at 30%, the total interest would be:
The interest rate model is also responsible for distributing the interest to the ticks, which does not necessarily correspond to the individual interest amount contributed by each tick. For example, the WeightedInterestRateModel will redistribute more of the total interest towards the higher ticks, in compensation for their greater default risk.
The WeightedInterestRateModel assigns a weighted interest to each tick based on its capital contributed and the cumulative repayment. In other words, ticks that contribute more capital, closer to the total repayment, receive a greater weight. The weighting is determined by:
Finally, the interest is assigned to each tick using its weight and the normalization of all weights:
For most balanced liquidity tick usage, this will result in higher ticks receiving greater effective APRs and lower ticks receiving lower effective APRs compared to the loan's overall APR. Ticks that contribute little or dust liquidity, anywhere in the capital stack, will receive little interest, due to their weight being diminished by their absolute contribution.
Interest rate models are implemented with the internal InterestRateModel abstract contract API.
Below are examples showing the distribution of interest and effective APRs by the WeightedInterestRateModel under various tick usage profiles:
Profile: Balanced, 10 Ticks
Copy
Principal 40.00000000 ETH
Repayment 40.32876712 ETH
Interest 0.32876712 ETH
Overall Rate 10.0000%
Liquidity Used [4.00 at 10.00%, 4.00 at 10.00%, 4.00 at 10.00%, 4.00 at 10.00%,
4.00 at 10.00%, 4.00 at 10.00%, 4.00 at 10.00%, 4.00 at 10.00%,
4.00 at 10.00%, 4.00 at 10.00%]
Tick Interests [0.0060, 0.0120, 0.0179, 0.0239, 0.0299, 0.0359, 0.0418, 0.0478,
0.0538, 0.0598]
Effective Rates [1.8182%, 3.6364%, 5.4545%, 7.2727%, 9.0909%, 10.9091%, 12.7273%,
14.5455%, 16.3636%, 18.1818%]
Profile: Balanced, 32 Ticks
Copy
Principal 40.00000000 ETH
Repayment 40.32876712 ETH
Interest 0.32876712 ETH
Overall Rate 10.0000%
Liquidity Used [1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%,
1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%, 1.25 at 10.00%]
Tick Interests [0.0006, 0.0012, 0.0019, 0.0025, 0.0031, 0.0037, 0.0044, 0.0050,
0.0056, 0.0062, 0.0068, 0.0075, 0.0081, 0.0087, 0.0093, 0.0100,
0.0106, 0.0112, 0.0118, 0.0125, 0.0131, 0.0137, 0.0143, 0.0149,
0.0156, 0.0162, 0.0168, 0.0174, 0.0181, 0.0187, 0.0193, 0.0199]
Effective Rates [0.6061%, 1.2121%, 1.8182%, 2.4242%, 3.0303%, 3.6364%, 4.2424%,
4.8485%, 5.4545%, 6.0606%, 6.6667%, 7.2727%, 7.8788%, 8.4848%,
9.0909%, 9.6970%, 10.3030%, 10.9091%, 11.5152%, 12.1212%,
12.7273%, 13.3333%, 13.9394%, 14.5455%, 15.1515%, 15.7576%,
16.3636%, 16.9697%, 17.5758%, 18.1818%, 18.7879%, 19.3939%]
Profile: Large + Dust, 32 Ticks
Copy
Principal 40.00310000 ETH
Repayment 40.33199452 ETH
Interest 0.32889452 ETH
Overall Rate 10.0031%
Liquidity Used [40.00 at 10.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%]
Tick Interests [0.3289, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000]
Effective Rates [10.0031%, 10.3293%, 10.3293%, 10.3293%, 10.3294%, 10.3294%,
10.3294%, 10.3294%, 10.3295%, 10.3295%, 10.3295%, 10.3296%,
10.3296%, 10.3296%, 10.3296%, 10.3297%, 10.3297%, 10.3297%,
10.3297%, 10.3298%, 10.3298%, 10.3298%, 10.3298%, 10.3299%,
10.3299%, 10.3299%, 10.3300%, 10.3300%, 10.3300%, 10.3300%,
10.3301%, 10.3301%]
Profile: Large + Dust, 6 Ticks
Copy
Principal 10.00050000 ETH
Repayment 10.41146301 ETH
Interest 0.41096301 ETH
Overall Rate 49.9980%
Liquidity Used [10.00 at 50.00%, 0.00 at 10.00%, 0.00 at 10.00%, 0.00 at 10.00%,
0.00 at 10.00%, 0.00 at 10.00%]
Tick Interests [0.4109, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000]
Effective Rates [49.9981%, 48.4197%, 48.4201%, 48.4206%, 48.4211%, 48.4215%]
Profile: Large + Dust + Small, 32 Ticks
Copy
Principal 45.00300000 ETH
Repayment 45.53736986 ETH
Interest 0.53436986 ETH
Overall Rate 14.4468%
Liquidity Used [40.00 at 10.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%,
0.00 at 50.00%, 0.00 at 50.00%, 0.00 at 50.00%, 5.00 at 50.00%]
Tick Interests [0.4664, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0680]
Effective Rates [14.1852%, 14.6478%, 14.6478%, 14.6479%, 14.6479%, 14.6480%,
14.6480%, 14.6480%, 14.6481%, 14.6481%, 14.6481%, 14.6482%,
14.6482%, 14.6483%, 14.6483%, 14.6483%, 14.6484%, 14.6484%,
14.6484%, 14.6485%, 14.6485%, 14.6486%, 14.6486%, 14.6486%,
14.6487%, 14.6487%, 14.6487%, 14.6488%, 14.6488%, 14.6489%,
14.6489%, 16.5396%]
Profile: Random, 32 Ticks
Copy
Principal 40.00000000 ETH
Repayment 41.24150013 ETH
Interest 1.24150013 ETH
Overall Rate 37.7623%
Liquidity Used [0.16 at 10.00%, 0.27 at 50.00%, 1.27 at 50.00%, 0.34 at 50.00%,
2.82 at 50.00%, 0.12 at 30.00%, 1.68 at 10.00%, 1.04 at 30.00%,
2.66 at 50.00%, 0.50 at 50.00%, 1.05 at 30.00%, 1.04 at 50.00%,
0.77 at 50.00%, 0.01 at 50.00%, 1.36 at 50.00%, 0.27 at 50.00%,
1.87 at 30.00%, 0.22 at 50.00%, 0.99 at 50.00%, 1.40 at 30.00%,
2.83 at 30.00%, 0.29 at 50.00%, 0.44 at 10.00%, 2.47 at 50.00%,
0.07 at 10.00%, 2.85 at 50.00%, 1.79 at 10.00%, 0.83 at 30.00%,
2.62 at 50.00%, 2.40 at 30.00%, 1.07 at 10.00%, 2.50 at 30.00%]
Tick Interests [0.0000, 0.0002, 0.0033, 0.0010, 0.0206, 0.0009, 0.0161, 0.0117,
0.0413, 0.0081, 0.0185, 0.0202, 0.0157, 0.0001, 0.0308, 0.0063,
0.0474, 0.0057, 0.0272, 0.0409, 0.0944, 0.0100, 0.0150, 0.0956,
0.0025, 0.1227, 0.0793, 0.0383, 0.1332, 0.1288, 0.0582, 0.1473]
Effective Rates [0.2816%, 0.7906%, 3.1256%, 3.7431%, 8.9102%, 8.9815%, 11.7206%,
13.7567%, 18.8630%, 19.7784%, 21.3390%, 23.5952%, 25.0009%,
25.0104%, 27.5119%, 28.0142%, 30.8909%, 31.7872%, 33.5959%,
35.5554%, 40.5839%, 41.7669%, 41.2124%, 47.0863%, 45.7135%,
52.4284%, 53.8561%, 56.2078%, 61.9133%, 65.2056%, 66.0064%,
71.5341%]