Overview of Super Tokens
Super Tokens extend the ERC20 token standard by integrating additional functionalities like streams and distributions. Super Tokens exist in two primary forms: Wrapper and Pure.
Super Tokens revolutionize balance calculations by combining traditional static balances with dynamic, real-time adjustments based on streams and distributions, leading to a more fluid representation of an account's value.
Characteristics of Super Tokens:
- Static Balance: Reflects the conventional ERC20 balance, representing the basic, unchanging part of an account's value.
- Real-Time Balances: Incorporates fluctuations from streams and distributions, adjusting the balance with each block to reflect ongoing financial activities. When you call the method
balanceOf()on a Super Token, you get a real-time balance.
- Complex Calculation: Unlike conventional tokens,
balanceOf()method in Super Tokens doesn't just retrieve a stored value; it performs complex calculations based on numerous parameters to give the real time balance.
- Ongoing Relationships: These calculations consider the account's continuous relationships with others, making the balance more representative of the current financial state.
- Time-Sensitive: In cases involving streams, the balance is further influenced by time, specifically through the timestamp of the latest block, making it sensitive to the passage of time.
- Dynamic Adjustment: As a result, the balance is a "real-time balance," capable of changing with every new block, independent of direct transactions affecting the account.
Types of Super Tokens
- Wrapper Super Tokens
- Pure Super Tokens
- Native Super Tokens
1. Wrapper Super Tokens
Wrapper Super Tokens are wrapped from existing ERC20 tokens to allow interaction with the Superfluid Protocol. They are the most common currently and can be permissionlessly created for any ERC20 token.
Wrapping & Unwrapping
- Wrapping: Deposit ERC20 tokens into the Wrapper Super Token contract to mint an equivalent amount of Super Tokens.
- Unwrapping: Burn Super Tokens to get back the underlying ERC20 tokens.
When to use Custom Wrappers?
- Unconventional ERC-20: Custom Wrapper Super Tokens are typically used when underlying ERC20 tokens have complex functionalities that standard wrappers can't handle.
- Additional Features: They can also be used to add additional features to the Super Token which don't exist in the Super Token contract.
For detailed deployment steps and further information, visit the Deploy a Super Token Page.
2. Pure Super Tokens
Pure Super Tokens are independent of any underlying asset, inheriting all Superfluid functionalities directly.
Pure Super Tokens can be customized with additional features like pre-minting, access control, and wallet whitelisting. They can be categorized as Governed or Independent, with Governed Pure Super Tokens recommended for alignment with Superfluid Protocol Governance.
For a step-by-step guide on deploying Pure Super Tokens, refer to the Pure Super Token Deployment section.
3. Native Super Tokens
Native Super Tokens are similar to wrappers but are designed for native assets like ETH, MATIC, or AVAX. Depositing these assets into the Native Super Token contract yields a wrapped version of the asset.
Canonical deployments of Native Super Tokens are available for each chain that Superfluid operates on. For detailed deployment steps and further information, visit the Deploy a Super Token Page.
ERC777 in Super Tokens
ERC777 is a token standard that builds on ERC20, introducing send/receive hooks and operator accounts for more complex token interactions.
- Send/Receive Hooks: Custom logic triggered upon sending or receiving ERC777 tokens.
- Operators: Accounts authorized to move tokens on behalf of others, triggering relevant hooks.
Super Token ERC777 Implementation
Super Tokens utilize ERC777 to allow for advanced token interactions.
- Override of
transferFrom: In Super Tokens, this function doesn't trigger hooks, differing from typical ERC777 behavior.
sendfunction is maintained as is, suitable for interactions requiring ERC777 features.
Super Token ERC777 Implementation