The original contract V3Vault is not ERC4626 compliant because functions maxRedeem, maxMint, maxWithdraw, maxDeposit don't return the correct value.
Proof of concept
The fix for this issue is PR #15
The mitigation updated the above 4 functions to reflect the correct values; however, there is 1 mistake at function maxWithdraw:
In case balance <= ownerAssetBalance, while the functions should return balance, the balance get converted to assets and returned (the balance is of type asset itself, not share).
Lines of code
https://github.com/revert-finance/lend/blob/audit/src/V3Vault.sol#L345
Vulnerability details
C4 issue
M-14: V3Vault is not ERC-4626 compliant
Comment
The original contract
V3Vault
is not ERC4626 compliant because functionsmaxRedeem
,maxMint
,maxWithdraw
,maxDeposit
don't return the correct value.Proof of concept
The fix for this issue is PR #15 The mitigation updated the above 4 functions to reflect the correct values; however, there is 1 mistake at function
maxWithdraw
:In case
balance <= ownerAssetBalance
, while the functions should returnbalance
, thebalance
get converted to assets and returned (the balance is of type asset itself, not share).Tool used
Manual review
Recommended Mitigation Steps
Return
balance
instead.Assessed type
Math