Superfluid Protocol Documentation

website·Indexed 30 days ago

https://docs-v2-omega.vercel.app/

Documentation for the Superfluid Protocol, a system for real-time finance and money streaming. It covers the Superfluid Host contract, Super Tokens, Distribution Pools, and advanced features such as Super Apps, the Stream Scheduler, Vesting Scheduler, and Auto-Wrap. The docs provide guidance on SDK integration, batch calls via Macro and CFA Forwarders, and implementing use cases like Token-Cost-Averaging (TCA) and social token incentives.

Tokens
56.9K
Snippets
225
Records
350
Agent score
74%

What's inside Superfluid

  1. Overview of the Macro Forwarder

    The MacroForwarder is a trusted forwarder contract used to batch transactions within the Superfluid ecosystem. It allows builders to define their own 'macros' (via custom contracts) to simplify on-chain logic for batch calls, reduce gas consumption, and ensure atomicity without needing to be directly trusted by the Superfluid host contract. It leverages ERC-2771 to pass the original msg.sender to the host contract.
  2. Overview of the Superfluid Protocol

    Superfluid is a non-custodial, permissionless, and open-source asset streaming and distribution protocol. It enables programmable, composable, and modular cash flows (such as subscriptions, salaries, and vesting) without locking up capital. The protocol nets inflows and outflows in real-time at every block without consuming gas, relying on a smart contract framework that extends the ERC-20 standard.
  3. Overview of the Superfluid Vesting Scheduler

    The Vesting Scheduler is a non-custodial smart contract used to implement token vesting schedules. It moves tokens from a sender's wallet or Safe to a recipient. Key features include:

    • Linear Vesting: Uses Superfluid streams to deliver tokens continuously to the recipient's wallet, removing the need for manual claiming.
    • Customizable Cliffs: Supports the addition of a cliff (a specific date and amount) that must be met before the linear vesting process begins.
    • Non-Custodial: Tokens remain in the sender's wallet or Safe until they are transferred to the recipient according to the schedule.
  4. Overview of Superfluid Distributions

    Distributions are a Superfluid primitive used for scalable one-to-many or many-to-many transfers of value. This is implemented through Distribution Pools, which are denominated in a single Super Token. There are two primary types of distributions:

    • Instant Distribution: A single transaction that distributes Super Tokens to any number of receivers with a fixed gas cost.
    • Streaming Distribution: A continuous flow of funds to receivers via Money Streaming into a Pool.
  5. Overview of Superfluid Distribution Pools

    Distribution Pools (also referred to as the General Distributions Agreement or GDA) enable scalable and efficient one-to-many token distributions at a fixed gas cost. They support two types of distributions:

    • Instant Distributions: A one-time distribution of a specified token amount to all pool members.
    • Streaming Distributions: A continuous flow of tokens to pool members over time.

    A single pool can be used to distribute any Super Token for either instant or streaming distributions.

  6. Overview of SuperfluidStaking contract architecture

    The SuperfluidStaking system implements a stake-based reward distribution platform using two primary contracts:

    1. SuperfluidStaking: The core manager responsible for accepting stakes, managing total staked amounts, creating/upgrading Super Tokens for rewards, managing the Superfluid distribution pool, and handling the unstaking and reward claim processes.
    2. ClaimContract: An auxiliary contract deployed for each individual staker. It is responsible for claiming rewards from the Superfluid pool and holding those rewards until the staker withdraws them.
  7. Use the Stream Accounting API for financial reporting

    The Stream Accounting API is a RESTful service that converts real-time Superfluid stream data into a format compatible with traditional accounting tools. It allows developers to aggregate stream value transfers into specific accounting periods (e.g., hourly, daily, or monthly) across all Superfluid-supported networks and tokens via Superfluid Subgraphs.

    Key capabilities include:

    • Flow Rate Changes: The API automatically segments data into separate periods when a stream's flow rate is updated.
    • Directionality: It tracks both incoming and outgoing streams, representing incoming value as positive and outbound value as negative.
    • Token Pricing: If a token is tracked by Coingecko, the API provides price information. Users can choose between instantaneous prices for each period or average prices over a timeframe.
  8. Understand Super Tokens and Wrapping

    Super Tokens are the fundamental assets used in all Superfluid operations. They come in three types: ERC20 Wrapper Tokens, Pure Super Tokens, and Native Asset Super Tokens.

    • Wrap: The process of converting standard ERC20 tokens into wrapped super tokens by transferring assets into a wrapper contract.
    • Unwrap: The process of converting wrapped super tokens back into underlying ERC20 assets by burning the super tokens.
    • Real Time Balance: A dynamic calculation of an account's balance that accounts for both static token balances and active Superfluid agreement logic.
  9. Understand Wrapper Super Tokens

    Wrapper Super Tokens are existing ERC20 tokens that have been wrapped to gain Superfluid functionalities, such as Money Streaming and Distributions. Wrapping converts an underlying token into its Super Token version, and unwrapping reverses this process.
  10. Understand Distribution concepts and terminology

    Distributions provide a scalable method for one-to-many fund transfers in DeFi, allowing value to be sent to multiple recipients with constant gas costs regardless of the number of receivers. Key concepts include:

    • Pool: A channel used for proportional token distribution. In streaming distributions, pools are contracts and can be ERC20 tokens.
    • Distribution: The action of allocating specified token amounts to receivers.
    • Units: The proportion of the distribution each subscriber receives.
    • Pool Admin: The administrator who manages the distribution process and assigns/revokes units.
    • Subscribers/Pool Member: Receivers allocated units who are eligible to receive tokens.