Math Paper

𝚵xactly Finance: A Model to Complete the Credit Market on the Ethereum Blockchain (Version 1.0)

Francisco Lepone and Gabriel Gruber
July 2022

Abstract

A model is proposed to complete the credit market on the Ethereum blockchain. It enables users to take loans and make deposits at fixed rates for various terms through the creation of Fixed Rate Pools.
Each Fixed Rate Pool represents a specific term. Interest rates are determined based on the utilization rate of each Fixed Rate Pool.
Additionally, the protocol offers the possibility of borrowing or parking liquidity at a floating rate through the implementation of a money market instrument in a Variable Rate Pool. The funding of the protocol is materialized through time deposits and the existence of a remunerated Smart Pool in charge of providing liquidity where required.

1. Introduction

Decentralized Finance (DeFi) based on blockchain technologies aims to create a new financial system by building a network of interconnected distributed apps (dApps) that use open source and non-custodial protocols. By combining some of these dApps, we can recreate traditional financial instruments and even new ones.
Currently, there is a number of efficient protocols for borrowing and lending, such as Compound
1^1
, AAVE
2^2
and Euler
3^3
among others. All of them have in common that they work with a short rate as reference for lending cost. Thus, they involve binding deposits and credits to a cost of variable nature.
This work is an attempt to bring a missing important piece into the ecosystem, the "time value of money": That is, to be able to make deposits or take loans at fixed rates for a certain period of time, allowing users to hedge interest rate volatility and to lock costs and revenues.
Some protocols approach this problem using a peer-to-peer (P2P) strategy, where lenders and borrowers are individually matched. This strategy, while being conceptually sound and simple, entails several inefficiencies related to matching both amount and time in each transaction. Protocols like AAVE take a different direction, offering a stable (not fixed) rate if the market conditions remain within a certain threshold. While this property provides greater predictability, it does not eliminate the risk and it only works for borrowers below a certain market utilization rate.
Alternatively, a series of fixed rate protocols were launched during the year 2021. Some of them, like Yield
4^4
and Notional
5^5
, use a token to create a component resembling a "Zero Coupon Bond", while others like Element
6^6
and Pendle
7^7
use two tokens to distinguish the principal and the interest rate, much like a "Coupon Stripping" approach, to try to discover the fixed interest rate based on the price of one or more assets with a certain expiration date represented by one or more ERC-20 tokens. Unfortunately, these types of protocols have not managed to capture enough liquidity yet. This might be due to their complexity when implementing them in the Ethereum blockchain.
Furthermore, when there is a slippage in the price of these types of tokens, the interest rate to be discovered is indirectly affected. Consequently, the protocols require their own AMM implementation. This poses additional challenges since these special tokens can't be traded on AMMs such as Uniswap
8^8
. The constant product invariant formula
xy=kx*y=k
is not ideal for yield tokens, where time is an additional factor. Our goal is to device a scheme that removes the mentioned obstacles and contributes to the growth of a complete fixed income market in the blockchain. The protocol admits borrowing and lending at fixed interest rates for different maturities while still offering variable interest rates alternatives, thus covering the entire DeFi credit market.

2. Protocol Architecture

The protocol is aimed to satisfy the credit market with both variable and fixed interest rates by using two types of pools per asset: Variable Rate Pools and Fixed Rate Pools. Probably one of the biggest challenges of being able to establish an efficient (of considerable volume) fixed-term credit market on the blockchain is being able to match supply and demand simultaneously. In fact, if credit supply for a certain maturity arrives before credit demand, it is impossible to guarantee the supplier any given interest rate without putting at risk the protocol solvency. On the contrary, if credit demand arrives before credit supply, loans cannot materialize. To this respect, the role of the Variable Rate Pool is to immediately satisfy the credit-demand for any maturity and stay there until there are enough deposits to match the borrowing. This is possible because any given interest rate is not promised to Variable Rate Pool liquidity contributors in advance.

3. Variable Rate Pool

