Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
beb36a70
Commit
beb36a70
authored
Sep 15, 2023
by
Will Cory
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments
parent
8ab7c2c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
55 deletions
+13
-55
config.go
indexer/config/config.go
+1
-5
devnet.go
indexer/config/devnet.go
+12
-50
No files found.
indexer/config/config.go
View file @
beb36a70
...
...
@@ -140,10 +140,6 @@ type ServerConfig struct {
Port
int
`toml:"port"`
}
var
(
DEVNET_CHAIN_ID
=
901
)
// LoadConfig loads the `indexer.toml` config file from a given path
func
LoadConfig
(
log
log
.
Logger
,
path
string
)
(
Config
,
error
)
{
log
.
Debug
(
"loading config"
,
"path"
,
path
)
...
...
@@ -161,7 +157,7 @@ func LoadConfig(log log.Logger, path string) (Config, error) {
return
conf
,
err
}
if
conf
.
Chain
.
Preset
==
DEVNET_CHAIN_ID
{
if
conf
.
Chain
.
Preset
==
DEVNET_
L2_
CHAIN_ID
{
preset
,
err
:=
GetDevnetPreset
()
if
err
!=
nil
{
return
conf
,
err
...
...
indexer/config/devnet.go
View file @
beb36a70
...
...
@@ -2,59 +2,31 @@ package config
import
(
"encoding/json"
"io/ioutil"
"errors"
"io/fs"
"os"
"github.com/ethereum/go-ethereum/common"
)
type
ethereumContracts
struct
{
AddressManager
string
`json:"AddressManager"`
BlockOracle
string
`json:"BlockOracle"`
DisputeGameFactory
string
`json:"DisputeGameFactory"`
DisputeGameFactoryProxy
string
`json:"DisputeGameFactoryProxy"`
L1CrossDomainMessenger
string
`json:"L1CrossDomainMessenger"`
L1CrossDomainMessengerProxy
string
`json:"L1CrossDomainMessengerProxy"`
L1ERC721Bridge
string
`json:"L1ERC721Bridge"`
L1ERC721BridgeProxy
string
`json:"L1ERC721BridgeProxy"`
L1StandardBridge
string
`json:"L1StandardBridge"`
L1StandardBridgeProxy
string
`json:"L1StandardBridgeProxy"`
L2OutputOracle
string
`json:"L2OutputOracle"`
L2OutputOracleProxy
string
`json:"L2OutputOracleProxy"`
Mips
string
`json:"Mips"`
OptimismMintableERC20Factory
string
`json:"OptimismMintableERC20Factory"`
OptimismMintableERC20FactoryProxy
string
`json:"OptimismMintableERC20FactoryProxy"`
OptimismPortal
string
`json:"OptimismPortal"`
OptimismPortalProxy
string
`json:"OptimismPortalProxy"`
PreimageOracle
string
`json:"PreimageOracle"`
ProxyAdmin
string
`json:"ProxyAdmin"`
SystemConfig
string
`json:"SystemConfig"`
SystemConfigProxy
string
`json:"SystemConfigProxy"`
}
var
(
filePath
=
"../.devnet/addresses.json"
DEVNET_L2_CHAIN_ID
=
901
)
func
readEthereumContracts
(
filename
string
)
(
*
ethereumContracts
,
error
)
{
// Check if the file exists
if
_
,
err
:=
os
.
Stat
(
filename
);
os
.
IsNotExist
(
err
)
{
func
GetDevnetPreset
()
(
*
Preset
,
error
)
{
if
_
,
err
:=
os
.
Stat
(
filePath
);
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
return
nil
,
err
}
// Read the file
content
,
err
:=
ioutil
.
ReadFile
(
filename
)
content
,
err
:=
os
.
ReadFile
(
filePath
)
if
err
!=
nil
{
return
nil
,
err
}
// Unmarshal the JSON
var
contracts
ethereumContracts
if
err
:=
json
.
Unmarshal
(
content
,
&
contracts
);
err
!=
nil
{
var
l1Contracts
L1Contracts
if
err
:=
json
.
Unmarshal
(
content
,
&
l1Contracts
);
err
!=
nil
{
return
nil
,
err
}
return
&
contracts
,
nil
}
func
GetDevnetPreset
()
(
*
Preset
,
error
)
{
ethereumContracts
,
err
:=
readEthereumContracts
(
"../.devnet/addresses.json"
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -64,17 +36,7 @@ func GetDevnetPreset() (*Preset, error) {
L1StartingHeight
:
0
,
L1BedrockStartingHeight
:
0
,
L2BedrockStartingHeight
:
0
,
L1Contracts
:
L1Contracts
{
AddressManager
:
common
.
HexToAddress
(
ethereumContracts
.
AddressManager
),
SystemConfigProxy
:
common
.
HexToAddress
(
ethereumContracts
.
SystemConfigProxy
),
OptimismPortalProxy
:
common
.
HexToAddress
(
ethereumContracts
.
OptimismPortalProxy
),
L2OutputOracleProxy
:
common
.
HexToAddress
(
ethereumContracts
.
L2OutputOracleProxy
),
L1CrossDomainMessengerProxy
:
common
.
HexToAddress
(
ethereumContracts
.
L1CrossDomainMessengerProxy
),
L1StandardBridgeProxy
:
common
.
HexToAddress
(
ethereumContracts
.
L1StandardBridgeProxy
),
L1ERC721BridgeProxy
:
common
.
HexToAddress
(
ethereumContracts
.
L1ERC721BridgeProxy
),
LegacyCanonicalTransactionChain
:
common
.
HexToAddress
(
"0x0"
),
LegacyStateCommitmentChain
:
common
.
HexToAddress
(
"0x0"
),
},
L1Contracts
:
l1Contracts
,
},
},
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment