mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-07-06 12:42:30 +00:00
56 lines
1.2 KiB
Go
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))
|
|
}
|