♾️3.4 Repayment

3.4.1 Full Repayment

In the full repayment cycle, the borrower repays a loan entirely providing enough cash to cover the future value.

As a result,

  • that debt position is closed,

  • the tracker of the aggregated borrower debt is reduced for the amount repaid and this results in some of his collateral being freed up

3.4.2 Partial Repayment via Compensation

3.4.2.1 Partial repayment with receivables

A borrower is allowed to reduce part of his debt in a DebtPosition by repaying a specific lender with some of his credit, aka repay with future cashflow.

From the accounting system perspective, a borrower who has some credit, aka future cashflow, in the form of a CreditPosition, can "sell" part of this credit to one of the lenders owning some percentage of a DebtPosition where he is the borrower, in exchange for this lender canceling an equivalent amount of the borrower debt.

This is allowed provided that the credit due date is earlier than the debt due date, as it is understood that by the time of the debt repayment, the credit will have already been available for claim, as it will have been repaid or liquidated if overdue.

This way, the lender who has received the credit is still able to claim his full credit at the due date, when expected.

Observation: in the event of a credit fractionalization due to the Compensate mechanism, the borrower pays the fragmentation fee with collateral.

3.4.2.2 Partial repayment with debt/credit creation

Since the Repay function only allows for full repayments, borrowers can repay partially by creating a new DebtPosition/CreditPosition pair and then compensating their original loan's debt. This effectively reduces the original loan's debt and creates a new debt. This means that, if no additional money is brought into the protocol, the borrower's total debt balance is not changed.

The way to achieve this is by calling Compensate with credit position ID equal to type(uint256).max, in a similar way as in matching order functions.

The whole process can be streamlined in a multicall:

  • deposit

  • compensate

  • repay

Last updated