Skip to content

Commit

Permalink
more buf lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Jan 24, 2025
1 parent c1f1cc3 commit 3689817
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 218 deletions.
24 changes: 12 additions & 12 deletions proto/ojo/oracle/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ service Query {
}

// Queries a Price by asset.
rpc Price(QueryGetPriceRequest)
returns (QueryGetPriceResponse) {
rpc Price(QueryPriceRequest)
returns (QueryPriceResponse) {
option (google.api.http).get = "/elys-network/elys/oracle/price/{asset}";
}

// Queries a list of Price items.
rpc PriceAll(QueryAllPriceRequest)
returns (QueryAllPriceResponse) {
rpc PriceAll(QueryPriceAllRequest)
returns (QueryPriceAllResponse) {
option (google.api.http).get = "/elys-network/elys/oracle/prices";
}
}
Expand Down Expand Up @@ -305,22 +305,22 @@ message QueryValidatorRewardSetResponse {
ValidatorRewardSet validators = 1 [(gogoproto.nullable) = false];
}

// QueryGetPriceRequest is the request type for the Query/GetPriceRequest RPC method.
message QueryGetPriceRequest {
// QueryPriceRequest is the request type for the Query/PriceRequest RPC method.
message QueryPriceRequest {
string asset = 1;
string source = 2;
uint64 timestamp = 3;
}

// QueryGetPriceResponse is the response type for the Query/GetPriceRequest RPC method.
message QueryGetPriceResponse {
// QueryPriceResponse is the response type for the Query/PriceRequest RPC method.
message QueryPriceResponse {
Price price = 1 [ (gogoproto.nullable) = false ];
}

// QueryAllPriceRequest is the request type for the Query/AllPriceRequest RPC method.
message QueryAllPriceRequest {}
// QueryPriceAllRequest is the request type for the Query/PriceAllRequest RPC method.
message QueryPriceAllRequest {}

// QueryAllPriceResponse is the response type for the Query/AllPriceRequest RPC method.
message QueryAllPriceResponse {
// QueryPriceAllResponse is the response type for the Query/AllPriceRequest RPC method.
message QueryPriceAllResponse {
repeated Price price = 1 [ (gogoproto.nullable) = false ];
}
4 changes: 2 additions & 2 deletions x/oracle/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func GetCmdListPrice() *cobra.Command {
}
queryClient := types.NewQueryClient(clientCtx)

res, err := queryClient.PriceAll(cmd.Context(), &types.QueryAllPriceRequest{})
res, err := queryClient.PriceAll(cmd.Context(), &types.QueryPriceAllRequest{})
return cli.PrintOrErr(res, err, clientCtx)
},
}
Expand All @@ -314,7 +314,7 @@ func CmdShowPrice() *cobra.Command {
}

queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetPriceRequest{
params := &types.QueryPriceRequest{
Asset: args[0],
Source: args[1],
Timestamp: timestamp,
Expand Down
14 changes: 7 additions & 7 deletions x/oracle/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ func (q querier) ValidatorRewardSet(

func (q querier) PriceAll(
goCtx context.Context,
req *types.QueryAllPriceRequest,
) (*types.QueryAllPriceResponse, error) {
req *types.QueryPriceAllRequest,
) (*types.QueryPriceAllResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
Expand All @@ -342,10 +342,10 @@ func (q querier) PriceAll(

prices := q.GetAllPrice(ctx)

return &types.QueryAllPriceResponse{Price: prices}, nil
return &types.QueryPriceAllResponse{Price: prices}, nil
}

func (q querier) Price(goCtx context.Context, req *types.QueryGetPriceRequest) (*types.QueryGetPriceResponse, error) {
func (q querier) Price(goCtx context.Context, req *types.QueryPriceRequest) (*types.QueryPriceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
Expand All @@ -357,7 +357,7 @@ func (q querier) Price(goCtx context.Context, req *types.QueryGetPriceRequest) (
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetPriceResponse{Price: val}, nil
return &types.QueryPriceResponse{Price: val}, nil
}

// if source is specified use latest price from source
Expand All @@ -366,13 +366,13 @@ func (q querier) Price(goCtx context.Context, req *types.QueryGetPriceRequest) (
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetPriceResponse{Price: val}, nil
return &types.QueryPriceResponse{Price: val}, nil
}

// find from any source if band source does not exist
val, found := q.GetLatestPriceFromAnySource(ctx, req.Asset)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
return &types.QueryGetPriceResponse{Price: val}, nil
return &types.QueryPriceResponse{Price: val}, nil
}
Loading

0 comments on commit 3689817

Please sign in to comment.