Buckets segment deposits into 6‑hour epochs, allowing unlocked liquidity to be recycled quickly and enabling near‑instant withdrawals despite Hyperliquid’s 4‑day lock.
Each new deposit joins the active epoch bucket. Funds remain locked for 4 days, but older buckets expire continuously—so most users exit in minutes, not days.
Hyperliquid enforces a 4‑day lock after every deposit. Without segmentation, a single fresh deposit would freeze the entire vault. Buckets isolate new capital so mature liquidity stays withdrawable.
Buckets live in a 4 096‑slot ring. `head` points to the oldest live bucket, `tail` to the next free slot. This constant‑time structure lets the contract append new buckets and prune empty ones with minimal gas.
When a user requests an exit, the contract walks the ring from `head`, aggregating unlocked principal until the user’s USD goal is met. Any still‑locked buckets are skipped, so exits settle almost instantly if older liquidity suffices.
Each epoch bucket is represented by a minimal clone of the `_Bucket` contract. This helper is the only contract that holds on‑chain state for that bucket.
To capture vault‐level gains, each bucket records its `lastEq` (vault equity) at creation or last fee claim.