Refinancing allows borrowers to instantly start a new loan with new terms - which sometimes can be improved or extended (but not always) - using the same collateral, without the necessity of fully repaying the original loan beforehand.

Refinancing provides enhanced flexibility for borrowers in managing their loan repayment. Borrowers with NFTs held in escrow can receive competing loan offers from various lenders, allowing them to choose between continuing with their current loan until maturity or instantly starting a new one. This approach eliminates the burden and time spent for the borrower to relist their asset and manually repay the full loan amount after each term, enabling a more dynamic rollover type of lending.

When opting to renew the loan, borrowers face two scenarios:

  • Paying the Difference: If the sum of the principal and interest (P1 + I1) of the current loan exceeds the principal (P2) of the new loan offer, the borrower must pay this difference.

  • Receiving the Difference: Conversely, if the total of the principal and interest (P1 + I1) is less than the principal (P2) of the new loan offer, the borrower will receive the excess amount.

Note that Loan extensions must be in the same token as the existing loan - for example, if the existing loan is in USDC - the extension must also be in USDC.

Calculating the refinancing balance

  • The original loan has Principal and Interest (P1, I1) and the refinanced loan has Principal and Interest (P2, I2).

  • To resolve the original loan, the borrower must pay P1+I1 to get the asset back, and then start a new loan for P2 (interest I2 will be paid on loan repayment only).

  • So the borrower will need (P1+I1)-P2 to refinance

Two refinance scenario

  • The only two refinance scenarios are P1+I1>P2 and P1+I1<P2

Scenario A - Jeff has a negative balance (P1+I1 > P2)

e.g. P1=10, I1=2, P2=11, I2=2

  • for Jeff to settle the original loan, he will need P1+I1=10+2=12

  • when Jeff accepts the new loan he will receive the principal P2=11

  • (P1+I1) - P2 = 10+2-11 = 1 - this is the base upfront cost of the refinance,

  • To close the new loan Jeff will have to repay P2+I2

Scenario B - Mary has a positive balance (P1+I1 < P2)

e.g. P1=10, I1=2, P2=15, I2=3

  • for Mary to settle the original loan she will need P1+I1=10+2=12

  • when she accepts the new loan she will receive the principal P2=15

  • (P1+I1) - P2 = 10+2-15 = -3 - this is the base upfront surplus of the refinance,

  • To close the new loan Mary will have to pay P2+I2

Refinancing Smart contract

  1. The borrower initiates the process of Refinancing.

  2. The borrower mints an Obligation Receipt (OR), establishing ownership of the loan. This Obligation Receipt (OR) is used by the Refinancing Smart Contract to refinance the loan on behalf of the borrower.

  3. The borrower authorizes the transfer of the current and future loan's Obligation Receipt (OR) to the Refinancing Smart Contract.

  4. The Refinancing Smart Contract takes out a flash loan from DyDx and pays off the old loan.

  5. Using the collateral NFT released from the old loan, the Refinancing Smart Contract initiates the new loan.

  6. Based on the comparison between the old loan's principal and the new one's, the Refinancing Smart Contract either withdraws the deficit from the borrower or disburses a surplus.

  7. The Refinancing Smart Contract repays the flash loan and mints a new Obligation Receipt (OR).

  8. The Refinancing Smart Contract transfers the rights of the new loan to the borrower of the original loan by transferring the new Obligation Receipt (OR).

Last updated