2024-02-15 07:08:32 +00:00
|
|
|
package module
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cosmossdk.io/core/appmodule"
|
|
|
|
"cosmossdk.io/core/store"
|
|
|
|
"cosmossdk.io/depinject"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
2024-09-05 07:07:54 +00:00
|
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
2024-02-15 07:08:32 +00:00
|
|
|
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
2024-09-05 07:07:54 +00:00
|
|
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
2024-02-15 07:08:32 +00:00
|
|
|
|
2024-04-01 09:57:26 +00:00
|
|
|
modulev1 "git.vdb.to/cerc-io/laconicd/api/cerc/registry/module/v1"
|
|
|
|
"git.vdb.to/cerc-io/laconicd/x/auction"
|
|
|
|
auctionkeeper "git.vdb.to/cerc-io/laconicd/x/auction/keeper"
|
|
|
|
"git.vdb.to/cerc-io/laconicd/x/bond"
|
|
|
|
bondkeeper "git.vdb.to/cerc-io/laconicd/x/bond/keeper"
|
|
|
|
"git.vdb.to/cerc-io/laconicd/x/registry/keeper"
|
2024-02-15 07:08:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ appmodule.AppModule = AppModule{}
|
|
|
|
|
|
|
|
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
|
|
|
func (am AppModule) IsOnePerModuleType() {}
|
|
|
|
|
|
|
|
// IsAppModule implements the appmodule.AppModule interface.
|
|
|
|
func (am AppModule) IsAppModule() {}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
appmodule.Register(
|
|
|
|
&modulev1.Module{},
|
|
|
|
appmodule.Provide(ProvideModule),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ModuleInputs struct {
|
|
|
|
depinject.In
|
|
|
|
|
2024-09-05 07:07:54 +00:00
|
|
|
Config *modulev1.Module
|
2024-02-15 07:08:32 +00:00
|
|
|
Cdc codec.Codec
|
|
|
|
StoreService store.KVStoreService
|
|
|
|
|
|
|
|
AccountKeeper auth.AccountKeeper
|
|
|
|
BankKeeper bank.Keeper
|
|
|
|
|
2024-02-28 04:34:58 +00:00
|
|
|
BondKeeper *bondkeeper.Keeper
|
|
|
|
AuctionKeeper *auctionkeeper.Keeper
|
2024-02-15 07:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ModuleOutputs struct {
|
|
|
|
depinject.Out
|
|
|
|
|
|
|
|
Keeper keeper.Keeper
|
|
|
|
Module appmodule.AppModule
|
2024-02-28 04:34:58 +00:00
|
|
|
|
|
|
|
AuctionHooks auction.AuctionHooksWrapper
|
|
|
|
BondHooks bond.BondHooksWrapper
|
2024-02-15 07:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
2024-09-05 07:07:54 +00:00
|
|
|
// default to governance authority if not provided
|
|
|
|
authority := authtypes.NewModuleAddress(govtypes.ModuleName)
|
|
|
|
if in.Config.Authority != "" {
|
|
|
|
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
|
|
|
|
}
|
2024-02-15 07:08:32 +00:00
|
|
|
k := keeper.NewKeeper(
|
|
|
|
in.Cdc,
|
|
|
|
in.StoreService,
|
|
|
|
in.AccountKeeper,
|
|
|
|
in.BankKeeper,
|
|
|
|
in.BondKeeper,
|
|
|
|
in.AuctionKeeper,
|
2024-09-05 07:07:54 +00:00
|
|
|
authority.String(),
|
2024-02-15 07:08:32 +00:00
|
|
|
)
|
|
|
|
m := NewAppModule(in.Cdc, k)
|
|
|
|
|
2024-02-28 04:34:58 +00:00
|
|
|
recordKeeper := keeper.NewRecordKeeper(in.Cdc, &k, in.AuctionKeeper)
|
|
|
|
|
|
|
|
return ModuleOutputs{
|
|
|
|
Module: m, Keeper: k,
|
|
|
|
AuctionHooks: auction.AuctionHooksWrapper{AuctionUsageKeeper: recordKeeper},
|
|
|
|
BondHooks: bond.BondHooksWrapper{BondUsageKeeper: recordKeeper},
|
|
|
|
}
|
2024-02-15 07:08:32 +00:00
|
|
|
}
|