Getting Started
Liquid StakingSecurity Developer docs
  • Hatom's Ecosystem
    • Introduction
    • Lending Protocol
      • Networks
      • Protocol Math
        • Cash Dynamics
        • Borrow Dynamics
        • Protocol Reserves Dynamics
        • Interest Rate
        • Exchange Rate
        • Rewards Dynamics
      • Glossary
        • Money Markets or "MM"
        • Utilisation Rate
        • Collateral Factor or Loan to Value
        • Borrow Limit Used
        • BorrowCap
        • Liquidation Factor/Threshold or Health Factor
        • Liquidation Limit Bar
        • Liquidation Incentive
        • Reserve Factor
        • Close Factor
        • ActiveCollateralCapUSD
        • Supply/Borrow APY
        • HTokens
        • Underlying Token
        • Cash
        • Reserve Balance
      • Fundamental Functions
      • HTokens
      • Lending Protocol Rewards
      • Hatom Price Oracle Infrastructure
        • Oracle Bots
        • Price Aggregator Smart Contract
        • Price Oracle Smart Contract
        • Guardian bot
      • Liquidation
        • How much is the liquidation penalty ?
        • Can you give me an example ?
        • How can I avoid getting liquidated ?
        • Can I participate in the liquidations ecosystem ?
    • Liquid Staking
      • Liquid Staking Derivatives
      • Basic Functionalities
      • Liquid Staking Delegation Algorithm
    • Hatom USD
      • USH Facilitators
        • Lending Protocol Facilitator
          • Borrow Repayment and Liquidations
          • Borrow Rate
        • Isolated Pools Facilitator
          • USH Redemption
          • How to Participate in Redemption
      • Price Stability
      • USH Staking Module
      • Frequently Asked Questions
    • Booster
      • Booster Math
    • Accumulator
    • TAO Bridge
      • Ecosystem Integration
      • Bridging Process
      • Bridging Fees
      • Video Guides
  • Governance
    • Introduction
    • How to vote ?
      • The Voting Process
      • Unstaking HTM Tokens During Voting
      • Increasing Voting Power
      • Voting on Multiple Proposals
    • Tuning Hatom Protocol Parameters
  • Learn more about "Hatom token"
    • Introduction
    • HTM Token
    • Roadmap
  • Security
    • Introduction
    • Security reports
    • Adding an Asset
      • Methodology
      • Risk Parameters
    • Bug Bounty
  • Troubleshooting
    • Guides: Lending Protocol
      • Supply an asset
      • Activate as collateral
      • Borrow an asset
      • Repay a borrow
      • Remove collateral
      • Withdraw your asset
    • How to translate ?
      • Translate "Hatom Protocol":
      • Translate "Docs Section":
    • Request assistance
  • Hatom Protocol
  • USH
  • Blog
  • Syfy
Powered by GitBook
On this page
  • Discount Rate Model
  • Discount Rate

Was this helpful?

Export as PDF
  1. Hatom's Ecosystem
  2. Hatom USD
  3. USH Facilitators
  4. Lending Protocol Facilitator

Borrow Rate

as of 02/01/2025

PreviousBorrow Repayment and LiquidationsNextIsolated Pools Facilitator

Last updated 4 months ago

Was this helpful?

Differently to other assets, USH won’t follow the standard interest rate model based on supply and demand dynamics, as the supply part does not exist. For this reason, the borrowing rate is given as a smart contract parameter, which will be fully controllable by the smart contract once admin rights are transferred to it. Additionally, there is a time lock as well as a maximum change allowed for increasing the rate.

As we have already mentioned, not all borrowers share the same borrowing rate: some of them might have a discount applied to the base borrowing rate. In the following section we will explain how to:

  • Simulate an account borrowing without a discount: Simulate the behavior of an account borrowing over time with a variable borrow rate.

  • Simulate an account borrowing with a discount: Simulate the behavior of an account borrowing over time with a variable borrow rate, including a variable discount applied on top of it.

