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-spearbit]View functions does not simulate hooks behaviour #118

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from all 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
4 changes: 4 additions & 0 deletions src/module/EulerEarnVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea

/// @notice Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance.
/// @dev See {IERC4626-maxWithdraw}.
/// @dev This function does not simulate the hook behavior called in the actual `withdraw()` function.
/// @return Amount of asset to be withdrawn.
function maxWithdraw(address _owner) public view virtual override nonReentrantView returns (uint256) {
uint256 ownerShares = _balanceOf(_owner);
Expand All @@ -288,6 +289,7 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea

/// @notice Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault.
/// @dev See {IERC4626-maxRedeem}.
/// @dev This function does not simulate the hook behavior called in the actual `redeem()` function.
/// @return Amount of shares.
function maxRedeem(address _owner) public view virtual override nonReentrantView returns (uint256) {
uint256 ownerShares = _balanceOf(_owner);
Expand Down Expand Up @@ -374,6 +376,7 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea

/// @notice Returns the maximum amount of the underlying asset that can be deposited into the euler earn.
/// @dev Not protected with `nonReentrantView()` because it does call `previewMint()` which has the `nonReentrantView()` modifier.
/// @dev This function does not simulate the hook behavior called in the actual `deposit()` function.
function maxDeposit(address) public view virtual override returns (uint256) {
uint256 maxAssets = type(uint256).max;

Expand All @@ -386,6 +389,7 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea
}

/// @notice Returns the maximum amount of the Vault shares that can be minted for the receiver.
/// @dev This function does not simulate the hook behavior called in the actual `mint()` function.
function maxMint(address) public view virtual override nonReentrantView returns (uint256) {
return _maxMint();
}
Expand Down
Loading