Fathom Protocol
  • Introduction
  • FXD Stablecoin
    • FXD Smart Contract Architecture
    • Minting and Burning Mechanisms with LTV Ratio
    • Soft-Pegging to the US Dollar
    • Opening and closing position flows
    • BookKeeping mechanism
      • Stablecoin Accounting
      • Collateral Accounting
    • Liquidation
      • Fixed Spread Liquidation Strategy
      • Liquidation process walk through
    • Emergency Shutdown
    • Maths for position safety
    • Fee structure
    • Risk Management
    • Interfaces
      • ProxyWalletRegistry
      • ProxyWallet
        • FathomStablecoinProxyActions
      • CollateralPoolConfig
      • BookKeeper
      • FXD
      • LiquidationEngine
      • FlashMintModule
      • PriceFeed
      • ShowStopper
      • StabilityFeeCollector
      • SystemDebtEngine
      • AdminControls
    • Deployments
      • XDC Network
    • User Guides
      • Open FXD position
      • Top Up FXD Position
      • Repay and close FXD position
    • Fathom Stablecoin Smart Contracts
    • Fathom Stablecoin Subgraph
  • Vaults
    • Key Features
    • Definitions
    • Architecture
    • Fees
    • Workflows
    • Vault Management
    • Strategy Creation
    • Interfaces
      • Factory
      • Vault
      • BaseStrategy
      • TokenizedStrategy
    • Deployments
      • XDC Network
    • User Guides
      • Deposit and Withdraw in Vault
    • Fathom Vaults Smart Contracts
    • Fathom Vaults Subgraph
  • Lending
    • Core Concepts
    • Protocol Mechanics
    • Architecture
    • Interfaces
      • FmToken
      • VariableDebtToken
      • StableDebtToken
      • L2Pool
      • PoolAddressesProvider
    • User Guides
      • Supply, Borrow, Repay and Withdraw Asset
    • Deployments
      • XDC Network
    • Fathom Lending Smart Contracts
    • Fathom Lending Subgraph
  • DEX
    • Core Concepts
    • Architecture
    • Interfaces
      • Factory
      • Pair
      • Router
    • User Guides
      • Providing Liquidity
      • Swapping Assets
    • Deployments
      • XDC Network
    • Fathom DEX Smart Contracts
    • Fathom DEX Subgraph
  • DAO
    • DAO Structure
    • Governance Process
    • Staking Process
    • Treasury Management
    • Risk Management and Security Measures
    • Contributing to Fathom DAO
    • Interfaces
      • FTHM
      • Staking
        • Vault
        • RewardsCalculator
        • vFTHM
      • Governance
        • TimelockController
    • Deployments
      • XDC Network
    • User Guides
      • Staking
      • Proposing
      • Voting
    • Fathom DAO Smart Contracts
    • Fathom DAO Subgraph
  • Whitepaper
    • Version 1.0
  • Resources
  • FXD Deployments
  • FTHM Deployments
  • Privacy Policy
  • Terms of Service
Powered by GitBook

Copyright© Fathom App 2024.

On this page

Was this helpful?

Export as PDF
  1. Lending

Architecture

PreviousProtocol MechanicsNextInterfaces

Last updated 11 months ago

Was this helpful?

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 . They are battle-tested on various networks and are considered safe.

Key Contracts and Their Roles

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. CollateralManager: Manages collateral for borrowers, ensuring that loans are properly collateralized and initiating the liquidation process when necessary.

  6. 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:

  1. User Interaction: Users interact with the LendingPool contract to deposit assets, borrow funds, repay loans, and withdraw assets.

  2. Data Access: The LendingPool contract interacts with the LendingPoolCore contract to access and update user balances, reserve configurations, and other protocol data.

  3. 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.

  4. Collateral Management: When a user borrows assets, the LendingPool contract interacts with the CollateralManager contract to verify collateral requirements and manage collateral deposits.

  5. 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.

  6. 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.

AAVE V3 direct fork