Factory

Factory: Core contract for initiating loan proposals and funding pools. Manages fee splits, lender whitelisting, and links with Myso token manager.

Summary:

The Factory.sol contract is a core component of a DeFi ecosystem, being responsible for creating loan proposals and funding pools. It also handles lender whitelisting, checking whitelist statuses, and updating whitelists. The Factory contract includes important safety features such as address verification and reentrancy guard.

Key Features:

  • Creation of loan proposals and funding pools.

  • Management of the whitelisting process for lenders.

  • Ability to check if a borrower or a lender is whitelisted.

  • Sets arranger fees for loans.

  • Maintains a registry of loan proposals and funding pools.

  • Supports updating the MYSO token manager address.

  • Contains security checks to prevent reentrancy attacks and verify valid addresses.

Key Functions:

  • createLoanProposal(): Creates a new loan proposal and registers it in the loanProposals array.

  • createFundingPool(): Creates a new funding pool and registers it in the fundingPools array.

  • setArrangerFeeSplit(): Sets the arranger fee split for a loan.

  • claimLenderWhitelistStatus(): Allows lenders to claim their whitelist status until a specific time by providing a valid signature.

  • updateLenderWhitelist(): Updates the whitelist status for multiple lenders.

  • setMysoTokenManager(): Updates the MYSO token manager address.

  • isWhitelistedBorrower(): Checks if a borrower is currently whitelisted by a specific authority.

  • isWhitelistedLender(): Checks if a lender is currently whitelisted by a specific authority.

  • owner(): Returns the owner of the contract.

Libraries:

  • ECDSA: The contract imports the ECDSA library from the OpenZeppelin library for ECDSA signature verification.

  • Clones: The contract uses OpenZeppelin's Clones library for creating clone contracts.

Interfaces:

  • IFactory: The contract implements the IFactory interface which provides the function definitions that Factory.sol needs to implement.

  • IFundingPoolImpl, ILoanProposalImpl, IMysoTokenManager: Interfaces for interacting with funding pools, loan proposals, and the MYSO token manager.

Inheritance:

  • Ownable: The contract inherits from the Ownable contract, which provides basic access control functionality, i.e., a simple way to restrict access to certain functions to the owner of the contract.

  • ReentrancyGuard: The contract uses the ReentrancyGuard contract from OpenZeppelin which helps in preventing reentrancy attacks.

Dependencies:

  • Constants: The contract imports the Constants library which contains constant values used throughout the contract.

  • Errors: The contract imports the Errors library, which provides custom error messages for different exceptional scenarios.

Last updated