Users can supply their assets to increase the liquidity of the Variable Rate Pool. There will be a Variable Rate Pool for each of the assets supported by the protocol. The role of the Variable Rate Pool is to provide immediate liquidity to any Fixed Rate Pool as required, ensuring that demand for new loans is satisfied. This is the mechanism Exactly protocol has to match credit supply and demand. When a new deposit is made in a certain Fixed Rate Pool, it replaces the prior contribution of the Variable Rate Pool to such pool. In turn, the Variable Rate Pool retains a small fraction of the interest fees as earnings for having provided liquidity in the first place. That way, the Variable Rate Pool liquidity is continuously reused to match the demand for new loans and afterwards released in exchange for a fee, ready to be used again for future loans. The rotation speed of this dynamics plays a key role in the profitability of the Variable Rate Pool. The faster the rotation, the higher the rate it builds up.
Furthermore, Variable Rate Pool liquidity is also available for variable rate loan funding. All the interest generated by this type of transaction is also to be collected by the Variable Rate Pool.
While the protocol does not guarantee liquidity in the pool, it relies on its interest rate model to incentivize it.
By design, the protocol sets aside a percentage of the Variable Rate Pool deposits as Liquidity Reserves. Liquidity Reserves cannot be borrowed and are only made available to meet withdrawal requests in the Variable Rate Pool.
Let
TSStTSS^t
be the total holdings in the Variable Rate Pool at any time
tt
and
η\eta
be the fraction of total holdings used as Liquidity Reserves or non-loanable holdings (
RSSt=ηTSStRSS^t=\eta TSS^t
). We define the loanable portion of the Variable Rate Pool (
SStSS^t
) as:

4. Fixed Rate Pool

Users can supply and/or borrow assets to/from various Fixed Rate Pools depending on their time horizon preferences. Each new deposit generates an increase in the liquidity for that specific Fixed Rate Pool, reducing its utilization rate. Conversely, each new borrow takes out liquidity and increases the utilization rate. When there is a new transaction (deposit/borrow) in a Fixed Rate Pool, interest rates are determined based on the state of the system at this moment. Nevertheless, credit demand (borrows) and supply (deposits) rates are calculated using different principles.
Any depositor in a Fixed Rate Pool, can withdraw their assets before maturity, provided there is enough liquidity available in the protocol. Similarly, any debtor can repay their debt in advance and release their collateral.

4.1. Borrowing Assets at Fixed Rates

At any time during the life of a Fixed Rate Pool, any investor can ask for a loan provided they have enough collateral to backup the borrow. The collateral is calculated based on the aggregated amount of assets deposited in the various Variable Rate Pools (marked as collateral) and that are not already in use to guarantee previous debts.
Let us consider the
ithith
Fixed Rate Pool (
FRPiFRP_{i}
) whose maturity operates in
TiT_{i}
. Loans inside a pool are financed by two types of funding: deposits in the same Fixed Rate Pool (loans,
BFFR,iBF_{FR,i}
) and contributions from the Variable Rate Pool (loans,
BVFR,iBV_{FR,i}
). The interest rate to be applied to each loan is determined by an interest rate demand function that depends on the utilization rate on that specific Fixed Rate Pool.

4.1.1. Credit Demand Interest Rate Function

