Skip to content

Commit

Permalink
Remove dependency on Etherscan, remove unused inline-contract indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Oct 30, 2024
1 parent 703e966 commit dc31254
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 861 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ mkdir ./sidecar-data || true
./bin/sidecar run \
--ethereum.rpc-url="http://34.229.43.36:8545" \
--chain="holesky" \
--etherscan.api-keys="<your etherscan key>" \
--statsd.url="localhost:8125" \
--datadir="./sidecar-data"
Expand All @@ -109,7 +108,6 @@ docker run -it --rm \
-e SIDECAR_DEBUG=false \
-e SIDECAR_ETHEREUM_RPC_BASE_URL="http://34.229.43.36:8545" \
-e SIDECAR_CHAIN="holesky" \
-e SIDECAR_ETHERSCAN_API_KEYS="<your etherscan key>" \
-e SIDECAR_STATSD_URL="localhost:8125" \
-e SIDECAR_DATADIR="/sidecar" \
-v "$(pwd)/sqlite:/sidecar" \
Expand All @@ -128,7 +126,6 @@ docker run \
-e "SIDECAR_DEBUG=false" \
-e "SIDECAR_ETHEREUM_RPC_BASE_URL=http://34.229.43.36:8545" \
-e "SIDECAR_CHAIN=holesky" \
-e "SIDECAR_ETHERSCAN_API_KEYS='<your etherscan key>'" \
-e "SIDECAR_STATSD_URL=localhost:8125" \
-e SIDECAR_DATADIR="/sidecar" \
-v "$(pwd)/sqlite:/sidecar" \
Expand Down
6 changes: 2 additions & 4 deletions cmd/debugger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum"
"github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan"
"github.com/Layr-Labs/go-sidecar/pkg/contractCaller"
"github.com/Layr-Labs/go-sidecar/pkg/contractManager"
"github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore"
Expand Down Expand Up @@ -41,7 +40,6 @@ func main() {
l.Sugar().Fatal("Failed to setup statsd client", zap.Error(err))
}

etherscanClient := etherscan.NewEtherscanClient(cfg, l)
client := ethereum.NewClient(cfg.EthereumRpcConfig.BaseUrl, l)

pgConfig := postgres.PostgresConfigFromDbConfig(&cfg.DatabaseConfig)
Expand All @@ -67,7 +65,7 @@ func main() {
log.Fatalf("Failed to initialize core contracts: %v", err)
}

cm := contractManager.NewContractManager(contractStore, etherscanClient, client, sdc, l)
cm := contractManager.NewContractManager(contractStore, client, sdc, l)

mds := pgStorage.NewPostgresBlockStore(grm, l, cfg)
if err != nil {
Expand Down Expand Up @@ -99,7 +97,7 @@ func main() {

cc := contractCaller.NewContractCaller(client, l)

idxr := indexer.NewIndexer(mds, contractStore, etherscanClient, cm, client, fetchr, cc, l, cfg)
idxr := indexer.NewIndexer(mds, contractStore, cm, client, fetchr, cc, l, cfg)

p := pipeline.NewPipeline(fetchr, idxr, mds, sm, l)

Expand Down
2 changes: 0 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func init() {
rootCmd.PersistentFlags().String("ethereum.rpc-url", "", `e.g. "http://34.229.43.36:8545"`)
rootCmd.PersistentFlags().String("ethereum.ws-url", "", `e.g. "ws://34.229.43.36:8546"`)

rootCmd.PersistentFlags().String("etherscan.api-keys", "", `Comma-separated string of keys. e.g. "key1,key2,key3"`)

rootCmd.PersistentFlags().String(config.DatabaseHost, "localhost", `Defaults to 'localhost'. Set to something else if you are running PostgreSQL on your own`)
rootCmd.PersistentFlags().Int(config.DatabasePort, 5432, `Defaults to '5432'`)
rootCmd.PersistentFlags().String(config.DatabaseUser, "sidecar", `Defaults to 'sidecar'`)
Expand Down
6 changes: 2 additions & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/Layr-Labs/go-sidecar/pkg/clients/ethereum"
"github.com/Layr-Labs/go-sidecar/pkg/clients/etherscan"
"github.com/Layr-Labs/go-sidecar/pkg/contractCaller"
"github.com/Layr-Labs/go-sidecar/pkg/contractManager"
"github.com/Layr-Labs/go-sidecar/pkg/contractStore/postgresContractStore"
Expand Down Expand Up @@ -50,7 +49,6 @@ var runCmd = &cobra.Command{
l.Sugar().Fatal("Failed to setup statsd client", zap.Error(err))
}

etherscanClient := etherscan.NewEtherscanClient(cfg, l)
client := ethereum.NewClient(cfg.EthereumRpcConfig.BaseUrl, l)

pgConfig := postgres.PostgresConfigFromDbConfig(&cfg.DatabaseConfig)
Expand All @@ -76,7 +74,7 @@ var runCmd = &cobra.Command{
log.Fatalf("Failed to initialize core contracts: %v", err)
}

cm := contractManager.NewContractManager(contractStore, etherscanClient, client, sdc, l)
cm := contractManager.NewContractManager(contractStore, client, sdc, l)

mds := pgStorage.NewPostgresBlockStore(grm, l, cfg)
if err != nil {
Expand Down Expand Up @@ -108,7 +106,7 @@ var runCmd = &cobra.Command{

cc := contractCaller.NewContractCaller(client, l)

idxr := indexer.NewIndexer(mds, contractStore, etherscanClient, cm, client, fetchr, cc, l, cfg)
idxr := indexer.NewIndexer(mds, contractStore, cm, client, fetchr, cc, l, cfg)

p := pipeline.NewPipeline(fetchr, idxr, mds, sm, l)

Expand Down
9 changes: 0 additions & 9 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ type Config struct {
Debug bool
StatsdUrl string
EthereumRpcConfig EthereumRpcConfig
EtherscanConfig EtherscanConfig
DatabaseConfig DatabaseConfig
RpcConfig RpcConfig
Chain Chain
Expand All @@ -72,10 +71,6 @@ type EthereumRpcConfig struct {
WsUrl string
}

type EtherscanConfig struct {
ApiKeys []string
}

type DatabaseConfig struct {
Host string
Port int
Expand Down Expand Up @@ -115,10 +110,6 @@ func NewConfig() *Config {
WsUrl: viper.GetString(normalizeFlagName("ethereum.ws_url")),
},

EtherscanConfig: EtherscanConfig{
ApiKeys: parseListEnvVar(viper.GetString(normalizeFlagName("etherscan.api_keys"))),
},

DatabaseConfig: DatabaseConfig{
Host: viper.GetString(normalizeFlagName(DatabaseHost)),
Port: viper.GetInt(normalizeFlagName(DatabasePort)),
Expand Down
4 changes: 0 additions & 4 deletions internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ func GetStatsdClient() *statsd.Client {
}
return statsdClient
}

const (
Etherscan_ContractAbi = "etherscan.contract_abi"
)
180 changes: 0 additions & 180 deletions pkg/clients/etherscan/client.go

This file was deleted.

Loading

0 comments on commit dc31254

Please sign in to comment.