_depositIntoVault and _withdrawFromVault won't work because there are no tokens inside the contract
When we have some funds inside the contract we call _depositIntoVault to deposit them to crv, so they will act as liquidity and provide an APY. Where we can clearly see that this contract is gonna be the receiver of the LP.
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L799
We can also withdraw them if we need to, where we are the ones receiving the real token
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L809
The issue we face is inside withdraw where if we want to withdraw but there are not enough funds we call _ensureLiquidity which withdraws from the crv vault to this contract.
However if you are familiar with how withdraw you will know that withdraw itself doesn't send us any funds, but the rToken does inside it's burn:
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/tokens/RToken.sol#L154
If the rToken doesn't have enough funds we would withdraw from the curve pool, but we would withdraw not to rToken which sends us tokens, but to the pool. This means that the pool will still be insufficient.
Note that we still don't send tokens to the pool and so the pool won't be able to deposit them in the first place due to deposit sending all of the tokens to reserveRTokenAddress, leaving the pool empty with nothing to deposit.
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/libraries/pools/ReserveLibrary.sol#L323
Manual review
Move both functions to rToken so it will be able to deposit them and will be able to withdraw the LP from the pool in case it needs more base tokens.
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.