Standard ERC20
Bridging Your Standard ERC-20 Token Using the Standard Bridge
Learn how to bridge ERC-20 tokens from Ethereum to Thanos using the Standard Bridge system. This tutorial is intended for developers who have an existing ERC-20 token on Ethereum and want to create a bridged representation of that token on Thanos.
This tutorial explains how to use the OptimismMintableERC20Factory
to deploy standardized ERC-20 tokens on Thanos. Tokens created with this factory contract are compatible with the Standard Bridge system and include basic logic for deposits, transfers, and withdrawals. If you need to include custom logic in your L2 token, refer to the tutorial on Bridging Your Custom ERC-20 Token Using the Standard Bridge instead.
Prerequisite
L1 ERC-20 Token Address
For this tutorial, you will need an L1 ERC-20 token. If you already have an L1 ERC-20 token deployed on Sepolia, you can skip this step. Otherwise, you can use a test token available at 0x5589BB8228C07c4e15558875fAf2B859f678d129
, which includes a function that allows you to mint tokens.
Creating an L2 ERC-20 Token
Once you have the L1 ERC-20 token, you can use the OptimismMintableERC20Factory to create the corresponding L2 ERC-20 token on Thanos. All tokens created from the factory implement the IOptimismMintableERC20
interface and are compatible with the Standard Bridge system.
Add Private Key to Environment Variables
Add RPC to Environment Variables
Add L1 ERC-20 Address to Environment Variables
Deploy L2 ERC-20
Bridging Your Custom ERC-20 Token Using the Standard Bridge
Learn how to bridge ERC-20 tokens from Ethereum to Thanos using the Standard Bridge system. This tutorial is for developers who have an existing ERC-20 token on Ethereum and want to create a bridged representation of that token on Thanos.
In this tutorial, we will explain how to create a custom token and provide an interface that allows it to be used with the IOptimismMintableERC20
Standard Bridge system. Custom tokens can trigger additional logic, such as executing specific actions whenever the token is deposited. If you don’t need such additional functionality, consider following the tutorial on Bridging Your Standard ERC-20 Token Using the Standard Bridge instead.
Prerequisite
node (v20.16.0)
L1 ERC-20 Token Address
For this tutorial, you will need an L1 ERC-20 token. If you already have an L1 ERC-20 token deployed on Sepolia, you can skip this step. Otherwise, you can use a test token available at 0x5589BB8228C07c4e15558875fAf2B859f678d129
, which includes a function that allows you to mint tokens.
Creating an L2 ERC-20 Token
If you have an L1 ERC-20 token, you can create the corresponding L2 ERC-20 token on Thanos. In this tutorial, we will use Remix, allowing you to easily deploy the token without frameworks like Hardhat. Alternatively, if you prefer, you can follow the same general process within your preferred framework.
In this section, we will create an ERC-20 token that allows deposits but does not allow withdrawals. This is just one of the many ways you can customize an L2 token.
Click the 📄 ("Create New File") button to create a new blank Solidity file. You can name this file whatever you like. Copy the following sample contract into the new file.
Save and Deploy the Contract
Save the file to automatically compile the contract. If you have disabled automatic compilation, click on the "Solidity Compiler" tab and manually compile the contract by pressing the blue "Compile" button.
Open the Deploy tab. Make sure the environment is set to "Injected Provider" your wallet is connected to Thanos, and Remix has access to your wallet. Then, select the contract from the MyCustomL2Token
deployment dropdown and deploy it with the following parameters.
Last updated