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
# Bridging your custom ERC-20 token using the Standard Bridge
23
22
24
-
In this tutorial you'll learn how to bridge a custom ERC-20 token from Ethereum to an OP Stack chain using the Standard Bridge system.
23
+
In this tutorial, you'll learn how to bridge a custom ERC-20 token from Ethereum to an OP Stack chain using the Standard Bridge system.
25
24
This tutorial is meant for developers who already have an existing ERC-20 token on Ethereum and want to create a bridged representation of that token on OP Mainnet.
26
25
27
-
This tutorial explains how you can create a custom token that conforms to the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface so that it can be used with the Standard Bridge system.
26
+
This tutorial explains how you can create a custom token that conforms to the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.12.2/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface so that it can be used with the Standard Bridge system.
28
27
A custom token allows you to do things like trigger extra logic whenever a token is deposited.
29
28
If you don't need extra functionality like this, consider following the tutorial on [Bridging Your Standard ERC-20 Token Using the Standard Bridge](./standard-bridge-standard-token) instead.
30
29
31
30
<Callouttype="error">
32
-
The Standard Bridge **does not** support [**fee on transfer tokens**](https://github.com/d-xo/weird-erc20#fee-on-transfer) or [**rebasing tokens**](https://github.com/d-xo/weird-erc20#balance-modifications-outside-of-transfers-rebasingairdrops) because they can cause bridge accounting errors.
31
+
The Standard Bridge **does not** support [**fee on transfer tokens**](https://github.com/d-xo/weird-erc20#fee-on-transfer) or [**rebasing tokens**](https://github.com/d-xo/weird-erc20#balance-modifications-outside-of-transfers-rebasingairdrops) because they can cause bridge accounting errors.
33
32
</Callout>
34
33
35
34
## About OptimismMintableERC20s
36
35
37
-
The Standard Bridge system requires that L2 representations of L1 tokens implement the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface.
36
+
The Standard Bridge system requires that L2 representations of L1 tokens implement the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.12.2/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface.
38
37
This interface is a superset of the standard ERC-20 interface and includes functions that allow the bridge to properly verify deposits/withdrawals and mint/burn tokens as needed.
39
38
Your L2 token contract must implement this interface in order to be bridged using the Standard Bridge system.
40
39
This tutorial will show you how to create a custom token that implements this interface.
@@ -50,8 +49,8 @@ This tutorial explains how to create a bridged ERC-20 token on OP Sepolia.
50
49
You will need to get some ETH on both of these testnets.
51
50
52
51
<Callouttype="info">
53
-
You can use [this faucet](https://sepoliafaucet.com/) to get ETH on Sepolia.
54
-
You can use the [Superchain Faucet](https://console.optimism.io/faucet?utm_source=docs) to get ETH on OP Sepolia.
52
+
You can use [this faucet](https://sepoliafaucet.com/) to get ETH on Sepolia.
53
+
You can use the [Superchain Faucet](https://console.optimism.io/faucet?utm_source=docs) to get ETH on OP Sepolia.
55
54
</Callout>
56
55
57
56
## Add OP Sepolia to your wallet
@@ -76,50 +75,54 @@ In this section, you'll be creating an ERC-20 token that can be deposited but ca
76
75
This is just one example of the endless ways in which you could customize your L2 token.
77
76
78
77
<Steps>
78
+
{<h3>Open Remix</h3>}
79
79
80
-
{<h3>Open Remix</h3>}
80
+
Navigate to [Remix](https://remix.ethereum.org) in your browser.
81
81
82
-
Navigate to [Remix](https://remix.ethereum.org) in your browser.
82
+
{<h3>Create a new file</h3>}
83
83
84
-
{<h3>Create a new file</h3>}
84
+
Click the 📄 ("Create new file") button to create a new empty Solidity file.
85
+
You can name this file whatever you'd like, for example `MyCustomL2Token.sol`.
85
86
86
-
Click the 📄 ("Create new file") button to create a new empty Solidity file.
87
-
You can name this file whatever you'd like.
87
+
{<h3>Copy the example contract</h3>}
88
88
89
-
{<h3>Copy the example contract</h3>}
89
+
Copy the following example contract into your new file:
90
90
91
-
Copy the following example contract into your new file:
Take a moment to review the example contract. It's closely based on the official [`OptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.12.2/packages/contracts-bedrock/src/universal/OptimismMintableERC20.sol) contract with one key modification:
97
97
98
-
Take a moment to review the example contract.
99
-
It's almost the same as the standard [`OptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/OptimismMintableERC20.sol) contract except that the `_burn` function has been made to always revert.
100
-
Since the bridge needs to burn tokens when users want to withdraw them to L1, this means that users will not be able to withdraw tokens from this contract.
98
+
The `burn` function has been modified to always revert, making it impossible to withdraw tokens back to L1.
Since the bridge needs to burn tokens when users want to withdraw them to L1, this means that users will not be able to withdraw tokens from this contract. Here's the key part of the contract that prevents withdrawals:
Save the file to automatically compile the contract.
108
-
If you've disabled auto-compile, you'll need to manually compile the contract by clicking the "Solidity Compiler" tab (this looks like the letter "S") and press the blue "Compile" button.
105
+
{<h3>Compile the contract</h3>}
109
106
110
-
{<h3>Deploy the contract</h3>}
107
+
Save the file to automatically compile the contract.
108
+
If you've disabled auto-compile, you'll need to manually compile the contract by clicking the "Solidity Compiler" tab (this looks like the letter "S") and press the blue "Compile" button.
111
109
112
-
Open the deployment tab (this looks like an Ethereum logo with an arrow pointing left).
113
-
Make sure that your environment is set to "Injected Provider", your wallet is connected to OP Sepolia, and Remix has access to your wallet.
114
-
Then, select the `MyCustomL2Token` contract from the deployment dropdown and deploy it with the following parameters:
110
+
Make sure you're using Solidity compiler version 0.8.15 (the same version used in the official Optimism contracts).
# Bridging Your Standard ERC-20 Token Using the Standard Bridge
23
21
24
22
In this tutorial you'll learn how to bridge a standard ERC-20 token from Ethereum to an OP Stack chain using the Standard Bridge system.
@@ -34,7 +32,7 @@ The Standard Bridge **does not** support [**fee on transfer tokens**](https://gi
34
32
35
33
## About OptimismMintableERC20s
36
34
37
-
The Standard Bridge system requires that L2 representations of L1 tokens implement the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.1.4/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol) interface.
35
+
The Standard Bridge system requires that L2 representations of L1 tokens implement the [`IOptimismMintableERC20`](https://github.com/ethereum-optimism/optimism/blob/v1.12.0/packages/contracts-bedrock/src/universal/OptimismMintableERC20.sol) interface.
38
36
This interface is a superset of the standard ERC-20 interface and includes functions that allow the bridge to properly verify deposits/withdrawals and mint/burn tokens as needed.
39
37
Your L2 token contract must implement this interface in order to be bridged using the Standard Bridge system.
40
38
This tutorial will show you how to use the [`OptimismMintableERC20Factory`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/universal/OptimismMintableERC20Factory.sol) to create a basic standardized ERC-20 token on layer 2.
Upgrade execution timelines are being publicly tracked in this [release management project board](https://github.com/orgs/ethereum-optimism/projects/117/views/12).
24
24
25
25
* OP Sepolia, Ink Sepolia, and Minato Sepolia are executing their upgrades **March 21st**
26
-
* OP Mainnet, Ink Mainnet, and Soneium Mainnet are expected to have Upgrade 13 executed on **April 1st**.
27
-
* Unichain Sepolia is executing its upgrade on **April 1st**.
26
+
* OP Mainnet, Ink Mainnet, and Soneium Mainnet are expected to have Upgrade 13 executed on **April 2nd**.
27
+
* Unichain Sepolia is executing its upgrade on **April 1nd**.
28
28
* Unichain Mainnet is executing its upgrade on **April 8th**.
29
29
* Other Optimism governed chains' upgrades will be tracked in the release management project board.
Upgrade execution timelines are being publicly tracked in this [release management project board](https://github.com/orgs/ethereum-optimism/projects/117/views/12) and are subject to change. Here are the following expected timelines:
24
24
25
-
* OP Sepolia, Ink Sepolia, and Minato Sepolia upgrades are targeting **April 2nd, 2025**.
25
+
* OP Sepolia, Ink Sepolia, and Minato Sepolia upgrades are targeting **April 9th, 2025**.
26
26
* OP Mainnet, Soneium Mainnet, Ink Mainnet are expected to execute Upgrade 14 on **April 25th, 2025**.
27
27
* Other Optimism governed chains' upgrades will be tracked in the release management project board.
0 commit comments