Commit 83d4d553 authored by Mark Tyneway's avatar Mark Tyneway

op-chain-ops: configurable gov token

This adds the governance token config to the `DeployConfig`.
The `name`, `symbol` and `_owner` can be set via new config options.
We must set these values to be `Optimism`, `OP` and the address
of the mint manager for the upgraded networks.

This change allows new networks to easily configure the gov token.
This is important so that other networks do not spin up a chain
that has a gov token that looks exactly the same as `OP`. This
will enable scammers.

In my opinion, we should also make the `MintManager` a predeploy
because it is the only L2 contract that we manage that is not
a predeploy.
parent 9dbd62d0
...@@ -88,9 +88,16 @@ type DeployConfig struct { ...@@ -88,9 +88,16 @@ type DeployConfig struct {
SystemConfigProxy common.Address `json:"systemConfigProxy"` SystemConfigProxy common.Address `json:"systemConfigProxy"`
// OptimismPortal proxy address on L1 // OptimismPortal proxy address on L1
OptimismPortalProxy common.Address `json:"optimismPortalProxy"` OptimismPortalProxy common.Address `json:"optimismPortalProxy"`
// The initial value of the gas overhead
GasPriceOracleOverhead uint64 `json:"gasPriceOracleOverhead"` GasPriceOracleOverhead uint64 `json:"gasPriceOracleOverhead"`
GasPriceOracleScalar uint64 `json:"gasPriceOracleScalar"` // The initial value of the gas scalar
GasPriceOracleScalar uint64 `json:"gasPriceOracleScalar"`
// The ERC20 symbol of the GovernanceToken
GovernanceTokenSymbol string `json:"governanceTokenSymbol"`
// The ERC20 name of the GovernanceToken
GovernanceTokenName string `json:"governanceTokenName"`
// The owner of the GovernanceToken
GovernanceTokenOwner common.Address `json:"governanceTokenOwner"`
DeploymentWaitConfirmations int `json:"deploymentWaitConfirmations"` DeploymentWaitConfirmations int `json:"deploymentWaitConfirmations"`
...@@ -192,6 +199,15 @@ func (d *DeployConfig) Check() error { ...@@ -192,6 +199,15 @@ func (d *DeployConfig) Check() error {
if d.L2GenesisBlockBaseFeePerGas == nil { if d.L2GenesisBlockBaseFeePerGas == nil {
return fmt.Errorf("%w: L2 genesis block base fee per gas cannot be nil", ErrInvalidDeployConfig) return fmt.Errorf("%w: L2 genesis block base fee per gas cannot be nil", ErrInvalidDeployConfig)
} }
if d.GovernanceTokenName == "" {
return fmt.Errorf("%w: GovernanceToken.name cannot be empty", ErrInvalidDeployConfig)
}
if d.GovernanceTokenSymbol == "" {
return fmt.Errorf("%w: GovernanceToken.symbol cannot be empty", ErrInvalidDeployConfig)
}
if d.GovernanceTokenOwner == (common.Address{}) {
return fmt.Errorf("%w: GovernanceToken owner cannot be address(0)", ErrInvalidDeployConfig)
}
return nil return nil
} }
...@@ -408,8 +424,9 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage ...@@ -408,8 +424,9 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage
"decimals": 18, "decimals": 18,
} }
storage["GovernanceToken"] = state.StorageValues{ storage["GovernanceToken"] = state.StorageValues{
"_name": "Optimism", "_name": config.GovernanceTokenName,
"_symbol": "OP", "_symbol": config.GovernanceTokenSymbol,
"_owner": config.GovernanceTokenOwner,
} }
storage["ProxyAdmin"] = state.StorageValues{ storage["ProxyAdmin"] = state.StorageValues{
"_owner": config.ProxyAdminOwner, "_owner": config.ProxyAdminOwner,
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
"proxyAdminOwner": "0x0000000000000000000000000000000000000222", "proxyAdminOwner": "0x0000000000000000000000000000000000000222",
"gasPriceOracleOverhead": 2100, "gasPriceOracleOverhead": 2100,
"gasPriceOracleScalar": 1000000, "gasPriceOracleScalar": 1000000,
"governanceTokenSymbol": "OP",
"governanceTokenName": "Optimism",
"governanceTokenOwner": "0x0000000000000000000000000000000000000333",
"deploymentWaitConfirmations": 1, "deploymentWaitConfirmations": 1,
"eip1559Denominator": 8, "eip1559Denominator": 8,
"eip1559Elasticity": 2, "eip1559Elasticity": 2,
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
"l2GenesisBlockBaseFeePerGas": "0x3B9ACA00", "l2GenesisBlockBaseFeePerGas": "0x3B9ACA00",
"gasPriceOracleOverhead": 2100, "gasPriceOracleOverhead": 2100,
"gasPriceOracleScalar": 1000000, "gasPriceOracleScalar": 1000000,
"governanceTokenSymbol": "OP",
"governanceTokenName": "Optimism",
"governanceTokenOwner": "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
"eip1559Denominator": 8, "eip1559Denominator": 8,
"eip1559Elasticity": 2, "eip1559Elasticity": 2,
"l1GenesisBlockTimestamp": "0x638a4554", "l1GenesisBlockTimestamp": "0x638a4554",
......
...@@ -101,6 +101,21 @@ interface RequiredDeployConfig { ...@@ -101,6 +101,21 @@ interface RequiredDeployConfig {
*/ */
l2OutputOracleChallenger: string l2OutputOracleChallenger: string
/**
* ERC20 symbol used for the L2 GovernanceToken.
*/
governanceTokenSymbol: string
/**
* ERC20 name used for the L2 GovernanceToken.
*/
governanceTokenName: string
/**
* Owner of the L2 GovernanceToken. Has mint/burn capability.
*/
governanceTokenOwner: string
/** /**
* Output finalization period in seconds. * Output finalization period in seconds.
*/ */
...@@ -315,4 +330,15 @@ export const deployConfigSpec: { ...@@ -315,4 +330,15 @@ export const deployConfigSpec: {
type: 'number', type: 'number',
default: 6, default: 6,
}, },
governanceTokenSymbol: {
type: 'string',
default: 'OP',
},
governanceTokenName: {
type: 'string',
default: 'Optimism',
},
governanceTokenOwner: {
type: 'string',
},
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment