The Financial Heartbeat of the Wave Program: Automated, Activity-Aware Funding Streams.
DripVault is a mission-critical smart contract module designed to bridge the gap between project treasuries and active maintainers. By leveraging the Drips Protocol V2, it transforms static fund allocations into continuous, streaming payments that respond dynamically to project liveness.
DripVault acts as an intelligent intermediary. It doesn't just "send" money; it orchestrates a continuous flow of value that is verified by on-chain activity heartbeats.
graph TD
A[Project Treasury] -->|Deposit Assets| B(DripVault)
B -->|Configure| C{Drips Hub V2}
C -->|Continuous Stream| D[Maintainer 1]
C -->|Continuous Stream| E[Maintainer 2]
F[Activity Oracle] -->|Heartbeat| G(PulseRegistry)
G -.->|Liveness Query| B
subgraph "Verification Loop"
B -->|isProjectActive?| G
G -- Yes --> B
B -->|syncStream| C
end
| Component | Role | Interaction |
|---|---|---|
| DripVault | The Architect | Holds the logic for stream synchronization and configuration mapping. |
| Drips Hub V2 | The Engine | Executes the core streaming and splitting of ERC-20 tokens. |
| PulseRegistry | The Pulse | Provides a source of truth for maintainer activity (Heartbeats). |
| ERC-20 Token | The Fuel | The underlying asset being streamed (e.g., USDC, DAI). |
The syncStream function is the primary interface for updating funding configurations. It ensures that no funds are streamed to projects that have fallen into a "stale" state.
/**
* @notice Synchronizes the drip stream for a maintainer.
* @param _userId The Drips User ID of the vault account.
* @param _receiver The maintainer address receiving the funds.
* @param _amtPerSec The flow rate (tokens per second).
*/
function syncStream(uint256 _userId, address _receiver, uint128 _amtPerSec) external {
// 1. Verify Liveness via PulseRegistry
require(pulseRegistry.isProjectActive(_receiver), "DripVault: Project heartbeat stale");
// 2. Define Stream Configuration
IDripsHub.StreamConfig memory config = IDripsHub.StreamConfig({
dripId: 0,
amtPerSec: uint160(_amtPerSec),
duration: 0, // Continuous
start: 0 // Immediate
});
// 3. Prepare Receiver Struct
IDripsHub.StreamReceiver memory nextReceiver = IDripsHub.StreamReceiver({
userId: uint256(uint160(_receiver)),
config: config
});
// 4. Update Drips Protocol
dripsHub.setStreams(_userId, ERC20Token, currentStreamConfigs[_userId], 0, wrap(nextReceiver));
}DripVault uses a "Configuration Wrapper" pattern. Instead of maintainers interacting with the complex Drips Hub directly, DripVault provides a simplified, opinionated interface tailored for the Wave Program.
If a project fails to record a heartbeat in the PulseRegistry within the grace period, DripVault can be triggered to halt the stream. This prevents "Ghost Funding" where capital continues to flow to abandoned projects.
By using amtPerSec, DripVault provides predictable funding. For example, to stream 2,500 USDC per month, the rate would be calculated as:
2,500 * 10^6 / (30 * 24 * 60 * 60) ≈ 964,506 units/sec.
While the current scaffold demonstrates a single receiver, the underlying architecture supports complex splitting logic, allowing a single project vault to distribute funds across multiple contributors in a single sync transaction.
git clone https://github.com/your-org/drip-vault.git
cd drip-vault
npm installnpx hardhat compileUpdate scripts/deploy.js with your specific protocol addresses:
- Drips Hub: The core protocol address (e.g., on Polygon, Ethereum, or Optimism).
- Pulse Registry: Your deployed
PulseRegistry.solinstance. - Token: The ERC-20 contract address of the funding asset.
- Authorization: The
syncStreamfunction is currently open for demonstration but should be restricted to aWaveManagerrole or an automated Oracle. - Gas Efficiency: The
setStreamslogic is gas-optimized by the Drips Protocol, but updating large arrays of receivers may require careful batching. - Immutability: Core protocol references are immutable to prevent unauthorized redirection of fund flows.
- Dynamic Rate Scaling: Automatically increase/decrease
amtPerSecbased on contribution point velocity. - Emergency Drain: Governance-controlled function to recover funds if a project is permanently abandoned.
- UI Dashboard: Real-time visualization of active streams and their associated liveness status.
This project is licensed under the MIT License.
Ensuring that every line of code written is met with a continuous pulse of funding.