Exactly protocol has a specific interest rate demand curve for each Fixed Rate Pool and each asset. Increasing or decreasing the rate incentivizes lenders to provide additional liquidity or borrowers to request more credit, respectively. Thus, this mechanism favors the convergence towards an equilibrium between supply and demand of credit. Since for each of the assets there is a certain number of maturities, by observing the interest rate term structure users can also determine what pools are the most interesting to participate in.
We model interest rates as a function of the utilization rate (
UU
) of each Fixed Rate Pool for every transaction by using a single, continuous and differentiable rational function
This function diverges asymptotically when
UUmaxU \rightarrow U_{max}
and it acts as a natural barrier to the credit demand as the level of utilization depletes the protocol liquidity capabilities.
The curve can be easily parametrized and adjusted to changing market conditions. In principle, there will be a demand function for each asset and each maturity. Curve parameters
AA
,
BB
, and
UmaxU_{max}
are determined through calibration against relevant market data.
where
UbU_{b}
conceptually represents the utilization level at the boundary between a region of normal interest rates (
UUbU \leq U_b
) and a region of leveraged interest rates (
U>UbU > U_b
).
The utilization rate in each Fixed Rate Pool at any time
tt
is defined as
where
TBFR,itTB_{FR,i}^t
is the total amount of outstanding borrows at time
tt
in the Fixed Rate Pool,
TDFR,itTD_{FR,i}^t
is the total amount of deposits,
SSt⟨SS⟩^t
is a moving average of the total supply in the Variable Rate Pool for this asset (see 4.1.3), andFR is a configurable parameter that regulates the fraction of Variable Rate Pool total liquidity that is "naturally assigned" to each pool. In this way, and assuming no deposits are made to the Fixed Rate Pool, once all the "natural liquidity" is already borrowed (
TBFR,it=SSt/τFRTB_{FR,i}^t=⟨SS⟩^t/\tau_{FR}
) the utilization rate equals one (
UFR,it=1U_{FR,i}^t=1
). For practical reasons, we will also choose
Ub=1U_b=1
.
The utilization rate in any Fixed Rate Pool can be higher than unity, but interest rates will then rise at a faster pace beyond this value. The maximum value of allowed utilization in a given Fixed Rate Pool will be
Ufull=τFRU_{full}=\tau_{FR}
. That point is reached when all the Variable Rate Pool liquidity is being borrowed by a single Fixed Rate Pool (under the assumption that
TDFR,it=0TD_{FR,i}^t=0
).
In practice, we set
This choice enables a more flexible calibration of the curve (the lowest the value of
Λ\Lambda
, the steepest the interest rates in the leveraged region).
The function was thought in such a way that it naturally divides the utilization domain into three well-differentiated areas (Fig. 1). A first region of normal rates (name it normal-regime) in which the utilization levels are well below total available liquidity. A second region in which interest rates increase at a faster pace (leveraged-regime) as utilization levels start to exhaust available resources. And a third region (unreachable-regime) where rate levels are even higher, eventually diverging and where it is not possible to take credits.

4.1.2 The Effective Interest Rate for a Particular Loan

One of the differences between money market protocols and Exactly's approach to term borrow/lending is that each user can receive/pay a fixed rate when they transact in our platform. Because of that, the choice of an appropriate utilization rate value becomes so crucial.
When at time
tk+1t^{k+1}
there is a new request for a loan of size
BFR,itk+1B_{FR,i}^{t_{k+1}}
, if confirmed, the system would evolve from a utilization state
UFR,itkU_{FR,i}^{t_{k}}
to a state
UFR,itk+1U_{FR,i}^{t_{k+1}}
according to the following rule:
In variable rate frameworks, fixing the initial rate based on the state of utilization prior to the transaction is not a big issue because rates will rapidly accommodate in the following transaction. Under a fixed rate environment, this approach might promote users to take advantage and capture all the liquidity available at current low rates. On the other hand, using an ex-post utilization to fix interest rates does not solve the problem either, as we would be overcharging costs to users. The appropriate approach to solve the problem is to make investors become indifferent to the decision of getting a loan for the total desired amount or splitting it into successive smaller loans.
To achieve that, the protocol needs to calculate the effective interest rate (2) satisfying this condition, i.e.:

4.1.3 Time Averaged Variable Rate Pool Supply

The direct use of the Variable Rate Pool supply quantity (
SStSS^{t}
) in the definition of utilization rate could expose the protocol to a type of manipulation attack. In fact, attackers can deposit to a market's Variable Rate Pool to lower the pool utilization rate to decrease the interest rate and then borrow at a cheaper rate. After that, the attackers can immediately withdraw from the Variable Rate Pool if there are enough assets available there. Although this potential manipulation does not hurt the protocol solvency, it constitutes an unfair practice affecting users. To discourage this misbehavior, we introduce an exponential weighted moving average (EMA) of the supply in the utilization rate formula.
The idea underlying the choice of
α\alpha
is the following: We want the system to adapt slowly when there is an increase in the supply that carries its value above its moving average (lowering interest rates) but we want the system to adapt faster when there are withdrawals that take the supply below its average value (increasing interest rates). So we set
α\alpha
as:
βslow\beta _{slow}
and
βfast\beta _{fast}
can be easily calibrated to fit a desired time decay window for each case.

