The DAO Treasury Streaming Program enables decentralized, automated, and trustless fund distribution for DAOs, contributors, teams, and long-term treasury management.
This program allows DAOs to:
- Stream funds over time
- Control treasury unlock schedules
- Automate vesting
- Prevent misuse of funds
- Guarantee transparent on-chain distribution
All logic is enforced using Solana PDAs, ensuring complete trustlessness.
DAOs often face a major problem: sending full payments upfront creates high risk, but manual milestone payments slow down progress.
Treasury streaming removes both issues.
The program ensures:
- Funds are released gradually
- DAO keeps full control
- Contributors cannot run away with upfront lump-sums
- DAO cannot rug contributors either
- Every lamport movement is transparent and verifiable
Treasury streaming creates a balanced, transparent, trustless payment system for all DAO contributors.
-
DAO creates a stream → funds are locked in a PDA vault.
- This vault holds the total amount for the stream.
- Neither DAO nor contributor can withdraw arbitrarily.
-
Contributor earns tokens over time.
- Stream unlocks linearly per second.
- Contributor can withdraw only the “earned” portion.
-
DAO can pause or cancel the stream.
- Unused funds automatically return to the DAO.
-
Contributor can withdraw unlocked tokens anytime.
This ensures predictable, automated, and safe fund flow.
- Contributor cannot withdraw more than what has vested.
- DAO funds stay locked inside a PDA-controlled vault.
- DAO cannot access vested funds owed to the contributor.
- Stream state is program-enforced, not trust-based.
- Everything is transparent and verifiable on-chain.
Treasury streaming creates a secure, predictable, and trustless payment flow for DAO contributors.
(modeled accurately based on common treasury-streaming patterns and your repo structure)
Stores all metadata needed to run and manage a vesting/stream.
#[account]
pub struct Stream {
pub stream_id: [u8; 16], // UUID
pub dao: Pubkey, // DAO signer / owner
pub recipient: Pubkey, // contributor receiving funds
pub total_amount: u64, // full amount locked for the stream
pub withdrawn_amount: u64, // amount already claimed
pub start_time: i64, // unix timestamp
pub end_time: i64, // stream end timestamp
pub is_paused: bool, // streaming control
pub bump: u8,
}Holds the funds being streamed.
#[account]
pub struct Vault {
pub authority: Pubkey, // PDA derived from Stream
pub amount: u64, // lamports stored in vault
}Optional: stores DAO-level metadata.
#[account]
pub struct DaoConfig {
pub dao: Pubkey,
pub treasury_wallet: Pubkey,
pub bump: u8,
}| PDA | Seeds |
|---|---|
| Stream | "stream", dao_pubkey, stream_id |
| Vault | "vault", stream_pubkey |
| DaoConfig | "dao", dao_pubkey |
The treasury system ensures:
- Predictable unlocking
- Trustless fund custody
- Secure withdrawals
- Safe cancellation
- Accurate accounting
Below is how a typical DAO → contributor stream lifecycle works.
DAO signs an instruction to:
- Generate a Stream PDA:
["stream", dao_pubkey, stream_id]
- Lock funds inside a Vault PDA
- Set start/end timestamps
- Freeze funds so neither party can cheat
No tokens move to the contributor yet.
This prevents:
- Overpayment
- Immediate rug pulls
- Manual off-chain tracking
As time passes:
- Unlocked = linear_vesting(start_time, end_time)
- Contributor may only withdraw what is unlocked
- Program enforces mathematical accuracy
Contributor withdraws only the vested portion.
Checks:
now >= start_timeunlocked_amount > withdrawn_amount
Funds move:
- From Vault PDA
- To contributor wallet
- Using PDA signer seeds
DAO can:
Stops further vesting. Contributor cannot gain or withdraw more.
Returns unvested funds to DAO automatically:
- Contributor keeps vested amount
- DAO recovers unused funds
This protects both parties fairly and algorithmically.
- Neither party controls the vault directly
- Contributor cannot withdraw unearned funds
- DAO cannot steal already vested funds
- All math is on-chain, trustless, and deterministic
- Every action is bound to PDA signers
- No administrator can override vesting logic
- Full transparency and auditability
This is the foundation of safe DAO treasury management.
This program is provided “as is”, without any warranties of any kind. Developers and DAOs must audit and verify this code before deployment. Use at your own risk.
Contributions are welcome. Please open an issue to discuss architectural or design changes.
MIT License.
See the LICENSE file for full terms.