> For the complete documentation index, see [llms.txt](https://degenprime.gitbook.io/degenprime/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://degenprime.gitbook.io/degenprime/diamond-hands/interest/calculations.md).

# Calculations

{% hint style="info" %}
Interest rates model might change to reflect the market. Stay in the loop in our [Telegram](https://t.me/DegenPrimeDefi). In the near future this static model, will be updated to a dynamic interest rate model, to automatically reflect supply and demand.
{% endhint %}

### Calculating borrowing interest

The borrowing rate $$R\_{b}$$ is based on the current pool utilisation. It is a segmented (piecewise-linear) function defined by [utilisation breakpoints](#utilization-breakpoints), [slopes](#slope), and the [offsets](#offset).

$$\ R\_{b} =   \begin{cases}     a\_{1}\*u +b\_{1}       & \quad \text{if } u <= u\_{1},\     a\_{2}\*u +b\_{2}  & \quad \text{if } u\_{1}\<u <= u\_{2},\ a\_{3}\*u +b\_{3}  & \quad \text{if } u\_{2}\<u <= u\_{3},\     a\_{4}\*u +b\_{4}  & \quad \text{if } u > u\_{3}   \end{cases} \ \ \ R\_{b} - \text{borrowing rate}\ u - \text{pool utilisation}\ a\_{1,2,3,4}-\text{slopes}\ b\_{1,2,3,4}-\text{offsets}\ u\_{1,2,3}-\text{utilisation breakpoints}\\$$

### **Utilisation** Breakpoints

The utilisation breakpoints define the points at which the [slope](#slope) should change. They are tuned to ensure ideal pool utilisation, and might change in the future. For both stables and non-stables, ideal utilisation ratio is set at 75%. For USDC that ratio is set at 85%.

By having multiple utilisation breakpoints instead of just one, DegenPrime creates an optimal utilisation range. Instead of suddenly increasing the slope, there are ranges, to stabilize the interest rate around the ideal pool utilisation.

<table><thead><tr><th></th><th width="253.33333333333331">Non-stables (AVAX, ARB, etc)</th><th>Stables (USDC, DAI, etc)</th><th data-hidden data-type="number"></th></tr></thead><tbody><tr><td><br><span class="math">u_1</span></td><td>0.6</td><td>0.6</td><td>22</td></tr><tr><td><br><span class="math">u_2</span></td><td>0.8</td><td>0.8</td><td>null</td></tr><tr><td><br><span class="math">u_3</span></td><td>0.9</td><td>0.9</td><td>null</td></tr></tbody></table>

### **Slope**

The slope defines the steepness with which the interest rates rise. In the beginning, it equals 0 (a constant function) to ensure low borrowing APR and encourage borrowing. In the second range rates moderately rise. The ideal pool utilisation percentage is in this range. In the third part, rates grow rapidly to encourage deposits and repayments to keep liquidity available for withdrawals. In the final range, liquidity must be freed up to bring the utilisation back to a healthy ratio. In this last part rates grow with exceptional speed.

<table><thead><tr><th width="249"></th><th width="251">Non-stables (BTC, ETH, etc)</th><th width="223">Stables (USDC)</th></tr></thead><tbody><tr><td><span class="math">a_{1}</span></td><td>0.050</td><td>0.167</td></tr><tr><td><span class="math">a_{2}</span></td><td>0.200</td><td>0.250</td></tr><tr><td><span class="math">a_{3}</span></td><td>0.500</td><td>1.000</td></tr><tr><td><span class="math">a_{4}</span></td><td>29.800</td><td>6.500</td></tr></tbody></table>

### Offset

If we combine the utilisation breakpoints with the desired interest rates, there needs to be an offset to make the graph connect. The following numbers are the result of the formula which brings the full graph together. &#x20;

<table><thead><tr><th width="254"></th><th width="246">Non-stables (BTC, ETH, etc)</th><th width="238">Stables (USDC)</th></tr></thead><tbody><tr><td>​<br><span class="math">b_1</span></td><td>0</td><td>0</td></tr><tr><td>​<br><span class="math">b_2</span></td><td>-0.090</td><td>-0.050</td></tr><tr><td>​<br><span class="math">b_3</span></td><td>-0.330</td><td>-0.650</td></tr><tr><td>​<br><span class="math">b_4</span></td><td>-26.700</td><td>-5.600</td></tr></tbody></table>

### Calculating deposit rate

Deposit rate is calculated based on current borrowing rate and pool utilisation and balances total interests of all borrowers and all depositors.&#x20;

$$R\_d = R\_b \* u\ R\_d - \text{deposit rate}\\$$

### Graphs

#### Non-stables

<figure><img src="/files/lNBWCsc4JTB5sFL2izDV" alt=""><figcaption><p>Interest graph non-stable assets<br>Utilisation -> Borrow APY -> Deposit APY: <br>60% -> 3% -> 1.8%<br>80% -> 7% -> 5.6%<br>90% -> 12% -> 10.8%<br>100% -> 310% -> 310%</p></figcaption></figure>

#### Stables

<figure><img src="/files/UZvOGTvZFyVgYN2VpA7c" alt=""><figcaption><p>Interest graph stable assets<br>Utilisation -> Borrow APY -> Deposit APY: <br>60% -> 10% -> 6%<br>80% -> 15% -> 12%<br>90% -> 25% -> 22.5%<br>100% -> 90% -> 90%</p></figcaption></figure>
