Dev Update 003 - How the Vault Actually Works
Hey Unchained Community,
The Vault is one of the most structurally important parts of the Solana Unchained ecosystem. It's also one of the most frequently misunderstood. This update is about the mechanics, how tokens lock, how rewards accumulate, and why the design was built the way it was.
Lock and Unlock Logic
When a user stakes into the Vault, they call a lock_tokens instruction that transfers their tokens into a program-owned escrow account. The lock period is tracked by absolute slot number, not a timestamp. The slot number at deposit time plus the duration in slots defines the unlock slot. Tokens cannot be withdrawn until current_slot >= unlock_slot. Early exit is disabled by default. That's not an oversight, it's a deliberate design choice. The Vault is built for committed capital, not short-term parking.
Four lockup durations are available: 30, 90, 180, and 365 days. Each corresponds to a different APR tier, assigned at deposit time and locked for the duration of the stake. The rate doesn't float, what you lock in is what applies for the full period.
Reward Calculation
Rewards are calculated using a straightforward formula:
reward = principal × APR × (elapsed_slots / slots_per_year)
Slots per year is approximately 157,680,000, based on Solana's ~0.5 second target slot time. Rewards accumulate per epoch and are claimable at any time without breaking the lock. Claiming rewards does not reset the lock period or affect the principal.
Why This Structure
The lock/unlock model exists for two reasons. First, it creates predictable, committed liquidity within the ecosystem capital that isn't going to move on short notice. Second, it feeds directly into the protocol fee distribution model. A portion of every Commerce Protocol transaction fee flows back to Vault stakers. The more activity the protocols generate, the more the Vault returns to stakers beyond the base APR. These two systems are designed to reinforce each other.
What's Still Being Validated
The reward accumulation logic has been tested extensively in isolation. Current work involves stress-testing epoch boundary behavior specifically ensuring that rewards are calculated correctly when a claim spans an epoch transition. This is a known edge case in slot-based accounting systems and gets treated with appropriate care.
The Solana Unchained Dev Team