4.2 Depositing Assets

Users can supply their assets to different Fixed Rate Pools depending on their time horizon preferences. Each new deposit generates an increase in the liquidity for that specific Fixed Rate Pool, reducing its utilization rate and the corresponding fixed interest rate for a new loan.
In economics, market clearing is the process by which the supply of whatever is traded is equated to the demand so that there is no leftover supply or demand. In the Exactly Protocol, users who are providing demand and supply of credit have access to the same information in the blockchain so there is no "friction" impending interest rate changes, thus rates will always adjust up or down to ensure market clearing.
To accomplish the market clearing condition supply interest rates are defined by the amount of interest pending payment available for distribution among Fixed Rate Pool depositors and Variable Rate Pool liquidity providers. This condition is dynamic and must hold true at all instants of time. The exact distribution among players will depend on their proportional contribution to the backing of loans.

4.2.1 Supply Interest Rate

When there is a new deposit (
DFR,itkD_{FR,i}^{t_{k}}
) to a Fixed Rate Pool, the system determines the total amount of outstanding borrows backed by the Variable Rate Pool and calculates the interest pending payment. The deposit is used to return an equivalent amount of funds to the Variable Rate Pool and its corresponding interest pending payment is assigned to the new depositor. In fact, a fraction
δ\delta
of those interests are retained by the Variable Rate Pool as a fee for its matching services. The new depositor thus gets a fraction
(1δ)(1-\delta )
of the original interests.
Assuming that at time
tkt_{k}
there is a set
{BVFR,itn,n=1,N,tn<tk}\{{BV_{FR,i}^{t_{n}},n=1,\ldots N,t_{n}<t_{k}}\}
of borrows funded by the Variable Rate Pool (
tnt_{n}
is the time when the loan
nn
started). The total pending of accruing interest on such borrows (
PIBVPFR,itkPIBVP_{FR,i}^{t_{k}}
) is:
Remember that
TiT_{i}
denotes the maturity of the pool. The amount of funds to be returned to the Variable Rate Pool will be
and the total interest assigned to the new depositor will be
Thus, the annualized fixed interest rate on the deposit (
RDFR,ik,tRD_{FR,i}^{k,t}
) can be calculated as follows

4.3 Early Withdraw

Any depositor, can withdraw their assets before maturity, provided there is enough liquidity available in the protocol. Withdrawing assets implies selling the position to the Variable Rate Pool at a price equal to the deposited principal amount plus interests earned at maturity discounted at the borrow rate prevailing at the time of withdrawal. This is equivalent to asking for a borrow in the Fixed Rate Pool for the resulting amount.

4.4 Early Repay

Borrowers can repay their debt before maturity and release their collateral. This implies repurchasing the debt at a price equal to de principal borrowed plus the interest owed at maturity discounted at the prevailing deposit rate at repayment time. This is equivalent to making a deposit in the Fixed Rate Pool for the resulting amount.

4.5 Aggregate Equations for Earned Interest on Loans in Fixed Rate Pools

Consider the time elapsed between any two operations in the protocol
(tk,tk+1)( t_{k},t_{k+1})
. Assume there are
l=1,2,,Ll=1,2,\ldots ,L
coexisting Fixed Rate Pools in the period whose starting and maturing dates are
tstartlt_{start}^{l}
and
tmatlt_{mat}^{l}
, respectively. Furthermore, assume there are
NlN_{l}
active loans and
MlM_{l}
deposits (
MlNlM_{l}\leq N_{l}
) in pool
lthlth
.
The total interest amount accumulated by the mass of loans from all the Fixed Rate Pools between
tkt_{k}
and
tk+1t_{k+1}
is given by:
The total amount of accrued interest earned by depositors is;
and the total amount of accrued interest earned by the Variable Rate Pool;

5. Borrowing Assets at Variable Rates

