Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(oracle): validator address override option for cli prevotes & votes #1323

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- [1220](https://github.com/umee-network/umee/pull/1220) Submit oracle prevotes / vote txs via the CLI.
- [1222](https://github.com/umee-network/umee/pull/1222) Liquidation reward_denom can now be either token or uToken.
- [1238](https://github.com/umee-network/umee/pull/1238) Added bad debts query.
- [1323](https://github.com/umee-network/umee/pull/1323) Oracle cli - Add validator address override option.

### Improvements

Expand Down
22 changes: 16 additions & 6 deletions x/oracle/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func GetCmdDelegateFeedConsent() *cobra.Command {
// broadcast a transaction with a MsgAggregateExchangeRatePrevote message.
func GetCmdAggregateExchangeRatePrevote() *cobra.Command {
cmd := &cobra.Command{
Use: "exchange-rate-prevote [hash]",
Args: cobra.ExactArgs(1),
Use: "exchange-rate-prevote [hash] [validator-address]",
Args: cobra.MinimumNArgs(1),
Short: "Submit an exchange rate prevote with a hash",
Long: fmt.Sprintf(`Submit an exchange rate prevote with a hash as a hex string
representation of a byte array.
Expand All @@ -90,10 +90,15 @@ func GetCmdAggregateExchangeRatePrevote() *cobra.Command {
return err
}

valAddress := sdk.ValAddress(clientCtx.GetFromAddress())
if len(args) > 1 {
valAddress = sdk.ValAddress(args[1])
}

msg := types.NewMsgAggregateExchangeRatePrevote(
hash,
clientCtx.GetFromAddress(),
sdk.ValAddress(clientCtx.GetFromAddress()),
valAddress,
)

if err := msg.ValidateBasic(); err != nil {
Expand All @@ -113,8 +118,8 @@ func GetCmdAggregateExchangeRatePrevote() *cobra.Command {
// broadcast a transaction with a NewMsgAggregateExchangeRateVote message.
func GetCmdAggregateExchangeRateVote() *cobra.Command {
cmd := &cobra.Command{
Use: "exchange-rate-vote [salt] [exchange-rates]",
Args: cobra.ExactArgs(2),
Use: "exchange-rate-vote [salt] [exchange-rates] [validator-address]",
Args: cobra.MinimumNArgs(2),
Short: "Submit an exchange rate vote with the salt and exchange rate string",
Long: fmt.Sprintf(`Submit an exchange rate vote with the salt of the previous hash, and the
exchange rate string previously used in the hash.
Expand All @@ -128,11 +133,16 @@ func GetCmdAggregateExchangeRateVote() *cobra.Command {
return err
}

valAddress := sdk.ValAddress(clientCtx.GetFromAddress())
if len(args) > 2 {
valAddress = sdk.ValAddress(args[2])
}

msg := types.NewMsgAggregateExchangeRateVote(
args[0],
args[1],
clientCtx.GetFromAddress(),
sdk.ValAddress(clientCtx.GetFromAddress()),
valAddress,
)

if err := msg.ValidateBasic(); err != nil {
Expand Down