The _rebalanceLiquidity
function is designed to maintain a liquidity buffer for the reserve token (RT
). However, due to an incorrect withdrawal mechanism, when a shortage is detected, the withdrawn funds are sent to the LendingPool contract instead of the RT token contract. This means that the buffer remains unchanged, preventing effective rebalancing.
_rebalanceLiquidity
_withdrawFromVault
The function withdraws amount
from the Curve vault to address(this)
, which is the LendingPool contract.
However, _rebalanceLiquidity
expects this withdrawn amount to increase the balance of RT token contract (reserve.reserveRTokenAddress
).
Since the funds are not moved to the RT contract, the buffer level remains low despite the withdrawal, causing an infinite loop where liquidity shortages are never fixed.
Liquidity Buffer Never Replenishes
Even when _rebalanceLiquidity
withdraws funds, the buffer check will still detect a shortage because the RT contract balance does not increase.
Repeated Withdrawals Without Fixing Issue
The function will keep withdrawing from Curve vault unnecessarily, wasting gas and potentially draining liquidity from the vault.
Modify _withdrawFromVault
to ensure that the withdrawn amount is sent directly to the RT token contract (reserve.reserveRTokenAddress
) instead of the LendingPool contract.
_withdrawFromVault
ImplementationAfter withdrawal, explicitly check whether the RT token balance increased as expected:
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.