P2Peer Contracts
Lending.sol
This contract provides a lending infrastructure for peer-to-peer loans, allowing users to create and match loan offers and listings while supporting different types of loans and loan operations.
Functionality
The contract provides the following functionality:
function execute(DataTypes.Input calldata offer, DataTypes.Input calldata listing)
Matches an offer and a listing, executes the corresponding loan logic.
function bulkExecute(DataTypes.Execution[] calldata executions)
Matches multiple offers and listings in a single function call.
function repayLoan(uint256 loanId,bool isBundle,uint256 reserveId)
Repays a loan or bundle, transferring the repayment amount to the lender and collateral back to the borrower.
loanId
: id of loanisBundle
: set to true if multiple loansreserveId
: if of reserve
function forecloseLoan(uint256 loanId, bool isBundle)
Forecloses a loan or bundle, transferring the collateral of a defaulted loan to the lender.
loanId
: id of loanisBundle
: set to true if multiple loans
function cancelOrder(DataTypes.Order calldata order)
Cancels an order to prevent it from being matched.
function cancelOrders(DataTypes.Order[] calldata orders)
Cancels multiple orders.
Dependencies
Interfaces:
- IAddressProvider.sol
- ICollateralManager.sol
- ILending.sol
- IExecutionDelegate.sol
Contracts:
- SharedStorage.sol
- LendingStorage.sol
- EIP712.sol
Libraries:
- ValidationLogic.sol
- LendingLogic.sol
- RepayLogic.sol
- RefinanceLogic.sol
- RenegotiateLogic.sol
- ForecloseLogic.sol
- DataTypes.sol
- MerkleVerifier.sol
- PercentageMath.sol
- Errors.sol
LendingStorage.sol
This contract is responsible for separating the storage logic from the main Lending Pool contract in the protocol.