Discount Rate Model

We need to prepare the framework of meaningful equations before going deep into the Discount Rate Model implementation. In that sense, let’s describe the money market dynamics first:

The continuously compounded money market account β(t)\beta \left( t \right)β(t) satisfies the following differential equation:

dβ(t)=r(t)⋅β(t)⋅dt,d\beta(t) = r(t) \cdot \beta(t) \cdot dt,dβ(t)=r(t)⋅β(t)⋅dt,

in which:

  • β(t0)=1\beta( t_0 ) = 1β(t0​)=1 is the initial condition, and

  • r(t)r(t)r(t) is the borrow rate, deterministic in our case.

This equation describes an account that has an initial deposited amount of β(t0)\beta( t_0 )β(t0​) which increases over time at a rate r(t)r(t)r(t). The exact solution for this differential equation is nothing more than:

β(t)=exp⁡(∫t0tr(u)⋅du).\beta(t) = \exp \left( \int_{t_0}^t r(u) \cdot du \right).β(t)=exp(∫t0​t​r(u)⋅du).

However, we can discretize the previous differential equation in a tenor structure 0=T0<T1<⋯<TN0 = T_0 < T_1 < \dots < T_N0=T0​<T1​<⋯<TN​ using the Euler explicit method, i.e. the most simple approximation, such that:

I(Ti+1)−I(Ti)=r(Ti)⋅I(Ti)⋅(Ti+1−Ti),I(T_{i+1}) - I(T_{i}) = r(T_{i}) \cdot I(T_{i}) \cdot \left( T_{i+1} - T_{i} \right),I(Ti+1​)−I(Ti​)=r(Ti​)⋅I(Ti​)⋅(Ti+1​−Ti​),

in which iii goes from 0,1,2,…,N0, 1, 2, \dots, N0,1,2,…,N. I(t)I(t)I(t) is known as a rolling certificate of deposit and can be interpreted as a discrete-time equivalent of β(t)\beta (t)β(t). More precisely, I(t)I(t)I(t) will approach β(t)\beta (t)β(t) as the time spacing of the tenor structure is made increasingly fine. We can reorder the previous equation and get:

Ii+1=Ii⋅(1+ri⋅τi),I_{i+1} = I_i \cdot \left( 1 + r_i \cdot \tau_i \right),Ii+1​=Ii​⋅(1+ri​⋅τi​),

in which we have abused notation by dropping TTT and with τi=Ti+1−Ti\tau_i = T_{i + 1} - T_iτi​=Ti+1​−Ti​. We can even go a step further and obtain:

Ii+1=∏n=0i(1+rn⋅τn).I_{i + 1} = \prod_{n = 0}^i \left( 1 + r_n \cdot \tau_n \right).Ii+1​=n=0∏i​(1+rn​⋅τn​).

Now, suppose there is a security that pays $1 at maturity . This security is known as the discount bond or zero coupon bond, and its value at any given time t⩽Tt \leqslant Tt⩽T in a deterministic environment is just:

P(t,T)=β(t)β(T)=exp⁡(∫t0tr(u)⋅du−∫t0Tr(u)⋅du),P(t,T) = \frac{\beta(t)}{\beta(T)} = \exp\left( \int_{t_0}^t r(u) \cdot du - \int_{t_0}^T r(u) \cdot du \right),P(t,T)=β(T)β(t)​=exp(∫t0​t​r(u)⋅du−∫t0​T​r(u)⋅du),

which yields:

P(t,T)=exp⁡(−∫tTr(u)⋅du).P(t,T) = \exp\left( - \int_t^T r(u) \cdot du \right).P(t,T)=exp(−∫tT​r(u)⋅du).

Based on what we have learned, its discrete value D(Ti+1,Tj+1)D\left(T_{i+1}, T_{j+1} \right)D(Ti+1​,Tj+1​) known as the discount factor is:

