Superfluid Protocol Documentation
website·Indexed 34 days ago
https://docs.superfluid.org/Documentation for the Superfluid protocol, a system for real-time money streaming. It covers the SDK, Super Tokens, Distribution Pools, and advanced topics such as Super Apps, the Stream Scheduler, and solvency mechanisms including liquidations and sentinels. Includes technical references for ISuperToken and SuperTokenV1Library, as well as guides for batching transactions via the Macro Forwarder.
What's inside Superfluid
- In Superfluid, a 'flow' is a continuous stream of tokens from one account to another, enabling real-time payments. Technically, a 'Flow' is a general term; a 'Stream' is specifically a flow with a non-zero rate, while a zero flow is not considered a stream.
Overview of the Superfluid Stream Scheduler
The Stream Scheduler is a Superfluid feature used to automate the lifecycle of token streams. While standard Superfluid streams are perpetual (running until manually canceled or funds are depleted), the Stream Scheduler allows users to:
- Schedule the closing of an existing stream.
- Schedule the start of a new stream.
- Schedule both the start and end dates for a new stream.
This is primarily used for time-bound payments such as payroll, subscriptions, and token vesting. The feature is available via the Superfluid Dashboard (requires approval) or through underlying contracts and off-chain automations.
Overview of Superfluid Super Apps
Super Apps are smart contracts registered with the Superfluid Protocol that can react to specific protocol actions, such as the creation, update, and deletion of flows. This allows developers to build logic that triggers automatically based on cashflow events.Overview of the Superfluid Protocol
Superfluid is a non-custodial, permissionless asset streaming and distribution protocol. It extends the ERC-20 standard via the Super Token framework to enable programmable, composable, and modular cash flows. Key technical advantages include the ability to execute transfers automatically over time in a non-interactive way, without locking up capital, and netting all inflows and outflows in real-time at every block without consuming gas.Overview of the FlowSplitter smart contract
TheFlowSplittersmart contract leverages the Superfluid protocol to automatically route incoming streams of Super Tokens between two recipients: a main receiver and a side receiver. The distribution is controlled by thesideReceiverPortionparameter, which specifies the percentage of the incoming flow routed to the side receiver, while the remaining balance is routed to the main receiver (e.g., ifsideReceiverPortionis 30%, the side receiver gets 30% and the main receiver gets 70%).Overview of Superfluid Distributions
Distributions are a Superfluid primitive designed for scalable one-to-many or many-to-many transfers of value. This is achieved through the creation of Distribution Pools, which are denominated in a single Super Token. There are two primary methods of distributing funds:
- 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 Superfluid Money Streaming into a Pool.
Overview of the Superfluid Vesting Scheduler
The Vesting Scheduler is a non-custodial smart contract used to automate token vesting schedules. It moves tokens directly from a sender's wallet or Safe to a recipient. The system supports customizable cliffs and linear vesting via Superfluid streams, meaning recipients receive tokens automatically in their wallets without needing to manually claim them.
Key capabilities include:
- Implementing linear vesting schedules with customizable cliffs.
- Specifying cliff dates, times, and amounts.
- Defining total vesting amounts and time frames.
- Retaining tokens in the sender's wallet/Safe until the scheduled transfer occurs.
Overview of Superfluid Distribution Pools
Distribution Pools (also known as the General Distributions Agreement or GDA) enable scalable 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.
Overview of Superfluid Distributions
Distributions provide a scalable, gas-efficient method for one-to-many fund transfers in DeFi. Instead of sending individual transactions to multiple recipients, Distributions use Pools to allocate tokens proportionally. The gas cost for executing a distribution remains constant regardless of the number of pool members, making it infinitely scalable compared to traditional multi-send solutions.Overview of SuperfluidStaking architecture
The SuperfluidStaking system implements a stake-based reward distribution platform using Superfluid Distribution Pools (General Distributions Agreement - GDA). It consists of two primary contract components:
- SuperfluidStaking: The core manager responsible for accepting stakes, managing the total staked amount, creating/upgrading Super Tokens for rewards, managing the Superfluid reward pool, and handling the unstaking process.
- ClaimContract: An auxiliary contract deployed for each individual staker to manage the claiming and holding of their specific rewards from the pool.
Overview of Superfluid Distribution Pools
A Distribution Pool (or General Distributions Agreement/GDA) is a smart contract that facilitates the distribution of tokens to multiple members, managed by a pool admin. Members hold units within the pool that determine their proportional share of the distributions. The pool implements basic ERC20 functionality, allowing pool units to be treated as ERC20 tokens (e.g., transferred to other addresses if permitted by configuration).Overview of the Superfluid Macro Forwarder
TheMacroForwarderis a trusted forwarder contract that allows developers to define custom 'macros' (user-defined contracts) to batch transactions. This approach reduces gas consumption, simplifies front-end code, and ensures atomicity for batch calls to the Superfluid Host without requiring the custom macro contract to be explicitly trusted by the Host.