From a2a6ea6a5116e6be45c830370e8037d18cec744e Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 6 Oct 2023 15:01:09 -0700 Subject: [PATCH 1/3] fix proto --- docs/openapi/openapi.swagger.yaml | 2 +- proto/fungible/query.proto | 2 +- x/fungible/types/query.pb.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 3c4345f108..dba864cfb5 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27848,7 +27848,7 @@ paths: - Query /zeta-chain/zetacore/fungible/system_contract: get: - summary: Queries a ZetaDepositAndCallContract by index. + summary: Queries SystemContract operationId: Query_SystemContract responses: "200": diff --git a/proto/fungible/query.proto b/proto/fungible/query.proto index 6796836aab..9abb33095c 100644 --- a/proto/fungible/query.proto +++ b/proto/fungible/query.proto @@ -26,7 +26,7 @@ service Query { option (google.api.http).get = "/zeta-chain/zetacore/fungible/foreign_coins"; } - // Queries a ZetaDepositAndCallContract by index. + // Queries SystemContract rpc SystemContract(QueryGetSystemContractRequest) returns (QueryGetSystemContractResponse) { option (google.api.http).get = "/zeta-chain/zetacore/fungible/system_contract"; } diff --git a/x/fungible/types/query.pb.go b/x/fungible/types/query.pb.go index 8c1744410b..f40c319e4e 100644 --- a/x/fungible/types/query.pb.go +++ b/x/fungible/types/query.pb.go @@ -655,7 +655,7 @@ type QueryClient interface { ForeignCoins(ctx context.Context, in *QueryGetForeignCoinsRequest, opts ...grpc.CallOption) (*QueryGetForeignCoinsResponse, error) // Queries a list of ForeignCoins items. ForeignCoinsAll(ctx context.Context, in *QueryAllForeignCoinsRequest, opts ...grpc.CallOption) (*QueryAllForeignCoinsResponse, error) - // Queries a ZetaDepositAndCallContract by index. + // Queries SystemContract SystemContract(ctx context.Context, in *QueryGetSystemContractRequest, opts ...grpc.CallOption) (*QueryGetSystemContractResponse, error) // Queries the address of a gas stability pool on a given chain. GasStabilityPoolAddress(ctx context.Context, in *QueryGetGasStabilityPoolAddress, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolAddressResponse, error) @@ -733,7 +733,7 @@ type QueryServer interface { ForeignCoins(context.Context, *QueryGetForeignCoinsRequest) (*QueryGetForeignCoinsResponse, error) // Queries a list of ForeignCoins items. ForeignCoinsAll(context.Context, *QueryAllForeignCoinsRequest) (*QueryAllForeignCoinsResponse, error) - // Queries a ZetaDepositAndCallContract by index. + // Queries SystemContract SystemContract(context.Context, *QueryGetSystemContractRequest) (*QueryGetSystemContractResponse, error) // Queries the address of a gas stability pool on a given chain. GasStabilityPoolAddress(context.Context, *QueryGetGasStabilityPoolAddress) (*QueryGetGasStabilityPoolAddressResponse, error) From a41be54f70811610c9609048cb567835c6d5ddb7 Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 6 Oct 2023 15:01:37 -0700 Subject: [PATCH 2/3] fix filename --- ...deposit_and_call_contract.go => grpc_query_system_contract.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename x/fungible/keeper/{grpc_query_zeta_deposit_and_call_contract.go => grpc_query_system_contract.go} (100%) diff --git a/x/fungible/keeper/grpc_query_zeta_deposit_and_call_contract.go b/x/fungible/keeper/grpc_query_system_contract.go similarity index 100% rename from x/fungible/keeper/grpc_query_zeta_deposit_and_call_contract.go rename to x/fungible/keeper/grpc_query_system_contract.go From fa38d01eba37090d608a3f679a5805816dd88a34 Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 6 Oct 2023 15:06:27 -0700 Subject: [PATCH 3/3] add cli query --- x/fungible/client/cli/query.go | 1 + .../client/cli/query_system_contract.go | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 x/fungible/client/cli/query_system_contract.go diff --git a/x/fungible/client/cli/query.go b/x/fungible/client/cli/query.go index f4e4e7994e..74b4a55adb 100644 --- a/x/fungible/client/cli/query.go +++ b/x/fungible/client/cli/query.go @@ -30,6 +30,7 @@ func GetQueryCmd(_ string) *cobra.Command { CmdShowForeignCoins(), CmdGasStabilityPoolAddress(), CmdGasStabilityPoolBalance(), + CmdSystemContract(), ) return cmd diff --git a/x/fungible/client/cli/query_system_contract.go b/x/fungible/client/cli/query_system_contract.go new file mode 100644 index 0000000000..df79e833d9 --- /dev/null +++ b/x/fungible/client/cli/query_system_contract.go @@ -0,0 +1,32 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func CmdSystemContract() *cobra.Command { + cmd := &cobra.Command{ + Use: "system-contract", + Short: "query system contract", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.SystemContract(context.Background(), &types.QueryGetSystemContractRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +}