Skip to content

[sdk]: lock StreamingYieldVault deposits during vesting#973

Merged
seunlanlege merged 2 commits into
mainfrom
sdk/vault-deposit-lock
Jun 16, 2026
Merged

[sdk]: lock StreamingYieldVault deposits during vesting#973
seunlanlege merged 2 commits into
mainfrom
sdk/vault-deposit-lock

Conversation

@seunlanlege

@seunlanlege seunlanlege commented Jun 15, 2026

Copy link
Copy Markdown
Member

What

Stops new depositors from joining a StreamingYieldVault mid-tranche and skimming yield meant for the holders who were already in. Deposits are now confined to the window between tranches.

Changes

  • Deposits/mints disabled while a tranche vests. maxDeposit/maxMint return 0 during vesting, so deposit/mint revert with the standard ERC4626ExceededMaxDeposit/ERC4626ExceededMaxMint. New capital can only enter after a tranche fully vests and before the next addYield.
  • Guaranteed deposit window. addYield must now wait MIN_WINDOW (2h) past the vest end, reverting with DepositWindowOpen(closesAt) until then. This guarantees a deposit window every cycle regardless of how promptly the keeper runs, independent of an off-chain clock.
  • VEST 23h → 22h, giving a 24h minimum cadence (VEST + MIN_WINDOW) with a guaranteed 2h window.
  • Added nextYieldAt() view (close of the window / earliest next addYield).

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/maxMint reflect 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.mdx synced to the new behaviour (deposit lock, MIN_WINDOW, nextYieldAt, DepositWindowOpen, cadence guidance).

@seunlanlege seunlanlege force-pushed the sdk/vault-deposit-lock branch from 8fcfa5c to 3ed71db Compare June 15, 2026 18:01
@seunlanlege seunlanlege merged commit 80e50a4 into main Jun 16, 2026
1 check passed
@seunlanlege seunlanlege deleted the sdk/vault-deposit-lock branch June 16, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants