The 3 major components of the Superfluid framework
Now that you've opened your first token flow, you're hooked to learn more right? I promise I'll keep this brief so we can get back to hacking. There are three primitives of Superfluid:
  1. 1.
  2. 2.
    Super Tokens
  3. 3.
    Super Apps
Each primitive enables new features, however you don't have to use all of them. You can mix and match them depending your needs.

1. Agreements

Agreements set the "rules" of how a Super Token can behave. The Superfluid framework is comprised of a single host contract, with multiple agreement contracts. An agreement contract must be on the approve-list, otherwise the host contract will not execute the agreement code.
Agreements are the building blocks that enable Superfluid to expand and add new features.
In the previous section, you used the Constant Flow Agreement, which enables you to flow tokens from your wallet. There is also the Instant Distribution Agreement, which allows sending tokens to multiple recipients in a single transaction. If you want to read the Solidity code, here are all the agreements:
protocol-monorepo/packages/ethereum-contracts/contracts/agreements at dev Β· superfluid-finance/protocol-monorepo
The Superfluid community is exploring the possibilites of what these two agreements can do. Eventually there will be more agreements, and there's an open invitation to help build and create them.

2. Super Tokens

In addition to agreements, the Superfluid framework also provides features at the token level. Here's a short list of super-powers:
  • ERC777 - tokens which can "react" to certain events using callbacks (erc777.org)
  • Batch capabilities - you can do multiple things in a single transaction
  • Meta-transactions - submit transactions on behalf of another account
Dive into the Solidity here:
protocol-monorepo/SuperToken.sol at dev Β· superfluid-finance/protocol-monorepo

3. Super Apps

Now for the really juicy stuff! A Superfluid App or "Super App" is a contract that can react to agreement calls. For example:
  • If a user starts a token flow to the contract, automatically flow another token back using the CFA.
  • If a user calls buyShares, distribute the ETH to all current shareholders using the IDA.
See more examples and ideas in πŸ› οΈ Examples​
A Super App can "manage" agreements and respond to changes. This is where you can write your own custom logic/behavior. Let's get creative!
Still awake? Now that you know the primitives, let's code our way through each one.
Last modified 10mo ago