Funding Pool Implementation

FundingPoolImpl: Core contract serving as a pool for lenders' deposits, tracking loan proposal subscriptions, and managing execution. Facilitates deposit and withdrawal of funds and subscriptions.

Summary:

FundingPoolImpl.sol is a core contract that serves as a pool for deposits from lenders. It also tracks subscriptions to loan proposals and manages loan proposal execution. The contract allows lenders to deposit and withdraw their funds, subscribe or unsubscribe to loan proposals, and facilitate the execution of loan proposals.

Key Features:

  • Stores the balances and subscription amounts of lenders.

  • Tracks total subscriptions for each loan proposal.

  • Allows deposit and withdrawal of funds.

  • Allows lenders to subscribe or unsubscribe to loan proposals.

  • Handles loan proposal execution, including transferring funds and fees.

Key Functions:

  • initialize(): Initializes the FundingPoolImpl contract with the factory and deposit token addresses.

  • deposit(): Allows lenders to deposit funds into the funding pool.

  • withdraw(): Allows lenders to withdraw their funds from the funding pool.

  • subscribe(): Allows lenders to subscribe to loan proposals.

  • unsubscribe(): Allows lenders to unsubscribe from loan proposals.

  • executeLoanProposal(): Handles loan proposal execution, transferring the funds and fees accordingly.

Libraries:

  • SafeERC20: This contract uses SafeERC20 for safe transfer of ERC20 tokens.

Interfaces:

  • IERC20Metadata: The contract imports IERC20Metadata interface, which is an extension of IERC20 with methods for getting the token's name, symbol, and decimals.

  • IFactory: The contract imports the IFactory interface, which defines the functions of the factory contract.

  • IFundingPoolImpl: The contract implements the IFundingPoolImpl interface, which outlines the main functionalities of the FundingPoolImpl contract.

  • ILoanProposalImpl: The contract imports the ILoanProposalImpl interface, which outlines the main functionalities of the LoanProposalImpl contract.

  • IMysoTokenManager: The contract imports the IMysoTokenManager interface, which outlines the operations of the MysoTokenManager.

Inheritance:

  • Initializable: The contract inherits from Initializable, providing a mechanism to initialize state in a contract at creation time in a controlled manner.

  • ReentrancyGuard: The contract inherits from ReentrancyGuard, providing a mechanism to prevent reentrant calls.

Dependencies:

  • Constants: The contract imports Constants for defining constants such as BASE and MIN_WAIT_UNTIL_EARLIEST_UNSUBSCRIBE.

  • DataTypesPeerToPool: The contract imports DataTypesPeerToPool to access the LoanTerms struct used for managing loan terms.

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

Last updated