Submitted by 0xStalin, also found by rvierdiiev
H-09: Vault is not compatible with some ERC4626 vaults
The issue is about the Vault contract not being compatible with some ERC4626 vaults, such as DnGmxSeniorVault.
The mitigation implemented new logic to determine if the Vault is collateralized or not. Now, all shares are backed 1:1 with deposited assets.
When withdrawing and redeeming, the new implementation checks if the vault is collateralized or not; if its collateralized, the shares:asset ratio is 1:1, if its under-collateralized, the ratio will be different, and the functions will compute how many shares are required to withdraw the desired amount of assets.
The new implementation mitigates socializing losses when the vault is under-collateralized. Now, each user can withdraw/redeem up to their maxWithdraw()/maxRedeem() amounts of assets, which those values are determined based on the amount of shares that the owner has.
I consider that the new implementation mitigates issues that can arise because of ERC4626 vaults not implementing the expected ERC4626 standard.
In regards to the exact issue pointed out in the original finding about the _yieldVault.maxWithdraw() returning a different value than the expected real balance of the caller, I do agree with the sponsors comment that the issue is more of warning about possible incompatibilities with some ERC4626 vaults. For that reason, I think that there is not such a fix for that exact issue, that is more a thing at the administration level when creating new vaults. The vaults creator should do their due diligence to verify that the ERC4626 Vault follows in the most part the standard.
dirk_y (warden) commented via issue #35:
0xStalin (warden) commented via issue #35:
asselstine (PoolTogether) commented via issue #35:
