Deploying ERC-20 tokens

Deploying ERC-20 Tokens to PGN


This guide is designed for developers and teams looking to deploy ERC-20 tokens on the PGN network. There are two recommended processes that you can use. For those that are not comfortable with coding, deploying via a user interface (UI) can significantly simplify the process.

  • UI-based deployment
  • Deploy using Hardhat

For both, you will need the following:

Table of contents

UI-based deployment

Use the following UI to deploy an ERC-20: (opens in a new tab)

##Deploy with Hardhat

The following link will take you to some code in Hardhat to deploy a standard Optimism ERC20.

Please note that this will not work with many of the stable coins since they have different constructor arguments than just name and symbol. (opens in a new tab)

Finding the correct token code to deploy

Ideally ask the owner of the token (for example, Circle for USDC) to provide a link to the contract on an OP Stack chain. (Note that Arbitrum will not work, but Base or Optimism will).

Another option is to find the token folder in the following link: (opens in a new tab)

Then copy the Base contract address for that token, and search for it in the Base Explorer (opens in a new tab).

Here is an example of USDC’s contract address on Base’s Explorer: (opens in a new tab)

You’ll find the implementationContract (address) at the bottom of the page

Navigate to that contract address to find the proper code for deployment.

Here is an example of the USDC implementationContract: (opens in a new tab)

Considerations when deploying

To deploy certain contract, we need to consider a few things.

  • What are the arguments to deploy this/these contract(s) with?
  • Does the Proxy contract has a constructor function (with the implementation address)
  • Has this contract been upgraded and what calls do we need to make to upgrade it?

In the Base/USDC example, we find 3 initialize functions: initialize, initializeV2, initializeV2_1. These must be called in a specific order since the code checks for variables set in each of the initialize functions (initialized and _initializedVersion).

Please note: Constructor functions are called when contract is deployed, initialize is called after deployment (to complicate things, these initialize functions are named by the contract devs and might vary between tokens)

Steps to deploy an example USDC contract

Here is the implementationContract (opens in a new tab) for USDC on Base.

  1. Deploy the implementation contract (FiatTokenV2_1.sol)
  2. Call initialize (specified in FiatTokenV1.sol) with these parameters: tokenName, tokenSymbol, tokenCurrency, tokenDecimals, newMasterMinter, newPauser, newBlacklister, and newOwner
  3. Call initializeV2 (specified in FiatTokenV2.sol) with parameter newName (this is the just token name: "USD Coin")
  4. Call initializeV2_1 with a lostAndFound address ("The address to which the locked funds are sent")
  5. Deploy FiatTokenProxy.sol with the address of the deployed FiatTokenV2_1.sol as parameter implementationContract

Add the token to the PGN bridge

The final step in the process is making sure the token is available via the PGN bridge.

Please make sure you add the token, similarly to how USDT was added: (opens in a new tab)