superfluid

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Superfluid Protocol Skill

Superfluid Protocol 技能指南

Complete interface documentation for Superfluid Protocol smart contracts via Rich ABI YAML references. Read
references/architecture.md
for the full protocol architecture. This file maps use-cases to the right references and explains how to read them.
通过Rich ABI YAML参考文档,为Superfluid Protocol智能合约提供完整的接口说明。如需了解完整的协议架构,请阅读
references/architecture.md
。本文档将不同用例映射到对应的参考资料,并说明如何阅读这些资料。

Architecture Summary

架构概述

Host (
Superfluid.sol
) — central router. Agreement calls go through
Host.callAgreement()
or
Host.batchCall()
. Manages the app registry, governance, and SuperTokenFactory.
Agreements — stateless financial primitives that store data on the token: CFA (1:1 streams), GDA (many-to-many via pools), IDA (deprecated, replaced by GDA).
Super Token — ERC-20/ERC-777/ERC-2612 with real-time balance. Three variants: Wrapper (ERC-20 backed), Native Asset/SETH (ETH backed), Pure (pre-minted).
Forwarders (CFAv1Forwarder, GDAv1Forwarder) — convenience wrappers. Each call is a standalone transaction with readable wallet descriptions. Cannot be batched — use
Host.batchCall
with raw agreement calls for atomicity.
MacroForwarder — extensible batch executor. Developers deploy custom macro contracts (
IUserDefinedMacro
) and call
MacroForwarder.runMacro()
to execute complex multi-step operations atomically. See
references/guides/macro-forwarders.md
.
Automation (Vesting Scheduler, FlowScheduler, Auto-Wrap) — schedule on-chain intent, require off-chain keepers to trigger execution.
Host
Superfluid.sol
)——核心路由组件。协议调用需通过
Host.callAgreement()
Host.batchCall()
发起。负责管理应用注册表、治理机制以及SuperTokenFactory。
协议(Agreements)——无状态的金融原语,数据存储在代币层面:包括CFA(一对一资金流)、GDA(通过资金池实现多对多分配)、IDA(已废弃,由GDA替代)。
Super Token——兼容ERC-20/ERC-777/ERC-2612标准的实时余额代币。分为三种类型:Wrapper(基于ERC-20背书)、Native Asset/SETH(基于ETH背书)、Pure(预铸造)。
Forwarders(CFAv1Forwarder、GDAv1Forwarder)——便捷封装工具。每个调用都是独立交易,带有易读的钱包描述。不支持批量操作——如需原子性批量操作,请使用
Host.batchCall
搭配原始协议调用。
MacroForwarder——可扩展的批量执行器。开发者部署自定义宏合约(
IUserDefinedMacro
),并调用
MacroForwarder.runMacro()
来原子性执行复杂的多步骤操作。详情请见
references/guides/macro-forwarders.md
自动化组件(Automation)(Vesting Scheduler、FlowScheduler、Auto-Wrap)——用于调度链上意图,需要链下keeper触发执行。

Use-Case → Reference Map

用例→参考资料映射

Read only the files needed for the task. Each Rich ABI YAML documents every public function, event, and error for one contract.
仅阅读完成任务所需的文档。每个Rich ABI YAML文档都记录了对应合约的所有公开函数、事件和错误信息。

Streaming money (CFA)

资金流(CFA)

IntentRead
Create/update/delete a stream (simple)
references/contracts/CFAv1Forwarder.abi.yaml
ACL, operator permissions, flow metadataalso
references/contracts/ConstantFlowAgreementV1.abi.yaml
Batch streams with other ops atomicallyalso
references/contracts/Superfluid.abi.yaml
(Host batch call)
意图参考文档
创建/更新/删除简单资金流
references/contracts/CFAv1Forwarder.abi.yaml
ACL、操作员权限、资金流元数据额外参考
references/contracts/ConstantFlowAgreementV1.abi.yaml
与其他操作原子性批量执行资金流额外参考
references/contracts/Superfluid.abi.yaml
(Host批量调用)

Distributing to many recipients (GDA)

多接收方资金分配(GDA)

IntentRead
Create pools, distribute, stream to pool
references/contracts/GDAv1Forwarder.abi.yaml
Pool member management, units, claimsalso
references/contracts/SuperfluidPool.abi.yaml
Low-level agreement detailsalso
references/contracts/GeneralDistributionAgreementV1.abi.yaml
意图参考文档
创建资金池、分配资金、向资金池发送流
references/contracts/GDAv1Forwarder.abi.yaml
资金池成员管理、份额、申领额外参考
references/contracts/SuperfluidPool.abi.yaml
底层协议细节额外参考
references/contracts/GeneralDistributionAgreementV1.abi.yaml

Token operations

代币操作

IntentRead
Wrap/unwrap, balances, ERC-20/777, permit
references/contracts/SuperToken.abi.yaml
Deploy a new Super Token
references/contracts/SuperTokenFactory.abi.yaml
意图参考文档
包装/解包、余额、ERC-20/777、授权
references/contracts/SuperToken.abi.yaml
部署新的Super Token
references/contracts/SuperTokenFactory.abi.yaml

Automation

自动化

IntentRead
Vesting with cliffs and streams
references/contracts/VestingSchedulerV3.abi.yaml
Schedule future stream start/stop
references/contracts/FlowScheduler.abi.yaml
Auto-wrap when Super Token balance is low
references/contracts/AutoWrapManager.abi.yaml
and
references/contracts/AutoWrapStrategy.abi.yaml
意图参考文档
带有 cliff 和流的归属计划
references/contracts/VestingSchedulerV3.abi.yaml
调度未来资金流的启动/停止
references/contracts/FlowScheduler.abi.yaml
当Super Token余额不足时自动包装
references/contracts/AutoWrapManager.abi.yaml
references/contracts/AutoWrapStrategy.abi.yaml

Writing Solidity integrations (SuperTokenV1Library)

编写Solidity集成代码(SuperTokenV1Library)

