[sdk]: lock StreamingYieldVault deposits during vesting#973
Merged
Conversation
8fcfa5c to
3ed71db
Compare
royvardhan
approved these changes
Jun 16, 2026
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.
What
Stops new depositors from joining a
StreamingYieldVaultmid-tranche and skimming yield meant for the holders who were already in. Deposits are now confined to the window between tranches.Changes
maxDeposit/maxMintreturn0during vesting, sodeposit/mintrevert with the standardERC4626ExceededMaxDeposit/ERC4626ExceededMaxMint. New capital can only enter after a tranche fully vests and before the nextaddYield.addYieldmust now waitMIN_WINDOW(2h) past the vest end, reverting withDepositWindowOpen(closesAt)until then. This guarantees a deposit window every cycle regardless of how promptly the keeper runs, independent of an off-chain clock.VEST23h → 22h, giving a 24h minimum cadence (VEST + MIN_WINDOW) with a guaranteed 2h window.nextYieldAt()view (close of the window / earliest nextaddYield).Why vesting is still needed
Vesting remains the primary anti-snipe defense: it time-weights yield so momentary presence around a recognition event captures nothing, which is what keeps the open deposit window safe. The deposit lock is a complementary fairness rule (no mid-tranche joiners), not a replacement.
Tests
Foundry suite updated and green (25 passing): deposit/mint revert while vesting, deposits open across the whole window,
maxDeposit/maxMintreflect the lock, the window can't be squeezed shut by an eager keeper, and an end-to-end check that a window depositor earns the next tranche but none of the current one.Docs
streaming-yield-vault.mdxsynced to the new behaviour (deposit lock,MIN_WINDOW,nextYieldAt,DepositWindowOpen, cadence guidance).