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 theFundingPoolImpl
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 usesSafeERC20
for safe transfer of ERC20 tokens.
Interfaces:
IERC20Metadata
: The contract importsIERC20Metadata
interface, which is an extension of IERC20 with methods for getting the token's name, symbol, and decimals.IFactory
: The contract imports theIFactory
interface, which defines the functions of the factory contract.IFundingPoolImpl
: The contract implements theIFundingPoolImpl
interface, which outlines the main functionalities of theFundingPoolImpl
contract.ILoanProposalImpl
: The contract imports theILoanProposalImpl
interface, which outlines the main functionalities of theLoanProposalImpl
contract.IMysoTokenManager
: The contract imports theIMysoTokenManager
interface, 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 importsConstants
for defining constants such asBASE
andMIN_WAIT_UNTIL_EARLIEST_UNSUBSCRIBE
.DataTypesPeerToPool
: The contract importsDataTypesPeerToPool
to access theLoanTerms
struct used for managing loan terms.Errors
: The contract imports theErrors
library, which provides custom error messages for different exceptional scenarios.
Last updated