Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func StartServer(lc fx.Lifecycle, engine ds.EngineI, cfg *config.Config, client
// In production, we'd want to separate the Listen and Serve phases for
// better error-handling.
go func() {
engine.UseThreads()
// engine.UseThreads()
engine.SyncHandler()
}()
return nil
Expand Down
3 changes: 1 addition & 2 deletions debts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ import (
"go.uber.org/fx"
)

var Module = fx.Option(
fx.Provide(NewDebtEngine))
var Module = fx.Provide(NewDebtEngine)
4 changes: 2 additions & 2 deletions ds/adapter_kit.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func (kit *AdapterKit) init() {
// REVERT_POOL_WRAPPER
kit.AddLevel([]string{PoolWrapper, AccountManager, CompositeChainlinkPF})
// another level created bcz of poolKeeper.
kit.AddLevel([]string{PoolQuotaWrapper, ChainlinkPriceFeed})
kit.AddLevel([]string{PoolQuotaWrapper, ChainlinkWrapper}) // ChainlinkPriceFeed
// REVERT_CM_WRAPPER
kit.AddLevel([]string{CMWrapper, AggregatedQueryFeedWrapper, LMRewardsv2,LMRewardsv3 })
kit.AddLevel([]string{CMWrapper, AggregatedQueryFeedWrapper, LMRewardsv2, LMRewardsv3})
// REVERT_CF_WRAPPER
kit.AddLevel([]string{CFWrapper, CreditConfigurator, Treasury})
// - we are dropping the uni check, so the dependency is reversed.
Expand Down
3 changes: 2 additions & 1 deletion ds/adapter_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const (
RebaseToken = "RebaseToken"
// Wrapper
AggregatedQueryFeedWrapper = "AggregatedQueryFeedWrapper"
ChainlinkWrapper = "ChainlinkWrapper"
AdminWrapper = "AdminWrapper"
CFWrapper = "CFWrapper"
CMWrapper = "CMWrapper"
Expand Down Expand Up @@ -56,7 +57,7 @@ const (

const (
FacadeMulticallCall = "FacadeMulticall"
FacadeBotMulticallCall = "FacadeBotMulticall"
FacadeBotMulticallCall = "FacadeBotMulticall"
FacadeOpenMulticallCall = "FacadeOpenMulticall"
FacadeLiquidateCall = "FacadeLiquidate"
FacadeLiquidateExpiredCall = "FacadeLiquidateExpired"
Expand Down
2 changes: 1 addition & 1 deletion ds/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type RepositoryI interface {
// price feed/oracle funcs
GetTokenOracles() map[schemas.PFVersion]map[string]*schemas.TokenOracle
DirectlyAddTokenOracle(tokenOracle *schemas.TokenOracle)
AddNewPriceOracleEvent(tokenOracle *schemas.TokenOracle, bounded bool, forChainlinkNewFeed ...bool)
AddNewPriceOracleEvent(tokenOracle *schemas.TokenOracle, forChainlinkNewFeed ...bool)
//
GetPrice(token string) *big.Int
AddPriceFeed(pf *schemas.PriceFeed)
Expand Down
2 changes: 1 addition & 1 deletion ds/repo_dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (DummyRepo) GetRetryFeedForDebts() []QueryPriceFeedI {
}

// has mutex lock
func (DummyRepo) AddNewPriceOracleEvent(tokenOracle *schemas.TokenOracle, bounded bool, forChainlinkNewFeed ...bool) {
func (DummyRepo) AddNewPriceOracleEvent(tokenOracle *schemas.TokenOracle, forChainlinkNewFeed ...bool) {
}

func (DummyRepo) LoadLastDebtSync() schemas.LastSync {
Expand Down
7 changes: 7 additions & 0 deletions engine/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/Gearbox-protocol/third-eye/repository"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/prometheus/client_golang/prometheus"
)

type Engine struct {
Expand All @@ -28,6 +29,7 @@ type Engine struct {
debtEng ds.DebtEngineI
syncedBlock atomic.Value
batchSizeForHistory int64
reg *prometheus.Registry
UsingThreads bool
}

Expand All @@ -36,12 +38,14 @@ type Engine struct {
func NewEngine(config *config.Config,
ec core.ClientI,
debtEng ds.DebtEngineI,
reg *prometheus.Registry,
repo ds.RepositoryI) ds.EngineI {
eng := &Engine{
debtEng: debtEng,
config: config,
repo: repo.(*repository.Repository),
batchSizeForHistory: config.BatchSizeForHistory,
reg: reg,
Node: &pkg.Node{
Client: ec,
},
Expand Down Expand Up @@ -162,6 +166,9 @@ func (e *Engine) LastSyncedBlock() (int64, uint64) {
func (e *Engine) Sync(syncTill int64) {
kit := e.repo.GetKit()
log.Info("Sync till", syncTill)
if e.reg != nil {
e.Client.(interface{ PromInit(*prometheus.Registry) }).PromInit(e.reg)
}
// log.Info("No of calls before syncing: ", e.Client.(*ethclient.Client).GetNoOfCalls())
for lvlIndex := 0; lvlIndex < kit.Len(); lvlIndex++ {
wg := &sync.WaitGroup{}
Expand Down
2 changes: 1 addition & 1 deletion engine/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ import (
)

var Module = fx.Option(
fx.Provide(NewEngine))
fx.Provide(NewEngine, getRegistry))
7 changes: 7 additions & 0 deletions engine/reg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package engine

import "github.com/prometheus/client_golang/prometheus"

func getRegistry() *prometheus.Registry {
return prometheus.NewRegistry()
}
38 changes: 20 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
module github.com/Gearbox-protocol/third-eye

go 1.20
go 1.21

toolchain go1.23.2

require (
github.com/Gearbox-protocol/sdk-go v0.0.0-20250323030017-295df9237f0c
github.com/Gearbox-protocol/sdk-go v0.0.0-20250324154851-854e9960e69d
github.com/ethereum/go-ethereum v1.13.14
github.com/go-playground/validator/v10 v10.4.1
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/heroku/x v0.0.42
github.com/joho/godotenv v1.3.0
github.com/prometheus/client_golang v1.14.0
github.com/stretchr/testify v1.8.4
github.com/prometheus/client_golang v1.21.1
github.com/stretchr/testify v1.10.0
go.uber.org/fx v1.13.1
gorm.io/gorm v1.25.11
)
Expand All @@ -21,7 +23,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
Expand All @@ -35,7 +37,6 @@ require (
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-jsonnet v0.18.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
Expand All @@ -47,15 +48,16 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/metachris/flashbotsrpc v0.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rabbitmq/amqp091-go v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/supranational/blst v0.3.11 // indirect
Expand All @@ -66,13 +68,13 @@ require (
go.uber.org/multierr v1.5.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/postgres v1.5.9 // indirect
Expand All @@ -82,6 +84,6 @@ require (

replace github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.1

replace github.com/Gearbox-protocol/sdk-go v0.0.0-20250202041008-5cd987002fd9 => ../sdk-go
replace github.com/Gearbox-protocol/sdk-go v0.0.0-20250324142421-7899229e67ef => ../sdk-go

replace github.com/ethereum/go-ethereum v1.13.14 => github.com/OffchainLabs/go-ethereum v1.13.4-0.20240313010929-e5d8587e7227
Loading
Loading