GoodDocs
  • Welcome to GoodDocs!
  • GoodDollar Ecosystem Vision
  • About the Protocol
    • Usage
    • Tokenomics
    • Sybil-Resistance
    • Protocol V3 Documentation
      • Architecture & Value Flow
      • System's Elements
      • Core Contracts & API
        • GoodDollar
        • GoodCompoundStaking V2 (DAI)
        • GoodAaveStaking V2 (USDC)
        • GoodReserveCDai
        • GoodFundManager
        • GoodMarketMaker
        • ContributionCalculation
        • UBIScheme
        • Identity
        • FirstClaimPool
        • AdminWallet
        • OneTimePayments
        • DonationsStaking
        • NameService
        • GReputation
        • CompoundVotingMachine
        • StakersDistribution
        • UniswapV2SwapHelper
        • Invites
        • GovernanceStaking
        • ClaimersDistribution
        • CompoundStakingFactory
        • AaveStakingFactory
        • ExchangeHelper
        • FuseFaucet
        • GoodDollarMintBurnWrapper
      • Previous Protocol Versions
        • Protocol V1
          • Architecture & Value Flow
          • Core Contracts & API
        • Protocol V2
          • Architecture & Value Flow
          • System's Elements
            • 1. The token (G$)
            • 2. The Reserve
            • 3. The Trust
            • 4. Staking rewards (APR)
            • 5. The Fund Manager
            • 6. The Distribution Contract (DisCo)
            • 7. Governance (DAO)
          • Core Contracts & API
            • GoodDollar
            • GoodCompoundStaking V2 (DAI)
            • GoodAaveStaking V2 (USDC)
            • GoodReserveCDai
            • GoodFundManager
            • GoodMarketMaker
            • ContributionCalculation
            • UBIScheme
            • Identity
            • FirstClaimPool
            • AdminWallet
            • OneTimePayments
            • DonationsStaking
            • NameService
            • GReputation
            • CompoundVotingMachine
            • StakersDistribution
            • UniswapV2SwapHelper
            • Invites
            • GovernanceStaking
            • ClaimersDistribution
            • CompoundStakingFactory
            • AaveStakingFactory
            • ExchangeHelper
            • FuseFaucet
  • User Guides
    • Buy & Sell G$
    • Stake to create UBI
    • Claim GOOD and G$X
    • Bridge GoodDollars
    • Connect another wallet address to identity
  • Liquidity
  • Wallet and Products
    • GoodWallet
    • GoodDapp
    • New GoodWallet
    • GoodCollective
    • GoodID & GoodOffers
    • 3rd Party Partners and Integrations
  • Frequently Asked Questions
    • Web3 basic knowledge and security tips - by Consensys
    • About GoodDollar
    • GoodDollar Protocol & G$ Token
    • Using GoodDollar
    • GoodDollar Community
    • Troubleshooting
  • For Developers
    • Contributing to GoodDollar
    • GoodDapp Developer Guides
      • Deploy your own GoodDapp UI
      • How to integrate the G$ token
      • Use G$ streaming
      • Ethers V5/useDapp Context Setup
    • APIs & SDKs
      • UBI
        • Claim UBI (Ethers v5/ React)
        • Claim UBI (Viem/Wagmi)
        • Claim UBI (Web-components)
      • Sybil Resistance
        • Identity (Ethers v5 / React)
        • Identity (Viem/Wagmi)
  • Useful Links
    • GoodDollar.org
    • GoodDapp
    • GoodWallet
    • GoodDollar User Guides
    • Statistics Dashboard
    • GoodDollar Whitepaper
    • GoodDollar Litepaper
    • GoodDollar Litepaper - Español
Powered by GitBook
On this page
  • TL;DR (one-minute overview)
  • Prerequisites
  • Project Setup
  • Creating a Flow (React / wagmi example)
  • Reading Live Data
  • Registering Your dApp as a Super-App (optional)
  • 6 Next Steps & Gotchas
  • Reference Links

Was this helpful?

  1. For Developers
  2. GoodDapp Developer Guides

Use G$ streaming

PreviousHow to integrate the G$ tokenNextEthers V5/useDapp Context Setup

Last updated 13 days ago

Was this helpful?

First-step:

  • Superfluid concepts:


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 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:

  • GDAv1Forwarder → pool-style distribution streams, optimized to work with off-chain interactions. ()

  • Super-Apps → have your contracts react to flow events once you register them with the Host. (, )


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

CFAv1Forwarder universal address


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()
);

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>
    </>
  );
}

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')
);

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

Flow-rate math

Buffer deposits

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


Reference Links


(Recommended for testing: Development G$) (production G$)

0xcfA132E353cB4E398080B9700609bb008eceB125 ()

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

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

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

For instructions please follow: The Celo network requires a 'deployer' to be whitelisted before it can be registered.

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

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

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

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

Create/Update/Delete Flows guide (Superfluid SDK) ()

CFAv1Forwarder technical reference ()

GDAv1Forwarder reference (for next steps) ()

SuperTokenV1Library (Solidity helper) ()

Super-Apps concepts page ()

Host & Super-App architecture ()

App-Registry wiki / registerApp ()

Agreement Forwarders overview ()

G$ token contract on CeloScan ()

What is Superfluid?
here.
docs.superfluid.finance
docs.superfluid.finance
GitHub
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
https://docs.superfluid.org/docs/protocol/advanced-topics/super-apps/register
Please reach out to us to help you get whitelisted.
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
GitHub
GitHub
Celo Chain Blockchain Explorer
0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475
0x62B8B11039fcfE5AB0C56E502b1C372A3D2a9C7A
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
docs.superfluid.finance
https://goodwallet.dev