IntentRead
Token-centric Solidity API (
using SuperTokenV1Library for ISuperToken
)
references/libraries/SuperTokenV1Library.abi.yaml
The library wraps CFA and GDA agreement calls into ergonomic methods like
token.flow(receiver, flowRate)
. Use it for any Solidity contract that interacts with Superfluid — Super Apps, automation contracts, DeFi integrations. Includes agreement-abstracted functions (
flowX
,
transferX
) that auto-route to CFA or GDA, plus
WithCtx
variants for Super App callbacks. See the YAML header and glossary for Foundry testing gotchas.
意图参考文档
以代币为中心的Solidity API(
using SuperTokenV1Library for ISuperToken
references/libraries/SuperTokenV1Library.abi.yaml
该库将CFA和GDA协议调用封装为易用的方法,例如
token.flow(receiver, flowRate)
。任何与Superfluid交互的Solidity合约(Super Apps、自动化合约、DeFi集成)都可使用它。它包含协议抽象函数(
flowX
transferX
),可自动路由到CFA或GDA,还包含用于Super App回调的
WithCtx
变体。请查看YAML头部和术语表,了解Foundry测试中的注意事项。

Building Super Apps

构建Super Apps

IntentRead
CFA callback hooks (simplified base)
references/bases/CFASuperAppBase.abi.yaml
Token-centric API for callback logicalso
references/libraries/SuperTokenV1Library.abi.yaml
(use
WithCtx
variants)
App registration, Host context, batch calls
references/contracts/Superfluid.abi.yaml
Super Apps that relay incoming flows via app credit cause the sender's deposit to roughly double (or more for fan-out patterns), because outgoing stream deposits are backed by the sender as owed deposit. See "App Credit & Deposit Mechanics" in
references/architecture.md
for the full explanation.
意图参考文档
CFA回调钩子(简化基类)
references/bases/CFASuperAppBase.abi.yaml
用于回调逻辑的代币中心API额外参考
references/libraries/SuperTokenV1Library.abi.yaml
(使用
WithCtx
变体)
应用注册、Host上下文、批量调用
references/contracts/Superfluid.abi.yaml
通过应用信用中继流入资金流的Super Apps会导致发送方的押金大约翻倍(扇出模式下可能更多),因为流出资金流的押金由发送方作为应付押金提供。完整说明请见
references/architecture.md
中的“应用信用与押金机制”章节。

Macro forwarders (composable batch operations)

宏转发器(可组合批量操作)

IntentRead
Write a macro for complex batched operations
references/guides/macro-forwarders.md
MacroForwarder contract address and interfacealso
references/guides/macro-forwarders.md
Batch operation types and encoding rulesalso
references/contracts/Superfluid.abi.yaml
(batch_operation_types)
EIP-712 signed macro patterns
references/guides/macro-forwarders-eip712-example.md
意图参考文档
编写用于复杂批量操作的宏
references/guides/macro-forwarders.md
MacroForwarder合约地址和接口额外参考
references/guides/macro-forwarders.md
批量操作类型和编码规则额外参考
references/contracts/Superfluid.abi.yaml
(batch_operation_types)
EIP-712签名宏模式
references/guides/macro-forwarders-eip712-example.md

Sentinels and liquidation

哨兵与清算

IntentRead
Batch liquidation of critical flows
references/contracts/BatchLiquidator.abi.yaml
PIC auction, bond management, exit rates
references/contracts/TOGA.abi.yaml
意图参考文档
批量清算关键资金流
references/contracts/BatchLiquidator.abi.yaml
PIC拍卖、债券管理、退出费率
references/contracts/TOGA.abi.yaml

Querying indexed data (Subgraphs)

查询索引数据(Subgraphs)

IntentRead
Understand how The Graph generates query schemas from entity definitions
references/subgraphs/query-patterns.md
Query streams, pools, tokens, accounts, eventsalso
references/subgraphs/protocol-v1.graphql
Query vesting schedules and execution historyalso
references/subgraphs/vesting-scheduler.graphql
Query scheduled flows and automation tasksalso
references/subgraphs/flow-scheduler.graphql
Query auto-wrap schedules and execution historyalso
references/subgraphs/auto-wrap.graphql
意图参考文档
了解The Graph如何从实体定义生成查询模式
references/subgraphs/query-patterns.md
查询资金流、资金池、代币、账户、事件额外参考
references/subgraphs/protocol-v1.graphql
查询归属计划和执行历史额外参考
references/subgraphs/vesting-scheduler.graphql
查询调度的资金流和自动化任务额外参考
references/subgraphs/flow-scheduler.graphql
查询自动包装计划和执行历史额外参考
references/subgraphs/auto-wrap.graphql

Legacy

遗留内容

IntentRead
Old IDA (instant distribution, deprecated)
references/contracts/InstantDistributionAgreementV1.abi.yaml
意图参考文档
旧版IDA(即时分配,已废弃)
references/contracts/InstantDistributionAgreementV1.abi.yaml

Ecosystem & tooling

生态系统与工具

IntentRead
Which SDK or package for a projectSee Ecosystem → SDKs & Packages below
Token prices, filtered token list, CoinGecko IDsSee Ecosystem → API Services (CMS) below
Stream accounting, per-day chunkingSee Ecosystem → API Services (Accounting) below
Resolve ENS / Farcaster / Lens handlesSee Ecosystem → API Services (Whois) below
Query protocol data via GraphQLSee Ecosystem → Subgraphs below
SUP token, governance, DAOSee Ecosystem → Foundation, DAO & SUP Token below
Token prices for Super Tokens (simple API)See Ecosystem → API Services (Token Prices) below
Run a sentinel / liquidation botSee Ecosystem → Sentinels below
Get a Super Token listed / enable automationsSee Ecosystem → Processes below
意图参考文档
为项目选择合适的SDK或包请查看下方生态系统→SDK与包部分
代币价格、筛选后的代币列表、CoinGecko ID请查看下方生态系统→API服务(CMS)部分
资金流会计核算、按天拆分请查看下方生态系统→API服务(会计核算)部分
解析ENS / Farcaster / Lens 句柄请查看下方生态系统→API服务(Whois)部分
通过GraphQL查询协议数据请查看下方生态系统→Subgraphs部分
SUP代币、治理、DAO请查看下方生态系统→基金会、DAO与SUP代币部分
Super Tokens的代币价格(简易API)请查看下方生态系统→API服务(代币价格)部分
运行哨兵/清算机器人请查看下方生态系统→哨兵部分
申请Super Token上线/启用自动化请查看下方生态系统→流程部分

Debugging Reverts

调试回滚

Error prefixes map to contracts:
PrefixContract
CFA_*
ConstantFlowAgreementV1
CFA_FWD_*
CFAv1Forwarder
GDA_*
GeneralDistributionAgreementV1
SUPERFLUID_POOL_*
SuperfluidPool
SF_TOKEN_*
SuperfluidToken (base of SuperToken)
SUPER_TOKEN_*
SuperToken
SUPER_TOKEN_FACTORY_*
SuperTokenFactory
HOST_*
Superfluid (Host)
IDA_*
InstantDistributionAgreementV1
APP_RULE
Superfluid (Host) — Super App callback violation
Each YAML's
errors:
section is the complete error index for that contract, with selector hashes and descriptions. Per-function
errors:
fields show which errors a specific function can throw.
错误前缀与合约的映射:
前缀合约
CFA_*
ConstantFlowAgreementV1
CFA_FWD_*
CFAv1Forwarder
GDA_*
GeneralDistributionAgreementV1
SUPERFLUID_POOL_*
SuperfluidPool
SF_TOKEN_*
SuperfluidToken(SuperToken的基类)
SUPER_TOKEN_*
SuperToken
SUPER_TOKEN_FACTORY_*
SuperTokenFactory
HOST_*
Superfluid(Host)
IDA_*
InstantDistributionAgreementV1
APP_RULE
Superfluid(Host)——Super App回调违反规则
每个YAML的
errors:
部分是对应合约的完整错误索引,包含选择器哈希和描述信息。每个函数的
errors:
字段显示该特定函数可能抛出的错误。

Reading the Rich ABI YAMLs

阅读Rich ABI YAML文档

Each YAML is a self-contained contract reference. Here's how to parse them.
每个YAML都是独立的合约参考文档。以下是解析方法。

Root structure

根结构

undefined
undefined

Header comment — contract name, description, key notes

头部注释——合约名称、描述、关键注意事项

meta: # name, version, source, implements, inherits, deployments
meta: # 名称、版本、源代码、实现接口、继承关系、部署信息

== Section == # Grouped functions (these are the core content)

== 章节 == # 分组函数(核心内容)

events: # All events the contract emits errors: # Complete error index

Three root keys are reserved: `meta`, `events`, `errors`. Every other
root-level key is a **function**.
events: # 合约发出的所有事件 errors: # 完整错误索引

三个根键是保留字段:`meta`、`events`、`errors`。其他所有根级别键都是**函数**。

Function entries

函数条目

yaml
createFlow:
  # Description of what the function does.
  # GOTCHA: Non-obvious behavior or edge cases.
  mutability: nonpayable     # view | pure | nonpayable | payable
  access: sender | operator  # who can call (omitted for view/pure)
  inputs:
    - token: address
    - receiver: address
    - flowRate: int96        # inline comments for non-obvious params
    - ctx: bytes
  outputs:
    - newCtx: bytes
  emits: [FlowUpdated, FlowUpdatedExtension]   # ordered by emission sequence
  errors: [CFA_FLOW_ALREADY_EXISTS, CFA_INVALID_FLOW_RATE]  # ordered by check sequence
Fields appear in this order: description comment,
mutability
,
access
,
inputs
,
outputs
,
emits
,
errors
. All are omitted when not applicable.
yaml
createFlow:
  # 函数功能描述。
  # 注意:非直观行为或边缘情况。
  mutability: nonpayable     # view | pure | nonpayable | payable
  access: sender | operator  # 可调用者(view/pure函数可省略)
  inputs:
    - token: address
    - receiver: address
    - flowRate: int96        # 非直观参数的内联注释
    - ctx: bytes
  outputs:
    - newCtx: bytes
  emits: [FlowUpdated, FlowUpdatedExtension]   # 按触发顺序排列
  errors: [CFA_FLOW_ALREADY_EXISTS, CFA_INVALID_FLOW_RATE]  # 按检查顺序排列
字段顺序为:描述注释、
mutability
access
inputs
outputs
emits
errors
。不适用的字段可省略。

Key conventions

关键约定

  • ctx: bytes
    parameter
    = function is called through the Host (
    callAgreement
    /
    batchCall
    ), never directly.
  • access
    labels
    :
    anyone
    ,
    host
    ,
    self
    ,
    admin
    ,
    governance
    ,
    sender
    ,
    receiver
    ,
    operator
    ,
    manager
    ,
    pic
    ,
    agreement
    ,
    trusted-forwarder
    ,
    factory
    ,
    super-app
    . Combine with
    |
    . Conditional:
    anyone(if-critical-or-jailed)
    .
  • emits
    and
    errors
    ordering
    carries meaning: matches execution flow, not alphabetical. First errors in the list are the most likely causes.
  • # GOTCHA:
    prefix flags non-obvious behavior, common mistakes, or edge cases. Pay close attention to these.
  • meta.source
    is an array of raw GitHub URLs to the Solidity source files (implementation, interface, base — filenames are self-documenting).
  • meta.deployments
    has per-network addresses split into
    mainnet
    and
    testnet
    subgroups.
  • ctx: bytes
    参数
    = 函数需通过Host调用(
    callAgreement
    /
    batchCall
    ),不能直接调用。
  • access
    标签
    anyone
    host
    self
    admin
    governance
    sender
    receiver
    operator
    manager
    pic
    agreement
    trusted-forwarder
    factory
    super-app
    。可使用
    |
    组合。条件性:
    anyone(if-critical-or-jailed)
  • emits
    errors
    的顺序
    有意义:与执行流程一致,而非按字母顺序排列。列表中的第一个错误是最可能的原因。
  • **
    # GOTCHA:
    **前缀标记非直观行为、常见错误或边缘情况。请务必注意这些内容。
  • **
    meta.source
    **是Solidity源代码文件的原始GitHub URL数组(实现、接口、基类——文件名自解释)。
  • **
    meta.deployments
    **包含按
    mainnet
    testnet
    分组的各网络部署地址。

Events section

事件章节

yaml
events:
  FlowUpdated:
    indexed:              # log topics (filterable)
      - token: address
      - sender: address
    data:                 # log payload
      - flowRate: int96
yaml
events:
  FlowUpdated:
    indexed:              # 日志主题(可过滤)
      - token: address
      - sender: address
    data:                 # 日志负载
      - flowRate: int96

Errors section

错误章节

yaml
errors:
  # -- Category --
  - SIMPLE_ERROR                    # 0xabcd1234 — description
  - PARAMETERIZED_ERROR:            # errors with diagnostic data
      inputs:
        - value: uint256
yaml
errors:
  # -- 分类 --
  - SIMPLE_ERROR                    # 0xabcd1234 — 描述
  - PARAMETERIZED_ERROR:            # 包含诊断数据的错误
      inputs:
        - value: uint256

Runtime Data (Scripts)

运行时数据(脚本)

The Rich ABIs document interfaces (what to call and how). Scripts provide runtime data (what to call it on) by wrapping canonical npm packages with local caching for offline use. No npm install required — the scripts fetch from CDN equivalents of the packages.
Rich ABI文档记录接口(调用什么以及如何调用)。脚本通过封装标准npm包并提供本地缓存以支持离线使用,提供运行时数据(调用的目标地址)。无需安装npm——脚本从CDN等效源获取包内容。

ABI JSON —
@sfpro/sdk
package +
scripts/abi.mjs

ABI JSON —
@sfpro/sdk
包 +
scripts/abi.mjs

The
@sfpro/sdk
package provides typed JSON ABIs for use with viem / wagmi / ethers. ABIs are split across sub-paths:
Contract (YAML name)Import pathExport name
CFAv1Forwarder
@sfpro/sdk/abi
cfaForwarderAbi
GDAv1Forwarder
@sfpro/sdk/abi
gdaForwarderAbi
SuperfluidPool
@sfpro/sdk/abi
gdaPoolAbi
SuperToken
@sfpro/sdk/abi
superTokenAbi
Superfluid (Host)
@sfpro/sdk/abi/core
hostAbi
ConstantFlowAgreementV1
@sfpro/sdk/abi/core
cfaAbi
GeneralDistributionAgreementV1
@sfpro/sdk/abi/core
gdaAbi
InstantDistributionAgreementV1
@sfpro/sdk/abi/core
idaAbi
SuperTokenFactory
@sfpro/sdk/abi/core
superTokenFactoryAbi
BatchLiquidator
@sfpro/sdk/abi/core
batchLiquidatorAbi
TOGA
@sfpro/sdk/abi/core
togaAbi
AutoWrapManager
@sfpro/sdk/abi/automation
autoWrapManagerAbi
AutoWrapStrategy
@sfpro/sdk/abi/automation
autoWrapStrategyAbi
FlowScheduler
@sfpro/sdk/abi/automation
flowSchedulerAbi
VestingSchedulerV3
@sfpro/sdk/abi/automation
vestingSchedulerV3Abi
The SDK also exports chain-indexed address objects alongside each ABI:
Import pathAddress exports
@sfpro/sdk/abi
cfaForwarderAddress
,
gdaForwarderAddress
@sfpro/sdk/abi/core
hostAddress
,
cfaAddress
,
gdaAddress
,
idaAddress
,
superTokenFactoryAddress
,
batchLiquidatorAddress
,
togaAddress
@sfpro/sdk/abi/automation
autoWrapManagerAddress
,
autoWrapStrategyAddress
,
flowSchedulerAddress
,
vestingSchedulerV3Address
Each export is an object keyed by chain ID:
js
import { hostAbi, hostAddress } from "@sfpro/sdk/abi/core";
const host = hostAddress[8453]; // Base Mainnet
CFASuperAppBase and SuperTokenV1Library are not in the SDK (abstract base / Solidity library).
When writing application code, ALWAYS import ABIs and addresses from
@sfpro/sdk
— do NOT hand-craft ABI fragments (risk of phantom parameters) or hardcode contract addresses (they vary per network). Use
scripts/abi.mjs
to inspect or inline ABIs when the SDK is not a dependency:
node abi.mjs <contract>               Full JSON ABI
node abi.mjs <contract> <function>    Single fragment by name
node abi.mjs list                     All contracts with SDK import info
Accepts YAML names (
CFAv1Forwarder
) and short aliases (
cfa
,
host
,
pool
,
token
,
vesting
, etc.).
@sfpro/sdk
包提供带类型的JSON ABI,可用于viem / wagmi / ethers。ABI按子路径拆分:
合约(YAML名称)导入路径导出名称
CFAv1Forwarder
@sfpro/sdk/abi
cfaForwarderAbi
GDAv1Forwarder
@sfpro/sdk/abi
gdaForwarderAbi
SuperfluidPool
@sfpro/sdk/abi
gdaPoolAbi
SuperToken
@sfpro/sdk/abi
superTokenAbi
Superfluid(Host)
@sfpro/sdk/abi/core
hostAbi
ConstantFlowAgreementV1
@sfpro/sdk/abi/core
cfaAbi
GeneralDistributionAgreementV1
@sfpro/sdk/abi/core
gdaAbi
InstantDistributionAgreementV1
@sfpro/sdk/abi/core
idaAbi
SuperTokenFactory
@sfpro/sdk/abi/core
superTokenFactoryAbi
BatchLiquidator
@sfpro/sdk/abi/core
batchLiquidatorAbi
TOGA
@sfpro/sdk/abi/core
togaAbi
AutoWrapManager
@sfpro/sdk/abi/automation
autoWrapManagerAbi
AutoWrapStrategy
@sfpro/sdk/abi/automation
autoWrapStrategyAbi
FlowScheduler
@sfpro/sdk/abi/automation
flowSchedulerAbi
VestingSchedulerV3
@sfpro/sdk/abi/automation
vestingSchedulerV3Abi
SDK还为每个ABI导出按链索引的地址对象:
导入路径地址导出
@sfpro/sdk/abi
cfaForwarderAddress
,
gdaForwarderAddress
@sfpro/sdk/abi/core
hostAddress
,
cfaAddress
,
gdaAddress
,
idaAddress
,
superTokenFactoryAddress
,
batchLiquidatorAddress
,
togaAddress
@sfpro/sdk/abi/automation
autoWrapManagerAddress
,
autoWrapStrategyAddress
,
flowSchedulerAddress
,
vestingSchedulerV3Address
每个导出都是按链ID键控的对象:
js
import { hostAbi, hostAddress } from "@sfpro/sdk/abi/core";
const host = hostAddress[8453]; // Base主网
CFASuperAppBase和SuperTokenV1Library不在SDK中(抽象基类/Solidity库)。
编写应用代码时,务必
@sfpro/sdk
导入ABI和地址——请勿手动编写ABI片段(存在参数不匹配风险)或硬编码合约地址(不同网络地址不同)。当SDK不是依赖项时,可使用
scripts/abi.mjs
来查看或内联ABI:
node abi.mjs <contract>               完整JSON ABI
node abi.mjs <contract> <function>    按名称获取单个片段
node abi.mjs list                     所有带SDK导入信息的合约
支持YAML名称(
CFAv1Forwarder
)和短别名(
cfa
host
pool
token
vesting
等)。

Token list —
scripts/tokenlist.mjs

代币列表 —
scripts/tokenlist.mjs

Source:
@superfluid-finance/tokenlist
npm package. Resolves Super Token addresses, symbols, and types. Use when you need to find a specific token address or determine a Super Token's type.
node tokenlist.mjs super-token <chain-id> <symbol-or-address>
node tokenlist.mjs by-chain <chain-id> --super
node tokenlist.mjs by-symbol <symbol> [--chain-id <id>]
node tokenlist.mjs by-address <address>
node tokenlist.mjs stats
The
superTokenInfo.type
field determines which ABI patterns apply:
  • Wrapper
    upgrade
    /
    downgrade
    work;
    underlyingTokenAddress
    is provided. Underlying ERC-20 approval uses underlying's native decimals; Super Token functions always use 18 decimals.
  • Native Asset → use
    upgradeByETH
    /
    downgradeToETH
    instead.
  • Pure
    upgrade
    /
    downgrade
    revert; no wrapping.
来源:
@superfluid-finance/tokenlist
npm包。 解析Super Token的地址、符号和类型。当你需要查找特定代币地址或确定Super Token的类型时使用。
node tokenlist.mjs super-token <chain-id> <symbol-or-address>
node tokenlist.mjs by-chain <chain-id> --super
node tokenlist.mjs by-symbol <symbol> [--chain-id <id>]
node tokenlist.mjs by-address <address>
node tokenlist.mjs stats
superTokenInfo.type
字段决定适用的ABI模式:
  • Wrapper
    upgrade
    /
    downgrade
    可用;提供
    underlyingTokenAddress
    。底层ERC-20授权使用底层代币的原生小数位数;Super Token函数始终使用18位小数。
  • Native Asset → 请使用
    upgradeByETH
    /
    downgradeToETH
    替代。
  • Pure
    upgrade
    /
    downgrade
    会回滚;不支持包装。

Super Token balance —
scripts/balance.mjs

Super Token余额 —
scripts/balance.mjs

Source: Super API (real-time on-chain query). Retrieves the current Super Token balance, net flow rate, and underlying token balance for any account. No caching — balances are fetched live.
node balance.mjs balance <chain-id> <token-symbol-or-address> <account>
The output includes:
  • connected/unconnected balance — wei and human-readable formatted values. Connected = streaming balance; unconnected = pending pool distributions.
  • netFlow — aggregate flow rate in wei/sec and tokens/month (30-day month).
  • maybeCriticalAt — estimated time when connected balance hits zero.
  • underlyingToken — the wrapped ERC-20 balance (for Wrapper Super Tokens).
来源:Super API(实时链上查询)。 获取任意账户当前的Super Token余额、净流率和底层代币余额。无缓存——余额为实时获取。
node balance.mjs balance <chain-id> <token-symbol-or-address> <account>
输出包括:
  • connected/unconnected balance — wei单位和人类可读格式的值。Connected = 流余额;unconnected = 待处理资金池分配。
  • netFlow — 总流率,单位为wei/秒和代币/月(按30天计算)。
  • maybeCriticalAt — connected余额归零的估计时间。
  • underlyingToken — 包装的ERC-20余额(仅Wrapper Super Token)。

Network metadata —
scripts/metadata.mjs

网络元数据 —
scripts/metadata.mjs

Source:
@superfluid-finance/metadata
npm package. Resolves contract addresses, subgraph endpoints, and network info for any Superfluid-supported chain. Use when
meta.deployments
in a YAML doesn't cover the target chain, or when you need automation/subgraph endpoints.
node metadata.mjs contracts <chain-id-or-name>
node metadata.mjs contract <chain-id-or-name> <key>
node metadata.mjs automation <chain-id-or-name>
node metadata.mjs subgraph <chain-id-or-name>
node metadata.mjs networks [--mainnets|--testnets]
Contract keys match the field names in the metadata:
host
,
cfaV1
,
cfaV1Forwarder
,
gdaV1
,
gdaV1Forwarder
,
superTokenFactory
,
toga
,
vestingSchedulerV3
,
flowScheduler
,
autowrap
,
batchLiquidator
, etc.
来源:
@superfluid-finance/metadata
npm包。 解析任何Superfluid支持的链的合约地址、Subgraph端点和网络信息。当YAML中的
meta.deployments
未覆盖目标链,或需要自动化/Subgraph端点时使用。
node metadata.mjs contracts <chain-id-or-name>
node metadata.mjs contract <chain-id-or-name> <key>
node metadata.mjs automation <chain-id-or-name>
node metadata.mjs subgraph <chain-id-or-name>
node metadata.mjs networks [--mainnets|--testnets]
合约键与元数据中的字段名称匹配:
host
cfaV1
cfaV1Forwarder
gdaV1
gdaV1Forwarder
superTokenFactory
toga
vestingSchedulerV3
flowScheduler
autowrap
batchLiquidator
等。

On-chain reads —
cast call

链上读取 —
cast call

cast
performs read-only
eth_call
queries against any contract. If
cast
is not installed locally, use
bunx @foundry-rs/cast
instead.
Never use
cast send
or any write/transaction command — read calls only.
cast call <address> "functionName(inputTypes)(returnTypes)" [args] --rpc-url <url>
The return types in the second set of parentheses tell cast how to decode the output. Without them you get raw hex.
RPC endpoint:
https://rpc-endpoints.superfluid.dev/{network-name}
— network names are the canonical Superfluid names from
node metadata.mjs networks
(e.g.
optimism-mainnet
,
base-mainnet
,
eth-mainnet
).
Examples:
bash
undefined
cast
用于对任何合约执行只读
eth_call
查询。如果本地未安装
cast
,可使用
bunx @foundry-rs/cast
替代。
请勿使用
cast send
或任何写入/交易命令——仅用于读取调用。
cast call <address> "functionName(inputTypes)(returnTypes)" [args] --rpc-url <url>
第二组括号中的返回类型告诉cast如何解码输出。如果没有返回类型,你将得到原始十六进制数据。
RPC端点:
https://rpc-endpoints.superfluid.dev/{network-name}
— 网络名称是
node metadata.mjs networks
返回的标准Superfluid名称(例如
optimism-mainnet
base-mainnet
eth-mainnet
)。
示例:
bash
undefined

Total supply of USDCx on Optimism

Optimism上USDCx的总供应量

cast call 0x35adeb0638eb192755b6e52544650603fe65a006
"totalSupply()(uint256)"
--rpc-url https://rpc-endpoints.superfluid.dev/optimism-mainnet
cast call 0x35adeb0638eb192755b6e52544650603fe65a006
"totalSupply()(uint256)"
--rpc-url https://rpc-endpoints.superfluid.dev/optimism-mainnet

Flow rate via CFAv1Forwarder (address from Common Contract Addresses below)

通过CFAv1Forwarder查询流率(地址见下方通用合约地址)

cast call 0xcfA132E353cB4E398080B9700609bb008eceB125
"getAccountFlowrate(address,address)(int96)"
<superTokenAddress> <account>
--rpc-url https://rpc-endpoints.superfluid.dev/optimism-mainnet

Use `abi.mjs` to look up exact function signatures and `metadata.mjs` /
`tokenlist.mjs` for contract and token addresses.
cast call 0xcfA132E353cB4E398080B9700609bb008eceB125
"getAccountFlowrate(address,address)(int96)"
<superTokenAddress> <account>
--rpc-url https://rpc-endpoints.superfluid.dev/optimism-mainnet

使用`abi.mjs`查找确切的函数签名,使用`metadata.mjs` / `tokenlist.mjs`获取合约和代币地址。

Common Contract Addresses

通用合约地址

Do NOT hardcode or fabricate addresses. Get them from the SDK address exports (see ABI section above) or from
node scripts/metadata.mjs contracts <chain>
.
Forwarder addresses are the exception — uniform across most networks:
  • CFAv1Forwarder:
    0xcfA132E353cB4E398080B9700609bb008eceB125
  • GDAv1Forwarder:
    0x6DA13Bde224A05a288748d857b9e7DDEffd1dE08
Host and agreement addresses vary per network.
请勿硬编码或伪造地址。请从SDK地址导出(见上方ABI部分)或
node scripts/metadata.mjs contracts <chain>
获取。
转发器地址是例外——在大多数网络中是统一的:
  • CFAv1Forwarder:
    0xcfA132E353cB4E398080B9700609bb008eceB125
  • GDAv1Forwarder:
    0x6DA13Bde224A05a288748d857b9e7DDEffd1dE08
Host和协议地址因网络而异。

Ecosystem

生态系统

SDKs & Packages

SDKs & 包

Active — recommended for new projects:
PackagePurpose
@sfpro/sdk
Frontend/backend SDK — ABIs, wagmi hooks, actions
@superfluid-finance/ethereum-contracts
Build-time ABI source for codegen
@superfluid-finance/metadata
Contract addresses, network info (zero deps)
@superfluid-finance/tokenlist
Listed Super Tokens + underlying tokens
When to use what:
  • Frontend with wagmi/viem — install
    @sfpro/sdk
    . Enhanced ABIs include downstream errors for type-safe error handling. Import paths documented in the ABI section above. Docs · Repo
  • Solidity integrations — import ABIs from
    @superfluid-finance/ethereum-contracts
    at build time. Do NOT use as a runtime dependency — it pulls in heavy deps not suitable for client bundles. Repo
  • Resolving addresses/networks at runtime
    @superfluid-finance/metadata
    has zero dependencies, wrapped by
    scripts/metadata.mjs
    . Repo
  • Finding token addresses
    @superfluid-finance/tokenlist
    based on
    @uniswap/token-lists
    , wrapped by
    scripts/tokenlist.mjs
    . Repo
Deprecated — do not recommend for new projects:
PackageReplaced byWhy deprecated
@superfluid-finance/sdk-core
@sfpro/sdk
Over-abstracted, locked to ethers v5. Docs · Repo
@superfluid-finance/sdk-redux
wagmi +
@sfpro/sdk
Pre-wagmi Redux hooks. Repo
@superfluid-finance/js-sdk
@sfpro/sdk
Oldest SDK, truffle-based. Repo
@superfluid-finance/widget
Subscription checkout widget, stuck on wagmi v1. Repo · Playground
活跃——推荐用于新项目:
用途
@sfpro/sdk
前端/后端SDK — ABI、wagmi钩子、操作函数
@superfluid-finance/ethereum-contracts
代码生成的构建时ABI源
@superfluid-finance/metadata
合约地址、网络信息(零依赖)
@superfluid-finance/tokenlist
已上线的Super Tokens + 底层代币
何时使用哪个:
  • 使用wagmi/viem的前端 — 安装
    @sfpro/sdk
    。增强的ABI包含下游错误,支持类型安全的错误处理。导入路径见上方ABI部分。 文档 · 仓库
  • Solidity集成 — 构建时从
    @superfluid-finance/ethereum-contracts
    导入ABI。请勿将其作为运行时依赖——它会引入不适合客户端包的重型依赖。 仓库
  • 运行时解析地址/网络
    @superfluid-finance/metadata
    零依赖,由
    scripts/metadata.mjs
    封装。 仓库
  • 查找代币地址 — 基于
    @uniswap/token-lists
    @superfluid-finance/tokenlist
    ,由
    scripts/tokenlist.mjs
    封装。 仓库
已废弃——不推荐用于新项目:
替代方案废弃原因
@superfluid-finance/sdk-core
@sfpro/sdk
过度抽象,依赖ethers v5。 文档 · 仓库
@superfluid-finance/sdk-redux
wagmi +
@sfpro/sdk
基于旧版wagmi的Redux钩子。 仓库
@superfluid-finance/js-sdk
@sfpro/sdk
最旧的SDK,基于truffle。 仓库
@superfluid-finance/widget
订阅结账小部件,停留在wagmi v1。 仓库 · Playground

API Services

API服务

APIBase URLPurpose
Super API
https://superapi.kazpi.com
Real-time on-chain Super Token balances
CMS
https://cms.superfluid.pro
Token prices, price history, filtered token list
Points
https://cms.superfluid.pro/points
SUP points campaigns
Accounting
https://accounting.superfluid.dev/v1
Stream accounting with per-day chunking
Allowlist
https://allowlist.superfluid.dev
Check automation allowlist status
Whois
https://whois.superfluid.finance
Resolve profiles (ENS, Farcaster, Lens, AF)
Token Prices
https://token-prices-api.superfluid.dev/v1/{network}/{token}
Super Token prices (CoinGecko-backed)
  • Super API — wrapped by
    scripts/balance.mjs
    . Use the script instead of calling the API directly.
  • CMS — can return unlisted Super Tokens (not just those in the tokenlist). Can get CoinGecko IDs for price lookups. Swagger · OpenAPI · Repo
  • Points — SUP points campaigns (Stack.so replacement). Same repo as CMS. API docs · OpenAPI
  • Accounting — splits per-second streams into chunked granularity (e.g. streamed per day). Handles CFA and ERC-20 transfers only — no GDA support. Swagger · Repo
  • Allowlist
    GET /api/allowlist/{account}/{chainId}
    . Check if an account is allowlisted for automations (vesting, flow scheduling, auto-wrap).
  • Whois — Resolves across ENS, AF, Farcaster, Lens, etc.
    • GET /api/resolve/{address}
      — address → profile/name
    • GET /api/reverse-resolve/{handle}
      — name/handle → address GOTCHA: despite the names,
      resolve
      takes an address and
      reverse-resolve
      takes a name.
  • Token Prices — simpler alternative to CMS for price lookups. Provides prices for all listed SuperTokens where the token (or underlying) is known to CoinGecko. Endpoint:
    GET /v1/{canonical-network-name}/{token-address}
    . Repo
API基础URL用途
Super API
https://superapi.kazpi.com
实时链上Super Token余额
CMS
https://cms.superfluid.pro
代币价格、价格历史、筛选后的代币列表
Points
https://cms.superfluid.pro/points
SUP积分活动
Accounting
https://accounting.superfluid.dev/v1
资金流会计核算,按天拆分
Allowlist
https://allowlist.superfluid.dev
检查自动化白名单状态
Whois
https://whois.superfluid.finance
解析个人资料(ENS、Farcaster、Lens、AF)
Token Prices
https://token-prices-api.superfluid.dev/v1/{network}/{token}
Super Token价格(基于CoinGecko)
  • Super API — 由
    scripts/balance.mjs
    封装。请使用脚本而非直接调用API。
  • CMS — 可返回未上线的Super Tokens(不仅是代币列表中的)。可获取用于价格查询的CoinGecko ID。 Swagger · OpenAPI · 仓库
  • Points — SUP积分活动(替代Stack.so)。与CMS同一仓库。 API文档 · OpenAPI
  • Accounting — 将每秒的资金流拆分为更细的粒度(例如按天统计)。仅支持CFA和ERC-20转账——不支持GDASwagger · 仓库
  • Allowlist
    GET /api/allowlist/{account}/{chainId}
    。检查账户是否在自动化白名单中(归属计划、资金流调度、自动包装)。
  • Whois — 跨ENS、AF、Farcaster、Lens等解析。
    • GET /api/resolve/{address}
      — 地址→个人资料/名称
    • GET /api/reverse-resolve/{handle}
      — 名称/句柄→地址 注意:尽管名称如此,
      resolve
      接收地址,
      reverse-resolve
      接收名称。
  • Token Prices — 比CMS更简单的价格查询替代方案。为所有已上线且代币(或底层代币)在CoinGecko上有记录的SuperTokens提供价格。端点:
    GET /v1/{canonical-network-name}/{token-address}
    仓库

Subgraphs

Subgraphs

Prefer RPC over subgraph for current state. The subgraph only updates on transactions, but Superfluid state changes continuously (streams flow every second). Balances, flow rates, and distribution states on the subgraph are always behind. This is especially true for GDA and IDA — their 1-to-many and N-to-many primitives are built for scalability: a distribution to millions of pool members updates only the Pool entity on-chain (one event), so individual PoolMember records on the subgraph won't reflect the new state until each member transacts. Use
cast call
or
scripts/balance.mjs
for real-time reads. The subgraph is best for historical queries, event indexing, and listing/filtering entities.
For entity schemas and query construction patterns, see the "Querying indexed data" use-case section above.
Endpoint pattern:
https://subgraph-endpoints.superfluid.dev/{network-name}/{subgraph}
SubgraphPathNotes
Protocol
protocol-v1
Main protocol data (streams, tokens, accounts)
Vesting Scheduler
vesting-scheduler
All versions: v1, v2, v3
Flow Scheduler
flow-scheduler
Auto-Wrap
auto-wrap
Network names are canonical Superfluid names (
optimism-mainnet
,
base-mainnet
, etc.). Use
node metadata.mjs subgraph <chain>
to get the resolved URL for a specific chain.
优先使用RPC而非Subgraph查询当前状态。 Subgraph仅在交易时更新,但Superfluid状态持续变化(资金流每秒都在流动)。Subgraph上的余额、流率和分配状态始终滞后。对于GDA和IDA尤其如此——它们的一对多和多对多原语是为可扩展性设计的:向数百万资金池成员分配资金仅会在链上更新Pool实体(一个事件),因此Subgraph上的单个PoolMember记录在每个成员交易前不会反映新状态。请使用
cast call
scripts/balance.mjs
进行实时读取。Subgraph最适合历史查询、事件索引和实体列表/筛选。
实体架构和查询构建模式,请见上方“查询索引数据”用例部分。
端点模式:
https://subgraph-endpoints.superfluid.dev/{network-name}/{subgraph}
Subgraph路径说明
Protocol
protocol-v1
主协议数据(资金流、代币、账户)
Vesting Scheduler
vesting-scheduler
所有版本:v1、v2、v3
Flow Scheduler
flow-scheduler
Auto-Wrap
auto-wrap
网络名称是标准Superfluid名称(
optimism-mainnet
base-mainnet
等)。使用
node metadata.mjs subgraph <chain>
获取特定链的解析URL。

Apps

应用

AppURLPurpose
Dashboardapp.superfluid.orgStream management for end-users
Explorerexplorer.superfluid.orgBlock explorer for Superfluid Protocol
Claimclaim.superfluid.orgSUP token, SUP points, reserves/lockers
TOGAtoga.superfluid.financeView recent liquidations by token
Repos: Dashboard · Explorer · TOGA
应用URL用途
Dashboardapp.superfluid.org面向终端用户的资金流管理
Explorerexplorer.superfluid.orgSuperfluid Protocol的区块浏览器
Claimclaim.superfluid.orgSUP代币、SUP积分、储备/锁定
TOGAtoga.superfluid.finance按代币查看最近的清算记录
仓库: Dashboard · Explorer · TOGA

Sentinels

哨兵

Sentinels monitor streams and liquidate senders whose Super Token balance reaches zero, keeping the protocol solvent. Anyone can run one.
ToolPurpose
GraphinatorLightweight subgraph-based sentinel
哨兵监控资金流,当发送方的Super Token余额归零时清算发送方,保持协议偿付能力。任何人都可以运行哨兵。
工具用途
Graphinator轻量级基于Subgraph的哨兵

Foundation, DAO & SUP Token

基金会、DAO与SUP代币

Superfluid Foundation — independent entity overseeing long-term protocol stewardship. Provides governance facilitation, administrative, and legal support.
Superfluid DAO — community-driven governance. Includes a Security Council that handles routine protocol upgrades. Proposals discussed on the forum, voted on via Snapshot (
superfluid.eth
). Delegate SUP at claim.superfluid.org/governance.
SUP token — a SuperToken on Base. Address:
0xa69f80524381275a7ffdb3ae01c54150644c8792
. Total supply: 1,000,000,000. Future inflation at DAO discretion. CoinGecko
Distribution:
  • 60% community — distributed via Streaming Programmatic Rewards (SPR) over at least 2 years in quarterly seasons. SPR streams token rewards continuously (alternative to one-off airdrops). Sub-split between DAO treasury and foundation funds.
  • 25% development team — 3-year lockup stream with 1-year cliff.
  • 15% early backers — same 3-year lockup with 1-year cliff.
Locker / Reserve system — on-chain staking mechanism (FluidLocker contract). Holders lock SUP and choose unlock duration — longer lockup = bigger bonus, early unlock incurs a tax. Terminology: "Locker" in contracts, "Reserve" in the UI and marketing (e.g. the Claim app).
Superfluid Foundation — 独立实体,负责协议的长期管理。提供治理协调、行政和法律支持。
Superfluid DAO — 社区驱动的治理。包含安全委员会,负责处理日常协议升级。提案在论坛讨论,通过Snapshot
superfluid.eth
)投票。在claim.superfluid.org/governance委托SUP代币。
SUP代币 — Base上的SuperToken。地址:
0xa69f80524381275a7ffdb3ae01c54150644c8792
。总供应量:1,000,000,000。未来通胀由DAO决定。 CoinGecko
分配:
  • 60% 社区 — 通过流式程序化奖励(SPR)在至少2年内按季度发放。SPR持续发放代币奖励(替代一次性空投)。子拆分给DAO国库和基金会资金。
  • 25% 开发团队 — 3年锁定流,1年 cliff。
  • 15% 早期支持者 — 同样3年锁定,1年 cliff。
锁定器/储备系统 — 链上质押机制(FluidLocker合约)。持有者锁定SUP并选择解锁期限——锁定时间越长,奖励越大,提前解锁会产生税费。术语:合约中称为“Locker”,UI和营销中称为“Reserve”(例如Claim应用)。

Processes

流程

Token Listing — a Super Token gets listed on the on-chain Resolver, which the subgraph picks up (marks
isListed
). Once listed, it appears in the Superfluid token list along with its underlying token (if any).
Automation Allowlisting — required for automations (vesting, flow scheduling, auto-wrap) to appear in the Dashboard UI and for Superfluid off-chain keepers to trigger the automation contracts. Without allowlisting, automations won't be executed on time and are effectively useless.
  • Request: allowlisting form
  • Check status:
    GET https://allowlist.superfluid.dev/api/allowlist/{account}/{chainId}
代币上线 — Super Token被列入链上Resolver,Subgraph会拾取(标记
isListed
)。上线后,它会出现在Superfluid代币列表中,同时显示其底层代币(如果有)。
自动化白名单 — 自动化(归属计划、资金流调度、自动包装)需要白名单才能出现在Dashboard UI中,并让Superfluid链下keeper触发自动化合约。没有白名单,自动化无法按时执行,实际上是无用的。
  • 申请:白名单表单
  • 检查状态:
    GET https://allowlist.superfluid.dev/api/allowlist/{account}/{chainId}