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

chore: fix typos #50

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions x/operators/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ import (

// GetQueryCmd returns the command allowing to perform queries
func GetQueryCmd() *cobra.Command {
servicesQueryCmd := &cobra.Command{
queryCmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

servicesQueryCmd.AddCommand(
queryCmd.AddCommand(
getCmdQueryOperator(),
getCmdQueryOperators(),
getCmdQueryParams(),
)

return servicesQueryCmd
return queryCmd
}

// getCmdQueryOperator returns the command allowing to query an operator
func getCmdQueryOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "operator [service-id]",
Use: "operator [operator-id]",
Short: "Query the operator with the given id",
Example: fmt.Sprintf(`%s query %s operator 1`, version.AppName, types.ModuleName),
Args: cobra.ExactArgs(2),
Expand All @@ -45,12 +45,12 @@ func getCmdQueryOperator() *cobra.Command {
}
queryClient := types.NewQueryClient(clientCtx)

serviceID, err := types.ParseOperatorID(args[0])
operatorID, err := types.ParseOperatorID(args[0])
if err != nil {
return err
}

res, err := queryClient.Operator(context.Background(), types.NewQueryOperatorRequest(serviceID))
res, err := queryClient.Operator(context.Background(), types.NewQueryOperatorRequest(operatorID))
if err != nil {
return err
}
Expand All @@ -64,7 +64,7 @@ func getCmdQueryOperator() *cobra.Command {
return cmd
}

// getCmdQueryOperators returns the command allowing to query services
// getCmdQueryOperators returns the command allowing to query operators
func getCmdQueryOperators() *cobra.Command {
cmd := &cobra.Command{
Use: "operators",
Expand Down
26 changes: 13 additions & 13 deletions x/operators/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ const (
flagPicture = "picture"
)

// GetTxCmd returns a new command to perform services transactions
// GetTxCmd returns a new command to perform operators transactions
func GetTxCmd() *cobra.Command {
subspacesTxCmd := &cobra.Command{
txCmd := &cobra.Command{
Use: types.ModuleName,
Short: "Operators transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

subspacesTxCmd.AddCommand(
txCmd.AddCommand(
GetCmdRegisterOperator(),
GetCmdEditOperator(),
GetCmdDeactivateOperator(),
)

return subspacesTxCmd
return txCmd
}

// GetCmdRegisterOperator returns the command allowing to register a new operator
func GetCmdRegisterOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "register [name]",
Args: cobra.ExactArgs(1),
Short: "Register a new service",
Long: `Register a new service having the given name.
Short: "Register a new operator",
Long: `Register a new operator having the given name.

You can specify a website and a picture URL using the optional flags.
The operator will be created with the sender as the admin.`,
Expand Down Expand Up @@ -81,8 +81,8 @@ The operator will be created with the sender as the admin.`,
},
}

cmd.Flags().String(flagWebsite, "", "The website of the service (optional)")
cmd.Flags().String(flagPicture, "", "The picture URL of the service (optional)")
cmd.Flags().String(flagWebsite, "", "The website of the operator (optional)")
cmd.Flags().String(flagPicture, "", "The picture URL of the operator (optional)")

flags.AddTxFlagsToCmd(cmd)

Expand Down Expand Up @@ -142,21 +142,21 @@ Only the fields that you provide will be updated`,
},
}

cmd.Flags().String(flagMoniker, types.DoNotModify, "The new moniker of the service (optional)")
cmd.Flags().String(flagWebsite, types.DoNotModify, "The new website of the service (optional)")
cmd.Flags().String(flagPicture, types.DoNotModify, "The new picture URL of the service (optional)")
cmd.Flags().String(flagMoniker, types.DoNotModify, "The new moniker of the operator (optional)")
cmd.Flags().String(flagWebsite, types.DoNotModify, "The new website of the operator (optional)")
cmd.Flags().String(flagPicture, types.DoNotModify, "The new picture URL of the operator (optional)")

flags.AddTxFlagsToCmd(cmd)

return cmd
}

// GetCmdDeactivateOperator returns the command allowing to deactivate an existing service
// GetCmdDeactivateOperator returns the command allowing to deactivate an existing operator
func GetCmdDeactivateOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "deactivate [id]",
Args: cobra.ExactArgs(1),
Short: "deactivate an existing service",
Short: "deactivate an existing operator",
Example: fmt.Sprintf(`%s tx %s deactivate 1 --from alice`, version.AppName, types.ModuleName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
Expand Down
6 changes: 3 additions & 3 deletions x/operators/keeper/alias_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func (k *Keeper) IterateOperators(ctx sdk.Context, cb func(operator types.Operat
}
}

// GetOperators returns the services stored in the KVStore
// GetOperators returns the operators stored in the KVStore
func (k *Keeper) GetOperators(ctx sdk.Context) []types.Operator {
var operators []types.Operator
k.IterateOperators(ctx, func(service types.Operator) (stop bool) {
operators = append(operators, service)
k.IterateOperators(ctx, func(operator types.Operator) (stop bool) {
operators = append(operators, operator)
return false
})
return operators
Expand Down
2 changes: 1 addition & 1 deletion x/operators/types/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// Event Hooks
// These can be utilized to communicate between an operators keeper
// and another keeper which must take particular actions when
// services change state. The second keeper must implement this
// operators change state. The second keeper must implement this
// interface, which then the operators keeper can call.

// OperatorsHooks event hooks for operators objects (noalias)
Expand Down
10 changes: 5 additions & 5 deletions x/pools/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ import (

// GetQueryCmd returns the command allowing to perform queries
func GetQueryCmd() *cobra.Command {
servicesQueryCmd := &cobra.Command{
queryCmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

servicesQueryCmd.AddCommand(
queryCmd.AddCommand(
getCmdQueryPoolByID(),
getCmdQueryPoolByDenom(),
getCmdQueryPools(),
)

return servicesQueryCmd
return queryCmd
}

// getCmdQueryPoolByID returns the command allowing to query a service
// getCmdQueryPoolByID returns the command allowing to query a pool
func getCmdQueryPoolByID() *cobra.Command {
cmd := &cobra.Command{
Use: "pool [pool-id]",
Expand Down Expand Up @@ -63,7 +63,7 @@ func getCmdQueryPoolByID() *cobra.Command {
return cmd
}

// getCmdQueryPoolByDenom returns the command allowing to query services
// getCmdQueryPoolByDenom returns the command allowing to query pool by denom
func getCmdQueryPoolByDenom() *cobra.Command {
cmd := &cobra.Command{
Use: "pool-by-denom [denom]",
Expand Down
16 changes: 8 additions & 8 deletions x/pools/keeper/pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
"github.com/milkyway-labs/milkyway/x/pools/types"
)

// SetNextPoolID sets the next service ID to be used when registering a new Pool
func (k *Keeper) SetNextPoolID(ctx sdk.Context, serviceID uint32) {
// SetNextPoolID sets the next pool ID to be used when registering a new Pool
func (k *Keeper) SetNextPoolID(ctx sdk.Context, poolID uint32) {
store := ctx.KVStore(k.storeKey)
store.Set(types.NextPoolIDKey, types.GetPoolIDBytes(serviceID))
store.Set(types.NextPoolIDKey, types.GetPoolIDBytes(poolID))
}

// GetNextPoolID returns the next service ID to be used when registering a new Pool
func (k *Keeper) GetNextPoolID(ctx sdk.Context) (serviceID uint32, err error) {
// GetNextPoolID returns the next pool ID to be used when registering a new Pool
func (k *Keeper) GetNextPoolID(ctx sdk.Context) (poolID uint32, err error) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.NextPoolIDKey)
if bz == nil {
return 0, errors.Wrapf(types.ErrInvalidGenesis, "initial service id not set")
return 0, errors.Wrapf(types.ErrInvalidGenesis, "initial pool id not set")
}

serviceID = types.GetPoolIDFromBytes(bz)
return serviceID, nil
poolID = types.GetPoolIDFromBytes(bz)
return poolID, nil
}

// --------------------------------------------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions x/services/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ const (

// GetTxCmd returns a new command to perform services transactions
func GetTxCmd() *cobra.Command {
subspacesTxCmd := &cobra.Command{
txCmd := &cobra.Command{
Use: types.ModuleName,
Short: "Services transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

subspacesTxCmd.AddCommand(
txCmd.AddCommand(
GetCmdCreateService(),
GetCmdUpdateService(),
GetCmdActivateService(),
GetCmdDeactivateService(),
)

return subspacesTxCmd
return txCmd
}

// GetCmdCreateService returns the command allowing to create a new service
Expand Down
6 changes: 3 additions & 3 deletions x/services/types/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ func (s Service) SharesFromTokens(tokens sdk.Coin) (sdkmath.LegacyDec, error) {

sharesDenom := s.GetSharesDenom(tokens.Denom)
delegatorTokenShares := s.DelegatorShares.AmountOf(sharesDenom)
operatorTokenAmount := s.Tokens.AmountOf(tokens.Denom)
serviceTokenAmount := s.Tokens.AmountOf(tokens.Denom)

return delegatorTokenShares.MulInt(tokens.Amount).QuoInt(operatorTokenAmount), nil
return delegatorTokenShares.MulInt(tokens.Amount).QuoInt(serviceTokenAmount), nil
}

// AddTokensFromDelegation adds the given amount of tokens to the service's total tokens,
Expand All @@ -123,7 +123,7 @@ func (s Service) AddTokensFromDelegation(amount sdk.Coins) (Service, sdk.DecCoin

delegatorShares := s.DelegatorShares.AmountOf(sharesDenom)
if delegatorShares.IsZero() {
// The first delegation to an operator sets the exchange rate to one
// The first delegation to a service sets the exchange rate to one
tokenShares = sdk.NewDecCoin(sharesDenom, token.Amount)
} else {
shares, err := s.SharesFromTokens(token)
Expand Down
Loading