D(Ti+1,Tj+1)=I(Ti+1)I(Tj+1)=∏n=i+1j(1+rn⋅τn)−1,D(T_{i+1}, T_{j+1}) = \frac{I(T_{i+1})}{I(T_{j+1})} = \prod_{n = i+1}^j \left( 1 + r_n \cdot \tau_n \right)^{-1},D(Ti+1​,Tj+1​)=I(Tj+1​)I(Ti+1​)​=n=i+1∏j​(1+rn​⋅τn​)−1,

with i⩽ji \leqslant ji⩽j. At this point, it is important to realize that I(t)I(t)I(t) is what is usually called the Borrow Index in smart contract jargon.

Simulation of an Account’s Borrow Without a Discount Rate

An account borrowed at any time ttt can be translated to a time T⩾tT \geqslant t T⩾t using the discount factor, such that:

D(t,T)⋅B(T)=B(t),D(t, T) \cdot B(T) = B(t),D(t,T)⋅B(T)=B(t),

so that the account borrowed amount at time TTT is:

B(T)=B(t)⋅D(t,T)−1=B(t)⋅I(T)I(t).B(T) = B(t) \cdot D(t, T)^{-1} = B(t) \cdot \frac{I(T)}{I(t)}.B(T)=B(t)⋅D(t,T)−1=B(t)⋅I(t)I(T)​.

In other words, computing the dynamics of I(t)I(t)I(t) at all interaction times allows the translation of any borrow amount across time.

Simulation of an Account’s Borrow With a Discount Rate

In the previous scenario, the Discount Factor or Borrow Index can be used to translate any borrow amount because all accounts are exposed to the same borrow rate. However, we now need to compute an account’s borrow even if each account has a different effective borrowing rate. This is because we apply a discount rate to the base rate and this discount rate is per user. The account borrows with discount, named B^(t)\hat{B}(t)B^(t), is affected by a discount amount proportional to the accrued interest between two infinitesimally close time intervals, such that:

dB^(t)=r(t)⋅B^(t)⋅dt−dδ(t)withdδ(t)=d(t)⋅r(t)⋅B^(t)⋅dt, d\hat{B}(t) = r(t) \cdot \hat{B}(t) \cdot dt - d\delta(t) \quad \text{with} \quad d\delta(t) = d(t) \cdot r(t) \cdot \hat{B}(t) \cdot dt,dB^(t)=r(t)⋅B^(t)⋅dt−dδ(t)withdδ(t)=d(t)⋅r(t)⋅B^(t)⋅dt,

with a discount rate 0⩽d(t)⩽10 \leqslant d(t) \leqslant 10⩽d(t)⩽1. After rearrangement, we get:

dB^(t)=(1−d(t))⋅r(t)⋅B^(t)⋅dt. d\hat{B}(t) = \left ( 1 - d(t) \right) \cdot r(t) \cdot \hat{B}(t) \cdot dt.dB^(t)=(1−d(t))⋅r(t)⋅B^(t)⋅dt.

We can implement the same discretization that we did for the money market account and obtain the following expression:

B^i+1=B^i+(1−di)⋅ri⋅B^i⋅τi=B^i⋅[1+(1−di)⋅ri⋅τi].\hat{B}_{i+1} = \hat{B}_i + \left( 1 - d_i \right) \cdot r_i \cdot \hat{B}_i \cdot \tau_i = \hat{B}_i \cdot \left[ 1 + \left( 1 - d_i \right) \cdot r_i \cdot \tau_i \right].B^i+1​=B^i​+(1−di​)⋅ri​⋅B^i​⋅τi​=B^i​⋅[1+(1−di​)⋅ri​⋅τi​].

With a bit of algebra and using the proven fact that Ii+1=Ii⋅(1+ri⋅τi) I_{i+1} = I_i \cdot \left( 1 + r_i \cdot \tau_i \right)Ii+1​=Ii​⋅(1+ri​⋅τi​) , we get:

