Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2783 +/- ##
==========================================
+ Coverage 39.02% 39.67% +0.64%
==========================================
Files 126 127 +1
Lines 5825 5843 +18
Branches 1546 1550 +4
==========================================
+ Hits 2273 2318 +45
+ Misses 3550 3523 -27
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
clement-ux
left a comment
There was a problem hiding this comment.
Everything looks good to me.
Note on withdrawAll():
When calling withdrawAll(), the strategy only withdraws what is currently liquid in the Morpho V2 vault (idle USDC + V1 adapter available liquidity). Under high utilization, some funds may remain in the strategy after the call. This is expected behavior, not a bug, but something to keep in mind operationally -- multiple calls or waiting for liquidity to free up may be needed to fully exit the position.
|
good point @clement-ux have expressed this more verbosely in the comment: 1f943d8 |
naddison36
left a comment
There was a problem hiding this comment.
I think we should also change withdrawAll on Generalized4626Strategy so it calls maxRedeem instead of balanceOf. This way it redeems what it can.
This doesn't work for Morpho v2 vaults as they just return zero for all their max functions. For for vaults that are ERC-4626 compliant, the change to Generalized4626Strategy will work.
ef0a057 to
9ee8188
Compare
|
@naddison36 good thinking thanks. Done here: 9ee8188 |
… possible liquidity in the withdrawAll
PR: Morpho V2 Liquidity Estimation + Safe WithdrawAll
Summary
This PR updates the Morpho V2 strategy to better estimate immediate liquidity and safely cap
withdrawAll, while acknowledging that only Morpho V1 adapters are supported for extended liquidity checks.Why
Morpho V2 vaults can configure a liquidity adapter. When that adapter points to a Morpho V1 vault, the strategy can query the V1 vault’s
maxWithdrawto include additional immediately available liquidity. If the adapter is something else, the strategy intentionally does not assume additional liquidity. This avoids over‑estimating withdrawable amounts and prevents failed withdrawals.Key Changes
withdrawAllnow accounts for adapter‑backed liquidity when the adapter is a Morpho V1 vault.withdrawAllrespects the actual available liquidity in the V2 vault and its adapter.Notes / Limitations