Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _withdraw() natspec #347

Merged
merged 5 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/MetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,13 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph

/// @inheritdoc ERC4626
/// @dev Used in redeem or withdraw to withdraw the underlying asset from Morpho markets.
/// @dev Depending on 4 cases, reverts when withdrawing "too much" with:
/// @dev Depending on 3 cases, reverts when withdrawing "too much" with:
Jean-Grimal marked this conversation as resolved.
Show resolved Hide resolved
/// 1. NotEnoughLiquidity when withdrawing more than available liquidity.
/// 2. ERC20InsufficientAllowance when withdrawing more than `caller`'s allowance.
MerlinEgalite marked this conversation as resolved.
Show resolved Hide resolved
/// 3. ERC20InsufficientBalance when withdrawing more than `owner`'s balance.
/// 1. ERC20InsufficientAllowance when withdrawing more than `caller`'s allowance.
/// 2. ERC20InsufficientBalance when withdrawing more than `owner`'s balance but less than vault's total assets.
/// 3. NotEnoughLiquidity when withdrawing more than vault's total assets.
/// 4. NotEnoughLiquidity when withdrawing more than `owner`'s balance but less than the available liquidity.
/// 3. NotEnoughLiquidity when withdrawing more than available liquidity.
Jean-Grimal marked this conversation as resolved.
Show resolved Hide resolved
function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares)
internal
override
Expand Down
2 changes: 1 addition & 1 deletion test/forge/ERC4626Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ contract ERC4626Test is IntegrationTest, IMorphoFlashLoanCallback {
vault.withdraw(assets, RECEIVER, ONBEHALF);
}

function testWithdrawMoreThanBalanceButLessThanLiquidity(uint256 deposited, uint256 assets) public {
function testWithdrawMoreThanBalanceAndLiquidity(uint256 deposited, uint256 assets) public {
deposited = bound(deposited, MIN_TEST_ASSETS, MAX_TEST_ASSETS);

loanToken.setBalance(SUPPLIER, deposited);
Expand Down
Loading