The SuperchainERC20 standard is ready for production deployments. However, the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
Issuing new assets with SuperchainERC20
Overview
This guide explains how to issue new assets with the SuperchainERC20
(opens in a new tab) contract.
Those assets can then be bridged quickly and safely using the SuperchainTokenBridge
(opens in a new tab) contract (once interop is operational).
For more information on how it works, see the explainer.
Note that bridging assets through the Superchain using SuperchainTokenBridge
never affects the total supply of your asset.
The supply remains fixed, bridging only changes the chain on which the asset is located.
The token's total amount across all network always remains the same, ensuring value stability.
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 multiple ways to do this.
Here we will use the SuperchainERC20 Starter Kit.
What you'll do
- Use the SuperchainERC20 Starter Kit to deploy an
SuperchainERC20
token on the devnet.
What you'll learn
- How to deploy
SuperchainERC20
tokens on different chains at the same address.
Prerequisites
Before starting this tutorial, ensure your development environment meets the following requirements:
Technical knowledge
- Understanding of smart contract development
- Familiarity with blockchain concepts
Development environment
- Unix-like operating system (Linux, macOS, or WSL for Windows)
- Git for version control
Required tools
The tutorial uses these primary tools:
- Foundry: For sending transactions to blockchains.
Step by step explanation
Install the prerequisites and the SuperchainERC20 Starter Kit
Follow the setup steps in the SuperchainERC20 Starter Kit.
Prepare for deployment
The Starter Kit already deploys a SuperchainERC20
token to Supersim.
Here we will deploy it to the Interop devnet.
-
Edit
packages/contracts/foundry.toml
to add the RPC endpoints for the devnet (add the bottom two rows).[rpc_endpoints] op_chain_a = "http://127.0.0.1:9545" op_chain_b = "http://127.0.0.1:9546" devnet0 = "https://interop-alpha-0.optimism.io" devnet1 = "https://interop-alpha-1.optimism.io"
You can import most RPC endpoints with this command, but it does not include the Interop devnet.
pnpm contracts:update:rpcs
-
Edit
packages/contracts/configs/deploy-config.toml
for the deployment settings.-
Set these parameters in the
[deploy-config]
section:Parameter Meaning Example salt A unique identifier Carthage chains The chains to deploy the contract1 ["devnet0","devnet1"] (1) These names must correspond to the chain names in the
[rpc-endpoints]
section offoundry.toml
you updated in the previous step. -
Set these parameters in the
[token]
section: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 (1) This should be an address you control (for which you know the private key), which has some ETH on the devnets. See here to add ETH to the devnets.
Here is a sample
packages/contracts/configs/deploy-config.toml
file you can use, as long as you updateowner_address
.[deploy_config] salt = "is the source of our word salary" chains = ["devnet0","devnet1"] [token] owner_address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" name = "Quick Transfer Token" symbol = "QTT" decimals = 18
-
-
Set the private key. Edit
packages/contracts/.env
to setDEPLOYER_PRIVATE_KEY
to the private key of an account that has ETH on both devnet blockchains.DEPLOYER_PRIVATE_KEY= <<<private key goes here>>>
Deploy the contracts
Run the deployment script.
pnpm contracts:deploy:token
Sanity check
-
Set
TOKEN_ADDRESS
to the address where the token is deployed.TOKEN_ADDRESS=0x322f4aF25D370BE2A2C74eEFf0DD0d2AF2e7eD75
-
Set
PRIVATE_KEY
to the private key for the owner address.PRIVATE_KEY= <<<private key goes here>>>
-
Mint tokens for an address you control on both chains. The owner address is the easiest to use.
OWNER_ADDRESS=`cast wallet address --private-key $PRIVATE_KEY` RPC_DEV0=https://interop-alpha-0.optimism.io RPC_DEV1=https://interop-alpha-1.optimism.io cast send --private-key $PRIVATE_KEY $TOKEN_ADDRESS "mintTo(address,uint256)" $OWNER_ADDRESS 1000 --rpc-url $RPC_DEV0 cast send --private-key $PRIVATE_KEY $TOKEN_ADDRESS "mintTo(address,uint256)" $OWNER_ADDRESS 2000 --rpc-url $RPC_DEV1
-
Check the balance of the owner address on both blockchains.
cast call $TOKEN_ADDRESS "balanceOf(address)" $OWNER_ADDRESS --rpc-url $RPC_DEV0 | cast to-dec cast call $TOKEN_ADDRESS "balanceOf(address)" $OWNER_ADDRESS --rpc-url $RPC_DEV1 | cast to-dec
Next steps
- Learn how to transfer tokens between chains inside the Superchain.
- Use the SuperchainERC20 Starter Kit to deploy your token across the Superchain.
- Explore the SuperchainERC20 specifications (opens in a new tab) for in-depth implementation details.
- Review the Superchain Interop Explainer for answers to common questions about interoperability.