market
collateral
collateral
directory contains the interface and implementation of the collateral escrowinit()
initializing the collateral escrowdeposit()
depositing collateral tokenswithdraw()
withdrawing collateral tokensloanSupply()
returning the loan supply of collateraltotalSupply()
returning the total supply of the collateralICollateralEscrow
libraries
LibCollateral
contains functions that interact with the ICollateralEscrow
LibConsensus
contains one function to process loan terms processLoanTerms()
and abstracted functions like _getConsensus()
, _getChainId()
and validateLoanRequest()
to help with processing the loan termsLibLoans
contains functions that deal with pulling information from respective loansfacets
CollateralFacet
, CreateLoanFacet
, LoanDataFacet
, RepayFacet
and the SignersFacet
.CollateralFacet
interfaces directly with the LibCollateral
to deposit, add, get and withdraw collaterals. LibLoans
is also used to help with some functionsCreateLoanFacet
connects to multiple libraries to help:createLoanWithTerms()
create a loantakeOutLoan()
take out a loantakeOutLoanWithNFTs()
take out a loan with an NFTCreateLoanLib
that:initLoan()
initializes a loancreateEscrow()
creates a loan escrowverifyCreateLoan()
verify a newly created loanLoanDataFacet
contains functions that deals with pulling out data from both loans and loan escrows. Data includes :getLoanTerms()
loan termsgetBorrowerLoans()
borrower loansgetDebtOwed()
debt owedgetInterestOwed()
interest owedgetCollateralNeededInfo()
collateral neededRepayFacet
contains functions that deal with both the repaying and the liquidation of loans given that a user wants to pay a little bit or a loan is undercollateralized (or expired), respectively. Functions include:escrowRepay()
repaying the loan with the respective escrowrepayLoan()
repaying the loan from a regular addressliquidateLoan()
liquidate a loan and payout the liquidatorRepayLib
that stores other functions likeclaimEscrowTokens()
which claims escrow tokens to the liquidator after a loan failsgetLiquidationReward()
gets collateral value and reward amount for the liquidatorpayOutLiquidator()
checks if loan has an escrow and then claims any tokens before paying out the loan collateralSignersFacet
simply adds signers and checks if a signer is part of a list of signers in an asset