Skip to content

Commit

Permalink
feat: add event sync skeleton, bootstrap only
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Oct 8, 2024
1 parent a283146 commit 6a72287
Show file tree
Hide file tree
Showing 23 changed files with 649 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
go.work

rabbitmq_data

.vscode
6 changes: 4 additions & 2 deletions cmd/babylon-staking-indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"github.com/rs/zerolog/log"

"github.com/babylonlabs-io/babylon-staking-indexer/cmd/babylon-staking-indexer/cli"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/client/btcclient"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/clients/bbnclient"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/clients/btcclient"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/config"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/db"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/observability/metrics"
Expand Down Expand Up @@ -47,13 +48,14 @@ func main() {
if err != nil {
log.Fatal().Err(err).Msg("error while creating btc client")
}
bbnClient := bbnclient.NewBbnClient(&cfg.Bbn)

qm, err := queue.NewQueueManager(&cfg.Queue)
if err != nil {
log.Fatal().Err(err).Msg("error while creating queue manager")
}

service := services.NewService(dbClient, btcClient, qm)
service := services.NewService(dbClient, btcClient, bbnClient, qm)
if err != nil {
log.Fatal().Err(err).Msg("error while creating delegation service")
}
Expand Down
4 changes: 4 additions & 0 deletions config/config-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ btc:
net-params: testnet
rpc-user: rpcuser
rpc-pass: rpcpass
bbn:
endpoint: localhost
port: 443
timeout: 10000 # 10 seconds
queue:
queue_user: user # can be replaced by values in .env file
queue_password: password
Expand Down
4 changes: 4 additions & 0 deletions config/config-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ btc:
net-params: testnet
rpc-user: rpcuser
rpc-pass: rpcpass
bbn:
endpoint: rpc.devnet.babylonchain.io
port: 443
timeout: 10000 # 10 seconds
queue:
queue_user: user # can be replaced by values in .env file
queue_password: password
Expand Down
60 changes: 38 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,54 @@ go 1.23.2

require (
github.com/babylonlabs-io/staking-queue-client v0.4.1
github.com/btcsuite/btcd v0.24.0
github.com/btcsuite/btcd v0.24.2
github.com/go-chi/chi/v5 v5.1.0
github.com/spf13/viper v1.18.2
github.com/spf13/viper v1.19.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.6 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cometbft/cometbft v0.38.12 // indirect
github.com/cosmos/gogoproto v1.7.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sync v0.5.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

require (
Expand All @@ -44,25 +60,25 @@ require (
github.com/joho/godotenv v1.5.1
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/prometheus/client_golang v1.19.0
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/prometheus/client_golang v1.20.1
github.com/rs/zerolog v1.32.0
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.9.0
github.com/subosito/gotenv v1.6.0 // indirect
go.mongodb.org/mongo-driver v1.14.0
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6a72287

Please sign in to comment.