Loan

Loan Blueprint

LoanBlueprint.sol groups all actions related to updating and managing loan information.

Functions

MintLoanToken

This function creates a Loan token for the user and sets the initial Loan information

function mintLoanToken(bytes calldata loanInfo, address to_, uint256 uniqueId_, uint256 portfolioId_)

Process:


SetInitialLoanInfo

This is an internal function that sets the initial Loan information. Is called by mintLoanToken

function setInitialLoanInfo(bytes calldata loanInfo_, uint256 loanId_, uint256 portfolioId_) private {

Process:

  • Validates loan info and loan ID.

  • Forwards the call toSetSupplyData(Action doesnt exist yet) action

  • Returns execution result


AddBorrowToLoan

This function that adds borrow information to an existing loan sets the update Loan information.

function addBorrowToLoan(
    bytes calldata borrowData_,
    address user_,
    uint256 loanId_,
    bytes calldata loanInfo_,
    uint256 portfolioId_,
    ILoan.UpdateField updateField
)

Process:

  • Validates borrow data, user address and loan ID

  • Forwards the call to AddBorrowToLoan action

  • Executes the function updateLoanInfo

  • Returns execution result


UpdateLoanInfo

This function can update any field in the LoanUpdate (link to struct) struct. It is called by addBorrowToLoan, but can also be invoked directly.

function setInitialLoanInfo(bytes calldata loanInfo_, uint256 loanId_, uint256 portfolioId_) private {

Process:

  • Validates user address and loan ID.

  • Forwards call to UpdateLoanInfoaction

  • Returns execution result

Last updated