Architecture
Fathom Lending's contract architecture is facilitating seamless interactions between various components of the protocol. The architecture consists of several core smart contracts that handle different aspects of the lending and borrowing process. This modular approach ensures that each contract has a well-defined role, enhancing maintainability and scalability.
These smart contracts are the AAVE V3 direct fork. They are battle-tested on various networks and are considered safe.
Key Contracts and Their Roles
LendingPool: The central contract that manages deposits, withdrawals, borrowing, and repayments. It interacts with other contracts to execute these operations and maintain the protocol's state.
LendingPoolCore: Stores the protocol's internal data, such as user balances, reserve configurations, and interest rate models. It serves as the data layer for the LendingPool contract.
LendingPoolConfigurator: Allows authorized entities to configure the protocol's parameters, such as interest rate models, collateral factors, and reserve assets. It ensures that the protocol can be updated and optimized as needed.
InterestRateStrategy: Determines the interest rates for borrowing and lending based on the utilization rates of the asset pools. Multiple strategies can be implemented to accommodate different assets and market conditions.
CollateralManager: Manages collateral for borrowers, ensuring that loans are properly collateralized and initiating the liquidation process when necessary.
PriceOracle: Provides real-time price data for assets, enabling accurate calculation of collateral values and ensuring that loans remain adequately collateralized.
Contract Interactions and Data Flow
The interaction between contracts in Fathom Lending follows a well-defined flow to ensure efficiency and security. Here’s how these interactions typically occur:
User Interaction: Users interact with the LendingPool contract to deposit assets, borrow funds, repay loans, and withdraw assets.
Data Access: The LendingPool contract interacts with the LendingPoolCore contract to access and update user balances, reserve configurations, and other protocol data.
Interest Calculation: When users deposit or borrow assets, the LendingPool contract calls the InterestRateStrategy contract to determine the applicable interest rates based on current utilization rates.
Collateral Management: When a user borrows assets, the LendingPool contract interacts with the CollateralManager contract to verify collateral requirements and manage collateral deposits.
Price Updates: The PriceOracle contract continuously updates asset prices, which are used by the LendingPool and CollateralManager contracts to assess collateral values and determine liquidation thresholds.
Liquidation: If a borrower's collateral falls below the required threshold, the CollateralManager contract initiates the liquidation process, interacting with the LendingPool contract to repay the loan and sell the collateral.
Last updated