theaccountantquits

Posted on Nov 28, 2022Read on Mirror.xyz

How to stream payments using Superfluid

gm web3 frens 👋

Why wait to get paid at the end of every month when you get paid every second? It’s one of those experiences I had been craving for without actually knowing it - until Superfluid came along.

Now I can see my money hit my wallet every second in a payment stream 🤯

The limitations of our existing financial system only allows us to pay salaries every month, but with payment streams, we are now ushering into the real-time finance economy era.

It’s a paradigm shift that provides you the ability to earn, invest, and spend your money in real-time.

This article will help you get started and will cover;

  • What is Superfluid

  • What are Super tokens (wrapping/unwrapping)

  • How to send a Superfluid stream

  • Send a streaming invoice in Request Finance

🤨 What is Superfluid

Superfluid is an asset streaming protocol to allow a constant flow of transactions that are executed automatically on-chain. Money streaming supercharges use cases involving recurring transactions with fixed amounts. Some use-cases include, but are not limited to:

  • Subscriptions (eg. paying for fixed gym membership)

  • Token Vesting (eg. DAOs can lock up funds and release periodically in a stream to contributors)

  • Dollar Cost Averaging (eg. stream DAI to accumulate ETH continuously)

Their app allows you to be connected to several blockchains including Polygon, Binance Smartchain, Gnosis Chain, Arbitrum.

What’s cool with using Superfluid is that there is only a transaction cost when you initiate a stream, but no further cost throughout the payment stream.

Important to add that Superfluid is an open source protocol, and any developer can build an application on top. You can view Superfluid’s ecosystem here.

✨ What are Super tokens (wrapping/unwrapping)

What you need to follow this article;

  • A Metamask wallet (as an extension on Chrome, Brave)

  • Some MATIC and DAI on Polygon chain

  • (Optional) Any other ERC20 token other than DAI on Polygon

To start sending streams through the Superfluid app, you do not need to create an account. Simply complete the following steps;

  1. Head over to their app page,

  2. Connect your Metamask wallet,

  3. Switch network to Polygon

If you do not have Polygon added to your Metamask already, you can visit chainlist.org and automatically add it as a network.

In order to use Superfluid’s app, you will 1st need to wrap your ERC20 tokens to a Super Token under the Polygon chain.

In this example, I am wrapping DAI (ERC20 token) into DAIx (Super Token) under the Polygon chain. Once under the Super Token standard, you can start streaming.

Complete the following steps;

  1. In the sidebar, click ‘Wrap/Unwrap’

  2. Select DAI token (or other ERC20 token available), insert the amount, and click on ‘Wrap’

  3. Your Metamask will open, and scroll down to confirm transaction

  4. To view your new DAIx, hover over to Dashboard

Now that you have your Super Tokens ready (here DAIx) , you can send a payment stream every second.

🌊 How to send a Superfluid stream

To start sending a stream, complete the following steps;

  1. In the sidebar, click ‘Send Stream’

  2. Insert the receiver’s wallet address or ENS name

  3. Select DAIx (or other Super Token)

  4. Insert Flow Rate

  5. Choose the time frame of stream , with options such as day, week, month , year.

Here I have chosen to send 4 DAIx over 1 day, which means that every second, the recipient is receiving 0.00004629 DAIx.

6. Make sure you understand the buffer risk, before starting, and click ‘Yes’

The buffer is an amount equivalent to 4 hours worth of the stream flow rate. In this example 0.0667 DAIx ( 0.00004629DAIx x 14,400 seconds).

The buffer is locked and you get it back when you close the stream before your wallet balance hits zero.

Therefore, you must always cancel your streams before your Super Token balance hits zero or your buffer will be lost, as streams cannot stop themselves automatically.

7. Click ‘Send Stream’

8. Your Metamask will open, and scroll down to confirm transaction

Once the stream transaction has been confirmed, you can hover over to your dashboard to see the ongoing stream.

👌Send a streaming invoice in Request Finance

To start accepting and sending payment streams for your business in a compliant way, Request Finance, the web3 tool for invoicing, payroll and accounting, has integrated Superfluid.

If you need help to set up your account and add a client in Request Finance, first go through ‘How to prepare a crypto invoice using Request Finance’

The remaining article will cover how you can issue and pay a streaming invoice, based on what we already learnt on wrapping a Super Token.

📄 Create a streaming invoice

To create a streaming invoice, complete the following steps;

  1. Click on ‘Invoices’ & ‘New invoice’ in sidebar

  2. Add invoice number

  3. Select your client from the drop down list

  4. (Optional) You may cc another recipient at your client’s company

  5. Choose the currency you want to denominate your invoice in

Currently for streaming invoice, Request Finance only allows the invoice to be denominated in the Super Token, and not other fiat currencies like USD or Euro. (In this example, my invoice is denominated in DAIx)

6. Click ‘More Options’ and select ‘invoice to be a recurring invoice through streaming payment’

7. Choose recurrence that you want the invoice to be automatically re-issued (eg. weekly, monthly, yearly)

8. Pick start date of invoice

9. Select the blockchain network you want your client to pay you on (currently only on Polygon)

10. Select the crypto you want to get paid in

11. Select your wallet address you want to get paid in

12. Add a description to your invoice

13. Insert the invoice amount

14. Attach any supporting files if needed

(In the below example, I have chosen to be paid on the Polygon network and in DAIx)

That’s it, click ‘Create & Send’, and you will be notified by email that an invoice has been created. Note that your client will also receive an email notification to pay for the invoice.

🚀Pay a streaming invoice

To complete payment as a registered user of Request Finance, log into your account and head over to the dashboard.

Click on streaming invoice titled ‘Awaiting payment’, and complete following steps;

  1. Connect your wallet to wrap your ERC20 token (DAI) into Super token (DAIx)

  2. Select your Metamask wallet

  3. This message appears whenever you do not have enough Super token in your wallet (as explained above, streaming only works when ERC20 tokens have been wrapped under Superfluid’s standard)

  4. Choose no. of months you wish to deposit, since this is a recurring invoice (in this example, I chose 2 months)

  5. Approve Deposit

  6. Your Metamask will open, and scroll down to confirm transaction

7. As explained above, streams using Superfluid run till perpetuity, and you have to cancel your stream before your deposited balance reaches zero.

8. Click ‘Accept & Continue’ Click ‘Pay Now’ to start paying your stream

9. Your Metamask will open, and scroll down to confirm transaction

What’s cool with using Request Finance for streaming invoices, is that as the invoice issuer, you can use the ‘Withdrawal’ function at any time to withdraw funds in real time.

To do this, head over to the Dashboard, and click on the invoice being streamed in, and complete the following steps;

10. Check the amount streamed to date

11. Click on the ‘Withdrawal’ button

  1. Choose DAI to be withdrawn.

Important to note that the tokens are automatically unwrapped from the Super token to the ERC20 token.

(In this case, since I just started the stream over 1 month as the payer, I could not withdraw the stream. But if I waited longer, I would receive DAI, and not DAIx)

That’s it frens.. I hope you have enjoyed this tutorial on how streaming works under Superfluid, and how you can start invoicing your clients and be paid in streams using Request Finance

About The Accountant Quits

The Accountant Quits is a platform for web3 accounting and prepares accountants for the future of decentralized work. Through its podcast, it aims to educate accountants by discussing with industry experts and thought leaders building practical solutions around blockchain for accounting. Follow us on Twitter for all things on web3 accounting.

subscribe://