The LendingPool does not call liquidity rebalancing when users repay their debts, causing excess liquidity to remain in the contract instead of being transferred to the Curve vault
LendingPool has a function _rebalanceLiquidtiy() which gets called after every liquidity movement actions in the contract (i.e., deposit, withdraw, borrow) in order not to keep excess liquidity in the contract but to transfer it to the Curve vault (where it might earn yield) and in such way maintain their desired buffer ratio. The function is defined as follows:
However, during the repayment process—when users repay their debt by transferring back the tokens—this function is not called, even though the contract's balance changes, which is incorrect. Therefore, it is necessary to call _rebalanceLiquidity() upon debt repayment as well, ensuring that the excess liquidity is properly deposited into the Curve vault and the desired buffer ratio is maintained.
Low
Manual Review
Call _rebalanceLiquidity() at the end of the _repay() function
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.