Users can also take loans at variable rates similarly to what they are accustomed to do in protocols like Compound or AAVE. Under Exactly's architecture it can be assumed that variable rate borrows take place in an especial pool exclusively fed with Variable Rate Pool resources. In this pool the only allowed operations are borrows and repayments. We use the same type of interest rate supply function as for Fixed Rate Pools.
In this case, to assure the proper behavior of the protocol, a new definition of utilization rate is needed. First, between any two transactions in the Variable Rate Pool, we define the current utilization rate as
where
TBVRtTB_{VR}^{t}
is the total amount of variable rate borrows outstanding at time
tt
, and
τVR\tau _{VR}
is a numerical parameter.
Second, each time there is a new transaction in the Variable Rate Pool, a new utilization rate is calculated according to the following rule:
Here
BVRt+1>0B_{VR}^{t+1}>0
means a new borrow is being made and
BVRt+1<0B_{VR}^{t+1}<0
means a repay (partial or total) of an existing borrow is being made.
Defining
U0=min(UVRt,UVRt+1)U_{0}=min(U_{VR}^{t} , U_{VR}^{t+1})
and
U1=max(UVRt,UVRt+1)U_{1}=max(U_{VR}^{t} , U_{VR}^{t+1})
we can update the prevailing variable interest rate at
t+1t+1
as:

5.1 Repayment of a variable rate loan

To keep track of the amount that each given single borrow must repay on exit, we record the number of shares that, upon entrance, this borrow represents to the total mass of variable rate loans.
Consider a new borrow
BVRk,tkB_{VR}^{k,t_{k}}
and the total amount of outstanding debt
TBVRtkTB_{VR}^{t_{k}^{-}}
. The amount of debt-shares associated to
BVRk,tkB_{VR}^{k,t_{k}}
is given by
where
ShTBVRtkShTB_{VR}^{t_{k}^{-}}
is the number of debt-shares corresponding to
TBVRtkTB_{VR}^{t_{k}^{-}}
When the loan is cancelled at a later time
tk+nt_{k+n}
, the amount to be repaid will be calculated as:

5.2 Calculating the total outstanding debt

The growth of variable rate debt is updated by calculating the interests between two consecutive transactions in the Variable Rate Pool:
So the updated debt is

5.3 Aggregate Equations for Interest Earned on Variable Rate Loans by the Variable Rate Pool

The total accrued interest earned by the Variable Rate Pool between
tkt_{k}
and
tk+1t_{k+1}
due to variable rate loans is given by:

6. Liquidations

In terms of liquidations, we adopted an approach similar to that of the Euler protocol. Consider a given user
jj
. Let's call
CjC^{j}
the total amount of collateral measured in USD they hold as guarantee for their debts. Assume
CjC^{j}
is composed of different assets.
We associate a collateral factor
ρi\rho _{i}
to each asset in order to asses the lending power of each collateral asset. Thus the risk adjusted collateral is given by
So, given a user collateral portfolio, the average collateral factor can be defined as follows
Similarly, the total amount of debt (
DjD^{j}
) and the risk adjusted debt (
D~j\widetilde{D}^{j}
) can be defined as follows
So, given asset
kk
, the maximum amount user
jj
can borrow from asset
kk
is:
The solvency condition for any given user is that their risk adjusted collateral be greater or equal to their risk adjusted liabilities, i.e.:
When an account becomes insolvent (
C~j/D~j1\widetilde{C}^{j}/\widetilde{D}^{j}\leq 1
) a liquidation process must be triggered.
In order to return the account to solvency as fast as possible and involving the least liquidation possible, we define the close factor (
κFj\kappa _{F}^{j}
) as the fraction of outstanding borrows that must be repaid to return the portfolio to solvency. By design,
κFj\kappa _{F}^{j}
will be dynamic (i.e. dependent on the degree of insolvency).
Be
Γ>1\Gamma >1
the safe collateralization ratio that must be applied in a liquidation.
Before liquidation we have
(C~j/D~j)before1(\widetilde{C}^{j}/\widetilde{D}^{j} ) ^{before}\leq 1
. Immediately after liquidation, the condition should be
(C~j/D~j)after=Γ(\widetilde{C}^{j}/\widetilde{D}^{j} ) ^{after}=\Gamma
.
In order to achieve that, liquidators repay an amount
κFjDj\kappa _{F}^{j}D^{j}
of debt and also pay an extra amount equal to
κFjνBDDj\kappa _{F}^{j}\nu _{BD}D^{j}
to the Variable Rate Pool in concept of bad debt compensation. At the same time, they take for themselves a fraction
κFj(1+νBD)(1+νliq)Dj\kappa_{F}^{j}(1+\nu_{BD})(1+\nu_{liq})D^{j}
of collateral. The reduction in debt and collateral after liquidation is as follows
Where
νliq\nu _{liq}
is the liquidator commission and
νBD\nu _{BD}
accounts for the percentage of extra liquidation that is retained to the the Variable Rate Pool as compensation for absorbing bad debt residuals after all the collateral is liquidated. Using the solvency condition
which provides the close factor as a function of the undercollateralization ratio

Acknowledgements

We would like to thank Patricio Molina, Rodrigo Bronzelle, Nicolás Castro García, Francisco Marienhoff and Mariel Ghelerman for their warm support at Exactly.
A very special thanks to Danilo Neves Cruz and Santiago Sánchez Ávalos for the many hours of fruitful exchange of ideas we have spent during the exciting development of this task.

References

  1. 1.
    Compound (2019), https://compound.finance/docs
  2. 2.
    AAVE (2020), https://docs.aave.com
  3. 3.
    Euler (2021), https://www.euler.finance
  4. 5.
    Notional (2020), https://docs.notional.finance
  5. 6.
    Element (2021), https://paper.element.fi
  6. 7.
    Pendle (2021), https://docs.pendle.finance
  7. 8.
    Uniswap (2018), https://docs.uniswap.org
  8. 9.
    Liquity (2020), https://docs.liquity.org

Model parameters

Below is the list of parameters in the model.
η\eta
: Fraction of total Variable Rate Pool supply selected as Liquidity Reserve.
R0R_{0}
: Interest Rate value associated to a utilization rate equal to zero.
RbR_{b}
: Interest Rate value associated to a utilization rate equal to
UbU_{b}
(generally
Ub=1U_{b}=1
).
τFR\tau _{FR}
: Fraction of Variable Rate Pool total liquidity a priori assigned to each Fixed Rate Pool.
τVR\tau _{VR}
: Fraction of Variable Rate Pool total liquidity a priori assigned to Variable Rate Pool.
Λ\Lambda
: Scale factor used to define
UmaxU_{max}
.
α\alpha
: Weighted factor in the Variable Rate Pool supply EMA.
βslow\beta _{slow}
: Time decay parameter used when supply is above average.
βfast\beta _{fast}
: Time decay parameter used when supply is below average.
δ\delta
: Fraction of term-loan interests retained by the Variable Rate Pool upon leaving the Fixed Rate Pool.
κF\kappa _{F}
: Close factor, fraction of debt to be repaid by liquidators.
Γ\Gamma
: Target solvency ratio after liquidation.
νliq\nu _{liq}
: Liquidator incentive.
νSM\nu _{SM}
: Variable Rate Pool compensation for bearing bad debt.

Disclaimer

This paper is only for general information purposes. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment instrument and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This paper reflects current personal opinions of the authors and are subject to change without being updated.

Download the Math Paper

Copy link
On this page
𝚵xactly Finance: A Model to Complete the Credit Market on the Ethereum Blockchain (Version 1.0)
Abstract
1. Introduction
2. Protocol Architecture
3. Variable Rate Pool
4. Fixed Rate Pool
4.1. Borrowing Assets at Fixed Rates
4.2 Depositing Assets
4.3 Early Withdraw
4.4 Early Repay
4.5 Aggregate Equations for Earned Interest on Loans in Fixed Rate Pools
5. Borrowing Assets at Variable Rates
5.1 Repayment of a variable rate loan
5.2 Calculating the total outstanding debt
5.3 Aggregate Equations for Interest Earned on Variable Rate Loans by the Variable Rate Pool
6. Liquidations
Acknowledgements
References
Model parameters
Disclaimer
Download the Math Paper