Use G$ streaming

First-step:


TL;DR (one-minute overview)

Streaming Payments with G$ Token GoodDollar’s G$ is deployed as a pure Superfluid SuperToken on the Celo network—no wrapping needed, so it can be streamed second-by-second out of the box. Streaming turns one-off transfers into continuous flows, enabling payroll, vesting, or loan payments. For other example use cases, see here. For simple second-by-second transfers called 'streaming', powered by the SuperFluid Protocol, you talk directly to the immutable CFAv1Forwarder contract (0xcfA132E3…B125) and pass in G$’s address (0x62B8…C7A`). All flows boil down to three methods:

createFlow(ISuperToken token, address sender, address receiver, int96 flowRate, bytes userData)
updateFlow(ISuperToken token, address sender, address receiver, int96 newRate, bytes userData)
deleteFlow(ISuperToken token, address sender, address receiver, bytes userData)

Optional next steps:


Prerequisites

What
Why

Node ≥ 18 & bundler (Vite / Next)

To build a web client

ethers v6 or viem + wagmi

Low-level EVM calls

A wallet on Celo Mainnet (chainId = 42220)

Only Celo currently has G$ streaming capabilities.

G$ token address

(Recommended for testing: Development G$) 0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475 (production G$) 0x62B8B11039fcfE5AB0C56E502b1C372A3D2a9C7A

CFAv1Forwarder universal address

0xcfA132E353cB4E398080B9700609bb008eceB125 (docs.superfluid.finance)


Project Setup

npm i ethers wagmi viem
// lib/superfluid.ts
import { BrowserProvider } from 'ethers';

export const provider = new BrowserProvider(window.ethereum);
export const forwarderAddr = '0xcfA132E353cB4E398080B9700609bb008eceB125';
export const gDollar     = '0x62B8B11039fcfE5AB0C56E502b1C372A3D2a9C7A';

// paste the CFAv1Forwarder ABI snippet from the tech-ref page ↓
import { CFAv1ForwarderAbi } from './CFAv1ForwarderAbi';

export const forwarder = new ethers.Contract(
  forwarderAddr,
  CFAv1ForwarderAbi,
  provider.getSigner()
);

The full ABI is on the technical-reference page and includes helpers like getBufferAmountByFlowrate. (docs.superfluid.finance)


Creating a Flow (React / wagmi example)

import { useState } from 'react';
import { useAccount } from 'wagmi';
import { forwarder, gDollar } from './lib/superfluid';

// helper – convert “tokens per month” → int96 wad/sec
const perMonthToRate = (pm: string) =>
  BigInt(pm) * 10n ** 18n / 2592000n; // 30 × 24 × 60 × 60

export default function CreateFlow() {
  const { address } = useAccount();
  const [receiver, setReceiver] = useState('');
  const [perMonth, setPerMonth] = useState('10');

  async function start() {
    const tx = await forwarder.createFlow(
      gDollar,
      address!,        // sender (caller)
      receiver,
      perMonthToRate(perMonth), // int96 flowRate
      '0x'             // userData
    );
    await tx.wait();
  }

  return (
    <>
      <input value={receiver} onChange={e=>setReceiver(e.target.value)} />
      <button onClick={start}>
        Stream {perMonth} G$/mo
      </button>
    </>
  );
}

The same pattern works for updateFlow and deleteFlow; just swap the method. (docs.superfluid.finance)


Reading Live Data

// How fast am I sending right now?
const { flowrate } = await forwarder.getFlowInfo(
  gDollar,
  sender,
  receiver
);

// How big a safety buffer does Superfluid require for 10 G$/mo?
const buffer = await forwarder.getBufferAmountByFlowrate(
  gDollar,
  perMonthToRate('10')
);

These helper views are defined in the same contract. (docs.superfluid.finance) For historical analytics use the Superfluid Subgraph or Explorer. (docs.superfluid.finance)


Registering Your dApp as a Super-App (optional)

If your contract should react to incoming/outgoing streams (e.g. auto-staking or NFT minting), you want your dApp to be registered as Super-App.


6 Next Steps & Gotchas

Topic
What to watch for

GDAv1Forwarder

Needed for pool-style “one-to-many” distributions; interface is analogous to CFA but targets pools. (docs.superfluid.finance)

Flow-rate math

rate = amountPerMonth × 1e18 / 2 592 000. Keep int96 limits (~10^27 total). (docs.superfluid.finance)

Buffer deposits

Use getBufferAmountByFlowrate before creating a stream to make sure the sender holds ≥ buffer + first few minutes. (docs.superfluid.finance)

Protocol fees

G$ applies its _processFees on each streamed “drip”; receiver gets flowRate – feeRate.

Network support

Streaming live only on Celo today; G$ on Fuse & ETH can still use one-off transfers.

Testing

Use GoodDollar’s dev contract 0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475. You can claim some free dev G$'s by creating a dev wallet here: https://goodwallet.dev


  1. Create/Update/Delete Flows guide (Superfluid SDK) (docs.superfluid.finance)

  2. CFAv1Forwarder technical reference (docs.superfluid.finance)

  3. GDAv1Forwarder reference (for next steps) (docs.superfluid.finance)

  4. SuperTokenV1Library (Solidity helper) (docs.superfluid.finance)

  5. Super-Apps concepts page (docs.superfluid.finance)

  6. Host & Super-App architecture (docs.superfluid.finance)

  7. App-Registry wiki / registerApp (GitHub)

  8. Agreement Forwarders overview (GitHub)

  9. G$ token contract on CeloScan (Celo Chain Blockchain Explorer)


Last updated

Was this helpful?