Setup hooks between laconic modules (#9)

- Implement auction and bond module hooks in registry module
- Code cleanup

Reviewed-on: deep-stack/laconic2d#9
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-02-28 04:34:58 +00:00
committed by ashwin
parent ba7a127d7f
commit c79b7bea7d
33 changed files with 495 additions and 2683 deletions
+14 -4
View File
@@ -10,7 +10,9 @@ import (
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper"
modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/registry/module/v1"
"git.vdb.to/cerc-io/laconic2d/x/auction"
auctionkeeper "git.vdb.to/cerc-io/laconic2d/x/auction/keeper"
"git.vdb.to/cerc-io/laconic2d/x/bond"
bondkeeper "git.vdb.to/cerc-io/laconic2d/x/bond/keeper"
"git.vdb.to/cerc-io/laconic2d/x/registry/keeper"
)
@@ -39,8 +41,8 @@ type ModuleInputs struct {
AccountKeeper auth.AccountKeeper
BankKeeper bank.Keeper
BondKeeper bondkeeper.Keeper
AuctionKeeper auctionkeeper.Keeper
BondKeeper *bondkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper
}
type ModuleOutputs struct {
@@ -48,6 +50,9 @@ type ModuleOutputs struct {
Keeper keeper.Keeper
Module appmodule.AppModule
AuctionHooks auction.AuctionHooksWrapper
BondHooks bond.BondHooksWrapper
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
@@ -56,11 +61,16 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
in.StoreService,
in.AccountKeeper,
in.BankKeeper,
keeper.RecordKeeper{},
in.BondKeeper,
in.AuctionKeeper,
)
m := NewAppModule(in.Cdc, k)
return ModuleOutputs{Module: m, Keeper: k}
recordKeeper := keeper.NewRecordKeeper(in.Cdc, &k, in.AuctionKeeper)
return ModuleOutputs{
Module: m, Keeper: k,
AuctionHooks: auction.AuctionHooksWrapper{AuctionUsageKeeper: recordKeeper},
BondHooks: bond.BondHooksWrapper{BondUsageKeeper: recordKeeper},
}
}