Skip to main content

Money Streaming in Superfluid

Money Streaming, previously known as Constant Flow Agreement (CFA), revolutionizes the movement of tokens with a by-the-second transfer mechanism. This page provides an in-depth overview of Money Streaming and the unique aspects of Flow NFTs in the Superfluid ecosystem.

What is Money Streaming?

Money Streaming allows for continuous, per-second token transfers between accounts, offering a dynamic and flexible approach to token distribution.

Key Characteristics

  • Perpetual Transfers: Streams continue until canceled by the sender or the sender's balance depletes.
  • Flexible Management: Streams can be created, updated, or deleted at any time by the sender.

For a more conceptual breakdown, refer to the detailed Money Streaming overview.

Flows and Flow Rates

Money Streaming in Superfluid introduces the concepts of flows and flow rates, key elements for managing the continuous movement of tokens. This section defines these concepts and explains how to calculate flow rates accurately.

Flows in Superfluid represent the continuous, per-second movement of tokens between accounts. They are defined by their flow rate and can be dynamically managed by the sender.

tip

You may have a hard time seeing the difference between "Flows" and "Streams". This is a feature, not a bug. The key difference is the following: Flows can be equal to 0, while Streams need to be strictly positive.

Flows have the following Characteristics:

  • Perpetual: Flows continue until the sender decides to cancel or the balance depletes.
  • Flexible: Flows can be created, updated, or stopped at any time.

Calculating Flow Rates

Flow rates dictate the speed at which tokens are transferred per second. Superfluid requires these rates to be specified in wei per second.

It's crucial to translate your desired flow rate into wei per second accurately. Incorrect calculations can lead to discrepancies between expected and actual flow rates as displayed on the Superfluid Dashboard and Console.

Flow Rate Conversion

Flow rates can be reframed from larger time denominations like months or years into wei per second. Understand the conversion process to accurately determine the wei/second rate for your flows.

Calculation Examples

From Month to Wei/Second

  • Monthly Rate: 10 DAIx/month.
  • Calculation: 10 DAIx / ((365/12) * 24 * 60 * 60) = 3805175038052 wei/second.

From Year to Wei/Second

  • Yearly Rate: 100 DAIx/year.
  • Calculation: 100 DAIx / (365 * 24 * 60 * 60) = 3170979198376 wei/second.
Calculation Precision

Using an approximate number of days in a month (like 30 days) for calculations can lead to slightly inaccurate wei/second rates, affecting how the rate appears on Superfluid interfaces.

This section provides a clear understanding of flows and flow rates within the Superfluid Money Streaming, enabling users to accurately manage and interpret their token streams.

Flow NFTs

Flow Non-Fungible Tokens (NFTs) serve as on-chain representations of the sender and receiver involved in a Money Stream, enhancing the visibility and traceability of streams.

Purpose and Dynamics

  1. Visual Representation: Similar to Uniswap v3 NFTs, Flow NFTs provide a graphical view of streaming positions.
  2. Transaction Traceability: Easy tracking of stream creation and cancellation through minting and burning events.

Flow NFT Dynamics

Flow NFT Dynamics

Flow NFT Characteristics

  • Minting and Burning: Minted when a stream is opened and burned upon closure.
  • Non-Transferability: Flow NFTs cannot be transferred between accounts.
  • Distinct Contracts: Each Super Token has its own Inflow and Outflow NFT contracts.
warning

Each Super Token, such as fUSDCx and fDAIx, has separate Inflow and Outflow NFT contracts, resulting in different NFTs for different token streams.

Example Transaction

View an example of a Money Streaming transaction, showcasing the minting of Flow NFTs:

  • Stream Sender: 0xbbf19110bf3c536b608877f1e02fdbd3cfac65a6
  • Stream Receiver: 0xc41876dab61de145093b6aa87417326b24ae4ecd

View Transaction on Polygonscan

Visual Examples

Flow NFTs display monthly flow rates, token types, sender/receiver details, network flags, and start dates.

Inflow NFT
Inflow NFT for TDLx stream
Outflow NFT
Outflow NFT for TDLx stream

Generate Flow NFT SVGs and metadata using the Superfluid NFT API.

Useful Functions for Flow NFTs

Access Inflow and Outflow NFT addresses through Super Tokens:

address outflowNFT = superToken.CONSTANT_OUTFLOW_NFT();
address inflowNFT = superToken.CONSTANT_INFLOW_NFT();

Flow NFTs provide functions for interacting with stream data:

// Get stream data from a Flow NFT token ID
function flowDataByTokenId(uint256 tokenId) external view returns (FlowNFTData memory flowData);

// Get Flow NFT token ID for given stream data
function getTokenId(address superToken, address flowSender, address flowReceiver) external view returns (uint256);

This overview offers a comprehensive understanding of Money Streaming and Flow NFTs within the Superfluid ecosystem, highlighting their functionalities, visual representations, and API usage.