Loan
Loan is created when a borrower is matched with a Lender to create a position.
Each Loan contract contains:
struct LoanData {
address borrower;
address lenderVault;
address collToken;
address borrowToken;
uint256 collAmt;
uint256 borrowAmt;
uint256 repaidAmt;
uint256 expiresAt;
}
How is a Loan created?
Just like the DLV, MethLab uses minimal proxy clones to create Loans.
// LendersVault.sol
function createLoan(
DataTypes.BorrowParams calldata bParams,
bytes calldata data
) external whenNotPaused nonReentrant returns (address loanContract)
The createLoan
function is available in the DelegatedLenderVault.solIf there's not enough liquidity to fulfil a particular borrower's intents, a loan may still be created using multiple Vaults together.
Loan Executor
LoanExecutor solves for fragmented liquidity. It is a periphery contract that contains the logic to create multiple loans in a single transaction. If there's not enough liqudity, or if the borrower wants to intentionally create loans using various vaults, they can do so using the executeLoans
available in the LoanExecutor.
Learn about the various LoanExecutor functions here.