We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High Risk
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L636
The debt of the loan at hand gets subtracted twice when refinancing it through refinance().
refinance()
Lender.sol's refinance() subtracts debt from the pool balance twice, which will lock another debt amount's worth of tokens in the new pool.
Lender.sol
debt
function refinance(Refinance[] calldata refinances) public { for (uint256 i = 0; i < refinances.length; i++) { ... // update the old lenders pool _updatePoolBalance( oldPoolId, pools[oldPoolId].poolBalance + loan.debt + lenderInterest ); pools[oldPoolId].outstandingLoans -= loan.debt; // @audit deducting from the balance #1 _updatePoolBalance(poolId, pools[poolId].poolBalance - debt); pools[poolId].outstandingLoans += debt; ... // @audit deducting from the balance #2 pools[poolId].poolBalance -= debt; ... } }
It will lock debt * 2 worth of tokens in the new pool.
debt * 2
Manual Review
Consider removing the following line: https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Debt gets subtracted twice when refinancing a loan
Severity
High Risk
Relevant GitHub Links
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L636
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
Summary
The debt of the loan at hand gets subtracted twice when refinancing it through
refinance()
.Vulnerability Details
Lender.sol
'srefinance()
subtractsdebt
from the pool balance twice, which will lock anotherdebt
amount's worth of tokens in the new pool.Impact
It will lock
debt * 2
worth of tokens in the new pool.Tools Used
Manual Review
Recommendations
Consider removing the following line: https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L698
The text was updated successfully, but these errors were encountered: