Skip to content

Commit

Permalink
Moved DefaultComputeUnitsPerRelay to service types
Browse files Browse the repository at this point in the history
  • Loading branch information
rBurgett committed Jun 10, 2024
1 parent 4491832 commit 37555c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions x/service/module/tx_add_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package service

import (
"fmt"
"strconv"

"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -9,14 +10,13 @@ import (
"github.com/spf13/cobra"

"github.com/pokt-network/poktroll/x/service/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
)

var _ = strconv.Itoa(0)

func CmdAddService() *cobra.Command {
cmd := &cobra.Command{
Use: "add-service <service_id> <service_name> <compute_units_per_relay>",
Use: fmt.Sprintf("add-service <service_id> <service_name> <compute_units_per_relay: default={%d}>", types.DefaultComputeUnitsPerRelay),
Short: "Add a new service to the network",
Long: `Add a new service to the network that will be available for applications,
gateways and suppliers to use. The service id MUST be unique but the service name doesn't have to be.
Expand All @@ -28,7 +28,7 @@ $ poktrolld tx service add-service "svc1" "service_one" --keyring-backend test -
serviceIdStr := args[0]
serviceNameStr := args[1]

computeUnitsPerRelay := sharedtypes.DefaultComputeUnitsPerRelay
computeUnitsPerRelay := types.DefaultComputeUnitsPerRelay
// if compute units per relay argument is provided
if len(args) > 2 {
computeUnitsPerRelay, err = strconv.ParseUint(args[2], 10, 64)
Expand Down
4 changes: 4 additions & 0 deletions x/service/types/message_add_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"github.com/pokt-network/poktroll/x/shared/types"
)

const (
DefaultComputeUnitsPerRelay uint64 = 1
)

var _ sdk.Msg = (*MsgAddService)(nil)

func NewMsgAddService(address, serviceId, serviceName string, computeUnitsPerRelay uint64) *MsgAddService {
Expand Down
4 changes: 0 additions & 4 deletions x/shared/types/service.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package types

const (
DefaultComputeUnitsPerRelay uint64 = 1
)

// NewService creates a new Service instance
func NewService(id string, name string, computeUnitsPerRelay uint64) *Service {
return &Service{
Expand Down

0 comments on commit 37555c7

Please sign in to comment.