# What is Dahlia?

Dahlia is a permissionless, modular lending protocol that emphasizes advanced risk control and liquidity aggregation, built atop the [Royco Protocol](https://royco.org). Designed to optimize capital efficiency and expand access to liquidity across a wider array of assets, Dahlia offers a flexible framework for market participants to manage risk while facilitating seamless borrowing and lending.

Dahlia empowers users to create markets, lend, borrow, repay, and withdraw seamlessly, supporting a comprehensive range of crypto lending and borrowing activities. Its modular design enables participants to maximize capital efficiency through limit orders while interacting with multiple liquidity pools. This adaptability not only improves capital allocation but also strengthens the overall functionality and resilience of the ecosystem.


# Markets & Vaults

​​Markets are the core of the Dahlia protocol. Unlike traditional lending platforms, Dahlia markets are **isolated** and **permissionless**, allowing any user to create a market between two ERC-20 tokens. This flexibility expands opportunities for long-tail DeFi assets, maximizing both risk management and liquidity options.

<figure><img src="https://2553671868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOoSolEmscLg1aJl6FXxT%2Fuploads%2FlAIwYiID0Oroc3l8YFze%2Fimage.png?alt=media&amp;token=c6047801-2bf0-4027-91d6-8c31a7ae572d" alt=""><figcaption><p>Lending Market in Dahlia</p></figcaption></figure>

### **Market Parameters**

Every Dahlia market is defined by a set of parameters:

* **Collateral**: The ERC-20 asset used as collateral.
* **Loan Asset**: The ERC-20 asset borrowed against the collateral.
* **Interest Rate Model (IRM)**: A smart contract that dictates how interest rates are adjusted based on utilization and market conditions.
* **Oracle Contract**: A contract that provides real-time price data for the collateral and loan asset, ensuring accurate loan-to-value calculations.
* **LLTV (Liquidation Loan-to-Value)**: The threshold ratio at which a loan is liquidated, representing the maximum loan amount as a percentage of collateral value. Exceeding this ratio may result in liquidation.
* **Liquidation Bonus**: The percentage of collateral paid to liquidators during a liquidation event. This bonus incentivizes third-party participants to execute liquidations when necessary.
* **Market Admin**: A role assigned to the deployer's address by default, which can be reassigned to another address. The Market Admin manages specific parameters, including pausing/unpausing the market, adjusting the liquidation bonus, and managing Royco Vault rewards.

This parameterization gives Dahlia a high degree of flexibility, encouraging innovative market creation while maintaining robust safeguards for participants.

### Royco Wrapped Vault Integration

Dahlia’s integration with Royco’s ERC-4626 WrappedVaults makes it easier to keep your funds working for you. By combining yield-bearing vaults with isolated lending markets, lenders can earn interest on one market while placing limit orders in another. If certain price or yield conditions aren’t met right away, your assets won’t sit idle—they continue accruing returns in the Royco-Dahlia Vault.

Dahlia’s WrappedVault remains fully compatible with all of Royco’s original features, including:

* **Rewards Campaigns:** Set up additional incentive programs to encourage more lending activity.
* **Limit Orders:** Create limit orders targeting specific interest rates on various assets to help you earn the yields you want.

Having the ability to set limit orders and maintain yield at the same time offers more flexibility. Lenders can explore different markets and strategies without pausing their earnings, while borrowers benefit from a market that consistently remains more active and liquid.

* **Earn While Setting Limit Orders**: Lenders can create limit orders across different markets while still earning yield in another active market. This ensures that funds are never idle, maximizing returns even when lenders are targeting specific rates elsewhere.
* **More Liquidity for Borrowers**: Borrowers benefit from increased liquidity because lenders can have active limit orders while still earning yield. This provides more borrowing options and mitigates some of the constraints typically found in isolated lending pools.

To learn more about Royco's native features, visit the [Royco Documentation](https://docs.royco.org).


# Market Modes

To ensure the safety of lenders and borrowers, Dahlia offers robust emergency management options to handle unexpected disruptions or critical market events.

### **Pause Mode**

Pause Mode is a safety mechanism designed to protect market participants during unexpected events, such as emergencies or disruptions. When a market is paused:

* **Borrowing and lending activities** are halted.
* Borrowers can still **repay their debt**.
* Lenders are allowed to **withdraw their funds**, though subject to any underlying losses that may have occurred.

The market remains in this state until the underlying issue is resolved and stability is restored. This can happen when:

* Market conditions normalize.
* Necessary actions are taken by the DAO or Market Admin to address the emergency.

**Authority**: The **Market Admin** and the [**DAO (Guardian Multisig)**](/governance-and-fees/governance) have the ability to pause or unpause a market, depending on the situation.

### **Deprecation Mode**

Deprecation Mode applies to markets that are deemed **unsafe** or have **insufficient deposits**, rendering them inactive. Once deprecated:

* **New borrowing and lending activities** are permanently disabled.
* Borrowers can **repay their debt**.
* Lenders can **withdraw their funds**, similar to paused markets.

Deprecation is an irreversible action. If a similar market is needed, users can **create a new market** with the same parameters.

**Authority**: Only the [**DAO (Guardian Multisig)**](/governance-and-fees/governance) can deprecate a market.

### **Oracle Stalled Mode**

If a market’s oracle becomes stalled — meaning one or more price feeds return `badData` (indicating the price has not been updated within the required delay and is no longer fresh) — Dahlia halts all actions that depend on oracle prices. This includes liquidations, new borrows, and collateral withdrawals.

To address a stalled oracle, there are two possible resolutions:

1. **Oracle price feeds recover** and start providing fresh prices again.
2. **Oracle price feeds are irreparably broken**, requiring an alternative mechanism to ensure funds are not stuck indefinitely.

In the event of an unresolved oracle issue, Dahlia can activate the **Stalled Market Mode** with the following process:

* A `REPAY_PERIOD` is initiated, during which borrowers can repay their full debt and reclaim their collateral. Lenders are unable to withdraw funds during this period.
* The `REPAY_PERIOD` lasts for **2 weeks** by default but can be adjusted by the DAO (Guardian Multisig).

If borrowers fail to repay their debt within the `REPAY_PERIOD`, the following actions occur:

* Borrowers lose the ability to reclaim their collateral.
* Lenders gain access to the **available liquidity** and any **remaining collateral**, ensuring fair distribution of assets even without a functioning oracle.

This mechanism prevents liquidity from becoming permanently stuck in the protocol and provides a clear resolution path in the absence of reliable price data.

**Authority:** Only the [**DAO (Guardian Multisig)**](/governance-and-fees/governance) can trigger Oracle Stalled Mode.


# Interest Rate Model

Dahlia Protocol utilizes an adapted version of [Fraxlend's Variable Interest Rate Model v2](https://docs.frax.finance/fraxlend/advanced-concepts/interest-rates#variable-rate-v2-interest-rate). This model has been proven in production for nearly two years, demonstrating robustness across diverse market conditions. We optimized the implementation to reduce gas usage by up to four times, making it even more efficient for use within Dahlia markets.

The IRM used in Dahlia operates on a dual-component system:

1. **Interest Rate Curve**: This determines the interest rate based on utilization at any given block. The curve functions similarly to those in other lending protocols like Aave, with adjustments based on current market utilization. The interest rate changes at different rates before and after the target utilization range, with distinct slopes for each segment of the curve. Specifically, the curve is calibrated to adjust gradually before reaching the target utilization, and more steeply afterward. Additionally, there are maximum and minimum full utilization rates, which determine the sharpness of the curve and ensure the interest rate remains within predefined bounds.
2. **Curve Adjustment**: The shape of the interest rate curve adjusts dynamically over time in response to deviations from the target utilization level. This ensures the curve aligns with market conditions, adapting to both under-utilization and over-utilization. The curve adjustment mechanism relies on a parameter called **rate\_half\_life**, which determines how quickly the interest rate changes in response to deviations from the target utilization level. Specifically:
   * If utilization is at 0%, the interest rate will halve over the period defined by the `rate_half_life` (e.g., 7 days).
   * If utilization is at 100%, the interest rate will double over the same period.
   * The adjustment happens incrementally every time the `accrueInterest()` function is called, effectively splitting the overall rate change into smaller chunks based on how frequently users interact with the market. If the `rate_half_life` were shorter (e.g., 1 day), the adjustments made each time the function is called would be more pronounced.
   * The adjustment is proportionally slower if the utilization is between 0% and target utilization, or target utilization and 100%.

<figure><img src="https://2553671868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOoSolEmscLg1aJl6FXxT%2Fuploads%2F0zjFo8EseYCdrZl6GsgO%2Fimage.png?alt=media&amp;token=8720e928-c74c-4953-b200-c94c87764411" alt=""><figcaption><p>Demonstrating Varible IRM Mechanics</p></figcaption></figure>

### Key IRM Parameters

The IRM parameters allow for detailed control over the interest rate behavior:

<table><thead><tr><th width="298">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>min_target_utilization</code></td><td>The minimum utilization rate below which no adjustments are made to the full utilization or target rates.</td></tr><tr><td><code>max_target_utilization</code></td><td>The maximum utilization rate above which no adjustments are made to the full utilization or target rates.</td></tr><tr><td><code>target_utilization</code></td><td>The utilization rate at which the slope of the interest rate curve increases.</td></tr><tr><td><code>min_full_utilization_rate</code></td><td>The minimum interest rate (per second) applied at 100% utilization. It is lower than the maximum full utilization rate.</td></tr><tr><td><code>max_full_utilization_rate</code></td><td>The maximum interest rate (per second) applied at 100% utilization. It is higher than the minimum full utilization rate.</td></tr><tr><td><code>zero_utilization_rate</code></td><td>The interest rate (per second) at 0% utilization, representing the minimum rate borrowers will pay.</td></tr><tr><td><code>rate_half_life</code></td><td>Determines the speed at which the interest rate curve adjusts to changes in utilization. At 100% utilization, the interest rate doubles at this rate; at 0%, it halves.</td></tr><tr><td><code>target_rate_percent</code></td><td>A percentage indicating the difference between the full utilization rate and the zero utilization rate, providing a smoother adjustment.</td></tr></tbody></table>

### Key Features and Advantages

* **Optimized Efficiency**: Our implementation is designed to significantly reduce gas costs, making transactions more affordable for users.
* **Robust and Flexible**: The IRM aims to maintain stability across various market conditions, encouraging participation from both lenders and borrowers while keeping lending markets competitive and sustainable.
* **Dynamic Adjustments**: The curve adjusts in real-time, ensuring the interest rate aligns with optimal utilization levels and responds to changes in demand.


# Oracles

Accurate asset pricing is fundamental to the safety and efficiency of lending and borrowing operations. To address this, lending protocols use Oracle contracts to aggregate and process price feeds. Dahlia’s approach to oracles is designed to provide flexibility, scalability, and robust data integrity — critical for long-tail assets that often face liquidity challenges.

### Oracle-Agnostic Design

Dahlia markets are **oracle agnostic**, meaning any oracle can be used as long as it implements the **IDahliaOracle** interface. This allows for seamless integration with existing price feeds while supporting custom oracle implementations.

Dahlia’s **Oracle Factory** enhances this flexibility, enabling market deployers to choose from pre-built oracle types or deploy their own custom oracles.

### Pre-Built Oracles

1. **Chainlink Oracle**
   * Relies on Chainlink’s decentralized oracle network for accurate and reliable price feeds.
   * Dahlia uses a **maximum delay check** to ensure the data remains fresh and hasn’t been delayed beyond an acceptable threshold.
2. **Pyth Oracle**
   * Works with [Pyth Network](https://www.pyth.network/price-feeds) price feeds.
3. **Dual Oracle (Chainlink with Uniswap Fallback)**
   * The **Chainlink Oracle** serves as the primary price feed.
   * If the Chainlink Oracle returns `badData` — indicating stale or invalid pricing — the system falls back to the **Uniswap V3 TWAP Oracle** as a secondary source.
   * This fallback mechanism ensures continued price reliability and system safety while minimizing exposure to oracle failures.

The Oracle Factory allows anyone to deploy a new oracle using one of the pre-built oracle types. For further customization, developers can implement their own oracles, provided they:

* Adhere to the IDahliaOracle interface.
* Include a properly defined `getPrice()` function.

### Oracle Malfunction

If an oracle that implements the **delay sanity check** fails (e.g., returns `badData`), Dahlia activates safeguards to protect users.

When an oracle malfunction occurs:

* Actions requiring fresh price data, such as liquidations, borrowing, or withdrawing collateral, are **halted**.
* The **Oracle Stalled Mode**, detailed on the [Market Modes page](/key-concepts/market-modes#oracle-stalled-mode), outlines the resolution process. This includes a `REPAY_PERIOD` during which borrowers can repay debts and reclaim collateral, ensuring fair liquidity distribution even without a functioning price feed.


# Liquidations

Liquidations are a critical mechanism that ensures the stability, solvency, and safety of the lending markets. When a borrower's position becomes undercollateralized — meaning the **Loan-to-Value (LTV)** ratio exceeds the market's **Liquidation Loan-to-Value (LLTV)** threshold — the position becomes eligible for liquidation. This process safeguards lenders by allowing the protocol to recover the borrowed funds while preventing systemic risk.

### Liquidation Bonus

In Dahlia, a **liquidation bonus** is applied as a fee paid by the borrower to the liquidator. This bonus is deducted from the borrower's collateral upon liquidation and serves as an incentive for liquidators to repay the borrower's debt.

#### Key Characteristics:

* **Set by Market Deployer**: The market deployer determines the liquidation bonus at the time of market creation.
* **Adjustable by Market Admin**: Post-deployment, the market admin can adjust the bonus to align with evolving market dynamics.
* **Upper Bound**: The liquidation bonus cannot exceed **¾** of the difference between the LLTV and 100%.

This mechanism ensures that liquidators are fairly incentivized while maintaining a buffer between the **LLTV + Liquidation Bonus** and **100% LLTV**. This buffer provides critical time and room for liquidators to process liquidations efficiently, reducing the likelihood of bad debt.

#### Steps in the Liquidation Process:

1. **Determine Eligibility**: The borrower's position is flagged for liquidation once the LLTV threshold is breached.
2. **Seize Collateral**: The protocol calculates the amount of collateral to be seized, factoring in the liquidation bonus for the liquidator's reward.
3. **Full or Partial Repayment**: The liquidator repays the borrower's outstanding debt, and the corresponding collateral — including the liquidation bonus — is transferred to the liquidator.
4. **Handle Bad Debt**: If the seized collateral is insufficient to cover the borrower's debt, the remaining shortfall is marked as **bad debt**.

<figure><img src="https://2553671868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOoSolEmscLg1aJl6FXxT%2Fuploads%2FVQwwvNgsCbBxI6jZfZrY%2Fimage.png?alt=media&amp;token=ef0cf4dc-f105-4647-9284-e0fead04119e" alt=""><figcaption><p>Full Liquidation Process (Example)</p></figcaption></figure>

### Reserve Fees and Bad Debt

To mitigate the risks associated with bad debt, Dahlia incorporates **reserve fees** into its risk management framework.

#### How Reserve Fees Work:

* **Governance-Enabled**: Reserve fees can be enabled or adjusted by governance as needed.
* **Collected from Borrowers**: A portion of borrower payments is directed to the reserve pool.
* **Forms a Safety Buffer**: The reserve pool acts as insurance, helping cover unexpected losses from liquidations where collateral is insufficient.

#### Handling Bad Debt:

In the event of bad debt:

1. The protocol attempts to use funds from the **reserve pool** to cover the shortfall.
2. This reduces the impact on lenders and maintains the financial health of the market.


# Governance

Given that Dahlia is a permissionless protocol, anyone can create a lending market. This significantly reduces the need for heavy-handed governance and instead shifts focus to managing risk and setting key parameters. Dahlia’s governance plays a limited but critical role in ensuring the stability and safety of the protocol through carefully controlled **pre-deployment** and **post-deployment** parameters.

### Pre-Deployment Parameters

1. **LLTV Range**: Defines the permissible range of Liquidation Loan-to-Value (LLTV) ratios that users can apply when creating new markets. The default LLTV range is set to **10%-98%**, offering market deployers flexibility to align with specific risk profiles.
2. **Liquidation Bonus Range**: Specifies the range of liquidation bonus rates, determining the portion of collateral awarded to liquidators during liquidation. This ensures bonuses remain attractive without imposing excessive penalties on borrowers.
3. **Allowed Interest Rate Models (IRM)**: Controls the list of interest rate models that can be used to regulate interest accrual. By maintaining a whitelist of IRM models, governance ensures predictable and consistent protocol behavior.

### Post-Deployment Parameters

1. **Protocol Fee**: A percentage fee deducted from the borrower’s APY and directed to the DAO treasury. This fee is set at **3%** of the interest earned by lenders and can be adjusted by governance to fund protocol improvements, development, and community initiatives.
2. **Reserve Fee**: A fee collected to form a reserve or insurance buffer for each market, helping protect against bad debt. The default reserve fee is set to **0%** but can be adjusted by governance as needed.
3. **Flashloan Fee**: A fee applied to the use of the flashloan feature. By default, this fee is **0%**, though governance can update it to align with market needs.
4. **Repay Period**: The duration allowed for borrowers to **repay their debt and claim collateral** in the event of a stalled market. It is set to **2 weeks** by default and can be adjusted by governance.
5. **Dahlia Registry Control**: Manages protocol-wide settings such as addresses for critical integrations (e.g., Royco IAM), ensuring smooth and secure connections across the ecosystem.
6. **Market Actions**:
   * [**Pause/Unpause Market**:](/key-concepts/market-modes#pause-mode) Allows governance to temporarily pause or unpause a market in the event of emergencies or risk concerns.
   * [**Market Deprecate**:](/key-concepts/market-modes#deprecation-mode) If a market is deemed unsafe or inactive, governance can permanently deprecate it, preventing further interactions.
   * [**Stall Market**:](/key-concepts/market-modes#oracle-stalled-mode) In the event of an oracle malfunction or data delay, governance can place a market in **Oracle Stalled Mode**. During this period, no actions requiring fresh price data (e.g., borrowing, liquidations, collateral withdrawals) can occur.

### Interim Governance Structure

At launch, Dahlia will operate under an **interim governance structure** until decentralized governance contracts are fully deployed. During this period, a **Guardian Multisig** will manage the protocol, consisting of **5 members** with a voting threshold of **3 out of 5**. This multisig will include Dahlia Foundation members and core protocol contributors to ensure fast, reliable decision-making while maintaining decentralization.

### Future of Governance: The Default Framework

Dahlia’s governance will evolve to adopt the **Default Framework**, a modular system that allows governance interactions through *policies* and *modules*. This flexible architecture empowers the community to implement governance upgrades, manage risk parameters, and adapt to evolving market dynamics efficiently.

The Default Framework prioritizes:

* **Decentralization**: Shifting control to stakeholders and the broader community.
* **Scalability**: Allowing governance to adapt to new features and markets without requiring core protocol changes.
* **Security and Stability**: Ensuring governance changes maintain the safety and integrity of the protocol.

By embracing the Default Framework, Dahlia will achieve a governance structure that is robust, adaptive, and inclusive, empowering its community to actively participate in shaping the future of the protocol.


# Fees

Dahlia implements a variety of fees that help sustain the protocol, ensure market stability, and incentivize certain behaviors within the ecosystem. Below are the core fees associated with Dahlia markets:

#### Protocol Fee

Applied to each market, deducted from the borrower's APY, and directed to the DAO treasury.&#x20;

* **Default:** 5% of the interest rate earned by lenders.&#x20;
* **Maximum:** The protocol fee rate is capped at 30%.

#### Reserve Fee

Provides a safety buffer in the event of bad debt. Collected from borrowers and directed to a reserve or insurance buffer.

* **Default:** 0%.

#### Flashloan Fee

Applied whenever users use Dahlia's flashloan functionality. Flashloans allow borrowing without collateral, provided the funds are returned in the same transaction.&#x20;

* **Default:** 0%.
* **Maximum:** Capped at 3%.

These fees can be adjusted by governance and are collected to ensure the protocol maintains sustainability, supports development, and provides safety mechanisms for market participants.


# Risk Factors

### **Smart Contract Risk**

The Dahlia protocol relies heavily on the security and reliability of its smart contracts, including the core lending contracts and the integrations with external protocols (e.g., Royco) and networks (e.g., Berachain). Any bugs, vulnerabilities, or exploits in these smart contracts could result in significant financial loss for users. Despite rigorous audits and testing, the possibility of unforeseen issues remains a key risk. Additionally, reliance on third-party integrations may introduce additional vulnerabilities outside Dahlia’s direct control.

### **L1 & L2 Network Risk**

Dahlia is deployed on multiple Layer 1 (L1) and Layer 2 (L2) networks to provide users with scalability and reduced transaction costs. However, some of these networks may be less mature than established L1s like Ethereum. Risks include potential downtime, chain reorganizations, or consensus failures that could disrupt protocol functionality. Moreover, any bridge-related issues between networks may amplify these risks, potentially affecting user funds and transaction reliability.

### **Market Liquidity Risk**

The liquidity in isolated markets on Dahlia depends on the active participation of lenders and borrowers. Markets for niche or long-tail assets may face low liquidity, resulting in difficulty for borrowers to obtain loans or for lenders to withdraw their funds. During periods of market stress, the absence of sufficient liquidity could exacerbate slippage, widen spreads, and result in unfavorable pricing for both lenders and borrowers. Additionally, isolated markets inherently carry liquidity fragmentation compared to pooled lending models.

### **Bad Debt Risk**

Bad debt occurs when borrow positions are undercollateralized meaning the total value of the collateral is less than the total value of the position’s debt. In such a scenario, liquidations would result in a situation where the available collateral assets are insufficient to repay the outstanding debt leaving a portion of the debt uncovered and resulting in a loss. This loss is referred to as Bad Debt and is allocated immediately to the market’s lenders. For the safety and attractiveness of a lending market it is imperative to configure the market with appropriate risk parameters. This is the objective of the Risk Framework which is explained \[here]\(link to risk framework).

### **Oracle Manipulation Risk**

Dahlia depends on price oracles to provide accurate, real-time market data for collateral and loan assets. If an oracle is compromised, manipulated, or delayed, it could lead to distorted price feeds. In such cases, loans could be incorrectly liquidated or remain under-collateralized, causing financial harm to users and undermining trust in the protocol. Although Dahlia uses decentralized oracles maintained by validators, extended oracle manipulation is a critical risk to monitor.

### **Other Risks**

* **Regulatory Risk**: The DeFi space operates in a rapidly evolving regulatory landscape. Legal changes or restrictions could impact Dahlia’s operations or the availability of its services in certain jurisdictions.
* **User Error**: DeFi platforms often involve complex interactions. Errors in setting parameters, managing collateral, or executing transactions could lead to unexpected losses.
* **Systemic Risk**: Issues in integrated protocols or the broader DeFi ecosystem (e.g., Royco Protocol, Berachain) could cascade into Dahlia’s functionality or liquidity availability.

### **Risk Mitigation**

Dahlia employs a multi-faceted approach to risk mitigation, including rigorous smart contract audits, a bug bounty program, and time-locked upgrades to enhance security. The protocol leverages decentralized oracles with fallback mechanisms to ensure accurate market data, while incentivized liquidity and dynamic market parameters address market liquidity risks. By deploying on multiple, carefully selected L1 and L2 networks, Dahlia reduces dependency on any single network and ensures resilience during potential downtime. A state-of-the-art risk parameter methodology mitigates market risks inherent in DeFi lending markets and ensures efficient and safe lending markets both for lenders and borrowers. Finally, clear documentation, user education, and transparent governance empower participants to manage risks effectively while fostering trust and ecosystem stability.


# Risk Methodology

## Intro

Dahlia implements an effective risk parameter methodology with the objective to mitigate the Liquidity Risk and Bad Debt Risk inherent in DeFi lending markets and enable efficient and safe lending markets. The methodology therefore assesses a number of historical data points related to the collateral and loan asset and derives appropriate risk parameters with which a Dahlia lending market is configured.

It is important to understand that Dahlia lending markets are immutable, meaning that their risk parameters are not actively managed but are static. As market conditions change, new lending markets may be created with different risk parameters requiring lenders and borrowers to monitor markets and reallocate positions if needed.

Furthermore, lenders and borrowers should be aware of other types of risks, such as Smart Contract risk, which are discussed [here](https://docs.dahlia.xyz/risks/risk-factors).

## Outline

<figure><img src="https://2553671868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOoSolEmscLg1aJl6FXxT%2Fuploads%2Fgit-blob-4337545501bff4ccefb35c35b4d5624767f88bd2%2Fframework-overview.png?alt=media" alt=""><figcaption></figcaption></figure>

The image shows a flow diagram of Dahlia’s risk parameter methodology. It illustrates how both the lending and borrowing assets are evaluated based on a qualitative Asset Rating methodology. The individual asset ratings then feed into a Market Rating capturing the overall risk profile of a Dahlia lending market.

In parallel, quantitative Risk Factors are extracted from relevant historical market data for each lending market, or collateral - loan asset pair. These risk factors are then combined with the market rating to compute the Risk Parameters with which a Dahlia lending market is ultimately equipped.

## Asset Rating

<figure><img src="https://2553671868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOoSolEmscLg1aJl6FXxT%2Fuploads%2Fgit-blob-6788ef301e63bd6cbfcea9eb97b081518ca8dec2%2Fasset-rating.png?alt=media" alt=""><figcaption></figcaption></figure>

Assets are classified based on five dimensions: Market Capitalization, Number of Holders, Age of the Asset in terms of price history, 24h trading volume and 24h price volatility. These dimensions combined should allow for a qualitative assessment of the overall maturity and quality of an asset. The Asset Rating is therefore assigned on a four-levels scale ranging from A, the highest quality, to D, the lowest quality.

💡 The Asset Rating captures the overall maturity and quality of collateral and loan assets on a scale of A, the highest quality, to D, the lowest quality.

## Market Rating

Dahlia lending markets consist of two assets, the collateral asset and the loan asset. The Market Rating combines the two asset’s individual ratings into a single market rating that captures the market’s overall quality based on the same four-level scale as shown in the table below.

Furthermore, the Market Rating is associated with a Risk Multiplier which serves as a “confidence score” and is used in the computation of the market’s Risk Parameters.

| Rating | Criteria                                              | Risk Multiplier |
| ------ | ----------------------------------------------------- | --------------- |
| A      | If both underlying assets have a rating of A          | 1               |
| B      | If both underlying assets have a rating of at least B | 1.5             |
| C      | If both underlying assets have a rating of at least C | 2               |
| D      | If at least one underlying asset has a D rating       | 3               |

💡 The Market Rating combines a market’s individual Asset Ratings into a single rating reflecting the lending market’s overall maturity and quality.

## Risk Factors

The market risk associated with a lending market can be assessed quantitatively in a number of Risk Factors. These factors directly relate to the market’s Bad Debt risk in that they serve as measures for

1. the likelihood of a market’s relative collateral value to fall to a level where positions would become insolvent (that is, the value of the collateral turns less then the position’s debt given a certain Liquidation Loan-to-Value)
2. the likelihood of liquidations turn unprofitable for liquidators and thus not being processed anymore

For each market, we therefore collect historical market data to compute the following risk factors:

### **24hrs price volatility**

Measures the “average” price changes within a full day. This translates to the “expected” collateral value drops within a day and thus is inversely related to the market’s LLTV.

### **24hrs Maximal Drawdown (MDD)**

Measures uncommon, yet possible, “extreme” price changes within a full day. As such a market’s MDD is always larger then the volatility. The measure translates to the expected “worst case” collateral value drops within a day and thus too is inversely related to the market’s LLTV.

### **24hrs DEX volume**

Measures the daily volume of trades in the respective trading pair processed on DEXs. Higher volume translates to more on-chain liquidity and means that liquidations, and in particular atomic, flashloan-powered liquidations, can be processed more efficiently (that is faster and with less slippage). This risk factor thus translates to the liquidation bonus paid to liquidators on a lending market: the higher the available liquidity, the lower the liquidation bonus has to be for timely liquidations to be profitable for liquidators.

## Risk Parameters

Finally, let’s discuss the various risk parameters derived from a lending market’s rating and risk factors. We distinguish two risk parameter sets: the **Interest Rate Model Parameters** and the **Liquidation Model Parameters**.

### **Interest Rate Model Parameters**

Dahlia uses an adaptive interest rate model that adjusts a market’s interest rate based on short-term utilization changes (regular rate curve), and based on long-term shifts in the market’s supply and demand for the loan asset (curve controller). You can read more about this model [here](https://docs.dahlia.xyz/key-concepts/interest-rate-model).

The objective of this model is to ensure the market can autonomously and efficiently find an equilibrium borrowing cost while making sure an appropriate level of liquidity is available for lenders to withdraw at any time. It is therefore configured with a number of parameters summarized here below:

* Target Utilization: Defines the equilibrium utilization of liquidity in the market and directly translates to the target liquidity reserves available for lenders. Since on Dahlia lending markets the loan and collateral assets are isolated, i.e. rehypothecation is not enabled by design, target utilization can be set relatively high (often at 90%) resulting in high capital efficiency and supply APYs.
* Zero Utilization Rate: The interest rate applied for zero utilization in the market. This is a fixed parameter and defines a static lower-end of the utilization-rate curve. It is usually defined as 0%.
* Minimal and Maximal Full Utilization Rate: These define the range within which the interest curve controller can adjust a market’s full utilization rate, that is the interest rate for 100% utilization, in any given block. Since the market participants, through their lend & borrow activity, autonomously shift the market’s full utilization rate to a level in this range, the limits of the range are less critical to configure. Nonetheless, the approach taken here is to reflect the Market Rating where a higher rating allows a market to arrive at lower interest rates compared to a market with a lower rating.

### **Liquidation Model Parameters**

Dahlia lending markets implement a simple, yet robust and efficient, liquidation model allowing full liquidations of insolvent positions with a fixed liquidation bonus (more on this [here](https://docs.dahlia.xyz/key-concepts/liquidations)). This model is based on two risk parameters:

* Liquidation Loan-to-Value (LLTV): this parameter defines the value a position’s debt cannot exceed relative to it’s collateral value. If a position’s debt value exceed this threshold, the market’s LLTV, it can be liquidated by anyone. The market’s LLTV must be less then 1.0 (100%) and thus includes a buffer safeguarding for expected market price movements during a day. The LLTV is thus derived from the market’s 24hrs Volatility, 24hrs MDD and Market Rating.
* Liquidation Bonus: this parameter defines the bonus paid to a liquidator as an incentive to repay an insolvent position’s debt in exchange to receive parts of its collateral. Specifically, the amount of collateral received is computed based on a discounted market price of the collateral where the discount is just the liquidation bonus. Hence ,the liquidation bonus should compensate the liquidator for any slippage of selling the collateral on a DEX and add an incentive on top for timely liquidations. The liquidation bonus is thus computed based on the assumed slippage realized in a “significant” liquidation event (which is defined as the liquidation of 10% of the market’s total debt). Thereby, this slippage is estimated based on the market’s 24hrs DEX Volume risk factor.


# Cantina Audit Report

{% file src="/files/4xdbR83yCKT4Wke6Xpu0" %}


