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. FXD Stablecoin
  2. Interfaces

PriceFeed

https://github.com/Into-the-Fathom/fathom-stablecoin-smart-contracts/blob/master/contracts/main/price-feeders/CentralizedOraclePriceFeed.sol

The CentralizedOraclePriceFeed contract utilizes a centralized oracle source to fetch the latest prices of assets. It introduces a delay in price updates to mitigate the risks associated with price manipulation and flash loan attacks. The delayed price update ensures that fetched prices do not immediately affect the system, providing a buffer to detect and react to potential price anomalies.

CentralizedOraclePriceFeed is named centralized because it utilizes Oracle data that can be fetched from off-chain centralized sources (like Chainlink, Supra, and other oracles), not from pure onchain (DEX) data. Oracles themselves can be decentralized, and CentralizedOraclePriceFeed isn't responsible for the quality of the data.

Storage Variables

  • oracle: Address of the centralized oracle contract (address). This oracle provides the latest price data.

  • accessControlConfig: Address of the access control contract (IAccessControlConfig). It is used to manage roles and permissions within the contract.

  • latestPrice: Latest fetched price information stored as PriceInfo, which includes the price and the timestamp of the last update.

  • delayedPrice: The price that is currently being used by the system, delayed by a certain period defined by timeDelay.

  • timeDelay: The delay period (in seconds) that determines how long fetched price data must wait before being considered valid within the system.

  • priceLife: The duration (in seconds) for which a price is considered valid after being updated.

  • poolId: Identifier for the specific pool or asset that this price feed pertains to.

Functions

  • setOracle(address _oracle): Updates the oracle address. This function can only be called by the owner or governance role.

  • setTimeDelay(uint256 _seconds): Sets the time delay for the price update. This can only be adjusted by the owner or governance role.

  • setPriceLife(uint256 _seconds): Sets the duration for which a price is considered valid.

  • retrivePrice(): Fetches the latest price from the oracle and updates the price information in the contract.

Events

  • LogSetTimeDelay(address indexed _caller, uint256 _seconds): Emitted when the time delay is updated.

  • LogSetPriceLife(address indexed _caller, uint256 _second): Emitted when the price life duration is updated.

  • LogPeekPriceFailed(address indexed _caller, string _reason): Emitted if fetching the latest price fails.

PreviousFlashMintModuleNextShowStopper

Last updated 1 year ago

Was this helpful?