Skip to content

Commit

Permalink
feat: x/oracle miss counter cli command (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Apr 26, 2022
1 parent c4052f6 commit 4b9c196
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Features
- [835](https://github.com/umee-network/umee/pull/835) Add miss counter query to oracle cli.

### Bug Fixes
- [829](https://github.com/umee-network/umee/pull/829) Fix `umeed tx leverage liquidate` command args

Expand Down
34 changes: 34 additions & 0 deletions x/oracle/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
GetCmdQueryExchangeRates(),
GetCmdQueryExchangeRate(),
GetCmdQueryFeederDelegation(),
GetCmdQueryMissCounter(),
)

return cmd
Expand Down Expand Up @@ -263,3 +264,36 @@ func GetCmdQueryFeederDelegation() *cobra.Command {
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

// GetCmdQueryMissCounter implements the miss counter query command.
func GetCmdQueryMissCounter() *cobra.Command {
cmd := &cobra.Command{
Use: "miss-counter [validator]",
Args: cobra.ExactArgs(1),
Short: "Query the current miss counter for a given validator address",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

_, err = sdk.ValAddressFromBech32(args[0])
if err != nil {
return err
}

res, err := queryClient.MissCounter(context.Background(), &types.QueryMissCounterRequest{
ValidatorAddr: args[0],
})
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}

0 comments on commit 4b9c196

Please sign in to comment.