20,000 USDC
View results
Submission Details
Severity: high

auctionLength not set in the loan

Summary

loan.auctionLength is not updated in giveLoan and buyLoan functions.

Vulnerability Details

In the giveLoan function, when the loan is given to another pool and the loan is updated with new details, auctionlength is not updated which has to be updated based on the new pool parameters.

Similarly in the function buyLoan when the loan goes to the auction
After the loan is given to new pool, the loan.auctionlength is not set according to the new pool.

Even the event to be emitted should include the auction length value.

Impact

The auction length will be different from the new pool setting.

Tools Used

Recommendations

In the function giveLoan,buyLoan add the following

// update the loan with the new info
+loans[loanId].auctionlength = pools[poolId].auctionLength
loans[loanId].lender = msg.sender;
loans[loanId].interestRate = pools[poolId].interestRate;
loans[loanId].startTimestamp = block.timestamp;
loans[loanId].auctionStartTimestamp = type(uint256).max;
loans[loanId].debt = totalDebt;

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.