Lender Vault Factory
LenderVaultFactory.sol: A contract facilitating the creation and registration of LenderVault instances using deterministic cloning and integration with the AddressRegistry.
Summary:
LenderVaultFactory.sol
is a contract responsible for creating new instances of LenderVault contracts. It interacts with the AddressRegistry contract to store and manage the addresses of the created vaults.
Key Features:
Creates new instances of LenderVault contracts.
Uses a deterministic cloning mechanism to create vault instances with unique addresses.
Initializes the created vault with the address of the factory and the AddressRegistry contract.
Registers the newly created vault address in the AddressRegistry.
Key Functions:
constructor(address _addressRegistry, address _lenderVaultImpl)
: Initializes the LenderVaultFactory contract with the addresses of the AddressRegistry and the LenderVault implementation contracts.createVault()
: Creates a new LenderVault instance by cloning the LenderVault implementation contract. It initializes the new vault with the address of the caller and the AddressRegistry contract. The newly created vault address is then registered in the AddressRegistry.
Libraries:
Clones
: The contract imports the Clones library from the OpenZeppelin library to facilitate the deterministic cloning mechanism used for creating new LenderVault instances.Errors
: The contract imports the Errors library, which provides custom error messages for different exceptional scenarios.
Interfaces:
ILenderVaultImpl
: The contract imports the ILenderVaultImpl interface to interact with the LenderVault implementation contract and call the initialize function on the newly created vault.ILenderVaultFactory
: The contract imports the ILenderVaultFactory interface, which defines the createVault function that needs to be implemented by the LenderVaultFactory contract.IAddressRegistry
: The contract imports the IAddressRegistry interface to interact with the AddressRegistry contract and register the newly created vault address.
Dependencies:
AddressRegistry: The contract depends on the AddressRegistry contract, as it interacts with it to register the addresses of the created LenderVault instances.
Last updated