Auth Module Param Store (#2998)

This commit is contained in:
Alexander Bezobchuk
2018-12-20 11:09:43 -08:00
committed by Jack Zampolin
parent 0c0bff7ea0
commit 217a2925dc
36 changed files with 919 additions and 774 deletions
+9
View File
@@ -17,6 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/ibc"
"github.com/cosmos/cosmos-sdk/x/params"
)
const (
@@ -41,12 +42,15 @@ type BasecoinApp struct {
keyMain *sdk.KVStoreKey
keyAccount *sdk.KVStoreKey
keyIBC *sdk.KVStoreKey
keyParams *sdk.KVStoreKey
tkeyParams *sdk.TransientStoreKey
// manage getting and setting accounts
accountKeeper auth.AccountKeeper
feeCollectionKeeper auth.FeeCollectionKeeper
bankKeeper bank.Keeper
ibcMapper ibc.Mapper
paramsKeeper params.Keeper
}
// NewBasecoinApp returns a reference to a new BasecoinApp given a logger and
@@ -65,12 +69,17 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.Ba
keyMain: sdk.NewKVStoreKey(bam.MainStoreKey),
keyAccount: sdk.NewKVStoreKey(auth.StoreKey),
keyIBC: sdk.NewKVStoreKey("ibc"),
keyParams: sdk.NewKVStoreKey("params"),
tkeyParams: sdk.NewTransientStoreKey("transient_params"),
}
app.paramsKeeper = params.NewKeeper(app.cdc, app.keyParams, app.tkeyParams)
// define and attach the mappers and keepers
app.accountKeeper = auth.NewAccountKeeper(
cdc,
app.keyAccount, // target store
app.paramsKeeper.Subspace(auth.DefaultParamspace),
func() auth.Account {
return &types.AppAccount{}
},