Skip to content

Commit 11ab864

Browse files
Merge branch 'main' into convert-to-serc20
2 parents 6a62ada + 01555aa commit 11ab864

File tree

5 files changed

+155
-19
lines changed

5 files changed

+155
-19
lines changed

pages/stack/interop/explainer.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ flowchart LR
210210

211211
Each blockchain in the Superchain interop cluster shares the same security model to mitigate the weakest-link scenario. As outlined in the [Standard Rollup Charter](/superchain/blockspace-charter), these chains share the same L1 `ProxyAdmin` Owner. Any changes to the Superchain interop cluster must follow the standard Protocol Upgrade vote procedure—the established governance process for Superchain modifications.
212212

213+
The Superchain interop cluster will be rolled out iteratively, but to see a list of eligible chains that could join the cluster visit the [Superchain Index](https://www.superchain.eco/superchain-index) and look at chains that have a `Standard` charter.
214+
213215
{/*
214216
## Superchain interop assets
215217

pages/stack/interop/superchain-erc20.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ The SuperchainERC20 standard is ready for production use with active Mainnet dep
1111
Please note that the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
1212
</Callout>
1313

14+
<Callout>
15+
SuperchainERC20s can be deployed on any chain, but will only be interoperable within the [Superchain interop cluster](/stack/interop/explainer#superchain-interop-cluster).
16+
</Callout>
17+
1418
# SuperchainERC20
1519

1620
The [`SuperchainERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainERC20.sol) contract implements [ERC-7802](https://ethereum-magicians.org/t/erc-7802-crosschain-token-interface/21508) to enable asset interoperability within the Superchain.

pages/stack/interop/tutorials/_meta.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"message-passing": "Interop message passing",
3+
"deploy-superchain-erc20": "Issuing new assets with SuperchainERC20",
34
"transfer-superchainERC20": "Transferring a SuperchainERC20",
4-
"deploy-superchain-erc20": "Issuing new assets with SuperchainERC20",
5-
"convert-erc20": "Convert an ERC20 token into a SuperchainERC20 token",
65
"bridge-crosschain-eth": "Bridging native cross-chain ETH transfers",
76
"relay-messages-cast": "Relaying interop messages using `cast`",
87
"relay-messages-viem": "Relaying interop messages using `viem`",

pages/stack/interop/tutorials/deploy-superchain-erc20.mdx

+147-17
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,173 @@ import { Callout } from 'nextra/components'
88
import { Steps } from 'nextra/components'
99

1010
<Callout>
11-
The SuperchainERC20 standard is ready for production use with active Mainnet deployments.
12-
Please note that the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
11+
The SuperchainERC20 standard is ready for production deployments.
12+
However, the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development.
1313
</Callout>
1414

1515
# Issuing new assets with SuperchainERC20
1616

17-
This guide explains how to issue new assets with the `SuperchainERC20` and bridge them effectively using the `SuperchainERC20Bridge`. If you want more information about the `SuperchainERC20 standard`, see our [`SuperchainERC20` standard explainer](/stack/interop/superchain-erc20)
17+
## Overview
1818

19-
Note that bridging assets through the Superchain using `SuperchainERC20` never affects the total supply of your asset. The supply remains fixed, and bridging only changes the chain on which your asset is located. This keeps the token's total amount the same across all networks, ensuring its value stays stable during the move and that the `SuperchainERC20` retains a unified, global supply count.
19+
This guide explains how to issue new assets with the [`SuperchainERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainERC20.sol) contract.
20+
Those assets can then be bridged quickly and safely using the [`SuperchainTokenBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol) contract (once interop is operational).
21+
For more information on how it works, [see the explainer](/stack/interop/superchain-erc20).
2022

21-
## Steps to issue and bridge assets
23+
Note that bridging assets through the Superchain using `SuperchainTokenBridge` *never* affects the total supply of your asset.
24+
The supply remains fixed, bridging only changes the chain on which the asset is located.
25+
The token's total amount across all network always remains the same, ensuring value stability.
26+
27+
To ensure fungibility across chains, `SuperchainERC20` assets *must* have the same contract address on all chains.
28+
This requirement abstracts away the complexity of cross-chain validation.
29+
Achieving this requires deterministic deployment methods. There are multiple ways to do this.
30+
Here we will use the [SuperchainERC20 Starter Kit](/app-developers/starter-kit).
31+
32+
### What you'll do
33+
34+
* Use the [SuperchainERC20 Starter Kit](/app-developers/starter-kit) to deploy an `SuperchainERC20` token on the devnet.
35+
36+
### What you'll learn
37+
38+
* How to deploy `SuperchainERC20` tokens on different chains at the same address.
39+
40+
## Prerequisites
41+
42+
Before starting this tutorial, ensure your development environment meets the following requirements:
43+
44+
### Technical knowledge
45+
46+
* Understanding of smart contract development
47+
* Familiarity with blockchain concepts
48+
49+
### Development environment
50+
51+
* Unix-like operating system (Linux, macOS, or WSL for Windows)
52+
* Git for version control
53+
54+
### Required tools
55+
56+
The tutorial uses these primary tools:
57+
58+
* Foundry: For sending transactions to blockchains.
59+
60+
## Step by step explanation
2261

2362
<Steps>
24-
### Deploy the `SuperchainERC20` Token Contract
63+
### Install the prerequisites and the SuperchainERC20 Starter Kit
64+
65+
Follow the setup steps in the [SuperchainERC20 Starter Kit](/app-developers/starter-kit#setup).
66+
67+
### Prepare for deployment
68+
69+
The Starter Kit already deploys a `SuperchainERC20` token to [Supersim](../tools/supersim).
70+
Here we will deploy it to the [Interop devnet](../tools/devnet).
71+
72+
1. Edit `packages/contracts/foundry.toml` to add the RPC endpoints for the devnet (add the bottom two rows).
2573

26-
To ensure fungibility across chains, the SuperchainERC20 assets need to have the same contract address on all chains. Achieving this requires deterministic deployment methods, such as:
74+
```toml
75+
[rpc_endpoints]
76+
op_chain_a = "http://127.0.0.1:9545"
77+
op_chain_b = "http://127.0.0.1:9546"
78+
devnet0 = "https://interop-alpha-0.optimism.io"
79+
devnet1 = "https://interop-alpha-1.optimism.io"
80+
```
2781

28-
* `Create2Deployer`: A smart contract that enables deploying contracts with predictable addresses.
29-
* `OptimismSuperchainERC20Factory`: A factory contract designed for L1-native tokens to ensure uniform deployments across chains.
82+
You can import most RPC endpoints with this command, but it does not include the Interop devnet.
3083

31-
There are [many ways to do this](https://github.com/Arachnid/deterministic-deployment-proxy), but [here's an example smart contract to start](https://github.com/ethereum-optimism/superchainerc20-starter/blob/main/packages/contracts/src/L2NativeSuperchainERC20.sol). For an in-depth guide on how to deploy a `SuperchainERC20` use the [SuperchainERC20 Starter Kit](/app-developers/starter-kit).
84+
```sh
85+
pnpm contracts:update:rpcs
86+
```
3287

33-
By deploying assets at identical addresses across multiple chains, we abstract away the complexity of cross-chain validation.
88+
2. Edit `packages/contracts/configs/deploy-config.toml` for the deployment settings.
3489

35-
### Implement the IERC7802 interface
90+
* Set these parameters in the `[deploy-config]` section:
3691

37-
Implementations of `SuperchainERC20` will be required to implement the [IERC7802](https://specs.optimism.io/interop/token-bridging.html#ierc7802) interface, that includes two external functions and two events.
92+
| Parameter | Meaning | Example |
93+
| --------- | --------------------------------------------- | ---------------------- |
94+
| salt | A unique identifier | Carthage |
95+
| chains | The chains to deploy the contract<sup>1</sup> | \["devnet0","devnet1"] |
3896

39-
The interface defines two functions for bridging:
97+
(1) These names must correspond to the chain names in the `[rpc-endpoints]` section of `foundry.toml` you updated in the previous step.
4098

41-
* `sendERC20`: Initializes a cross-chain transfer of a `SuperchainERC20` by burning the tokens locally and sending a message to the `SuperchainERC20Bridge` on the target chain using the `L2toL2CrossDomainMessenger`. This ensures that asset supply remains constant, as sending an asset moves it from one chain to another without creating additional supply.
42-
* `relayERC20`: Processes incoming messages from the L2toL2CrossDomainMessenger and mints the corresponding amount of the SuperchainERC20.
99+
* Set these parameters in the `[token]` section:
43100

44-
[Here's an example implementation of the `SuperchainERC20Bridge`](https://specs.optimism.io/interop/token-bridging.html#implementation)
101+
| Parameter | Meaning | Example | |
102+
| -------------- | ------------------------ | ------------------------ | ------------------------------------------ |
103+
| owner\_address | Owner of the token | Your address<sup>1</sup> | |
104+
| name | Token name | Quick Transfer Token | |
105+
| symbol | Token symbol | QTT | |
106+
| decimals | Number of decimal places | 18 | |
107+
108+
(1) This should be an address you control (for which you know the private key), which has some ETH on the devnets.
109+
[See here](/stack/interop/tools/devnet#sending-eth-to-the-interop-devnets) to add ETH to the devnets.
110+
111+
Here is a sample `packages/contracts/configs/deploy-config.toml` file you can use, as long as you update `owner_address`.
112+
113+
```toml
114+
[deploy_config]
115+
salt = "is the source of our word salary"
116+
chains = ["devnet0","devnet1"]
117+
118+
[token]
119+
owner_address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
120+
name = "Quick Transfer Token"
121+
symbol = "QTT"
122+
decimals = 18
123+
```
124+
125+
3. Set the private key.
126+
Edit `packages/contracts/.env` to set `DEPLOYER_PRIVATE_KEY` to the private key of an account that has ETH on both devnet blockchains.
127+
128+
```sh
129+
DEPLOYER_PRIVATE_KEY= <<<private key goes here>>>
130+
```
131+
132+
### Deploy the contracts
133+
134+
Run the deployment script.
135+
136+
```sh
137+
pnpm contracts:deploy:token
138+
```
139+
140+
<details>
141+
<summary>Sanity check</summary>
142+
143+
1. Set `TOKEN_ADDRESS` to the address where the token is deployed.
144+
145+
```sh
146+
TOKEN_ADDRESS=0x322f4aF25D370BE2A2C74eEFf0DD0d2AF2e7eD75
147+
```
148+
149+
2. Set `PRIVATE_KEY` to the private key for the owner address.
150+
151+
```sh
152+
PRIVATE_KEY= <<<private key goes here>>>
153+
```
154+
155+
3. Mint tokens for an address you control on both chains.
156+
The owner address is the easiest to use.
157+
158+
```sh
159+
OWNER_ADDRESS=`cast wallet address --private-key $PRIVATE_KEY`
160+
RPC_DEV0=https://interop-alpha-0.optimism.io
161+
RPC_DEV1=https://interop-alpha-1.optimism.io
162+
cast send --private-key $PRIVATE_KEY $TOKEN_ADDRESS "mintTo(address,uint256)" $OWNER_ADDRESS 1000 --rpc-url $RPC_DEV0
163+
cast send --private-key $PRIVATE_KEY $TOKEN_ADDRESS "mintTo(address,uint256)" $OWNER_ADDRESS 2000 --rpc-url $RPC_DEV1
164+
```
165+
166+
4. Check the balance of the owner address on both blockchains.
167+
168+
```sh
169+
cast call $TOKEN_ADDRESS "balanceOf(address)" $OWNER_ADDRESS --rpc-url $RPC_DEV0 | cast to-dec
170+
cast call $TOKEN_ADDRESS "balanceOf(address)" $OWNER_ADDRESS --rpc-url $RPC_DEV1 | cast to-dec
171+
```
172+
</details>
45173
</Steps>
46174

47175
## Next steps
176+
177+
* Learn how to [transfer tokens between chains inside the Superchain](transfer-superchainERC20).
48178
* Use the [SuperchainERC20 Starter Kit](/app-developers/starter-kit) to deploy your token across the Superchain.
49179
* Explore the [SuperchainERC20 specifications](https://specs.optimism.io/interop/token-bridging.html) for in-depth implementation details.
50180
* Review the [Superchain Interop Explainer](/stack/interop/explainer) for answers to common questions about interoperability.

words.txt

+1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ seqnr
360360
SEQUENCERHTTP
361361
sequencerhttp
362362
serv
363+
settions
363364
signup
364365
SLLV
365366
SLTI

0 commit comments

Comments
 (0)