Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 5.75 KB

037.md

File metadata and controls

68 lines (47 loc) · 5.75 KB

Smooth Satin Chicken

Medium

Borrower will face refinancing failure due to insufficient collateral with no option to add more

Summary

The lack of an option for users to add collateral when it's insufficient during refinancing will cause a disruption in refinancing opportunities for borrowers, as borrowers will face automatic transaction reverts due to insufficient collateral, preventing refinancing, which in turn leads to the liquidation of collateral from unpaid previous debts.

Necessary instructions

Debt Accumulation Impact:

As time progresses, the initial loan will accumulate debt in the form of interest. If this accumulated debt is minimal, the required collateral (collateralAmountRequired) calculated during refinancing may still be covered by the original collateral. However, in most cases, the accumulated debt exceeds the borrower’s expectations, resulting in a need for additional collateral.

Market Conditions:

The collateral-to-loan ratio in the lending market tends to be relatively balanced. This means that the range of fluctuation in collateral requirements across different loan offers is generally small. Most loan offers within the market have similar collateral requirements.

Special Circumstances:

The relationship between the collateral required and the loan amount is crucial in special cases. If a new loan offer requires less collateral for the same loan amount compared to the old loan, refinancing may proceed smoothly.

For example, if a new offer lends 100 USDC for 50 units of collateral, while the old offer required 100 units of collateral for the same loan amount, refinancing could be successful in this case.

Challenges of Refinancing:

In such market conditions, even if the new loan offer has a slightly lower collateral requirement, the borrower may still need to provide more collateral due to the accumulated debt. If the contract does not allow the borrower to supplement the collateral, the transaction will result in a revert. In most cases, due to debt accumulation and the relative stability of collateral ratios in the market, refinancing is likely to fail because of insufficient collateral. This reflects a limitation in the current contract design.

Root Cause

Code:

        if (collateralAmountRequired > loan.collateralAmount) {
            revert InsufficientCollateral();
        }

and refinance https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L1049-L1130 The choice to only allow refunding of excess collateral and not provide an option for borrowers to add more collateral during refinancing is a mistake, as it leads to unfavorable outcomes under two scenarios:

Scenario 1: Borrower Seeks a New Loan Offer with a Lower Interest Rate and Reduced Collateral Requirement In this case, the borrower tries to refinance with a new offer that has a lower interest rate and reduced collateral requirement. However, due to accumulated debt, the required collateral (collateralAmountRequired) may exceed the original collateral amount. Since the contract does not allow the borrower to add more collateral, the transaction reverts with an InsufficientCollateral error, even if the borrower is willing to provide more collateral.

Scenario 2: Borrower Wants to Extend the Loan Duration through Refinancing Borrowers might want to extend their loan duration to prevent liquidation. However, even if the borrower finds a loan offer with a lower interest rate, the accumulated debt might require more collateral than the borrower currently has. Without a mechanism to allow adding more collateral, the borrower cannot proceed with refinancing and risks liquidation when the loan matures, ultimately losing their collateral.

Path

1.Borrower takes out an active loan with collateral set to be exactly less than the amount required for future refinancing due to accumulated debt over time.

2.As the borrower's debt accumulates due to interest, the borrower needs to refinance using a new loan offer with a lower interest rate. However, due to the increased debt, the new loan offer requires additional collateral beyond what the borrower has currently pledged.

3.The contract logic lacks the ability to allow the borrower to add the required collateral during refinancing. When the system checks for the new required collateral and finds that the borrower’s current collateral is insufficient, the transaction reverts automatically with an InsufficientCollateral error.

4.As the loan approaches maturity, the borrower has limited time to find alternative refinancing options. If the borrower cannot add the necessary collateral, they risk loan liquidation due to insufficient collateral, resulting in the loss of their pledged collateral.

Impact

The borrower cannot complete the refinancing process if the required collateral is greater than the existing collateral, even if they are willing to add more collateral. This results in borrowers potentially losing their previously pledged collateral due to liquidation if they cannot refinance in time. The borrower may also suffer a loss in opportunities to obtain better loan offers, as the inability to refinance restricts their flexibility in managing debt.

Mitigation

To mitigate this issue, the smart contract can be updated to allow borrowers to add additional collateral when the existing collateral is insufficient during refinancing. This would prevent automatic reverts and give borrowers the opportunity to fulfill the new collateral requirements and successfully complete the refinancing process. Additionally, providing a time window for borrowers to add the required collateral after an initial failure could further improve the user experience and prevent liquidation.