syntax = "proto3";
package band.feeds.v1beta1;

option go_package = "github.com/bandprotocol/chain/v3/x/feeds/types";

import "gogoproto/gogo.proto";
import "band/feeds/v1beta1/feeds.proto";
import "band/feeds/v1beta1/params.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";

// Msg defines the feeds Msg service.
service Msg {
  option (cosmos.msg.v1.service) = true;

  // Vote is an RPC method to vote signal ids and their powers.
  rpc Vote(MsgVote) returns (MsgVoteResponse);

  // SubmitSignalPrices is an RPC method to submit signal prices.
  rpc SubmitSignalPrices(MsgSubmitSignalPrices) returns (MsgSubmitSignalPricesResponse);

  // UpdateReferenceSourceConfig is an RPC method to update reference price source configuration.
  rpc UpdateReferenceSourceConfig(MsgUpdateReferenceSourceConfig) returns (MsgUpdateReferenceSourceConfigResponse);

  // UpdateParams is an RPC method to update parameters.
  rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}

// MsgVote is the transaction message to vote signals.
message MsgVote {
  option (cosmos.msg.v1.signer) = "voter";
  option (amino.name)           = "feeds/MsgVote";

  // voter is the address of the voter that wants to vote signals.
  string voter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // signals is a list of submitted signals.
  repeated Signal signals = 2 [(gogoproto.nullable) = false];
}

// MsgVoteResponse is the response type for the Msg/Vote RPC method.
message MsgVoteResponse {}

// MsgSubmitSignalPrices is the transaction message to submit multiple signal prices.
message MsgSubmitSignalPrices {
  option (cosmos.msg.v1.signer) = "validator";
  option (amino.name)           = "feeds/MsgSubmitSignalPrices";

  // validator is the address of the validator that is performing the operation.
  string validator = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];

  // timestamp is the timestamp used as reference for the data.
  int64 timestamp = 2;

  // signal_prices is a list of signal prices to submit.
  repeated SignalPrice signal_prices = 3 [(gogoproto.nullable) = false];
}

// MsgSubmitSignalPricesResponse is the response type for the Msg/SubmitSignalPrices RPC method.
message MsgSubmitSignalPricesResponse {}

// MsgUpdateReferenceSourceConfig is the transaction message to update reference price source's configuration.
message MsgUpdateReferenceSourceConfig {
  option (cosmos.msg.v1.signer) = "admin";
  option (amino.name)           = "feeds/MsgUpdateReferenceSourceConfig";

  // admin is the address of the admin that is performing the operation.
  string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // reference_source_config is the information of reference price source.
  ReferenceSourceConfig reference_source_config = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateReferenceSourceConfigResponse is the response type for the Msg/UpdateReferenceSourceConfig RPC method.
message MsgUpdateReferenceSourceConfigResponse {}

// MsgUpdateParams is the transaction message to update parameters.
message MsgUpdateParams {
  option (cosmos.msg.v1.signer) = "authority";
  option (amino.name)           = "feeds/MsgUpdateParams";

  // authority is the address of the governance account.
  string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // params is the x/feeds parameters to update.
  Params params = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateParamsResponse is the response type for the Msg/UpdateParams RPC method.
message MsgUpdateParamsResponse {}
