-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,090 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
syntax = "proto3"; | ||
package osmosis.txfees.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
// this line is used by starport scaffolding # 1 | ||
import "google/protobuf/duration.proto"; | ||
|
||
import "osmosis/txfees/v1beta1/feetoken.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/x/txfees/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// this line is used by starport scaffolding # 2 | ||
// GaugeIds takes the pool id and returns the matching gauge ids and durations | ||
rpc FeeTokens(QueryFeeTokensRequest) returns (QueryFeeTokensResponse) { | ||
option (google.api.http).get = "/osmosis/txfees/v1beta1/fee_tokens"; | ||
} | ||
|
||
rpc DenomPoolId(QueryDenomPoolIdRequest) returns (QueryDenomPoolIdResponse) { | ||
option (google.api.http).get = | ||
"/osmosis/txfees/v1beta1/denon_pool_id/{denom}"; | ||
} | ||
|
||
rpc BaseDenom(QueryBaseDenomRequest) returns (QueryBaseDenomResponse) { | ||
option (google.api.http).get = "/osmosis/txfees/v1beta1/base_denom"; | ||
} | ||
} | ||
|
||
message QueryFeeTokensRequest {} | ||
message QueryFeeTokensResponse { | ||
|
||
repeated FeeToken fee_tokens = 1 [ | ||
(gogoproto.moretags) = "yaml:\"fee_tokens\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// this line is used by starport scaffolding # 3 | ||
message QueryDenomPoolIdRequest { | ||
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
} | ||
message QueryDenomPoolIdResponse { | ||
uint64 poolID = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; | ||
} | ||
|
||
message QueryBaseDenomRequest {} | ||
message QueryBaseDenomResponse { | ||
string base_denom = 1 [ (gogoproto.moretags) = "yaml:\"base_denom\"" ]; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,99 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
"strconv" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
// "github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/osmosis-labs/osmosis/x/txfees/types" | ||
) | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/gov/client/cli" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
|
||
var ( | ||
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) | ||
) | ||
|
||
const ( | ||
flagPacketTimeoutTimestamp = "packet-timeout-timestamp" | ||
"github.com/osmosis-labs/osmosis/x/txfees/types" | ||
) | ||
|
||
|
||
// GetTxCmd returns the transaction commands for this module | ||
func GetTxCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
func NewTxCmd() *cobra.Command { | ||
txCmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), | ||
Short: "txfees transaction subcommands", | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
// this line is used by starport scaffolding # 1 | ||
txCmd.AddCommand( | ||
NewCmdSubmitUpdateFeeTokenProposal(), | ||
) | ||
|
||
return txCmd | ||
} | ||
|
||
func NewCmdSubmitUpdateFeeTokenProposal() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "update-fee-token [denom] [poolId]", | ||
Args: cobra.ExactArgs(2), | ||
Short: "Submit an update to a fee token to be usable for tx fees", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
denom := args[0] | ||
pool_id, err := strconv.ParseUint(args[1], 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
feeToken := types.FeeToken{ | ||
Denom: denom, | ||
PoolID: pool_id, | ||
} | ||
|
||
title, err := cmd.Flags().GetString(cli.FlagTitle) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
description, err := cmd.Flags().GetString(cli.FlagDescription) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
from := clientCtx.GetFromAddress() | ||
|
||
depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) | ||
if err != nil { | ||
return err | ||
} | ||
deposit, err := sdk.ParseCoinsNormalized(depositStr) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
content := types.NewUpdateFeeTokenProposal(title, description, feeToken) | ||
|
||
msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err = msg.ValidateBasic(); err != nil { | ||
return err | ||
} | ||
|
||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
cmd.Flags().String(cli.FlagTitle, "", "title of proposal") | ||
cmd.Flags().String(cli.FlagDescription, "", "description of proposal") | ||
cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") | ||
cmd.MarkFlagRequired(cli.FlagTitle) | ||
cmd.MarkFlagRequired(cli.FlagDescription) | ||
|
||
return cmd | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.