Calculating interest rates and cumulation of debt.
Interest rates are recalculated in the
Tellercontract every time
The system interest rate is proportional to the opportunity cost of supplying loanable funds with underlying assets. The most common underlying asset for lending is the US dollar. Probity uses the following formula to calculate the annualized interest rate R for every change in supply. Let U be the utilization ratio, i.e., the ratio of the amount borrowed to the total supply. The function takes the form:
A maximum interest rate can be set to comply with jurisdictions with restrictions on the amount of interest that can be charged. The function curve makes it easy. A max of 10% APR can be enforced by a modification such that the function is used for U = [0, 90] and is set to 10% for all U > 90.
The annualized interest rate is dependent on the utilization at time t and defined as:
In the Trustline Credit Network, interest compounds on a per-second basis. Thus, the per-second interest rate r is taken as the n-th root of the annualized interest rate. Given that a year is comprised of 60 * 60 * 24 * 365.25 = 31,557,600 seconds, the per-second interest rate is defined as:
And the per-second compound interest function, which gives us the total debt after t periods, is given as:
Where D(t) is the debt at time t, D_0 is the loan principal, and r is a constant rate. However, since the interest rate changes whenever underlying supply changes, we use the concept of a rate accumulator.
The rate accumulator A at time t is given as:
With A_0 as the initial cumulative rate. Now, we take the normalized debt amount
as the principal amount over the initial cumulative rate:
The total debt at time t can be calculated with the normalized debt and rate accumulator:
Suppose that the initial supply has $1,000. Alice borrows $500 from the pool. The utilization ratio is 500/1000 = 0.5 or 50%. The annualized interest rate set to:
From the annualized rate, we derive the per-second rate as follows:
The initial cumulative rate is equal to the initial interest rate, so the normalized debt balance turns out to be:
One month contains 2,629,800 seconds. Assuming that the interest rate stays constant this entire time, the total debt after one month is equal to:
Now suppose that Bob adds $200 to the pool at this time, bringing the total to $1,200. The utilization ratio is now 500/1200, or roughly 41.7%, and the annualized interest rate decreases from 2% to to 1.71428571428571428571428571429%. This corresponds to a per-second rate of 1.000000000538620692738000247%. The rate accumulator is now updated:
The multiplier at the end of the second month will be:
Which comes out to 1.003072524482622234898573734. We multiply this by the normalized debt to get Alice's new outstanding debt balance:
Alice owes $1.54 in interest. If Alice makes a repayment at the end of the second month, the normalized debt is readjusted. For example, if she makes a payment of $100, then the new balance is 401.536261926377845203 and the normalized amount is:
The interest payable is the amount of earned interest that a supplier is entitled to withdraw at any given time. It is essentially the same calculation as total debt with a couple of differences: (1) we scale the interest rate by the utilization ratio and (2) since lending pool reserves are burned when underlying assets are redeemed, the investor's entitlement is toward interest earned, and not the pool supply plus interest.
Except, in this case, the rates are scaled by the utilization ratio:
The interest payable at time t is equal to:
When earned interest amount
is redeemed at time t, the normalized equity amount readjusts:
is bounded by
Assume that there is a total supply of $10,000 with $6,000 outstanding (U=60%). Alice adds $2,000 to the reserves so that U=50% and r=2%. If the rate accumulator is set to 1.00081816993115769498 then Alice's normalized equity amount is:
At the moment there is no interest entitlement, but assuming that the rate is constant without any changes in supply and Alice waits one month, the rate accumulator will be:
And interest entitlement will be roughly equal to:
Now suppose that Alice withdraws the interest at this time with
from the TCN contract. The normalized amount from the Treasury contract is readjusted:
Which leads to a balance of
. This new amount sets the basis for future accumulated interest.