The _rebalanceLiquidity
and _ensureLiquidity
functions incorrectly withdraw tokens to the LendingPool address instead of the reserveRTokenAddress when rebalancing the buffer or ensuring liquidity, leading to potential accounting errors and redundant withdrawals.
The issue occurs in the _rebalanceLiquidity
function when currentBuffer < desiredBuffer
:
And in _ensureLiquidity
if (availableLiquidity < amount)
:
The _withdrawFromVault
function withdraws the shortage
/ requiredAmount
from the Curve vault and transfers it to the LendingPool address:
Tokens are withdrawn to LendingPool address instead of reserveRTokenAddress
currentBuffer
and availableLiquidity
check balance at reserveRTokenAddress but withdrawals don't go there
This mismatch means subsequent calls will keep detecting a shortage
Results in repeated withdrawals since withdrawals never increases at reserveRTokenAddress
Buffer mechanism becomes ineffective as tokens aren't stored in correct location
Repeated unnecessary withdrawals from vault on each rebalance and ensureLiquidity call
Increased gas costs from redundant operations
Potential depletion of vault liquidity through repeated withdrawals
Break in system invariants around buffer and liquidity maintenance
Manual review
Modify _withdrawFromVault to withdraw to reserveRTokenAddress:
Add validation to ensure tokens arrive at correct address:
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.