Building Batched Streams in Safe

Send multiple streams in the same transaction with Safe transaction batching

If you have a Safe and are looking to send multiple streams in one transaction rather than having to manually execute each one, this guide will show you how it's done.

1. Go the Safe Transaction Builder

2. Get CFAv1Forwarder Address

Find the CFAv1Forwarder address for the desired network below:

NetworkAddress

Ethereum Mainnet Polygon Gnosis Chain Optimism Arbitrum Avalanche BNB Chain Goerli Arbitrum Goerli Optimism Goerli Mumbai

0xcfA132E353cB4E398080B9700609bb008eceB125

Avalanche Fuji

0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D

Paste that address in the Enter Address or ENS Name box on the Transaction Builder interface.

3. Copy CFAv1Forwarder ABI

Copy the ABI below and paste in the Enter ABI box in the Transaction Builder interface.

Expand for CFAv1Forwarder ABI

Hover over the code box below and click the copy icon on the top right.

[
    {
      "inputs": [
        {
          "internalType": "contract ISuperfluid",
          "name": "host",
          "type": "address"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
    {
      "inputs": [],
      "name": "CFA_FWD_INVALID_FLOW_RATE",
      "type": "error"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        },
        {
          "internalType": "bytes",
          "name": "userData",
          "type": "bytes"
        }
      ],
      "name": "createFlow",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        },
        {
          "internalType": "bytes",
          "name": "userData",
          "type": "bytes"
        }
      ],
      "name": "deleteFlow",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "getAccountFlowInfo",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "lastUpdated",
          "type": "uint256"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        },
        {
          "internalType": "uint256",
          "name": "deposit",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "owedDeposit",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "getAccountFlowrate",
      "outputs": [
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        }
      ],
      "name": "getBufferAmountByFlowrate",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "bufferAmount",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        }
      ],
      "name": "getFlowInfo",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "lastUpdated",
          "type": "uint256"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        },
        {
          "internalType": "uint256",
          "name": "deposit",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "owedDeposit",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "flowOperator",
          "type": "address"
        }
      ],
      "name": "getFlowOperatorPermissions",
      "outputs": [
        {
          "internalType": "uint8",
          "name": "permissions",
          "type": "uint8"
        },
        {
          "internalType": "int96",
          "name": "flowrateAllowance",
          "type": "int96"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        }
      ],
      "name": "getFlowrate",
      "outputs": [
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "flowOperator",
          "type": "address"
        }
      ],
      "name": "grantPermissions",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "flowOperator",
          "type": "address"
        }
      ],
      "name": "revokePermissions",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        }
      ],
      "name": "setFlowrate",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        }
      ],
      "name": "setFlowrateFrom",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "receiver",
          "type": "address"
        },
        {
          "internalType": "int96",
          "name": "flowrate",
          "type": "int96"
        },
        {
          "internalType": "bytes",
          "name": "userData",
          "type": "bytes"
        }
      ],
      "name": "updateFlow",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "contract ISuperToken",
          "name": "token",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "flowOperator",
          "type": "address"
        },
        {
          "internalType": "uint8",
          "name": "permissions",
          "type": "uint8"
        },
        {
          "internalType": "int96",
          "name": "flowrateAllowance",
          "type": "int96"
        }
      ],
      "name": "updateFlowOperatorPermissions",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    }
]

4. Line Up Streaming Transactions

Now you'll be able to set up each stream transaction for the batch one at a time.

If you're looking to create streams, select the createFlow method.

Function Parameters

token (address) - Super Token you're streaming

sender (address) - Your Safe address

receiver (address) - The receiver address

flowrate (int96) - Flow rate in seconds

Flow Rate is always in wei/second. Super Tokens always have 18 decimals of precision. For example: You want to stream 1000 DAIx/month to Alice

flowrate = 1,000 * (10^18) / ( seconds in month )

flowrate = 1,000 * (10^18) / ( (60 * 60 * 24 * 365) / 12 )

flowrate = 1,000 * (10^18) / 2628000

flowrate = 380517503805175

userData (bytes) - put in 0x

- - -

Hit Add Transaction and repeat for each stream you'd like to send 🔁

5. Create and Send the Batch

Once you added all operations to the batch click "Create Batch" and then "Send Batch". After execution, your streams should be running!

You can check out the Superfluid Safe App to see the streams in action and conduct necessary modifications.

Last updated