<!-- canonical: https://0xsimao.com/findings/fuji-finance-yield-redeem-converts-shares -->

# YieldVault maxRedeem(...) unnecessarily converts shares to assets and back to shares again

Low/Info · Three Sigma · Lending aggregator · 6th May, 2023

Finding 3S-FUJI-N02 of the Fuji Finance security review.

- Report: /reports/fuji-finance
- Source: https://cdn.sanity.io/files/qoqld077/staging/32181a28eac3175d15fb8924d249bb0d91ca350c.pdf

---

### Description

maxRedeem(...) enables users to know how many shares they can redeem. In the case of
the borrowing vault, it depends on the amount of debt a user has taken, which is taken into
account in _computeFreeAssets(...).
In the case of the yield vault, maxRedeem(...) is the balance of the user. Currently, it
converts the balance of the user to assets in _computeFreeAssets(...), and then in
maxRedeem(...) back to shares again. This is unnecessary and the code could be
refactored to handle these 2 situations.

### Recommendation

The YieldVault could override maxRedeem(...) and return the balance of the user directly
(if not paused).

### Status

Addressed here: [Fujicracy/fuji-v2#641](https://github.com/Fujicracy/fuji-v2/pull/641)

---

Related findings:

- [All assets of (m)TapiocaOFT can be stealed by depositing to strategy cross chain call with 1 amount but maximum shares possible](https://0xsimao.com/findings/tapioca-dao-tapioca-stealed-maximum-shares): Tapioca DAO
- [ERC4626YieldBackend.withdrawMax() silently succeeds when vault is paused, leaving funds stuck](https://0xsimao.com/findings/superfluid-erc4626-yield-paused-stuck): Superfluid Yield Backends
- [MapleSkyStrategy::assetsUnderManagement() uses maxWithdraw(), which may return 0](https://0xsimao.com/findings/maple-finance-iv-sky-management-withdraw-return): Maple Cash Strategies
- [Incorrect `ERC4626ExceededMaxRedeem` event on `ManagedLeveragedVault.sol:: cancelWithdrawalIntent()`](https://0xsimao.com/findings/beraborrow-i-erc4626-exceeded-redeem-withdrawal): Beraborrow Managed Dens
