diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 2bd9ef4e4b..185c5305c3 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27889,7 +27889,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/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 +} 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 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)