An issue has been identified in the liquidity rebalancing mechanism, specifically within the LendingPool::_rebalanceLiquidity
function. When excess liquidity exists beyond the buffer, LendingPool::_depositIntoVault
is called to transfer the extra funds to the Curve vault. However, the approval for this transfer is granted from the lending pool instead of the RToken contract, which holds the actual funds. This misalignment could result in failed transactions and unintended behavior.
Deposit Flow:
A user deposits assets into the lending pool using the LendingPool::deposit
function.
The ReserveLibrary.deposit
function is called, updating the reserve state and minting RTokens and transferring the asset token to RToken contract.
_rebalanceLiquidity
is invoked to ensure the buffer holds an optimal liquidity ratio.
LendingPool::deposit
:
ReserveLibrary::deposit
:
2.Rebalancing Liquidity:
The function checks the balance in the RToken
contract to determine if excess funds exist.
If funds exceed the desired buffer, _depositIntoVault
is triggered to move the excess into the vault.
LendingPool::_rebalanceLiquidity
:
3.Approval Issue in _depositIntoVault
:
The function grants approval for the Curve vault to withdraw liquidity.
However, the approval is set from the lending pool's address, while the actual funds reside in the RToken contract.
This discrepancy may cause transaction failures, as the Curve vault will attempt to withdraw funds from an account that lacks the required balance.
LendingPool::_depositIntoVault
:
Transaction Reverts: If the lending pool does not hold the expected funds, the approval and deposit transaction may revert.
Liquidity Management Failure: If the rebalancing process fails, excess liquidity may remain in the buffer, leading to inefficient fund utilization.
User Experience Issues: Users may experience unexpected failures when depositing funds due to improper liquidity handling.
Manual
Approve From Correct Source: Update _depositIntoVault
to approve the Curve vault from the RToken contract instead of the lending pool.
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.