Loan Proposal Implementation
LoanProposalImpl: Contract for managing loan proposals, including creation, negotiation, and handling of subscriptions, conversions, collateral transfers, rollbacks, and defaults.
Summary:
LoanProposalImpl.sol
is a key contract that maintains and manages loan proposals in the lending system. The contract provides functionalities for the creation, negotiation, acceptance, finalization, and rollback of loan terms. Furthermore, the contract keeps track of the subscriptions and conversions related to each loan proposal.
Key Features:
Stores dynamic and static data related to loan proposals.
Maps and tracks total converted subscriptions, and whether lenders have exercised conversion or claimed repayment.
Allows the proposal of loan terms, acceptance of loan terms, and finalization of loan terms and collateral transfer.
Provides a function to rollback a proposal if conditions are not met.
Handles cases of default, detailing the total subscriptions that have claimed on default.
Key Functions:
initialize()
: Initializes theLoanProposalImpl
contract with necessary parameters such as factory, arranger, funding pool,collToken
,whitelistAuthority
, and grace periods.proposeLoanTerms()
: Allows an arranger to propose terms for a new loan.acceptLoanTerms()
: Allows a borrower to accept the proposed loan terms.finalizeLoanTermsAndTransferColl()
: Finalizes the loan terms and handles the transfer of collateral from the borrower.rollback()
: Allows to rollback a proposal if conditions are not met.
Libraries:
SafeERC20
: The contract uses the OpenZeppelin'sSafeERC20
library for safe operations with ERC20 tokens.SafeCast
: The contract uses OpenZeppelin'sSafeCast
for safe type casting.
Interfaces:
IERC20Metadata
: The contract imports theIERC20Metadata
interface, which is an extension of IERC20 providing 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 imports theIFundingPoolImpl
interface outlining the main functionalities of theFundingPoolImpl
.
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