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

Initializing a new loan

  1. initializeBundle() - Borrower initializes a bundle with the AssetWrapper obtaining an ERC721 (wNFT) representing a basket of ERC20, ERC721, ERC1155 collateral.

  2. depositERC*() - Borrower approves collateral1…N then deposits collateral1…N into initialized bundle.

  3. LoanTerms - Borrower creates LoanTerms including dueDate, principal, interest, collateralTokenID, payableCurrency and sends to lender over any off-chain communication protocol.

  4. Lender creates an allowance to the borrower for the ERC20 principal of the loan.

  5. Lender or Borrower sign the loan terms and initialize loan with the OriginationController.

  6. initializeLoan*() - OriginationController transfers the wNFT to LoanCore.

  7. startLoan() - LoanCore starts the loan distributing PromissoryNotes (ERC721) to borrower and lender.

  8. 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).

  1. repay() - Borrower initiates loan repayment by calling repay (or repayWithBorrowerNotePermit) function on RepaymentController with borrower node id.

  2. Loan id is retrieved via mapping from BorrowerNote contract, which minted a BorrowerNote (ERC721) to borrower on origination.

  3. getLoan() - Repayment controller performs a sideways call to LoanCore contract to get loan terms given id.

  4. safeTransferFrom() - Repayment controller transfers ERC20 payable currency from msg.sender to LoanCore equalling principal plus interest from loan terms.

  5. 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.

  6. transferFrom() - wNFT (ERC721) representing bundle of wrapped assets (wrapped via AssetWrapper) is re-distributed back to borrower that was owner of burned BorrowerNote.

  7. 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)

  1. claim() - create a transaction that initiates a claim on an wNFT pertaining to a defaulted loan, an unpaid loan past its' term.

  2. getLoanId() - ensure the msg.sender is owner of Lender Note and fetch the loan id from Lender Note’s mapping.

  3. claim() - call claim method on LoanCore.

  4. Fetch Loan terms from LoanCore and ensure the loan is in a defaulted state.

  5. Set the state of the loan to Defaulted.

  6. Burn both Lender and Borrower Notes.

  7. Transfer the wNFT representing the wrapped bundle of collateral to the lender.

What’s Next