Core System-Wide Contracts (Deployed Once)
1. **CollateralRegistry.sol**
- Central registry that maps collateral tokens to their respective TroveManager addresses
- Maintains list of all supported collateral tokens
- Routes redemptions across different collateral branches
- Limited to maximum of 10 collateral types (hardcoded storage slots)
2. **BoldToken.sol**
- The protocol's stablecoin implementation
- ERC20 token with EIP-2612 permit functionality
- Handles minting and burning of BOLD tokens
3. **HintHelpers.sol**
- Helper contract for calculating hints for trove operations
- Used to find the correct position in the sorted list of troves
- Provides read-only functionality
4. **MultiTroveGetter.sol**
- Helper contract for fetching arrays of Trove data
- Provides batch reading functionality for trove information
### Branch-Level Contracts (Deployed Per Collateral)
5. **TroveManager.sol**
- Core logic for managing troves (loans)
- Handles liquidations, redemptions, and interest rate calculations
- Contains branch-specific parameters (MCR, CCR, SCR)
- Reference from `README.md`:
```markdown
startLine: 229
endLine: 235
```
6. **BorrowerOperations.sol**
- Handles all borrower actions (open, close, adjust troves)
- Manages collateral deposits and withdrawals
- Validates trove operations
7. **StabilityPool.sol**
- Holds BOLD deposits used for liquidations
- Distributes liquidation gains to depositors
- Manages yield distribution
8. **ActivePool.sol**
- Holds the active collateral and tracks total debt
- Manages interest distribution
- Handles collateral transfers
9. **DefaultPool.sol**
- Holds collateral and debt from liquidated troves
- Manages redistribution of liquidated assets
10. **SortedTroves.sol**
- Maintains ordered list of troves by interest rate
- Doubly-linked list implementation
- Handles insertion and reordering of troves
11. **CollSurplusPool.sol**
- Holds leftover collateral from liquidations
- Allows borrowers to reclaim their surplus collateral
12. **TroveNFT.sol**
- NFT representation of troves
- Tracks trove ownership
- Enables trove transfers
13. **GasPool.sol**
- Manages gas compensation for liquidations
- Holds ETH for gas compensation
### Price Feed Contracts (One Per Collateral)
14. **PriceFeeds/*.sol**
- Different implementations for each collateral type
- Handles oracle integrations and price calculations
- Examples: WETHPriceFeed.sol, WSTETHPriceFeed.sol, RETHPriceFeed.sol
The system is designed to support up to 10 different collateral types, with each collateral type having its own set of branch-level contracts. This architecture allows for independent management of different collateral types while maintaining system-wide coordination through the CollateralRegistry.