Skip to content

About Super Token Factory

Miao ZhiCheng edited this page Jul 24, 2023 · 3 revisions

Super tokens can be created through the super token factory registered in the host contract. By doing so, the super token created delegates its logic contract update process to the governance process.

Note that, super tokens created not through the factory can still use the host contract.

Deploy ERC20 Wrapper Super Token

createERC20Wrapper

Anyone can create an Super Token wrapper of an underlying ERC20 token. By doing so, the logic contract of the created Super Token is managed by the Superfluid governance.

It is worth noting that all wrappers created should have the same functionality.

There are three upgradability choices:

  • NON_UPGRADABLE (enum value 0, deprecated, and will fail)
  • SEMI_UPGRADABLE (enum value 1, semi upgradable, meaning governance will upgrade its logic contract manually)
  • FULL_UPGRADABLE (enum value 2, full-upgradability, meaning it follows the latest logic contract)

For auditors:

Note that the underlyingToken must implement "decimals", "name" and "symbol" public methods (non ERCO20 standard), it is by design, and does not compromise the factory security in any ways (DON'T TRUST, VERIFY!)

createCanonicalERC20Wrapper

The createERC20Wrapper created one practical problem, there is no trusted source that sets which Super Token wrapper is the "cononical". As a result createCanonicalERC20Wrapper was created.

As part of its original hope, createCanonicalERC20Wrapper should only allow the first created Super Token to be "canonical" by the rule; after that createCanonicalERC20Wrapper will revert.

Initially we also attempted to make sure that the canonical wrapper Super Token address to be deterministic using CREATE2. But due to backward-compatibility constraints, Super Tokens that were created before createCanonicalERC20Wrapper cannot satisfy the deterministicity. Hence a simpler registra table is used internally instead.

Additional helper functions:

  • computeCanonicalERC20WrapperAddress
  • getCanonicalERC20Wrapper

initializeCustomSuperToken

To create a custom super token, initializeCustomSuperToken is provided to complete the custom super token initialization and hand over its upgradability control to the Superfluid governance.

For Contributors

Official guide is available here. To make your token visible in Superfluid applications, you should also follow the Token Dashboard Submission guide.

Clone this wiki locally