Adds authz to app.go (#1178)

* wip on adding authz to app.go

* Wip build working

Co-authored-by: DracoLi <draco@dracoli.com>
This commit is contained in:
Thomas Constantine Moore 2022-04-21 16:34:14 -04:00 committed by GitHub
parent c511c56560
commit de0e164632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,9 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -168,6 +171,7 @@ var (
ibc.AppModuleBasic{}, ibc.AppModuleBasic{},
upgrade.AppModuleBasic{}, upgrade.AppModuleBasic{},
evidence.AppModuleBasic{}, evidence.AppModuleBasic{},
authzmodule.AppModuleBasic{},
transfer.AppModuleBasic{}, transfer.AppModuleBasic{},
vesting.AppModuleBasic{}, vesting.AppModuleBasic{},
evm.AppModuleBasic{}, evm.AppModuleBasic{},
@ -257,6 +261,7 @@ type App struct {
distrKeeper distrkeeper.Keeper distrKeeper distrkeeper.Keeper
govKeeper govkeeper.Keeper govKeeper govkeeper.Keeper
paramsKeeper paramskeeper.Keeper paramsKeeper paramskeeper.Keeper
authzKeeper authzkeeper.Keeper
crisisKeeper crisiskeeper.Keeper crisisKeeper crisiskeeper.Keeper
slashingKeeper slashingkeeper.Keeper slashingKeeper slashingkeeper.Keeper
ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
@ -326,7 +331,7 @@ func NewApp(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey,
upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey,
evmtypes.StoreKey, feemarkettypes.StoreKey, evmtypes.StoreKey, feemarkettypes.StoreKey, authzkeeper.StoreKey,
capabilitytypes.StoreKey, kavadisttypes.StoreKey, auctiontypes.StoreKey, capabilitytypes.StoreKey, kavadisttypes.StoreKey, auctiontypes.StoreKey,
issuancetypes.StoreKey, bep3types.StoreKey, pricefeedtypes.StoreKey, issuancetypes.StoreKey, bep3types.StoreKey, pricefeedtypes.StoreKey,
swaptypes.StoreKey, cdptypes.StoreKey, hardtypes.StoreKey, swaptypes.StoreKey, cdptypes.StoreKey, hardtypes.StoreKey,
@ -406,6 +411,9 @@ func NewApp(
app.bankKeeper, app.bankKeeper,
stakingSubspace, stakingSubspace,
) )
app.authzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter())
app.mintKeeper = mintkeeper.NewKeeper( app.mintKeeper = mintkeeper.NewKeeper(
appCodec, appCodec,
keys[minttypes.StoreKey], keys[minttypes.StoreKey],
@ -646,6 +654,7 @@ func NewApp(
transferModule, transferModule,
vesting.NewAppModule(app.accountKeeper, app.bankKeeper), vesting.NewAppModule(app.accountKeeper, app.bankKeeper),
params.NewAppModule(app.paramsKeeper), params.NewAppModule(app.paramsKeeper),
authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry),
kavadist.NewAppModule(app.kavadistKeeper, app.accountKeeper), kavadist.NewAppModule(app.kavadistKeeper, app.accountKeeper),
auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.bankKeeper), auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.bankKeeper),
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper), issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper),
@ -677,6 +686,7 @@ func NewApp(
slashingtypes.ModuleName, slashingtypes.ModuleName,
evidencetypes.ModuleName, evidencetypes.ModuleName,
stakingtypes.ModuleName, stakingtypes.ModuleName,
authz.ModuleName,
feemarkettypes.ModuleName, feemarkettypes.ModuleName,
evmtypes.ModuleName, evmtypes.ModuleName,
kavadisttypes.ModuleName, kavadisttypes.ModuleName,
@ -702,6 +712,7 @@ func NewApp(
crisistypes.ModuleName, crisistypes.ModuleName,
govtypes.ModuleName, govtypes.ModuleName,
stakingtypes.ModuleName, stakingtypes.ModuleName,
authz.ModuleName,
evmtypes.ModuleName, evmtypes.ModuleName,
// fee market module must go after evm module in order to retrieve the block gas used. // fee market module must go after evm module in order to retrieve the block gas used.
feemarkettypes.ModuleName, feemarkettypes.ModuleName,
@ -741,6 +752,7 @@ func NewApp(
minttypes.ModuleName, minttypes.ModuleName,
ibchost.ModuleName, ibchost.ModuleName,
evidencetypes.ModuleName, evidencetypes.ModuleName,
authz.ModuleName,
ibctransfertypes.ModuleName, ibctransfertypes.ModuleName,
evmtypes.ModuleName, feemarkettypes.ModuleName, evmtypes.ModuleName, feemarkettypes.ModuleName,
kavadisttypes.ModuleName, kavadisttypes.ModuleName,