Documentation ¶
Index ¶
- Variables
- func LoadContractBytecode(codeHash Hash) ([]byte, error)
- func MustBeValidSuperchainLevel(chainConfig ChainConfig)
- type Address
- type AddressList
- type AddressSet
- type BlockID
- type ChainConfig
- type ChainGenesis
- type ContractImplementations
- type ContractVersions
- type Genesis
- type GenesisAccount
- type GenesisData
- type GenesisLayer
- type GenesisSystemConfig
- type HardForkConfiguration
- type Hash
- type HexBig
- type HexBytes
- type ImplementationList
- type PlasmaConfig
- type Superchain
- type SuperchainConfig
- type SuperchainL1Info
- type SuperchainLevel
- type SystemConfig
- type VersionedContract
Constants ¶
This section is empty.
Variables ¶
var Addresses = map[uint64]*AddressList{}
var GenesisSystemConfigs = map[uint64]*GenesisSystemConfig{}
var Implementations = map[string]ContractImplementations{}
Implementations maps superchain name to contract implementations
var OPChains = map[uint64]*ChainConfig{}
var SuperchainSemver map[string]ContractVersions
SuperchainSemver maps superchain name to a contract name : approved semver version structure.
var Superchains = map[string]*Superchain{}
Functions ¶
func LoadContractBytecode ¶
func MustBeValidSuperchainLevel ¶
func MustBeValidSuperchainLevel(chainConfig ChainConfig)
Types ¶
type Address ¶
type Address [20]byte
func HexToAddress ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalText ¶
type AddressList ¶
type AddressList struct { AddressManager Address `json:"AddressManager"` L1CrossDomainMessengerProxy Address `json:"L1CrossDomainMessengerProxy"` L1ERC721BridgeProxy Address `json:"L1ERC721BridgeProxy"` L1StandardBridgeProxy Address `json:"L1StandardBridgeProxy"` L2OutputOracleProxy Address `json:"L2OutputOracleProxy"` OptimismMintableERC20FactoryProxy Address `json:"OptimismMintableERC20FactoryProxy"` OptimismPortalProxy Address `json:"OptimismPortalProxy"` SystemConfigProxy Address `json:"SystemConfigProxy"` ProxyAdmin Address `json:"ProxyAdmin"` }
AddressList represents the set of network specific contracts for a given network.
func (AddressList) AddressFor ¶
func (a AddressList) AddressFor(contractName string) (Address, error)
AddressFor returns a nonzero address for the supplied contract name, if it has been specified (and an error otherwise). Useful for slicing into the struct using a string.
type AddressSet ¶
AddressSet represents a set of addresses for a given contract. They are keyed by the semantic version.
func (AddressSet) Get ¶
func (a AddressSet) Get(key string) Address
Get will handle getting semantic versions from the set in the case where the semver string is not prefixed with a "v" as well as if it does have a "v" prefix.
func (AddressSet) Versions ¶
func (a AddressSet) Versions() []string
Versions will return the list of semantic versions for a contract. It handles the case where the versions are not prefixed with a "v".
type ChainConfig ¶
type ChainConfig struct { Name string `yaml:"name"` ChainID uint64 `yaml:"chain_id"` PublicRPC string `yaml:"public_rpc"` SequencerRPC string `yaml:"sequencer_rpc"` Explorer string `yaml:"explorer"` SuperchainLevel SuperchainLevel `yaml:"superchain_level"` BatchInboxAddr Address `yaml:"batch_inbox_addr"` Genesis ChainGenesis `yaml:"genesis"` // Superchain is a simple string to identify the superchain. // This is implied by directory structure, and not encoded in the config file itself. Superchain string `yaml:"-"` // Chain is a simple string to identify the chain, within its superchain context. // This matches the resource filename, it is not encoded in the config file itself. Chain string `yaml:"-"` // Hardfork Configuration Overrides HardForkConfiguration `yaml:",inline"` // Optional feature Plasma *PlasmaConfig `yaml:"plasma,omitempty"` }
func (*ChainConfig) EnhanceYAML ¶
func (c *ChainConfig) EnhanceYAML(ctx context.Context, node *yaml.Node) error
EnhanceYAML creates a customized yaml string from a RollupConfig. After completion, the *yaml.Node pointer can be used with a yaml encoder to write the custom format to file
func (*ChainConfig) IsEcotone ¶
func (c *ChainConfig) IsEcotone() bool
IsEcotone returns true if the EcotoneTime for this chain in the past.
func (*ChainConfig) SetDefaultHardforkTimestampsToNil ¶
func (c *ChainConfig) SetDefaultHardforkTimestampsToNil(s *SuperchainConfig)
SetDefaultHardforkTimestampsToNil sets each hardfork timestamp to nil (to remove the override) if the timestamp matches the superchain default
type ChainGenesis ¶
type ChainGenesis struct { L1 BlockID `yaml:"l1"` L2 BlockID `yaml:"l2"` L2Time uint64 `json:"l2_time" yaml:"l2_time"` ExtraData *HexBytes `yaml:"extra_data,omitempty"` SystemConfig SystemConfig `json:"system_config" yaml:"-"` }
type ContractImplementations ¶
type ContractImplementations struct { L1CrossDomainMessenger AddressSet `yaml:"l1_cross_domain_messenger"` L1ERC721Bridge AddressSet `yaml:"l1_erc721_bridge"` L1StandardBridge AddressSet `yaml:"l1_standard_bridge"` L2OutputOracle AddressSet `yaml:"l2_output_oracle"` OptimismMintableERC20Factory AddressSet `yaml:"optimism_mintable_erc20_factory"` OptimismPortal AddressSet `yaml:"optimism_portal"` SystemConfig AddressSet `yaml:"system_config"` }
ContractImplementations represent a set of contract implementations on a given network. The key in the map represents the semantic version of the contract and the value is the address that the contract is deployed to.
func (ContractImplementations) Copy ¶
func (c ContractImplementations) Copy() ContractImplementations
Copy will return a shallow copy of the ContractImplementations.
func (ContractImplementations) Merge ¶
func (c ContractImplementations) Merge(other ContractImplementations)
Merge will combine two ContractImplementations into one. Any conflicting keys will be overwritten by the arguments. It assumes that nonce of the struct fields are nil.
func (ContractImplementations) Resolve ¶
func (c ContractImplementations) Resolve(versions ContractVersions) (ImplementationList, error)
Resolve will return a set of addresses that resolve a given semantic version set.
type ContractVersions ¶
type ContractVersions struct { L1CrossDomainMessenger string `yaml:"l1_cross_domain_messenger"` L1ERC721Bridge string `yaml:"l1_erc721_bridge"` L1StandardBridge string `yaml:"l1_standard_bridge"` L2OutputOracle string `yaml:"l2_output_oracle"` OptimismMintableERC20Factory string `yaml:"optimism_mintable_erc20_factory"` OptimismPortal string `yaml:"optimism_portal"` SystemConfig string `yaml:"system_config"` // Superchain-wide contracts: ProtocolVersions string `yaml:"protocol_versions"` SuperchainConfig string `yaml:"superchain_config,omitempty"` }
ContractVersions represents the desired semantic version of the contracts in the superchain. This currently only supports L1 contracts but could represent L2 predeploys in the future.
func (ContractVersions) Check ¶
func (c ContractVersions) Check(allowEmptyVersions bool) error
Check will sanity check the validity of the semantic version strings in the ContractVersions struct. If allowEmptyVersions is true, empty version errors will be ignored.
func (ContractVersions) VersionFor ¶
func (c ContractVersions) VersionFor(contractName string) (string, error)
VersionFor returns the version for the supplied contract name, if it exits (and an error otherwise). Useful for slicing into the struct using a string.
type Genesis ¶
type Genesis struct { // Block properties Nonce uint64 `json:"nonce"` Timestamp uint64 `json:"timestamp"` ExtraData []byte `json:"extraData"` GasLimit uint64 `json:"gasLimit"` Difficulty *HexBig `json:"difficulty"` Mixhash Hash `json:"mixHash"` Coinbase Address `json:"coinbase"` Number uint64 `json:"number"` GasUsed uint64 `json:"gasUsed"` ParentHash Hash `json:"parentHash"` BaseFee *HexBig `json:"baseFeePerGas"` ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844 BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844 // State data Alloc map[Address]GenesisAccount `json:"alloc"` // StateHash substitutes for a full embedded state allocation, // for instantiating states with the genesis block only, to be state-synced before operation. // Archive nodes should use a full external genesis.json or datadir. StateHash *Hash `json:"stateHash,omitempty"` }
func LoadGenesis ¶
type GenesisAccount ¶
type GenesisData ¶
type GenesisData struct { L1 GenesisLayer `json:"l1" yaml:"l1"` L2 GenesisLayer `json:"l2" yaml:"l2"` L2Time int `json:"l2_time" yaml:"l2_time"` }
type GenesisLayer ¶
type GenesisSystemConfig ¶
type HardForkConfiguration ¶
type HardForkConfiguration struct { CanyonTime *uint64 `json:"canyon_time,omitempty" yaml:"canyon_time,omitempty"` DeltaTime *uint64 `json:"delta_time,omitempty" yaml:"delta_time,omitempty"` EcotoneTime *uint64 `json:"ecotone_time,omitempty" yaml:"ecotone_time,omitempty"` FjordTime *uint64 `json:"fjord_time,omitempty" yaml:"fjord_time,omitempty"` }
type ImplementationList ¶
type ImplementationList struct { L1CrossDomainMessenger VersionedContract `json:"L1CrossDomainMessenger"` L1ERC721Bridge VersionedContract `json:"L1ERC721Bridge"` L1StandardBridge VersionedContract `json:"L1StandardBridge"` L2OutputOracle VersionedContract `json:"L2OutputOracle"` OptimismMintableERC20Factory VersionedContract `json:"OptimismMintableERC20Factory"` OptimismPortal VersionedContract `json:"OptimismPortal"` SystemConfig VersionedContract `json:"SystemConfig"` }
ImplementationList represents the set of implementation contracts to be used together for a network.
type PlasmaConfig ¶
type PlasmaConfig struct { DAChallengeAddress *Address `json:"da_challenge_contract_address" yaml:"-"` // DA challenge window value set on the DAC contract. Used in plasma mode // to compute when a commitment can no longer be challenged. DAChallengeWindow *uint64 `json:"da_challenge_window" yaml:"da_challenge_window"` // DA resolve window value set on the DAC contract. Used in plasma mode // to compute when a challenge expires and trigger a reorg if needed. DAResolveWindow *uint64 `json:"da_resolve_window" yaml:"da_resolve_window"` }
type Superchain ¶
type Superchain struct { Config SuperchainConfig // Chains that are part of this superchain ChainIDs []uint64 // Superchain identifier, without capitalization or display changes. Superchain string }
type SuperchainConfig ¶
type SuperchainConfig struct { Name string `yaml:"name"` L1 SuperchainL1Info `yaml:"l1"` ProtocolVersionsAddr *Address `yaml:"protocol_versions_addr,omitempty"` SuperchainConfigAddr *Address `yaml:"superchain_config_addr,omitempty"` // contains filtered or unexported fields }
type SuperchainL1Info ¶
type SuperchainLevel ¶
type SuperchainLevel uint
const ( Standard SuperchainLevel = 2 Frontier SuperchainLevel = 1 )
type SystemConfig ¶
type VersionedContract ¶
VersionedContract represents a contract that has a semantic version.