<!-- canonical: https://0xsimao.com/findings/yieldoor-ii-rebalance-callback-rebalancing-morpho -->

# RebalanceLogic::rebalanceCallback() doesn't update lastTotalAssets when rebalancing from morpho to morpho

Low/Info · 0xSimao · Leveraged yield farming · 20th June 2025

Finding L-1 of the Yieldoor LoopedVault security review.

- Protocol: https://app.yieldoor.com/
- Report: /reports/yieldoor-ii
- Source: https://github.com/0xSimao/audits/blob/main/0xSimao/2025-06-20-yieldoor-ii.pdf

---

**Description:**

All actions that instantly change the value of the vault, namely slippage from swaps, are taken into account by also reducing `lastTotalAssets` resulting in the next vesting amount being unaffected. However, this is not performed when rebalancing [morpho to morpho](https://github.com/spacegliderrrr/loopedVault/blob/master/src/libraries/RebalanceLogic.sol#L111), which does a swap and changes the value of the vault.

**Recommended Mitigation:**

Adjust `lastTotalAssets` when rebalancing morpho to morpho. Aave to morpho or morpho to aave shouldn't change the value of the vault.

**0xSimao:**

Fixed in [#ad00401](https://github.com/spacegliderrrr/loopedVault/commit/ad0040106a3c92636afd77e1bf511be21bebbe5c).

---

Related findings:

- [It's possible for debt to be stuck in the LoopedVault when rebalancing from Aave to Morpho](https://0xsimao.com/findings/yieldoor-iii-debt-stuck-aave-morpho): Yieldoor LoopedVault Update
- [`ViewLogic::maxLiquidatable()` doesn't take the bonus into account, making the agent liquidatable again](https://0xsimao.com/findings/cap-view-liquidatable-bonus-agent): Cap
- [ERC4626YieldBackend.withdrawSurplus() uses convertToAssets() which doesn't account for fees](https://0xsimao.com/findings/superfluid-erc4626-yield-withdraw-fees): Superfluid Yield Backends
- [MToken's total principal invariant doesn't hold without MinterGateway, leading to potential principal loss](https://0xsimao.com/findings/m-0-invariant-hold-minter-gateway): M^0 Minter Gateway
