In LendingPool.sol, _rebalanceLiquidity()
is invoked in deposit()
, withdraw()
, and borrow()
to have excess reserve assets sent to curve vault for additionally leveraged yields, and vice versa, keeping 20% buffer of reserve.totalLiquidity
. Such liquidity rebalancing is nonetheless missing in _repay()
and finalizeLiquidation()
when reserve.totalLiquidity
has typically increased in value. This results in excess reserve assets idle in RToken.sol and miss out the on time opportunities leveraging curve yields.
When _repay()
or finalizeLiquidation()
is called, transfer of reserve assets to reserve.reserveRTokenAddress
is made:
And then, ReserveLibrary.updateInterestRatesAndLiquidity()
is invoked at the end of the function logic:
Evidently, amountScaled
, the third input parameter, as matching to liquidityAdded
, is going to be added to reserve.totalLiquidity
as liquidityAdded.toUint128()
.
So, rightfully, _rebalanceLiquidity()
should have been called to keep desiredBuffer
by sending excess
to the curve vault, considering reserve.totalLiquidity
has now increased by the delta of amountScaled
:
Not doing this is going to keep the excess reserve assets idling in RToken.sol instead having it sent to curve fault leveraging for extra yields.
Time is money. So, the missing liquidity rebalance in time is going to make the protocol lose out on yields deprived through the delta of time till the next trigger of _rebalanceLiquidity()
.
Manual
Consider making the following fix:
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.