
Snapshot
- Focus: A Vault with dynamic adapter-based strategy allocation to invest into different yield sources with varying maturity on Solana with an instant withdrawal mechanism.
- Context: Perena needed a unified vault that could route capital across multiple yield sources while providing instant withdrawals through a treasury; a pattern required due to different yield sources could have different maturity times.
- Who it’s for: Perena, a DeFi protocol building an on-chain banking system using diversified stablecoin yield sources
Outcomes:
- A production metavault system with a standardized adapter interface extensibility for both on-chain and off-chain yield sources with varying maturity times
- A TypeScript SDK for atomic multi-strategy transactions.
- A Treasury system enabling instant withdrawals through adaptive pricing, with dynamic fees based on liquidity scarcity, inventory risk, and time value, plus circuit breakers for self-regulation.
Context
Many on-chain yield strategies introduce lockup periods, where capital must remain deployed for a defined duration before it can be withdrawn.
On Solana, these varying maturity profiles, combined with the constraints of the account model, make it challenging to aggregate multiple strategies into a single vault interface where deposits and withdrawals are managed programmatically.
Moonsong Labs was engaged to design and implement a system that supports combining strategies with different maturity timelines, alongside a treasury mechanism that enables instant liquidity for users in exchange for a variable fee.
The Challenge
The challenge was to design a solution that balanced Solana’s execution model with the operational flexibility expected in DeFi vault products:
- Adapter interface flexibility: The vault needed to accommodate varying protocol requirements without forcing constraints or code changes for new integrations.
- Instant liquidity under capital lock: Users expected same-block withdrawals while strategies locked capital for hours or days. The treasury required an economic model that balanced user demand for immediacy with protocol safety, pricing liquidity as a scarce resource while preventing insolvency through hard safety limits.
- Atomicity and transaction composition: Multi-strategy allocations needed to fit within Solana’s compute budget and account limits while maintaining atomic execution guarantees.
Standard solutions require adapters to be known at the time of deployment, limiting flexibility post-deployment. Introducing new yield sources requires updates to the main vault program logic, rather than deploying a connector and modifying the configuration on an already-running vault.
Our Approach
Moonsong Labs identified this as an adapter interface design issue that required resolving Solana’s account-declaration constraints before building vault logic.

We evaluated six architectural approaches for dynamic adapter integration, including strict account standardization, registry-based account discovery, event-driven patterns, and multi-instruction transactions.
The selected approach, strict account standardization using Anchor’s remaining accounts, balanced flexibility with determinism:
- All adapters implement a uniform interface:
deposit(amount),withdraw_request(shares, recipient),get_nav(), andget_withdrawal_time() - Each method accepts exactly four accounts, passed via the
remaining_accountspattern - Vault code iterates over registered adapters, slicing the account array and forwarding CPI calls without needing to know adapter-specific logic
- Adapters validate their own account structures, but the vault enforces ordering and mutability conventions
This pattern allowed Perena to register adapters by program ID and weight, with the vault handling allocation mechanics generically.
Execution
The implementation progressed in three phases:
Architecture validation
- Prototyped the remaining accounts pattern with a minimal vault and two test strategies.
- Confirmed that account resolution could be handled client-side without indexing infrastructure.
- Validated transaction size and compute budget implications for realistic strategy counts.
Core vault and adapter framework
- Implemented the vault program with a strategy registry and allocation logic.
- Built the first set of production strategy adapters.
- Established testing harnesses that simulated multi-strategy scenarios under varying market conditions.
Client tooling
- Developed an extensible TypeScript client to parse vault configuration and construct strategy-aware transactions.
- Implemented transaction composition logic that combines multiple strategy instructions into single atomic operations.
- Integrated with Perena’s existing transaction simulation and risk management tooling.

Example sequence diagram for Instant Withdraw (shares → assets with dynamic fee) high-level logic.
Results
The architecture successfully decoupled strategy selection from vault mechanics:
- Deploy vault instances targeting arbitrary mixes of DeFi protocols and RWA instruments without modifying core vault code
- Provide instant same-block withdrawals by maintaining a dynamically managed liquidity reserve
- Price instant liquidity through a five-component adaptive fee model (base, utilization, participation, time, risk) with automatic circuit breakers that halt withdrawals when safety thresholds are exceeded
- Compose multi-adapter capital allocations into single atomic transactions via the TypeScript SDK
- Add new yield sources by implementing the four-account adapter interface, no client-side transaction logic changes required.
This approach enabled easy extensibility to vaults without requiring code program code upgrades (and therefore audits) while preserving Solana’s execution guarantees. The pattern was designed to support additional vault configurations across different asset classes and risk profiles.