Skip to content

Commit

Permalink
Added code comments in proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Nov 13, 2023
1 parent f79cfb3 commit 99abaf0
Show file tree
Hide file tree
Showing 80 changed files with 1,730 additions and 312 deletions.
7 changes: 7 additions & 0 deletions proto/sentinel/deposit/v1/deposit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ option go_package = "github.com/sentinel-official/hub/v1/x/deposit/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// Deposit represents a message for handling deposits.
message Deposit {
// Field 1: Deposit address represented as a string.
string address = 1;

// Field 2: List of coins involved in the deposit.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin coins = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
Expand Down
8 changes: 8 additions & 0 deletions proto/sentinel/deposit/v1/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ option go_package = "github.com/sentinel-official/hub/v1/x/deposit/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// EventAdd represents a message for adding events.
message EventAdd {
// Field 1: Address associated with the event.
string address = 1 [(gogoproto.moretags) = "yaml:\"address\""];

// Field 2: Coins associated with the event.
string coins = 2 [(gogoproto.moretags) = "yaml:\"coins\""];
}

// EventSubtract represents a message for subtracting events.
message EventSubtract {
// Field 1: Address associated with the event.
string address = 1 [(gogoproto.moretags) = "yaml:\"address\""];

// Field 2: Coins associated with the event.
string coins = 2 [(gogoproto.moretags) = "yaml:\"coins\""];
}
13 changes: 13 additions & 0 deletions proto/sentinel/deposit/v1/querier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,41 @@ option go_package = "github.com/sentinel-official/hub/v1/x/deposit/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// QueryDepositsRequest represents a request to query deposits with optional pagination.
message QueryDepositsRequest {
// Field 1: Pagination parameters for the query.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryDepositRequest represents a request to query a specific deposit by address.
message QueryDepositRequest {
// Field 1: Address of the deposit to be queried.
string address = 1;
}

// QueryDepositsResponse represents the response to a query for deposits.
message QueryDepositsResponse {
// Field 1: List of deposits returned in the response.
repeated Deposit deposits = 1 [(gogoproto.nullable) = false];

// Field 2: Pagination details for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryDepositResponse represents the response to a query for a specific deposit.
message QueryDepositResponse {
// Field 1: The queried deposit.
Deposit deposit = 1 [(gogoproto.nullable) = false];
}

// QueryService is the service definition for the deposit module's queries.
service QueryService {
// RPC method for querying deposits with optional pagination.
rpc QueryDeposits(QueryDepositsRequest) returns (QueryDepositsResponse) {
option (google.api.http).get = "/sentinel/deposits";
}

// RPC method for querying a specific deposit by address.
rpc QueryDeposit(QueryDepositRequest) returns (QueryDepositResponse) {
option (google.api.http).get = "/sentinel/deposits/{address}";
}
Expand Down
4 changes: 4 additions & 0 deletions proto/sentinel/mint/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ option go_package = "github.com/sentinel-official/hub/v1/x/mint/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// GenesisState represents the genesis state for the module.
message GenesisState {
// Field 1: List of inflations included in the genesis state.
// - (gogoproto.moretags) = "yaml:\"inflations\"": YAML tag for better representation.
// - (gogoproto.nullable) = false: Field is not nullable.
repeated Inflation inflations = 1 [
(gogoproto.moretags) = "yaml:\"inflations\"",
(gogoproto.nullable) = false
Expand Down
23 changes: 23 additions & 0 deletions proto/sentinel/mint/v1/inflation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,45 @@ option go_package = "github.com/sentinel-official/hub/v1/x/mint/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// Inflation represents a message for handling inflation parameters.
message Inflation {
// Field 1: Maximum inflation rate.
// - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec":
// Custom type definition for the field.
// - (gogoproto.moretags) = "yaml:\"max\"": YAML tag for better representation.
// - (gogoproto.nullable) = false: Field is not nullable.
string max = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"max\"",
(gogoproto.nullable) = false
];

// Field 2: Minimum inflation rate.
// - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec":
// Custom type definition for the field.
// - (gogoproto.moretags) = "yaml:\"min\"": YAML tag for better representation.
// - (gogoproto.nullable) = false: Field is not nullable.
string min = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"min\"",
(gogoproto.nullable) = false
];

// Field 3: Rate of change of inflation.
// - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec":
// Custom type definition for the field.
// - (gogoproto.moretags) = "yaml:\"rate_change\"": YAML tag for better representation.
// - (gogoproto.nullable) = false: Field is not nullable.
string rate_change = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"rate_change\"",
(gogoproto.nullable) = false
];

// Field 4: Timestamp indicating when the inflation parameters were set.
// - (gogoproto.moretags) = "yaml:\"timestamp\"": YAML tag for better representation.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.stdtime) = true: Use standard time representation for Go.
google.protobuf.Timestamp timestamp = 4 [
(gogoproto.moretags) = "yaml:\"timestamp\"",
(gogoproto.nullable) = false,
Expand Down
14 changes: 14 additions & 0 deletions proto/sentinel/node/v2/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,36 @@ option go_package = "github.com/sentinel-official/hub/v1/x/node/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// EventRegister represents an event for registration.
message EventRegister {
// Field 1: Address associated with the registration event.
string address = 1 [(gogoproto.moretags) = "yaml:\"address\""];
}

// EventUpdateDetails represents an event for updating details.
message EventUpdateDetails {
// Field 1: Address associated with the update details event.
string address = 1 [(gogoproto.moretags) = "yaml:\"address\""];
}

// EventUpdateStatus represents an event for updating status.
message EventUpdateStatus {
// Field 1: Status to be updated in the event.
sentinel.types.v1.Status status = 1 [(gogoproto.moretags) = "yaml:\"status\""];

// Field 2: Address associated with the update status event.
string address = 2 [(gogoproto.moretags) = "yaml:\"address\""];
}

// EventCreateSubscription represents an event for creating a subscription.
message EventCreateSubscription {
// Field 1: Address associated with the create subscription event.
string address = 1 [(gogoproto.moretags) = "yaml:\"address\""];

// Field 2: Node address associated with the create subscription event.
string node_address = 2 [(gogoproto.moretags) = "yaml:\"node_address\""];

// Field 3: ID associated with the create subscription event.
uint64 id = 3 [
(gogoproto.customname) = "ID",
(gogoproto.moretags) = "yaml:\"id\""
Expand Down
6 changes: 6 additions & 0 deletions proto/sentinel/node/v2/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ option go_package = "github.com/sentinel-official/hub/v1/x/node/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// GenesisState represents the genesis state for the module.
message GenesisState {
// Field 1: List of nodes included in the genesis state.
// - (gogoproto.nullable) = false: Field is not nullable.
repeated Node nodes = 1 [(gogoproto.nullable) = false];

// Field 2: Parameters associated with the genesis state.
// - (gogoproto.nullable) = false: Field is not nullable.
Params params = 2 [(gogoproto.nullable) = false];
}
66 changes: 56 additions & 10 deletions proto/sentinel/node/v2/msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,112 @@ option go_package = "github.com/sentinel-official/hub/v1/x/node/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// MsgRegisterRequest defines the SDK message for registering a node
// MsgRegisterRequest defines the SDK message for registering a node.
message MsgRegisterRequest {
// Field 1: Sender's address initiating the registration.
string from = 1;

// Field 2: Prices in gigabytes for the registered node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin gigabyte_prices = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 3: Hourly prices for the registered node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin hourly_prices = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 4: Remote URL associated with the registered node.
// - (gogoproto.customname) = "RemoteURL": Custom name for the field.
string remote_url = 4 [(gogoproto.customname) = "RemoteURL"];
}

// MsgUpdateDetailsRequest defines the SDK message for updating the node details
// MsgUpdateDetailsRequest defines the SDK message for updating node details.
message MsgUpdateDetailsRequest {
// Field 1: Sender's address initiating the update.
string from = 1;

// Field 2: Updated prices in gigabytes for the node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin gigabyte_prices = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 3: Updated hourly prices for the node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin hourly_prices = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 4: Updated remote URL for the node.
// - (gogoproto.customname) = "RemoteURL": Custom name for the field.
string remote_url = 4 [(gogoproto.customname) = "RemoteURL"];
}

// MsgUpdateStatusRequest defines the SDK message for updating the node status
// MsgUpdateStatusRequest defines the SDK message for updating node status.
message MsgUpdateStatusRequest {
// Field 1: Sender's address initiating the status update.
string from = 1;

// Field 2: New status for the node.
sentinel.types.v1.Status status = 2;
}

// MsgSubscribeRequest defines the SDK message for subscribe to a node
// MsgSubscribeRequest defines the SDK message for subscribing to a node.
message MsgSubscribeRequest {
// Field 1: Sender's address initiating the subscription.
string from = 1;

// Field 2: Node address to subscribe to.
string node_address = 2;

// Field 3: Number of gigabytes for the subscription.
int64 gigabytes = 3;

// Field 4: Number of hours for the subscription.
int64 hours = 4;

// Field 5: Denomination for the subscription.
string denom = 5;
}

// MsgRegisterResponse defines the response of message MsgRegisterRequest
// MsgRegisterResponse defines the response of message MsgRegisterRequest.
message MsgRegisterResponse {}

// MsgUpdateDetailsResponse defines the response of message
// MsgUpdateDetailsRequest
// MsgUpdateDetailsResponse defines the response of message MsgUpdateDetailsRequest.
message MsgUpdateDetailsResponse {}

// MsgUpdateStatusResponse defines the response of message
// MsgUpdateStatusRequest
// MsgUpdateStatusResponse defines the response of message MsgUpdateStatusRequest.
message MsgUpdateStatusResponse {}

// MsgSubscribeResponse defines the response of message MsgSubscribeRequest
// MsgSubscribeResponse defines the response of message MsgSubscribeRequest.
message MsgSubscribeResponse {}

// MsgService is the service definition for the node module's messages.
service MsgService {
// RPC method for registering a node.
rpc MsgRegister(MsgRegisterRequest) returns (MsgRegisterResponse);

// RPC method for updating node details.
rpc MsgUpdateDetails(MsgUpdateDetailsRequest) returns (MsgUpdateDetailsResponse);

// RPC method for updating node status.
rpc MsgUpdateStatus(MsgUpdateStatusRequest) returns (MsgUpdateStatusResponse);

// RPC method for subscribing to a node.
rpc MsgSubscribe(MsgSubscribeRequest) returns (MsgSubscribeResponse);
}
25 changes: 25 additions & 0 deletions proto/sentinel/node/v2/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,47 @@ option go_package = "github.com/sentinel-official/hub/v1/x/node/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

// Node represents a message for handling node information.
message Node {
// Field 1: Address associated with the node.
string address = 1;

// Field 2: Prices in gigabytes for the node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin gigabyte_prices = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 3: Hourly prices for the node.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins":
// Type to cast to when repeating this field.
repeated cosmos.base.v1beta1.Coin hourly_prices = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];

// Field 4: Remote URL associated with the node.
// - (gogoproto.customname) = "RemoteURL": Custom name for the field.
string remote_url = 4 [(gogoproto.customname) = "RemoteURL"];

// Field 5: Timestamp indicating when the node became inactive.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.stdtime) = true: Use standard time representation for Go.
google.protobuf.Timestamp inactive_at = 5 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
];

// Field 6: Status of the node, using the sentinel.types.v1.Status enum.
sentinel.types.v1.Status status = 6;

// Field 7: Timestamp indicating when the status of the node was last updated.
// - (gogoproto.nullable) = false: Field is not nullable.
// - (gogoproto.stdtime) = true: Use standard time representation for Go.
google.protobuf.Timestamp status_at = 7 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true
Expand Down
Loading

0 comments on commit 99abaf0

Please sign in to comment.