1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package standard
import (
"embed"
"io/fs"
"github.com/BurntSushi/toml"
"github.com/ethereum-optimism/superchain-registry/superchain"
)
//go:embed *.toml
var standardConfigFile embed.FS
func init() {
Config = ConfigType{
Params: make(map[string]*Params),
Roles: new(Roles),
MultisigRoles: make(map[string]*MultisigRoles),
}
decodeTOMLFileIntoConfig("standard-config-roles-universal.toml", Config.Roles)
networks := []string{"mainnet", "sepolia"}
for _, network := range networks {
Config.MultisigRoles[network] = new(MultisigRoles)
decodeTOMLFileIntoConfig("standard-config-roles-"+network+".toml", Config.MultisigRoles[network])
Config.Params[network] = new(Params)
decodeTOMLFileIntoConfig("standard-config-params-"+network+".toml", Config.Params[network])
var versions VersionTags = VersionTags{
Releases: make(map[Tag]superchain.ContractVersions, 0),
}
decodeTOMLFileIntoConfig("standard-versions-"+network+".toml", &versions)
NetworkVersions[network] = versions
}
decodeTOMLFileIntoConfig("standard-bytecodes.toml", &BytecodeHashes)
decodeTOMLFileIntoConfig("standard-immutables.toml", &BytecodeImmutables)
// Get the single standard release Tag (universal across superchain targets)
// and store in the standard.Release
temp := new(struct {
Sr string `toml:"standard_release"`
})
decodeTOMLFileIntoConfig("standard-releases.toml", temp)
Release = Tag(temp.Sr)
if Release == "" {
panic("empty standard release")
}
}
func decodeTOMLFileIntoConfig[
T any](filename string, config *T) {
data, err := fs.ReadFile(standardConfigFile, filename)
if err != nil {
panic(err)
}
err = toml.Unmarshal(data, config)
if err != nil {
panic(err)
}
}