Architecture
This document describes user interactions with the Pawn Protocol throughout the loan lifecycle from the borrower and lender’s perspectives.
Initializing a new loan


-
initializeBundle()
- Borrower initializes a bundle with the AssetWrapper obtaining an ERC721 (wNFT) representing a basket of ERC20, ERC721, ERC1155 collateral. -
depositERC*()
- Borrower approves collateral1…N then deposits collateral1…N into initialized bundle. -
LoanTerms - Borrower creates LoanTerms including dueDate, principal, interest, collateralTokenID, payableCurrency and sends to lender over any off-chain communication protocol.
-
Lender creates an allowance to the borrower for the ERC20 principal of the loan.
-
Lender or Borrower sign the loan terms and initialize loan with the OriginationController.
-
initializeLoan*()
- OriginationController transfers the wNFT to LoanCore. -
startLoan()
- LoanCore starts the loan distributing PromissoryNotes (ERC721) to borrower and lender. -
startLoan()
- LoanCore starts the loan transferring principal net of fees to borrower.
Repaying an existing loan


Loan repayment process initialized from borrower (holder of Borrower Note).
-
repay()
- Borrower initiates loan repayment by calling repay (or repayWithBorrowerNotePermit) function on RepaymentController with borrower node id. -
Loan id is retrieved via mapping from BorrowerNote contract, which minted a BorrowerNote (ERC721) to borrower on origination.
-
getLoan()
- Repayment controller performs a sideways call to LoanCore contract to get loan terms given id. -
safeTransferFrom()
- Repayment controller transfers ERC20 payable currency from msg.sender to LoanCore equalling principal plus interest from loan terms. -
repay()
- repay called on LoanCore which checks tokens received from borrower in previous step satisfy loan terms and burns lender and borrower notes, calling burn on the contracts, respectively. -
transferFrom()
- wNFT (ERC721) representing bundle of wrapped assets (wrapped via AssetWrapper) is re-distributed back to borrower that was owner of burned BorrowerNote. -
safeTransfer()
- principal + interest in the form of the payable currency stipulated in loan terms (ERC20) is re-distributed to lender that was owner of burned LenderNote.
Claiming a defaulted loan


Loan claim process initiated by lender (holder of Lender Note)
-
claim()
- create a transaction that initiates a claim on an wNFT pertaining to a defaulted loan, an unpaid loan past its' term. -
getLoanId()
- ensure the msg.sender is owner of Lender Note and fetch the loan id from Lender Note’s mapping. -
claim()
- call claim method on LoanCore. -
Fetch Loan terms from LoanCore and ensure the loan is in a defaulted state.
-
Set the state of the loan to Defaulted.
-
Burn both Lender and Borrower Notes.
-
Transfer the wNFTwNFT - Acronym representing a "wrapped NFT" created by minting against the AssetWrapper contract on the Pawn protocol. representing the wrapped bundle of collateral to the lender.
Updated 4 months ago