Denari (DNR) is a decentralized, exogenous, crypto-collateralized, algorithmic stablecoin pegged to the U.S. Dollar (USD).
It is inspired by DAI, designed for simplicity, security, and extensibility.
The Denari Protocol consists of two main smart contracts:
- Denari.sol — ERC20 token contract representing the Denari stablecoin (
DNR). - DNREngine.sol — Core engine that manages collateral deposits, stablecoin minting/burning, redemptions, and liquidations.
The system uses crypto assets (wETH and wBTC) as collateral and maintains stability through overcollateralization and on-chain Chainlink oracles.
| Contract | Responsibility |
|---|---|
| Denari.sol | ERC20-compliant token representing DNR, controlled by DNREngine. Handles minting/burning. |
| DNREngine.sol | Core protocol logic — manages collateral, debt positions, redemptions, and liquidations. |
| OracleLib.sol | Library for Chainlink price feeds with staleness protection. |
| HelperConfig.s.sol | Deployment configuration for Anvil, Sepolia, and Mainnet. |
| DeployDNR.s.sol | Script to deploy protocol and link ownership between contracts. |
| DNREngineTest.t.sol | Foundry test suite ensuring correctness and stability. |
Properties
- Exogenous — backed by external crypto assets (wETH / wBTC)
- Anchored — 1 DNR = 1 USD target peg
- Decentralized — no centralized control
- Overcollateralized — ensures solvency during volatility
- Algorithmic — minting/burning governed by protocol rules
Collateral Types
- wETH
- wBTC
Collateralization Parameters
| Parameter | Value | Description |
|---|---|---|
| Liquidation Threshold | 50% | 200% collateralization required |
| Liquidation Bonus | 10% | Incentive for liquidators |
| Minimum Health Factor | 1.0 | Below this, liquidation is allowed |
Users deposit wETH or wBTC to mint DNR. Each collateral type has an associated Chainlink price feed.
dnrEngine.depositCollateral(weth, 1 ether);After depositing sufficient collateral, users can mint Denari stablecoins up to their available limit.Minting automatically checks the user’s health factor — users cannot mint if it drops below the minimum.
dnrEngine.mintDNR(2000e18);Users burn their DNR to reduce debt and reclaim collateral.
dnrEngine.burnDNR(amount);After burning sufficient DNR, users can withdraw their collateral.
dnrEngine.redeemCollateral(weth, amount);When a user’s health factor falls below 1.0, their position becomes liquidatable. Liquidators can repay a portion of their DNR debt to seize collateral at a 10% discount.
dnrEngine.liquidate(user, weth, amountDNRToBurn);| Step | Description | Function |
|---|---|---|
| 1 | Deposit collateral (wETH / wBTC) | depositCollateral() |
| 2 | Mint DNR | mintDNR() |
| 3 | Price drop simulation | updateAnswer() |
| 4 | Check health factor | getHealthFactor() |
| 5 | Liquidate unhealthy position | liquidate() |
| 6 | Verify solvency | getHealthFactor() |
The Health Factor (HF) indicates how safe a user's position is.

If HF >= 1.0 → safe position
If HF < 1.0 → subject to liquidation
This Foundry deployment script handles the automated deployment of the Denari Protocol core contracts —
the Denari (DNR) stablecoin and the DNREngine — along with environment configuration via HelperConfig.s.sol.
File: script/DeployDNR.s.sol
Purpose: Deploys the core Denari Protocol contracts with the correct collateral and price feed setup.
| Contract | Description |
|---|---|
Denari.sol |
ERC20 stablecoin implementation (DNR). |
DNREngine.sol |
Core logic handling collateral, minting, burning, and liquidation. |
HelperConfig.s.sol |
Provides environment-specific configuration such as price feeds, collateral tokens, and deployer key. |
The script:
- Loads network-specific configuration from
HelperConfig.s.sol(e.g., WETH, WBTC, and Chainlink feeds). - Sets up arrays for token addresses and price feed addresses.
- Deploys the
Denaricontract. - Deploys the
DNREnginecontract with the deployed tokens and feeds. - Transfers ownership of the Denari stablecoin to the engine.
- Returns all deployed contract addresses.
HelperConfig
↓
Provides WETH/WBTC + Price Feeds
↓
DeployDNR.s.sol
↓
Deploys Denari.sol and DNREngine.sol
↓
Transfers Denari ownership → DNREngine
When executed, the script returns:
(DNREngine dnrEngine, Denari dnr, HelperConfig helperConfig)MIT License © 2025 Developed by Conrad Japhet