Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DripVault 🌊

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.


🏗️ Architecture & System Design

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.

High-Level Workflow

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
Loading

Components Overview

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).

💻 Technical Implementation

Core Logic: syncStream

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));
}

Protocol Wrapping

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.


🛠️ Detailed Features

1. Automated Heartbeat Halting

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.

2. Deterministic Streaming

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.

3. Multi-Receiver Management

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.


🚀 Getting Started

Installation

git clone https://github.com/your-org/drip-vault.git
cd drip-vault
npm install

Compilation

npx hardhat compile

Deployment Configuration

Update 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.sol instance.
  • Token: The ERC-20 contract address of the funding asset.

🛡️ Security Considerations

  • Authorization: The syncStream function is currently open for demonstration but should be restricted to a WaveManager role or an automated Oracle.
  • Gas Efficiency: The setStreams logic 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.

🗺️ Roadmap

  • Dynamic Rate Scaling: Automatically increase/decrease amtPerSec based 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.

📜 License

This project is licensed under the MIT License.


Ensuring that every line of code written is met with a continuous pulse of funding.

About

DripVault is the financial engine of the Wave Program, managing automated funding streams via Drips Protocol V2. Integrated with PulseRegistry, it ensures capital flows only to active maintainers, dynamically halting streams for stale projects to prevent ghost funding and maximize capital efficiency across the ecosystem.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages