superfluid
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSuperfluid Protocol Skill
Superfluid Protocol 技能指南
Complete interface documentation for Superfluid Protocol smart contracts via
Rich ABI YAML references. Read for the full
protocol architecture. This file maps use-cases to the right references and
explains how to read them.
references/architecture.md通过Rich ABI YAML参考文档,为Superfluid Protocol智能合约提供完整的接口说明。如需了解完整的协议架构,请阅读。本文档将不同用例映射到对应的参考资料,并说明如何阅读这些资料。
references/architecture.mdArchitecture Summary
架构概述
Host () — central router. Agreement calls go through
or . Manages the app registry,
governance, and SuperTokenFactory.
Superfluid.solHost.callAgreement()Host.batchCall()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 with raw agreement calls for atomicity.
Host.batchCallMacroForwarder — extensible batch executor. Developers deploy custom
macro contracts () and call
to execute complex multi-step operations atomically. See
.
IUserDefinedMacroMacroForwarder.runMacro()references/guides/macro-forwarders.mdAutomation (Vesting Scheduler, FlowScheduler, Auto-Wrap) — schedule
on-chain intent, require off-chain keepers to trigger execution.
Host()——核心路由组件。协议调用需通过或发起。负责管理应用注册表、治理机制以及SuperTokenFactory。
Superfluid.solHost.callAgreement()Host.batchCall()协议(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.batchCallMacroForwarder——可扩展的批量执行器。开发者部署自定义宏合约(),并调用来原子性执行复杂的多步骤操作。详情请见。
IUserDefinedMacroMacroForwarder.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)
| Intent | Read |
|---|---|
| Create/update/delete a stream (simple) | |
| ACL, operator permissions, flow metadata | also |
| Batch streams with other ops atomically | also |
| 意图 | 参考文档 |
|---|---|
| 创建/更新/删除简单资金流 | |
| ACL、操作员权限、资金流元数据 | 额外参考 |
| 与其他操作原子性批量执行资金流 | 额外参考 |
Distributing to many recipients (GDA)
多接收方资金分配(GDA)
| Intent | Read |
|---|---|
| Create pools, distribute, stream to pool | |
| Pool member management, units, claims | also |
| Low-level agreement details | also |
| 意图 | 参考文档 |
|---|---|
| 创建资金池、分配资金、向资金池发送流 | |
| 资金池成员管理、份额、申领 | 额外参考 |
| 底层协议细节 | 额外参考 |
Token operations
代币操作
| Intent | Read |
|---|---|
| Wrap/unwrap, balances, ERC-20/777, permit | |
| Deploy a new Super Token | |
| 意图 | 参考文档 |
|---|---|
| 包装/解包、余额、ERC-20/777、授权 | |
| 部署新的Super Token | |
Automation
自动化
| Intent | Read |
|---|---|
| Vesting with cliffs and streams | |
| Schedule future stream start/stop | |
| Auto-wrap when Super Token balance is low | |
| 意图 | 参考文档 |
|---|---|
| 带有 cliff 和流的归属计划 | |
| 调度未来资金流的启动/停止 | |
| 当Super Token余额不足时自动包装 | |
Writing Solidity integrations (SuperTokenV1Library)
编写Solidity集成代码(SuperTokenV1Library)
| Intent | Read |
|---|---|
Token-centric Solidity API ( | |
The library wraps CFA and GDA agreement calls into ergonomic methods like
. Use it for any Solidity contract that
interacts with Superfluid — Super Apps, automation contracts, DeFi
integrations. Includes agreement-abstracted functions (, )
that auto-route to CFA or GDA, plus variants for Super App
callbacks. See the YAML header and glossary for Foundry testing gotchas.
token.flow(receiver, flowRate)flowXtransferXWithCtx| 意图 | 参考文档 |
|---|---|
以代币为中心的Solidity API( | |
该库将CFA和GDA协议调用封装为易用的方法,例如。任何与Superfluid交互的Solidity合约(Super Apps、自动化合约、DeFi集成)都可使用它。它包含协议抽象函数(、),可自动路由到CFA或GDA,还包含用于Super App回调的变体。请查看YAML头部和术语表,了解Foundry测试中的注意事项。
token.flow(receiver, flowRate)flowXtransferXWithCtxBuilding Super Apps
构建Super Apps
| Intent | Read |
|---|---|
| CFA callback hooks (simplified base) | |
| Token-centric API for callback logic | also |
| App registration, Host context, batch calls | |
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 for the full explanation.
references/architecture.md| 意图 | 参考文档 |
|---|---|
| CFA回调钩子(简化基类) | |
| 用于回调逻辑的代币中心API | 额外参考 |
| 应用注册、Host上下文、批量调用 | |
通过应用信用中继流入资金流的Super Apps会导致发送方的押金大约翻倍(扇出模式下可能更多),因为流出资金流的押金由发送方作为应付押金提供。完整说明请见中的“应用信用与押金机制”章节。
references/architecture.mdMacro forwarders (composable batch operations)
宏转发器(可组合批量操作)
| Intent | Read |
|---|---|
| Write a macro for complex batched operations | |
| MacroForwarder contract address and interface | also |
| Batch operation types and encoding rules | also |
| EIP-712 signed macro patterns | |
| 意图 | 参考文档 |
|---|---|
| 编写用于复杂批量操作的宏 | |
| MacroForwarder合约地址和接口 | 额外参考 |
| 批量操作类型和编码规则 | 额外参考 |
| EIP-712签名宏模式 | |
Sentinels and liquidation
哨兵与清算
| Intent | Read |
|---|---|
| Batch liquidation of critical flows | |
| PIC auction, bond management, exit rates | |
| 意图 | 参考文档 |
|---|---|
| 批量清算关键资金流 | |
| PIC拍卖、债券管理、退出费率 | |
Querying indexed data (Subgraphs)
查询索引数据(Subgraphs)
| Intent | Read |
|---|---|
| Understand how The Graph generates query schemas from entity definitions | |
| Query streams, pools, tokens, accounts, events | also |
| Query vesting schedules and execution history | also |
| Query scheduled flows and automation tasks | also |
| Query auto-wrap schedules and execution history | also |
| 意图 | 参考文档 |
|---|---|
| 了解The Graph如何从实体定义生成查询模式 | |
| 查询资金流、资金池、代币、账户、事件 | 额外参考 |
| 查询归属计划和执行历史 | 额外参考 |
| 查询调度的资金流和自动化任务 | 额外参考 |
| 查询自动包装计划和执行历史 | 额外参考 |
Legacy
遗留内容
| Intent | Read |
|---|---|
| Old IDA (instant distribution, deprecated) | |
| 意图 | 参考文档 |
|---|---|
| 旧版IDA(即时分配,已废弃) | |
Ecosystem & tooling
生态系统与工具
| Intent | Read |
|---|---|
| Which SDK or package for a project | See Ecosystem → SDKs & Packages below |
| Token prices, filtered token list, CoinGecko IDs | See Ecosystem → API Services (CMS) below |
| Stream accounting, per-day chunking | See Ecosystem → API Services (Accounting) below |
| Resolve ENS / Farcaster / Lens handles | See Ecosystem → API Services (Whois) below |
| Query protocol data via GraphQL | See Ecosystem → Subgraphs below |
| SUP token, governance, DAO | See Ecosystem → Foundation, DAO & SUP Token below |
| Token prices for Super Tokens (simple API) | See Ecosystem → API Services (Token Prices) below |
| Run a sentinel / liquidation bot | See Ecosystem → Sentinels below |
| Get a Super Token listed / enable automations | See 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:
| Prefix | Contract |
|---|---|
| ConstantFlowAgreementV1 |
| CFAv1Forwarder |
| GeneralDistributionAgreementV1 |
| SuperfluidPool |
| SuperfluidToken (base of SuperToken) |
| SuperToken |
| SuperTokenFactory |
| Superfluid (Host) |
| InstantDistributionAgreementV1 |
| Superfluid (Host) — Super App callback violation |
Each YAML's section is the complete error index for that contract,
with selector hashes and descriptions. Per-function fields show
which errors a specific function can throw.
errors:errors:错误前缀与合约的映射:
| 前缀 | 合约 |
|---|---|
| ConstantFlowAgreementV1 |
| CFAv1Forwarder |
| GeneralDistributionAgreementV1 |
| SuperfluidPool |
| SuperfluidToken(SuperToken的基类) |
| SuperToken |
| SuperTokenFactory |
| Superfluid(Host) |
| InstantDistributionAgreementV1 |
| 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
根结构
undefinedundefinedHeader 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 sequenceFields appear in this order: description comment, , ,
, , , . All are omitted when not applicable.
mutabilityaccessinputsoutputsemitserrorsyaml
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] # 按检查顺序排列字段顺序为:描述注释、、、、、、。不适用的字段可省略。
mutabilityaccessinputsoutputsemitserrorsKey conventions
关键约定
- parameter = function is called through the Host (
ctx: bytes/callAgreement), never directly.batchCall - labels:
access,anyone,host,self,admin,governance,sender,receiver,operator,manager,pic,agreement,trusted-forwarder,factory. Combine withsuper-app. Conditional:|.anyone(if-critical-or-jailed) - and
emitsordering carries meaning: matches execution flow, not alphabetical. First errors in the list are the most likely causes.errors - prefix flags non-obvious behavior, common mistakes, or edge cases. Pay close attention to these.
# GOTCHA: - is an array of raw GitHub URLs to the Solidity source files (implementation, interface, base — filenames are self-documenting).
meta.source - has per-network addresses split into
meta.deploymentsandmainnetsubgroups.testnet
- 参数 = 函数需通过Host调用(
ctx: bytes/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: - ****是Solidity源代码文件的原始GitHub URL数组(实现、接口、基类——文件名自解释)。
meta.source - ****包含按
meta.deployments和mainnet分组的各网络部署地址。testnet
Events section
事件章节
yaml
events:
FlowUpdated:
indexed: # log topics (filterable)
- token: address
- sender: address
data: # log payload
- flowRate: int96yaml
events:
FlowUpdated:
indexed: # 日志主题(可过滤)
- token: address
- sender: address
data: # 日志负载
- flowRate: int96Errors section
错误章节
yaml
errors:
# -- Category --
- SIMPLE_ERROR # 0xabcd1234 — description
- PARAMETERIZED_ERROR: # errors with diagnostic data
inputs:
- value: uint256yaml
errors:
# -- 分类 --
- SIMPLE_ERROR # 0xabcd1234 — 描述
- PARAMETERIZED_ERROR: # 包含诊断数据的错误
inputs:
- value: uint256Runtime 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
@sfpro/sdkscripts/abi.mjsABI JSON — @sfpro/sdk
包 + scripts/abi.mjs
@sfpro/sdkscripts/abi.mjsThe package provides typed JSON ABIs
for use with viem / wagmi / ethers. ABIs are split across sub-paths:
@sfpro/sdk| Contract (YAML name) | Import path | Export name |
|---|---|---|
| CFAv1Forwarder | | |
| GDAv1Forwarder | | |
| SuperfluidPool | | |
| SuperToken | | |
| Superfluid (Host) | | |
| ConstantFlowAgreementV1 | | |
| GeneralDistributionAgreementV1 | | |
| InstantDistributionAgreementV1 | | |
| SuperTokenFactory | | |
| BatchLiquidator | | |
| TOGA | | |
| AutoWrapManager | | |
| AutoWrapStrategy | | |
| FlowScheduler | | |
| VestingSchedulerV3 | | |
The SDK also exports chain-indexed address objects alongside each ABI:
| Import path | Address exports |
|---|---|
| |
| |
| |
Each export is an object keyed by chain ID:
js
import { hostAbi, hostAddress } from "@sfpro/sdk/abi/core";
const host = hostAddress[8453]; // Base MainnetCFASuperAppBase and SuperTokenV1Library are not in the SDK (abstract base /
Solidity library).
When writing application code, ALWAYS import ABIs and addresses from
— do NOT hand-craft ABI fragments (risk of phantom parameters)
or hardcode contract addresses (they vary per network). Use
to inspect or inline ABIs when the SDK is not a dependency:
@sfpro/sdkscripts/abi.mjsnode abi.mjs <contract> Full JSON ABI
node abi.mjs <contract> <function> Single fragment by name
node abi.mjs list All contracts with SDK import infoAccepts YAML names () and short aliases (, ,
, , , etc.).
CFAv1Forwardercfahostpooltokenvesting@sfpro/sdk| 合约(YAML名称) | 导入路径 | 导出名称 |
|---|---|---|
| CFAv1Forwarder | | |
| GDAv1Forwarder | | |
| SuperfluidPool | | |
| SuperToken | | |
| Superfluid(Host) | | |
| ConstantFlowAgreementV1 | | |
| GeneralDistributionAgreementV1 | | |
| InstantDistributionAgreementV1 | | |
| SuperTokenFactory | | |
| BatchLiquidator | | |
| TOGA | | |
| AutoWrapManager | | |
| AutoWrapStrategy | | |
| FlowScheduler | | |
| VestingSchedulerV3 | | |
SDK还为每个ABI导出按链索引的地址对象:
| 导入路径 | 地址导出 |
|---|---|
| |
| |
| |
每个导出都是按链ID键控的对象:
js
import { hostAbi, hostAddress } from "@sfpro/sdk/abi/core";
const host = hostAddress[8453]; // Base主网CFASuperAppBase和SuperTokenV1Library不在SDK中(抽象基类/Solidity库)。
编写应用代码时,务必从导入ABI和地址——请勿手动编写ABI片段(存在参数不匹配风险)或硬编码合约地址(不同网络地址不同)。当SDK不是依赖项时,可使用来查看或内联ABI:
@sfpro/sdkscripts/abi.mjsnode abi.mjs <contract> 完整JSON ABI
node abi.mjs <contract> <function> 按名称获取单个片段
node abi.mjs list 所有带SDK导入信息的合约支持YAML名称()和短别名(、、、、等)。
CFAv1ForwardercfahostpooltokenvestingToken list — scripts/tokenlist.mjs
scripts/tokenlist.mjs代币列表 — scripts/tokenlist.mjs
scripts/tokenlist.mjsSource: 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.
@superfluid-finance/tokenlistnode 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 statsThe field determines which ABI patterns apply:
superTokenInfo.type- Wrapper → /
upgradework;downgradeis provided. Underlying ERC-20 approval uses underlying's native decimals; Super Token functions always use 18 decimals.underlyingTokenAddress - Native Asset → use /
upgradeByETHinstead.downgradeToETH - Pure → /
upgraderevert; no wrapping.downgrade
来源: npm包。
解析Super Token的地址、符号和类型。当你需要查找特定代币地址或确定Super Token的类型时使用。
@superfluid-finance/tokenlistnode 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 statssuperTokenInfo.type- Wrapper → /
upgrade可用;提供downgrade。底层ERC-20授权使用底层代币的原生小数位数;Super Token函数始终使用18位小数。underlyingTokenAddress - Native Asset → 请使用/
upgradeByETH替代。downgradeToETH - Pure → /
upgrade会回滚;不支持包装。downgrade
Super Token balance — scripts/balance.mjs
scripts/balance.mjsSuper Token余额 — scripts/balance.mjs
scripts/balance.mjsSource: 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网络元数据 — scripts/metadata.mjs
scripts/metadata.mjsSource: npm package.
Resolves contract addresses, subgraph endpoints, and network info for any
Superfluid-supported chain. Use when in a YAML doesn't
cover the target chain, or when you need automation/subgraph endpoints.
@superfluid-finance/metadatameta.deploymentsnode 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: , ,
, , , , ,
, , , , etc.
hostcfaV1cfaV1ForwardergdaV1gdaV1ForwardersuperTokenFactorytogavestingSchedulerV3flowSchedulerautowrapbatchLiquidator来源: npm包。
解析任何Superfluid支持的链的合约地址、Subgraph端点和网络信息。当YAML中的未覆盖目标链,或需要自动化/Subgraph端点时使用。
@superfluid-finance/metadatameta.deploymentsnode 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]合约键与元数据中的字段名称匹配:、、、、、、、、、、等。
hostcfaV1cfaV1ForwardergdaV1gdaV1ForwardersuperTokenFactorytogavestingSchedulerV3flowSchedulerautowrapbatchLiquidatorOn-chain reads — cast call
cast call链上读取 — cast call
cast callcasteth_callcastbunx @foundry-rs/castNever use or any write/transaction command — read calls only.
cast sendcast 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: — network
names are the canonical Superfluid names from
(e.g. , , ).
https://rpc-endpoints.superfluid.dev/{network-name}node metadata.mjs networksoptimism-mainnetbase-mainneteth-mainnetExamples:
bash
undefined请勿使用或任何写入/交易命令——仅用于读取调用。
cast sendcast call <address> "functionName(inputTypes)(returnTypes)" [args] --rpc-url <url>第二组括号中的返回类型告诉cast如何解码输出。如果没有返回类型,你将得到原始十六进制数据。
RPC端点: — 网络名称是返回的标准Superfluid名称(例如、、)。
https://rpc-endpoints.superfluid.dev/{network-name}node metadata.mjs networksoptimism-mainnetbase-mainneteth-mainnet示例:
bash
undefinedTotal supply of USDCx on Optimism
Optimism上USDCx的总供应量
cast call 0x35adeb0638eb192755b6e52544650603fe65a006
"totalSupply()(uint256)"
--rpc-url https://rpc-endpoints.superfluid.dev/optimism-mainnet
"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
"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
"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
"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:
| Package | Purpose |
|---|---|
| Frontend/backend SDK — ABIs, wagmi hooks, actions |
| Build-time ABI source for codegen |
| Contract addresses, network info (zero deps) |
| Listed Super Tokens + underlying tokens |
When to use what:
- Frontend with wagmi/viem — install . Enhanced ABIs include downstream errors for type-safe error handling. Import paths documented in the ABI section above. Docs · Repo
@sfpro/sdk - Solidity integrations — import ABIs from
at build time. Do NOT use as a runtime dependency — it pulls in heavy deps not suitable for client bundles. Repo
@superfluid-finance/ethereum-contracts - Resolving addresses/networks at runtime —
has zero dependencies, wrapped by
@superfluid-finance/metadata. Reposcripts/metadata.mjs - Finding token addresses — based on
@superfluid-finance/tokenlist, wrapped by@uniswap/token-lists. Reposcripts/tokenlist.mjs
Deprecated — do not recommend for new projects:
| Package | Replaced by | Why deprecated |
|---|---|---|
| | Over-abstracted, locked to ethers v5. Docs · Repo |
| wagmi + | Pre-wagmi Redux hooks. Repo |
| | Oldest SDK, truffle-based. Repo |
| — | Subscription checkout widget, stuck on wagmi v1. Repo · Playground |
活跃——推荐用于新项目:
| 包 | 用途 |
|---|---|
| 前端/后端SDK — ABI、wagmi钩子、操作函数 |
| 代码生成的构建时ABI源 |
| 合约地址、网络信息(零依赖) |
| 已上线的Super Tokens + 底层代币 |
何时使用哪个:
- 使用wagmi/viem的前端 — 安装。增强的ABI包含下游错误,支持类型安全的错误处理。导入路径见上方ABI部分。 文档 · 仓库
@sfpro/sdk - Solidity集成 — 构建时从导入ABI。请勿将其作为运行时依赖——它会引入不适合客户端包的重型依赖。 仓库
@superfluid-finance/ethereum-contracts - 运行时解析地址/网络 —
零依赖,由
@superfluid-finance/metadata封装。 仓库scripts/metadata.mjs - 查找代币地址 — 基于的
@uniswap/token-lists,由@superfluid-finance/tokenlist封装。 仓库scripts/tokenlist.mjs
已废弃——不推荐用于新项目:
| 包 | 替代方案 | 废弃原因 |
|---|---|---|
| | 过度抽象,依赖ethers v5。 文档 · 仓库 |
| wagmi + | 基于旧版wagmi的Redux钩子。 仓库 |
| | 最旧的SDK,基于truffle。 仓库 |
| — | 订阅结账小部件,停留在wagmi v1。 仓库 · Playground |
API Services
API服务
| API | Base URL | Purpose |
|---|---|---|
| Super API | | Real-time on-chain Super Token balances |
| CMS | | Token prices, price history, filtered token list |
| Points | | SUP points campaigns |
| Accounting | | Stream accounting with per-day chunking |
| Allowlist | | Check automation allowlist status |
| Whois | | Resolve profiles (ENS, Farcaster, Lens, AF) |
| Token Prices | | Super Token prices (CoinGecko-backed) |
- Super API — wrapped by . Use the script instead of calling the API directly.
scripts/balance.mjs - 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 — . Check if an account is allowlisted for automations (vesting, flow scheduling, auto-wrap).
GET /api/allowlist/{account}/{chainId} - Whois — Resolves across ENS, AF, Farcaster, Lens, etc.
- — address → profile/name
GET /api/resolve/{address} - — name/handle → address GOTCHA: despite the names,
GET /api/reverse-resolve/{handle}takes an address andresolvetakes a name.reverse-resolve
- 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: . Repo
GET /v1/{canonical-network-name}/{token-address}
| API | 基础URL | 用途 |
|---|---|---|
| Super API | | 实时链上Super Token余额 |
| CMS | | 代币价格、价格历史、筛选后的代币列表 |
| Points | | SUP积分活动 |
| Accounting | | 资金流会计核算,按天拆分 |
| Allowlist | | 检查自动化白名单状态 |
| Whois | | 解析个人资料(ENS、Farcaster、Lens、AF) |
| Token Prices | | Super Token价格(基于CoinGecko) |
- Super API — 由封装。请使用脚本而非直接调用API。
scripts/balance.mjs - CMS — 可返回未上线的Super Tokens(不仅是代币列表中的)。可获取用于价格查询的CoinGecko ID。 Swagger · OpenAPI · 仓库
- Points — SUP积分活动(替代Stack.so)。与CMS同一仓库。 API文档 · OpenAPI
- Accounting — 将每秒的资金流拆分为更细的粒度(例如按天统计)。仅支持CFA和ERC-20转账——不支持GDA。 Swagger · 仓库
- 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 or for real-time
reads. The subgraph is best for historical queries, event indexing, and
listing/filtering entities.
cast callscripts/balance.mjsFor 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}| Subgraph | Path | Notes |
|---|---|---|
| Protocol | | Main protocol data (streams, tokens, accounts) |
| Vesting Scheduler | | All versions: v1, v2, v3 |
| Flow Scheduler | | |
| Auto-Wrap | |
Network names are canonical Superfluid names (,
, etc.). Use to get the
resolved URL for a specific chain.
optimism-mainnetbase-mainnetnode metadata.mjs subgraph <chain>优先使用RPC而非Subgraph查询当前状态。 Subgraph仅在交易时更新,但Superfluid状态持续变化(资金流每秒都在流动)。Subgraph上的余额、流率和分配状态始终滞后。对于GDA和IDA尤其如此——它们的一对多和多对多原语是为可扩展性设计的:向数百万资金池成员分配资金仅会在链上更新Pool实体(一个事件),因此Subgraph上的单个PoolMember记录在每个成员交易前不会反映新状态。请使用或进行实时读取。Subgraph最适合历史查询、事件索引和实体列表/筛选。
cast callscripts/balance.mjs实体架构和查询构建模式,请见上方“查询索引数据”用例部分。
端点模式:
https://subgraph-endpoints.superfluid.dev/{network-name}/{subgraph}| Subgraph | 路径 | 说明 |
|---|---|---|
| Protocol | | 主协议数据(资金流、代币、账户) |
| Vesting Scheduler | | 所有版本:v1、v2、v3 |
| Flow Scheduler | | |
| Auto-Wrap | |
网络名称是标准Superfluid名称(、等)。使用获取特定链的解析URL。
optimism-mainnetbase-mainnetnode metadata.mjs subgraph <chain>Apps
应用
| App | URL | Purpose |
|---|---|---|
| Dashboard | app.superfluid.org | Stream management for end-users |
| Explorer | explorer.superfluid.org | Block explorer for Superfluid Protocol |
| Claim | claim.superfluid.org | SUP token, SUP points, reserves/lockers |
| TOGA | toga.superfluid.finance | View recent liquidations by token |
| 应用 | URL | 用途 |
|---|---|---|
| Dashboard | app.superfluid.org | 面向终端用户的资金流管理 |
| Explorer | explorer.superfluid.org | Superfluid Protocol的区块浏览器 |
| Claim | claim.superfluid.org | SUP代币、SUP积分、储备/锁定 |
| TOGA | toga.superfluid.finance | 按代币查看最近的清算记录 |
Sentinels
哨兵
Sentinels monitor streams and liquidate senders whose Super Token balance
reaches zero, keeping the protocol solvent. Anyone can run one.
| Tool | Purpose |
|---|---|
| Graphinator | Lightweight 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 ().
Delegate SUP at
claim.superfluid.org/governance.
superfluid.ethSUP token — a SuperToken on Base. Address:
. Total supply: 1,000,000,000.
Future inflation at DAO discretion.
CoinGecko
0xa69f80524381275a7ffdb3ae01c54150644c8792Distribution:
- 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()投票。在claim.superfluid.org/governance委托SUP代币。
superfluid.ethSUP代币 — Base上的SuperToken。地址:
。总供应量:1,000,000,000。未来通胀由DAO决定。
CoinGecko
0xa69f80524381275a7ffdb3ae01c54150644c8792分配:
- 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 ). Once listed, it appears in the
Superfluid token list along with its underlying token (if any).
isListed- Request: listing form → opens issue in superfluid-org/assets
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会拾取(标记)。上线后,它会出现在Superfluid代币列表中,同时显示其底层代币(如果有)。
isListed- 申请:上线表单 → 在superfluid-org/assets中创建议题
自动化白名单 — 自动化(归属计划、资金流调度、自动包装)需要白名单才能出现在Dashboard UI中,并让Superfluid链下keeper触发自动化合约。没有白名单,自动化无法按时执行,实际上是无用的。
- 申请:白名单表单
- 检查状态:
GET https://allowlist.superfluid.dev/api/allowlist/{account}/{chainId}