From e6ae93b812e88df50577487e5238fb11acf97959 Mon Sep 17 00:00:00 2001 From: Jeremy Letang Date: Wed, 14 Aug 2024 16:40:42 +0100 Subject: [PATCH] fix: initialise rebate stats and programs in APIs Signed-off-by: Jeremy Letang --- CHANGELOG.md | 1 + cmd/data-node/commands/start/node.go | 2 ++ datanode/api/server.go | 9 ++++++++- datanode/api/trading_test.go | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56743e12179..7f6fd3f0c72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - [11542](https://github.com/vegaprotocol/vega/issues/11542) - Fix non determinism in lottery ranking. - [11544](https://github.com/vegaprotocol/vega/issues/11544) - Fix empty candles stream. - [11579](https://github.com/vegaprotocol/vega/issues/11579) - Spot calculate fee on amend, use order price if no amended price is provided. +- [11585](https://github.com/vegaprotocol/vega/issues/11585) - Initialise rebate stats service in API. ## 0.77.5 diff --git a/cmd/data-node/commands/start/node.go b/cmd/data-node/commands/start/node.go index a71d04c0e90..395dcd52d4d 100644 --- a/cmd/data-node/commands/start/node.go +++ b/cmd/data-node/commands/start/node.go @@ -242,6 +242,8 @@ func (l *NodeCommand) createGRPCServer(config api.Config) *api.GRPCServer { l.timeWeightedNotionalPositionService, l.gameScoreService, l.ammPoolsService, + l.volumeRebateStatsService, + l.volumeRebateProgramService, ) return grpcServer } diff --git a/datanode/api/server.go b/datanode/api/server.go index 0ba7ecabe14..e3a5f51cbc6 100644 --- a/datanode/api/server.go +++ b/datanode/api/server.go @@ -194,6 +194,8 @@ type GRPCServer struct { timeWeightedNotionalPositionService *service.TimeWeightedNotionalPosition gameScoreService *service.GameScore ammPoolService *service.AMMPools + volumeRebateStatsService *service.VolumeRebateStats + volumeRebateProgramService *service.VolumeRebatePrograms eventObserver *eventObserver @@ -266,6 +268,8 @@ func NewGRPCServer( timeWeightedNotionalPositionService *service.TimeWeightedNotionalPosition, gameScoreService *service.GameScore, ammPoolService *service.AMMPools, + volumeRebateStatsService *service.VolumeRebateStats, + volumeRebateProgramsService *service.VolumeRebatePrograms, ) *GRPCServer { // setup logger log = log.Named(namedLogger) @@ -337,7 +341,8 @@ func NewGRPCServer( timeWeightedNotionalPositionService: timeWeightedNotionalPositionService, gameScoreService: gameScoreService, ammPoolService: ammPoolService, - + volumeRebateStatsService: volumeRebateStatsService, + volumeRebateProgramService: volumeRebateProgramsService, eventObserver: &eventObserver{ log: log, eventService: eventService, @@ -578,6 +583,8 @@ func (g *GRPCServer) Start(ctx context.Context, lis net.Listener) error { twNotionalPositionService: g.timeWeightedNotionalPositionService, gameScoreService: g.gameScoreService, AMMPoolService: g.ammPoolService, + volumeRebateStatsService: g.volumeRebateStatsService, + volumeRebateProgramService: g.volumeRebateProgramService, } protoapi.RegisterTradingDataServiceServer(g.srv, tradingDataSvcV2) diff --git a/datanode/api/trading_test.go b/datanode/api/trading_test.go index 4fd6399d708..658b49726bf 100644 --- a/datanode/api/trading_test.go +++ b/datanode/api/trading_test.go @@ -163,6 +163,8 @@ func getTestGRPCServer(t *testing.T, ctx context.Context) (tidy func(), conn *gr gameScoreService := service.NewGameScore(sqlstore.NewGameScores(sqlConn), logger) ammPoolsService := service.NewAMMPools(sqlstore.NewAMMPools(sqlConn)) sqlMarketDepthService := service.NewMarketDepth(service.NewDefaultConfig().MarketDepth, sqlOrderService, ammPoolsService, nil, nil, nil, nil, logger) + volumeRebateStatsService := service.NewVolumeRebateStats(sqlstore.NewVolumeRebateStats(sqlConn)) + volumeRebateProgramssService := service.NewVolumeRebatePrograms(sqlstore.NewVolumeRebatePrograms(sqlConn)) g := api.NewGRPCServer( logger, @@ -225,6 +227,8 @@ func getTestGRPCServer(t *testing.T, ctx context.Context) (tidy func(), conn *gr timeWeightedNotionPositionService, gameScoreService, ammPoolsService, + volumeRebateStatsService, + volumeRebateProgramssService, ) if g == nil { err = fmt.Errorf("failed to create gRPC server")