Skip to content

Commit

Permalink
Add ibc fairblock module
Browse files Browse the repository at this point in the history
  • Loading branch information
p0p3yee committed Jan 19, 2023
1 parent e603ce0 commit ddceb4a
Show file tree
Hide file tree
Showing 63 changed files with 9,869 additions and 2,564 deletions.
30 changes: 29 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

fairblockmodule "fairyring/x/fairblock"
fairblockmodulekeeper "fairyring/x/fairblock/keeper"
fairblockmoduletypes "fairyring/x/fairblock/types"
fairyringmodule "fairyring/x/fairyring"
fairyringmodulekeeper "fairyring/x/fairyring/keeper"
fairyringmoduletypes "fairyring/x/fairyring/types"
Expand Down Expand Up @@ -166,6 +169,7 @@ var (
ica.AppModuleBasic{},
vesting.AppModuleBasic{},
fairyringmodule.AppModuleBasic{},
fairblockmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand Down Expand Up @@ -239,7 +243,9 @@ type App struct {
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper

FairyringKeeper fairyringmodulekeeper.Keeper
FairyringKeeper fairyringmodulekeeper.Keeper
ScopedFairblockKeeper capabilitykeeper.ScopedKeeper
FairblockKeeper fairblockmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -285,6 +291,7 @@ func New(
ibctransfertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, group.StoreKey,
icacontrollertypes.StoreKey,
fairyringmoduletypes.StoreKey,
fairblockmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -510,6 +517,20 @@ func New(
)
fairyringModule := fairyringmodule.NewAppModule(appCodec, app.FairyringKeeper, app.AccountKeeper, app.BankKeeper)

scopedFairblockKeeper := app.CapabilityKeeper.ScopeToModule(fairblockmoduletypes.ModuleName)
app.ScopedFairblockKeeper = scopedFairblockKeeper
app.FairblockKeeper = *fairblockmodulekeeper.NewKeeper(
appCodec,
keys[fairblockmoduletypes.StoreKey],
keys[fairblockmoduletypes.MemStoreKey],
app.GetSubspace(fairblockmoduletypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
scopedFairblockKeeper,
)
fairblockModule := fairblockmodule.NewAppModule(appCodec, app.FairblockKeeper, app.AccountKeeper, app.BankKeeper)

fairblockIBCModule := fairblockmodule.NewIBCModule(app.FairblockKeeper)
// this line is used by starport scaffolding # stargate/app/keeperDefinition

// Sealing prevents other modules from creating scoped sub-keepers
Expand All @@ -519,6 +540,7 @@ func New(
ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(fairblockmoduletypes.ModuleName, fairblockIBCModule)
// this line is used by starport scaffolding # ibc/app/router
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -556,6 +578,7 @@ func New(
transferModule,
icaModule,
fairyringModule,
fairblockModule,
// this line is used by starport scaffolding # stargate/app/appModule
)

Expand Down Expand Up @@ -586,6 +609,7 @@ func New(
paramstypes.ModuleName,
vestingtypes.ModuleName,
fairyringmoduletypes.ModuleName,
fairblockmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand All @@ -611,6 +635,7 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
fairyringmoduletypes.ModuleName,
fairblockmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -641,6 +666,7 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
fairyringmoduletypes.ModuleName,
fairblockmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand Down Expand Up @@ -671,6 +697,7 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
transferModule,
fairyringModule,
fairblockModule,
// this line is used by starport scaffolding # stargate/app/appModule
)
app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -870,6 +897,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(fairyringmoduletypes.ModuleName)
paramsKeeper.Subspace(fairblockmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
Loading

0 comments on commit ddceb4a

Please sign in to comment.