FixedInterestOnlyLoan
Last updated
Last updated
FixedInterestOnlyLoans
is an ERC-721 contract. Each minted NFT represents a loan that must be paid back to the NFT owner.
Each loan is parametrized by:
Underlying token with which funds are lent out and repaid (e.g. USDC)
Principal debt (minting price)
Period payment (interest paid at each installment)
Period length (a period when the borrower pays installments)
Period count (total number of installments)
End date (date of the last installment to be paid together with the principal, set when the loan is started)
Recipient’s address
Grace period (time by which borrower can be late in repayment of each installment)
A canBeRepaidAfterDefault flag that allows a loan to be repaid after a loan was marked as defaulted
A loan can have one of the possible statuses: Created
, Accepted
, Started
, Repaid
, Canceled
, or Defaulted
.
Upon minting the loan status is set to Created
. In this state, a borrower can accept a loan by calling acceptLoan(id)
and the loan status is changed to Accepted
.
The NFT owner can call start(id)
on loans whose status is Accepted
. When a loan is started the loan end date is calculated for the loan and the loan status is changed to Started
.
The NFT owner can mark loans as canceled whose status is Created
or Accepted
.
The NFT owner can mark loans as Defaulted
whose status is Started
and the current block time is after a current period endDate + grace
Period
time.
The NFT owner can update the loan's gracePeriod
at any time by calling updateInstrument(id)
. The NFT owner must call repay(id, amount)
to recalculate repaid periods and the current period end date.
The repaid amount must be equal to the period payment or period payment + principal for the last installment. The loan can be repaid after it was marked as defaulted only if the proper canBeRepaidAfterDefault
flag was set to true.