B^i+1=B^i⋅[Ii+1Ii⋅(1−di)+di].\hat{B}_{i+1} = \hat{B}_i \cdot \left[ \frac{I_{i+1}}{I_i} \cdot \left( 1 - d_i \right) + d_i \right].B^i+1​=B^i​⋅[Ii​Ii+1​​⋅(1−di​)+di​].

This last equation allows using the conventional Borrow Index I(t)I(t)I(t), obtained through the money market dynamics without any kind of discount, to determine an account’s borrow with a discount rate d(t)d(t)d(t).

Discount Rate

The discount rate d(t)d(t)d(t) plays a crucial role in the protocol because it allows any user to borrow USH with a discount applied to the borrow rate. In this context, the discount rate is defined as a function of the collateral distribution deposited by the user in the protocol, such that the discount rate dd d of an account aaa with deposited collaterals CCC of asset types jjj behaves as:

da=da(t,Ca,j(t))for j=1,…,N.d_a = d_a(t, C_{a,j}(t)) \quad \text{for } j=1, \dots, N.da​=da​(t,Ca,j​(t))for j=1,…,N.

Each market jjj has a conversion rate hjh_jhj​ (a.k.a the coverage) which determines the amount of USH that can be borrowed at a discount based on the amount of collateral CjC_jCj​:

bjcov=hj⋅Cj.b^\text{cov}_j = h_j \cdot C_j.bjcov​=hj​⋅Cj​.

Then, an account with a borrowed amount BaB_aBa​ has a borrowed amount at a discount Ba,dB_{a,d} Ba,d​ given by:

Ba,d=min⁡(Ba,∑j=1Nhj⋅Ca,j).B_{a,d} = \min \left( B_a, \sum_{j=1}^{N} h_j \cdot C_{a,j} \right).Ba,d​=min(Ba​,j=1∑N​hj​⋅Ca,j​).

It follows that the borrow amount without a discount is just:

Ba,d=Ba−Ba,d.B_{a,\sout{d}} = B_a - B_{a,d}.Ba,d​=Ba​−Ba,d​.

If Ba,d=0 B_{a,d} = 0Ba,d​=0, then the account’s discount rate is zero:

da=0.d_a = 0.da​=0.

If Ba,d⩽BaB_{a,d} \leqslant B_aBa,d​⩽Ba​ , we have:

da=1Ba⋅∑j=1Ndj⋅hj⋅Ca,j,d_a = \frac{1}{B_a} \cdot \sum_{j=1}^{N} d_j \cdot h_j \cdot C_{a,j},da​=Ba​1​⋅j=1∑N​dj​⋅hj​⋅Ca,j​,

in which each djd_jdj​ is the discount rate per asset defined as a market parameter. In order to demonstrate this last equation, one can reason about the discounts being applied to each part of the account’s borrow, such that the following relationship must be true:

r⋅(1−da)⋅Ba=r⋅Ba,d+r⋅(1−d1)⋅h1⋅Ca,1+⋯+r⋅(1−dN)⋅hN⋅Ca,N.\small r \cdot \left( 1 - d_a \right) \cdot B_a = r \cdot B_{a,\sout{d}} + r \cdot \left( 1 - d_1 \right) \cdot h_1 \cdot C_{a,1} + \dots + r \cdot \left(1 - d_{N} \right) \cdot h_{N} \cdot C_{a,N}.r⋅(1−da​)⋅Ba​=r⋅Ba,d​+r⋅(1−d1​)⋅h1​⋅Ca,1​+⋯+r⋅(1−dN​)⋅hN​⋅Ca,N​.

Finally, if there is too much coverage such that ∑j=1Njhj⋅ca,j>Ba\sum_{j=1}^{N_j} h_j \cdot c_{a,j} > B_a ∑j=1Nj​​hj​⋅ca,j​>Ba​ and Ba,d=0B_{a,\sout{d}} = 0Ba,d​=0, the protocol applies the coverage in descending order, i.e. that largest discounts are taken into consideration first.

Governance