Skip to content

Commit

Permalink
removed all-inflows and added quota expires grpc req
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Dec 8, 2023
1 parent c62e569 commit e3f95b9
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 245 deletions.
27 changes: 16 additions & 11 deletions proto/umee/uibc/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "umee/uibc/v1/quota.proto";
import "google/protobuf/timestamp.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/umee-network/umee/v6/x/uibc";
Expand Down Expand Up @@ -35,22 +36,22 @@ service Query {
option (google.api.http).get = "/umee/uibc/v1/inflows";
}

// AllInflows returns inflows for each registered denom in the current quota period.
rpc AllInflows(QueryAllInflows) returns (QueryAllInflowsResponse) {
option (google.api.http).get = "/umee/uibc/v1/all_inflows";
// QuotaExpires returns when current ibc quota will end.
rpc QuotaExpires(QueryQuotaExpires) returns (QueryQuotaExpiresResponse) {
option (google.api.http).get = "/umee/uibc/v1/quota_expires";
}
}

// QueryAllInflows defines request type for query the inflow quota of registered denoms.
message QueryAllInflows {
string denom = 1;
}
message QueryQuotaExpires {}

// QueryAllInflowsResponse defines response type of Query/AllInflows
message QueryAllInflowsResponse {
repeated cosmos.base.v1beta1.DecCoin inflows = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false
message QueryQuotaExpiresResponse {
google.protobuf.Timestamp end_time = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.jsontag) = "end_time,omitempty",
(gogoproto.moretags) = "yaml:\"end_time\""
];
}

Expand All @@ -61,11 +62,15 @@ message QueryInflows {

// QueryInflowsResponse defines response type of Query/Inflows
message QueryInflowsResponse {
string amount = 1 [
string sum = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
repeated cosmos.base.v1beta1.DecCoin inflows = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.DecCoin",
(gogoproto.nullable) = false
];
}

// QueryParams defines the request structure for the Params gRPC service
Expand Down
19 changes: 7 additions & 12 deletions x/uibc/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,26 @@ func GetQueryCmd() *cobra.Command {
QueryParams(),
GetOutflows(),
GetInflows(),
GetAllInflows(),
GetQuotaEndTime(),
)

return cmd
}

// GetAllInflows returns registered IBC denoms inflows in the current quota period.
func GetAllInflows() *cobra.Command {
// GetQuotaEndTime returns end time for the current quota period.
func GetQuotaEndTime() *cobra.Command {
cmd := &cobra.Command{
Use: "all-inflows [denom]",
Args: cobra.MaximumNArgs(1),
Short: "Get the ibc inflows of the registered tokens.",
Use: "quota-end-time",
Args: cobra.NoArgs,
Short: "Get the current ibc quota end time.",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := uibc.NewQueryClient(clientCtx)

req := &uibc.QueryAllInflows{}
if len(args) > 0 && len(args[0]) != 0 {
req.Denom = args[0]
}

resp, err := queryClient.AllInflows(cmd.Context(), req)
resp, err := queryClient.QuotaExpires(cmd.Context(), &uibc.QueryQuotaExpires{})
return cli.PrintOrErr(resp, err, clientCtx)
},
}
Expand Down
Loading

0 comments on commit e3f95b9

Please sign in to comment.