Skip to content

Super Token Deployment Guide

Didi edited this page May 20, 2022 · 3 revisions

Deploy Super Tokens

From a protocol perspective, there are 2 types of Super Tokens:

  • Generic ERC20 Wrapper Super Tokens
  • Custom Super Tokens

Deployment of a generic ERC20 Wrapper can be done with a single contract call to SuperTokenFactory.createERC20Wrapper().
This deploys a new UUPSProxy contract for the token and sets its implementation address to the canonical SuperToken logic contract.

The deployment process for a Custom Super Token depends on the type of customization.
Two notable implementations currently in use are PureSuperToken and SETH. They contain some logic in the proxy contract itself.
After deploying such a customized proxy contract, it can be wired to the canonical SuperToken logic by calling SuperTokenFactory.initializedCustomSuperToken().

For a more comprehensive explanation, refer to the Super Token docs.

Depending on the token you want to deploy and the tools you prefer, there's several deploy options to choose from:

Standalone Dapp

In ethereum-contracts/utils, you can find a simple Dapp for deploying ER20 Wrapper Super Tokens.
Check out the repository, go to that directory and do as instructed in the README.

Explorer

For most protocol deployments, there's an Explorer which allows to interact with verified contracts through through a connected wallet.
Check the Networks Directory for Explorer links to the contracts. More detailed instructions can be found here.

Provided scripts

In ethereum-contracts/scripts, you can find scripts facilitating the deployment of Super Tokens. Those are especially helpful for deploying Custom Super Tokens.
E.g. in order to deploy a Pure Super Token, you can use the script deploy-unlisted-pure-super-token.js.
First, set up a local instance of the protocol repository (if not yet the case):

git clone https://github.com/superfluid-finance/protocol-monorepo/
yarn install && yarn build
cd packages/ethereum-contracts
cp .env.template .env
​
# edit .env file and set a mnemonic and rpc endpoint for the network you want to deploy to

Then you can run the deploy script like this:

RELEASE_VERSION=v1 npx truffle --network kovan exec scripts/deploy-unlisted-pure-super-token.js : "My Super Token" "MST" 1000

Note that some of the deploy scripts will also try to list the newly deployed token in a Resolver contract.
This will fail if msg.sender doesn't have permission to write to that Resolver contract.

Console or custom script

You can directly interact with the protocol contracts from a web3 console (e.g. truffle or hardhat), using the aforementioned Super Token Factory.
For a more complex process (usually Custom Super Token) and/or repeatability, you may also write a custom script. See ethereum-contracts/scripts for a reference.

What next?

Once a Super Token is deployed, it can immediately be used on the protocol level.
In order to also interact with it through the Superfluid Dashboard, it needs to be listed, see Super Token Listing Guide.

Clone this wiki locally