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:
The arbitrageur profits 1.
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:
The arbitrageur profits 1.10.
Fees
The protocol collects fees in four places:Governable fee added as debt to a trove but minted to governance.
Governable fee taken whenever a user redeems MUSD for BTC.
Operates like the borrowing rate when refinancing a trove.
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
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
A collateralized debt position (CDP).
Individual Collateralization Ratio of a single trove.
Total Collateralization Ratio of the entire system.
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