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 theFundingPoolImplcontract 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 usesSafeERC20for safe transfer of ERC20 tokens.
Interfaces:
IERC20Metadata: The contract importsIERC20Metadatainterface, which is an extension of IERC20 with methods for getting the token's name, symbol, and decimals.IFactory: The contract imports theIFactoryinterface, which defines the functions of the factory contract.IFundingPoolImpl: The contract implements theIFundingPoolImplinterface, which outlines the main functionalities of theFundingPoolImplcontract.ILoanProposalImpl: The contract imports theILoanProposalImplinterface, which outlines the main functionalities of theLoanProposalImplcontract.IMysoTokenManager: The contract imports theIMysoTokenManagerinterface, which outlines the operations of theMysoTokenManager.
Inheritance:
Initializable: The contract inherits fromInitializable, providing a mechanism to initialize state in a contract at creation time in a controlled manner.ReentrancyGuard: The contract inherits fromReentrancyGuard, providing a mechanism to prevent reentrant calls.
Dependencies:
Constants: The contract importsConstantsfor defining constants such asBASEandMIN_WAIT_UNTIL_EARLIEST_UNSUBSCRIBE.DataTypesPeerToPool: The contract importsDataTypesPeerToPoolto access theLoanTermsstruct used for managing loan terms.Errors: The contract imports theErrorslibrary, which provides custom error messages for different exceptional scenarios.
Last updated