The LendingPool contract contains a logical flaw in its _withdrawFromVault function, where crvUSD tokens withdrawn from the Curve Vault are incorrectly sent to the LendingPool contract (address(this)) instead of the designated reserve.reserveRTokenAddress. This misrouting causes liquidity shortages in the RToken reserve, preventing users from withdrawing or borrowing crvUSD even when funds are available in the protocol.
The _withdrawFromVault function is invoked when the protocol needs to replenish liquidity for user withdrawals or borrowing. When the RToken reserve (reserve.reserveRTokenAddress) lacks sufficient crvUSD, the LendingPool attempts to withdraw from the Curve Vault. However, the current implementation erroneously designates address(this) (the LendingPool contract) as the receiver of the withdrawn crvUSD tokens. This misdirects the funds to the LendingPool instead of the RToken reserve, which is the designated liquidity source for user transactions. Consequently, functions IRToken(reserve.reserveRTokenAddress).transferAsset(msg.sender, amount) fail because the RToken reserve’s balance remains unchanged, even though the protocol has sufficient liquidity deposit in the wrong contract.
Initial State:
RToken contract holds 0 crvUSD.
Curve Vault holds 1000 crvUSD allocated to the protocol.
User A attempts to borrow 500 crvUSD.
Action Flow:
_ensureLiquidity checks RToken balance (0 crvUSD) and triggers _withdrawFromVault(500).
Curve Vault sends 500 crvUSD to LendingPool (not RToken).
IRToken(reserve.reserveRTokenAddress).transferAsset(...) is called but fails because RToken still has 0 crvUSD.
Result:
Borrow transaction reverts with "insufficient balance".
500 crvUSD remains stuck in the LendingPool, unusable for user operations.
User withdrawals and borrowing Reverts.
Manual Review
Update the receiver address in _withdrawFromVault to direct crvUSD to the RToken reserve:
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.