Lender Vault Implementation

LenderVaultImpl: A contract for secure loan storage and management, featuring deposit and collateral handling, signer management, token transfers, and compartment creation.

Summary:

The LenderVaultImpl contract serves as a secure storage for loans and manages collateral locking and unlocking, loan processing, token transfers, signer management, and more. It is designed to be used in conjunction with the borrower gateway and other components of a lending platform.

Key Features

  • Managing Deposits and Collateral: The contract handles the deposits of a given lender as well as manages any collateral pledge amounts from borrowers that consume loans from a given lender.

  • Storing Loan Info: The contract stores all relevant loan data and manages collateral locking and unlocking.

  • Signer Management: Multiple signers can be added to the vault to delegate loan quote management to 3rd parties.

  • Token Transfers: The contract handles safe transfers of tokens between addresses.

  • Compartment Creation: Compartments can be created for collateral tokens, allowing for advanced collateral management and support.

Key Functions

The LenderVaultImpl contract provides the following key functions:

  • withdraw(): Allows the owner to withdraw a specified amount of tokens from the vault.

  • transferTo(): Enables the Borrower Gateway contract to transfer tokens from the vault to a specified recipient.

  • transferCollFromCompartment(): Facilitates the transfer of collateral tokens from a compartment to the vault.

  • setMinNumOfSigners(): Sets the minimum number of signers required for a transaction.

  • addSigners(): Allows the owner to add additional signers to the vault.

  • removeSigner(): Allows the owner to remove a signer from the list of authorized signers.

  • loan(): Retrieves loan information based on the loan ID.

  • totalNumLoans(): Returns the total number of loans stored in the vault.

  • validateRepayInfo(): Validates repayment information provided for a loan.

Libraries

The LenderVaultImpl contract utilizes the following libraries:

  • SafeERC20: A library for safely handling ERC20 token transfers.

  • SafeCast: A library for safely casting between different numeric types.

  • Clones: A library for creating compartment clones.

Interfaces

The LenderVaultImpl contract implements the following interfaces:

  • Initializable: Allows for initialization of the contract state.

  • Ownable: Provides ownership-related functionality.

  • ILenderVaultImpl: Defines the interface for the Lender Vault.

Dependencies

The LenderVaultImpl contract relies on the following external contracts and libraries:

  • OpenZeppelin Contracts: The contract imports various components from the OpenZeppelin Contracts library, including ERC20 token interfaces, safe transfer functionality, and more.

Last updated