The SuperchainERC20 standard is ready for production deployments.
Please note that the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
Overview
This guide explains how to upgrade an ERC20 to aSuperchainERC20
that can then teleport across the Superchain interop cluster quickly and safely using the SuperchainTokenBridge
contract. For more information on how it works, see the explainer.
To ensure fungibility across chains, SuperchainERC20
assets must have the same contract address on all chains. This requirement abstracts away the complexity of cross-chain validation. Achieving this requires deterministic deployment methods. There are many ways to do this.
Here we will use the SuperchainERC20 Starter Kit.
What you’ll do
- Use the SuperchainERC20 starter kit to deploy tokens with your custom code.
Step by step
1
General setup
Follow the setup steps in the SuperchainERC20 starter kit, steps 1-4.
- Install Foundry.
-
Run these commands:
-
Edit
packages/contracts/configs/deploy-config.toml
’s[token]
section.
(1) This should be an address you control (for which you know the private key), which has some ETH on the blockchains in question. In the case of Supersim, the default has 10k ETH and you can use it. For the devnets, see here to send ETH.Parameter Meaning Example owner_address Owner of the token Your address1 name Token name Quick Transfer Token symbol Token symbol QTT decimals Number of decimal places 18 -
If you change
owner_address
, you need to also set the private key. Editpackages/contracts/.env
to setDEPLOYER_PRIVATE_KEY
to the private key of an account that has ETH on both devnet blockchains.
2
Blockchain-specific setup
3
Create the custom contract
The easiest way to do this is to copy and modify the
L2NativeSuperchainERC20.sol
contract.
Use this code, for example, as packages/contracts/src/CustomSuperchainToken.sol
.4
Deploy the new token
-
Edit
packages/contracts/scripts/SuperchainERC20Deployer.s.sol
:-
Change line 6 to import the new token.
-
Update lines 52-54 to get the
CustomSuperchainToken
initialization code. -
Modify line 62 to deploy a
CustomSuperchainToken
contract.
-
Change line 6 to import the new token.
- Deploy the token contract.
5
Verify the installation
-
Set
TOKEN_ADDRESS
to the address where the token is deployed. You can also play with a previously created token, which is at address0xF3Ce0794cB4Ef75A902e07e5D2b75E4D71495ee8
on the devnets. -
Source the
.env
file to get the private key and the address to which it corresponds. -
Set variables for the RPC URLs.
-
Get your current balance (it should be zero).
-
Call the faucet to get a token and check the balance again.
-
Repeat the same steps on Chain B.
Next steps
- Use the SuperchainERC20 Starter Kit to deploy your token across the Superchain.
- If you’d like a guided walkthrough, check out our tutorial video instead.
- Review the Superchain Interop Explainer for answers to common questions about interoperability.