Loan
Read Methods
previewRepay
function previewRepay(uint256 repayAmt) public view returns (uint256)
Allows to preview the collateral amount from the repayAmt
. repayAmt
is the amount that the borrower wants to repay. It returns the collateral amount.
Parameters
Name | Type | Description |
---|---|---|
repayAmt | uint256 | Amount borrower intends tp repay |
borrower
function borrower() external view returns (address)
Returns the address of the borrower of the loan. This function takes no parameter.
lenderVault
function lenderVault() external view returns (address)
Returns the address of the lender vault. This function takes no parameter.
Write Methods
repay
function repay(uint256 repayAmt, bytes calldata data) external nonReentrant
Repay the borrowed amount back to the lender. It accepts the amount of assets that must be repaid. In case of leverage, it also accepts the data that contains the leverage info.
Parameters
Name | Type | Description |
---|---|---|
repayAmt | uint256 | The amount that the borrower intends to repay |
data | bytes | The ABI encoded data that contains leverage info |
seizeCollateral
function seizeCollateral() external
In case the borrower does not repay, it can be used to calculate the reclaimable amount of collateral. It also transfers the collateral to the lenders vault in the same transaction.
transfer
function transfer(address newBorrower) external
Transfer the loan to a new borrower. After the transfer, any replayments will lead to collateral being released to the new borrower.
Parameters
Name | Type | Description |
---|---|---|
newBorrower | address | Address of the new borrower |