Skip to main content


Superfluid is a protocol revolving around a new token standard called Super Token. Super Tokens have special capabilities (super powers?). One of them allows to create second-by-second token transfers (called Money Streaming). In this guide, we'll walk through the process of setting up and deploying a basic contract for creating, updating and deleting Superfluid money streams. Let's go!


  • Solidity knowledge
  • A development environment (Remix, Hardhat, or Foundry)
  • A testnet wallet (e.g., MetaMask)
  • Access to a testnet native coin (e.g. Polygon Mumbai Testnet Matic - get faucet here)

Contract Overview: FlowSender

In this guide we will describe the contract FlowSender:

  • This contract is designed to interact with the Superfluid protocol, specifically to send Super Tokens using Money Streaming.
  • This contract enables the creation, modification, and deletion of continuous money streams.
  • The contract interacts with an example super token (fake DAI Super Token - fDAIx) to create a stream from itself to a receiver.
  • Each time a stream is created, a new receiver is added to the list of receivers, and the Superfluid Protocol keeps track of the balances and the receivers on the blockchain.

Visualization showing the user creating a flow through FlowSender and all of the streams that have been created

What is Tx?

If you are new to blockchain development, you may not be familiar with the term "Tx". Tx is short for transaction, which is a record of an action on the blockchain. Transactions are used to transfer value, store data, and interact with smart contracts.

Contract and Key Functions

Click here to show FlowSender contract

//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.14;

import { ISuperfluid, ISuperToken } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";

import { SuperTokenV1Library } from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// For deployment on Mumbai Testnet

interface IFakeDAI is IERC20 {

function mint(address account, uint256 amount) external;


contract FlowSender {

using SuperTokenV1Library for ISuperToken;

mapping (address => bool) public accountList;

ISuperToken public daix;

// fDAIx address on Polygon Mumbai = 0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f
constructor(ISuperToken _daix) {

daix = _daix;


/// @dev Mints 10,000 fDAI to this contract and wraps it all into fDAIx
function gainDaiX() external {

// Get address of fDAI by getting underlying token address from DAIx token
IFakeDAI fdai = IFakeDAI( daix.getUnderlyingToken() );

// Mint 10,000 fDAI, 10000e18);

// Approve fDAIx contract to spend fDAI
fdai.approve(address(daix), 20000e18);

// Wrap the fDAI into fDAIx


/// @dev creates a stream from this contract to desired receiver at desired rate
function createStream(int96 flowRate, address receiver) external {

// Create stream
daix.createFlow(receiver, flowRate);


/// @dev updates a stream from this contract to desired receiver to desired rate
function updateStream(int96 flowRate, address receiver) external {

// Update stream
daix.updateFlow(receiver, flowRate);


/// @dev deletes a stream from this contract to desired receiver
function deleteStream(address receiver) external {

// Delete stream
daix.deleteFlow(address(this), receiver);


/// @dev get flow rate between this contract to certain receiver
function readFlowRate(address receiver) external view returns (int96 flowRate) {

// Get flow rate
return daix.getFlowRate(address(this), receiver);



  • gainDaiX: Mints and wraps fDAI into fDAIx (Superfluid's wrapped token).
  • createStream: Initiates a new money stream to a specified receiver.
  • updateStream: Updates an existing money stream's flow rate.
  • deleteStream: Terminates an existing money stream.
  • readFlowRate: Reads the current flow rate of a stream.

Environment Setup and Deployment

Deploy the FlowSender contract to a testnet like Mumbai using your preferred development environment.

Using Remix IDE

  1. Access Remix IDE: Visit Remix IDE.
  2. Create New File: In the 'File Explorers' tab, create a new .sol file.
  3. Paste Contract Code: Copy the FlowSender contract code into the new file.
  4. Compile the Contract: Go to the 'Solidity Compiler' tab and click 'Compile'.
  5. Deploy the Contract:
    • Switch to the 'Deploy & Run Transactions' tab.
    • Connect to MetaMask, selecting Mumbai Testnet.
    • Click on 'Deploy' to deploy your contract.

For more information, check out the Remix IDE documentation.

What is the token address?

When deploying the contract, you will need to provide the address of the fDAIx token on the testnet you are using. For example, on Mumbai Testnet, the address of fDAIx is 0x5D8B4C2554aeB7e86F387B4d6c00Ac33499Ed01f.

For other testnets, make sure to check out the Superfluid console.

Interacting with the Contract

Once you have deployed your contract, you can run your tests on your favourite framework. You can also test your smart contract live in the browser using the Superfluid Flow Sender Playground below. Modify yourAddress putting the address to your deployed contract and follow the steps on the interface below.

Live Editor
function FlowSenderPlayground() {

const yourAddress="0xe8f9eEDf7f171111169C71119cd625ee629E9831";
return (
      <FlowSenderComponent contractAddress={yourAddress} />

Further Exploration

Understanding Super Tokens

Super Tokens are the core of the Superfluid protocol, offering real-time finance capabilities. Learn about how these upgraded ERC-20 tokens enable new financial primitives.

Exploring Money Streaming

Money Streaming is a novel concept introduced by Superfluid, allowing continuous and instant value transfer over time.

Diving into Distributions

Distributions are a key feature for scalable one-to-many payments in Superfluid. Learn how you can leverage distributions for various use cases.