SuperchainERC20
The SuperchainERC20 standard is ready for production use with active Mainnet deployments. Please note that the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
Overview
What is SuperchainERC20?
The SuperchainERC20 contract implements ERC-7802 to enable asset interoperability within the Superchain.
Asset interoperability allows tokens to move securely across the Superchain by burning tokens on the source chain and minting an equivalent amount on the destination chain. This approach addresses issues such as liquidity fragmentation and poor user experiences caused by asset wrapping or reliance on liquidity pools.
Instead of wrapping assets, this mechanism effectively "teleports" tokens between chains in the Superchain. It provides users with a secure and capital-efficient method for transacting across chains.
Prerequisites
Deploying a SuperchainERC20 Token
In this section, you will deploy a new SuperchainERC20 token to Soneium Minato.
-
Clone the SuperchainERC20 Starter Kit repository:
git clone https://github.com/ethereum-optimism/superchainerc20-starter.git
cd superchainerc20-starter
-
Install project dependencies using pnpm:
pnpm i
-
Initialize .env files:
pnpm init:env
-
Setup deployment config (RPC URLs and token info):
This script automatically fetches the public RPC URLs for each chain listed in the Superchain Registry and adds them to the
[rpc_endpoints]configuration section offoundry.toml. The script ensures that only new RPC URLs are appended, preserving any URLs already present infoundry.toml. To execute the script, run:pnpm contracts:update:rpcsNow, open the file
packages/contracts/configs/deploy-config.tomland addsepolia/soneium-minatoto thechainsarray within the[deploy_config]section, as shown below:packages/contracts/configs/deploy-config.toml[deploy_config]
salt = "ethers phoenix"
chains = ["sepolia/soneium-minato"]
[token]
owner_address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
name = "TestSuperchainERC20"
symbol = "TSU"
decimals = 18noteIf you want to deploy to Soneium mainnet, use
mainnet/soneiuminstead.In the
[token]section modify the data according to your needs.- owner_address: The address designated as the owner of the token.
- The
L2NativeSuperchainERC20.solcontract included in thesuperchainerc20-starterrepository extends theOwnablecontract. - example:
owner_address = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
- The
- name: The token's name.
- example:
name = TestSuperchainERC20
- example:
- symbol: The token's symbol.
- example:
symbol = TSU
- example:
- decimals: The number of decimal places the token supports.
- example:
decimals = 18
- example:
- owner_address: The address designated as the owner of the token.
-
Set up your deployer private key:
echo 'DEPLOYER_PRIVATE_KEY=<YOUR PRIVATE KEY>' > packages/contracts/.envwarningNever share your private key. It grants full access to your wallet.
tipRefer to the MetaMask documentation for instructions on exporting your account's private key.
tipTo use a Ledger or Trezor hardware wallet for this process, refer to the Foundry documentation for detailed instructions on private key management.
-
Deploy your token:
Deployments are executed through the
SuperchainERC20Deployer.s.solscript. This script deploys tokens across each specified chain in the deployment configuration usingCreate2, ensuring deterministic contract addresses for each deployment. The script targets theL2NativeSuperchainERC20.solcontract by default. If you need to modify the token being deployed, either update this file directly or point the script to a custom token contract of your choice.To execute a token deployment run:
pnpm contracts:deploy:token
Best Practices for Deploying SuperchainERC20
Use Create2 to deploy SuperchainERC20
Create2 ensures that the address is deterministically determined by the bytecode of the contract and the provided salt. This is crucial because in order for cross-chain transfers of SuperchainERC20s to work with interop, the tokens must be deployed at the same address across all chains.
crosschainMint and crosschainBurn permissions
For best security practices SuperchainERC20Bridge should be the only contract with permission to call crosschainMint and crosschainBurn. These permissions are set up by default when using the SuperchainERC20 contract.
Further Reading
For more information about the SuperchainERC20 implementation, please refer to the following pages: