Design
Technical architecture and system design, including core contracts and libraries

Core Contracts
These contracts form the core of the system.
MultiSourceLoan - Main contract of the protocol where loans are originated/refinanced/repaid. It also keeps collateral in escrow.
Diamond.sol
- Core Diamond proxy implementation for upgradeable architecture.ControlFacet.sol
- Administrative functions including protocol configuration and operational controls.DiamondCut.sol
- Diamond standard facet for adding, replacing, and removing facets.DiamondLoup.sol
- Diamond standard facet for inspecting which facets and functions are available.DiamondInit.sol
- Initialization contract for setting up Diamond proxy with initial facets and configuration.LiquidationFacet.sol
- Liquidation management.LoanFacet.sol
- Core loan operations.ViewFacet.sol
- Read-only operations for querying loan states, user states, and protocol statistics.RefinanceLoanFacet.sol
- Loan refinancing logic.LoanExtensionFacet.sol
- Delegate/FlashLoan logic.
AuctionWithBuyoutLoanLiquidatorUpgradeable.sol
- Liquidation contract including buyout and auction.LoanManagerRegistryUpgradeable.sol
LoanManagerParameterSetterUpgradeable.sol
- Utility contract for setting of loan manager parameters.UserVault.sol
- Allows users to mint a vault to collateralized multiple NFTs and borrow against them as a bundle under a single loan.AddressManagerUpgradeable.sol
- Manager of whitelisted collections/erc20 supported by BAE lending.FeeDiscountManagerUpgradeable.sol
- Manages dynamic protocol fee reductions based on borrower NFT holdings or keeper signaturesListNftAddressesValidator.sol
- Enables multi-collection offers by validating NFT contracts against approved collection listsRangeValidator.sol
- Validates collection offers across a range of token IDs enabling collection offers for specific Artblocks Curated collections like Fidenzas, Chromie Squiggles, and more. Used for V1, V2, and V3.
Librarires & Base Inherit Contract
AccessControl.sol
- Base contract providing role-based access control functionality for protocol governanceLibAccessControl.sol
- Library containing access control utilities and permission checking logicLibDiamond.sol
- Diamond standard library for managing facets, selectors, and Diamond proxy functionalityLibHash.sol
- Cryptographic utilities for offer validation, signature verification, and data integrityLibInterest.sol
- Interest calculation utilities supporting pro-rata interest and complex tranche structuresLibLoan.sol
- Core loan logic including validation, capacity management, and state transitionsLibLoanStructs.sol
- Data structure definitions for loans, offers, and protocol entitiesLibValidator.sol
- Input validationAccessControlStorage.sol
- Storage library for role-based permissions and access control data using Diamond storageBaseStorage.sol
- Storage library for core protocol configuration including currencies, collections, and global parametersLoanStorage.sol
- Storage library for loan-specific state management including active loans, offers, and tranche information
External Libraries
forge-std v1.9.7
- Testing framework@openzeppelin-contracts v5.3.0
- Standard contract libraries@openzeppelin-contracts-upgradeable v5.3.0
- Upgradeable contract patternsdelegate-registry v2.0
- Delegation management system
Last updated