The LendingPool::_depositIntoVault function attempts to deposit funds into Curve's vault from the wrong source contract, causing all deposits to fail when vault integration is enabled.
The LendingPool
contract incorrectly implements integration with Curve's vault in several ways:
1) In _depositIntoVault, it approves the vault to spend tokens from the LendingPool contract, but the actual funds are held in the RToken contract:
2) The deposit call will fail because:
The funds are in RToken contract, not LendingPool, but the Curve vault transfers the funds from the msg.sender
(ref)
The approval is given from the wrong contract
User calls LendingPool::deposit(100)
with 100 tokens
Funds are transferred to RToken contract
_rebalanceLiquidity()
is called which tries to deposit excess into Curve vault
_depositIntoVault()
fails because:
LendingPool has no tokens to transfer
RToken hasn't approved LendingPool to spend its tokens
The deposit transaction reverts, making deposits impossible when vault integration is enabled
Complete denial of service of the deposit functionality when Curve vault integration is enabled
Loss of yield generation capabilities since excess funds cannot be deposited into the vault
System cannot maintain proper liquidity buffer ratios
Move the funds from the RToken contract to the LendingPool contract first, and then deposit into the Curve vault.
Move all vault integration logic to the RToken contract since it holds the funds:
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.