-
Notifications
You must be signed in to change notification settings - Fork 156
MasterVault as ERC4626 #124
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
Closed
Closed
+132
−42
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment on lines
+56
to
+68
function deposit(uint256 assets, address receiver) public virtual override returns (uint256 shares) { | ||
if (subVault == address(0)) { | ||
revert SubVaultIsNotSet(); | ||
} | ||
amountDeposited = IERC4626(subVault).deposit(amount, gateway); | ||
emit Deposited(amount); | ||
|
||
IERC20(underlyingAsset).safeTransferFrom(msg.sender, address(this), assets); | ||
IERC20(underlyingAsset).safeIncreaseAllowance(subVault, assets); | ||
IERC4626(subVault).deposit(assets, address(this)); | ||
shares = convertToShares(assets); | ||
netDeposits += assets; | ||
_mint(receiver, shares); | ||
emit Deposit(msg.sender, receiver, assets, shares); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
MasterVault.deposit(uint256,address) ignores return value by IERC4626(subVault).deposit(assets,address(this))
Comment on lines
+77
to
+94
function withdraw(uint256 assets, address receiver, address owner) public virtual override returns (uint256 shares) { | ||
if (subVault == address(0)) { | ||
revert SubVaultIsNotSet(); | ||
} | ||
uint256 shares = IERC4626(subVault).withdraw(amount, recipient, gateway); | ||
emit Withdrawn(amount, recipient, shares); | ||
|
||
shares = convertToShares(assets); | ||
|
||
if (msg.sender != owner) { | ||
_spendAllowance(owner, msg.sender, shares); | ||
} | ||
|
||
uint256 subVaultAssets = _calculateSubVaultWithdrawal(assets); | ||
IERC4626(subVault).withdraw(subVaultAssets, address(this), address(this)); | ||
_burn(owner, shares); | ||
netDeposits -= assets; | ||
IERC20(underlyingAsset).safeTransfer(receiver, assets); | ||
emit Withdraw(msg.sender, receiver, owner, assets, shares); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
802b031
to
fdf4733
Compare
0cb6a58
to
fdf4733
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.