Factory

https://github.com/Into-the-Fathom/fathom-vaults-smart-contracts/blob/master/contracts/factory/packages/FactoryPackage.sol

Factory is proxy, and its implementation is FactoryPackage.

The FactoryPackage contract is responsible for managing and deploying vaults with specific configurations. It maintains control over the vault's deployment template, fee structure, and also tracks all deployed vaults.

State Variables:

  • vaultPackage: Address of the vault package used as the template for deploying new vaults.

  • feeRecipient: Address where collected fees are sent.

  • feeBPS: Basis points for calculating fees on transactions.

  • vaults: Dynamic array storing addresses of all vaults deployed by this factory.

  • vaultCreators: Mapping from vault address to the creator's address.

Set Functions

updateVaultPackage

  • Arguments:

    • _vaultPackage: New address for the vault package to update the template for future vault deployments.

updateFeeConfig

  • Arguments:

    • _feeRecipient: New address for receiving the fees collected from the operations.

    • _feeBPS: New basis points for the fee, updating how the fee percentage is calculated.

deployVault

  • Arguments:

    • _profitMaxUnlockTime: The maximum time over which profits are unlocked in the deployed vault.

    • _assetType: Type identifier of the asset, useful for handling different asset behaviors or requirements.

    • _asset: Address of the asset (usually a token) that the vault will manage.

    • _name: Human-readable name of the vault for identification.

    • _symbol: Symbol of the vault's token.

    • _accountant: Address of the accountant contract that manages fee assessments and other accounting tasks for the vault.

    • _admin: Address that will have administrative privileges over the newly created vault.

Read Functions

getVaults

  • Returns: An array of addresses representing all vaults that have been deployed by this factory.

getVaultCreator

  • Arguments:

    • _vault: The address of the vault for which the creator's address is queried.

  • Returns: The address of the creator who initially deployed the specified vault.

protocolFeeConfig

  • Returns: A tuple containing the current fee basis points (uint16) and the address of the fee recipient. This provides a quick overview of how fees are being handled by the factory.

Events:

VaultPackageUpdated

  • Parameters:

    • vaultPackage (address indexed): Emitted when the vault package address is updated.

FeeConfigUpdated

  • Parameters:

    • feeRecipient (address indexed): Emitted when the fee recipient address is updated.

    • feeBPS (uint16 indexed): Emitted when the fee percentage basis points are updated.

VaultDeployed

  • Parameters:

    • vault (address indexed): Address of the newly deployed vault.

    • profitMaxUnlockTime (uint32 indexed): Profit unlock time for the vault.

    • asset (address indexed): Asset managed by the vault.

    • name (string): Name of the vault.

    • symbol (string): Symbol of the vault’s token.

    • accountant (address): Accountant contract address.

    • admin (address): Admin address with privileges over the vault.

Last updated

Copyright© Fathom App 2024.