DEFI FINANCIAL MATHEMATICS AND MODELING

The Mathematics Behind DeFi Borrowing and Liquidation Incentives

8 min read
#DeFi #Mathematics #Borrowing #Liquidation #Incentives
The Mathematics Behind DeFi Borrowing and Liquidation Incentives

In the last few years, decentralized finance has moved from a niche experiment to a cornerstone of the blockchain ecosystem.
At the heart of most lending platforms lies a simple, yet powerful, mathematical engine that decides how much a borrower can take, how fast the debt grows, and when a position must be closed.
Understanding these formulas gives users a better grasp of risk, and it helps developers build fairer, more efficient protocols.


Interest Rates in DeFi Lending

Unlike traditional banks that set fixed or floating rates through policy decisions, DeFi protocols determine interest dynamically, as explored in the interest rate dynamics guide.
The most common model is demand‑driven, a concept detailed in the complete DeFi modeling guide, where the borrowing rate is a function of the utilization of a particular asset pool.

Utilization and the Basic Formula

Let

  • (D) be the total debt outstanding in a pool.
  • (S) be the total supplied liquidity.

The utilization ratio (U) is simply

[ U = \frac{D}{S}. ]

The protocol then maps (U) to an annualized borrowing rate (r_b(U)) using a piecewise or sigmoid curve.
A typical linear model is

[ r_b(U) = r_{\min} + (r_{\max} - r_{\min}) \cdot U, ]

where (r_{\min}) is the floor rate (often zero) and (r_{\max}) is the cap that kicks in when the pool is saturated.

The supply rate (r_s(U)) is the borrowing rate multiplied by the collateral factor (C_f), which represents the proportion of debt that can be generated from supplied assets.
So

[ r_s(U) = r_b(U) \cdot C_f. ]

Because borrowing and supplying happen in real time, rates fluctuate minute‑by‑minute, which is why many DeFi users track them live on dashboards.

Dynamic Adjustments

Some protocols add a soft cap or elasticity feature.
If utilization exceeds a threshold (U_{\text{soft}}), the protocol may increase the slope of the rate curve to disincentivize further borrowing.
This creates a feedback loop: higher rates reduce demand, lowering utilization, and bringing rates back down.

A visual representation of this relationship looks like a smooth curve that steepens after a certain utilization point.


Borrowing Mechanics and Collateral

Borrowing in DeFi is anchored to collateral.
The protocol ensures that the value of collateral always exceeds the debt by a safe margin, protecting lenders against price volatility.

Collateral Factor

For an asset (A), the collateral factor (C_f(A)) is the maximum percentage of its value that can be borrowed.
If (C_f(A) = 0.75), a borrower can generate debt up to 75 % of the USD value of their (A) holdings.

The total borrowing capacity for a user with multiple collateral types is

[ \text{Max Debt} = \sum_{i} \text{USD_value}(A_i) \cdot C_f(A_i). ]

Borrowing Capacity and Health Factor

Once a user takes out a loan, the health factor (HF) becomes critical.
HF is defined as the ratio of the current collateral value to the debt, adjusted by the collateral factor:

[ HF = \frac{\sum_{i} \text{USD_value}(A_i) \cdot C_f(A_i)}{\text{Debt}}. ]

A health factor above 1 means the user is safely over‑collateralized.
If HF falls below a protocol‑defined liquidation threshold (HF_{\text{liq}}) (often 1.1 or 1.2), the position becomes eligible for liquidation.


Liquidation Triggers and Incentives

When a borrower’s health factor dips below the safe zone, liquidators step in.
They repay a portion of the debt in exchange for a discounted portion of collateral.
This mechanism keeps the system solvent and motivates active participation.

The Liquidation Window

Protocols expose a liquidation window (T_{\text{liq}}).
During this window, liquidators can submit a liquidation transaction.
If the transaction succeeds, the protocol locks the debt portion being repaid and transfers collateral to the liquidator, after deducting the liquidation penalty.

Liquidation Penalty and Bonus

Let

  • (P_{\text{pen}}) be the liquidation penalty (e.g., 5 %).
  • (L_{\text{bonus}}) be the bonus that liquidators receive on the collateral they claim (e.g., 10 %).

When a liquidator repays an amount (R) of debt, the protocol calculates the collateral to be transferred as

[ C_{\text{liq}} = \frac{R \cdot (1 + P_{\text{pen}})}{P_{\text{coll}}} ]

where (P_{\text{coll}}) is the current price of the collateral in the loan’s base currency.

The liquidator keeps an additional fraction (L_{\text{bonus}}) of (C_{\text{liq}}) as an incentive, so the total collateral received is

[ C_{\text{total}} = C_{\text{liq}} \cdot (1 + L_{\text{bonus}}). ]

