Open
Conversation
Collaborator
maruf0011
commented
Oct 24, 2023
- Implementation
- Existing test coverage
- New test specific to slippage vault.
larryob
suggested changes
Oct 27, 2023
Contributor
larryob
left a comment
There was a problem hiding this comment.
Looking good, needs a couple of changes.
Comment on lines
+8
to
+10
| import {Vault} from "src/vaults/Vault.sol"; | ||
| import {VaultV2} from "src/vaults/VaultV2.sol"; | ||
| import {NftGate} from "src/vaults/NftGate.sol"; |
|
|
||
| function harvest(Strategy[] calldata strategyList) external virtual override onlyRole(HARVESTER) { | ||
| // Profit must not be unlocking | ||
| // require(block.timestamp >= lastHarvest + LOCK_INTERVAL, "BV: profit unlocking"); |
Contributor
There was a problem hiding this comment.
Probably want to remove this comment
| // Used to store the total profit accrued by the strategies. | ||
| uint256 totalProfitAccrued; | ||
|
|
||
| for (uint256 i = 0; i < strategyList.length; i = uncheckedInc(i)) { |
Contributor
There was a problem hiding this comment.
It'd be nice if we could pull the logic for harvesting a single strategy into its own function.
| * @dev See {IERC4262-deposit}. | ||
| */ | ||
| function deposit(uint256 assets, address receiver) public virtual override whenNotPaused returns (uint256) { | ||
| _harvestAll(); |
Contributor
There was a problem hiding this comment.
Instead of calling_harvestAll(), we should be getting the total strategy holdings before/after we deposit into the strategies. The difference between these two numbers is what should be passed to previewDeposit
| return vaultTVL() - oldTVL; | ||
| } | ||
|
|
||
| function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual override { |
Contributor
There was a problem hiding this comment.
We can't use _depositIntoStrategies. We need to increment totalStrategyHoldings by the exact amount that actually got into the strategies.
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
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.