Compound Streamer: Universal Asset Streaming Infrastructure

TL;DR: WOOF! has developed a universal streaming infrastructure that enables flexible, oracle-powered asset distribution. Originally built for our Compound funding arrangement, we’re now proposing to make this infrastructure available to the entire ecosystem through a public factory contract.


Problem

Historically, payments to vendors and initiatives have been streamed linearly in COMP tokens. However, this approach exposes both the DAO and recipients to price volatility. If the price of COMP increases, the DAO may overpay relative to the intended USD value. Conversely, if the price of COMP falls, the counterparty may receive less than originally expected. This issue becomes especially pronounced in the case of long-term streams, such as those lasting a year, where market fluctuations can significantly impact the value transferred over time.

Background: From Specific Solution to Universal Infrastructure

Earlier this year, WOOF! implemented a streaming contract for our ongoing development funding from Compound DAO. This contract streams COMP tokens equivalent to a fixed USDC value over time, using Chainlink oracles for real-time price conversion. The Streamer solution has already found positive feedback from the OpenZeppelin team and was also mentioned in the Request for Proposal (RFP): Compound DAO Voting Service Provider (VSP) thread as a distribution mechanism.

After successfully running this system and receiving interest from other ecosystem participants and vendors, we recognized the potential for a more flexible, universal solution.

The result is Compound Streamer - a generalized streaming infrastructure that maintains the proven reliability of our original implementation while adding the flexibility needed for diverse use cases across the ecosystem.

Core Architecture: Dual-Token Streaming with Real-Time Pricing

The Problem with Traditional Streaming

Most streaming solutions distribute a fixed amount of tokens over time. This works well for stable tokens but creates challenges when streaming volatile assets or when you want to maintain consistent USD value distribution.

Our Solution: Native + Streaming Asset Model

Compound Streamer introduces a dual-token architecture:

  • Native Asset: The base unit for value calculation (e.g., USDC, USDT, USD, or any reference token)
  • Streaming Asset: The actual token being distributed (e.g., COMP, WETH, or any ERC20)

Example: Stream 100,000 USD worth of COMP over 6 months

  • Native Asset: USDC (~ 100,000 USD total value)
  • Streaming Asset: COMP (amount varies with price)
  • When COMP = 50 USDC: recipient gets 2,000 COMP
  • When COMP = 40 USDC: recipient gets 2,500 COMP
  • USD value remains constant at $100,000

Oracle-Powered Price Conversion

The system uses paired Chainlink oracles to maintain accurate value conversion:

Streaming Amount = (Native Asset Value × Native Asset Price) / (Streaming Asset Price × (1 - Slippage))

Key features:

  • Real-time pricing: Conversions use latest Chainlink data
  • Slippage protection: Configurable buffer for price volatility
  • Decimal handling: Automatic scaling for tokens with different decimals

Technical Features & Safeguards

Smart Cooldown System

  • Claim cooldown: Prevents seldom claiming frequency
  • Emergency claiming: Anyone can trigger claims after cooldown expires
  • Sweep cooldown: Protects unclaimed tokens after stream end

Flexible Termination Controls

  • Notice period: Configurable advance notice for stream termination
  • Gradual wind-down: Tokens continue accruing during notice period
  • Protection mechanism: Ensures recipients can claim earned tokens

Asset Recovery & Safety

  • Rescue function: Recover accidentally sent tokens (excluding streaming asset)
  • Validation checks: Comprehensive parameter validation at deployment
  • Minimum thresholds: Ensures meaningful stream values ($1+ equivalent)

Factory-Based Deployment

  • Create2 deterministic deployment: Predictable contract addresses
  • Parameter validation: Factory validates all parameters before deployment

Proven Foundation, Enhanced Implementation

Our approach builds on a solid foundation of proven concepts:

Original Implementation (Production):

  • Active operation: WOOF! funding stream successfully running via Compound Proposal 414
  • OpenZeppelin audit: Original hardcoded version reviewed and approved
  • Real-world validation: Handling substantial value transfers with zero incidents
  • Governance approval: Demonstrated community confidence in the streaming concept

Universal Version (New Development):

  • Enhanced architecture: Generalized from proven hardcoded solution
  • Factory-based deployment: Enables ecosystem-wide adoption
  • Comprehensive testing: 95%+ coverage with fuzzing validation across diverse token configurations
  • Security-first approach: Built using same principles that passed OpenZeppelin review

The universal version represents a natural evolution from our successful production system, maintaining the core reliability while adding the flexibility needed for broader ecosystem adoption.

Use Cases & Applications

Treasury Management

  • Vendor payments: Pay service providers in tokens while maintaining USD accounting
  • Grant distribution: Structured grants with built-in vesting

Implementation Examples

Basic COMP Distribution

// Stream 1M USDC worth of COMP over 1 year

factory.deployStreamer(
    COMP_ADDRESS,              // streaming asset
    USDC_ADDRESS,              // native asset (value reference)
    COMP_USD_ORACLE,           // COMP price feed
    USDC_USD_ORACLE,           // USDC price feed
    TREASURY_ADDRESS,          // return address for unused tokens
    RECIPIENT_ADDRESS,         // token recipient
    1_000_000 * 1e6,          // $1M in USDC units
    5e5,                      // 0.5% slippage
    7 days,                   // claim cooldown
    10 days,                  // sweep cooldown
    365 days,                 // stream duration
    30 days                   // minimum notice period
)

Pure USD Streaming

// Stream $1M USD equivalent using constant price feed
factory.deployStreamer(
    COMP\_ADDRESS,              // streaming asset
    CONSTANT\_PRICE\_FEED,       // native asset
    COMP\_USD\_ORACLE,           // COMP price feed
    CONSTANT\_PRICE\_FEED,       // constant $1 feed
    // ... other parameters, same as above
)

Repository & Documentation

Contracts: Available in our compound-streamer repository
Documentation: NatSpec and usage guides included
Testing: 95%+ test coverage with fuzzing validation
Foundation: Built on proven concepts from OpenZeppelin-audited original implementation

Next Steps: Community Deployment

We’re proposing to deploy the StreamerFactory to mainnet, making this infrastructure available to the entire Compound ecosystem. The factory approach ensures:

  1. Open access: Anyone can deploy streaming contracts
  2. Parameter flexibility: Full customization for diverse use cases
  3. Security consistency: All deployments use audited, validated code

Deployment Proposal Steps

  1. Community feedback (this post): Gather input on features and approach
  2. Security audit: Security review of the universal implementation
  3. Final polishing: Complete any requested modifications from audit and community
  4. Mainnet deployment: Make infrastructure available to ecosystem

Discussion Questions

We’d love community input on several key questions:

  1. Feature completeness: Are there additional streaming scenarios this infrastructure should support?
  2. Parameter defaults: What would be sensible default values for cooldowns and notice periods?
  3. Documentation needs: What additional guides or examples would be most valuable?

We look forward to community feedback and the opportunity to contribute this infrastructure to the broader ecosystem’s toolkit.

3 Likes