_rebalanceLiquidity()
function allows rebalancing liquidity in the Pool depending on the set buffer. It does so by either calling curveVault.deposit()
or curveVault.withdraw()
when the vault is set.
However, the problem is that all of the liquidity of the lending pool is contained within the RToken contract. This can be seen from the _ensureLiquidity()
function.
When _depositIntoVault()
is called, it will try to deposit assets from the LendingPool contract, which does not hold any funds, therefore making it always revert.
Additionally _withdrawFromVault()
withdraws assets from the curveVault into LendingPool instead of RToken. And even though currently there's no way to deposit into curveVault, it's something to keep in mind when this issue gets fixed.
What makes it worse, is the fact that once curveVault is set, there's no way to reset it back to address(0) due to the following check.
When the curveVault is set, _ensureLiquidity
and all functions calling _rebalanceLiquidity()
will be DoS'ed.
Please create this contract in the pools/LendingPool
directory of the project.
Please add this test to LendingPool.test.js
and run it with npx hardhat test --grep "reverts if the vault is set"
.
Add a function in the RToken contract that will deposit assets to the curveVault and call it from the LendingPool contract when rebalancing liquidity. Create the same function for the withdraw functionality and call in the LendingPool when rebalancing liquidity.
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.