`AssetManager.rebalance()` will revert when the balance of `tokenAddress` in the money market is 0.
`AssetManager.rebalance()` will revert when the balance of `tokenAddress` in the money market is 0.\\nAssetManager.rebalance() tries to withdraw tokens from each money market for rebalancing here.\\n```\\n    // Loop through each money market and withdraw all the tokens\\n    for (uint256 i = 0; i < moneyMarketsLength; i++) {\\n        IMoneyMarketAdapter moneyMarket = moneyMarkets[i];\\n        if (!moneyMarket.supportsToken(tokenAddress)) continue;\\n        moneyMarket.withdrawAll(tokenAddress, address(this));\\n\\n        supportedMoneyMarkets[supportedMoneyMarketsSize] = moneyMarket;\\n        supportedMoneyMarketsSize++;\\n    }\\n```\\n\\nWhen the balance of the `tokenAddress` is 0, we don't need to call `moneyMarket.withdrawAll()` but it still tries to call.\\nBut this will revert because Aave V3 doesn't allow to withdraw 0 amount here.\\n```\\n  function validateWithdraw(\\n    DataTypes.ReserveCache memory reserveCache,\\n    uint256 amount,\\n    uint256 userBalance\\n  ) internal pure {\\n    require(amount != 0, Errors.INVALID_AMOUNT);\\n```\\n\\nSo `AssetManager.rebalance()` will revert if one money market has zero balance of `tokenAddress`.
Issue `AssetManager.rebalance()` will revert when the balance of `tokenAddress` in the money market is 0.\\nI think we can modify AaveV3Adapter.withdrawAll() to work only when the balance is positive.\\n```\\n    function withdrawAll(address tokenAddress, address recipient)\\n        external\\n        override\\n        onlyAssetManager\\n        checkTokenSupported(tokenAddress)\\n    {\\n        address aTokenAddress = tokenToAToken[tokenAddress];\\n        IERC20Upgradeable aToken = IERC20Upgradeable(aTokenAddress);\\n        uint256 balance = aToken.balanceOf(address(this));\\n\\n        if (balance > 0) {\\n            lendingPool.withdraw(tokenAddress, type(uint256).max, recipient);\\n        }\\n    }\\n```\\n
The money markets can't be rebalanced if there is no balance in at least one market.
```\\n    // Loop through each money market and withdraw all the tokens\\n    for (uint256 i = 0; i < moneyMarketsLength; i++) {\\n        IMoneyMarketAdapter moneyMarket = moneyMarkets[i];\\n        if (!moneyMarket.supportsToken(tokenAddress)) continue;\\n        moneyMarket.withdrawAll(tokenAddress, address(this));\\n\\n        supportedMoneyMarkets[supportedMoneyMarketsSize] = moneyMarket;\\n        supportedMoneyMarketsSize++;\\n    }\\n```\\n