MUSD is a collateralized debt position (CDP) based on Threshold USD, which is a fork of Liquity.
Architectural Overview
The protocol allows Bitcoin holders to mint MUSD by using their BTC as collateral. This means users can access USD-denominated liquidity while keeping their Bitcoin investment intact. The primary components are how the system handles custody, maintains the price peg, and earns fees.Custody
A user opens up a position by callingBorrowerOperations.openTrove, providing BTC, and requesting MUSD. The BTC is routed to the ActivePool, where it stays until a user either:
- Withdraws (via
BorrowerOperations.withdrawColl) - Pays off their debt (via
BorrowerOperations.closeTrove) - Is redeemed against (via
TroveManager.redeemCollateral) - Gets liquidated (via
TroveManager.liquidate)
StabilityPool, in which case the BTC is transferred there, or the debt and collateral are absorbed and redistributed to other users, in which case the BTC is transferred to the DefaultPool.
Maintaining the Peg
Price Floor ($1)
We maintain the price floor of $1 through arbitrage, an external USD ↔ BTC price oracle, and the ability to redeem MUSD for BTC at a 1:1 rate (viaTroveManager.redeemCollateral).
Example arbitrage scenario:
Imagine that MUSD was trading for 100k. An arbitrageur with $800 could:
1
Buy MUSD
Trade $800 for 1000 MUSD.
2
Redeem for BTC
Redeem 1000 MUSD for 0.01 BTC ($1000 worth of BTC).
3
Sell BTC
Sell 0.01 BTC for $1000.
Price Ceiling ($1.10)
We maintain a price ceiling of $1.10 via the minimum 110% collateralization ratio. Example arbitrage scenario: Imagine that MUSD is trading for 100k. An arbitrageur with $100k could:1
Buy BTC
Buy 1 BTC (worth $100k).
2
Open Trove
Open a trove with 1 BTC as collateral and borrow the maximum 90,909 MUSD.
3
Sell MUSD
Sell 90,909 MUSD for $109,091.
Fees
The protocol collects fees in four places:percentage
default:"0.1%"
Governable fee added as debt to a trove but minted to governance.
percentage
default:"0.75%"
Governable fee taken whenever a user redeems MUSD for BTC.
percentage
Operates like the borrowing rate when refinancing a trove.
percentage
Simple, fixed interest on the principal of the loan.
Core Ideas
Protocol Bootstrap Loan & Stability Pool
Unlike protocols that incentivize stability pool deposits with token rewards, MUSD’s Stability Pool is initially populated with a bootstrapping loan. This MUSD can only be used for liquidations.
Protocol Controlled Value (PCV)
Over time, as the protocol accrues interest and fees, the bootstrap loan gets repaid, and the portion of the MUSD in the Stability Pool that is Protocol Controlled Value increases. The PCV contract manages the distribution of accrued MUSD from interest and fees, with the split between loan repayment and a fee recipient being governable.Immutability and Upgradability
Repository Structure
The MUSD repository contains:- Smart Contracts: Core MUSD protocol contracts
- Integration Examples: Sample implementations
- Testing Suite: Comprehensive test coverage
- Documentation: Technical specifications
Development Setup
Prerequisites
- Node.js 18+ (check
.nvmrcfor exact version) - pnpm package manager
- Foundry for smart contract development
- Git
Installation
1
Clone Repository
2
Install Dependencies
3
Configure Environment
System Overview
The MUSD system consists of four main contract groups:- Core Protocol: Handles main operations like opening/closing positions and managing collateral
- Asset Pools: Manages the system’s various collateral and liquidity pools
- Supporting Contracts: Provides services like price feeds, remote trove management, and PCV
Integration Guide
Opening a Trove
For optimal gas efficiency, provide hints for the trove’s insertion position in the sorted list.Adjusting and Closing Troves
You can similarly adjust (adjustTrove) or close (closeTrove) troves. Convenience functions are also available for withdrawing/repaying MUSD and adding/withdrawing collateral.
For complete examples, see the demo test file.
Liquidations
When a trove’s collateralization ratio falls below 110%, it can be liquidated by anyone. The liquidator is rewarded with a gas compensation and a percentage of the trove’s collateral.Liquidation Flows
- With Stability Pool: The Stability Pool’s MUSD is burned to cover the debt, and it seizes the collateral.
- Partial Stability Pool: If the pool is insufficient, it covers what it can, and the remaining debt/collateral is redistributed to other active troves.
- Empty Stability Pool: All debt and collateral are redistributed to other active troves.
Executing a Liquidation
Redemptions
Any MUSD holder can redeem their tokens for an equivalent value of BTC, which helps maintain the $1 peg. The system redeems against the trove with the lowest collateral ratio. For step-by-step instructions and code, see the dedicated guide:Borrower Risks
Testing
Key Changes from THUSD
- Fixed-Interest Borrowing: Interest rates are fixed when a trove is opened and can be refinanced.
- Protocol Controlled Value (PCV): Manages fees for loan repayment and other system needs.
- EIP-712 Signature Verification: Allows for gasless transaction authorizations.
- No Special Recovery Mode Liquidations: Liquidations follow a single process.
Definitions
concept
A collateralized debt position (CDP).
metric
Individual Collateralization Ratio of a single trove.
metric
Total Collateralization Ratio of the entire system.
state
Activated if TCR falls below 150%, enforcing stricter borrowing rules.
Additional Resources
- MUSD Main README - Comprehensive architectural overview
- Demo Test Suite - Working code examples
- MUSD User Guide - End-user documentation