<aside> ⚠️ Note this is beta software, please contact the OP Labs team for support - We do not recommend running a Custom Gas Token chain in production mainnet yet. This guide is for running testnet chains to allow an initial set of chain operators to flag any issues before launching to mainnet. The OP Labs team will flag when they have confidence in the security of the implementation code.
</aside>
An OP Stack chain that uses the custom gas token feature enables an end user to deposit an L1 native ERC20 token into L2 where that asset is minted as the native L2 asset and can be used to pay for gas on L2.
The deploy config in contracts-bedrock/deploy-config
needs to be updated with new fields:
useCustomGasToken
customGasTokenAddress
useCustomGasToken
should be set to true
and the address of the L1 ERC20 token should be in customGasTokenAddress
. The ERC20 should already be deployed before trying to spin up the custom gas token chain.
If you set useCustomGasToken
to false
(it defaults this way) then it will use ETH as the gas paying token
When setting your customGasTokenAddress
, set the contract address of an L1 ERC20 token you wish to use as the gas token on your L2.
The custom gas token being set must meet the following criteria:
<aside> ⚠️ NOTE: You will NOT be able to change the address of the custom gas token if it is already set.
</aside>
From contracts-bedrock
, deploy the L1 contracts using the following command:
DEPLOYMENT_OUTFILE=deployments/artifact.json \\
DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \\
forge script scripts/Deploy.s.sol:Deploy \\
--broadcast --private-key $PRIVATE_KEY \\
--rpc-url $ETH_RPC_URL
DEPLOYMENT_OUTFILE
is the path to the file at which the L1 contract deployment artifacts are written to after deployment. Foundry has filesystem restrictions for security, so make this file a child of the deployments
directory. This file will contain key/value pairs of the names and addresses of the deployed contracts.DEPLOY_CONFIG_PATH
is the path to the file for the deploy config used to deploy<aside> 📢 Be sure to use the same branch that you used to deploy the L1 contracts.
</aside>
https://github.com/ethereum-optimism/optimism/pull/10143
A forge script is used to generate the L2 genesis. It is a requirement that the L1 contracts have been deployed before generating the L2 genesis, since some L1 contract addresses are embedded into the L2 genesis.
It is assumed that: