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
  • Contract Storage
  • Core Functionalities
  • Access Control Modifiers
  • Events
  • Strategy Interaction Functions
  • Configuration and Maintenance
  • Utility and Helper Functions

Was this helpful?

Export as PDF
  1. Vaults
  2. Interfaces

TokenizedStrategy

https://github.com/Into-the-Fathom/fathom-vaults-smart-contracts/blob/master/contracts/strategy/TokenizedStrategy.sol

The TokenizedStrategy contract serves as a proxy-style implementation that centralizes logic, storage, and management for strategies inheriting from BaseStrategy. It facilitates the creation of ERC4626 compliant vaults by handling interactions and state transitions through delegated calls to this contract.

Contract Storage

  • StrategyData: This struct consolidates all storage variables needed for a strategy, optimizing for gas efficiency by reducing the frequency of storage slot loading during function execution. Key elements include:

    • initialDomainSeparator and initialChainId: Utilized for EIP-712 compliance across different chains.

    • totalSupply, totalIdle, and totalDebt: Track the total shares issued, the idle assets, and the assets actively deployed, respectively.

    • profitUnlockingRate and fullProfitUnlockDate: Manage the unlocking of profit over time.

    • management, keeper, emergencyAdmin: Addresses responsible for strategy management, routine maintenance, and emergency interventions.

Core Functionalities

  • Initialization and Strategy Setup: On the deployment of a new strategy, essential parameters like asset type, strategy name, and roles are established.

  • Asset Management: Functions to deploy funds (deployFunds), free funds (freeFunds), and report the strategy's performance (report) encapsulate core investment strategy operations.

  • Fee Management: The contract facilitates setting and adjusting performance fees, which are calculated on the profits generated by the strategy.

Access Control Modifiers

  • onlyManagement: Ensures that only the designated management address can perform certain administrative tasks.

  • onlyKeepers: Restricts sensitive operations such as reporting to either the designated keeper or management addresses.

  • onlyEmergencyAuthorized: Allows for emergency actions, such as strategy shutdown, to be executed by authorized emergency administrators.

Events

  • Management Events: Such as UpdateManagement, signal changes in management roles or parameters.

  • Operational Events: Including Deposit and Withdraw, provide transactional transparency for assets moving in and out of the strategy.

  • Performance Reporting: The Reported event logs the outcomes of performance reports, detailing profits, losses, and fees.

Strategy Interaction Functions

  • deposit/mint: For adding assets to the strategy in exchange for shares.

  • withdraw/redeem: For removing assets from the strategy, optionally handling losses within specified bounds.

  • shutdownStrategy/emergencyWithdraw: For halting new investments and managing assets in response to adverse conditions.

Configuration and Maintenance

  • setPerformanceFee, setKeeper, setEmergencyAdmin: Functions to adjust operational parameters and roles to respond to evolving strategy needs or external conditions.

  • shutdownStrategy: A critical function used to cease all investment activities, allowing the strategy to only handle withdrawals and necessary maintenance.

Utility and Helper Functions

  • convertToShares/convertToAssets: Convert between the underlying asset and shares based on the current state of the strategy, aiding in calculations for deposits and withdrawals.

  • _updateBalances: Ensures internal accounting reflects the actual state of assets within the strategy, crucial after any interaction that alters the balance of deployed or idle assets.

PreviousBaseStrategyNextDeployments

Last updated 11 months ago

Was this helpful?