You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/stack/interop/deploy-superchain-erc20.mdx
+5-47
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ import { Steps } from 'nextra/components'
13
13
Interop is currently in active development and not yet ready for production use. The information provided here may change. Check back regularly for the most up-to-date information.
14
14
</Callout>
15
15
16
-
This guide explains how to issue new assets with the `SuperchainERC20`standard 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)
16
+
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
17
18
18
An important thing to note is using `crosschainBurn` and `crosschainMint` on the `SuperchainERC20` to move your asset across the Superchain only affects which chain your asset is located on and does not change the overall supply of the token. 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
19
@@ -28,63 +28,21 @@ To ensure fungibility across chains, the SuperchainERC20 assets need to have the
28
28
*`Create2Deployer`: A smart contract that enables deploying contracts with predictable addresses.
29
29
*`OptimismSuperchainERC20Factory`: A factory contract designed for L1-native tokens to ensure uniform deployments across chains.
30
30
31
-
There are [many ways to do this](https://github.com/Arachnid/deterministic-deployment-proxy), but here's an example smart contract to start:
32
-
33
-
```solidity
34
-
// Example token deployment using Create2Deployer
35
-
bytes32 salt = keccak256(abi.encodePacked("SuperchainToken"));
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)
38
32
39
33
By deploying assets at identical addresses across multiple chains, we abstract away the complexity of cross-chain validation.
40
34
41
-
### Implement the ICrosschainERC20 interface
42
-
43
-
Ensure that your token contract conforms to the `ICrosschainERC20` interface to support cross-chain minting and burning.
44
-
45
-
```solidity
46
-
interface ICrosschainERC20 {
47
-
function crosschainMint(address _account, uint256 _amount) external; /// Mints _amount of token to address _account.
48
-
function crosschainBurn(address _account, uint256 _amount) external; /// Burns _amount of token from address _account.
49
-
50
-
event CrosschainMint(address indexed _to, uint256 _amount); /// MUST trigger when crosschainMint is called
51
-
event CrosschainBurn(address indexed _from, uint256 _amount); /// MUST trigger when crosschainBurn is called
52
-
}
53
-
```
54
-
55
-
### Use the `SuperchainERC20Bridge` for cross-chain transfers
35
+
### Implement the IERC7802 interface
56
36
57
-
The `SuperchainERC20Bridge` relies on the `L2ToL2CrossDomainMessenger`to securely relay messages between chains and provide replay protection, domain binding and access to additional message information.
37
+
Implementations of `SuperchainERC2` 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.
58
38
59
39
We'll use two function for bridging:
60
40
61
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 never changes; sending an asset moves it from one chain to another, it does not "create" an additional asset in regards to supply.
62
42
*`relayERC20`: process incoming messages from the L2toL2CrossDomainMessenger and mints the corresponding amount of the SuperchainERC20.
63
43
64
-
Here's an example implementation of the `SuperchainERC20Bridge`
0 commit comments