During refinance
, poolBalance update is done twice. This will either revert if lender don't have enough amount of balance or more importantly lender will lose funds.
During refinance
first we call _updatePoolBalance
and deduct tokens from the pool as shown below:
After that, we again deduct tokens from the pool as shown below:
Hence we are deducting debt amount of token from the pool twice. Hence if pool don't have enough token; it will revert, if pool have enough token; lender will lose debt amount of token unfairly.
Direct loss of funds for lender, hence I consider this as high.
Manual Review.
Remove second poolBalance update.
One extra recommendation regardless of this issue: For best practices it is important to follow Checks,Effects,Interactions pattern. This double reduction might have happened because there are so many "interactions" between poolBalance update "effects", hence it is easier to miss these kind of double effects.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.