This simple formula captures the economic trade‑off: liquidators gain a higher value than they pay, but borrowers suffer a penalty that discourages reckless leverage.

Sensitivity to Price Oracle Accuracy

Liquidation calculations rely on oracle data.
If an oracle reports a stale or manipulated price, (C_{\text{liq}}) can be mis‑estimated, leading to either under‑liquidation (risking protocol loss) or over‑liquidation (unfair to borrowers).
Protocols mitigate this with time‑weighted average prices and oracle delay mechanisms.


Modeling Liquidation Penalties

Designing a liquidation incentive requires balancing two competing objectives:

  1. Protect lenders by ensuring rapid resolution of under‑collateralized positions.
  2. Encourage healthy borrowing by setting penalties that are not too punitive.

A common approach is to model expected loss (E[L]) as a function of the penalty (P_{\text{pen}}) and the probability distribution of collateral price movements.

Expected Loss Formula

Assuming the borrower’s debt is (D) and collateral value follows a log‑normal distribution with volatility (\sigma), the probability that HF falls below (HF_{\text{liq}}) in a time interval (\Delta t) can be estimated using standard risk‑neutral techniques.
Let (p_{\text{liq}}) be that probability.
Then

[ E[L] = p_{\text{liq}} \cdot D \cdot P_{\text{pen}}. ]

Protocol designers choose (P_{\text{pen}}) to keep (E[L]) below a target risk threshold while keeping the bonus (L_{\text{bonus}}) attractive enough for liquidators.

Parameter Exploration

To illustrate, consider a pool with:

  • (D = $10{,}000)
  • Volatility (\sigma = 20%) per year
  • Liquidation threshold (HF_{\text{liq}} = 1.1)

Using a simple binomial model, we can compute (p_{\text{liq}}) for different penalty rates.
Below is a table of results (values are illustrative):

Penalty Probability of Liquidation Expected Loss
3 % 0.12 $120
5 % 0.12 $200
8 % 0.12 $320

This demonstrates that even a modest penalty can keep expected losses manageable while providing enough incentive for liquidators to act quickly.


Practical Takeaways for Borrowers

  1. Track Health Factor – Use dashboards that update HF in real time; staying above 1.5 gives a safety buffer.
  2. Diversify Collateral – Some assets have lower volatility and higher collateral factors; mixing them reduces liquidation risk.
  3. Understand Oracle Lag – Protocols often enforce a minimum delay between price update and liquidation eligibility; be aware of this window.

Practical Takeaways for Lenders

  1. Set Collateral Factors Wisely – A higher factor increases borrowing volume but also the risk of liquidation.
  2. Monitor Utilization – A surge in borrowing can cause rates to spike; this may attract more lenders, but also raises systemic risk.
  3. Implement Risk Controls – Use stop‑loss mechanisms on your own portfolio or employ diversified exposure across protocols.

Future Directions

Stablecoins and Peg Integrity

Stablecoins are the primary collateral in many lending pools.
Ongoing research focuses on on‑chain governance to maintain peg stability, which directly impacts liquidation thresholds.

Advanced Oracles

Decentralized oracle networks (e.g., Chainlink, Tellor) are evolving to provide real‑time, tamper‑resistant price feeds.
Future protocols may incorporate multiple oracles per asset to reduce price manipulation risk.

Flash Loans and Re‑Collateralization

Flash loans allow users to borrow large sums for a single transaction.
Protocol designers must model the impact of such large, short‑term debt spikes on utilization and liquidation dynamics, perhaps by temporarily adjusting collateral factors during high‑traffic periods.

Machine Learning for Risk Forecasting

Some projects experiment with predictive models that learn from on‑chain data to forecast liquidation events.
These models can adjust liquidation penalties or bonus rates dynamically to keep risk within bounds.


Closing Thoughts

The mathematics that power DeFi borrowing and liquidation is elegant and self‑contained.
A few simple formulas dictate how much one can borrow, how rates adjust to market demand, and when a position is at risk.
By applying basic probability and risk‑management principles, protocol designers can calibrate penalties and incentives that keep the system robust, while borrowers and lenders can make informed decisions to maximize returns and minimize losses.

The future of DeFi will hinge on continued refinement of these models, integration of more accurate data feeds, and the evolution of governance mechanisms that allow protocols to adapt to changing market conditions. In this dynamic environment, a solid grasp of the underlying mathematics will remain a critical skill for anyone participating in the decentralized economy.

Lucas Tanaka
Written by

Lucas Tanaka

Lucas is a data-driven DeFi analyst focused on algorithmic trading and smart contract automation. His background in quantitative finance helps him bridge complex crypto mechanics with practical insights for builders, investors, and enthusiasts alike.

Contents