Skip to content

Commit

Permalink
Merge pull request #11586 from vegaprotocol/fix/11585
Browse files Browse the repository at this point in the history
fix: initialise rebate stats and programs in APIs
  • Loading branch information
jeremyletang authored Aug 14, 2024
2 parents e4dfd3a + e6ae93b commit 2bfad77
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cmd/data-node/commands/start/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
9 changes: 8 additions & 1 deletion datanode/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ type GRPCServer struct {
timeWeightedNotionalPositionService *service.TimeWeightedNotionalPosition
gameScoreService *service.GameScore
ammPoolService *service.AMMPools
volumeRebateStatsService *service.VolumeRebateStats
volumeRebateProgramService *service.VolumeRebatePrograms

eventObserver *eventObserver

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -337,7 +341,8 @@ func NewGRPCServer(
timeWeightedNotionalPositionService: timeWeightedNotionalPositionService,
gameScoreService: gameScoreService,
ammPoolService: ammPoolService,

volumeRebateStatsService: volumeRebateStatsService,
volumeRebateProgramService: volumeRebateProgramsService,
eventObserver: &eventObserver{
log: log,
eventService: eventService,
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions datanode/api/trading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 2bfad77

Please sign in to comment.