Lorenz Herzberger ec77745fcd
wip: updated machine module
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-06-17 09:29:05 +02:00

56 lines
1.2 KiB
Go

package keeper
import (
"fmt"
"cosmossdk.io/core/store"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/machine/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeService store.KVStoreService
logger log.Logger
// the address capable of executing a MsgUpdateParams message. Typically, this
// should be the x/gov module account.
authority string
rootDir string
}
)
func NewKeeper(
cdc codec.BinaryCodec,
storeService store.KVStoreService,
logger log.Logger,
authority string,
rootDir string,
) Keeper {
if _, err := sdk.AccAddressFromBech32(authority); err != nil {
panic(fmt.Sprintf("invalid authority address: %s", authority))
}
return Keeper{
cdc: cdc,
storeService: storeService,
authority: authority,
logger: logger,
rootDir: rootDir,
}
}
// GetAuthority returns the module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// Logger returns a module-specific logger.
func (k Keeper) Logger() log.Logger {
return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName))
}